⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mindmapcontroller.java

📁 思维导图(Mind Mapping)以放射性思考(Radiant Thinking)为基础的收放自如方式
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*FreeMind - A Program for creating and viewing Mindmaps *Copyright (C) 2000-2001  Joerg Mueller <joergmueller@bigfoot.com> *See COPYING for Details * *This program is free software; you can redistribute it and/or *modify it under the terms of the GNU General Public License *as published by the Free Software Foundation; either version 2 *of the License, or (at your option) any later version. * *This program is distributed in the hope that it will be useful, *but WITHOUT ANY WARRANTY; without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *GNU General Public License for more details. * *You should have received a copy of the GNU General Public License *along with this program; if not, write to the Free Software *Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *//*$Id: MindMapController.java,v 1.35.14.13 2005/06/16 19:27:05 christianfoltin Exp $*/package freemind.modes.mindmapmode;import java.awt.event.ActionEvent;import java.io.File;import java.io.IOException;import java.io.InputStream;import java.lang.reflect.Constructor;import java.net.MalformedURLException;import java.net.URL;import java.util.HashMap;import java.util.HashSet;import java.util.Iterator;import java.util.List;import java.util.ListIterator;import java.util.Vector;import java.util.logging.Logger;import javax.swing.AbstractAction;import javax.swing.Action;import javax.swing.JFileChooser;import javax.swing.JMenu;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPopupMenu;import javax.swing.JRadioButtonMenuItem;import javax.swing.JToolBar;import javax.swing.KeyStroke;import javax.swing.filechooser.FileFilter;import javax.xml.bind.JAXBException;import javax.xml.bind.Unmarshaller;import freemind.common.JaxbTools;import freemind.controller.MenuBar;import freemind.controller.StructuredMenuHolder;import freemind.controller.actions.generated.instance.MenuActionBase;import freemind.controller.actions.generated.instance.MenuCategoryBase;import freemind.controller.actions.generated.instance.MenuCheckedAction;import freemind.controller.actions.generated.instance.MenuSeparator;import freemind.controller.actions.generated.instance.MenuStructure;import freemind.controller.actions.generated.instance.MenuSubmenu;import freemind.extensions.HookFactory;import freemind.extensions.HookRegistration;import freemind.extensions.HookFactory.RegistrationContainer;import freemind.main.Tools;import freemind.modes.ControllerAdapter;import freemind.modes.MapAdapter;import freemind.modes.MindIcon;import freemind.modes.MindMap;import freemind.modes.MindMapNode;import freemind.modes.Mode;import freemind.modes.ModeController;import freemind.modes.NodeAdapter;import freemind.modes.actions.ChangeArrowsInArrowLinkAction;import freemind.modes.actions.ColorArrowLinkAction;import freemind.modes.actions.FindAction;import freemind.modes.actions.GotoLinkNodeAction;import freemind.modes.actions.IconAction;import freemind.modes.actions.ImportExplorerFavoritesAction;import freemind.modes.actions.ImportFolderStructureAction;import freemind.modes.actions.NewMapAction;import freemind.modes.actions.NewPreviousSiblingAction;import freemind.modes.actions.NewSiblingAction;import freemind.modes.actions.NodeGeneralAction;import freemind.modes.actions.NodeHookAction;import freemind.modes.actions.RemoveArrowLinkAction;import freemind.modes.actions.SingleNodeOperation;public class MindMapController extends ControllerAdapter {	private static Logger logger;	private Vector hookActions;	/** Stores the menu items belonging to the given action. */	private HashMap actionToMenuPositions;	//    Mode mode;    private MindMapPopupMenu popupmenu;    //private JToolBar toolbar;    private MindMapToolBar toolbar;    private boolean addAsChildMode = false;   public Action newMap = new NewMapAction(this, this);   public Action open = new OpenAction(this);   public Action save = new SaveAction(this);   public Action saveAs = new SaveAsAction(this);   public Action exportToHTML = new ExportToHTMLAction(this);   public Action exportBranchToHTML = new ExportBranchToHTMLAction(this);   public Action editLong = new EditLongAction();   public Action newSibling = new NewSiblingAction(this);   public Action newPreviousSibling = new NewPreviousSiblingAction(this);   public Action setLinkByFileChooser = new SetLinkByFileChooserAction();   public Action setImageByFileChooser = new SetImageByFileChooserAction();   public Action followLink = new FollowLinkAction();   public Action exportBranch = new ExportBranchAction();   public Action importBranch = new ImportBranchAction();   public Action importLinkedBranch = new ImportLinkedBranchAction();   public Action importLinkedBranchWithoutRoot = new ImportLinkedBranchWithoutRootAction();    public Action increaseNodeFont = new NodeGeneralAction (this, "increase_node_font_size", null,       new SingleNodeOperation() { public void apply(MindMapMapModel map, MindMapNodeModel node) {           increaseFontSize(node, 1);    }});    public Action decreaseNodeFont = new NodeGeneralAction (this, "decrease_node_font_size", null,       new SingleNodeOperation() { public void apply(MindMapMapModel map, MindMapNodeModel node) {           increaseFontSize(node, -1);    }});    // Extension Actions    public Vector iconActions = new Vector(); //fc    FileFilter filefilter = new MindMapFilter();    private MenuStructure mMenuStructure;    private List pRegistrations;    public MindMapController(Mode mode) {	super(mode);	if(logger == null) {		logger = getFrame().getLogger(this.getClass().getName());	}	logger.info("createIconActions");        // icon actions:        createIconActions();    	logger.info("createNodeHookActions");        //node hook actions:        createNodeHookActions();    	logger.info("mindmap_menus");        // load menus:        try {            InputStream in;            in = this.getFrame().getResource("mindmap_menus.xml").openStream();            mMenuStructure = updateMenusFromXml(in);        } catch (IOException e) {            // TODO Auto-generated catch block            e.printStackTrace();        }    	logger.info("MindMapPopupMenu");        popupmenu = new MindMapPopupMenu(this);    	logger.info("MindMapToolBar");        toolbar = new MindMapToolBar(this);    	logger.info("setAllActions");        setAllActions(false);        // addAsChildMode (use old model of handling CtrN) (PN)        addAsChildMode =            Tools.safeEquals(getFrame().getProperty("add_as_child"), "true");        pRegistrations = new Vector();    }    /** This method is called after and before a change of the map module.     * Use it to perform the actions that cannot be performed at creation time.     *      */    public void startupController() {		super.startupController();		HookFactory hookFactory = getFrame().getHookFactory();		List pluginRegistratios = hookFactory.getRegistrations(this.getClass());		logger.info("mScheduledActions are executed: "				+ pluginRegistratios.size());		for (Iterator i = pluginRegistratios.iterator(); i.hasNext();) {			// call constructor:			try {				HookFactory.RegistrationContainer container = (RegistrationContainer) i						.next();				Class registrationClass = container.hookRegistrationClass;				Constructor hookConstructor = registrationClass						.getConstructor(new Class[] { ModeController.class,								MindMap.class });				HookRegistration registrationInstance = (HookRegistration) hookConstructor						.newInstance(new Object[] { this, getMap() });				// register the instance to enable basePlugins.				hookFactory.registerRegistrationContainer(container,						registrationInstance);				registrationInstance.register();				pRegistrations.add(registrationInstance);			} catch (Exception e) {				e.printStackTrace();			}		}	}    public void shutdownController() {        super.shutdownController();        for (Iterator i = pRegistrations.iterator(); i.hasNext();) {            HookRegistration registrationInstance = (HookRegistration) i.next();            registrationInstance.deRegister();        }    }    	public MapAdapter newModel() {       return new MindMapMapModel(getFrame()); }    private void createIconActions() {        Vector iconNames = MindIcon.getAllIconNames();        for ( int i = 0 ; i < iconNames.size(); ++i ) {            String iconName = ((String) iconNames.get(i));            MindIcon myIcon     = MindIcon.factory(iconName);            IconAction myAction = new IconAction(this, myIcon,removeLastIconAction);            iconActions.add(myAction);        }    }	/**	 * 	 */	private void createNodeHookActions() {		actionToMenuPositions = new HashMap();        if (hookActions == null) {            hookActions = new Vector();            // HOOK TEST            HookFactory factory = getFrame().getHookFactory();            List list = factory.getPossibleNodeHooks(this.getClass());            for (Iterator i = list.iterator(); i.hasNext();) {                String desc = (String) i.next();                // create hook action.                 NodeHookAction action = new NodeHookAction(desc, this);                factory.decorateAction(desc, action);                actionToMenuPositions.put(action, factory.getHookMenuPositions(desc));                hookActions.add(action);            }            List hooks =                factory.getPossibleModeControllerHooks(this.getClass());            for (Iterator i = hooks.iterator(); i.hasNext();) {                String desc = (String) i.next();                ModeControllerHookAction action =                    new ModeControllerHookAction(desc, this);                factory.decorateAction(desc, action);			   actionToMenuPositions.put(action, factory.getHookMenuPositions(desc));                hookActions.add(action);            }            //HOOK TEST END       	    }	}    public FileFilter getFileFilter() {       return filefilter; }    public void nodeChanged(MindMapNode n) {    	super.nodeChanged(n);    	// only for the selected node (fc, 2.5.2004)		if (n == getSelected()) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -