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.
JTabbedPane.AccessibleJTabbedPane, JTabbedPane.ModelListener
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
HINT_PINNED, HORIZONTAL_ALIGNMENT_HINT, LONG_DESCRIPTION, NAME, SHORT_DESCRIPTION, SMALL_ICON
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TLcyCompositeCustomizerTabbedPane()
Creates a new
TLcyCompositeCustomizerTabbedPane . |
TLcyCompositeCustomizerTabbedPane(String aName)
Creates a new
TLcyCompositeCustomizerTabbedPane . |
Modifier and Type | Method and Description |
---|---|
void |
addCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel)
Adds the given
ILcyCustomizerPanel to this composite implementation. |
void |
addCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel,
int aIndex)
Inserts the given
ILcyCustomizerPanel into this composite implementation, at
the given index. |
void |
addUndoableListener(ILcdUndoableListener aUndoableListener)
Adds a listener to this source, so this listener is notified when something undoable has
happened.
|
boolean |
applyChanges()
Updates the set
Object according to the current state of the user interface. |
void |
cancelChanges()
Updates the user interface state according to the current state of the set
Object . |
boolean |
canSetObject(Object aObject)
Returns
true if and only if setObject would not throw an
IllegalArgumentException . |
protected void |
fireUndoableHappened(ILcdUndoable aUndoable)
Fires the given
ILcdUndoable to all associated ILcdUndoableListener s. |
List<ILcyCustomizerPanel> |
getCustomizerPanels()
Returns the associated
ILcyCustomizerPanel s as an (unmodifiable) java.util.List. |
Object |
getObject()
Returns the object that was set using
setObject . |
Object |
getValue(String aKey)
Gets the property value for the given key.
|
boolean |
isChangesPending()
Returns
true if changes are pending. |
boolean |
isChangesValid()
Returns
true if the pending changes are valid, or if there are no pending changes. |
void |
putValue(String aKey,
Object aValue)
Sets the property value for
aKey to aValue . |
void |
removeCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel)
Removes the given
ILcyCustomizerPanel . |
void |
removeUndoableListener(ILcdUndoableListener aUndoableListener)
Removes the specified listener so it is no longer notified.
|
void |
setObject(Object aObject)
Set the object to be edited.
|
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, fireStateChanged, getAccessibleContext, getBackgroundAt, getBoundsAt, getChangeListeners, getComponentAt, getDisabledIconAt, getDisplayedMnemonicIndexAt, getForegroundAt, getIconAt, getMnemonicAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getTitleAt, getToolTipText, getToolTipTextAt, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, insertTab, isEnabledAt, paramString, remove, remove, removeAll, removeChangeListener, removeTabAt, setBackgroundAt, setComponentAt, setDisabledIconAt, setDisplayedMnemonicIndexAt, setEnabledAt, setForegroundAt, setIconAt, setMnemonicAt, setModel, setSelectedComponent, setSelectedIndex, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, setTitleAt, setToolTipTextAt, setUI, updateUI
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, 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
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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
addPropertyChangeListener, removePropertyChangeListener
public TLcyCompositeCustomizerTabbedPane()
TLcyCompositeCustomizerTabbedPane
. Child ILcyCustomizerPanel
s
need to be added before it can be used.public TLcyCompositeCustomizerTabbedPane(String aName)
TLcyCompositeCustomizerTabbedPane
. Child ILcyCustomizerPanel
s
need to be added before it can be used.aName
- The name for the customizer, see ILcyCustomizerPanel.NAME
.public void addUndoableListener(ILcdUndoableListener aUndoableListener)
ILcdUndoableSource
addUndoableListener
in interface ILcdUndoableSource
aUndoableListener
- The listener to be notified when something undoable has happened.public void removeUndoableListener(ILcdUndoableListener aUndoableListener)
ILcdUndoableSource
removeUndoableListener
in interface ILcdUndoableSource
aUndoableListener
- The listener to remove.protected void fireUndoableHappened(ILcdUndoable aUndoable)
ILcdUndoable
to all associated ILcdUndoableListener
s.aUndoable
- The ILcdUndoable
to fire.public Object getValue(String aKey)
ILcyCustomizerPanel
getValue
in interface ILcyCustomizerPanel
aKey
- The key to retrieve the value for.ILcyCustomizerPanel.putValue(java.lang.String, java.lang.Object)
public void putValue(String aKey, Object aValue)
ILcyCustomizerPanel
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
.putValue
in interface ILcyCustomizerPanel
aKey
- The key. Should preferably start with an uppercase letter to avoid confusion with regular properties.aValue
- The value.ILcyCustomizerPanel.getValue(java.lang.String)
,
ILcyCustomizerPanel.NAME
,
ILcyCustomizerPanel.SMALL_ICON
,
ILcyCustomizerPanel.SHORT_DESCRIPTION
,
ILcyCustomizerPanel.LONG_DESCRIPTION
,
ILcyCustomizerPanel.HINT_PINNED
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
.
addCustomizerPanel
in interface ILcyCompositeCustomizerPanel
aCustomizerPanel
- The ILcyCustomizerPanel
to add.ILcyCompositeCustomizerPanel.removeCustomizerPanel(ILcyCustomizerPanel)
public void addCustomizerPanel(ILcyCustomizerPanel aCustomizerPanel, int aIndex)
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.
addCustomizerPanel
in interface ILcyCompositeCustomizerPanel
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.ILcyCompositeCustomizerPanel.removeCustomizerPanel(ILcyCustomizerPanel)
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.
removeCustomizerPanel
in interface ILcyCompositeCustomizerPanel
aCustomizerPanel
- The ILcyCustomizerPanel
to remove.ILcyCompositeCustomizerPanel.addCustomizerPanel(ILcyCustomizerPanel)
public List<ILcyCustomizerPanel> getCustomizerPanels()
ILcyCompositeCustomizerPanel
ILcyCustomizerPanel
s as an (unmodifiable) java.util.List.getCustomizerPanels
in interface ILcyCompositeCustomizerPanel
ILcyCustomizerPanel
s as an (unmodifiable) java.util.List.public boolean isChangesPending()
ILcyCustomizerPanel
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.isChangesPending
in interface ILcyCustomizerPanel
true
if there are pending changes, false
otherwise.public boolean canSetObject(Object aObject)
ILcyCustomizerPanel
true
if and only if setObject
would not throw an
IllegalArgumentException
.canSetObject
in interface ILcyCustomizerPanel
aObject
- The object to check.true
if setObject
would accept the object, false
if it would throw an exception.public void setObject(Object aObject)
ILcyCustomizerPanel
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.setObject
in interface ILcyCustomizerPanel
aObject
- The object to be customized, or null
to inform that editing is temporarily disabled.public Object getObject()
ILcyCustomizerPanel
setObject
. This can be null
.getObject
in interface ILcyCustomizerPanel
setObject
.ILcyCustomizerPanel.setObject(Object)
public boolean isChangesValid()
ILcyCustomizerPanel
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
.isChangesValid
in interface ILcyCustomizerPanel
true
if the changes can be applied, false
otherwise.public boolean applyChanges()
ILcyCustomizerPanel
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
).applyChanges
in interface ILcyCustomizerPanel
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
.public void cancelChanges()
ILcyCustomizerPanel
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()
).cancelChanges
in interface ILcyCustomizerPanel