public class SelectionManager
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.beans.PropertyChangeListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
SelectionManager.SelectionEnded
This is the interface that an user of SelectionManager has to implement
to get informed when a selection closes.
|
| Constructor and Description |
|---|
SelectionManager(SelectionManager.SelectionEnded selectionEndedListener,
boolean aspectRatio,
NavigatableComponent navComp)
Create a new SelectionManager.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> |
getSelectedObjects(boolean alt)
Return a list of all objects in the selection, respecting the different
modifier.
|
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e)
If the correct button is hold, draw the rectangle.
|
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e)
If the correct button, from the "drawing rectangle" mode
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Check the state of the keys and buttons and set the selection accordingly.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
If the action goes inactive, remove the selection rectangle from screen
|
void |
register(NavigatableComponent eventSource,
boolean lassoMode)
Register itself at the given event source.
|
void |
setLassoMode(boolean lassoMode) |
void |
unregister(java.awt.Component eventSource)
Unregister itself from the given event source.
|
public SelectionManager(SelectionManager.SelectionEnded selectionEndedListener, boolean aspectRatio, NavigatableComponent navComp)
selectionEndedListener - The action listener that receives the event when
the left button is released.aspectRatio - If true, the selection window must obtain the aspect
ratio of the drawComponent.navComp - The component, the rectangle is drawn onto.public void register(NavigatableComponent eventSource, boolean lassoMode)
eventSource - The emitter of the mouse events.public void unregister(java.awt.Component eventSource)
eventSource - The emitter of the mouse events.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerpublic java.util.Collection<org.openstreetmap.josm.data.osm.OsmPrimitive> getSelectedObjects(boolean alt)
alt - Whether the alt key was pressed, which means select all
objects that are touched, instead those which are completely covered.public void setLassoMode(boolean lassoMode)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListener