Search in sources :

Example 1 with EdgeStyle

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

the class MainView method getUnzoomedEdgeWidth.

public float getUnzoomedEdgeWidth() {
    final NodeView nodeView = getNodeView();
    final int edgeWidth = nodeView.getEdgeWidth();
    final EdgeStyle style = nodeView.getEdgeStyle();
    final float nodeLineWidth = style.getNodeLineWidth(edgeWidth);
    return nodeLineWidth;
}
Also used : Point(java.awt.Point) GradientPaint(java.awt.GradientPaint) EdgeStyle(org.freeplane.features.edge.EdgeStyle)

Example 2 with EdgeStyle

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

the class ForkMainView method getInsets.

@Override
public Insets getInsets(Insets insets) {
    final NodeView nodeView = getNodeView();
    int edgeWidth = nodeView.getEdgeWidth();
    final EdgeStyle style = nodeView.getEdgeStyle();
    edgeWidth = style.getNodeLineWidth(edgeWidth);
    if (insets == null)
        insets = new Insets(0, 2, edgeWidth, 2);
    else
        insets.set(0, 2, edgeWidth, 2);
    return insets;
}
Also used : Insets(java.awt.Insets) Point(java.awt.Point) EdgeStyle(org.freeplane.features.edge.EdgeStyle)

Example 3 with EdgeStyle

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

the class MEdgeController method setStyle.

public void setStyle(final NodeModel node, final EdgeStyle style) {
    final ModeController modeController = Controller.getCurrentModeController();
    final EdgeStyle oldStyle;
    if (style != null) {
        oldStyle = EdgeModel.createEdgeModel(node).getStyle();
        if (style.equals(oldStyle)) {
            return;
        }
    } else {
        oldStyle = EdgeModel.createEdgeModel(node).getStyle();
        if (oldStyle == null) {
            return;
        }
    }
    final IActor actor = new IActor() {

        public void act() {
            EdgeModel.createEdgeModel(node).setStyle(style);
            modeController.getMapController().nodeChanged(node);
            edgeStyleRefresh(node);
        }

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

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

        public void undo() {
            EdgeModel.createEdgeModel(node).setStyle(oldStyle);
            modeController.getMapController().nodeChanged(node);
            edgeStyleRefresh(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) EdgeStyle(org.freeplane.features.edge.EdgeStyle) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 4 with EdgeStyle

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

the class StyleEditorPanel method setStyle.

public void setStyle(final NodeModel node) {
    if (internalChange) {
        return;
    }
    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"));
        final NodeStyleController styleController = NodeStyleController.getController();
        {
            final Color nodeColor = NodeStyleModel.getColor(node);
            final Color viewNodeColor = styleController.getColor(node);
            mSetNodeColor.setValue(nodeColor != null);
            mNodeColor.setColorValue(viewNodeColor);
        }
        {
            final Color color = NodeStyleModel.getBackgroundColor(node);
            final Color viewColor = styleController.getBackgroundColor(node);
            mSetNodeBackgroundColor.setValue(color != null);
            mNodeBackgroundColor.setColorValue(viewColor != null ? viewColor : Controller.getCurrentController().getMapViewManager().getBackgroundColor(node));
        }
        {
            final String shape = NodeStyleModel.getShape(node);
            final String viewShape = styleController.getShape(node);
            mSetNodeShape.setValue(shape != null);
            mNodeShape.setValue(viewShape);
        }
        final NodeSizeModel nodeSizeModel = NodeSizeModel.getModel(node);
        {
            final int width = nodeSizeModel != null ? nodeSizeModel.getMaxNodeWidth() : NodeSizeModel.NOT_SET;
            final int viewWidth = styleController.getMaxWidth(node);
            mSetMaxNodeWidth.setValue(width != NodeSizeModel.NOT_SET);
            mMaxNodeWidth.setValue(Integer.toString(viewWidth));
        }
        {
            final int width = nodeSizeModel != null ? nodeSizeModel.getMinNodeWidth() : NodeSizeModel.NOT_SET;
            final int viewWidth = styleController.getMinWidth(node);
            mSetMinNodeWidth.setValue(width != NodeSizeModel.NOT_SET);
            mMinNodeWidth.setValue(Integer.toString(viewWidth));
        }
        final EdgeController edgeController = EdgeController.getController();
        final EdgeModel edgeModel = EdgeModel.getModel(node);
        {
            final Color edgeColor = edgeModel != null ? edgeModel.getColor() : null;
            final Color viewColor = edgeController.getColor(node);
            mSetEdgeColor.setValue(edgeColor != null);
            mEdgeColor.setColorValue(viewColor);
        }
        {
            final EdgeStyle style = edgeModel != null ? edgeModel.getStyle() : null;
            final EdgeStyle viewStyle = edgeController.getStyle(node);
            mSetEdgeStyle.setValue(style != null);
            mEdgeStyle.setValue(viewStyle.toString());
        }
        {
            final int width = edgeModel != null ? edgeModel.getWidth() : EdgeModel.DEFAULT_WIDTH;
            final int viewWidth = edgeController.getWidth(node);
            mSetEdgeWidth.setValue(width != EdgeModel.DEFAULT_WIDTH);
            mEdgeWidth.setValue(Integer.toString(viewWidth));
        }
        {
            final CloudController cloudController = CloudController.getController();
            final CloudModel cloudModel = CloudModel.getModel(node);
            final Color viewCloudColor = cloudController.getColor(node);
            mSetCloud.setValue(cloudModel != null);
            mCloudColor.setColorValue(viewCloudColor);
            final CloudModel.Shape viewCloudShape = cloudController.getShape(node);
            mCloudShape.setValue(viewCloudShape != null ? viewCloudShape.toString() : CloudModel.Shape.ARC.toString());
        }
        {
            final String fontFamilyName = NodeStyleModel.getFontFamilyName(node);
            final String viewFontFamilyName = styleController.getFontFamilyName(node);
            mSetNodeFontName.setValue(fontFamilyName != null);
            mNodeFontName.setValue(viewFontFamilyName);
        }
        {
            final Integer fontSize = NodeStyleModel.getFontSize(node);
            final Integer viewfontSize = styleController.getFontSize(node);
            mSetNodeFontSize.setValue(fontSize != null);
            mNodeFontSize.setValue(viewfontSize.toString());
        }
        {
            final Boolean bold = NodeStyleModel.isBold(node);
            final Boolean viewbold = styleController.isBold(node);
            mSetNodeFontBold.setValue(bold != null);
            mNodeFontBold.setValue(viewbold);
        }
        {
            final Boolean italic = NodeStyleModel.isItalic(node);
            final Boolean viewitalic = styleController.isItalic(node);
            mSetNodeFontItalic.setValue(italic != null);
            mNodeFontItalic.setValue(viewitalic);
        }
        {
            final Boolean hyperlink = NodeLinks.formatNodeAsHyperlink(node);
            final Boolean viewhyperlink = LinkController.getController().formatNodeAsHyperlink(node);
            mSetNodeFontHyperlink.setValue(hyperlink != null);
            mNodeFontHyperlink.setValue(viewhyperlink);
        }
        {
            final Boolean nodeNumbering = NodeStyleModel.getNodeNumbering(node);
            final Boolean viewNodeNumbering = styleController.getNodeNumbering(node);
            mSetNodeNumbering.setValue(nodeNumbering != null);
            mNodeNumbering.setValue(viewNodeNumbering);
        }
        {
            String nodeFormat = NodeStyleModel.getNodeFormat(node);
            String viewNodeFormat = TextController.getController().getNodeFormat(node);
            mSetNodeFormat.setValue(nodeFormat != null);
            if (viewNodeFormat == null && node.getUserObject() instanceof IFormattedObject)
                viewNodeFormat = ((IFormattedObject) node.getUserObject()).getPattern();
            mNodeFormat.setValue(viewNodeFormat);
        }
        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 (mAutomaticEdgeColorCheckBox != null) {
            final ModeController modeController = Controller.getCurrentModeController();
            AutomaticEdgeColorHook al = (AutomaticEdgeColorHook) modeController.getExtension(AutomaticEdgeColorHook.class);
            mAutomaticEdgeColorCheckBox.setSelected(al.isActive(node));
        }
    } finally {
        internalChange = false;
    }
}
Also used : AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) EdgeController(org.freeplane.features.edge.EdgeController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) AutomaticEdgeColorHook(org.freeplane.features.edge.mindmapmode.AutomaticEdgeColorHook) AutomaticLayout(org.freeplane.features.styles.AutomaticLayout) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) Color(java.awt.Color) IFormattedObject(org.freeplane.features.format.IFormattedObject) ModeController(org.freeplane.features.mode.ModeController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) NodeSizeModel(org.freeplane.features.nodestyle.NodeSizeModel) IExtension(org.freeplane.core.extension.IExtension) CloudModel(org.freeplane.features.cloud.CloudModel) EdgeStyle(org.freeplane.features.edge.EdgeStyle) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 5 with EdgeStyle

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

