private JComponent createActionPanel(ModeController modeController) { AFreeplaneAction exportPresentationAction = modeController.getAction("ExportPresentationAction"); AFreeplaneAction exportAllPresentationsAction = modeController.getAction("ExportAllPresentationsAction"); JPanel controlButtons = new JPanel(new GridLayout(3, 1)); JButton btnExportPresentation = new JButton(exportPresentationAction); btnExportPresentation.setAlignmentX(JButton.CENTER_ALIGNMENT); controlButtons.add(btnExportPresentation); JButton btnExportAllPresentations = new JButton(exportAllPresentationsAction); btnExportAllPresentations.setAlignmentX(JButton.CENTER_ALIGNMENT); controlButtons.add(btnExportAllPresentations); AFreeplaneAction configureAction = modeController.getAction("ShowPreferencesAction"); JButton btnConfigure = new JButton(configureAction); btnConfigure.setActionCommand(OptionPanel.OPTION_PANEL_RESOURCE_PREFIX + "Presentation"); btnConfigure.setAlignmentX(JButton.CENTER_ALIGNMENT); controlButtons.add(btnConfigure); final Dimension maximumSize = new Dimension(controlButtons.getPreferredSize()); maximumSize.width = Integer.MAX_VALUE; controlButtons.setMaximumSize(maximumSize); return controlButtons; }
@Override public void addControlGroup(DefaultFormBuilder formBuilder) { if (addStyleBox) { addAutomaticLayout(formBuilder); addStyleBox(formBuilder); } mNodeStyleButton = addStyleButton(formBuilder, "actual_node_styles", modeController.getAction(ManageNodeConditionalStylesAction.NAME)); if (addStyleBox) { mMapStyleButton = addStyleButton(formBuilder, "actual_map_styles", modeController.getAction(ManageMapConditionalStylesAction.NAME)); } }
public void setAnchorID(final String anchorID) { this.anchorID = anchorID; final String tooltip; AFreeplaneAction setLinkAnchorAction = modeController.getAction("SetLinkAnchorAction"); final boolean anchored = isAnchored(); if(anchored) tooltip = TextUtils.format(setLinkAnchorAction.getTooltipKey() + "_anchored", anchorID); else tooltip = TextUtils.getRawText(setLinkAnchorAction.getTooltipKey()); setLinkAnchorAction.putValue(Action.SHORT_DESCRIPTION, tooltip); setLinkAnchorAction.putValue(Action.LONG_DESCRIPTION, tooltip); setLinkAnchorAction.setSelected(anchored); modeController.getAction("ClearLinkAnchorAction").setEnabled(anchored); modeController.getAction("MakeLinkToAnchorAction").setEnabled(anchored); modeController.getAction("MakeLinkFromAnchorAction").setEnabled(anchored); }
private void updateIconToolbar(ModeController modeController) { iconToolBar.removeAll(); iconToolBar.add(modeController.getAction("RemoveIcon_0_Action")) .setAlignmentX(JComponent.CENTER_ALIGNMENT); iconToolBar.add(modeController.getAction("RemoveIconAction")).setAlignmentX(JComponent.CENTER_ALIGNMENT); iconToolBar.add(modeController.getAction("RemoveAllIconsAction")).setAlignmentX( JComponent.CENTER_ALIGNMENT); iconToolBar.addSeparator(); if (ResourceController.getResourceController().getBooleanProperty("structured_icon_toolbar")) { insertSubmenus(iconToolBar); return; } final String[] fpIcons = ResourceController.getResourceController().getProperty("icons.list").split(";"); for (final String icon : fpIcons) { final MindIcon mindIcon = STORE.getMindIcon(icon); final AFreeplaneAction iconAction = iconActions.get(mindIcon); iconToolBar.add(iconAction).setAlignmentX(JComponent.CENTER_ALIGNMENT); } final Collection<MindIcon> userIcons = STORE.getUserIcons(); for (final MindIcon icon : userIcons) { final AFreeplaneAction iconAction = iconActions.get(icon); iconToolBar.add(iconAction).setAlignmentX(JComponent.CENTER_ALIGNMENT); } }
public void actionPerformed(final ActionEvent e) { final ModeController modeController = Controller.getCurrentModeController(); ArrayList<IIconInformation> actions = new ArrayList<IIconInformation>(); final Controller controller = Controller.getCurrentController(); actions.add((IIconInformation) modeController.getAction("RemoveIcon_0_Action")); actions.add((IIconInformation) modeController.getAction("RemoveIconAction")); actions.add((IIconInformation) modeController.getAction("RemoveAllIconsAction")); final MIconController mIconController = (MIconController) IconController.getController(); for (AFreeplaneAction aFreeplaneAction : mIconController.getIconActions()) actions.add((IIconInformation) aFreeplaneAction); final IconSelectionPopupDialog selectionDialog = new IconSelectionPopupDialog(UITools.getCurrentFrame(), actions); final NodeModel selected = controller.getSelection().getSelected(); controller.getMapViewManager().scrollNodeToVisible(selected); selectionDialog.pack(); UITools.setDialogLocationRelativeTo(selectionDialog, selected); selectionDialog.setModal(true); selectionDialog.show(); final int result = selectionDialog.getResult(); if (result >= 0) { final Action action = (Action) actions.get(result); action.actionPerformed(new ActionEvent(action, 0, NodeModel.NODE_ICON, selectionDialog.getModifiers())); } } }
keyStroke = null; final AFreeplaneAction action = modeController.getAction(itemKey); if (action != null) { setAccelerator(modeController, action, keyStroke);
private boolean isMenuEvent(KeyEvent e) { if (!editLong) { AFreeplaneAction editLongAcction = modeController.getAction("EditLongAction"); KeyStroke accelerator = ResourceController.getResourceController().getAcceleratorManager() .getAccelerator(editLongAcction); if (accelerator != null) { final KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e); if (accelerator.equals(keyStroke)) { return true; } } } return false; }
@Override public void setSaved(final MapModel mapModel, final boolean saved) { final boolean setTitle = saved != mapModel.isSaved() || mapModel.isReadOnly(); mapModel.setSaved(saved); if (setTitle) { final Controller controller = Controller.getCurrentController(); controller.getMapViewManager().setMapTitles(); final AFreeplaneAction saveAction = controller.getModeController().getAction("SaveAction"); if(saveAction != null) saveAction.setEnabled(); } }
final Action action = modeController.getAction(actionKey);
private AFreeplaneAction createAction(final String scriptName, final String scriptPath, ExecutionMode executionMode, final ScriptMetaData metaData, final String title) { final String key = ExecuteScriptAction.makeMenuItemKey(scriptName, executionMode); final AFreeplaneAction alreadyRegisteredAction = modeController.getAction(key); if (alreadyRegisteredAction == null) { String longTitle = createTooltip(title, executionMode); String menuItemTitle = hasMultipleExcecutionModes(metaData) ? longTitle : title; AFreeplaneAction action = new ExecuteScriptAction(scriptName, menuItemTitle, scriptPath, executionMode, metaData.getPermissions()); action.putValue(Action.SHORT_DESCRIPTION, longTitle); action.putValue(Action.LONG_DESCRIPTION, longTitle); modeController.addAction(action); return action; } else { return alreadyRegisteredAction; } }