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
changeSupportFields inherited from interface com.luciad.gui.ILcdAction
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedALcyCreateLayersAction(ILcyLucyEnv aLucyEnv, ILcyGenericMapComponent<S, T> aMapComponent) Create a new action which will add the created layers toaMapComponent -
Method Summary
Modifier and TypeMethodDescriptionvoidBehaves equivalent tocreateAndInsertLayers(java.awt.Component)voidaddUndoableListener(ILcdUndoableListener aListener) Adds a listener to this source, so this listener is notified when something undoable has happened.createAndInsertLayers(Component aParentComponent) Creates and insert newILcdLayerinstances into the map component.createLayersForModel(ILcdModel aModel, Component aParentComponent) Create a list of layers foraModelprotected ILcdModelcreateModel(Component aParentComponent) Creates theILcdModel.protected voidfireUndoableHappened(ILcdUndoable aUndoable) Fires the givenILcdUndoableto the associated listeners.Returns theALcyDefaultModelDescriptorFactory.protected ILcyLucyEnvReturns the Lucy back-endprotected ILcyGenericMapComponent<S, T> Returns theILcyGenericMapComponentto which the created layers will be added.voidremoveUndoableListener(ILcdUndoableListener aListener) Removes the specified listener so it is no longer notified.voidsetDefaultModelDescriptorFactory(ALcyDefaultModelDescriptorFactory aDefaultModelDescriptorFactory) Sets theALcyDefaultModelDescriptorFactoryto 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:
actionPerformedin interfaceActionListener- Parameters:
e- The event object
-
createAndInsertLayers
Creates and insert new
ILcdLayerinstances 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
nullif the end-user cancelled the operation. - Throws:
IllegalArgumentException- If noALcyDefaultModelDescriptorFactorycould be found inILcyLucyEnv, and none was set, or if noILcdModelFactorywas found that could create anILcdModelfor 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, ornullif the end-user canceled the operation. - Throws:
IllegalArgumentException- If noALcyDefaultModelDescriptorFactorycould be found inILcyLucyEnv, and none was set, or if noILcdModelFactorywas found that could create anILcdModelfor 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 benullin 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 theILcyGenericMapComponentto which the created layers will be added.- Returns:
- the
ILcyGenericMapComponentto which the created layers will be added.
-
addUndoableListener
Description copied from interface:ILcdUndoableSourceAdds a listener to this source, so this listener is notified when something undoable has happened.- Specified by:
addUndoableListenerin interfaceILcdUndoableSource- Parameters:
aListener- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeUndoableListenerin interfaceILcdUndoableSource- Parameters:
aListener- The listener to remove.
-
fireUndoableHappened
Fires the givenILcdUndoableto the associated listeners.- Parameters:
aUndoable- The undoable to fire.
-
getDefaultModelDescriptorFactory
Returns theALcyDefaultModelDescriptorFactory.- Returns:
- the
ALcyDefaultModelDescriptorFactory. - See Also:
-
setDefaultModelDescriptorFactory
public void setDefaultModelDescriptorFactory(ALcyDefaultModelDescriptorFactory aDefaultModelDescriptorFactory) Sets theALcyDefaultModelDescriptorFactoryto use. If set, that factory is used to create anILcdModelDescriptor, which in turn is used to create anILcdModelandILcdLayers. If set tonull, the end-user is asked to choose from the factories that are available at theILcyLucyEnv.- Parameters:
aDefaultModelDescriptorFactory- The factory to use, ornullfor automatic behavior.- See Also:
-