y.view
Class SelectionBoxMode

java.lang.Object
  |
  +--y.view.ViewMode
        |
        +--y.view.AbstractSelectionBoxMode
              |
              +--y.view.SelectionBoxMode
All Implemented Interfaces:
EventListener, MouseInputListener, MouseListener, MouseMotionListener
Direct Known Subclasses:
HierarchySelectionBoxMode

public class SelectionBoxMode
extends AbstractSelectionBoxMode

This ViewMode is responsible for letting the user open up a selection box. Graph elements inside that box will automatically be selected.

This mode never selects nodes and edges at the same time. What actually gets selected depends on whether or not the shift key is pressed down when opening the selection box and on the set of currently selected graph elements.

If the shift key is pressed down when opening the selection box the new selection will consist of the previously selected elements plus the ones that lie inside of the selection box.

If the graph elements already selected were edges then the shiftkey driven union mechanism selects more edges. Otherwise more nodes and bends will be selected.


Field Summary
 
Fields inherited from class y.view.ViewMode
lastClickEvent, lastDragEvent, lastPressEvent, lastReleaseEvent, originalX, originalY, view
 
Constructor Summary
SelectionBoxMode()
          Instantiates a new SelectionBoxMode.
SelectionBoxMode(ViewContainer view)
          Instantiates a new SelectionBoxMode for a given ViewContainer
 
Method Summary
protected  boolean belongsToSelection(Bend b, Rectangle2D box)
          Callback method that decides whether or not the given bend should be selected, by the given selection box bounds.
protected  boolean belongsToSelection(Edge e, Rectangle2D box)
          Callback method that decides whether or not the given edge should be selected, by the given selection box bounds.
protected  boolean belongsToSelection(Node v, Rectangle2D box)
          Callback method that decides whether or not the given node should be selected, by the given selection box bounds.
protected  void selectionBoxAction(Rectangle sb, boolean shiftMode)
          Selects graph objects within selection box bounds.
 
Methods inherited from class y.view.AbstractSelectionBoxMode
mouseDraggedLeft, mousePressedLeft, mouseReleasedLeft, mouseShiftPressedLeft, mouseShiftReleasedLeft, selectionBoxAction, updateDoubleSelectionBox
 
Methods inherited from class y.view.ViewMode
activate, getGraph2D, getGridX, getGridY, getHitInfo, getHitInfo, getLastHitInfo, getName, init, isGrabFocusEnabled, isGridMode, mouseClicked, mouseClicked, mouseDragged, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleased, mouseReleasedMiddle, mouseReleasedRight, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedMiddle, mouseShiftReleasedRight, reactivateParent, setActiveView, setChild, setChild, setGrabFocusEnabled, setGridMode, setLastHitInfo, setName, setParent, translateX, translateY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionBoxMode

public SelectionBoxMode(ViewContainer view)
Instantiates a new SelectionBoxMode for a given ViewContainer


SelectionBoxMode

public SelectionBoxMode()
Instantiates a new SelectionBoxMode.

Method Detail

selectionBoxAction

protected void selectionBoxAction(Rectangle sb,
                                  boolean shiftMode)
Selects graph objects within selection box bounds. if in shift mode a union of already selected and newly selected objects is created. Usually this operation operates on nodes and bends. But if already some edges are selected and we are in shift mode then more edges got selected.

Specified by:
selectionBoxAction in class AbstractSelectionBoxMode
Parameters:
sb - The position and size of the selection box.
shiftMode - true if shift was pressed when box was closed, false otherwise.

belongsToSelection

protected boolean belongsToSelection(Node v,
                                     Rectangle2D box)
Callback method that decides whether or not the given node should be selected, by the given selection box bounds.


belongsToSelection

protected boolean belongsToSelection(Edge e,
                                     Rectangle2D box)
Callback method that decides whether or not the given edge should be selected, by the given selection box bounds.


belongsToSelection

protected boolean belongsToSelection(Bend b,
                                     Rectangle2D box)
Callback method that decides whether or not the given bend should be selected, by the given selection box bounds.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003