Interface GraphRenderer<S,​G>

All Known Implementing Classes:
GraphRendererBase

public interface GraphRenderer<S,​G>
Interface for classes that draw a GraphicGraph in a swing component.

There are two rendering mechanisms in the Swing ui package : the viewer and the renderers. The viewer is a complete architecture to render a graph in a panel or frame, handling all the details. The renderer architecture is a way to only render the graph in any surface, handled directly by the developer. When using the render you are must handle the graphic graph by yourself, but you have a lot more flexibility.

The viewer mechanisms uses graph renderers.

  • Method Details

    • open

      void open​(GraphicGraph graph, S drawingSurface)
    • close

      void close()
    • createDefaultView

      View createDefaultView​(Viewer viewer, String id)
    • getCamera

      Camera getCamera()
      Get a camera object to provide control commands on the view.
      Returns:
      a Camera instance
    • findGraphicElementAt

      GraphicElement findGraphicElementAt​(EnumSet<InteractiveElement> types, double x, double y)
      Search for the first GraphicElement among the specified types (precedence: node, edge, sprite) that contains the point at coordinates (x, y).
      Parameters:
      types - The types to check
      x - The point abscissa.
      y - The point ordinate.
      Returns:
      The first GraphicElement among the specified types at the given coordinates or null if nothing found.
    • allGraphicElementsIn

      Collection<GraphicElement> allGraphicElementsIn​(EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2)
      Search for all the graphic elements of the specified types contained inside the rectangle (x1,y1)-(x2,y2).
      Parameters:
      types - The types to check
      x1 - The rectangle lowest point abscissa.
      y1 - The rectangle lowest point ordinate.
      x2 - The rectangle highest point abscissa.
      y2 - The rectangle highest point ordinate.
      Returns:
      The set of GraphicElements in the given rectangle.
    • render

      void render​(G g, int x, int y, int width, int height)
      Redisplay or update the graph.
    • beginSelectionAt

      void beginSelectionAt​(double x1, double y1)
      Called by the mouse manager to specify where a node and sprite selection started.
      Parameters:
      x1 - The selection start abscissa.
      y1 - The selection start ordinate.
    • selectionGrowsAt

      void selectionGrowsAt​(double x, double y)
      The selection already started grows toward position (x, y).
      Parameters:
      x - The new end selection abscissa.
      y - The new end selection ordinate.
    • endSelectionAt

      void endSelectionAt​(double x2, double y2)
      Called by the mouse manager to specify where a node and spite selection stopped.
      Parameters:
      x2 - The selection stop abscissa.
      y2 - The selection stop ordinate.
    • moveElementAtPx

      void moveElementAtPx​(GraphicElement element, double x, double y)
      Force an element to move at the given location in pixels.
      Parameters:
      element - The element.
      x - The requested position abscissa in pixels.
      y - The requested position ordinate in pixels.
    • screenshot

      void screenshot​(String filename, int width, int height)
    • setBackLayerRenderer

      void setBackLayerRenderer​(LayerRenderer<G> renderer)
      Set a layer renderer that will be called each time the graph needs to be redrawn before the graph is rendered. Pass "null" to remove the layer renderer.
      Parameters:
      renderer - The renderer (or null to remove it).
    • setForeLayoutRenderer

      void setForeLayoutRenderer​(LayerRenderer<G> renderer)
      Set a layer renderer that will be called each time the graph needs to be redrawn after the graph is rendered. Pass "null" to remove the layer renderer.
      Parameters:
      renderer - The renderer (or null to remove it).