Search in sources :

Example 1 with ILinkView

use of org.freeplane.view.swing.map.link.ILinkView in project freeplane by freeplane.

the class MapView method getInnerBounds.

public Rectangle getInnerBounds() {
    final Rectangle innerBounds = rootView.getBounds();
    final Rectangle maxBounds = new Rectangle(0, 0, getWidth(), getHeight());
    for (int i = 0; i < arrowLinkViews.size(); ++i) {
        final ILinkView arrowView = arrowLinkViews.get(i);
        arrowView.increaseBounds(innerBounds);
    }
    return innerBounds.intersection(maxBounds);
}
Also used : ILinkView(org.freeplane.view.swing.map.link.ILinkView) Rectangle(java.awt.Rectangle) Point(java.awt.Point)

Example 2 with ILinkView

use of org.freeplane.view.swing.map.link.ILinkView in project freeplane by freeplane.

the class MapView method paintConnectors.

private void paintConnectors(final Collection<NodeLinkModel> links, final Graphics2D graphics, final HashSet<ConnectorModel> alreadyPaintedLinks) {
    final Font font = graphics.getFont();
    try {
        final Iterator<NodeLinkModel> linkIterator = links.iterator();
        while (linkIterator.hasNext()) {
            final NodeLinkModel next = linkIterator.next();
            if (!(next instanceof ConnectorModel)) {
                continue;
            }
            final ConnectorModel ref = (ConnectorModel) next;
            if (alreadyPaintedLinks.add(ref)) {
                final NodeModel target = ref.getTarget();
                if (target == null) {
                    continue;
                }
                final NodeModel source = ref.getSource();
                final NodeView sourceView = getNodeView(source);
                final NodeView targetView = getNodeView(target);
                final ILinkView arrowLink;
                final boolean areBothNodesVisible = sourceView != null && targetView != null && source.hasVisibleContent() && target.hasVisibleContent();
                final boolean showConnector = SHOW_CONNECTOR_LINES == showConnectors || HIDE_CONNECTOR_LINES == showConnectors || SHOW_CONNECTORS_FOR_SELECTION == showConnectors && (sourceView != null && sourceView.isSelected() || targetView != null && targetView.isSelected());
                if (showConnector) {
                    if (areBothNodesVisible && (Shape.EDGE_LIKE.equals(ref.getShape()) || sourceView.getMap().getLayoutType() == MapViewLayout.OUTLINE))
                        arrowLink = new EdgeLinkView(ref, getModeController(), sourceView, targetView);
                    else if (areBothNodesVisible || !hideSingleEndConnectors)
                        arrowLink = new ConnectorView(ref, sourceView, targetView, getBackground());
                    else
                        break;
                    arrowLink.paint(graphics);
                    arrowLinkViews.add(arrowLink);
                }
            }
        }
    } finally {
        graphics.setFont(font);
    }
}
Also used : EdgeLinkView(org.freeplane.view.swing.map.link.EdgeLinkView) NodeModel(org.freeplane.features.map.NodeModel) ILinkView(org.freeplane.view.swing.map.link.ILinkView) ConnectorView(org.freeplane.view.swing.map.link.ConnectorView) ConnectorModel(org.freeplane.features.link.ConnectorModel) INodeView(org.freeplane.features.map.INodeView) Font(java.awt.Font) NodeLinkModel(org.freeplane.features.link.NodeLinkModel)

Example 3 with ILinkView

use of org.freeplane.view.swing.map.link.ILinkView in project freeplane by freeplane.

the class MapView method paintLinks.

private void paintLinks(final Collection<NodeLinkModel> links, final Graphics2D graphics, final HashSet<ConnectorModel> alreadyPaintedLinks) {
    final Font font = graphics.getFont();
    try {
        final Iterator<NodeLinkModel> linkIterator = links.iterator();
        while (linkIterator.hasNext()) {
            final NodeLinkModel next = linkIterator.next();
            if (!(next instanceof ConnectorModel)) {
                continue;
            }
            final ConnectorModel ref = (ConnectorModel) next;
            if (alreadyPaintedLinks.add(ref)) {
                final NodeModel target = ref.getTarget();
                if (target == null) {
                    continue;
                }
                final NodeModel source = ref.getSource();
                final NodeView sourceView = getNodeView(source);
                final NodeView targetView = getNodeView(target);
                final ILinkView arrowLink;
                if (sourceView != null && targetView != null && (Shape.EDGE_LIKE.equals(ref.getShape()) || sourceView.getMap().getLayoutType() == MapViewLayout.OUTLINE) && source.isVisible() && target.isVisible()) {
                    arrowLink = new EdgeLinkView(ref, getModeController(), sourceView, targetView);
                } else {
                    arrowLink = new ConnectorView(ref, sourceView, targetView, getBackground());
                }
                arrowLink.paint(graphics);
                arrowLinkViews.add(arrowLink);
            }
        }
    } finally {
        graphics.setFont(font);
    }
}
Also used : EdgeLinkView(org.freeplane.view.swing.map.link.EdgeLinkView) NodeModel(org.freeplane.features.map.NodeModel) ILinkView(org.freeplane.view.swing.map.link.ILinkView) ConnectorView(org.freeplane.view.swing.map.link.ConnectorView) ConnectorModel(org.freeplane.features.link.ConnectorModel) INodeView(org.freeplane.features.map.INodeView) Font(java.awt.Font) NodeLinkModel(org.freeplane.features.link.NodeLinkModel)

Aggregations

ILinkView (org.freeplane.view.swing.map.link.ILinkView)3 Font (java.awt.Font)2 ConnectorModel (org.freeplane.features.link.ConnectorModel)2 NodeLinkModel (org.freeplane.features.link.NodeLinkModel)2 INodeView (org.freeplane.features.map.INodeView)2 NodeModel (org.freeplane.features.map.NodeModel)2 ConnectorView (org.freeplane.view.swing.map.link.ConnectorView)2 EdgeLinkView (org.freeplane.view.swing.map.link.EdgeLinkView)2 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1