Class TLcyCompositeCustomizerTabbedPane

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTabbedPane
com.luciad.lucy.gui.customizer.TLcyCompositeCustomizerTabbedPane
All Implemented Interfaces:
ILcdUndoableSource, ILcyCompositeCustomizerPanel, ILcyCustomizerPanel, ILcdPropertyChangeSource, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class TLcyCompositeCustomizerTabbedPane extends JTabbedPane implements ILcyCompositeCustomizerPanel

Composite implementation of ILcyCustomizerPanel that uses a JTabbedPane. This class is very similar to TLcyCompositeCustomizerPanel, the only difference is that it uses a tabbed pane to represent every child ILcyCustomizerPanel in a tab. Children must be added using addCustomizerPanel. The title, icon and tooltip of the tab are the name, small icon and short description of the ILcyCustomizerPanel. The tabs need to be added before any object is set. A typical usage could be:


  ILcyCustomizerPanel cust1 = ...;
  ILcyCustomizerPanel cust2 = ...;

  TLcyCompositeCustomizerTabbedPane composite = new TLcyCompositeCustomizerTabbedPane();
  composite.addCustomizerPanel( cust1 );
  composite.addCustomizerPanel( cust2 );
 

When an object is set, it is simply set to all child customizer panels. If needed, setObject can be overridden to retrieve some sub-object from the set object and pass that on to the children. E.g., if a TLcdGXYLayer is set to the composite customizer, it might be needed to set the TLcdGXYLayer.getGXYPainterProvider object to one of the child customizer panels.

