Search in sources :

Example 1 with AutomaticLayoutController

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;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color) MapModel(org.freeplane.features.map.MapModel)

Example 2 with AutomaticLayoutController

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);
}
Also used : AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) AutomaticLayout(org.freeplane.features.styles.AutomaticLayout) TranslatedObject(org.freeplane.core.resources.TranslatedObject) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) ModeController(org.freeplane.features.mode.ModeController) JComboBoxWithBorder(org.freeplane.core.ui.components.JComboBoxWithBorder)

Example 3 with AutomaticLayoutController

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());
}
Also used : BlinkingNodeHook(org.freeplane.view.swing.features.BlinkingNodeHook) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) MEncryptionController(org.freeplane.features.encrypt.mindmapmode.MEncryptionController) AutomaticEdgeColorHook(org.freeplane.features.edge.AutomaticEdgeColorHook) ImportMindmanagerFiles(org.freeplane.features.export.mindmapmode.ImportMindmanagerFiles) ChangeNodeLevelController(org.freeplane.features.map.mindmapmode.ChangeNodeLevelController) HierarchicalIcons(org.freeplane.features.icon.HierarchicalIcons) AlwaysUnfoldedNode(org.freeplane.features.map.AlwaysUnfoldedNode) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController)

Example 4 with AutomaticLayoutController

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;
    }
}
Also used : AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) AutomaticEdgeColorHook(org.freeplane.features.edge.AutomaticEdgeColorHook) IExtension(org.freeplane.core.extension.IExtension) AutomaticLayout(org.freeplane.features.styles.AutomaticLayout) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) ModeController(org.freeplane.features.mode.ModeController) AutomaticEdgeColor(org.freeplane.features.edge.AutomaticEdgeColor)

Example 5 with AutomaticLayoutController

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);
}
Also used : AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) NodeModel(org.freeplane.features.map.NodeModel) Color(java.awt.Color) ArrayList(java.util.ArrayList)

Aggregations

AutomaticLayoutController (org.freeplane.features.styles.AutomaticLayoutController)7 AutomaticEdgeColorHook (org.freeplane.features.edge.AutomaticEdgeColorHook)3 ViewerController (org.freeplane.view.swing.features.filepreview.ViewerController)3 Color (java.awt.Color)2 MEncryptionController (org.freeplane.features.encrypt.mindmapmode.MEncryptionController)2 ImportMindmanagerFiles (org.freeplane.features.export.mindmapmode.ImportMindmanagerFiles)2 HierarchicalIcons (org.freeplane.features.icon.HierarchicalIcons)2 AlwaysUnfoldedNode (org.freeplane.features.map.AlwaysUnfoldedNode)2 NodeModel (org.freeplane.features.map.NodeModel)2 ChangeNodeLevelController (org.freeplane.features.map.mindmapmode.ChangeNodeLevelController)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 AccessControlException (java.security.AccessControlException)1 ArrayList (java.util.ArrayList)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 JComponent (javax.swing.JComponent)1 JPopupMenu (javax.swing.JPopupMenu)1 JScrollPane (javax.swing.JScrollPane)1 IExtension (org.freeplane.core.extension.IExtension)1