public abstract class ALcdGXYController extends Object implements ILcdGXYController, ILcdStatusSource
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:
startInteraction(com.luciad.view.gxy.ILcdGXYView)
and terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
,
if the view implementation does not already do this;paint(java.awt.Graphics)
) and/or change
the mouse cursor during the user interaction (see ILcdGXYView.setCursor(java.awt.Cursor)
).status events
to its
status listeners
.ILcdGXYController
,
Serialized FormConstructor and Description |
---|
ALcdGXYController() |
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aStatusListener)
Registers the given listener so it will receive status events from this source.
|
ILcdGXYController |
asGXYController() |
protected void |
fireStatusEvent(TLcdStatusEvent aStatusEvent) |
Cursor |
getCursor()
Returns the cursor that will be displayed on a view when this controller is active for that view.
|
ILcdGXYView |
getGXYView()
Returns the
ILcdGXYView the controller is interacting with. |
ILcdIcon |
getIcon()
Returns an icon to visualize the interaction implemented.
|
String |
getName()
Returns a name for this controller that enables to determine the interaction that
can be performed with this controller.
|
String |
getShortDescription()
Returns a short description that enables to determine the interaction that
can be performed with this controller.
|
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
paint(Graphics aGraphics)
Enables the controller to give visual feedback on the current user interactions.
|
protected void |
registerInstance()
Deprecated.
This method is not used.
|
void |
removeStatusListener(ILcdStatusListener aStatusListener)
Removes the specified listener so it is no longer notified.
|
protected ILcdGXYViewXYWorldTransformation |
retrieveGXYViewXYWorldTransformation()
Convenience method to retrieve the
ILcdGXYViewXYWorldTransformation for the
ILcdGXYView this controller interacts with. |
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setCursor(Cursor aCursor) |
protected void |
setGXYView(ILcdGXYView aGXYView)
Sets the
ILcdGXYView the controller is interacting with. |
void |
setIcon(ILcdIcon aIcon) |
void |
setName(String aName) |
void |
setShortDescription(String aShortDescription) |
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
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.
use
paint(java.awt.Graphics) instead |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLayered
public void addStatusListener(ILcdStatusListener aStatusListener)
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.
addStatusListener
in interface ILcdStatusSource
aStatusListener
- The listener to be notified when the status has changed.public void removeStatusListener(ILcdStatusListener aStatusListener)
ILcdStatusSource
removeStatusListener
in interface ILcdStatusSource
aStatusListener
- The listener to remove.protected void fireStatusEvent(TLcdStatusEvent aStatusEvent)
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.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.public boolean isTraceOn()
true
if tracing is enabled for this class.public ILcdGXYController asGXYController()
public void startInteraction(ILcdGXYView aGXYView)
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
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)
terminateInteraction
in interface ILcdGXYController
aGXYView
- the ILcdGXYView
this ILcdGXYController
interacted with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void viewRepaint(ILcdGXYView aGXYView)
paint(java.awt.Graphics)
insteadviewRepaint
in interface ILcdGXYController
aGXYView
- the ILcdGXYView
to draw on.public void paint(Graphics aGraphics)
Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
paint
in interface ILcdGXYController
aGraphics
- the Graphics on which the view was rendered.public ILcdGXYView getGXYView()
ILcdGXYView
the controller is interacting with.ILcdGXYView
the controller is interacting with, or null if the view is not interacting
with a viewprotected void setGXYView(ILcdGXYView aGXYView)
ILcdGXYView
the controller is interacting with.
This method is called when ILcdGXYView.setGXYController
is used to set an
ILcdGXYController
active on an ILcdGXYView
.
aGXYView
- the view the controller is interacting withstartInteraction(com.luciad.view.gxy.ILcdGXYView)
,
ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
protected ILcdGXYViewXYWorldTransformation retrieveGXYViewXYWorldTransformation()
ILcdGXYViewXYWorldTransformation
for the
ILcdGXYView
this controller interacts with.
The default implementation returns the view's own transformation.ILcdGXYViewXYWorldTransformation
for the ILcdGXYView
this controller interacts with.public Cursor getCursor()
ILcdGXYController
getCursor
in interface ILcdGXYController
Cursor
set by setCursor, or Cursor.getDefaultCursor()
if no Cursor
has been set yet.public void setCursor(Cursor aCursor)
aCursor
- the Cursor
to use when a user interacts with this
ILcdGXYController
on a ILcdGXYView
.public void setName(String aName)
aName
- the name to associate to this ILcdGXYController
public String getName()
ILcdGXYController
getName
in interface ILcdGXYController
ILcdGXYController
public void setShortDescription(String aShortDescription)
aShortDescription
- the short description to associate to this
ILcdGXYController
public String getShortDescription()
ILcdGXYController
getShortDescription
in interface ILcdGXYController
ILcdGXYController
public void setIcon(ILcdIcon aIcon)
aIcon
- the ILcdIcon
to associate to this
ILcdGXYController
public ILcdIcon getIcon()
ILcdGXYController
getIcon
in interface ILcdGXYController
ILcdIcon
associated to this
ILcdGXYController
protected void registerInstance()