Class TLcyKML22GUIFactory
The main GUI Factory for the TLcyKML22AddOn
. This GUI Factory creates the panel
for the KML content tree. This factory was designed so that it is
easy to modify small parts of the creation process. This can be done by subclassing this class and
overriding certain methods. The TLcyKML22GUIFactory
creates the following for the KML model
content tree:
- A JTree
- A TreeModel
- A TreeCellRenderer
- A panel containing the KML model content tree
It uses the concept of an ALcyGUIFactory
, allowing the users
of this class to modify almost every part of the creation process.
The created tree makes use of TLcyKML22TreeModelObject as its domain object.
- Since:
- 10.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The ID for the panel of the KML content tree, used by the createPanel(int, com.luciad.lucy.util.properties.ALcyProperties) method.static final String
A constant that is used to retrieve a map component from aALcyProperties
instance.static final int
The ID for KML content tree, used by the createTree(int, com.luciad.lucy.util.properties.ALcyProperties) method.static final int
The ID for the cell renderer of the KML content tree, used by the createTreeCellRenderer(int, com.luciad.lucy.util.properties.ALcyProperties) method.static final int
The ID for the model of the KML content tree, used by the createTreeModel(int, ALcyProperties) method. -
Constructor Summary
ConstructorDescriptionTLcyKML22GUIFactory
(ILcyLucyEnv aLucyEnv) Creates a new GUI factory with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
cleanup
(ALcyProperties aProperties) Performs cleanup operations, such as nullifying fields that are no longer needed.protected ILcdAction
createAction
(int aActionID, ALcyProperties aProperties) Creates anILcdAction
for the given ID.protected ILcyActiveSettable
createActiveSettable
(int aActiveSettableID, ALcyProperties aProperties) Creates anILcyActiveSettable
for the given ID.protected Component
createComponent
(int aComponentID, ALcyProperties aProperties) Creates a widget for the given ID.protected Component
createGUIContent
(ALcyProperties aProperties) Retrieves all panels and lays them out in ajava.awt.Component
.protected Component
createPanel
(int aPanelID, ALcyProperties aProperties) Creates a panel for the given ID.protected JTree
createTree
(int aTreeID, ALcyProperties aProperties) Creates the tree corresponding to the IDaTreeID
.protected TreeCellRenderer
createTreeCellRenderer
(int aTreeCellRendererID, ALcyProperties aProperties) Creates the tree cell renderer corresponding to the IDaTreeCellRendererID
.protected TreeModel
createTreeModel
(int aTreeModelID, ALcyProperties aProperties) Creates the tree model corresponding to the IDaTreeModelID
.protected JTree
getTree
(int aTreeID) Returns theJTree
for the given ID.protected TreeCellRenderer
getTreeCellRenderer
(int aTreeCellRendererID) Returns theTreeCellRenderer
for the given ID.Returns the tree cell renderer ID of the model content tree.Returns the tree ID of the model content tree.protected TreeModel
getTreeModel
(int aTreeModelID) Returns theTreeModel
for the given ID.Returns the tree model ID of the model content tree.protected void
setup
(ALcyProperties aProperties) Sets up the KML content tree based on the given parameters.Methods inherited from class com.luciad.lucy.gui.ALcyGUIFactory
createGUI, getAction, getActionContext, getActionIDs, getActiveSettable, getActiveSettableContext, getActiveSettableIDs, getComponent, getComponentIDs, getLucyEnv, getPanel, getPanelIDs, isActiveSettableDeactivatePossible
-
Field Details
-
MAP_COMPONENT_KEY
A constant that is used to retrieve a map component from a
ALcyProperties
instance. This constant is used by the getMapComponent(ALcyProperties aProperties) method to retrieve a map component from its given property object.The
ALcyProperties
instance passed to this factory will contain the map component for which the model content tree must be created. This key can be used to retrieve that map component.The corresponding value may be null
- See Also:
-
MODEL_CONTENT_TREE
public static final int MODEL_CONTENT_TREEThe ID for KML content tree, used by the createTree(int, com.luciad.lucy.util.properties.ALcyProperties) method.- See Also:
-
MODEL_CONTENT_TREE_MODEL
public static final int MODEL_CONTENT_TREE_MODELThe ID for the model of the KML content tree, used by the createTreeModel(int, ALcyProperties) method.
The model is completely self-sufficient in the sense that it keeps itself up to date based on
ILcdLayered
events andILcdModel
events. TheTreeModel
makes exclusive use of TLcyKML22TreeModelObject instances to model its children. ATLcyKML22TreeModelObject
contains the following:- The domain object (or
TLcdKML22DynamicModel
in the case of containers) - A reference to the model that contains the domain object
- A reference to the layer that contains the model
- A reference to the view that contains the layer
Only the root element contains null for all of the above
- See Also:
- The domain object (or
-
MODEL_CONTENT_TREE_CELL_RENDERER
public static final int MODEL_CONTENT_TREE_CELL_RENDERERThe ID for the cell renderer of the KML content tree, used by the createTreeCellRenderer(int, com.luciad.lucy.util.properties.ALcyProperties) method.
The tree cell renderer expects its objects to be instances of
TLcyKML22TreeModelObject
. It will create check-boxes to manipulate the visibility of an element. It will also create an icon, a name and a description for each element.- See Also:
-
CENTER_PANEL
public static final int CENTER_PANELThe ID for the panel of the KML content tree, used by the createPanel(int, com.luciad.lucy.util.properties.ALcyProperties) method.
The panel is a
JPanel
with aJScrollPane
and the tree, obtained by calling the createTree(int, com.luciad.lucy.util.properties.ALcyProperties) method with theMODEL_CONTENT_TREE
ID.- See Also:
-
-
Constructor Details
-
TLcyKML22GUIFactory
Creates a new GUI factory with the given parameters. This default constructor builds all actions, component and panels.
- Parameters:
aLucyEnv
- an instance of ILcyLucyEnv
-
-
Method Details
-
setup
Sets up the KML content tree based on the given parameters. The model content tree will be set up in the following order:
- Creation and setup of the model of the KML content tree.
- Creation and setup of the cell renderer of the KML content tree.
- Creation and setup of the KML content
JTree
itself.
- Overrides:
setup
in classALcyGUIFactory<Component>
- Parameters:
aProperties
- a properties object that can be used to tune the behavior of this factory.
-
createGUIContent
Description copied from class:ALcyGUIFactory
Retrieves all panels and lays them out in a
java.awt.Component
. Therefore, this method usesALcyGUIFactory.getPanel(int)
with all ID's that end inPANEL
, and lays out those components in for example ajavax.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; }
- Specified by:
createGUIContent
in classALcyGUIFactory<Component>
- Parameters:
aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the component containing all panels, layed out appropriately.
-
createPanel
Description copied from class: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 == ... ) { ... } }
- Specified by:
createPanel
in classALcyGUIFactory<Component>
- Parameters:
aPanelID
- the ID describing which panel to create. This is normally a constant that ends withPANEL
.aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the newly created
java.awt.Component
, or null.
-
createTree
Creates the tree corresponding to the IDaTreeID
. May returnnull
.- Parameters:
aTreeID
- the ID of the tree. This is typically a constant ending inTREE
.aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the tree corresponding to the ID
aTreeID
. May benull
.
-
createTreeModel
Creates the tree model corresponding to the IDaTreeModelID
. May returnnull
.- Parameters:
aTreeModelID
- the ID of the tree model. This is typically a constant ending inTREE_MODEL
.aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the tree model corresponding to the ID
aTreeModelID
. May benull
.
-
createTreeCellRenderer
protected TreeCellRenderer createTreeCellRenderer(int aTreeCellRendererID, ALcyProperties aProperties) Creates the tree cell renderer corresponding to the IDaTreeCellRendererID
. May returnnull
.- Parameters:
aTreeCellRendererID
- the ID of the tree cell renderer. This is typically a constant ending inTREE_CELL_RENDERER
.aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the tree cell renderer corresponding to the ID
aTreeCellRendererID
. May benull
.
-
getTreeIDs
Returns the tree ID of the model content tree.- Returns:
- the tree ID of the model content tree.
-
getTreeModelIDs
Returns the tree model ID of the model content tree.- Returns:
- the tree model ID of the model content tree.
-
getTreeCellRendererIDs
Returns the tree cell renderer ID of the model content tree.- Returns:
- the tree cell renderer ID of the model content tree.
-
getTreeModel
Returns the
TreeModel
for the given ID.Please refer to
setup
to know when this method can be used.- Parameters:
aTreeModelID
- the id describing whichTreeModel
to return. This is usually a constant that ends inTREE_MODEL
.- Returns:
- the
TreeModel
for the given ID.
-
getTreeCellRenderer
Returns the
TreeCellRenderer
for the given ID.Please refer to
setup
to know when this method can be used.- Parameters:
aTreeCellRendererID
- the id describing whichTreeCellRenderer
to return. This is normally a constant that ends inTREE_CELL_RENDERER
.- Returns:
- the
TreeCellRenderer
for the given ID.
-
getTree
Returns the
JTree
for the given ID.Please refer to
setup
to know when this method can be used.- Parameters:
aTreeID
- the id describing whichJTree
to return. This is normally a constant that ends inTREE
.- Returns:
- the
JTree
for the given ID.
-
createAction
Description copied from class: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
).- Specified by:
createAction
in classALcyGUIFactory<Component>
- Parameters:
aActionID
- the ID describing which action to create. This is normally a constant that ends withACTION
.aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the newly created
ILcdAction
, ornull
. - See Also:
-
createActiveSettable
protected ILcyActiveSettable createActiveSettable(int aActiveSettableID, ALcyProperties aProperties) Description copied from class: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
).- Specified by:
createActiveSettable
in classALcyGUIFactory<Component>
- Parameters:
aActiveSettableID
- the ID describing which active settable to create. This is normally a constant that ends withACTIVE_SETTABLE
.aProperties
- a properties object that can be used to tune the behavior of this factory.- Returns:
- the newly created
ILcyActiveSettable
, ornull
.
-
createComponent
Description copied from class:ALcyGUIFactory
Creates a widget for the given ID. It is safe to use the
ALcyGUIFactory.getAction(int)
andALcyGUIFactory.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.
- Specified by:
createComponent
in classALcyGUIFactory<Component>
- Parameters:
aComponentID
- the ID describing which component to create. This is normally a constant that ends withCOMPONENT
.aProperties
- a properties object that can be used to tune the behavior of this factory. state.- Returns:
- the newly created
java.awt.Component
, or null.
-
cleanup
Description copied from class:ALcyGUIFactory
Performs cleanup operations, such as nullifying fields that are no longer needed.
Warning: Should not be overridden without calling the super function.
- Overrides:
cleanup
in classALcyGUIFactory<Component>
- Parameters:
aProperties
- a properties object that can be used to tune the behavior of this factory.
-