the class OutlineEdgeView method getStroke.

@Override
protected Stroke getStroke() {
    final NodeView target = getTarget();
    int edgeWidth = target.getEdgeWidth();
    final EdgeStyle style = target.getEdgeStyle();
    final int nodeLineWidth = style.getNodeLineWidth(edgeWidth);
    final int zoomedWidth;
    if (edgeWidth != 0)
        zoomedWidth = getTarget().getZoomed(nodeLineWidth);
    else
        zoomedWidth = nodeLineWidth;
    return new BasicStroke(zoomedWidth);
}
Also used : BasicStroke(java.awt.BasicStroke) NodeView(org.freeplane.view.swing.map.NodeView) Point(java.awt.Point) EdgeStyle(org.freeplane.features.edge.EdgeStyle)

Aggregations

EdgeStyle (org.freeplane.features.edge.EdgeStyle)6 Point (java.awt.Point)4 EdgeModel (org.freeplane.features.edge.EdgeModel)2 ModeController (org.freeplane.features.mode.ModeController)2 BasicStroke (java.awt.BasicStroke)1 Color (java.awt.Color)1 GradientPaint (java.awt.GradientPaint)1 Insets (java.awt.Insets)1 IExtension (org.freeplane.core.extension.IExtension)1 IActor (org.freeplane.core.undo.IActor)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 NodeModel (org.freeplane.features.map.NodeModel)1 NodeSizeModel (org.freeplane.features.nodestyle.NodeSizeModel)1 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)1