Class ALcdGXYController
- All Implemented Interfaces:
ILcdStatusSource
,ILcdGXYController
,Serializable
- Direct Known Subclasses:
ALcdGXYChainableController
,ALcdGXYSmartController
,TLcdGXYNavigateController
,TLcdGXYNoopController
,TLcdGXYZoomWheelController
,TLcdMapGridRulerController
ILcdGXYController
that interacts with one view at a time.
It automatically sets the view's cursor and stores a reference to the view the controller is interacting with.
A typical controller extends this class in the following way:
- depending on the user interaction needed, the controller will implement input event listeners such as
MouseListener, MouseMotionListener or KeyListener, and register and unregister them in
startInteraction(com.luciad.view.gxy.ILcdGXYView)
andterminateInteraction(com.luciad.view.gxy.ILcdGXYView)
, if the view implementation does not already do this; - depending on the input events, the controller will execute model, layer, view, or other changes and repaint the view when necessary;
- for visual feedback, the controller can render on the view (see
paint(java.awt.Graphics)
) and/or change the mouse cursor during the user interaction (seeILcdGXYView.setCursor(java.awt.Cursor)
).
status events
to its
status listeners
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatusListener
(ILcdStatusListener aStatusListener) Registers the given listener so it will receive status events from this source.protected void
fireStatusEvent
(TLcdStatusEvent aStatusEvent) Returns the cursor that will be displayed on a view when this controller is active for that view.Returns theILcdGXYView
the controller is interacting with.getIcon()
Returns an icon to visualize the interaction implemented.getName()
Returns a name for this controller that enables to determine the interaction that can be performed with this controller.Returns a short description that enables to determine the interaction that can be performed with this controller.boolean
Deprecated.This method has been deprecated.void
Enables the controller to give visual feedback on the current user interactions.protected void
Deprecated.This method is not used.void
removeStatusListener
(ILcdStatusListener aStatusListener) Removes the specified listener so it is no longer notified.protected ILcdGXYViewXYWorldTransformation
Convenience method to retrieve theILcdGXYViewXYWorldTransformation
for theILcdGXYView
this controller interacts with.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
protected void
setGXYView
(ILcdGXYView aGXYView) Sets theILcdGXYView
the controller is interacting with.void
void
void
setShortDescription
(String aShortDescription) void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
startInteraction
(ILcdGXYView aGXYView) Sets up the controller to receive input through the view passed.void
terminateInteraction
(ILcdGXYView aGXYView) Releases a few items.void
viewRepaint
(ILcdGXYView aGXYView) Deprecated.usepaint(java.awt.Graphics)
insteadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYController
getLayered
-
Constructor Details
-
ALcdGXYController
public ALcdGXYController()
-
-
Method Details
-
addStatusListener
Description copied from interface:ILcdStatusSource
Registers the given listener so it will receive status events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source, you can use a
ALcdWeakStatusListener
instance as status listener.- Specified by:
addStatusListener
in interfaceILcdStatusSource
- Parameters:
aStatusListener
- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSource
Removes the specified listener so it is no longer notified.- Specified by:
removeStatusListener
in interfaceILcdStatusSource
- Parameters:
aStatusListener
- The listener to remove.
-
fireStatusEvent
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
asGXYController
-
startInteraction
Sets up the controller to receive input through the view passed.All
ILcdGXYView
implementations that support interaction call this method when the controller has been made active withsetGXYController
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
.- Specified by:
startInteraction
in interfaceILcdGXYController
- Parameters:
aGXYView
- theILcdGXYView
thisILcdGXYController
will interact with.- See Also:
-
terminateInteraction
Releases a few items. Can be redefined but this 'super' method should be called too.- Specified by:
terminateInteraction
in interfaceILcdGXYController
- Parameters:
aGXYView
- theILcdGXYView
thisILcdGXYController
interacted with.- See Also:
-
viewRepaint
Deprecated.usepaint(java.awt.Graphics)
insteadEmpty implementation.- Specified by:
viewRepaint
in interfaceILcdGXYController
- Parameters:
aGXYView
- theILcdGXYView
to draw on.
-
paint
Enables the controller to give visual feedback on the current user interactions. Note that the controller is responsible for repainting the view.Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
- Specified by:
paint
in interfaceILcdGXYController
- Parameters:
aGraphics
- the Graphics on which the view was rendered.
-
getGXYView
Returns theILcdGXYView
the controller is interacting with.- Returns:
- the
ILcdGXYView
the controller is interacting with, or null if the view is not interacting with a view
-
setGXYView
Sets theILcdGXYView
the controller is interacting with.This method is called when
ILcdGXYView.setGXYController
is used to set anILcdGXYController
active on anILcdGXYView
.- Parameters:
aGXYView
- the view the controller is interacting with- See Also:
-
retrieveGXYViewXYWorldTransformation
Convenience method to retrieve theILcdGXYViewXYWorldTransformation
for theILcdGXYView
this controller interacts with. The default implementation returns the view's own transformation.- Returns:
- a
ILcdGXYViewXYWorldTransformation
for theILcdGXYView
this controller interacts with.
-
getCursor
Description copied from interface:ILcdGXYController
Returns the cursor that will be displayed on a view when this controller is active for that view.- Specified by:
getCursor
in interfaceILcdGXYController
- Returns:
- the
Cursor
set by setCursor, orCursor.getDefaultCursor()
if noCursor
has been set yet.
-
setCursor
- Parameters:
aCursor
- theCursor
to use when a user interacts with thisILcdGXYController
on aILcdGXYView
.
-
setName
- Parameters:
aName
- the name to associate to thisILcdGXYController
-
getName
Description copied from interface:ILcdGXYController
Returns a name for this controller that enables to determine the interaction that can be performed with this controller. For example 'zoom' for a zoom controller.- Specified by:
getName
in interfaceILcdGXYController
- Returns:
- the name associated to this
ILcdGXYController
-
setShortDescription
- Parameters:
aShortDescription
- the short description to associate to thisILcdGXYController
-
getShortDescription
Description copied from interface:ILcdGXYController
Returns a short description that enables to determine the interaction that can be performed with this controller. For example 'Zoom in and out on a view' for a zoom controller.- Specified by:
getShortDescription
in interfaceILcdGXYController
- Returns:
- the short description associated to this
ILcdGXYController
-
setIcon
- Parameters:
aIcon
- theILcdIcon
to associate to thisILcdGXYController
-
getIcon
Description copied from interface:ILcdGXYController
Returns an icon to visualize the interaction implemented. For example, an icon of a magnifying glass for a zoom controller.- Specified by:
getIcon
in interfaceILcdGXYController
- Returns:
- the
ILcdIcon
associated to thisILcdGXYController
-
registerInstance
protected void registerInstance()Deprecated.This method is not used.
-