public void xmlActionPerformed(ActionEvent e) { if (singleNodeOperation != null) { for (ListIterator it = modeController.getSelecteds().listIterator(); it.hasNext(); ) { MindMapNodeModel selected = (MindMapNodeModel) it.next(); singleNodeOperation.apply((MindMapMapModel) this.modeController.getMap(), selected); } } else { // xml action: // Do-action CompoundAction doAction = new CompoundAction(); // Undo-action CompoundAction undo = new CompoundAction(); // sort selectedNodes list by depth, in order to guarantee that // sons are deleted first: for (ListIterator it = modeController.getSelecteds().listIterator(); it.hasNext(); ) { MindMapNodeModel selected = (MindMapNodeModel) it.next(); ActionPair pair = actor.apply(this.modeController.getMap(), selected); if (pair != null) { doAction.addChoice(pair.getDoAction()); undo.addAtChoice(0, pair.getUndoAction()); } } if (doAction.sizeChoiceList() == 0) return; modeController.getActionFactory().startTransaction((String) getValue(NAME)); modeController.getActionFactory().executeAction(new ActionPair(doAction, undo)); modeController.getActionFactory().endTransaction((String) getValue(NAME)); } }
private void removeIcon(MindMapNode node, MindIcon icon, boolean removeFirst) { final ActionPair removeIconActionPair = getRemoveIconActionPair(node, icon, removeFirst); if (removeIconActionPair == null) { return; } modeController.getActionFactory().startTransaction((String) getValue(NAME)); modeController.getActionFactory().executeAction(removeIconActionPair); modeController.getActionFactory().endTransaction((String) getValue(NAME)); }
public void togglePrintAction() { if (!mPrintActionHandler.containsKey(modeController)) { PrintActionHandler printActionHandler = new freemind.modes.mindmapmode.actions.xml.PrintActionHandler(modeController); modeController.getActionFactory().registerHandler(printActionHandler); mPrintActionHandler.put(modeController, printActionHandler); } else { modeController .getActionFactory() .deregisterHandler((ActionHandler) mPrintActionHandler.get(modeController)); } }
public IconAction( MindMapController controller, MindIcon _icon, RemoveIconAction removeLastIconAction) { super(_icon.getDescription(), _icon.getIcon(), controller); this.modeController = controller; this.removeLastIconAction = removeLastIconAction; putValue(Action.SHORT_DESCRIPTION, _icon.getDescription()); this.icon = _icon; controller.getActionFactory().registerActor(this, getDoActionClass()); }
protected void execute(ActionPair pair) { modeController.getActionFactory().executeAction(pair); }
private void toggleIcon(MindMapNode node, MindIcon icon) { modeController.getActionFactory().startTransaction((String) getValue(NAME)); modeController.getActionFactory().executeAction(getToggleIconActionPair(node, icon)); modeController.getActionFactory().endTransaction((String) getValue(NAME)); }
public void addIcon(MindMapNode node, MindIcon icon) { modeController.getActionFactory().startTransaction((String) getValue(NAME)); modeController.getActionFactory().executeAction(getAddLastIconActionPair(node, icon)); modeController.getActionFactory().endTransaction((String) getValue(NAME)); }