|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object GraphUI net.clackrouter.jgraph.pad.GPGraphUI
public class GPGraphUI
Nested Class Summary | |
---|---|
class |
GPGraphUI.CellEditorHandler
Listener responsible for getting cell editing events and updating the graph accordingly. |
class |
GPGraphUI.ComponentHandler
Updates the preferred size when scrolling (if necessary). |
class |
GPGraphUI.GPTransferHandler
TransferHandler that can import text. |
class |
GPGraphUI.GraphDropTargetListener
Graph Drop Target Listener |
class |
GPGraphUI.GraphIncrementAction
GraphIncrementAction is used to handle up/down actions. |
class |
GPGraphUI.GraphModelHandler
Listens for changes in the graph model and updates the view accordingly. |
class |
GPGraphUI.GraphSelectionHandler
Listens for changes in the selection model and updates the display accordingly. |
class |
GPGraphUI.GraphTransferHandler
|
class |
GPGraphUI.GraphViewObserver
Listens for changes in the graph view and updates the size accordingly. |
class |
GPGraphUI.KeyHandler
This is used to get mutliple key down events to appropriately generate events. |
class |
GPGraphUI.MouseHandler
TreeMouseListener is responsible for updating the selection based on mouse events. |
class |
GPGraphUI.MouseInputHandler
MouseInputHandler handles passing all mouse events, including mouse motion events, until the mouse is released to the destination it is constructed with. |
class |
GPGraphUI.PropertyChangeHandler
PropertyChangeListener for the graph. |
class |
GPGraphUI.RootHandle
|
Field Summary | |
---|---|
protected GraphCellEditor |
cellEditor
Current editor for the graph. |
protected javax.swing.event.CellEditorListener |
cellEditorListener
Listens for CellEditor events. |
protected java.awt.event.ComponentListener |
componentListener
Listens for Component events. |
protected GPGraphUI.GraphDropTargetListener |
defaultDropTargetListener
The default DropTargetListener. |
protected javax.swing.TransferHandler |
defaultTransferHandler
The default TransferHandler. |
static boolean |
DNDPREVIEW
Controls live-preview in dragEnabled mode. |
protected int |
dropAction
Needed to exchange information between DropTargetHandler and TransferHandler. |
protected java.lang.Object |
editingCell
Path that is being edited. |
protected java.awt.Component |
editingComponent
When editing, this will be the Component that is doing the actual editing. |
protected boolean |
editorHasDifferentSize
Set to true if the editor has a different size than the renderer. |
protected CellView |
focus
The focused cell under the mousepointer. |
protected JGraph |
graph
Component that we're going to be drawing into. |
protected GraphLayoutCache |
graphLayoutCache
Reference to the graph's view (geometric pattern). |
protected GraphModel |
graphModel
Used to determine what to display. |
protected GraphModelListener |
graphModelListener
Is responsible for updating the view based on model events. |
protected GraphSelectionListener |
graphSelectionListener
Updates the display when the selection changes. |
protected GraphSelectionModel |
graphSelectionModel
Model maintaining the selection. |
protected java.util.Observer |
graphViewObserver
Updates the display when the view has changed. |
protected CellHandle |
handle
Handle that we are going to use. |
protected java.awt.Point |
insertionLocation
Needed to exchange information between Transfer- and MouseListener. |
protected java.awt.event.KeyListener |
keyListener
Listens for KeyListener events. |
protected BasicMarqueeHandler |
marquee
Marquee that we are going to use. |
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. |
protected java.awt.event.MouseListener |
mouseListener
Listens for Mouse events. |
protected java.awt.Dimension |
preferredMinSize
Minimum preferred size. |
protected java.awt.Dimension |
preferredSize
Size needed to completely display all the cells. |
protected java.beans.PropertyChangeListener |
propertyChangeListener
Listens for JGraph property changes and updates display. |
protected javax.swing.CellRendererPane |
rendererPane
Used to paint the CellRenderer. |
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). |
protected boolean |
snapSelectedView
If ture, a the view under mousepointer will be snapped to the grid lines during a drag operation. |
protected boolean |
stopEditingInCompleteEditing
Set to false when editing and shouldSelectCell() returns true meaning the node should be selected before editing, used in completeEditing. |
protected boolean |
validCachedPreferredSize
Is the preferredSize valid? |
Constructor Summary | |
---|---|
GPGraphUI()
|
Method Summary | |
---|---|
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 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. |
protected java.util.Observer |
createGraphViewObserver()
Returns a listener that can update the graph when the view changes. |
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()
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent x)
|
java.lang.Object |
getEditingCell(JGraph graph)
Returns the element that is being edited. |
protected java.lang.Object |
getFocusedCell()
Returns the cell that has the focus. |
RouterGraph |
getGPGraph()
|
CellHandle |
getHandle(JGraph graph)
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 |
insertCells(java.lang.Object[] cells,
java.util.Map viewAttributeMap,
ConnectionSet cs,
ParentMap pm,
boolean clone,
int dx,
int dy)
Insert the specified cells into the model. |
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 event)
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. |
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 |
paintForeground(java.awt.Graphics g)
Paint the foreground of this graph. |
protected void |
paintGrid(double gs,
java.awt.Graphics g,
java.awt.geom.Rectangle2D r)
Paint the grid. |
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(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. |
protected void |
setGraphLayoutCache(GraphLayoutCache view)
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() . |
protected void |
updateHandle()
Update the handle using createHandle. |
void |
updateSize()
Messages the Graph with graphDidChange . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean DNDPREVIEW
public static int SCROLLBORDER
public static float SCROLLSTEP
public static int MAXCELLS
public static int MAXHANDLES
public static int MAXCLIPCELLS
protected java.awt.Dimension preferredMinSize
protected JGraph graph
protected GraphLayoutCache graphLayoutCache
protected GraphCellEditor cellEditor
protected boolean stopEditingInCompleteEditing
protected javax.swing.CellRendererPane rendererPane
protected java.awt.Dimension preferredSize
protected boolean validCachedPreferredSize
protected GraphModel graphModel
protected GraphSelectionModel graphSelectionModel
protected CellHandle handle
protected BasicMarqueeHandler marquee
protected java.awt.Component editingComponent
protected CellView focus
protected java.lang.Object editingCell
protected boolean editorHasDifferentSize
protected java.awt.Point insertionLocation
protected int dropAction
protected boolean snapSelectedView
protected java.beans.PropertyChangeListener propertyChangeListener
protected java.awt.event.MouseListener mouseListener
protected java.awt.event.KeyListener keyListener
protected java.awt.event.ComponentListener componentListener
protected javax.swing.event.CellEditorListener cellEditorListener
protected GraphSelectionListener graphSelectionListener
protected GraphModelListener graphModelListener
protected java.util.Observer graphViewObserver
protected javax.swing.TransferHandler defaultTransferHandler
protected GPGraphUI.GraphDropTargetListener defaultDropTargetListener
Constructor Detail |
---|
public GPGraphUI()
Method Detail |
---|
public RouterGraph getGPGraph()
protected javax.swing.TransferHandler createTransferHandler()
protected void paintBackground(java.awt.Graphics g)
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent x)
protected void setModel(GraphModel model)
updateSize
.
protected void setGraphLayoutCache(GraphLayoutCache view)
updateSize
.
protected void setMarquee(BasicMarqueeHandler marqueeHandler)
protected void setSelectionModel(GraphSelectionModel newLSM)
public CellHandle getHandle(JGraph graph)
protected java.lang.Object getFocusedCell()
public java.awt.geom.Dimension2D getPreferredSize(JGraph graph, CellView view)
public java.awt.Point getInsertionLocation()
public void setInsertionLocation(java.awt.Point p)
public void selectCellsForEvent(JGraph graph, java.lang.Object[] cells, java.awt.event.MouseEvent event)
public void selectCellsForEvent(java.lang.Object[] cells, java.awt.event.MouseEvent event)
public void selectCellForEvent(java.lang.Object cell, java.awt.event.MouseEvent event)
protected void toggleSelectionCellForEvent(java.lang.Object cell, java.awt.event.MouseEvent event)
public boolean isAddToSelectionEvent(java.awt.event.MouseEvent e)
public boolean isToggleSelectionEvent(java.awt.event.MouseEvent event)
public boolean isForceMarqueeEvent(java.awt.event.MouseEvent event)
public boolean isConstrainedMoveEvent(java.awt.event.MouseEvent event)
public boolean isEditing(JGraph graph)
public boolean stopEditing(JGraph graph)
public void cancelEditing(JGraph graph)
public void startEditingAtCell(JGraph graph, java.lang.Object cell)
public java.lang.Object getEditingCell(JGraph graph)
public void installUI(javax.swing.JComponent c)
protected void prepareForUIInstall()
graph
instance variable has been
set, but before any defaults/listeners have been installed.
protected void completeUIInstall()
protected void installDefaults()
protected void installListeners()
protected void installKeyboardActions()
protected void installComponents()
protected java.beans.PropertyChangeListener createPropertyChangeListener()
protected java.awt.event.MouseListener createMouseListener()
protected java.awt.event.KeyListener createKeyListener()
protected GraphSelectionListener createGraphSelectionListener()
protected javax.swing.event.CellEditorListener createCellEditorListener()
protected java.awt.event.ComponentListener createComponentListener()
protected javax.swing.CellRendererPane createCellRendererPane()
protected java.util.Observer createGraphViewObserver()
protected GraphModelListener createGraphModelListener()
public void uninstallUI(javax.swing.JComponent c)
protected void completeUIUninstall()
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected void uninstallComponents()
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
public void paintCell(java.awt.Graphics g, CellView view, java.awt.geom.Rectangle2D bounds, boolean preview)
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.
protected void paintGrid(double gs, java.awt.Graphics g, java.awt.geom.Rectangle2D r)
protected void paintForeground(java.awt.Graphics g)
public void paintPorts(java.awt.Graphics g, CellView[] ports)
ports
.
protected void updateHandle()
protected GraphContext createContext(JGraph graph, java.lang.Object[] cells)
public CellHandle createHandle(GraphContext context)
context
.
context
- reference to the context of the current selection.public void updateSize()
graphDidChange
.
protected void updateCachedPreferredSize()
preferredSize
instance variable,
which is returned from getPreferredSize()
.
public void setPreferredMinSize(java.awt.Dimension newSize)
public java.awt.Dimension getPreferredMinSize()
public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
protected void completeEditing()
getInvokesStopCellEditing
, stopCellEditing will
invoked on the current editor. Then completeEditing will
be messaged with false, true, false to cancel any lingering
editing.
protected void completeEditing(boolean messageStop, boolean messageCancel, boolean messageGraph)
protected boolean startEditing(java.lang.Object cell, java.awt.event.MouseEvent event)
This assumes that cell is valid and visible.
public static void autoscroll(JGraph graph, java.awt.Point p)
p
.
public void insertCells(java.lang.Object[] cells, java.util.Map viewAttributeMap, ConnectionSet cs, ParentMap pm, boolean clone, int dx, int dy)
public boolean isSnapSelectedView()
public void setSnapSelectedView(boolean snapSelectedView)
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |