Search in sources :

Example 1 with EdgeModel

use of org.freeplane.features.edge.EdgeModel in project freeplane by freeplane.

the class EdgeStyleAction method setSelected.

@Override
public void setSelected() {
    final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
    final EdgeModel model = EdgeModel.getModel(node);
    if (model != null) {
        if (mStyle.equals(model.getStyle())) {
            setSelected(true);
            return;
        }
    }
    setSelected(false);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 2 with EdgeModel

use of org.freeplane.features.edge.EdgeModel in project freeplane by freeplane.

the class EdgeWidthAction method setSelected.

@Override
public void setSelected() {
    final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
    final EdgeModel model = EdgeModel.getModel(node);
    if (model == null) {
        if (mWidth == EdgeModel.WIDTH_PARENT) {
            setSelected(true);
            return;
        }
    } else if (model.getWidth() == mWidth) {
        setSelected(true);
        return;
    }
    setSelected(false);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 3 with EdgeModel

use of org.freeplane.features.edge.EdgeModel in project freeplane by freeplane.

the class MEdgeController method setWidth.

public void setWidth(final NodeModel node, final int width) {
    final ModeController modeController = Controller.getCurrentModeController();
    final int oldWidth = EdgeModel.createEdgeModel(node).getWidth();
    if (width == oldWidth) {
        return;
    }
    final IActor actor = new IActor() {

        public void act() {
            EdgeModel.createEdgeModel(node).setWidth(width);
            modeController.getMapController().nodeChanged(node);
            edgeWidthRefresh(node);
        }

        private void edgeWidthRefresh(final NodeModel node) {
            for (final NodeModel child : modeController.getMapController().childrenFolded(node)) {
                final EdgeModel edge = EdgeModel.getModel(child);
                if (edge == null || edge.getWidth() == EdgeModel.WIDTH_PARENT) {
                    modeController.getMapController().nodeRefresh(child);
                    edgeWidthRefresh(child);
                }
            }
        }

        public String getDescription() {
            return "setWidth";
        }

        public void undo() {
            EdgeModel.createEdgeModel(node).setWidth(oldWidth);
            modeController.getMapController().nodeChanged(node);
            edgeWidthRefresh(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 4 with EdgeModel

use of org.freeplane.features.edge.EdgeModel in project freeplane by freeplane.

the class AttributeTable method updateGridColor.

private void updateGridColor() {
    final NodeView nodeView = attributeView.getNodeView();
    if (!SwingUtilities.isDescendingFrom(this, nodeView))
        return;
    final MapView mapView = nodeView.getMap();
    final MapStyleModel model = MapStyleModel.getExtension(mapView.getModel());
    final NodeModel attributeStyleNode = model.getStyleNodeSafe(MapStyleModel.ATTRIBUTE_STYLE);
    final EdgeModel edge = EdgeModel.getModel(attributeStyleNode);
    if (edge != null) {
        final Color edgeColor = edge.getColor();
        setGridAndBorderColor(edgeColor);
    } else
        this.gridColor = null;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color) MapView(org.freeplane.view.swing.map.MapView) NodeView(org.freeplane.view.swing.map.NodeView) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 5 with EdgeModel

use of org.freeplane.features.edge.EdgeModel in project freeplane by freeplane.

the class MEdgeController method setDash.

public void setDash(final NodeModel node, final DashVariant dash) {
    final ModeController modeController = Controller.getCurrentModeController();
    final DashVariant oldDash = EdgeModel.createEdgeModel(node).getDash();
    if (dash == oldDash) {
        return;
    }
    final IActor actor = new IActor() {

        public void act() {
            EdgeModel.createEdgeModel(node).setDash(dash);
            modeController.getMapController().nodeChanged(node);
            edgeWidthRefresh(node);
        }

        private void edgeWidthRefresh(final NodeModel node) {
            for (final NodeModel child : modeController.getMapController().childrenUnfolded(node)) {
                if (child.getViewers().isEmpty())
                    continue;
                final EdgeModel edge = EdgeModel.getModel(child);
                if (edge == null || edge.getWidth() == EdgeModel.WIDTH_PARENT) {
                    modeController.getMapController().nodeRefresh(child);
                    edgeWidthRefresh(child);
                }
            }
        }

        public String getDescription() {
            return "setDash";
        }

        public void undo() {
            EdgeModel.createEdgeModel(node).setDash(oldDash);
            modeController.getMapController().nodeChanged(node);
            edgeWidthRefresh(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : DashVariant(org.freeplane.features.DashVariant) NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) EdgeModel(org.freeplane.features.edge.EdgeModel)

Aggregations

EdgeModel (org.freeplane.features.edge.EdgeModel)9 NodeModel (org.freeplane.features.map.NodeModel)8 ModeController (org.freeplane.features.mode.ModeController)4 IActor (org.freeplane.core.undo.IActor)3 Color (java.awt.Color)2 EdgeStyle (org.freeplane.features.edge.EdgeStyle)2 NodeSizeModel (org.freeplane.features.nodestyle.NodeSizeModel)2 IExtension (org.freeplane.core.extension.IExtension)1 DashVariant (org.freeplane.features.DashVariant)1 CloudController (org.freeplane.features.cloud.CloudController)1 CloudModel (org.freeplane.features.cloud.CloudModel)1 MCloudController (org.freeplane.features.cloud.mindmapmode.MCloudController)1 EdgeController (org.freeplane.features.edge.EdgeController)1 AutomaticEdgeColorHook (org.freeplane.features.edge.mindmapmode.AutomaticEdgeColorHook)1 MEdgeController (org.freeplane.features.edge.mindmapmode.MEdgeController)1 IFormattedObject (org.freeplane.features.format.IFormattedObject)1 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)1 NodeStyleModel (org.freeplane.features.nodestyle.NodeStyleModel)1 MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)1 AutomaticLayout (org.freeplane.features.styles.AutomaticLayout)1