org.jgraph.plaf.basic

Class BasicGraphUI.RootHandle

public class BasicGraphUI.RootHandle extends Object implements CellHandle, Serializable

Field Summary
protected CellHandleactiveHandle
The handle that consumed the last mousePressedEvent.
protected booleanblockPaint
protected Rectangle2DcachedBounds
protected GraphContextcontext
protected CellView[]contextViews
protected Point2Dcurrent
protected ConnectionSetdisconnect
protected booleanfirstDrag
protected CellHandle[]handles
protected CellViewignoreTargetGroup
protected Point2DinitialLocation
protected booleanisContextVisible
protected booleanisDragging
Indicates whether this handle has started drag and drop.
protected booleanisMoving
Indicates whether this handle is currently moving cells.
protected Point2Dlast
protected Graphicsoffgraphics
Reference to graph off screen graphics
protected CellView[]portViews
protected Point2DsnapLast
protected Point2DsnapStart
protected Point2Dstart
protected CellViewtargetGroup
protected CellView[]views
protected double_mouseToViewDelta_x
protected double_mouseToViewDelta_y
Constructor Summary
RootHandle(GraphContext ctx)
Creates a root handle which contains handles for the given cells.
Method Summary
protected Point2DconstrainDrag(MouseEvent event, double totDx, double totDy, double dx, double dy)
Hook method to constrain a mouse drag
protected CellViewfindUnselectedInnermostGroup(double x, double y)
Used for move into group to find the target group.
protected CellViewfindViewForPoint(Point2D pt)
Hook for subclassers to return a different view for a mouse click at pt.
GraphContextgetContext()
ComponentgetFirstOpaqueParent(Component component)
protected Point2DgetInitialLocation(Object[] cells)
Returns the initial location, which is the top left corner of the selection, ignoring all connected endpoints of edges.
protected voidinitOffscreen()
voidmouseDragged(MouseEvent event)
Process mouse dragged event.
voidmouseMoved(MouseEvent event)
Invoked when the mouse pointer has been moved on a component (with no buttons down).
voidmousePressed(MouseEvent event)
voidmouseReleased(MouseEvent event)
voidoverlay(Graphics g)
voidpaint(Graphics g)
protected voidstartDragging(MouseEvent event)

Field Detail

activeHandle

protected transient CellHandle activeHandle
The handle that consumed the last mousePressedEvent. Initially null.

blockPaint

protected boolean blockPaint

cachedBounds

protected transient Rectangle2D cachedBounds

context

protected transient GraphContext context

contextViews

protected transient CellView[] contextViews

current

protected Point2D current

disconnect

protected transient ConnectionSet disconnect

firstDrag

protected transient boolean firstDrag

handles

protected transient CellHandle[] handles

ignoreTargetGroup

protected transient CellView ignoreTargetGroup

initialLocation

protected transient Point2D initialLocation

isContextVisible

protected boolean isContextVisible

isDragging

protected boolean isDragging
Indicates whether this handle has started drag and drop. Note: isDragging => isMoving.

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.

last

protected transient Point2D last

offgraphics

protected transient Graphics offgraphics
Reference to graph off screen graphics

portViews

protected transient CellView[] portViews

snapLast

protected transient Point2D snapLast

snapStart

protected transient Point2D snapStart

start

protected transient Point2D start

targetGroup

protected transient CellView targetGroup

views

protected transient CellView[] views

_mouseToViewDelta_x

protected transient double _mouseToViewDelta_x

_mouseToViewDelta_y

protected transient double _mouseToViewDelta_y

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

constrainDrag

protected Point2D constrainDrag(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

findUnselectedInnermostGroup

protected CellView findUnselectedInnermostGroup(double x, double y)
Used for move into group to find the target group.

findViewForPoint

protected CellView findViewForPoint(Point2D pt)
Hook for subclassers to return a different view for a mouse click at pt. For example, this can be used to return a leaf cell instead of a group.

getContext

public GraphContext getContext()

getFirstOpaqueParent

public Component getFirstOpaqueParent(Component component)

Returns: Returns the parent graph scrollpane for the specified graph.

getInitialLocation

protected Point2D getInitialLocation(Object[] cells)
Returns the initial location, which is the top left corner of the selection, ignoring all connected endpoints of edges.

initOffscreen

protected void initOffscreen()

mouseDragged

public void mouseDragged(MouseEvent event)
Process mouse dragged event.

mouseMoved

public void mouseMoved(MouseEvent event)
Invoked when the mouse pointer has been moved on a component (with no buttons down).

mousePressed

public void mousePressed(MouseEvent event)

mouseReleased

public void mouseReleased(MouseEvent event)

overlay

public void overlay(Graphics g)

paint

public void paint(Graphics g)

startDragging

protected void startDragging(MouseEvent event)
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.