Search in sources :

Example 1 with OptionPanelBuilder

use of org.freeplane.core.resources.components.OptionPanelBuilder in project freeplane by freeplane.

the class ManageAddOnsPanel method createConfigureAction.

private AbstractAction createConfigureAction(final AddOnTableModel tableModel) {
    return new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            final int row = Integer.parseInt(e.getActionCommand());
            final AddOnProperties addOn = tableModel.getAddOnAt(row);
            if (!addOn.supportsOperation(AddOnProperties.OP_CONFIGURE)) {
                JOptionPane.showMessageDialog(ManageAddOnsPanel.this, getText("cannot.configure", addOn.getTranslatedName()), "Freeplane", JOptionPane.ERROR_MESSAGE);
            } else {
                OptionPanelBuilder optionPanelBuilder = new OptionPanelBuilder();
                optionPanelBuilder.load(new StringReader(addOn.getPreferencesXml()));
                MModeController.createPropertyAction(optionPanelBuilder).actionPerformed(e);
            }
        }
    };
}
Also used : OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) ActionEvent(java.awt.event.ActionEvent) StringReader(java.io.StringReader) AbstractAction(javax.swing.AbstractAction) AddOnProperties(org.freeplane.main.addons.AddOnProperties)

Example 2 with OptionPanelBuilder

use of org.freeplane.core.resources.components.OptionPanelBuilder in project freeplane by freeplane.

the class MModeController method createOptionPanelControls.

private void createOptionPanelControls() {
    optionPanelBuilder = new OptionPanelBuilder();
    final ResourceController resourceController = ResourceController.getResourceController();
    URL preferences = resourceController.getResource("/xml/preferences.xml");
    optionPanelBuilder.load(preferences);
    addAction(createPropertyAction(optionPanelBuilder));
}
Also used : OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) ResourceController(org.freeplane.core.resources.ResourceController) URL(java.net.URL)

Example 3 with OptionPanelBuilder

use of org.freeplane.core.resources.components.OptionPanelBuilder in project freeplane by freeplane.

the class MIconController method createPreferences.

private void createPreferences() {
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    final OptionPanelBuilder optionPanelBuilder = modeController.getOptionPanelBuilder();
    final List<AFreeplaneAction> actions = new ArrayList<AFreeplaneAction>();
    actions.addAll(iconActions.values());
    actions.add(modeController.getAction("RemoveIcon_0_Action"));
    actions.add(modeController.getAction("RemoveIconAction"));
    actions.add(modeController.getAction("RemoveAllIconsAction"));
    for (final AFreeplaneAction iconAction : actions) {
        final IIconInformation info = (IIconInformation) iconAction;
        optionPanelBuilder.addCreator("Keystrokes/icons", new IPropertyControlCreator() {

            public IPropertyControl createControl() {
                final KeyProperty keyProperty = new KeyProperty(info.getShortcutKey(), info.getTranslationKeyLabel());
                keyProperty.setImageIcon(info.getIcon());
                keyProperty.disableModifiers();
                return keyProperty;
            }
        }, IndexedTree.AS_CHILD);
    }
}
Also used : IPropertyControlCreator(org.freeplane.core.resources.components.IPropertyControlCreator) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) ArrayList(java.util.ArrayList) IIconInformation(org.freeplane.features.icon.IIconInformation) IPropertyControl(org.freeplane.core.resources.components.IPropertyControl) KeyProperty(org.freeplane.core.resources.components.KeyProperty) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 4 with OptionPanelBuilder

use of org.freeplane.core.resources.components.OptionPanelBuilder in project freeplane by freeplane.

the class MFileManager method createPreferences.

private void createPreferences() {
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    final OptionPanelBuilder optionPanelBuilder = modeController.getOptionPanelBuilder();
    optionPanelBuilder.addCreator("Environment/load", new IPropertyControlCreator() {

        public IPropertyControl createControl() {
            final Set<String> charsets = Charset.availableCharsets().keySet();
            final LinkedList<String> charsetList = new LinkedList<String>(charsets);
            charsetList.addFirst("JVMdefault");
            final LinkedList<String> charsetTranslationList = new LinkedList<String>(charsets);
            charsetTranslationList.addFirst(TextUtils.getText("OptionPanel.default"));
            return new ComboProperty("default_charset", charsetList, charsetTranslationList);
        }
    }, IndexedTree.AS_CHILD);
}
Also used : ComboProperty(org.freeplane.core.resources.components.ComboProperty) IPropertyControlCreator(org.freeplane.core.resources.components.IPropertyControlCreator) Set(java.util.Set) OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) IPropertyControl(org.freeplane.core.resources.components.IPropertyControl) LinkedList(java.util.LinkedList) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Aggregations

OptionPanelBuilder (org.freeplane.core.resources.components.OptionPanelBuilder)4 IPropertyControl (org.freeplane.core.resources.components.IPropertyControl)2 IPropertyControlCreator (org.freeplane.core.resources.components.IPropertyControlCreator)2 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)2 ActionEvent (java.awt.event.ActionEvent)1 StringReader (java.io.StringReader)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 AbstractAction (javax.swing.AbstractAction)1 ResourceController (org.freeplane.core.resources.ResourceController)1 ComboProperty (org.freeplane.core.resources.components.ComboProperty)1 KeyProperty (org.freeplane.core.resources.components.KeyProperty)1 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)1 IIconInformation (org.freeplane.features.icon.IIconInformation)1 AddOnProperties (org.freeplane.main.addons.AddOnProperties)1