Documentation of 'org.jgraph.plaf.basic.BasicGraphUI' Java class
BasicGraphUI
org.jgraph.plaf.basic

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
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static boolean DNDPREVIEW
      Controls live-preview in dragEnabled mode.
      static int MAXCELLS
      The maximum number of cells to paint when dragging.
      static int MAXCLIPCELLS
      Maximum number of cells to compute clipping bounds for.
      static int MAXHANDLES
      The maximum number of handles to paint individually.
      static int SCROLLBORDER
      Border in pixels to scroll if marquee or dragging are active.
      static float SCROLLSTEP
      Multiplicator for width and height when autoscrolling (=stepsize).
    • Constructor Summary

      Constructors 
      Constructor and Description
      BasicGraphUI() 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and 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.
      CellHandle createHandle(GraphContext context)
      Constructs the "root handle" for context.
      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.
      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.
      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.
      void paintCell(java.awt.Graphics g, CellView view, java.awt.geom.Rectangle2D bounds, boolean preview)
      Paints the renderer of view to g at bounds.
      void paintPorts(java.awt.Graphics g, CellView[] ports)
      Paint ports.
      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(JGraph graph, java.lang.Object[] cells, java.awt.event.MouseEvent event)
      From GraphUI interface.
      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 setInsertionLocation(java.awt.Point p)
      Sets the current location for Drag-and-Drop activity.
      void setPreferredMinSize(java.awt.Dimension newSize)
      Sets the preferred minimum size.
      void setSnapSelectedView(boolean snapSelectedView)
      Sets the mode of the snapSelectedView drag operation.
      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.
      void uninstallUI(javax.swing.JComponent c) 
      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

        equals, 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.
    • Constructor Detail

      • BasicGraphUI

        public BasicGraphUI()
    • Method Detail

      • createUI

        public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent x)
      • 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
      • 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.
      • 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
      • uninstallUI

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

        public void paint(java.awt.Graphics g,
                          javax.swing.JComponent c)
        Main painting routine.
        Overrides:
        paint in class javax.swing.plaf.ComponentUI
      • 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
      • 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
      • 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
      • 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.
      • 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
      • 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.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.