Class ALcyCreateLayersAction<S extends ILcdView & ILcdTreeLayered,T extends ILcdLayer>
- All Implemented Interfaces:
ILcdAction
,ILcdUndoableSource
,ILcdPropertyChangeSource
,ActionListener
,Serializable
,EventListener
- Direct Known Subclasses:
TLcyCreateGXYLayerAction
,TLcyLspCreateLayerAction
Abstract base class to create and add layers onto an ILcyGenericMapComponent
.
It uses the available ALcyDefaultModelDescriptorFactory
instances to create a model descriptor and the ILcdModelFactory
instances to create an ILcdModel
. The
available factories are retrieved from the Lucy back-end.
After the ILcdModel
is created, the end-user is given a chance to modify it, using an
ILcyCustomizerPanel
for a TLcyModelMetaDataContext
. If no such ILcyCustomizerPanel
can be created, this step is
skipped.
If multiple ALcyDefaultModelDescriptorFactory
instances are available, the end-user is
asked to choose one of them. Alternatively, one can be set to this action.
This action provides undo support through its addUndoableListener
method. One
could for example attach ILcyLucyEnv.getUndoManager()
to enable it.
Extensions of this class should still implement the layer creation part. When layer(s) can be created, they will be added to the specified map component factory.
- Since:
- 2012.1
- See Also:
-
Field Summary
Fields inherited from class com.luciad.gui.ALcdAction
changeSupport
Fields inherited from interface com.luciad.gui.ILcdAction
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
-
Constructor Summary
ModifierConstructorDescriptionprotected
ALcyCreateLayersAction
(ILcyLucyEnv aLucyEnv, ILcyGenericMapComponent<S, T> aMapComponent) Create a new action which will add the created layers toaMapComponent
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Behaves equivalent tocreateAndInsertLayers(java.awt.Component)
void
addUndoableListener
(ILcdUndoableListener aListener) Adds a listener to this source, so this listener is notified when something undoable has happened.createAndInsertLayers
(Component aParentComponent) Creates and insert newILcdLayer
instances into the map component.createLayersForModel
(ILcdModel aModel, Component aParentComponent) Create a list of layers foraModel
protected ILcdModel
createModel
(Component aParentComponent) Creates theILcdModel
.protected void
fireUndoableHappened
(ILcdUndoable aUndoable) Fires the givenILcdUndoable
to the associated listeners.Returns theALcyDefaultModelDescriptorFactory
.protected ILcyLucyEnv
Returns the Lucy back-endprotected ILcyGenericMapComponent
<S, T> Returns theILcyGenericMapComponent
to which the created layers will be added.void
removeUndoableListener
(ILcdUndoableListener aListener) Removes the specified listener so it is no longer notified.void
setDefaultModelDescriptorFactory
(ALcyDefaultModelDescriptorFactory aDefaultModelDescriptorFactory) Sets theALcyDefaultModelDescriptorFactory
to use.Methods inherited from class com.luciad.gui.ALcdAction
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, isTraceOn, putValue, registerInstance, removePropertyChangeListener, setClassTraceOn, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription, setTraceOn
-
Constructor Details
-
ALcyCreateLayersAction
Create a new action which will add the created layers toaMapComponent
- Parameters:
aLucyEnv
- The Lucy back-endaMapComponent
- The map component to which the layers will be added
-
-
Method Details
-
actionPerformed
Behaves equivalent tocreateAndInsertLayers(java.awt.Component)
- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
e
- The event object
-
createAndInsertLayers
Creates and insert new
ILcdLayer
instances into the map component. Please refer to the class comment for more details about how the layers are created.- Parameters:
aParentComponent
- The parent component, used to parent dialogs.- Returns:
- A list containing the layers that were created and inserted, or
null
if the end-user cancelled the operation. - Throws:
IllegalArgumentException
- If noALcyDefaultModelDescriptorFactory
could be found inILcyLucyEnv
, and none was set, or if noILcdModelFactory
was found that could create anILcdModel
for the descriptor. Will also be thrown when no layer(s) could be created for theILcdModel
- See Also:
-
createModel
Creates theILcdModel
. Please refer to the class comment for more details about how the model is created- Parameters:
aParentComponent
- The parent component, used to parent dialogs.- Returns:
- The created
ILcdModel
, ornull
if the end-user canceled the operation. - Throws:
IllegalArgumentException
- If noALcyDefaultModelDescriptorFactory
could be found inILcyLucyEnv
, and none was set, or if noILcdModelFactory
was found that could create anILcdModel
for the descriptor.
-
createLayersForModel
Create a list of layers foraModel
- Parameters:
aModel
- The model to create the layers foraParentComponent
- The parent component, used to parent dialogs.- Returns:
- A list containing the layers that were created for
aModel
. This list should not be empty, nor should it containnull
. Can benull
in case the end-user cancelled the operation. - Throws:
IllegalArgumentException
- when no layer could be created foraModel
-
getLucyEnv
Returns the Lucy back-end- Returns:
- the Lucy back-end
-
getMapComponent
Returns theILcyGenericMapComponent
to which the created layers will be added.- Returns:
- the
ILcyGenericMapComponent
to which the created layers will be added.
-
addUndoableListener
Description copied from interface:ILcdUndoableSource
Adds a listener to this source, so this listener is notified when something undoable has happened.- Specified by:
addUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aListener
- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSource
Removes the specified listener so it is no longer notified.- Specified by:
removeUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aListener
- The listener to remove.
-
fireUndoableHappened
Fires the givenILcdUndoable
to the associated listeners.- Parameters:
aUndoable
- The undoable to fire.
-
getDefaultModelDescriptorFactory
Returns theALcyDefaultModelDescriptorFactory
.- Returns:
- the
ALcyDefaultModelDescriptorFactory
. - See Also:
-
setDefaultModelDescriptorFactory
public void setDefaultModelDescriptorFactory(ALcyDefaultModelDescriptorFactory aDefaultModelDescriptorFactory) Sets theALcyDefaultModelDescriptorFactory
to use. If set, that factory is used to create anILcdModelDescriptor
, which in turn is used to create anILcdModel
andILcdLayer
s. If set tonull
, the end-user is asked to choose from the factories that are available at theILcyLucyEnv
.- Parameters:
aDefaultModelDescriptorFactory
- The factory to use, ornull
for automatic behavior.- See Also:
-