public class TLspInteractiveLabelsController extends ALspController
This controller provides the option of showing a java.awt.Component
when the
mouse moves over a label. This enables more extensive manipulation of the labeled object.
In order to start, stop or cancel the interaction manually, the used ALspInteractiveLabelProvider
can be called directly. This
controller will adjust its state automatically to the state of the interactive label provider.
When a label is edited interactively, its object is set to 'edited'. This controller also paints the edited labels. In order to make sure that only the swing component used in the controller is displayed, the used label painter should not paint interactively edited label. It should however paint other parts of the label that can't be painted by the controller itself. E.g. the pin.
This controller has the following pre-requisites:
ILspInteractivePaintableLayer
.ILspAWTView
.ALspSwingLabelStyler
,
initialized with the same ALspInteractiveLabelProvider
as
this controller.Constructor and Description |
---|
TLspInteractiveLabelsController(ALspInteractiveLabelProvider aInteractiveLabelProvider)
Creates a new interactive labels controller using the given interactive label provider.
|
Modifier and Type | Method and Description |
---|---|
AWTEvent |
handleAWTEventImpl(AWTEvent aAWTEvent)
Called by
handleAWTEvent . |
boolean |
isActivateOnObjectHover()
Returns if interactive labels are also activated when hovering over the domain object.
|
boolean |
isSelectObjectDuringInteraction()
Returns if the object is automatically selected during interaction.
|
protected TLspPaintProgress |
paintImpl(ILcdGLDrawable aGLDrawable,
ILspView aView,
TLspPaintPhase aPaintPhase)
The specific implementation of
paint for this controller. |
void |
setActivateOnObjectHover(boolean aActivateOnObjectHover)
Sets if labels should start interaction when hovering over their domain object, so not
only when hovering over the label itself.
|
void |
setSelectObjectDuringInteraction(boolean aSelectObjectDuringInteraction)
Sets if the object should automatically be selected during interaction.
|
protected void |
startInteractionImpl(ILspView aView)
The specific implementation of
startInteraction for this controller. |
protected void |
terminateInteractionImpl(ILspView aView)
The specific implementation of
terminateInteraction for this controller. |
addPropertyChangeListener, addStatusListener, appendController, firePropertyChange, fireStatusEvent, getAWTFilter, getCursor, getFXCursor, getFXFilter, getIcon, getLayered, getName, getNextController, getShortDescription, getView, handleAWTEvent, handleFXEvent, handleFXEventImpl, paint, registerViewPropertyNameForReset, removePropertyChangeListener, removeStatusListener, setAWTFilter, setCursor, setFXCursor, setFXFilter, setIcon, setName, setShortDescription, startInteraction, terminateInteraction
public TLspInteractiveLabelsController(ALspInteractiveLabelProvider aInteractiveLabelProvider)
aInteractiveLabelProvider
- an interactive label provider. Should not be null
.public boolean isSelectObjectDuringInteraction()
setSelectObjectDuringInteraction(boolean)
public void setSelectObjectDuringInteraction(boolean aSelectObjectDuringInteraction)
true
.aSelectObjectDuringInteraction
- true
to automatically select the object
during interaction.isSelectObjectDuringInteraction()
public boolean isActivateOnObjectHover()
setActivateOnObjectHover(boolean)
public void setActivateOnObjectHover(boolean aActivateOnObjectHover)
Sets if labels should start interaction when hovering over their domain object, so not only when hovering over the label itself. Note that this setting only works for domain objects with exactly one label that can be made interactive.
The default value is false.
aActivateOnObjectHover
- true
to start label interaction when hovering the
mouse over a domain object.isActivateOnObjectHover()
protected void startInteractionImpl(ILspView aView)
ALspController
startInteraction
for this controller.startInteractionImpl
in class ALspController
aView
- the view to start interaction with.protected void terminateInteractionImpl(ILspView aView)
ALspController
terminateInteraction
for this controller.terminateInteractionImpl
in class ALspController
aView
- the view to terminate interaction with.public AWTEvent handleAWTEventImpl(AWTEvent aAWTEvent)
ALspController
handleAWTEvent
.
Returns null
when the controller consumed the event or a partially consumed event
when the controller partially consumed the event (which could happen with
TLcdTouchEvent
s). When the controller did not use the given event, it is returned
unaltered.handleAWTEventImpl
in class ALspController
aAWTEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.protected TLspPaintProgress paintImpl(ILcdGLDrawable aGLDrawable, ILspView aView, TLspPaintPhase aPaintPhase)
ALspController
paint
for this controller.paintImpl
in class ALspController
aGLDrawable
- the drawable that should be painted onaView
- the view that is painted onaPaintPhase
- the current paint phase