use of org.freeplane.features.link.ConnectorModel in project freeplane by freeplane.
the class NodeProxy method removeConnector.
// Node: R/W
public void removeConnector(final Proxy.Connector connectorToBeRemoved) {
final ConnectorProxy connectorProxy = (ConnectorProxy) connectorToBeRemoved;
final ConnectorModel link = connectorProxy.getConnector();
final MLinkController linkController = (MLinkController) LinkController.getController();
linkController.removeArrowLink(link);
}
use of org.freeplane.features.link.ConnectorModel 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);
}
}
Aggregations