use of org.freeplane.core.ui.components.JComboBoxWithBorder in project freeplane by freeplane.
the class StyleControlGroup method addStyleControls.
private void addStyleControls(final DefaultFormBuilder formBuilder) {
TranslatedObject[] automaticLayoutTypes = TranslatedObject.fromEnum(AutomaticLayout.class);
mAutomaticLayoutComboBox = new JComboBoxWithBorder(automaticLayoutTypes);
DefaultComboBoxModel automaticLayoutComboBoxModel = (DefaultComboBoxModel) mAutomaticLayoutComboBox.getModel();
automaticLayoutComboBoxModel.addElement(AUTOMATIC_LAYOUT_DISABLED);
automaticLayoutComboBoxModel.setSelectedItem(AUTOMATIC_LAYOUT_DISABLED);
mAutomaticLayoutComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (internalChange)
return;
final ModeController modeController = Controller.getCurrentModeController();
AutomaticLayoutController al = modeController.getExtension(AutomaticLayoutController.class);
TranslatedObject selectedItem = (TranslatedObject) mAutomaticLayoutComboBox.getSelectedItem();
al.undoableDeactivateHook(Controller.getCurrentController().getMap().getRootNode());
if (!selectedItem.equals(AUTOMATIC_LAYOUT_DISABLED)) {
al.undoableActivateHook(Controller.getCurrentController().getMap().getRootNode(), (AutomaticLayout) selectedItem.getObject());
}
}
});
appendLabeledComponent(formBuilder, "AutomaticLayoutAction.text", mAutomaticLayoutComboBox);
}
use of org.freeplane.core.ui.components.JComboBoxWithBorder in project freeplane by freeplane.
the class StyleControlGroup method addEdgeColoringControls.
private void addEdgeColoringControls(final DefaultFormBuilder formBuilder) {
TranslatedObject[] automaticLayoutTypes = TranslatedObject.fromEnum(AutomaticEdgeColor.class.getSimpleName() + ".", AutomaticEdgeColor.Rule.class);
mAutomaticEdgeColorComboBox = new JComboBoxWithBorder(automaticLayoutTypes);
DefaultComboBoxModel automaticEdgeColorComboBoxModel = (DefaultComboBoxModel) mAutomaticEdgeColorComboBox.getModel();
automaticEdgeColorComboBoxModel.addElement(AUTOMATIC_LAYOUT_DISABLED);
automaticEdgeColorComboBoxModel.setSelectedItem(AUTOMATIC_LAYOUT_DISABLED);
mAutomaticEdgeColorComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (internalChange)
return;
final ModeController modeController = Controller.getCurrentModeController();
AutomaticEdgeColorHook hook = modeController.getExtension(AutomaticEdgeColorHook.class);
TranslatedObject selectedItem = (TranslatedObject) mAutomaticEdgeColorComboBox.getSelectedItem();
final MapModel map = Controller.getCurrentController().getMap();
final AutomaticEdgeColor oldExtension = (AutomaticEdgeColor) hook.getMapHook(map);
final int colorCount = oldExtension == null ? 0 : oldExtension.getColorCounter();
final NodeModel rootNode = map.getRootNode();
hook.undoableDeactivateHook(rootNode);
if (!selectedItem.equals(AUTOMATIC_LAYOUT_DISABLED)) {
final AutomaticEdgeColor newExtension = new AutomaticEdgeColor((AutomaticEdgeColor.Rule) selectedItem.getObject(), colorCount);
hook.undoableActivateHook(rootNode, newExtension);
}
}
});
appendLabeledComponent(formBuilder, "AutomaticEdgeColorHookAction.text", mAutomaticEdgeColorComboBox);
mEditEdgeColorsBtn = TranslatedElementFactory.createButton("editEdgeColors");
mEditEdgeColorsBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final MEdgeController edgeController = (MEdgeController) modeController.getExtension(EdgeController.class);
edgeController.editEdgeColorConfiguration(Controller.getCurrentController().getMap());
}
});
formBuilder.appendLineGapRow();
formBuilder.nextLine();
formBuilder.appendRow(FormSpecs.PREF_ROWSPEC);
formBuilder.setColumn(1);
formBuilder.append(mEditEdgeColorsBtn, 7);
formBuilder.nextLine();
}
Aggregations