Class BasicGraphUI

  • All Implemented Interfaces:
    java.io.Serializable

    public class BasicGraphUI
    extends GraphUI
    implements java.io.Serializable
    The basic L&F for a graph data structure.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicGraphUI()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void autoscroll​(JGraph graph, java.awt.Point p)
      Scroll the graph for an event at p.
      void cancelEditing​(JGraph graph)
      Cancels all current editing sessions.
      protected void completeEditing()
      Messages to stop the editing session.
      protected void completeEditing​(boolean messageStop, boolean messageCancel, boolean messageGraph)
      Stops the editing session.
      protected void completeUIInstall()
      Invoked from installUI after all the defaults/listeners have been installed.
      protected void completeUIUninstall()  
      protected javax.swing.event.CellEditorListener createCellEditorListener()
      Creates a listener to handle events from the current editor.
      protected javax.swing.CellRendererPane createCellRendererPane()
      Returns the renderer pane that renderer components are placed in.
      protected java.awt.event.ComponentListener createComponentListener()
      Creates and returns a new ComponentHandler.
      protected GraphContext createContext​(JGraph graph, java.lang.Object[] cells)  
      protected GraphLayoutCacheListener createGraphLayoutCacheListener()
      Returns a listener that can update the graph when the view changes.
      protected GraphModelListener createGraphModelListener()
      Returns a listener that can update the graph when the model changes.
      protected GraphSelectionListener createGraphSelectionListener()
      Creates the listener that updates the display based on selection change methods.
      CellHandle createHandle​(GraphContext context)
      Constructs the "root handle" for context.
      protected java.awt.event.KeyListener createKeyListener()
      Creates the listener reponsible for getting key events from the graph.
      protected java.awt.event.MouseListener createMouseListener()
      Creates the listener responsible for calling the correct handlers based on mouse events, and to select invidual cells.
      protected java.beans.PropertyChangeListener createPropertyChangeListener()
      Creates a listener that is responsible to update the UI based on how the graph's bounds properties change.
      protected javax.swing.TransferHandler createTransferHandler()
      Creates an instance of TransferHandler.
      static javax.swing.plaf.ComponentUI createUI​(javax.swing.JComponent x)  
      void drawGraph​(java.awt.Graphics g, java.awt.geom.Rectangle2D clipBounds)
      Draws the graph to the specified graphics object within the specified clip bounds, if any
      int getDropAction()
      Returns the current drop action.
      java.lang.Object getEditingCell​(JGraph graph)
      Returns the element that is being edited.
      protected java.awt.geom.Point2D getEditorLocation​(java.lang.Object cell, java.awt.geom.Dimension2D editorSize, java.awt.geom.Point2D pt)
      Subclassers may override this to provide a better location for the in-place editing of edges (if you do not inherit from the EdgeRenderer class).
      protected java.lang.Object getFocusedCell()
      Returns the cell that has the focus.
      CellHandle getHandle()
      Returns the handle that is currently active, or null, if no handle is currently active.
      java.awt.Point getInsertionLocation()
      Returns the current location of the Drag-and-Drop activity.
      java.awt.Dimension getMaximumSize​(javax.swing.JComponent c)
      Returns the maximum size for this component, which will be the preferred size if the instance is currently in a JGraph, or 0, 0.
      java.awt.Dimension getMinimumSize​(javax.swing.JComponent c)
      Returns the minimum size for this component.
      java.awt.Dimension getPreferredMinSize()
      Returns the minimum preferred size.
      java.awt.Dimension getPreferredSize​(javax.swing.JComponent c)
      Returns the preferred size to properly display the graph.
      java.awt.geom.Dimension2D getPreferredSize​(JGraph graph, CellView view)
      Get the preferred Size for a cell view.
      protected void installComponents()
      Intalls the subcomponents of the graph, which is the renderer pane.
      protected void installDefaults()
      Invoked as part from the boilerplate install block.
      protected void installKeyboardActions()
      Invoked as part from the boilerplate install block.
      protected void installListeners()
      Invoked as part from the boilerplate install block.
      void installUI​(javax.swing.JComponent c)  
      boolean isAddToSelectionEvent​(java.awt.event.MouseEvent e)
      Returning true signifies that cells are added to the selection.
      boolean isConstrainedMoveEvent​(java.awt.event.MouseEvent event)
      Returning true signifies a move should only be applied to one direction.
      boolean isEditing​(JGraph graph)
      Returns true if the graph is being edited.
      boolean isForceMarqueeEvent​(java.awt.event.MouseEvent event)
      Returning true signifies the marquee handler has precedence over other handlers, and is receiving subsequent mouse events.
      boolean isSnapSelectedView()  
      boolean isToggleSelectionEvent​(java.awt.event.MouseEvent e)
      Returning true signifies a mouse event on the cell should toggle the selection of only the cell under mouse.
      void paint​(java.awt.Graphics g, javax.swing.JComponent c)
      Main painting routine.
      protected void paintBackground​(java.awt.Graphics g)
      Paint the background of this graph.
      protected void paintBackgroundComponent​(java.awt.Graphics g, java.awt.Component component, java.awt.Rectangle clip)
      Requests that the component responsible for painting the background paint itself
      protected void paintBackgroundImage​(java.awt.Graphics g, java.awt.Rectangle clip)
      Hook for subclassers to paint the background image.
      void paintCell​(java.awt.Graphics g, CellView view, java.awt.geom.Rectangle2D bounds, boolean preview)
      Paints the renderer of view to g at bounds.
      protected void paintCells​(java.awt.Graphics g, java.awt.geom.Rectangle2D realClipBounds)
      Hook method to allow subclassers to alter just the cell painting functionality
      protected void paintForeground​(java.awt.Graphics g)
      Paint the foreground of this graph.
      protected void paintGrid​(double gs, java.awt.Graphics g, java.awt.geom.Rectangle2D clipBounds)
      Paint the grid.
      protected void paintOverlay​(java.awt.Graphics g)
      Hook method to paints the overlay
      void paintPorts​(java.awt.Graphics g, CellView[] ports)
      Paint ports.
      protected void prepareForUIInstall()
      Invoked after the graph instance variable has been set, but before any defaults/listeners have been installed.
      void selectCellForEvent​(java.lang.Object cell, java.awt.event.MouseEvent event)
      Messaged to update the selection based on a MouseEvent over a particular cell.
      void selectCellsForEvent​(java.lang.Object[] cells, java.awt.event.MouseEvent event)
      Messaged to update the selection based on a MouseEvent for a group of cells.
      void selectCellsForEvent​(JGraph graph, java.lang.Object[] cells, java.awt.event.MouseEvent event)
      From GraphUI interface.
      protected void setGraphLayoutCache​(GraphLayoutCache cache)
      Sets the GraphLayoutCache (geometric pattern).
      void setInsertionLocation​(java.awt.Point p)
      Sets the current location for Drag-and-Drop activity.
      protected void setMarquee​(BasicMarqueeHandler marqueeHandler)
      Sets the marquee handler.
      protected void setModel​(GraphModel model)
      Sets the GraphModel.
      void setPreferredMinSize​(java.awt.Dimension newSize)
      Sets the preferred minimum size.
      protected void setSelectionModel​(GraphSelectionModel newLSM)
      Resets the selection model.
      void setSnapSelectedView​(boolean snapSelectedView)
      Sets the mode of the snapSelectedView drag operation.
      protected boolean startEditing​(java.lang.Object cell, java.awt.event.MouseEvent event)
      Will start editing for cell if there is a cellEditor and shouldSelectCell returns true.
      void startEditingAtCell​(JGraph graph, java.lang.Object cell)
      Selects the cell and tries to edit it.
      boolean stopEditing​(JGraph graph)
      Stops the current editing session.
      protected void toggleSelectionCellForEvent​(java.lang.Object cell, java.awt.event.MouseEvent event)
      Messaged to update the selection based on a toggle selection event, which means the cell's selection state is inverted.
      protected void uninstallComponents()
      Uninstalls the renderer pane.
      protected void uninstallKeyboardActions()  
      protected void uninstallListeners()  
      void uninstallUI​(javax.swing.JComponent c)  
      protected void updateCachedPreferredSize()
      Updates the preferredSize instance variable, which is returned from getPreferredSize().
      void updateHandle()
      Update the handle using createHandle.
      void updateSize()
      Messages the Graph with graphDidChange.
      • Methods inherited from class javax.swing.plaf.ComponentUI

        contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, update
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DNDPREVIEW

        public static final boolean DNDPREVIEW
        Controls live-preview in dragEnabled mode. This is used to disable live-preview in dragEnabled mode on Java 1.4.0 to workaround a bug that cause the VM to hang during concurrent DnD and repaints. Is this still required?
      • SCROLLBORDER

        public static int SCROLLBORDER
        Border in pixels to scroll if marquee or dragging are active.
      • SCROLLSTEP

        public static float SCROLLSTEP
        Multiplicator for width and height when autoscrolling (=stepsize).
      • MAXCELLS

        public static int MAXCELLS
        The maximum number of cells to paint when dragging.
      • MAXHANDLES

        public static int MAXHANDLES
        The maximum number of handles to paint individually.
      • MAXCLIPCELLS

        public static int MAXCLIPCELLS
        Maximum number of cells to compute clipping bounds for.
      • preferredMinSize

        protected java.awt.Dimension preferredMinSize
        Minimum preferred size.
      • graph

        protected JGraph graph
        Component that we're going to be drawing into.
      • graphLayoutCache

        protected GraphLayoutCache graphLayoutCache
        Reference to the graph's view (geometric pattern).
      • cellEditor

        protected GraphCellEditor cellEditor
        Current editor for the graph.
      • stopEditingInCompleteEditing

        protected boolean stopEditingInCompleteEditing
        Set to false when editing and shouldSelectCell() returns true meaning the node should be selected before editing, used in completeEditing.
      • rendererPane

        protected javax.swing.CellRendererPane rendererPane
        Used to paint the CellRenderer.
      • preferredSize

        protected java.awt.Dimension preferredSize
        Size needed to completely display all the cells.
      • validCachedPreferredSize

        protected boolean validCachedPreferredSize
        Is the preferredSize valid?
      • graphModel

        protected GraphModel graphModel
        Used to determine what to display.
      • graphSelectionModel

        protected GraphSelectionModel graphSelectionModel
        Model maintaining the selection.
      • handle

        protected CellHandle handle
        Handle that we are going to use.
      • editingComponent

        protected java.awt.Component editingComponent
        When editing, this will be the Component that is doing the actual editing.
      • focus

        protected CellView focus
        The focused cell under the mousepointer and the last focused cell.
      • lastFocus

        protected CellView lastFocus
        The focused cell under the mousepointer and the last focused cell.
      • editingCell

        protected java.lang.Object editingCell
        Path that is being edited.
      • editorHasDifferentSize

        protected boolean editorHasDifferentSize
        Set to true if the editor has a different size than the renderer.
      • insertionLocation

        protected java.awt.Point insertionLocation
        Needed to exchange information between Transfer- and MouseListener.
      • dropAction

        protected int dropAction
        Needed to exchange information between DropTargetHandler and TransferHandler.
      • snapSelectedView

        protected boolean snapSelectedView
        If ture, a the view under mousepointer will be snapped to the grid lines during a drag operation. If snap-to-grid mode is disabled, views are moved by a snap increment.
      • propertyChangeListener

        protected java.beans.PropertyChangeListener propertyChangeListener
        Listens for JGraph property changes and updates display.
      • mouseListener

        protected java.awt.event.MouseListener mouseListener
        Listens for Mouse events.
      • keyListener

        protected java.awt.event.KeyListener keyListener
        Listens for KeyListener events.
      • componentListener

        protected java.awt.event.ComponentListener componentListener
        Listens for Component events.
      • cellEditorListener

        protected javax.swing.event.CellEditorListener cellEditorListener
        Listens for CellEditor events.
      • graphSelectionListener

        protected GraphSelectionListener graphSelectionListener
        Updates the display when the selection changes.
      • graphModelListener

        protected GraphModelListener graphModelListener
        Is responsible for updating the view based on model events.
      • graphLayoutCacheListener

        protected GraphLayoutCacheListener graphLayoutCacheListener
        Updates the display when the view has changed.
      • defaultTransferHandler

        protected javax.swing.TransferHandler defaultTransferHandler
        The default TransferHandler.
      • dropTarget

        protected java.awt.dnd.DropTarget dropTarget
        The drop target where the default listener was last installed.
    • Constructor Detail

      • BasicGraphUI

        public BasicGraphUI()
    • Method Detail

      • createUI

        public static javax.swing.plaf.ComponentUI createUI​(javax.swing.JComponent x)
      • setModel

        protected void setModel​(GraphModel model)
        Sets the GraphModel. This invokes updateSize.
      • setGraphLayoutCache

        protected void setGraphLayoutCache​(GraphLayoutCache cache)
        Sets the GraphLayoutCache (geometric pattern). This invokes updateSize.
      • setMarquee

        protected void setMarquee​(BasicMarqueeHandler marqueeHandler)
        Sets the marquee handler.
      • setSelectionModel

        protected void setSelectionModel​(GraphSelectionModel newLSM)
        Resets the selection model. The appropriate listeners are installed on the model.
      • getHandle

        public CellHandle getHandle()
        Returns the handle that is currently active, or null, if no handle is currently active. Typically, the returned objects are instances of the RootHandle inner class.
        Specified by:
        getHandle in class GraphUI
      • getDropAction

        public int getDropAction()
        Returns the current drop action.
        Specified by:
        getDropAction in class GraphUI
      • getFocusedCell

        protected java.lang.Object getFocusedCell()
        Returns the cell that has the focus.
      • getPreferredSize

        public java.awt.geom.Dimension2D getPreferredSize​(JGraph graph,
                                                          CellView view)
        Get the preferred Size for a cell view.
        Specified by:
        getPreferredSize in class GraphUI
      • getInsertionLocation

        public java.awt.Point getInsertionLocation()
        Returns the current location of the Drag-and-Drop activity.
        Specified by:
        getInsertionLocation in class GraphUI
      • setInsertionLocation

        public void setInsertionLocation​(java.awt.Point p)
        Sets the current location for Drag-and-Drop activity. Should be set to null after a drop. Used from within DropTargetListener.
        Specified by:
        setInsertionLocation in class GraphUI
      • selectCellsForEvent

        public void selectCellsForEvent​(JGraph graph,
                                        java.lang.Object[] cells,
                                        java.awt.event.MouseEvent event)
        From GraphUI interface.
        Specified by:
        selectCellsForEvent in class GraphUI
      • selectCellsForEvent

        public void selectCellsForEvent​(java.lang.Object[] cells,
                                        java.awt.event.MouseEvent event)
        Messaged to update the selection based on a MouseEvent for a group of cells. If the event is a toggle selection event, the cells are either selected, or deselected. Otherwise the cells are selected.
      • selectCellForEvent

        public void selectCellForEvent​(java.lang.Object cell,
                                       java.awt.event.MouseEvent event)
        Messaged to update the selection based on a MouseEvent over a particular cell. If the event is a toggle selection event, the cell is either selected, or deselected. Otherwise the cell is selected.
      • toggleSelectionCellForEvent

        protected void toggleSelectionCellForEvent​(java.lang.Object cell,
                                                   java.awt.event.MouseEvent event)
        Messaged to update the selection based on a toggle selection event, which means the cell's selection state is inverted.
      • isAddToSelectionEvent

        public boolean isAddToSelectionEvent​(java.awt.event.MouseEvent e)
        Returning true signifies that cells are added to the selection.
      • isToggleSelectionEvent

        public boolean isToggleSelectionEvent​(java.awt.event.MouseEvent e)
        Returning true signifies a mouse event on the cell should toggle the selection of only the cell under mouse.
      • isForceMarqueeEvent

        public boolean isForceMarqueeEvent​(java.awt.event.MouseEvent event)
        Returning true signifies the marquee handler has precedence over other handlers, and is receiving subsequent mouse events.
      • isConstrainedMoveEvent

        public boolean isConstrainedMoveEvent​(java.awt.event.MouseEvent event)
        Returning true signifies a move should only be applied to one direction.
      • isEditing

        public boolean isEditing​(JGraph graph)
        Returns true if the graph is being edited. The item that is being edited can be returned by getEditingPath().
        Specified by:
        isEditing in class GraphUI
      • stopEditing

        public boolean stopEditing​(JGraph graph)
        Stops the current editing session. This has no effect if the graph isn't being edited. Returns true if the editor allows the editing session to stop.
        Specified by:
        stopEditing in class GraphUI
      • cancelEditing

        public void cancelEditing​(JGraph graph)
        Cancels all current editing sessions.
        Specified by:
        cancelEditing in class GraphUI
      • startEditingAtCell

        public void startEditingAtCell​(JGraph graph,
                                       java.lang.Object cell)
        Selects the cell and tries to edit it. Editing will fail if the CellEditor won't allow it for the selected item.
        Specified by:
        startEditingAtCell in class GraphUI
      • getEditingCell

        public java.lang.Object getEditingCell​(JGraph graph)
        Returns the element that is being edited.
        Specified by:
        getEditingCell in class GraphUI
      • installUI

        public void installUI​(javax.swing.JComponent c)
        Overrides:
        installUI in class javax.swing.plaf.ComponentUI
      • prepareForUIInstall

        protected void prepareForUIInstall()
        Invoked after the graph instance variable has been set, but before any defaults/listeners have been installed.
      • completeUIInstall

        protected void completeUIInstall()
        Invoked from installUI after all the defaults/listeners have been installed.
      • installDefaults

        protected void installDefaults()
        Invoked as part from the boilerplate install block. This sets the look and feel specific variables in JGraph.
      • installListeners

        protected void installListeners()
        Invoked as part from the boilerplate install block. This installs the listeners from BasicGraphUI in the graph.
      • installKeyboardActions

        protected void installKeyboardActions()
        Invoked as part from the boilerplate install block.
      • installComponents

        protected void installComponents()
        Intalls the subcomponents of the graph, which is the renderer pane.
      • createTransferHandler

        protected javax.swing.TransferHandler createTransferHandler()
        Creates an instance of TransferHandler. Used for subclassers to provide different TransferHandler.
      • createPropertyChangeListener

        protected java.beans.PropertyChangeListener createPropertyChangeListener()
        Creates a listener that is responsible to update the UI based on how the graph's bounds properties change.
      • createMouseListener

        protected java.awt.event.MouseListener createMouseListener()
        Creates the listener responsible for calling the correct handlers based on mouse events, and to select invidual cells.
      • createKeyListener

        protected java.awt.event.KeyListener createKeyListener()
        Creates the listener reponsible for getting key events from the graph.
      • createGraphSelectionListener

        protected GraphSelectionListener createGraphSelectionListener()
        Creates the listener that updates the display based on selection change methods.
      • createCellEditorListener

        protected javax.swing.event.CellEditorListener createCellEditorListener()
        Creates a listener to handle events from the current editor.
      • createComponentListener

        protected java.awt.event.ComponentListener createComponentListener()
        Creates and returns a new ComponentHandler.
      • createCellRendererPane

        protected javax.swing.CellRendererPane createCellRendererPane()
        Returns the renderer pane that renderer components are placed in.
      • createGraphLayoutCacheListener

        protected GraphLayoutCacheListener createGraphLayoutCacheListener()
        Returns a listener that can update the graph when the view changes.
      • createGraphModelListener

        protected GraphModelListener createGraphModelListener()
        Returns a listener that can update the graph when the model changes.
      • uninstallUI

        public void uninstallUI​(javax.swing.JComponent c)
        Overrides:
        uninstallUI in class javax.swing.plaf.ComponentUI
      • completeUIUninstall

        protected void completeUIUninstall()
      • uninstallListeners

        protected void uninstallListeners()
      • uninstallKeyboardActions

        protected void uninstallKeyboardActions()
      • uninstallComponents

        protected void uninstallComponents()
        Uninstalls the renderer pane.
      • paint

        public void paint​(java.awt.Graphics g,
                          javax.swing.JComponent c)
        Main painting routine.
        Overrides:
        paint in class javax.swing.plaf.ComponentUI
      • paintOverlay

        protected void paintOverlay​(java.awt.Graphics g)
        Hook method to paints the overlay
        Parameters:
        g - the graphics object to paint the overlay to
      • drawGraph

        public void drawGraph​(java.awt.Graphics g,
                              java.awt.geom.Rectangle2D clipBounds)
        Draws the graph to the specified graphics object within the specified clip bounds, if any
        Parameters:
        g - the graphics object to draw the graph to
        clipBounds - the bounds within graph cells must intersect to be redrawn
      • paintCells

        protected void paintCells​(java.awt.Graphics g,
                                  java.awt.geom.Rectangle2D realClipBounds)
        Hook method to allow subclassers to alter just the cell painting functionality
        Parameters:
        g - the graphics object to paint to
        realClipBounds - the bounds of the region being repainted
      • paintCell

        public void paintCell​(java.awt.Graphics g,
                              CellView view,
                              java.awt.geom.Rectangle2D bounds,
                              boolean preview)
        Paints the renderer of view to g at bounds. Recursive implementation that paints the children first.

        The reciever should NOT modify clipBounds, or insets. The preview flag is passed to the renderer, and is not used here.

        Specified by:
        paintCell in class GraphUI
      • paintBackground

        protected void paintBackground​(java.awt.Graphics g)
        Paint the background of this graph. Calls paintGrid.
      • paintBackgroundImage

        protected void paintBackgroundImage​(java.awt.Graphics g,
                                            java.awt.Rectangle clip)
        Hook for subclassers to paint the background image.
        Parameters:
        g - The graphics object to paint the image on.
        clip - The clipping region to draw into
      • paintBackgroundComponent

        protected void paintBackgroundComponent​(java.awt.Graphics g,
                                                java.awt.Component component,
                                                java.awt.Rectangle clip)
        Requests that the component responsible for painting the background paint itself
        Parameters:
        g - The graphics object to paint the image on.
        component - the component to be painted onto the background image
        clip - The clipping region to draw into
      • paintGrid

        protected void paintGrid​(double gs,
                                 java.awt.Graphics g,
                                 java.awt.geom.Rectangle2D clipBounds)
        Paint the grid.
      • paintForeground

        protected void paintForeground​(java.awt.Graphics g)
        Paint the foreground of this graph. Calls paintPorts.
      • paintPorts

        public void paintPorts​(java.awt.Graphics g,
                               CellView[] ports)
        Paint ports.
        Specified by:
        paintPorts in class GraphUI
      • updateHandle

        public void updateHandle()
        Update the handle using createHandle.
        Specified by:
        updateHandle in class GraphUI
      • createContext

        protected GraphContext createContext​(JGraph graph,
                                             java.lang.Object[] cells)
      • createHandle

        public CellHandle createHandle​(GraphContext context)
        Constructs the "root handle" for context.
        Parameters:
        context - reference to the context of the current selection.
      • updateSize

        public void updateSize()
        Messages the Graph with graphDidChange.
      • updateCachedPreferredSize

        protected void updateCachedPreferredSize()
        Updates the preferredSize instance variable, which is returned from getPreferredSize().
      • setPreferredMinSize

        public void setPreferredMinSize​(java.awt.Dimension newSize)
        Sets the preferred minimum size.
      • getPreferredMinSize

        public java.awt.Dimension getPreferredMinSize()
        Returns the minimum preferred size.
      • getPreferredSize

        public java.awt.Dimension getPreferredSize​(javax.swing.JComponent c)
        Returns the preferred size to properly display the graph.
        Overrides:
        getPreferredSize in class javax.swing.plaf.ComponentUI
      • getMinimumSize

        public java.awt.Dimension getMinimumSize​(javax.swing.JComponent c)
        Returns the minimum size for this component. Which will be the min preferred size or 0, 0.
        Overrides:
        getMinimumSize in class javax.swing.plaf.ComponentUI
      • getMaximumSize

        public java.awt.Dimension getMaximumSize​(javax.swing.JComponent c)
        Returns the maximum size for this component, which will be the preferred size if the instance is currently in a JGraph, or 0, 0.
        Overrides:
        getMaximumSize in class javax.swing.plaf.ComponentUI
      • completeEditing

        protected void completeEditing()
        Messages to stop the editing session. If the UI the receiver is providing the look and feel for returns true from getInvokesStopCellEditing, stopCellEditing will invoked on the current editor. Then completeEditing will be messaged with false, true, false to cancel any lingering editing.
      • completeEditing

        protected void completeEditing​(boolean messageStop,
                                       boolean messageCancel,
                                       boolean messageGraph)
        Stops the editing session. If messageStop is true the editor is messaged with stopEditing, if messageCancel is true the editor is messaged with cancelEditing. If messageGraph is true the graphModel is messaged with valueForCellChanged.
      • startEditing

        protected boolean startEditing​(java.lang.Object cell,
                                       java.awt.event.MouseEvent event)
        Will start editing for cell if there is a cellEditor and shouldSelectCell returns true.

        This assumes that cell is valid and visible.

      • getEditorLocation

        protected java.awt.geom.Point2D getEditorLocation​(java.lang.Object cell,
                                                          java.awt.geom.Dimension2D editorSize,
                                                          java.awt.geom.Point2D pt)
        Subclassers may override this to provide a better location for the in-place editing of edges (if you do not inherit from the EdgeRenderer class).
      • autoscroll

        public static void autoscroll​(JGraph graph,
                                      java.awt.Point p)
        Scroll the graph for an event at p.
      • isSnapSelectedView

        public boolean isSnapSelectedView()
        Returns:
        true if snapSelectedView mode is enabled during the drag operation. If it is enabled, the view, that is returned by the findViewForPoint(Point pt), will be snapped to the grid lines.
        By default, findViewForPoint() returns the first view from the GraphContext whose bounds intersect with snap proximity of a mouse pointer. If snap-to-grid mode is disabled, views are moved by a snap increment.
      • setSnapSelectedView

        public void setSnapSelectedView​(boolean snapSelectedView)
        Sets the mode of the snapSelectedView drag operation.
        Parameters:
        snapSelectedView - specifies if the snap-to-grid mode should be applied during a drag operation. If it is enabled, the view, that is returned by the findViewForPoint(Point pt), will be snapped to the grid lines.
        By default, findViewForPoint() returns the first view from the GraphContext whose bounds intersect with snap proximity of a mouse pointer. If snap-to-grid mode is disabled, views are moved by a snap increment.