Class TLcyContourGUIFactory

java.lang.Object
com.luciad.lucy.gui.ALcyGUIFactory<Component>
com.luciad.lucy.addons.tea.contour.TLcyContourGUIFactory

public class TLcyContourGUIFactory extends ALcyGUIFactory<Component>
Determines the GUI elements to add to the contour application pane. The GUI elements can read and write their run-time state from the properties that the factory has been initialized with.

Each GUI element can be replaced by overriding the respective create* method to return a custom element for the respective GUI ID. For example, to change the functionality of the layer update action, override the createAction(int, com.luciad.lucy.util.properties.ALcyProperties) method to return a custom action for the UPDATE_LAYER_ACTION ID.

Similarly, one can override the createGUIContent method to produce a customized layout for the GUI elements.

See Also:
  • Field Details

  • Constructor Details

    • TLcyContourGUIFactory

      public TLcyContourGUIFactory(ILcyLucyEnv aLucyEnv)
      Default constructor that builds all actions, component and panels.
      Parameters:
      aLucyEnv - the Lucy environment in which the GUI will be built
  • Method Details

    • createGUIContent

      protected Component createGUIContent(ALcyProperties aProperties)

      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;
        }
       

      Specified by:
      createGUIContent in class ALcyGUIFactory<Component>
      Parameters:
      aProperties - properties that define the default preferences and values of the GUI elements. The properties are also changed by the GUI elements, according to the property names defined in TLcyContourAddOn.
      Returns:
      the component containing all panels, layed out appropriately.
    • createAction

      protected ILcdAction createAction(int aID, ALcyProperties aProperties)
      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 class ALcyGUIFactory<Component>
      Parameters:
      aID - 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.
      Returns:
      the newly created ILcdAction, or null.
      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 class ALcyGUIFactory<Component>
      Parameters:
      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.
      Returns:
      the newly created ILcyActiveSettable, or null.
    • createComponent

      protected Component createComponent(int aID, ALcyProperties aProperties)
      Description copied from class: 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.

      Specified by:
      createComponent in class ALcyGUIFactory<Component>
      Parameters:
      aID - 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.
      Returns:
      the newly created java.awt.Component, or null.
    • createPanel

      protected Component createPanel(int aID, ALcyProperties aProperties)
      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 class ALcyGUIFactory<Component>
      Parameters:
      aID - 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.
      Returns:
      the newly created java.awt.Component, or null.