See Also:
  • Constructor Details

    • TLcyCompositeCustomizerTabbedPane

      public TLcyCompositeCustomizerTabbedPane()
      Creates a new TLcyCompositeCustomizerTabbedPane. Child ILcyCustomizerPanels need to be added before it can be used.
    • TLcyCompositeCustomizerTabbedPane

      public TLcyCompositeCustomizerTabbedPane(String aName)
      Creates a new TLcyCompositeCustomizerTabbedPane. Child ILcyCustomizerPanels need to be added before it can be used.
      Parameters:
      aName - The name for the customizer, see ILcyCustomizerPanel.NAME.
  • Method Details

    • addUndoableListener

      public void addUndoableListener(ILcdUndoableListener aUndoableListener)
      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 interface ILcdUndoableSource
      Parameters:
      aUndoableListener - The listener to be notified when something undoable has happened.
    • removeUndoableListener

      public void removeUndoableListener(ILcdUndoableListener aUndoableListener)
      Description copied from interface: ILcdUndoableSource
      Removes the specified listener so it is no longer notified.
      Specified by:
      removeUndoableListener in interface ILcdUndoableSource
      Parameters:
      aUndoableListener - The listener to remove.
    • fireUndoableHappened

      protected void fireUndoableHappened(ILcdUndoable aUndoable)
      Fires the given ILcdUndoable to all associated ILcdUndoableListeners.
      Parameters:
      aUndoable - The ILcdUndoable to fire.
    • getValue

      public Object getValue(String aKey)
      Description copied from interface: ILcyCustomizerPanel
      Gets the property value for the given key.
      Specified by:
      getValue in interface ILcyCustomizerPanel
      Parameters:
      aKey - The key to retrieve the value for.
      Returns:
      the property value for the given key.
      See Also:
    • putValue

      public void putValue(String aKey, Object aValue)
      Description copied from interface: ILcyCustomizerPanel
      Sets the property value for aKey to aValue. If the value has changed, a PropertyChangeEvent is sent to the listeners. The property name of the event equals the value of aKey.
      Specified by:
      putValue in interface ILcyCustomizerPanel
      Parameters:
      aKey - The key. Should preferably start with an uppercase letter to avoid confusion with regular properties.
      aValue - The value.
      See Also:
    • addCustomizerPanel

      public void addCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel)

      Adds the given ILcyCustomizerPanel to this composite implementation.

      Note that all children must be added before this ILcyCompositeCustomizerPanel is used.

      The given panel is automatically added as a tab to this tabbed pane. The title, icon and tooltip of the tab are the name, small icon and short description of the ILcyCustomizerPanel.

      Specified by:
      addCustomizerPanel in interface ILcyCompositeCustomizerPanel
      Parameters:
      aCustomizerPanel - The ILcyCustomizerPanel to add.
      See Also:
    • addCustomizerPanel

      public void addCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel, int aIndex)
      Description copied from interface: ILcyCompositeCustomizerPanel

      Inserts the given ILcyCustomizerPanel into this composite implementation, at the given index. The panels with an index greater than the given index are shifted to a higher index, to make room for the new panel.

      Note that all children must be added before this ILcyCompositeCustomizerPanel is used.

      Specified by:
      addCustomizerPanel in interface ILcyCompositeCustomizerPanel
      Parameters:
      aCustomizerPanel - The ILcyCustomizerPanel to add.
      aIndex - The index to insert the ILcyCustomizerPanel at. 0 <= aIndex <= getCustomizerPanels().size(). If aIndex == getCustomizerPanels().size(), the panel is added at the end.
      See Also:
    • removeCustomizerPanel

      public void removeCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel)

      Removes the given ILcyCustomizerPanel.

      Note that all children must not be changed after this ILcyCompositeCustomizerPanel is used.

      The tab is also removed.

      Specified by:
      removeCustomizerPanel in interface ILcyCompositeCustomizerPanel
      Parameters:
      aCustomizerPanel - The ILcyCustomizerPanel to remove.
      See Also:
    • getCustomizerPanels

      public List<ILcyCustomizerPanel> getCustomizerPanels()
      Description copied from interface: ILcyCompositeCustomizerPanel
      Returns the associated ILcyCustomizerPanels as an (unmodifiable) java.util.List.
      Specified by:
      getCustomizerPanels in interface ILcyCompositeCustomizerPanel
      Returns:
      the associated ILcyCustomizerPanels as an (unmodifiable) java.util.List.
    • isChangesPending

      public boolean isChangesPending()
      Description copied from interface: ILcyCustomizerPanel
      Returns true if changes are pending. A change is a modification made by the user, e.g., the modified content of a text field. Pending means the method applyChanges was not invoked after the change occurred.

      A property change event "changesPending" must be fired if the return value of this method is changed. This can for example be used to enable/disable an apply button.

      Specified by:
      isChangesPending in interface ILcyCustomizerPanel
      Returns:
      true if there are pending changes, false otherwise.
    • canSetObject

      public boolean canSetObject(Object aObject)
      Description copied from interface: ILcyCustomizerPanel
      Returns true if and only if setObject would not throw an IllegalArgumentException.
      Specified by:
      canSetObject in interface ILcyCustomizerPanel
      Parameters:
      aObject - The object to check.
      Returns:
      true if setObject would accept the object, false if it would throw an exception.
    • setObject

      public void setObject(Object aObject)
      Description copied from interface: ILcyCustomizerPanel
      Set the object to be edited. This method should be called before the ILcyCustomizerPanel has been added to any parent AWT container. It can be called afterwards as well however. In this case the user interface should update itself to represent the newly set object.

      A value of null is set to inform this ILcyCustomizerPanel to (temporarily) deinitialize itself, it allows to perform cleanup tasks, such as removing listeners.

      Specified by:
      setObject in interface ILcyCustomizerPanel
      Parameters:
      aObject - The object to be customized, or null to inform that editing is temporarily disabled.
    • getObject

      public Object getObject()
      Description copied from interface: ILcyCustomizerPanel
      Returns the object that was set using setObject. This can be null.
      Specified by:
      getObject in interface ILcyCustomizerPanel
      Returns:
      the object that was set using setObject.
      See Also:
    • isChangesValid

      public boolean isChangesValid()
      Description copied from interface: ILcyCustomizerPanel
      Returns true if the pending changes are valid, or if there are no pending changes. Returns false if there are invalid pending changes. A change is a modification made by the user, e.g., the modified content of a text field. Pending means the method applyChanges was not invoked after the change occurred.

      False could for example be returned if the user has entered invalid input that cannot be applied, such as text where a number is expected.

      A property change event "changesValid" must be fired if the return value of this method is changed. This can for example be used to enable/disable an apply button, or to inform the user that he must first correct the invalid content.

      Implementations can ignore this feature by always returning true.

      Specified by:
      isChangesValid in interface ILcyCustomizerPanel
      Returns:
      true if the changes can be applied, false otherwise.
    • applyChanges

      public boolean applyChanges()
      Description copied from interface: ILcyCustomizerPanel
      Updates the set Object according to the current state of the user interface. This means all pending changes are committed.

      If there were any pending changes, so isChangesPending returned true, it should return false after this method has finished, and therefore also a "changesPending" property change event must be fired.

      E.g. consider that a ILcdGXYLayer object is set and a new label text is entered in a text field. When this method is called, the new label text should be set to the ILcdGXYLayer (using ILcdGXYLayer.setLabel).

      Specified by:
      applyChanges in interface ILcyCustomizerPanel
      Returns:
      True if the changes were applied or if there were no changes, false if the changes could not be applied because they are invalid. In that event, isChangesValid returns false.
    • cancelChanges

      public void cancelChanges()
      Description copied from interface: ILcyCustomizerPanel
      Updates the user interface state according to the current state of the set Object. Any changes that were made in the user interface but were not yet applied, should be discarded.

      E.g. consider that an ILcdGXYLayer is being edited and a new label text was entered in a text field. When this method is called, the new label text should be cleared and the current label of the ILcdGXYLayer should be put in the text field (ILcdGXYLayer.getLabel()).

      Specified by:
      cancelChanges in interface ILcyCustomizerPanel