org.jgraph.plaf.basic

Class BasicGraphUI.RootHandle

Enclosing Class:
BasicGraphUI
Implemented Interfaces:
CellHandle, Serializable

public class BasicGraphUI.RootHandle
extends java.lang.Object
implements CellHandle, Serializable

Field Summary

protected double
_mouseToViewDelta_x
protected double
_mouseToViewDelta_y
protected CellHandle
activeHandle
The handle that consumed the last mousePressedEvent.
protected boolean
blockPaint
protected Rectangle2D
cachedBounds
protected GraphContext
context
protected CellView[]
contextViews
protected Point2D
current
protected ConnectionSet
disconnect
protected boolean
firstDrag
protected CellHandle[]
handles
protected CellView
ignoreTargetGroup
protected Point2D
initialLocation
protected boolean
isContextVisible
protected boolean
isDragging
Indicates whether this handle has started drag and drop.
protected boolean
isMoving
Indicates whether this handle is currently moving cells.
protected Point2D
last
protected Graphics
offgraphics
Reference to graph off screen graphics
protected CellView[]
portViews
protected Point2D
snapLast
protected Point2D
snapStart
protected Point2D
start
protected CellView
targetGroup
protected CellView[]
views

Constructor Summary

RootHandle(GraphContext ctx)
Creates a root handle which contains handles for the given cells.

Method Summary

protected Point2D
constrainDrag(MouseEvent event, double totDx, double totDy, double dx, double dy)
Hook method to constrain a mouse drag
protected CellView
findUnselectedInnermostGroup(double x, double y)
Used for move into group to find the target group.
protected CellView
findViewForPoint(Point2D pt)
Hook for subclassers to return a different view for a mouse click at pt.
GraphContext
getContext()
Component
getFirstOpaqueParent(Component component)
protected Point2D
getInitialLocation(Object[] cells)
Returns the initial location, which is the top left corner of the selection, ignoring all connected endpoints of edges.
protected void
initOffscreen()
void
mouseDragged(MouseEvent event)
Process mouse dragged event.
void
mouseMoved(MouseEvent event)
Invoked when the mouse pointer has been moved on a component (with no buttons down).
void
mousePressed(MouseEvent event)
void
mouseReleased(MouseEvent event)
void
overlay(Graphics g)
void
paint(Graphics g)
protected void
startDragging(MouseEvent event)

Field Details

_mouseToViewDelta_x

protected double _mouseToViewDelta_x

_mouseToViewDelta_y

protected double _mouseToViewDelta_y

activeHandle

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

blockPaint

protected boolean blockPaint

cachedBounds

protected Rectangle2D cachedBounds

context

protected GraphContext context

contextViews

protected CellView[] contextViews

current

protected Point2D current

disconnect

protected ConnectionSet disconnect

firstDrag

protected boolean firstDrag

handles

protected CellHandle[] handles

ignoreTargetGroup

protected CellView ignoreTargetGroup

initialLocation

protected 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 Point2D last

offgraphics

protected Graphics offgraphics
Reference to graph off screen graphics

portViews

protected CellView[] portViews

snapLast

protected Point2D snapLast

snapStart

protected Point2D snapStart

start

protected Point2D start

targetGroup

protected CellView targetGroup

views

protected CellView[] views

Constructor Details

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 Details

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.
Specified by:
mouseDragged in interface CellHandle

mouseMoved

public void mouseMoved(MouseEvent event)
Invoked when the mouse pointer has been moved on a component (with no buttons down).
Specified by:
mouseMoved in interface CellHandle

mousePressed

public void mousePressed(MouseEvent event)
Specified by:
mousePressed in interface CellHandle

mouseReleased

public void mouseReleased(MouseEvent event)
Specified by:
mouseReleased in interface CellHandle

overlay

public void overlay(Graphics g)
Specified by:
overlay in interface CellHandle

paint

public void paint(Graphics g)
Specified by:
paint in interface CellHandle

startDragging

protected void startDragging(MouseEvent event)

Copyright (C) 2001-2008 Gaudenz Alder. All rights reserved.