/** * Attaches an anchor of a target pin an edge. * The anchor is a ProxyAnchor that switches between the anchor attached to the pin widget directly and * the anchor attached to the pin node widget based on the minimize-state of the node. * @param edge the edge * @param oldTargetPin the old target pin * @param targetPin the new target pin */ protected void attachEdgeTargetAnchor (String edge, String oldTargetPin, String targetPin) { ((ConnectionWidget) findWidget (edge)).setTargetAnchor (getPinAnchor (targetPin)); }
private Anchor getPinAnchor (String pin) { if (pin == null) return null; VMDNodeWidget nodeWidget = (VMDNodeWidget) findWidget (getPinNode (pin)); Widget pinMainWidget = findWidget (pin); Anchor anchor; if (pinMainWidget != null) { anchor = AnchorFactory.createDirectionalAnchor (pinMainWidget, AnchorFactory.DirectionalAnchorKind.HORIZONTAL, 8); anchor = nodeWidget.createAnchorPin (anchor); } else anchor = nodeWidget.getNodeAnchor (); return anchor; }
/** * Implements attaching a widget to a pin. The widget is VMDPinWidget and has object-hover and select action. * The the node id ends with "#default" then the pin is the default pin of a node and therefore it is non-visual. * @param node the node * @param pin the pin * @return the widget attached to the pin, null, if it is a default pin */ protected Widget attachPinWidget (String node, String pin) { if (pin.endsWith (PIN_ID_DEFAULT_SUFFIX)) return null; VMDPinWidget widget = new VMDPinWidget (this, scheme); ((VMDNodeWidget) findWidget (node)).attachPinWidget (widget); widget.getActions ().addAction (createObjectHoverAction ()); widget.getActions ().addAction (createSelectAction ()); return widget; }
/** * Creates a VMD graph scene with a specific color scheme. * @param scheme the color scheme */ public VMDGraphScene (VMDColorScheme scheme) { this.scheme = scheme; setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS); addChild (backgroundLayer); addChild (mainLayer); addChild (connectionLayer); addChild (upperLayer); router = RouterFactory.createOrthogonalSearchRouter (mainLayer, connectionLayer); getActions ().addAction (ActionFactory.createZoomAction ()); getActions ().addAction (ActionFactory.createPanAction ()); getActions ().addAction (ActionFactory.createRectangularSelectAction (this, backgroundLayer)); sceneLayout = LayoutFactory.createSceneGraphLayout (this, new GridGraphLayout<String, String> ().setChecker (true)); }
/** * Implements attaching a widget to a node. The widget is VMDNodeWidget and has object-hover, select, popup-menu and move actions. * @param node the node * @return the widget attached to the node */ protected Widget attachNodeWidget (String node) { VMDNodeWidget widget = new VMDNodeWidget (this, scheme); mainLayer.addChild (widget); widget.getHeader ().getActions ().addAction (createObjectHoverAction ()); widget.getActions ().addAction (createSelectAction ()); widget.getActions ().addAction (moveAction); return widget; }
/** * Implements attaching a widget to a pin. The widget is VMDPinWidget and has object-hover and select action. * The the node id ends with "#default" then the pin is the default pin of a node and therefore it is non-visual. * @param node the node * @param pin the pin * @return the widget attached to the pin, null, if it is a default pin */ protected Widget attachPinWidget (String node, String pin) { if (pin.endsWith (PIN_ID_DEFAULT_SUFFIX)) return null; VMDPinWidget widget = new VMDPinWidget (this, scheme); ((VMDNodeWidget) findWidget (node)).attachPinWidget (widget); widget.getActions ().addAction (createObjectHoverAction ()); widget.getActions ().addAction (createSelectAction ()); return widget; }
/** * Creates a VMD graph scene with a specific color scheme. * @param scheme the color scheme */ public VMDGraphScene (VMDColorScheme scheme) { this.scheme = scheme; setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS); addChild (backgroundLayer); addChild (mainLayer); addChild (connectionLayer); addChild (upperLayer); router = RouterFactory.createOrthogonalSearchRouter (mainLayer, connectionLayer); getActions ().addAction (ActionFactory.createZoomAction ()); getActions ().addAction (ActionFactory.createPanAction ()); getActions ().addAction (ActionFactory.createRectangularSelectAction (this, backgroundLayer)); sceneLayout = LayoutFactory.createSceneGraphLayout (this, new GridGraphLayout<String, String> ().setChecker (true)); }
/** * Implements attaching a widget to a node. The widget is VMDNodeWidget and has object-hover, select, popup-menu and move actions. * @param node the node * @return the widget attached to the node */ protected Widget attachNodeWidget (String node) { VMDNodeWidget widget = new VMDNodeWidget (this, scheme); mainLayer.addChild (widget); widget.getHeader ().getActions ().addAction (createObjectHoverAction ()); widget.getActions ().addAction (createSelectAction ()); widget.getActions ().addAction (moveAction); return widget; }
/** * Attaches an anchor of a source pin an edge. * The anchor is a ProxyAnchor that switches between the anchor attached to the pin widget directly and * the anchor attached to the pin node widget based on the minimize-state of the node. * @param edge the edge * @param oldSourcePin the old source pin * @param sourcePin the new source pin */ protected void attachEdgeSourceAnchor (String edge, String oldSourcePin, String sourcePin) { ((ConnectionWidget) findWidget (edge)).setSourceAnchor (getPinAnchor (sourcePin)); }
/** * Implements attaching a widget to an edge. the widget is ConnectionWidget and has object-hover, select and move-control-point actions. * @param edge the edge * @return the widget attached to the edge */ protected Widget attachEdgeWidget (String edge) { VMDConnectionWidget connectionWidget = new VMDConnectionWidget (this, scheme); connectionWidget.setRouter (router); connectionLayer.addChild (connectionWidget); connectionWidget.getActions ().addAction (createObjectHoverAction ()); connectionWidget.getActions ().addAction (createSelectAction ()); connectionWidget.getActions ().addAction (moveControlPointAction); return connectionWidget; }
private Anchor getPinAnchor (String pin) { if (pin == null) return null; VMDNodeWidget nodeWidget = (VMDNodeWidget) findWidget (getPinNode (pin)); Widget pinMainWidget = findWidget (pin); Anchor anchor; if (pinMainWidget != null) { anchor = AnchorFactory.createDirectionalAnchor (pinMainWidget, AnchorFactory.DirectionalAnchorKind.HORIZONTAL, 8); anchor = nodeWidget.createAnchorPin (anchor); } else anchor = nodeWidget.getNodeAnchor (); return anchor; }
/** * Attaches an anchor of a source pin an edge. * The anchor is a ProxyAnchor that switches between the anchor attached to the pin widget directly and * the anchor attached to the pin node widget based on the minimize-state of the node. * @param edge the edge * @param oldSourcePin the old source pin * @param sourcePin the new source pin */ protected void attachEdgeSourceAnchor (String edge, String oldSourcePin, String sourcePin) { ((ConnectionWidget) findWidget (edge)).setSourceAnchor (getPinAnchor (sourcePin)); }
/** * Implements attaching a widget to an edge. the widget is ConnectionWidget and has object-hover, select and move-control-point actions. * @param edge the edge * @return the widget attached to the edge */ protected Widget attachEdgeWidget (String edge) { VMDConnectionWidget connectionWidget = new VMDConnectionWidget (this, scheme); connectionWidget.setRouter (router); connectionLayer.addChild (connectionWidget); connectionWidget.getActions ().addAction (createObjectHoverAction ()); connectionWidget.getActions ().addAction (createSelectAction ()); connectionWidget.getActions ().addAction (moveControlPointAction); return connectionWidget; }
/** * Attaches an anchor of a target pin an edge. * The anchor is a ProxyAnchor that switches between the anchor attached to the pin widget directly and * the anchor attached to the pin node widget based on the minimize-state of the node. * @param edge the edge * @param oldTargetPin the old target pin * @param targetPin the new target pin */ protected void attachEdgeTargetAnchor (String edge, String oldTargetPin, String targetPin) { ((ConnectionWidget) findWidget (edge)).setTargetAnchor (getPinAnchor (targetPin)); }