Class VertexSelectingGraphMousePlugin<V,​E>

    • Field Detail

      • pickSize

        protected int pickSize
      • vertex

        protected V vertex
        the selected Vertex, if any
      • deselectedVertex

        protected V deselectedVertex
      • locked

        protected boolean locked
        controls whether the Vertices may be moved with the mouse
      • footprintRectangle

        protected Rectangle2D footprintRectangle
      • lensColor

        protected Color lensColor
        color for the picking rectangle
      • deltaDown

        protected Point2D deltaDown
      • singleSelectionMask

        protected int singleSelectionMask
      • addSingleSelectionMask

        protected int addSingleSelectionMask
      • vertexDragged

        protected boolean vertexDragged
    • Constructor Detail

      • VertexSelectingGraphMousePlugin

        public VertexSelectingGraphMousePlugin()
      • VertexSelectingGraphMousePlugin

        public VertexSelectingGraphMousePlugin​(int singleSelectionMask,
                                               int addSingleSelectionMask)
        create an instance with overrides
    • Method Detail

      • configure

        public static <V,​E> void configure​(VisualizationViewer<V,​E> visualizationViewer)
        Configure the passed VisualizationViewer to use vertex selection only. No edge selection with the mouse. Edges will be 'selected' only when both endpoint vertices are selected.
        Type Parameters:
        V - vertex type
        E - edge type
        Parameters:
        visualizationViewer - to configure
      • getLensColor

        public Color getLensColor()
        Returns:
        Returns the lensColor.
      • setLensColor

        public void setLensColor​(Color lensColor)
        Parameters:
        lensColor - The lensColor to set.
      • mousePressed

        public void mousePressed​(MouseEvent e)
        For primary modifiers (default, MouseButton1): pick a single Vertex or Edge that is under the mouse pointer. For additional selection (default Shift+MouseButton1): Add to the selection, a single Vertex or Edge that is under the mouse pointer. If a previously selected Vertex or Edge is under the pointer, it is un-selected.
        Specified by:
        mousePressed in interface MouseListener
        Parameters:
        e - the event
      • singleVertexSelection

        protected boolean singleVertexSelection​(MouseEvent e,
                                                Point2D layoutPoint,
                                                boolean addToSelection)
      • mouseReleased

        public void mouseReleased​(MouseEvent e)
        If the mouse is dragging a rectangle, pick the Vertices contained in that rectangle

        clean up settings from mousePressed

        Specified by:
        mouseReleased in interface MouseListener
      • mouseDragged

        public void mouseDragged​(MouseEvent e)
        If the mouse is over a selected vertex, drag all selected vertices with the mouse. If the mouse is not over a Vertex, draw the rectangle to select multiple Vertices
        Specified by:
        mouseDragged in interface MouseMotionListener
      • transform

        protected Shape transform​(VisualizationViewer<V,​E> vv,
                                  Shape shape)
        override to consider Lens effects
        Parameters:
        vv -
        shape -
        Returns:
      • isLocked

        public boolean isLocked()
        Returns:
        Returns the locked.
      • setLocked

        public void setLocked​(boolean locked)
        Parameters:
        locked - The locked to set.