Search in sources :

Example 1 with IPropertyControl

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

the class StyleEditorPanel method init.

/**
 * Creates all controls and adds them to the frame.
 * @param modeController
 */
private void init() {
    final String form = "right:max(20dlu;p), 2dlu, p, 1dlu,right:max(20dlu;p), 4dlu, 80dlu, 7dlu";
    final FormLayout rightLayout = new FormLayout(form, "");
    final DefaultFormBuilder formBuilder = new DefaultFormBuilder(rightLayout);
    formBuilder.border(Paddings.DLU2);
    new SeparatorProperty("OptionPanel.separator.NodeStyle").layout(formBuilder);
    final List<IPropertyControl> controls = new ArrayList<IPropertyControl>();
    for (ControlGroup controlGroup : controlGroups) {
        controlGroup.addControlGroup(formBuilder);
    }
    add(formBuilder.getPanel(), BorderLayout.CENTER);
    addListeners();
    setFont(this, FONT_SIZE);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) SeparatorProperty(org.freeplane.core.resources.components.SeparatorProperty) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) ArrayList(java.util.ArrayList) IPropertyControl(org.freeplane.core.resources.components.IPropertyControl)

Example 2 with IPropertyControl

use of org.freeplane.core.resources.components.IPropertyControl 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.getTranslationValueLabel());
                keyProperty.setIcon(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 3 with IPropertyControl

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

the class OptionPanelController method getCurrentOptionProperties.

public Properties getCurrentOptionProperties() {
    final Properties p = new Properties();
    Vector<IPropertyControl> controls = this.propertyControls;
    for (final IPropertyControl control : controls) {
        if (control instanceof PropertyBean) {
            final PropertyBean bean = (PropertyBean) control;
            final String value = bean.getValue();
            if (value != null) {
                p.setProperty(bean.getName(), value);
            }
        }
    }
    return p;
}
Also used : IPropertyControl(org.freeplane.core.resources.components.IPropertyControl) Properties(java.util.Properties) PropertyBean(org.freeplane.core.resources.components.PropertyBean)

Example 4 with IPropertyControl

use of org.freeplane.core.resources.components.IPropertyControl 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() {

        @Override
        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);
    optionPanelBuilder.addCreator("Environment/files/skip_template_selection", new IPropertyControlCreator() {

        @Override
        public IPropertyControl createControl() {
            final Collection<String> templates = collectAvailableMapTemplates();
            ComboProperty comboProperty = new ComboProperty(STANDARD_TEMPLATE, templates, templates);
            comboProperty.setEditable(true);
            return comboProperty;
        }
    }, IndexedTree.BEFORE);
}
Also used : ComboProperty(org.freeplane.core.resources.components.ComboProperty) IPropertyControlCreator(org.freeplane.core.resources.components.IPropertyControlCreator) Set(java.util.Set) TreeSet(java.util.TreeSet) OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) Collection(java.util.Collection) IPropertyControl(org.freeplane.core.resources.components.IPropertyControl) LinkedList(java.util.LinkedList) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Aggregations

IPropertyControl (org.freeplane.core.resources.components.IPropertyControl)4 ArrayList (java.util.ArrayList)2 IPropertyControlCreator (org.freeplane.core.resources.components.IPropertyControlCreator)2 OptionPanelBuilder (org.freeplane.core.resources.components.OptionPanelBuilder)2 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)2 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 Collection (java.util.Collection)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 ComboProperty (org.freeplane.core.resources.components.ComboProperty)1 KeyProperty (org.freeplane.core.resources.components.KeyProperty)1 PropertyBean (org.freeplane.core.resources.components.PropertyBean)1 SeparatorProperty (org.freeplane.core.resources.components.SeparatorProperty)1 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)1 IIconInformation (org.freeplane.features.icon.IIconInformation)1