public class TLcyLspMapLayerControlFactory extends ALcyGUIFactory<TLcyLspMapLayerControl>
Factory to create a TLcyLspMapLayerControl
for a given
TLcyLspMapComponent
. It cannot create a layer control for other
ILcyGenericMapComponent
implementations.
It uses the concept of an ALcyGUIFactory
, allowing the users of this
class to modify almost every part of the creation process.
The layer control is composed of a list of layers, and several ILcyActionBar
instances that contain actions to move and delete the selected layer(s) and to change their
properties.
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_BAR
The ID for the
createActionBar method that represents the regular ILcyActionBar , by default the
tool bar located at the top of the layer control panel. |
static int |
CENTER_PANEL
The ID for the
createPanel method that represents the panel located at the center of the layer control. |
static int |
COPY_LAYER_REFERENCE_ACTION
The ID for the
createAction method that represents the action to adapt the world reference of the view so
that the projection and geodetic datum match with that of the model of the selected layer. |
static int |
COPY_LAYER_REFERENCE_ACTION_ENABLED_FILTER
The ID for the
createActionEnabledFilter
method that represents the ILcdFilter to enable or disable the copy layer
reference action. |
static int |
COPY_LAYERS_ACTION
The ID for the
createAction
method that represents the action to import layers from another map component. |
static int |
DELETE_LAYER_ACTION
The ID for the
createAction method that represents the action to delete the selected layer(s). |
static int |
DELETE_LAYER_ACTION_ENABLED_FILTER
The ID for the
createEnabledActionFilter method that represents the ILcdFilter to enable or
disable the delete layer action. |
static int |
EAST_PANEL
The ID for the
createPanel method that represents the panel located at the east of the layer control. |
static int |
FIT_TO_LAYER_ACTION
The ID for the
createAction method that represents the action to fit the map extents so that the selected
layers are shown. |
static int |
FIT_TO_LAYER_ACTION_ENABLED_FILTER
The ID for the
createEnabledActionFilter method that represents the ILcdFilter to enable or
disable the fit to layer action. |
static int |
LAYER_CONTROL_TRANSFER_HANDLER
The ID for the
createTransferHandler(int, com.luciad.lucy.util.properties.ALcyProperties)
method that represents the transfer handler for the layer control. |
static int |
LAYER_EDITABLE_ACTIVE_SETTABLE
The ID for the
createActiveSettable method that represents the active settable to toggle the editable
property of the selected layer(s) on or off. |
static int |
LAYER_EDITABLE_ACTIVE_SETTABLE_ENABLED_FILTER
The ID for the
createEnabledActiveSettableFilter method that represents the ILcdFilter to enable
or disable the layer editable active settable |
static int |
LAYER_LABELED_ACTIVE_SETTABLE
The ID for the
createActiveSettable method that represents the active settable to toggle the labeled
property of the selected layer(s). |
static int |
LAYER_LABELED_ACTIVE_SETTABLE_ENABLED_FILTER
The ID for the
createEnabledActiveSettableFilter method that represents the ILcdFilter to enable
or disable the layer labeled active settable. |
static int |
LAYER_PROPERTIES_ACTION
The ID for the
createAction method that represents the action to show the layer properties of the selected
layer(s). |
static int |
LAYER_PROPERTIES_ACTION_ENABLED_FILTER
The ID for the
createEnabledActionFilter method that represents the ILcdFilter to enable or
disable the layer properties action. |
static int |
LAYER_SELECTABLE_ACTIVE_SETTABLE
The ID for the
createActiveSettable method that represents the active settable to toggle the selectable
property of the selected layer(s). |
static int |
LAYER_SELECTABLE_ACTIVE_SETTABLE_ENABLED_FILTER
The ID for the
createEnabledActiveSettableFilter method that represents the ILcdFilter to enable
or disable the layer selectable active settable. |
static int |
LAYER_TREE_COMPONENT
The ID for the
createComponent method that represents the Component to show a hierarchical view
on the layers of the view. |
static int |
LAYER_VISIBLE_ACTIVE_SETTABLE
The ID for the
createActiveSettable method that represents the active settable to toggle the visibility
property of the selected layer(s). |
static int |
LAYER_VISIBLE_ACTIVE_SETTABLE_ENABLED_FILTER
The ID for the
createEnabledActiveSettableFilter method that represents the ILcdFilter to
enable
or disable the layer visible active settable. |
static String |
MAP_COMPONENT_PROPERTY_NAME
The name of the property, containing the map component.
|
static int |
MOVE_LAYER_BOTTOM_ACTION
The ID for the
createAction method that represents the action to move layers to the bottom of the view. |
static int |
MOVE_LAYER_DOWN_ACTION
The ID for the
createAction method that represents the action to move layers one position towards the bottom
of the view. |
static int |
MOVE_LAYER_TOP_ACTION
The ID for the
createAction method that represents the action to move layers to the top of the view. |
static int |
MOVE_LAYER_UP_ACTION
The ID for the
createAction method that represents the action to move layers one position towards the top of
the view. |
static int |
NORTH_PANEL
The ID for the
createPanel method that represents the panel located at the north of the layer control. |
static int |
ORDER_ACTION_BAR
The ID for the
createActionBar method that represents the so called order bar, which contains by default the
buttons to change the position of layers in the view, and which is located by default at the
east of the layer control panel. |
static int |
SET_LAYER_TRANSPARENCY_ACTION
The ID for the
createAction method that represents the action to change the transparency of the layer. |
static int |
SET_LAYER_TRANSPARENCY_ACTION_ENABLED_FILTER
The ID for the
createActionEnabledFilter
method that represents the ILcdFilter for the action to change the transparency of a layer. |
static int |
SOUTH_PANEL
The ID for the
createPanel method that represents the panel located at the south of the layer control. |
static int |
TREE
The ID for the
createTree method that represents the Swing JTree for the hierarchical layer
view. |
static int |
TREE_CELL_RENDERER
The ID for the
createTreeCellRenderer method that represents the Swing tree cell renderer for the
hierarchical layer view. |
static int |
TREE_MODEL
The ID for the
createTreeModel method that represents the Swing tree model for the hierarchical layer view. |
static int |
WEST_PANEL
The ID for the
createPanel method that represents the panel located at the west of the layer control. |
Constructor and Description |
---|
TLcyLspMapLayerControlFactory(ILcyLucyEnv aLucyEnv)
Creates a new layer control factory for the specified
ILcyLucyEnv . |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanup(ALcyProperties aProperties)
Performs cleanup operations, such as nullifying fields that are no longer needed.
|
protected ILcdAction |
createAction(int aActionID,
ALcyProperties aProperties)
Creates an
ILcdAction for the given ID. |
protected ILcyActionBar |
createActionBar(int aActionBarID,
ALcyProperties aProperties)
Creates an empty action bar.
|
protected ILcdFilter<ILspLayer> |
createActionEnabledFilter(int aFilterID,
ALcyProperties aProperties)
Creates an
ILcdFilter for the corresponding action. |
protected ILcyActiveSettable |
createActiveSettable(int aActiveSettableID,
ALcyProperties aProperties)
Creates an
ILcyActiveSettable for the given ID. |
protected ILcdFilter<ILspLayer> |
createActiveSettableEnabledFilter(int aFilterID,
ALcyProperties aProperties)
Creates an
ILcdFilter for the corresponding active settable. |
protected Component |
createComponent(int aComponentID,
ALcyProperties aProperties)
Creates a widget for the given ID.
|
protected TLcyLspMapLayerControl |
createEmptyMapLayerControl(ALcyProperties aProperties)
Creates an empty layer control, without any content, buttons or panels.
|
protected TLcyLspMapLayerControl |
createGUIContent(ALcyProperties aProperties)
Retrieves all panels and lays them out in a
java.awt.Component . |
protected Component |
createPanel(int aPanelID,
ALcyProperties aProperties)
Creates a panel for the given ID.
|
protected ILcyPopupMenu |
createPopupMenu(ALcyProperties aProperties)
Creates an empty popup menu.
|
protected TransferHandler |
createTransferHandler(int aTransferHandlerID,
ALcyProperties aProperties)
Creates a
TransferHandler for the given ID. |
protected JTree |
createTree(int aTreeID,
ALcyProperties aProperties)
Creates the tree corresponding to the ID
aTreeID . |
protected TreeCellRenderer |
createTreeCellRenderer(int aTreeCellRendererID,
ALcyProperties aProperties)
Creates the tree cell renderer corresponding to the ID
aTreeCellRendererID . |
protected TreeModel |
createTreeModel(int aTreeModelID,
ALcyProperties aProperties)
Creates the tree model corresponding to the ID
aTreeModelID . |
protected ILcyActionBar |
getActionBar(int aActionBarID)
Returns the
ILcyActionBar for the given ID. |
protected ILcdIntList |
getActionBarIDs()
Returns the list with all action bar IDs.
|
protected Object |
getActionContext(int aActionID,
ALcyProperties aProperties)
Returns the context of the action bars in which the action with the specified ID should be
inserted.
|
protected ILcdFilter<ILspLayer> |
getActionEnabledFilter(int aFilterID)
Returns the
ILcdFilter for the given ID. |
protected ILcdIntList |
getActionEnabledFilterIDs()
Returns the list with all enabled action filter IDs.
|
protected Object |
getActiveSettableContext(int aActiveSettableID,
ALcyProperties aProperties)
Returns the context of the action bars in which the active settable with the specified ID
should be inserted.
|
protected ILcdFilter<ILspLayer> |
getActiveSettableEnabledFilter(int aFilterID)
Returns the
ILcdFilter for the given ID. |
protected ILcdIntList |
getActiveSettableEnabledFilterIDs()
Returns the list with all enabled active settable filter IDs.
|
protected ILcyLspMapComponent |
getMapComponent(ALcyProperties aProperties)
Convenience method to retrieve the map component from
aProperties . |
protected TLcyLspMapLayerControl |
getMapLayerControl()
Returns the map layer control under construction.
|
protected ILcyPopupMenu |
getPopupMenu()
Returns the created
ILcyPopupMenu . |
protected TransferHandler |
getTransferHandler(int aTransferHandlerID)
Returns the
TransferHandler for the given ID. |
protected ILcdIntList |
getTransferHandlerIDs()
Returns the list with all transfer handler IDs.
|
protected JTree |
getTree(int aTreeID)
Returns the
JTree for the given ID. |
protected TreeCellRenderer |
getTreeCellRenderer(int aTreeCellRendererID)
Returns the
TreeCellRenderer for the given ID. |
protected ILcdIntList |
getTreeCellRendererIDs()
Returns the list with all tree cell renderer IDs.
|
protected ILcdIntList |
getTreeIDs()
Returns the list with all tree IDs.
|
protected TreeModel |
getTreeModel(int aTreeModelID)
Returns the
TreeModel for the given ID. |
protected ILcdIntList |
getTreeModelIDs()
Returns the list with all tree model IDs.
|
protected void |
setup(ALcyProperties aProperties)
This method overrides the default behavior of the
setup method. |
createGUI, getAction, getActionIDs, getActiveSettable, getActiveSettableIDs, getComponent, getComponentIDs, getLucyEnv, getPanel, getPanelIDs, isActiveSettableDeactivatePossible
public static final String MAP_COMPONENT_PROPERTY_NAME
TLcyLspMapComponentFactory
will insert the map component it is creating in the properties, passed to this factory. This
map component can be retrieved by this String.public static final int FIT_TO_LAYER_ACTION
createAction
method that represents the action to fit the map extents so that the selected
layers are shown.public static final int LAYER_PROPERTIES_ACTION
createAction
method that represents the action to show the layer properties of the selected
layer(s). It does so using the ILcyCustomizerPanelFactory
s available in the
TLcyUserInterfaceManager
for an object of type TLcyLayerContext
.public static final int DELETE_LAYER_ACTION
createAction
method that represents the action to delete the selected layer(s).public static final int MOVE_LAYER_TOP_ACTION
createAction
method that represents the action to move layers to the top of the view.public static final int MOVE_LAYER_UP_ACTION
createAction
method that represents the action to move layers one position towards the top of
the view.public static final int MOVE_LAYER_DOWN_ACTION
createAction
method that represents the action to move layers one position towards the bottom
of the view.public static final int MOVE_LAYER_BOTTOM_ACTION
createAction
method that represents the action to move layers to the bottom of the view.public static final int COPY_LAYERS_ACTION
The ID for the createAction
method that represents the action to import layers from another map component.
public static final int COPY_LAYER_REFERENCE_ACTION
createAction
method that represents the action to adapt the world reference of the view so
that the projection and geodetic datum match with that of the model of the selected layer. As a
result, no projection or geodetic datum transformations are required when painting that
specific layer, resulting in faster paint times (for that layer). This is especially true for
raster data (imagery), where those transformations are computationally expensive (called
warping).public static final int SET_LAYER_TRANSPARENCY_ACTION
createAction
method that represents the action to change the transparency of the layer.public static final int LAYER_SELECTABLE_ACTIVE_SETTABLE
createActiveSettable
method that represents the active settable to toggle the selectable
property of the selected layer(s).public static final int LAYER_LABELED_ACTIVE_SETTABLE
createActiveSettable
method that represents the active settable to toggle the labeled
property of the selected layer(s).public static final int LAYER_VISIBLE_ACTIVE_SETTABLE
createActiveSettable
method that represents the active settable to toggle the visibility
property of the selected layer(s).public static final int LAYER_EDITABLE_ACTIVE_SETTABLE
createActiveSettable
method that represents the active settable to toggle the editable
property of the selected layer(s) on or off.ILcdLayer.isEditable()
,
Constant Field Valuespublic static final int LAYER_SELECTABLE_ACTIVE_SETTABLE_ENABLED_FILTER
createEnabledActiveSettableFilter
method that represents the ILcdFilter
to enable
or disable the layer selectable active settable.public static final int LAYER_LABELED_ACTIVE_SETTABLE_ENABLED_FILTER
createEnabledActiveSettableFilter
method that represents the ILcdFilter
to enable
or disable the layer labeled active settable.public static final int LAYER_VISIBLE_ACTIVE_SETTABLE_ENABLED_FILTER
createEnabledActiveSettableFilter
method that represents the ILcdFilter
to
enable
or disable the layer visible active settable.public static final int LAYER_EDITABLE_ACTIVE_SETTABLE_ENABLED_FILTER
createEnabledActiveSettableFilter
method that represents the ILcdFilter
to enable
or disable the layer editable active settablepublic static final int LAYER_PROPERTIES_ACTION_ENABLED_FILTER
createEnabledActionFilter
method that represents the ILcdFilter
to enable or
disable the layer properties action.LAYER_PROPERTIES_ACTION
,
Constant Field Valuespublic static final int FIT_TO_LAYER_ACTION_ENABLED_FILTER
createEnabledActionFilter
method that represents the ILcdFilter
to enable or
disable the fit to layer action.FIT_TO_LAYER_ACTION
,
Constant Field Valuespublic static final int DELETE_LAYER_ACTION_ENABLED_FILTER
createEnabledActionFilter
method that represents the ILcdFilter
to enable or
disable the delete layer action.DELETE_LAYER_ACTION
,
Constant Field Valuespublic static final int COPY_LAYER_REFERENCE_ACTION_ENABLED_FILTER
createActionEnabledFilter
method that represents the ILcdFilter
to enable or disable the copy layer
reference action.COPY_LAYER_REFERENCE_ACTION
,
Constant Field Valuespublic static final int SET_LAYER_TRANSPARENCY_ACTION_ENABLED_FILTER
createActionEnabledFilter
method that represents the ILcdFilter
for the action to change the transparency of a layer.SET_LAYER_TRANSPARENCY_ACTION
,
Constant Field Valuespublic static final int LAYER_TREE_COMPONENT
The ID for the createComponent
method that represents the Component
to show a hierarchical view
on the layers of the view.
The creation of this component is performed in parts, please refer to the constants that are
prefixed with LAYER_TREE_COMPONENT
for more information.
public static final int ACTION_BAR
createActionBar
method that represents the regular ILcyActionBar
, by default the
tool bar located at the top of the layer control panel.public static final int ORDER_ACTION_BAR
createActionBar
method that represents the so called order bar, which contains by default the
buttons to change the position of layers in the view, and which is located by default at the
east of the layer control panel.public static final int TREE_MODEL
createTreeModel
method that represents the Swing tree model for the hierarchical layer view.
This ID represents a part of the LAYER_TREE_COMPONENT
.LAYER_TREE_COMPONENT
,
Constant Field Valuespublic static final int TREE_CELL_RENDERER
createTreeCellRenderer
method that represents the Swing tree cell renderer for the
hierarchical layer view. This ID represents a part of the LAYER_TREE_COMPONENT
.LAYER_TREE_COMPONENT
,
Constant Field Valuespublic static final int TREE
createTree
method that represents the Swing JTree
for the hierarchical layer
view. This ID represents a part of the LAYER_TREE_COMPONENT
.LAYER_TREE_COMPONENT
,
Constant Field Valuespublic static final int NORTH_PANEL
createPanel
method that represents the panel located at the north of the layer control.public static final int EAST_PANEL
createPanel
method that represents the panel located at the east of the layer control.public static final int SOUTH_PANEL
createPanel
method that represents the panel located at the south of the layer control.public static final int WEST_PANEL
createPanel
method that represents the panel located at the west of the layer control.public static final int CENTER_PANEL
createPanel
method that represents the panel located at the center of the layer control.public static final int LAYER_CONTROL_TRANSFER_HANDLER
createTransferHandler(int, com.luciad.lucy.util.properties.ALcyProperties)
method that represents the transfer handler for the layer control.public TLcyLspMapLayerControlFactory(ILcyLucyEnv aLucyEnv)
Creates a new layer control factory for the specified ILcyLucyEnv
.
It will create all the default actions, active settables, ... of which the IDs can be found as static fields on this class.
aLucyEnv
- the Lucy backend.protected void setup(ALcyProperties aProperties)
This method overrides the default behavior of the setup
method. It will create all the components in a certain order. It will
createEmptyMapLayerControl(com.luciad.lucy.util.properties.ALcyProperties)
.createPopupMenu(com.luciad.lucy.util.properties.ALcyProperties)
.createActionBar(int,
com.luciad.lucy.util.properties.ALcyProperties)
with all given action bar ids (see getActionBarIDs()
).createActiveSettableEnabledFilter(int,
com.luciad.lucy.util.properties.ALcyProperties)
with all given active settable filter ids
(see getActiveSettableEnabledFilterIDs()
).createActionEnabledFilter(int,
com.luciad.lucy.util.properties.ALcyProperties)
with all given action filter ids (see getActionEnabledFilterIDs()
).createTreeModel(int,
com.luciad.lucy.util.properties.ALcyProperties)
with all given tree model ids (see getTreeModelIDs()
).createTreeCellRenderer(int,
com.luciad.lucy.util.properties.ALcyProperties)
with all given tree cell renderer ids (see
getTreeCellRendererIDs()
).createTree(int, com.luciad.lucy.util.properties.ALcyProperties)
with all given tree ids (see getTreeIDs()
).ALcyGUIFactory.setup(com.luciad.lucy.util.properties.ALcyProperties)
.createTransferHandler(int,
com.luciad.lucy.util.properties.ALcyProperties)
with all given transfer handler ids (see
getTransferHandlerIDs()
). Note that because of this order, panels can be composed of components, and components can
use the active settables and actions, ... . So the createPanel(int, com.luciad.lucy.util.properties.ALcyProperties)
method can use ALcyGUIFactory.getComponent(int)
to retrieve its sub components, and the createComponent(int, com.luciad.lucy.util.properties.ALcyProperties)
method can use
ALcyGUIFactory.getAction(int)
and ALcyGUIFactory.getActiveSettable(int)
to retrieve needed actions and active
settables.
setup
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aProperties
- a properties object that can be used to tune the behavior of this factory.protected void cleanup(ALcyProperties aProperties)
ALcyGUIFactory
Performs cleanup operations, such as nullifying fields that are no longer needed.
Warning: Should not be overridden without calling the super function.
cleanup
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aProperties
- a properties object that can be used to tune the behavior of this factory.protected Object getActionContext(int aActionID, ALcyProperties aProperties)
ALcyGUIFactory
Returns the context of the action bars in which the action with the specified ID should be inserted.
All actions are inserted in the action bars by TLcyActionBarUtil.insertInConfiguredActionBars(com.luciad.gui.ILcdAction,
Object, com.luciad.lucy.gui.TLcyActionBarManager, com.luciad.lucy.util.properties.ALcyProperties)
.
This method specifies the context for which the action with ID aActionID
is
inserted.
By default this method returns null
.
getActionContext
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aActionID
- the ID of the action.aProperties
- The properties. Can be used to tune the behavior of this factory.protected Object getActiveSettableContext(int aActiveSettableID, ALcyProperties aProperties)
ALcyGUIFactory
Returns the context of the action bars in which the active settable with the specified ID should be inserted.
All active settables are inserted in the action bars by TLcyActionBarUtil#insertInConfiguredActionBars
. This method
specifies the context for which the active settable with ID aActiveSettableID
is
inserted.
By default this method returns null
.
getActiveSettableContext
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aActiveSettableID
- the ID of the active settableaProperties
- The properties. Can be used to tune the behavior of this factory.protected TLcyLspMapLayerControl createGUIContent(ALcyProperties aProperties)
ALcyGUIFactory
Retrieves all panels and lays them out in a java.awt.Component
. Therefore, this
method uses ALcyGUIFactory.getPanel(int)
with all ID's that end in PANEL
, and lays out
those components in for example a javax.swing.JPanel
.
This function should be overridden when the global layout of the panel needs to be changed, for example when the main panels need to be rearranged, or when a new panel needs to be added.
An example implementation could be:
public Component createGUIContent( ALcyProperties aProperties ) {
JPanel content = new JPanel( new BorderLayout() );
Component somePanel = getPanel( SOME_PANEL );
if ( somePanel != null ) content.add( somePanel, BorderLayout.NORTH );
Component otherPanel = getPanel( OTHER_PANEL );
if ( otherPanel != null ) content.add( otherPanel, BorderLayout.CENTER );
return content;
}
createGUIContent
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aProperties
- a properties object that can be used to tune the behavior of this factory.protected TLcyLspMapLayerControl createEmptyMapLayerControl(ALcyProperties aProperties)
Creates an empty layer control, without any content, buttons or panels.
aProperties
- a properties object that can be used to tune the behavior of this factory.null
.protected ILcyPopupMenu createPopupMenu(ALcyProperties aProperties)
Creates an empty popup menu.
aProperties
- a properties object that can be used to tune the behavior of this factory.null
, but subclasses may
choose to return null
if they want to remove the popup menu from the layer
control.protected ILcyPopupMenu getPopupMenu()
Returns the created ILcyPopupMenu
.
Please refer to setup
to
know when this method can be used.
ILcyPopupMenu
, or null
.protected ILcyActionBar createActionBar(int aActionBarID, ALcyProperties aProperties)
Creates an empty action bar.
aActionBarID
- The ID of the action bar. It is typically a constant ending in
ACTION_BAR
aProperties
- a properties object that can be used to tune the behavior of this factory.null
, but subclasses may
choose to return null
if they want to remove the specified action bar
from the layer control.protected ILcyActionBar getActionBar(int aActionBarID)
Returns the ILcyActionBar
for the given ID.
Please refer to setup
to
know when this method can be used.
aActionBarID
- The id describing which ILcyActionBar
to return. This is
normally a constant that ends in ACTION_BAR
.ILcyActionBar
for the given ID.protected ILcdIntList getActionBarIDs()
Returns the list with all action bar IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing action bar IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected ILcdFilter<ILspLayer> createActiveSettableEnabledFilter(int aFilterID, ALcyProperties aProperties)
Creates an ILcdFilter
for the corresponding active settable. If the filter does
not accept a layer passed as argument to the ILcdFilter.accept(Object)
method ( ie. returns false), the corresponding user interface element will be disabled when
that layer is selected.
This default implementation will always return an ILcdFilter
that is not null.
It is good practice to combine this filter with your filter by using an ALcyCompositeFilter
to which you add your filter and the filter returned
by this default implementation.
Following example demonstrates how you could override this method:
protected ILcdFilter<ILspLayer> createActiveSettableEnabledFilter(
int aFilterID, ALcyProperties aProperties ) {
switch ( aFilterID ){
// create a filter that will disable the layer selectable button for specific layers.
case LAYER_SELECTABLE_ACTIVE_SETTABLE_ENABLED_FILTER:
TLcyCompositeAndFilter<ILspLayer> my_filter = new TLcyCompositeAndFilter<ILspLayer>();
// Make sure we use the filter created by the super implementation.
// This filter will never be null
.
my_filter.addFilter( super.createActiveSettableEnabledFilter( aFilterID, aProperties ) );
// do not accept layers that have a model with a MyModelDescriptor as model descriptor.
my_filter.addFilter( new ILcdFilter<ILspLayer>(){
public boolean accept( ILspLayer aLayer ){
return !( aLayer.getModel().getModelDescriptor() instanceof MyModelDescriptor );
}
} );
return my_filter;
default:
return super.createActiveSettableEnabledFilter( aFilterID, aProperties );
}
}
aFilterID
- the ID indicating for which active settable the filter applies. It is
typically an ID ending in ACTIVE_SETTABLE_ENABLED_FILTER
.aProperties
- a properties object that can be used to tune the behavior of this factory.protected ILcdFilter<ILspLayer> getActiveSettableEnabledFilter(int aFilterID)
Returns the ILcdFilter
for the given ID.
Please refer to setup
to know
when this method can be used.
aFilterID
- the id describing which ILcdFilter
to return. This is usually a
constant that ends in ACTIVE_SETTABLE_ENABLED_FILTER
.ILcdFilter
for the given ID.protected ILcdIntList getActiveSettableEnabledFilterIDs()
Returns the list with all enabled active settable filter IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing enabled active settable filter IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected ILcdFilter<ILspLayer> createActionEnabledFilter(int aFilterID, ALcyProperties aProperties)
Creates an ILcdFilter
for the corresponding action. If the filter does not
accept a layer passed as argument to the ILcdFilter.accept(Object)
method ( ie. returns false), the corresponding user interface element will be disabled when
that layer is selected.
This default implementation will always return an ILcdFilter
that is not null.
It is good practice to combine this filter with your filter by using an ALcyCompositeFilter
to which you add your filter and the filter returned
by this default implementation.
Following example demonstrates how you could override this method:
protected ILcdFilter<ILspLayer> createActionEnabledFilter( int aFilterID, ALcyProperties
aProperties ) {
switch ( aFilterID ){
// create a filter that will disable the fit action for specific layers.
case FIT_TO_LAYER_ACTION_ENABLED_FILTER:
TLcyCompositeAndFilter<ILspLayer> my_filter = new TLcyCompositeAndFilter<ILspLayer>();
// Make sure we use the filter created by the super implementation.
// This filter will never be null
.
my_filter.addFilter( super.createActionEnabledFilter( aFilterID, aProperties ) );
// do not accept layers that have a model with a MyModelDescriptor as modeldescriptor.
my_filter.addFilter( new ILcdFilter<ILspLayer>(){
public boolean accept( ILspLayer aLayer ){
return !( aLayer.getModel().getModelDescriptor() instanceof MyModelDescriptor );
} );
return my_filter;
default:
return super.createActionEnabledFilter( aFilterID, aProperties );
}
}
aFilterID
- the ID indicating for which action the filter applies. It is typically an ID
ending in ACTION_ENABLED_FILTER
.aProperties
- a properties object that can be used to tune the behavior of this factory.protected ILcdFilter<ILspLayer> getActionEnabledFilter(int aFilterID)
Returns the ILcdFilter
for the given ID.
Please refer to setup
to know
when this method can be used.
aFilterID
- the id describing which ILcdFilter
to return. This is normally a
constant that ends in ACTION_ENABLED_FILTER
.ILcdFilter
for the given ID.protected ILcdIntList getActionEnabledFilterIDs()
Returns the list with all enabled action filter IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing enabled action filter IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected TreeModel createTreeModel(int aTreeModelID, ALcyProperties aProperties)
aTreeModelID
. May return
null
.aTreeModelID
- the ID of the tree model. This is typically a constant ending in
TREE_MODEL
.aProperties
- a properties object that can be used to tune the behavior of this factory.aTreeModelID
. May be
null
.protected TreeModel getTreeModel(int aTreeModelID)
Returns the TreeModel
for the given ID.
Please refer to setup
to know
when this method can be used.
aTreeModelID
- the id describing which TreeModel
to return. This is usually a
constant that ends in TREE_MODEL
.TreeModel
for the given ID.protected ILcdIntList getTreeModelIDs()
Returns the list with all tree model IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing tree model IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected TreeCellRenderer createTreeCellRenderer(int aTreeCellRendererID, ALcyProperties aProperties)
aTreeCellRendererID
. May
return null
.aTreeCellRendererID
- the ID of the tree cell renderer. This is typically a constant
ending in TREE_CELL_RENDERER
.aProperties
- a properties object that can be used to tune the behavior of this
factory.aTreeCellRendererID
. May be
null
.protected TreeCellRenderer getTreeCellRenderer(int aTreeCellRendererID)
Returns the TreeCellRenderer
for the given ID.
Please refer to setup
to know
when this method can be used.
aTreeCellRendererID
- the id describing which TreeCellRenderer
to return.
This is normally a constant that ends in TREE_CELL_RENDERER
.TreeCellRenderer
for the given ID.protected ILcdIntList getTreeCellRendererIDs()
Returns the list with all tree cell renderer IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing tree cell renderer IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected JTree createTree(int aTreeID, ALcyProperties aProperties)
aTreeID
. May return null
.aTreeID
- the ID of the tree. This is typically a constant ending in
TREE
.aProperties
- a properties object that can be used to tune the behavior of this factory.aTreeID
. May be null
.protected JTree getTree(int aTreeID)
Returns the JTree
for the given ID.
Please refer to setup
to
know
when this method can be used.
aTreeID
- the id describing which JTree
to return. This is normally a
constant that ends in TREE
.JTree
for the given ID.protected ILcdIntList getTreeIDs()
Returns the list with all tree IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing tree IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected ILcdAction createAction(int aActionID, ALcyProperties aProperties)
ALcyGUIFactory
Creates an ILcdAction
for the given ID.
Note: if the action should be inserted in the configured action bars, the ID_KEY of the
returned action must be set (see TLcyActionBarUtil.ID_KEY
).
createAction
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aActionID
- the ID describing which action to create. This is normally a constant that
ends with ACTION
.aProperties
- a properties object that can be used to tune the behavior of this factory.ILcdAction
, or null
.ALcyGUIFactory.setup(com.luciad.lucy.util.properties.ALcyProperties)
protected ILcyActiveSettable createActiveSettable(int aActiveSettableID, ALcyProperties aProperties)
ALcyGUIFactory
Creates an ILcyActiveSettable
for the given ID.
Note: if the active settable should be inserted in the configured action bars, the ID_KEY of
the returned active settable must be set (see TLcyActionBarUtil.ID_KEY
).
createActiveSettable
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aActiveSettableID
- the ID describing which active settable to create. This is normally a
constant that ends with ACTIVE_SETTABLE
.aProperties
- a properties object that can be used to tune the behavior of this
factory.ILcyActiveSettable
, or null
.protected Component createComponent(int aComponentID, ALcyProperties aProperties)
ALcyGUIFactory
Creates a widget for the given ID. It is safe to use the ALcyGUIFactory.getAction(int)
and ALcyGUIFactory.getActiveSettable(int)
methods in this method, to build widgets that use an action or active
settable.
These widgets might interact with the given properties object, to retrieve or store some state. Such a widget could for example be a check box whose 'selected' state is synchronized with some property.
createComponent
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aComponentID
- the ID describing which component to create. This is normally a constant
that ends with COMPONENT
.aProperties
- a properties object that can be used to tune the behavior of this factory.
state.java.awt.Component
, or null.protected Component createPanel(int aPanelID, ALcyProperties aProperties)
ALcyGUIFactory
Creates a panel for the given ID. It is safe to use ALcyGUIFactory.getComponent(int)
in this method, to
build panels that are composed of components.
An example implementation could be:
protected Component createPanel( int aPanelID, ALcyProperties aProperties ) {
if ( aPanelID == SOME_PANEL ) {
JPanel content = new JPanel( new BorderLayout() );
Component someComponent = getComponent( SOME_COMPONENT );
if ( someComponent != null ) content.add( someComponent, BorderLayout.NORTH );
Component otherComponent = getComponent( OTHER_COMPONENT );
if ( otherComponent != null ) content.add( otherComponent, BorderLayout.CENTER );
return content;
}
else if ( aPanelID == ... ) {
...
}
}
createPanel
in class ALcyGUIFactory<TLcyLspMapLayerControl>
aPanelID
- the ID describing which panel to create. This is normally a constant that
ends with PANEL
.aProperties
- a properties object that can be used to tune the behavior of this factory.java.awt.Component
, or null.protected TransferHandler createTransferHandler(int aTransferHandlerID, ALcyProperties aProperties)
TransferHandler
for the given ID.aTransferHandlerID
- the ID describing which transfer handler to create. This is normally
a constant that ends with TRANSFER_HANDLER
.aProperties
- a properties object that can be used to tune the behavior of this
factory.TransferHandler
, or null
.protected TransferHandler getTransferHandler(int aTransferHandlerID)
Returns the TransferHandler
for the given ID.
Please refer to setup(com.luciad.lucy.util.properties.ALcyProperties)
to know when
this method can be used.
aTransferHandlerID
- the id describing which transfer handler to return. This is normally
a constant that ends in TRANSFER_HANDLER
.TransferHandler
for the given ID.protected ILcdIntList getTransferHandlerIDs()
Returns the list with all transfer handler IDs.
By default, this list only contains the IDs defined in this class. Adding and/or removing transfer handler IDs to/from this factory is achieved by altering this list.
Warning: do not alter the list when the factory is creating the GUI. Only modify it before
or after the ALcyGUIFactory.createGUI(com.luciad.lucy.util.properties.ALcyProperties)
method.
protected TLcyLspMapLayerControl getMapLayerControl()
Returns the map layer control under construction.
null
.protected ILcyLspMapComponent getMapComponent(ALcyProperties aProperties)
Convenience method to retrieve the map component from aProperties
. The map
component should be stored with key MAP_COMPONENT_PROPERTY_NAME
.
An exception is thrown when the map component could not be retrieved from the properties.
aProperties
- the properties containing the map component.null
.