Class TLcyCompositeCustomizerPanel
- All Implemented Interfaces:
ILcdUndoableSource
,ILcyCompositeCustomizerPanel
,ILcyCustomizerPanel
,ILcdPropertyChangeSource
,ImageObserver
,MenuContainer
,Serializable
,Accessible
Composite implementation of ILcyCustomizerPanel
that uses a JPanel. It can be used
to combine several ILcyCustomizerPanel
s in one big ILcyCustomizerPanel
.
Every child ILcyCustomizerPanel
must be added using the method
addCustomizerPanel
, before this TLcyCompositeCustomizerPanel
is used.
A typical usage could be:
ILcyCustomizerPanel cust1 = ...;
ILcyCustomizerPanel cust2 = ...;
TLcyCompositeCustomizerPanel composite = new TLcyCompositeCustomizerPanel(
"MyCustomizer", new BorderLayout() );
composite.addCustomizerPanel( cust1, BorderLayout.NORTH );
composite.addCustomizerPanel( cust2, BorderLayout.SOUTH );
It might sometimes be convenient to put another Swing component in the hierarchy, not the child
ILcyCustomizerPanel
itself. For example to wrap the child customizers in a panel
that has a titled border before adding them to the composite. In that case, it is considered
the responsibility of the user of this class to add (and remove) the Swing component to the
hierarchy. So the above example becomes:
TLcyCompositeCustomizerPanel composite = new TLcyCompositeCustomizerPanel(
"MyCustomizer", new BorderLayout() );
composite.addCustomizerPanel( cust1, false );
composite.add( TLcyCommonWidgetFactory.getSharedInstance().createTitledPanel(
"MyTitle", ( Component ) cust1 ), BorderLayout.NORTH );
composite.addCustomizerPanel( cust2, false );
composite.add( TLcyCommonWidgetFactory.getSharedInstance().createTitledPanel(
"MyTitle", ( Component ) cust2 ), BorderLayout.SOUTH );
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface com.luciad.lucy.gui.customizer.ILcyCustomizerPanel
HINT_PINNED, HORIZONTAL_ALIGNMENT_HINT, LONG_DESCRIPTION, NAME, SHORT_DESCRIPTION, SMALL_ICON
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionCreates a newTLcyCompositeCustomizerPanel
.TLcyCompositeCustomizerPanel
(LayoutManager aLayoutManager) Creates a newTLcyCompositeCustomizerPanel
.Creates a newTLcyCompositeCustomizerPanel
.TLcyCompositeCustomizerPanel
(String aName, LayoutManager aLayoutManager) Creates a newTLcyCompositeCustomizerPanel
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel) Adds the givenILcyCustomizerPanel
to this composite implementation.void
addCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel, boolean aAddToGUI) Adds the givenILcyCustomizerPanel
to this composite implementation.void
addCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel, int aIndex) Inserts the givenILcyCustomizerPanel
into this composite implementation, at the given index.void
addCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel, int aIndex, boolean aAddToGUI) Adds the givenILcyCustomizerPanel
to this composite implementation.void
addCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel, Object aLayoutConstraints) Adds the givenILcyCustomizerPanel
to this composite implementation.void
addCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel, Object aLayoutConstraints, int aIndex) Adds the givenILcyCustomizerPanel
to this composite implementation.void
addUndoableListener
(ILcdUndoableListener aUndoableListener) Adds a listener to this source, so this listener is notified when something undoable has happened.boolean
Updates the setObject
according to the current state of the user interface.void
Updates the user interface state according to the current state of the setObject
.boolean
canSetObject
(Object aObject) Returnstrue
if and only ifsetObject
would not throw anIllegalArgumentException
.protected void
fireUndoableHappened
(ILcdUndoable aUndoable) Fires the givenILcdUndoable
to all associatedILcdUndoableListener
s.Returns the associatedILcyCustomizerPanel
s as an (unmodifiable) java.util.List.Returns the object that was set usingsetObject
.Gets the property value for the given key.boolean
Returnstrue
if changes are pending.boolean
Returnstrue
if the pending changes are valid, or if there are no pending changes.void
Sets the property value foraKey
toaValue
.void
removeCustomizerPanel
(ILcyCustomizerPanel aCustomizerPanel) Removes the givenILcyCustomizerPanel
from this composite.void
removeUndoableListener
(ILcdUndoableListener aUndoableListener) Removes the specified listener so it is no longer notified.void
Set the object to be edited.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.luciad.lucy.gui.customizer.ILcyCustomizerPanel
addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Constructor Details
-
TLcyCompositeCustomizerPanel
public TLcyCompositeCustomizerPanel()Creates a newTLcyCompositeCustomizerPanel
. ChildILcyCustomizerPanel
s need to be added before it can be used. -
TLcyCompositeCustomizerPanel
Creates a newTLcyCompositeCustomizerPanel
. ChildILcyCustomizerPanel
s need to be added before it can be used.- Parameters:
aLayoutManager
- The layout manager.
-
TLcyCompositeCustomizerPanel
Creates a newTLcyCompositeCustomizerPanel
. ChildILcyCustomizerPanel
s need to be added before it can be used.- Parameters:
aName
- The name for the customizer, seeILcyCustomizerPanel.NAME
.
-
TLcyCompositeCustomizerPanel
Creates a newTLcyCompositeCustomizerPanel
. ChildILcyCustomizerPanel
s need to be added before it can be used.- Parameters:
aName
- The name for the customizer, seeILcyCustomizerPanel.NAME
.aLayoutManager
- The layout manager.
-
-
Method Details
-
addCustomizerPanel
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 interfaceILcyCompositeCustomizerPanel
- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to add.- See Also:
-
addCustomizerPanel
Adds the givenILcyCustomizerPanel
to this composite implementation. The given panel might be added as a Swing component too, depending on the value ofaAddToGUI
. Note that all children must be added before thisTLcyCompositeCustomizerPanel
is used.- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to add.aAddToGUI
-true
ifaCustomizerPanel
should be added to Swing's component hierarchy as well.false
avoids adding the panel to the GUI, this is then considered the responsibility of the user of this method.- See Also:
-
addCustomizerPanel
Adds the givenILcyCustomizerPanel
to this composite implementation. The given panel might be added as a Swing component too, depending on the value ofaAddToGUI
. Note that all children must be added before thisTLcyCompositeCustomizerPanel
is used.- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to add.aIndex
- the position at which to insertaCustomizerPanel
. Use -1 orgetCustomizerPanelCount()
to insert at the end.aAddToGUI
-true
ifaCustomizerPanel
should be added to Swing's component hierarchy as well.false
avoids adding the panel to the GUI, this is then considered the responsibility of the user of this method.- See Also:
-
addCustomizerPanel
Adds the givenILcyCustomizerPanel
to this composite implementation. The given panel is also added as a Swing component with the given layout constraints. Note that all children must be added before thisTLcyCompositeCustomizerPanel
is used.- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to add.aLayoutConstraints
- the Swing layout contraints.- See Also:
-
addCustomizerPanel
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.The given panel is also added as a Swing component at the given index.
- Specified by:
addCustomizerPanel
in interfaceILcyCompositeCustomizerPanel
- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to add.aIndex
- The index to insert theILcyCustomizerPanel
at.0 <= aIndex <= getCustomizerPanels().size()
. IfaIndex == getCustomizerPanels().size()
, the panel is added at the end.- See Also:
-
addCustomizerPanel
public void addCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel, Object aLayoutConstraints, int aIndex) Adds the givenILcyCustomizerPanel
to this composite implementation. The given panel is also added as a Swing component with the given layout constraints and index. Note that all children must be added before thisTLcyCompositeCustomizerPanel
is used.- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to add.aLayoutConstraints
- the Swing layout constraints.aIndex
- the position at which to insertaCustomizerPanel
. Use -1 orgetCustomizerPanelCount()
to insert at the end.- See Also:
-
removeCustomizerPanel
Removes the givenILcyCustomizerPanel
from this composite. If it is part of the GUI, it is removed from the GUI as well.- Specified by:
removeCustomizerPanel
in interfaceILcyCompositeCustomizerPanel
- Parameters:
aCustomizerPanel
- TheILcyCustomizerPanel
to remove.- See Also:
-
getCustomizerPanels
Description copied from interface:ILcyCompositeCustomizerPanel
Returns the associatedILcyCustomizerPanel
s as an (unmodifiable) java.util.List.- Specified by:
getCustomizerPanels
in interfaceILcyCompositeCustomizerPanel
- Returns:
- the associated
ILcyCustomizerPanel
s as an (unmodifiable) java.util.List.
-
addUndoableListener
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 interfaceILcdUndoableSource
- Parameters:
aUndoableListener
- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSource
Removes the specified listener so it is no longer notified.- Specified by:
removeUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aUndoableListener
- The listener to remove.
-
fireUndoableHappened
Fires the givenILcdUndoable
to all associatedILcdUndoableListener
s.- Parameters:
aUndoable
- TheILcdUndoable
to fire.
-
getValue
Description copied from interface:ILcyCustomizerPanel
Gets the property value for the given key.- Specified by:
getValue
in interfaceILcyCustomizerPanel
- Parameters:
aKey
- The key to retrieve the value for.- Returns:
- the property value for the given key.
- See Also:
-
putValue
Description copied from interface:ILcyCustomizerPanel
Sets the property value foraKey
toaValue
. If the value has changed, aPropertyChangeEvent
is sent to the listeners. The property name of the event equals the value ofaKey
.- Specified by:
putValue
in interfaceILcyCustomizerPanel
- Parameters:
aKey
- The key. Should preferably start with an uppercase letter to avoid confusion with regular properties.aValue
- The value.- See Also:
-
isChangesPending
public boolean isChangesPending()Description copied from interface:ILcyCustomizerPanel
Returnstrue
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 methodapplyChanges
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 interfaceILcyCustomizerPanel
- Returns:
true
if there are pending changes,false
otherwise.
-
canSetObject
Description copied from interface:ILcyCustomizerPanel
Returnstrue
if and only ifsetObject
would not throw anIllegalArgumentException
.- Specified by:
canSetObject
in interfaceILcyCustomizerPanel
- Parameters:
aObject
- The object to check.- Returns:
true
ifsetObject
would accept the object,false
if it would throw an exception.
-
setObject
Description copied from interface:ILcyCustomizerPanel
Set the object to be edited. This method should be called before theILcyCustomizerPanel
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 ofnull
is set to inform thisILcyCustomizerPanel
to (temporarily) deinitialize itself, it allows to perform cleanup tasks, such as removing listeners.- Specified by:
setObject
in interfaceILcyCustomizerPanel
- Parameters:
aObject
- The object to be customized, ornull
to inform that editing is temporarily disabled.
-
getObject
Description copied from interface:ILcyCustomizerPanel
Returns the object that was set usingsetObject
. This can benull
.- Specified by:
getObject
in interfaceILcyCustomizerPanel
- Returns:
- the object that was set using
setObject
. - See Also:
-
isChangesValid
public boolean isChangesValid()Description copied from interface:ILcyCustomizerPanel
Returnstrue
if the pending changes are valid, or if there are no pending changes. Returnsfalse
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 methodapplyChanges
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 returningtrue
.- Specified by:
isChangesValid
in interfaceILcyCustomizerPanel
- Returns:
true
if the changes can be applied,false
otherwise.
-
applyChanges
public boolean applyChanges()Description copied from interface:ILcyCustomizerPanel
Updates the setObject
according to the current state of the user interface. This means all pending changes are committed. If there were any pending changes, soisChangesPending
returnedtrue
, it should returnfalse
after this method has finished, and therefore also a"changesPending"
property change event must be fired. E.g. consider that aILcdGXYLayer
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 theILcdGXYLayer
(usingILcdGXYLayer.setLabel
).- Specified by:
applyChanges
in interfaceILcyCustomizerPanel
- 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
returnsfalse
.
-
cancelChanges
public void cancelChanges()Description copied from interface:ILcyCustomizerPanel
Updates the user interface state according to the current state of the setObject
. Any changes that were made in the user interface but were not yet applied, should be discarded. E.g. consider that anILcdGXYLayer
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 theILcdGXYLayer
should be put in the text field (ILcdGXYLayer.getLabel()
).- Specified by:
cancelChanges
in interfaceILcyCustomizerPanel
-