Package org.jgraph.graph
Class BasicMarqueeHandler
java.lang.Object
org.jgraph.graph.BasicMarqueeHandler
A simple implementation of a marquee handler for JGraph.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Point2D
protected Rectangle2D
protected Cursor
protected Point2D
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the currentPoint.static JGraph
getGraphForEvent
(MouseEvent event) Returns the marqueeBounds.Returns the previousCursor.Returns the startPoint.void
handleMarqueeEvent
(MouseEvent e, JGraph graph, Rectangle2D bounds) Hook for subclassers.boolean
isForceMarqueeEvent
(MouseEvent event) boolean
isMarqueeTriggerEvent
(MouseEvent e, JGraph graph) Hook for subclassers.void
Includes the specified startPoint in the marquee selection.void
Empty.void
Start the marquee at the specified startPoint.void
Stops the current marquee selection.void
Draw the current state of the handler.void
Called after the component was repainted (after autoscroll).protected void
Called from mouse dragged to update the marquee state during a repaint.void
setCurrentPoint
(Point2D currentPoint) Sets the currentPoint.void
setMarqueeBounds
(Rectangle2D marqueeBounds) Sets the marqueeBounds.void
setPreviousCursor
(Cursor previousCursor) Sets the previousCursor.void
setStartPoint
(Point2D startPoint) Sets the startPoint.
-
Field Details
-
previousCursor
-
marqueeBounds
-
startPoint
-
currentPoint
-
-
Constructor Details
-
BasicMarqueeHandler
public BasicMarqueeHandler()
-
-
Method Details
-
isForceMarqueeEvent
-
mouseReleased
Stops the current marquee selection. -
handleMarqueeEvent
Hook for subclassers. Current implementation checks if graph selection is enabled. This is called from mouseReleased to execute the marquee selection. -
mouseDragged
Includes the specified startPoint in the marquee selection. Calls overlay. -
processMouseDraggedEvent
Called from mouse dragged to update the marquee state during a repaint. -
paint
Called after the component was repainted (after autoscroll). This is used to indicate that the graphics is no more dirty. -
overlay
Draw the current state of the handler. This is called twice by the overlay method and also by the paint method. The caller's intention is that the overlay method draws exactly the current state of the handler so that it may be used for XOR paint. The drag method calls overlay, changes the state, and calls overlay again to use this. However, since it is not always possible to clear the screen with an exact repaint the caller passes a flag to indicate if the graphics object should be cleared with this call (eg. if a subsequent call follows).- Parameters:
g
-
-
mousePressed
Start the marquee at the specified startPoint. This invokes expandMarqueeToPoint to initialize marquee selection. -
isMarqueeTriggerEvent
Hook for subclassers. Current implementation checks if graph selection is enabled. This is called from mousePressed before initiating the marquee selection. -
mouseMoved
Empty. -
getCurrentPoint
Returns the currentPoint.- Returns:
- Point
-
getMarqueeBounds
Returns the marqueeBounds.- Returns:
- Rectangle
-
getPreviousCursor
Returns the previousCursor.- Returns:
- Cursor
-
getStartPoint
Returns the startPoint.- Returns:
- Point
-
setCurrentPoint
Sets the currentPoint.- Parameters:
currentPoint
- The currentPoint to set
-
setMarqueeBounds
Sets the marqueeBounds.- Parameters:
marqueeBounds
- The marqueeBounds to set
-
setPreviousCursor
Sets the previousCursor.- Parameters:
previousCursor
- The previousCursor to set
-
setStartPoint
Sets the startPoint.- Parameters:
startPoint
- The startPoint to set
-
getGraphForEvent
- Returns:
- Returns the source of the event as a graph.
-