Class PraxisGraphScene<N>

java.lang.Object
org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.widget.Scene
org.netbeans.api.visual.model.ObjectScene
org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
org.praxislive.ide.pxr.graph.scene.PraxisGraphScene<N>
Type Parameters:
N - node type
All Implemented Interfaces:
Accessible, org.openide.util.Lookup.Provider

public final class PraxisGraphScene<N> extends org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
A graph scene providing node widgets with pins and edges. The graph scene is backed by a set of nodes of the given type. A graph cannot contain duplicate nodes.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.netbeans.api.visual.graph.GraphPinScene

    org.netbeans.api.visual.graph.GraphPinScene.StringGraph

    Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Scene

    org.netbeans.api.visual.widget.Scene.SceneListener

    Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget

    org.netbeans.api.visual.widget.Widget.Dependency
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a Praxis graph scene.
    PraxisGraphScene(org.netbeans.api.visual.action.ConnectProvider connectProvider, org.netbeans.api.visual.action.PopupMenuProvider popupProvider)
    Create a Praxis graph scene with the provided connect and popup menu providers.
  • Method Summary

    Modifier and Type
    Method
    Description
    addNode(N node, String name)
    Add a node with the given name.
    addPin(N node, String name)
    Add a pin with the given name to a node.
    addPin(N node, String name, Alignment alignment)
    Add a pin with the given name and alignment to a node.
    addPin(PinID<N> pin, Alignment alignment)
    Add a pin with the given ID and alignment.
    void
    addToolWidget(org.netbeans.api.visual.widget.Widget tool)
    Add a widget to the the scene tools container.
    protected void
    attachEdgeSourceAnchor(EdgeID<N> edge, PinID<N> oldSourcePin, PinID<N> sourcePin)
    Attaches an anchor of a source pin an edge.
    protected void
    attachEdgeTargetAnchor(EdgeID<N> edge, PinID<N> oldTargetPin, PinID<N> targetPin)
    Attaches an anchor of a target pin an edge.
    protected org.netbeans.api.visual.widget.Widget
    Implements attaching a widget to an edge.
    protected org.netbeans.api.visual.widget.Widget
    Implements attaching a widget to a node.
    protected org.netbeans.api.visual.widget.Widget
    attachPinWidget(N node, PinID<N> pin)
    Implements attaching a widget to a pin.
    void
    Clear all widgets from the scene tools container.
    connect(N node1, String pin1, N node2, String pin2)
    Add a connection between the given pins.
    connect(PinID<N> p1, PinID<N> p2)
    Add a connection between the given pins.
    protected void
    detachEdgeWidget(EdgeID<N> edge, org.netbeans.api.visual.widget.Widget widget)
     
    protected void
    detachNodeWidget(N node, org.netbeans.api.visual.widget.Widget widget)
     
    void
    disconnect(N node1, String pin1, N node2, String pin2)
    Disconnect the given pins.
    Get the comment text.
    Get the look and feel scheme.
    Get the scheme colours.
    boolean
     
    boolean
    Query whether the graph is zoomed out below the level of detail threshold.
    boolean
     
    boolean
    Query whether the graph is using orthogonal routing.
    void
     
    void
    removeToolWidget(org.netbeans.api.visual.widget.Widget tool)
    Remove a widget from the scene tools container.
    void
    setAnimateChanges(boolean animate)
     
    void
    setComment(String comment)
    Set a comment text to be displayed on the graph.
    void
    setCommentEditProvider(org.netbeans.api.visual.action.EditProvider provider)
    Set an edit provider for the scene comment.
    void
    setMinimizeConnectedPins(boolean minimizeConnected)
     
    void
    setOrthogonalRouting(boolean orthogonal)
    Set whether to use orthogonal routing (as opposed to curved edges).
    void
    Set the scheme colours.
    void
    userSelectionSuggested(Set<?> suggestedSelectedObjects, boolean invertSelection)
     

    Methods inherited from class org.netbeans.api.visual.graph.GraphPinScene

    addEdge, addNode, addPin, detachPinWidget, findEdgesBetween, findPinEdges, getEdges, getEdgeSource, getEdgeTarget, getNodePins, getNodes, getPinNode, getPins, isEdge, isNode, isPin, notifyEdgeAdded, notifyNodeAdded, notifyPinAdded, removeEdge, removeNode, removeNodeWithEdges, removePin, removePinWithEdges, setEdgeSource, setEdgeTarget

    Methods inherited from class org.netbeans.api.visual.model.ObjectScene

    addObject, addObjectSceneListener, clearObjectState, createObjectHoverAction, createSelectAction, findObject, findObjectState, findStoredObject, findWidget, findWidgets, getFocusedObject, getHighlightedObjects, getHoveredObject, getIdentityCode, getObjects, getObjectState, getSelectedObjects, isObject, removeObject, removeObjectMapping, removeObjectSceneListener, setFocusedObject, setHighlightedObjects, setHoveredObject, setSelectedObjects

    Methods inherited from class org.netbeans.api.visual.widget.Scene

    addSceneListener, convertSceneToView, convertSceneToView, convertViewToScene, convertViewToScene, createBirdView, createSatelliteView, createView, createWidgetHoverAction, getActiveTool, getDefaultFont, getFocusedWidget, getGraphics, getInputBindings, getKeyEventProcessingType, getLookFeel, getMaximumBounds, getPriorActions, getResourceTable, getSceneAnimator, getView, getZoomFactor, isRepaintRequiredForRevalidating, isValidated, paint, removeSceneListener, setActiveTool, setFocusedWidget, setKeyEventProcessingType, setLookFeel, setMaximumBounds, setResourceTable, setZoomFactor, validate, validate

    Methods inherited from class org.netbeans.api.visual.widget.Widget

    addChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, calculateClientArea, convertLocalToScene, convertLocalToScene, convertSceneToLocal, convertSceneToLocal, createActions, equals, getAccessibleContext, getActions, getActions, getBackground, getBorder, getBounds, getChildConstraint, getChildren, getClientArea, getCursor, getCursorAt, getDependencies, getFont, getForeground, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isVisible, notifyAdded, notifyBackgroundChanged, notifyFontChanged, notifyForegroundChanged, notifyRemoved, notifyStateChanged, paint, paintBackground, paintBorder, paintChildren, paintWidget, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBackgroundFromResource, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setFontFromResource, setForeground, setForegroundFromResource, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setState, setToolTipText, setVisible, updateResources

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PraxisGraphScene

      public PraxisGraphScene()
      Create a Praxis graph scene.
    • PraxisGraphScene

      public PraxisGraphScene(org.netbeans.api.visual.action.ConnectProvider connectProvider, org.netbeans.api.visual.action.PopupMenuProvider popupProvider)
      Create a Praxis graph scene with the provided connect and popup menu providers.
      Parameters:
      connectProvider - connect provider
      popupProvider - popup menu provider
  • Method Details

    • addNode

      public NodeWidget addNode(N node, String name)
      Add a node with the given name. Returns the node widget for further customization.
      Parameters:
      node - node
      name - name of node
      Returns:
      node widget representation
    • addPin

      public PinWidget addPin(N node, String name)
      Add a pin with the given name to a node. The pin will be centrally aligned. Returns the pin widget attached to the node widget for further customization.
      Parameters:
      node - node to add pin to
      name - name of pin
      Returns:
      pin widget representation
    • addPin

      public PinWidget addPin(N node, String name, Alignment alignment)
      Add a pin with the given name and alignment to a node. Returns the pin widget attached to the node widget for further customization.
      Parameters:
      node - node to add pin to
      name - name of pin
      alignment - pin alignment
      Returns:
      pin widget representation
    • addPin

      public PinWidget addPin(PinID<N> pin, Alignment alignment)
      Add a pin with the given ID and alignment. Returns the pin widget for further customization.
      Parameters:
      pin - pin ID
      alignment - pin alignment
      Returns:
      pin widget representation
    • connect

      public EdgeWidget connect(N node1, String pin1, N node2, String pin2)
      Add a connection between the given pins. Returns the edge widget for further customization.
      Parameters:
      node1 - first node
      pin1 - first pin name
      node2 - second node
      pin2 - second pin name
      Returns:
      edge widget representation
    • connect

      public EdgeWidget connect(PinID<N> p1, PinID<N> p2)
      Add a connection between the given pins. Returns the edge widget for further customization.
      Parameters:
      p1 - first pin ID
      p2 - second pin ID
      Returns:
      edge widget representation
    • disconnect

      public void disconnect(N node1, String pin1, N node2, String pin2)
      Disconnect the given pins.
      Parameters:
      node1 - first node
      pin1 - first pin name
      node2 - second node
      pin2 - second pin name
    • getLookAndFeel

      public LAFScheme getLookAndFeel()
      Get the look and feel scheme.
      Returns:
      LAF scheme
    • setSchemeColors

      public void setSchemeColors(LAFScheme.Colors schemeColors)
      Set the scheme colours.
      Parameters:
      schemeColors - scheme colours
    • getSchemeColors

      public LAFScheme.Colors getSchemeColors()
      Get the scheme colours.
      Returns:
      scheme colours
    • setOrthogonalRouting

      public void setOrthogonalRouting(boolean orthogonal)
      Set whether to use orthogonal routing (as opposed to curved edges).
      Parameters:
      orthogonal - use orthogonal routing
    • isOrthogonalRouting

      public boolean isOrthogonalRouting()
      Query whether the graph is using orthogonal routing.
      Returns:
      using orthogonal routing
    • setMinimizeConnectedPins

      public void setMinimizeConnectedPins(boolean minimizeConnected)
    • isMinimizeConnectedPins

      public boolean isMinimizeConnectedPins()
    • userSelectionSuggested

      public void userSelectionSuggested(Set<?> suggestedSelectedObjects, boolean invertSelection)
      Overrides:
      userSelectionSuggested in class org.netbeans.api.visual.model.ObjectScene
    • attachNodeWidget

      protected org.netbeans.api.visual.widget.Widget attachNodeWidget(N node)
      Implements attaching a widget to a node. The widget is NodeWidget and has object-hover, select, popup-menu and move actions.
      Specified by:
      attachNodeWidget in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
      Parameters:
      node - the node
      Returns:
      the widget attached to the node
    • attachPinWidget

      protected org.netbeans.api.visual.widget.Widget attachPinWidget(N node, PinID<N> pin)
      Implements attaching a widget to a pin.
      Specified by:
      attachPinWidget in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
      Parameters:
      node - the node
      pin - the pin
      Returns:
      the widget attached to the pin
    • attachEdgeWidget

      protected org.netbeans.api.visual.widget.Widget attachEdgeWidget(EdgeID<N> edge)
      Implements attaching a widget to an edge.
      Specified by:
      attachEdgeWidget in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
      Parameters:
      edge - the edge
      Returns:
      the widget attached to the edge
    • attachEdgeSourceAnchor

      protected void attachEdgeSourceAnchor(EdgeID<N> edge, PinID<N> oldSourcePin, PinID<N> sourcePin)
      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.
      Specified by:
      attachEdgeSourceAnchor in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
      Parameters:
      edge - the edge
      oldSourcePin - the old source pin
      sourcePin - the new source pin
    • attachEdgeTargetAnchor

      protected void attachEdgeTargetAnchor(EdgeID<N> edge, PinID<N> oldTargetPin, PinID<N> targetPin)
      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.
      Specified by:
      attachEdgeTargetAnchor in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
      Parameters:
      edge - the edge
      oldTargetPin - the old target pin
      targetPin - the new target pin
    • detachNodeWidget

      protected void detachNodeWidget(N node, org.netbeans.api.visual.widget.Widget widget)
      Overrides:
      detachNodeWidget in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
    • detachEdgeWidget

      protected void detachEdgeWidget(EdgeID<N> edge, org.netbeans.api.visual.widget.Widget widget)
      Overrides:
      detachEdgeWidget in class org.netbeans.api.visual.graph.GraphPinScene<N,EdgeID<N>,PinID<N>>
    • isBelowLODThreshold

      public boolean isBelowLODThreshold()
      Query whether the graph is zoomed out below the level of detail threshold. Pins and node names may not be visible below the threshold.
      Returns:
      below level of detail threshold
    • setComment

      public void setComment(String comment)
      Set a comment text to be displayed on the graph. A null or empty comment will remove the display.
      Parameters:
      comment - comment text
    • getComment

      public String getComment()
      Get the comment text.
      Returns:
      comment text
    • setCommentEditProvider

      public void setCommentEditProvider(org.netbeans.api.visual.action.EditProvider provider)
      Set an edit provider for the scene comment.
      Parameters:
      provider - scene comment edit provider
    • addToolWidget

      public void addToolWidget(org.netbeans.api.visual.widget.Widget tool)
      Add a widget to the the scene tools container.
      Parameters:
      tool - tool widget
    • removeToolWidget

      public void removeToolWidget(org.netbeans.api.visual.widget.Widget tool)
      Remove a widget from the scene tools container.
      Parameters:
      tool - tool widget
    • clearToolWidgets

      public void clearToolWidgets()
      Clear all widgets from the scene tools container.
    • layoutScene

      public void layoutScene()
    • setAnimateChanges

      public void setAnimateChanges(boolean animate)
    • isAnimateChanges

      public boolean isAnimateChanges()