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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStatusListener(ILcdStatusListener aStatusListener) Registers the given listener so it will receive status events from this source.protected voidfireStatusEvent(TLcdStatusEvent aStatusEvent) Returns the cursor that will be displayed on a view when this controller is active for that view.Returns theILcdGXYViewthe 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.booleanDeprecated.This method has been deprecated.voidEnables the controller to give visual feedback on the current user interactions.protected voidDeprecated.This method is not used.voidremoveStatusListener(ILcdStatusListener aStatusListener) Removes the specified listener so it is no longer notified.protected ILcdGXYViewXYWorldTransformationConvenience method to retrieve theILcdGXYViewXYWorldTransformationfor theILcdGXYViewthis controller interacts with.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidprotected voidsetGXYView(ILcdGXYView aGXYView) Sets theILcdGXYViewthe controller is interacting with.voidvoidvoidsetShortDescription(String aShortDescription) voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidstartInteraction(ILcdGXYView aGXYView) Sets up the controller to receive input through the view passed.voidterminateInteraction(ILcdGXYView aGXYView) Releases a few items.voidviewRepaint(ILcdGXYView aGXYView) Deprecated.usepaint(java.awt.Graphics)insteadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYController
getLayered
-
Constructor Details
-
ALcdGXYController
public ALcdGXYController()
-
-
Method Details
-
addStatusListener
Description copied from interface:ILcdStatusSourceRegisters 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
ALcdWeakStatusListenerinstance as status listener.- Specified by:
addStatusListenerin interfaceILcdStatusSource- Parameters:
aStatusListener- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeStatusListenerin 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 istruethen 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 eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen 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.Returnstrueif 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
ILcdGXYViewimplementations that support interaction call this method when the controller has been made active withsetGXYControlleron 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:
startInteractionin interfaceILcdGXYController- Parameters:
aGXYView- theILcdGXYViewthisILcdGXYControllerwill interact with.- See Also:
-
terminateInteraction
Releases a few items. Can be redefined but this 'super' method should be called too.- Specified by:
terminateInteractionin interfaceILcdGXYController- Parameters:
aGXYView- theILcdGXYViewthisILcdGXYControllerinteracted with.- See Also:
-
viewRepaint
Deprecated.usepaint(java.awt.Graphics)insteadEmpty implementation.- Specified by:
viewRepaintin interfaceILcdGXYController- Parameters:
aGXYView- theILcdGXYViewto 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:
paintin interfaceILcdGXYController- Parameters:
aGraphics- the Graphics on which the view was rendered.
-
getGXYView
Returns theILcdGXYViewthe controller is interacting with.- Returns:
- the
ILcdGXYViewthe controller is interacting with, or null if the view is not interacting with a view
-
setGXYView
Sets theILcdGXYViewthe controller is interacting with.This method is called when
ILcdGXYView.setGXYControlleris used to set anILcdGXYControlleractive on anILcdGXYView.- Parameters:
aGXYView- the view the controller is interacting with- See Also:
-
retrieveGXYViewXYWorldTransformation
Convenience method to retrieve theILcdGXYViewXYWorldTransformationfor theILcdGXYViewthis controller interacts with. The default implementation returns the view's own transformation.- Returns:
- a
ILcdGXYViewXYWorldTransformationfor theILcdGXYViewthis controller interacts with.
-
getCursor
Description copied from interface:ILcdGXYControllerReturns the cursor that will be displayed on a view when this controller is active for that view.- Specified by:
getCursorin interfaceILcdGXYController- Returns:
- the
Cursorset by setCursor, orCursor.getDefaultCursor()if noCursorhas been set yet.
-
setCursor
- Parameters:
aCursor- theCursorto use when a user interacts with thisILcdGXYControlleron aILcdGXYView.
-
setName
- Parameters:
aName- the name to associate to thisILcdGXYController
-
getName
Description copied from interface:ILcdGXYControllerReturns 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:
getNamein interfaceILcdGXYController- Returns:
- the name associated to this
ILcdGXYController
-
setShortDescription
- Parameters:
aShortDescription- the short description to associate to thisILcdGXYController
-
getShortDescription
Description copied from interface:ILcdGXYControllerReturns 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:
getShortDescriptionin interfaceILcdGXYController- Returns:
- the short description associated to this
ILcdGXYController
-
setIcon
- Parameters:
aIcon- theILcdIconto associate to thisILcdGXYController
-
getIcon
Description copied from interface:ILcdGXYControllerReturns an icon to visualize the interaction implemented. For example, an icon of a magnifying glass for a zoom controller.- Specified by:
getIconin interfaceILcdGXYController- Returns:
- the
ILcdIconassociated to thisILcdGXYController
-
registerInstance
protected void registerInstance()Deprecated.This method is not used.
-