use of org.freeplane.features.styles.AutomaticLayoutController in project freeplane by freeplane.
the class EdgeController method getStyleEdgeColorRule.
private ObjectRule<Color, Rules> getStyleEdgeColorRule(NodeModel node) {
MapModel map = node.getMap();
Collection<IStyle> collection = LogicalStyleController.getController(modeController).getStyles(node);
final MapStyleModel styles = MapStyleModel.getExtension(map);
for (IStyle styleKey : collection) {
final NodeModel styleNode = styles.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
if (node != styleNode && map.getRootNode().containsExtension(AutomaticEdgeColor.class)) {
AutomaticLayoutController automaticLayoutController = modeController.getExtension(AutomaticLayoutController.class);
if (automaticLayoutController != null && automaticLayoutController.isAutomaticLevelStyle(styleNode)) {
continue;
}
}
ObjectRule<Color, Rules> nodeColor = getNodeColorRule(styleNode);
if (nodeColor != null)
return nodeColor;
}
return null;
}
use of org.freeplane.features.styles.AutomaticLayoutController 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.features.styles.AutomaticLayoutController in project freeplane by freeplane.
the class HeadlessMModeControllerFactory method createAddIns.
private void createAddIns() {
new HierarchicalIcons();
new AutomaticLayoutController();
new BlinkingNodeHook();
SummaryNode.install();
new AlwaysUnfoldedNode();
FreeNode.install();
new AutomaticEdgeColorHook();
new ViewerController();
MEncryptionController.install(new MEncryptionController(modeController));
new ChangeNodeLevelController(modeController);
NodeHistory.install(modeController);
modeController.addAction(new ImportMindmanagerFiles());
}
use of org.freeplane.features.styles.AutomaticLayoutController in project freeplane by freeplane.
the class StyleControlGroup method setStyle.
@Override
public void setStyle(NodeModel node) {
internalChange = true;
try {
final LogicalStyleController logicalStyleController = LogicalStyleController.getController();
if (addStyleBox) {
final boolean isStyleSet = LogicalStyleModel.getStyle(node) != null;
mSetStyle.setValue(isStyleSet);
setStyleList(mMapStyleButton, logicalStyleController.getMapStyleNames(node, "\n"));
}
setStyleList(mNodeStyleButton, logicalStyleController.getNodeStyleNames(node, "\n"));
if (mAutomaticLayoutComboBox != null) {
final ModeController modeController = Controller.getCurrentModeController();
AutomaticLayoutController al = modeController.getExtension(AutomaticLayoutController.class);
IExtension extension = al.getExtension(node);
if (extension == null)
mAutomaticLayoutComboBox.setSelectedItem(AUTOMATIC_LAYOUT_DISABLED);
else
mAutomaticLayoutComboBox.setSelectedIndex(((AutomaticLayout) extension).ordinal());
}
if (mAutomaticEdgeColorComboBox != null) {
final ModeController modeController = Controller.getCurrentModeController();
AutomaticEdgeColorHook al = (AutomaticEdgeColorHook) modeController.getExtension(AutomaticEdgeColorHook.class);
final AutomaticEdgeColor extension = (AutomaticEdgeColor) al.getExtension(node);
if (extension == null) {
mAutomaticEdgeColorComboBox.setSelectedItem(AUTOMATIC_LAYOUT_DISABLED);
mEditEdgeColorsBtn.setEnabled(false);
} else {
mAutomaticEdgeColorComboBox.setSelectedIndex(extension.rule.ordinal());
mEditEdgeColorsBtn.setEnabled(true);
}
}
} finally {
internalChange = false;
}
}
use of org.freeplane.features.styles.AutomaticLayoutController in project freeplane by freeplane.
the class EdgeColorsConfigurationFactory method createNewConfiguration.
private EdgeColorConfiguration createNewConfiguration(MapModel map) {
ArrayList<Color> colors = new ArrayList<>();
AutomaticLayoutController automaticLayoutController = modeController.getExtension(AutomaticLayoutController.class);
EdgeController edgeController = modeController.getExtension(EdgeController.class);
for (int levelStyleCounter = 0; ; levelStyleCounter++) {
NodeModel styleNode = automaticLayoutController.getStyleNode(map, levelStyleCounter);
if (styleNode == null)
break;
colors.add(edgeController.getColor(styleNode));
}
return new EdgeColorConfiguration(colors);
}
Aggregations