Interface View


public interface View
A view on a graphic graph.
  • Method Summary

    Modifier and Type Method Description
    <T,​ U> void addListener​(T descriptor, U listener)
    Generic method for add a new Listener.
    Collection<GraphicElement> allGraphicElementsIn​(EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2)
    Search for all the graphic elements contained inside the rectangle (x1,y1)-(x2,y2).
    void beginSelectionAt​(double x1, double y1)
    Called by the mouse manager to specify where a node and sprite selection started.
    void close​(GraphicGraph graph)
    Close definitively this view.
    void display​(GraphicGraph graph, boolean graphChanged)
    Redisplay or update the view contents.
    void enableMouseOptions()
    This is a shortcut to a call setShortcutManager with a MouseOverMouseManager instance and with (InteractiveElement.EDGE, InteractiveElement.NODE, InteractiveElement.SPRITE).
    void endSelectionAt​(double x2, double y2)
    Called by the mouse manager to specify where a node and spite selection stopped.
    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).
    void freezeElement​(GraphicElement element, boolean frozen)
    Freeze an element so that the optional layout cannot move it.
    Camera getCamera()
    Get a camera object to provide control commands on the view.
    String getIdView()
    Get the unique view id.
    void moveElementAtPx​(GraphicElement element, double x, double y)
    Force an element to move at the given location in pixels.
    void openInAFrame​(boolean on)
    Open this view in a frame.
    <T,​ U> void removeListener​(T descriptor, U listener)
    Generic method for remove a Listener.
    Object requireFocus()
    Request ui focus.
    void selectionGrowsAt​(double x, double y)
    The selection already started grows toward position (x, y).
    void setMouseManager​(MouseManager manager)
    Change the manager for mouse events on this view.
    void setShortcutManager​(ShortcutManager manager)
    Change the manager for key and shortcuts events on this view.
  • Method Details

    • getIdView

      String getIdView()
      Get the unique view id.
      Returns:
      a view 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 contained inside the rectangle (x1,y1)-(x2,y2).
      Parameters:
      types - The set of 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 sprites, nodes, and edges in the given rectangle.
    • display

      void display​(GraphicGraph graph, boolean graphChanged)
      Redisplay or update the view contents. Called by the Viewer.
      Parameters:
      graph - The graphic graph to represent.
      graphChanged - True if the graph changed since the last call to this method.
    • openInAFrame

      void openInAFrame​(boolean on)
      Open this view in a frame. The argument allows to put the view in a new frame or to remove it from the frame (if it already exists). Called by the Viewer.
      Parameters:
      on - Add the view in its own frame or remove it if it already was in its own frame.
    • close

      void close​(GraphicGraph graph)
      Close definitively this view. Called by the Viewer.
      Parameters:
      graph - The graphic 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.
    • freezeElement

      void freezeElement​(GraphicElement element, boolean frozen)
      Freeze an element so that the optional layout cannot move it.
      Parameters:
      element - The element.
      frozen - If true the element cannot be moved automatically.
    • 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.
    • setMouseManager

      void setMouseManager​(MouseManager manager)
      Change the manager for mouse events on this view. If the value for the new manager is null, a default manager is installed. The MouseManager.init(org.graphstream.ui.graphicGraph.GraphicGraph, View) method must not yet have been called.
      Parameters:
      manager - The new manager, or null to set the default manager.
      See Also:
      MouseManager
    • setShortcutManager

      void setShortcutManager​(ShortcutManager manager)
      Change the manager for key and shortcuts events on this view. If the value for the new manager is null, a default manager is installed. The ShortcutManager.init(org.graphstream.ui.graphicGraph.GraphicGraph, View) method must not yet have been called.
      Parameters:
      manager - The new manager, or null to set the default manager
      See Also:
      ShortcutManager
    • enableMouseOptions

      void enableMouseOptions()
      This is a shortcut to a call setShortcutManager with a MouseOverMouseManager instance and with (InteractiveElement.EDGE, InteractiveElement.NODE, InteractiveElement.SPRITE).
    • requireFocus

      Object requireFocus()
      Request ui focus.
      Returns:
      optional object used to confirm the request
    • addListener

      <T,​ U> void addListener​(T descriptor, U listener)
      Generic method for add a new Listener.
      Parameters:
      T - Describe the listener
      U - Listener
    • removeListener

      <T,​ U> void removeListener​(T descriptor, U listener)
      Generic method for remove a Listener.
      Parameters:
      T - Describe the listener
      U - Listener