public class LassoLayer extends AbstractSystemLayer implements MouseListener, MouseMotionListener, KeyEventDispatcher
Modifier and Type | Class and Description |
---|---|
static class |
LassoLayer.LassoMode
A selection mode enumerator that can be used to instruct the lasso layer
what to select when a lasso operation finishes.
|
static class |
LassoLayer.SelectionBehaviour
An enumerator used to control the selection behaviour of the lasso.
|
alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE
Constructor and Description |
---|
LassoLayer(LayerContainer lc)
Constructs a new lasso layer.
|
Modifier and Type | Method and Description |
---|---|
void |
addLassoLayerListener(ILassoLayerListener l)
Adds a lasso layer listener to the lasso layer.
|
protected Cursor |
createLassoCursor(LassoLayer.LassoMode mode,
boolean multi)
Creates a cursor that will be used for the given lasso mode.
|
boolean |
dispatchKeyEvent(KeyEvent e)
Intercepts key events from the
KeyboardFocusManager in order to
temporarily change the edit mode. |
protected void |
fireLassoLayerEvent(LassoLayerEvent evt)
Sends the given event object to all lasso layer listeners that are
currently observing the lasso layer.
|
LassoLayer.LassoMode |
getLassoMode()
Returns the lasso mode used by the lasso layer (selecting timeline
objects or selecting time spans).
|
LassoLayer.SelectionBehaviour |
getSelectionBehaviour()
Returns the selection behavour used by the lasso.
|
Color |
getSelectionColor()
Returns the color used for filling the selection color.
|
LassoLayer.LassoMode[] |
getSupportedLassoModes()
Returns the supported lasso modes.
|
boolean |
isSelecting()
Determines if a selection / lasso operation is currently taking place.
|
boolean |
isSingleRowObjectCreation()
Determines whether the layer only supports the creation of timeline
objects on a single row or several rows at the same time.
|
boolean |
isSupportedLassoMode(LassoLayer.LassoMode mode)
Checks whether the given lasso mode is supported by the lasso layer.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
protected void |
paintLasso(Graphics g,
Rectangle lasso)
Draws the actual lasso.
|
protected void |
paintLayer(Graphics g) |
void |
removeLassoLayerListener(ILassoLayerListener l)
Removes a lasso layer listener from the lasso layer.
|
void |
setLassoMode(LassoLayer.LassoMode mode)
Sets the lasso mode so that the layer can switch between selecting
timeline objects and selecting time spans and creating timeline objects.
|
void |
setSelectionBehaviour(LassoLayer.SelectionBehaviour behaviour)
Sets the selection behavour used by the lasso.
|
void |
setSelectionColor(Color color)
Sets the color used for filling the selection rectangle.
|
void |
setSingleRowObjectCreation(boolean single)
Specifies whether the layer only supports the creation of timeline
objects on a single row or several rows at the same time.
|
void |
setSupportedLassoModes(LassoLayer.LassoMode... modes)
Sets the supported lasso modes.
|
void |
tearDown()
Removes the layer from the keyboard focus manager.
|
addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getHeight, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getTimeSpanUsed, getToolTipText, getTreeTable, getTreeTablePolicyProvider, getWidth, isVisible, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, setVisible
public LassoLayer(LayerContainer lc)
lc
- the layer container to which the layer belongspublic boolean isSelecting()
protected void paintLayer(Graphics g)
paintLayer
in class AbstractLayer
protected void paintLasso(Graphics g, Rectangle lasso)
g
- the graphics context into which to drawlasso
- the lasso boundspublic void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public Color getSelectionColor()
public void setSelectionColor(Color color)
color
- the color used for filling the selection colorpublic LassoLayer.LassoMode getLassoMode()
public void setLassoMode(LassoLayer.LassoMode mode)
mode
- the mode to use for the next lasso operationpublic boolean isSingleRowObjectCreation()
public void setSingleRowObjectCreation(boolean single)
single
- if TRUE timeline objects can only be created one row at a timeprotected Cursor createLassoCursor(LassoLayer.LassoMode mode, boolean multi)
IconRegistry
with the following IDs:
mode
- the lasso mode for which to create a cursormulti
- determines if the cursor is needed for a 'multi' operation
(multi timeline object selection, multi time span selection)public boolean dispatchKeyEvent(KeyEvent e)
KeyboardFocusManager
in order to
temporarily change the edit mode. Pressing the SHIFT
key
will turn on the multi selection mode. Pressing the
CTRL
key will change from timeline object selection
to time span selection. Pressing the ALT key will switch to the
timeline object creation mode. Key events will only be processed
if the mouse cursor is currently on top of the layer container.dispatchKeyEvent
in interface KeyEventDispatcher
public LassoLayer.LassoMode[] getSupportedLassoModes()
LassoLayer.LassoMode
.setSupportedLassoModes(LassoMode[])
public void setSupportedLassoModes(LassoLayer.LassoMode... modes)
LassoLayer.LassoMode
.modes
- the supported lasso modesgetSupportedLassoModes()
public boolean isSupportedLassoMode(LassoLayer.LassoMode mode)
mode
- the mode to checksetSupportedLassoModes(com.dlsc.flexgantt.swing.layer.system.LassoLayer.LassoMode[])
,
getSupportedLassoModes()
public void addLassoLayerListener(ILassoLayerListener l)
l
- the listener to attach to the layerpublic void removeLassoLayerListener(ILassoLayerListener l)
l
- the listener that will be removedprotected void fireLassoLayerEvent(LassoLayerEvent evt)
evt
- the lasso layer event that will be sent to all listenerspublic LassoLayer.SelectionBehaviour getSelectionBehaviour()
public void setSelectionBehaviour(LassoLayer.SelectionBehaviour behaviour)
behaviour
- the lasso selection behaviourpublic void tearDown()
tearDown
in class AbstractLayer
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.