Search in sources :

Example 11 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class MapViewController method setMapTitles.

public void setMapTitles() {
    final ModeController modeController = Controller.getCurrentModeController();
    if (modeController == null) {
        controller.getViewController().setTitle("");
        return;
    }
    final Object[] messageArguments = { TextUtils.getText(("mode_" + modeController.getModeName())) };
    final MessageFormat formatter = new MessageFormat(TextUtils.getText("mode_title"));
    String frameTitle = formatter.format(messageArguments);
    String viewName = "";
    final MapModel model = getModel();
    if (model != null) {
        viewName = getMapViewComponent().getName();
        frameTitle = viewName + ((model.isSaved() || model.isReadOnly()) ? "" : "*") + " - " + frameTitle + (model.isReadOnly() ? " (" + TextUtils.getText("read_only") + ")" : "");
        final File file = model.getFile();
        if (file != null) {
            frameTitle += " " + file.getAbsolutePath();
        }
    }
    controller.getViewController().setTitle(frameTitle);
    modeController.getUserInputListenerFactory().updateMapList();
}
Also used : MessageFormat(java.text.MessageFormat) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) File(java.io.File)

Example 12 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class NodeView method getEdgeColor.

public Color getEdgeColor() {
    if (edgeColor.hasValue())
        return edgeColor.getValue();
    Rules rule = edgeColor.getRule();
    if (rule == EdgeController.Rules.BY_COLUMN) {
        final Color color = new AutomaticEdgeStyle(this).getColor();
        edgeColor.setCache(color);
        return color;
    }
    final NodeModel parentNode = model.getParentNode();
    if (rule == EdgeController.Rules.BY_BRANCH && parentNode.isRoot() || rule == EdgeController.Rules.BY_LEVEL) {
        final int index;
        if (rule == EdgeController.Rules.BY_BRANCH)
            index = parentNode.getIndex(model) + 1;
        else
            index = model.getNodeLevel(false) + (model.isHiddenSummary() ? 1 : 0);
        final MapModel mapModel = map.getModel();
        ModeController modeController = map.getModeController();
        EdgeController edgeController = modeController.getExtension(EdgeController.class);
        if (edgeController.areEdgeColorsAvailable(mapModel)) {
            Color color = edgeController.getEdgeColor(mapModel, index);
            edgeColor.setCache(color);
            return color;
        }
    } else if (rule == EdgeController.Rules.BY_PARENT) {
        final NodeView parentView = getParentView();
        if (parentView != null) {
            final Color color = parentView.getEdgeColor();
            return color;
        }
    }
    return Color.GRAY;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) AutomaticEdgeStyle(org.freeplane.view.swing.map.edge.AutomaticEdgeStyle) EdgeController(org.freeplane.features.edge.EdgeController) Color(java.awt.Color) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController) INodeView(org.freeplane.features.map.INodeView) Rules(org.freeplane.features.edge.EdgeController.Rules) Point(java.awt.Point)

Example 13 with MapModel

use of org.freeplane.features.map.MapModel 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 14 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class FindAction method findNext.

void findNext(Direction direction) {
    final MapModel map = Controller.getCurrentController().getMap();
    final FoundNodes info = FoundNodes.get(map);
    if (info.condition == null) {
        displayNoPreviousFindMessage();
        return;
    }
    final FilterController filterController = FilterController.getCurrentFilterController();
    final NodeModel start = Controller.getCurrentController().getSelection().getSelected();
    final NodeModel root = map.getNodeForID(info.rootID);
    if (root == null) {
        info.condition = null;
        displayNoPreviousFindMessage();
        return;
    }
    final NodeModel next = filterController.findNext(start, null, direction, info.condition);
    if (next == null) {
        displayNotFoundMessage(root, info.condition);
        return;
    }
    info.displayFoundNode(next);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapModel(org.freeplane.features.map.MapModel)

Example 15 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class FoundNodes method displayFoundNode.

/**
 * Display a node in the display (used by find and the goto action by arrow
 * link actions).
 */
void displayFoundNode(final NodeModel node) {
    final MapModel map = node.getMap();
    final LinkedList<String> nodesUnfoldedByDisplay = new LinkedList<String>();
    NodeModel nodeOnPath = null;
    for (nodeOnPath = node; nodeOnPath != null && !this.nodesUnfoldedByDisplay.contains(nodeOnPath.createID()); nodeOnPath = nodeOnPath.getParentNode()) {
        if (Controller.getCurrentModeController().getMapController().isFolded(nodeOnPath)) {
            nodesUnfoldedByDisplay.add(nodeOnPath.createID());
        }
    }
    final ListIterator<String> oldPathIterator = this.nodesUnfoldedByDisplay.listIterator(this.nodesUnfoldedByDisplay.size());
    while (oldPathIterator.hasPrevious()) {
        final String oldPathNodeID = oldPathIterator.previous();
        final NodeModel oldPathNode = map.getNodeForID(oldPathNodeID);
        if (oldPathNode != null && oldPathNode.equals(nodeOnPath)) {
            break;
        }
        oldPathIterator.remove();
        if (oldPathNode != null) {
            Controller.getCurrentModeController().getMapController().fold(oldPathNode);
        }
    }
    this.nodesUnfoldedByDisplay.addAll(nodesUnfoldedByDisplay);
    Controller.getCurrentModeController().getMapController().select(node);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapModel(org.freeplane.features.map.MapModel) LinkedList(java.util.LinkedList)

Aggregations

MapModel (org.freeplane.features.map.MapModel)161 NodeModel (org.freeplane.features.map.NodeModel)53 ModeController (org.freeplane.features.mode.ModeController)42 Controller (org.freeplane.features.mode.Controller)34 IActor (org.freeplane.core.undo.IActor)31 File (java.io.File)18 AttributeRegistry (org.freeplane.features.attribute.AttributeRegistry)17 MMapModel (org.freeplane.features.map.mindmapmode.MMapModel)17 IUndoHandler (org.freeplane.core.undo.IUndoHandler)16 URL (java.net.URL)14 MMapController (org.freeplane.features.map.mindmapmode.MMapController)14 IStyle (org.freeplane.features.styles.IStyle)14 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)14 MapController (org.freeplane.features.map.MapController)12 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)12 IMapViewManager (org.freeplane.features.ui.IMapViewManager)12 MapStyleModel (org.freeplane.features.styles.MapStyleModel)10 IOException (java.io.IOException)9 MalformedURLException (java.net.MalformedURLException)9 URI (java.net.URI)9