public class TLcdGXYInteractiveLabelsController extends ALcdGXYSmartController implements ILcdGXYChainableController
Component
when the mouse moves over a label, to make the label interactive.
ALcdGXYInteractiveLabelProvider
that returns the interactive version of the label.
Make sure to call fireInteractionStartedEvent
in the provide method.
ALcdGXYInteractiveLabelProvider
can be called directly. This controller
will adjust its state automatically to the state of the interactive label provider.
TLcdLabelLocation
to true
. So in order for this controller
to work, label painters should respect this property. They can do this by
TLcdLabelLocation
object, it will only work for layers implementing ILcdGXYEditableLabelsLayer
and
label painters implementing ILcdGXYLabelPainter2
ILcdGXYLabelPainter2
's TRANSLATING, RESHAPING, and CREATING modes),
Therefore, it requires instant editing in order to function correctly
(see TLcdGXYEditController2.setInstantEditing(boolean)
).
Constructor and Description |
---|
TLcdGXYInteractiveLabelsController(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider)
Creates a new
TLcdGXYInteractiveLabelsController using the given interactive
label provider. |
Modifier and Type | Method and Description |
---|---|
protected void |
addComponentToGXYView(ILcdGXYView aGXYView,
Component aComponent)
Adds the specified interactive label to the user interface.
|
void |
appendGXYController(ILcdGXYChainableController aEnd)
This method will append the passed controller to the end of the chain.
|
protected boolean |
canAddComponentToGXYView(ILcdGXYView aGXYView)
Returns whether or not an interactive label can be added to the given view.
|
protected Component |
getComponentForGXYView(ILcdGXYView aGXYView)
Gets the component that represents the given
ILcdGXYView . |
ILcdGXYChainableController |
getNextGXYController()
Returns a reference to the controller that is located after this one in a chain, or null
if this controller is the last element of the chain.
|
void |
handleAWTEvent(AWTEvent aEvent)
This is method is called when the target of the listener has a new AWTEvent available.
|
boolean |
isSelectObjectDuringInteraction()
Returns if the object is automatically selected during interaction.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e)
Will perform a pan depending on the values of isDragging,
isPanOnMouseDragExit and isPanOnMouseMoveExit properties
|
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
paint(Graphics aGraphics)
Enables the controller to give visual feedback on the current user interactions.
|
protected void |
removeComponentFromGXYView(ILcdGXYView aGXYView,
Component aComponent)
Removes the specified
java.awt.Component from the user interface. |
void |
setNextGXYController(ILcdGXYChainableController aNext)
This method sets the next controller in the chain for this controller.
|
void |
setProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver)
Enables the
ALcdGXYInteractiveLabelProvider functionality, so that the interactive
label is present when the mouse hoovers over a label. |
void |
setSelectObjectDuringInteraction(boolean aSelectObjectDuringInteraction)
Sets if the object should automatically be selected during interaction.
|
void |
startInteraction(ILcdGXYView aGXYView)
Sets up the controller to receive input through the view passed.
|
void |
terminateInteraction(ILcdGXYView aGXYView)
Releases a few items.
|
addUndoableListener, doPanGXYView, doZoomGXYView, fireUndoableEvent, getDownPanChars, getDownPanCodes, getLeftPanChars, getLeftPanCodes, getPanAbsDelta, getPanAbsDelta, getRightPanChars, getRightPanCodes, getUndoableListenerCount, getUpPanChars, getUpPanCodes, getZoomInChars, getZoomInCodes, getZoomOutChars, getZoomOutCodes, isDragging, isPanOnMouseDragExit, isPanOnMouseMoveExit, isPanUndoable, isRequestFocusOnMouseEntered, isRequestFocusOnMousePressed, isTraceOn, isZoomUndoable, keyPressed, keyReleased, keyTyped, removeUndoableListener, setDownPanChars, setDownPanCodes, setIsDragging, setLeftPanChars, setLeftPanCodes, setPanAbsDelta, setPanOnMouseDragExit, setPanOnMouseMoveExit, setPanUndoable, setRequestFocusOnMouseEntered, setRequestFocusOnMousePressed, setRightPanChars, setRightPanCodes, setTraceOn, setUpPanChars, setUpPanCodes, setZoomInChars, setZoomInCodes, setZoomOutChars, setZoomOutCodes, setZoomUndoable, updateViewLocationAfterZoomSFCT
addStatusListener, asGXYController, fireStatusEvent, getCursor, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription, viewRepaint
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCursor, getIcon, getLayered, getName, getShortDescription, viewRepaint
public TLcdGXYInteractiveLabelsController(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider)
TLcdGXYInteractiveLabelsController
using the given interactive
label provider.aGXYInteractiveLabelProvider
- an interactive label provider. This class will be used
to create the java.awt.Component
for the
labels.public void setProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver)
ALcdGXYInteractiveLabelProvider
functionality, so that the interactive
label is present when the mouse hoovers over a label. This flag is typically disabled
whenever the interactive label functionality is not wanted or when the interactive label
behavior should be set up manually.aProvideInteractiveLabelOnMouseOver
- true
to activate the automatic behavior
and false
otherwise.public boolean isSelectObjectDuringInteraction()
setSelectObjectDuringInteraction(boolean)
public void setSelectObjectDuringInteraction(boolean aSelectObjectDuringInteraction)
true
.aSelectObjectDuringInteraction
- true
to automatically select the object
during interaction.isSelectObjectDuringInteraction()
public void startInteraction(ILcdGXYView aGXYView)
ALcdGXYController
All ILcdGXYView
implementations that support interaction call this method when the controller
has been made active with setGXYController
on the view,
so this method shouldn't normally be called directly.
Note that most view implementations add the controller as listener if appropriate before calling
this method.
Sets the cursor on the view and sets the view for which this controller is now active.
Sends out a status event based on the short description
.
startInteraction
in interface ILcdGXYController
startInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
will interact with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
public void terminateInteraction(ILcdGXYView aGXYView)
ALcdGXYController
terminateInteraction
in interface ILcdGXYController
terminateInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
interacted with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void paint(Graphics aGraphics)
ALcdGXYController
Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
paint
in interface ILcdGXYController
paint
in class ALcdGXYController
aGraphics
- the Graphics on which the view was rendered.protected boolean canAddComponentToGXYView(ILcdGXYView aGXYView)
false
, addComponentToGXYView
must not be called. By default this method checks if the given
ILcdGXYView
is an instance of java.awt.Container
without a layout
set on it.
Override this method if your ILcdGXYView
implementation is not a
java.awt.Container
or if you add components to another container than the
specified ILcdGXYView
.
aGXYView
- The ILcdGXYView
for which to check if a component can be added.true
if a component can be added, false
otherwise.addComponentToGXYView(ILcdGXYView, java.awt.Component)
protected Component getComponentForGXYView(ILcdGXYView aGXYView)
ILcdGXYView
. By default this is
the view itself casted to java.awt.Component
. This information is used for
handling mouse events.
Override this method if your ILcdGXYView
implementation does not extend from
java.awt.Component
.
aGXYView
- The view for which a Component
must be retrieved.java.awt.Component
which corresponds to the given
ILcdGXYView
IllegalArgumentException
- By default when aGXYView
is not a
java.awt.Component
ALcdGXYInteractiveLabelProvider.dispatchMouseEvent(java.awt.event.MouseEvent,
java.awt.Component, java.awt.Component)
protected void addComponentToGXYView(ILcdGXYView aGXYView, Component aComponent)
ILcdGXYView
to java.awt.Container
and adds the component to the
view.
Override this method if your implementation of ILcdGXYView
does not extend from
java.awt.Container
or if you want to add the interactive label to another
java.awt.Container
because, for instance, you already need to add other components
to the specified ILcdGXYView
.
If you override this method, you also need to override canAddComponentToGXYView
and removeComponentFromGXYView
as these methods are closely related to each other.
This method will not be called if canAddComponentToGXYView
returns false
.
aGXYView
- The view to which the interactive label should be added.aComponent
- The interactive label that should be added to the user interface.IllegalArgumentException
- By default if aGXYView
is not an instance of
java.awt.Container
or if the layout of
aGXYView
is not null.canAddComponentToGXYView(ILcdGXYView)
,
removeComponentFromGXYView(ILcdGXYView, java.awt.Component)
protected void removeComponentFromGXYView(ILcdGXYView aGXYView, Component aComponent)
java.awt.Component
from the user interface. By default
this method casts the specified ILcdGXYView
to java.awt.Container
and
removes the component from that container.
Override this method if you have overridden
addComponentToGXYView
.
aGXYView
- The view from which the interactive label should be removed.aComponent
- The interactive label that should be removed from the user interfaceIllegalArgumentException
- By default if the view does not extend from
java.awt.Container
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
mouseClicked
in class ALcdGXYSmartController
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class ALcdGXYSmartController
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class ALcdGXYSmartController
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class ALcdGXYSmartController
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class ALcdGXYSmartController
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
mouseEntered
in class ALcdGXYSmartController
public void mouseExited(MouseEvent e)
ALcdGXYSmartController
mouseExited
in interface MouseListener
mouseExited
in class ALcdGXYSmartController
public ILcdGXYChainableController getNextGXYController()
ILcdGXYChainableController
getNextGXYController
in interface ILcdGXYChainableController
ILcdGXYChainableController.setNextGXYController(ILcdGXYChainableController)
public void setNextGXYController(ILcdGXYChainableController aNext)
ILcdGXYChainableController
setNextGXYController
in interface ILcdGXYChainableController
aNext
- the reference to the controller that will be the next element in the chainILcdGXYChainableController.getNextGXYController()
public void appendGXYController(ILcdGXYChainableController aEnd)
ILcdGXYChainableController
appendGXYController
in interface ILcdGXYChainableController
aEnd
- the controller to be appended to the end of the chain.public void handleAWTEvent(AWTEvent aEvent)
ILcdAWTEventListener
handleAWTEvent
in interface ILcdAWTEventListener
aEvent
- The event to be handled.