Package org.jgraph.plaf.basic
Class BasicGraphUI.RootHandle
- java.lang.Object
-
- org.jgraph.plaf.basic.BasicGraphUI.RootHandle
-
- All Implemented Interfaces:
java.io.Serializable,CellHandle
- Enclosing class:
- BasicGraphUI
public class BasicGraphUI.RootHandle extends java.lang.Object implements CellHandle, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected double_mouseToViewDelta_xprotected double_mouseToViewDelta_yprotected CellHandleactiveHandleThe handle that consumed the last mousePressedEvent.protected booleanblockPaintprotected java.awt.geom.Rectangle2DcachedBoundsprotected GraphContextcontextprotected CellView[]contextViewsprotected java.awt.geom.Point2Dcurrentprotected ConnectionSetdisconnectprotected booleanfirstDragprotected CellHandle[]handlesprotected CellViewignoreTargetGroupprotected java.awt.geom.Point2DinitialLocationprotected booleanisContextVisibleprotected booleanisDraggingIndicates whether this handle has started drag and drop.protected booleanisMovingIndicates whether this handle is currently moving cells.protected java.awt.geom.Point2Dlastprotected java.awt.GraphicsoffgraphicsReference to graph off screen graphicsprotected CellView[]portViewsprotected java.awt.geom.Point2DsnapLastprotected java.awt.geom.Point2DsnapStartprotected java.awt.geom.Point2Dstartprotected CellViewtargetGroupprotected CellView[]views
-
Constructor Summary
Constructors Constructor Description RootHandle(GraphContext ctx)Creates a root handle which contains handles for the given cells.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.geom.Point2DconstrainDrag(java.awt.event.MouseEvent event, double totDx, double totDy, double dx, double dy)Hook method to constrain a mouse dragprotected CellViewfindUnselectedInnermostGroup(double x, double y)Used for move into group to find the target group.protected CellViewfindViewForPoint(java.awt.geom.Point2D pt)Hook for subclassers to return a different view for a mouse click atpt.GraphContextgetContext()java.awt.ComponentgetFirstOpaqueParent(java.awt.Component component)protected java.awt.geom.Point2DgetInitialLocation(java.lang.Object[] cells)Returns the initial location, which is the top left corner of the selection, ignoring all connected endpoints of edges.protected voidinitOffscreen()voidmouseDragged(java.awt.event.MouseEvent event)Process mouse dragged event.voidmouseMoved(java.awt.event.MouseEvent event)Invoked when the mouse pointer has been moved on a component (with no buttons down).voidmousePressed(java.awt.event.MouseEvent event)Messaged when a mouse button is pressed.voidmouseReleased(java.awt.event.MouseEvent event)Messaged when the drag operation has terminated with a drop.voidoverlay(java.awt.Graphics g)Paint the handle on the given graphics object during mouse operations.voidpaint(java.awt.Graphics g)Paint the handle on the given graphics object once.protected voidstartDragging(java.awt.event.MouseEvent event)
-
-
-
Field Detail
-
_mouseToViewDelta_x
protected transient double _mouseToViewDelta_x
-
_mouseToViewDelta_y
protected transient double _mouseToViewDelta_y
-
firstDrag
protected transient boolean firstDrag
-
views
protected transient CellView[] views
-
contextViews
protected transient CellView[] contextViews
-
portViews
protected transient CellView[] portViews
-
targetGroup
protected transient CellView targetGroup
-
ignoreTargetGroup
protected transient CellView ignoreTargetGroup
-
cachedBounds
protected transient java.awt.geom.Rectangle2D cachedBounds
-
initialLocation
protected transient java.awt.geom.Point2D initialLocation
-
handles
protected transient CellHandle[] handles
-
start
protected transient java.awt.geom.Point2D start
-
last
protected transient java.awt.geom.Point2D last
-
snapStart
protected transient java.awt.geom.Point2D snapStart
-
snapLast
protected transient java.awt.geom.Point2D snapLast
-
offgraphics
protected transient java.awt.Graphics offgraphics
Reference to graph off screen graphics
-
isMoving
protected boolean isMoving
Indicates whether this handle is currently moving cells. Start may be non-null and isMoving false while the minimum movement has not been reached.
-
isDragging
protected boolean isDragging
Indicates whether this handle has started drag and drop. Note: isDragging => isMoving.
-
activeHandle
protected transient CellHandle activeHandle
The handle that consumed the last mousePressedEvent. Initially null.
-
context
protected transient GraphContext context
-
isContextVisible
protected boolean isContextVisible
-
blockPaint
protected boolean blockPaint
-
current
protected java.awt.geom.Point2D current
-
disconnect
protected transient ConnectionSet disconnect
-
-
Constructor Detail
-
RootHandle
public RootHandle(GraphContext ctx)
Creates a root handle which contains handles for the given cells. The root handle and all its childs point to the specified JGraph instance. The root handle is responsible for dragging the selection.
-
-
Method Detail
-
getInitialLocation
protected java.awt.geom.Point2D getInitialLocation(java.lang.Object[] cells)
Returns the initial location, which is the top left corner of the selection, ignoring all connected endpoints of edges.
-
getContext
public GraphContext getContext()
-
paint
public void paint(java.awt.Graphics g)
Description copied from interface:CellHandlePaint the handle on the given graphics object once.- Specified by:
paintin interfaceCellHandle- Parameters:
g- the graphics object to paint the handle on
-
overlay
public void overlay(java.awt.Graphics g)
Description copied from interface:CellHandlePaint the handle on the given graphics object during mouse operations.- Specified by:
overlayin interfaceCellHandle- Parameters:
g- the graphics object to paint the handle on
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent event)
Invoked when the mouse pointer has been moved on a component (with no buttons down).- Specified by:
mouseMovedin interfaceCellHandle- Parameters:
event- the mouse event to be processed
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent event)
Description copied from interface:CellHandleMessaged when a mouse button is pressed.- Specified by:
mousePressedin interfaceCellHandle- Parameters:
event- the mouse event to be processed
-
findViewForPoint
protected CellView findViewForPoint(java.awt.geom.Point2D pt)
Hook for subclassers to return a different view for a mouse click atpt. For example, this can be used to return a leaf cell instead of a group.
-
findUnselectedInnermostGroup
protected CellView findUnselectedInnermostGroup(double x, double y)
Used for move into group to find the target group.
-
startDragging
protected void startDragging(java.awt.event.MouseEvent event)
-
getFirstOpaqueParent
public java.awt.Component getFirstOpaqueParent(java.awt.Component component)
- Returns:
- Returns the parent graph scrollpane for the specified graph.
-
initOffscreen
protected void initOffscreen()
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent event)
Process mouse dragged event.- Specified by:
mouseDraggedin interfaceCellHandle- Parameters:
event- the drag event to be processed
-
constrainDrag
protected java.awt.geom.Point2D constrainDrag(java.awt.event.MouseEvent event, double totDx, double totDy, double dx, double dy)Hook method to constrain a mouse drag- Parameters:
event-totDx-totDy-dx-dy-- Returns:
- a point describing any position constraining applied
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent event)
Description copied from interface:CellHandleMessaged when the drag operation has terminated with a drop.- Specified by:
mouseReleasedin interfaceCellHandle- Parameters:
event- the drop event to be processed
-
-