Class TLcyGXYAsynchronousLayerCustomizerPanel
- All Implemented Interfaces:
ILcdUndoableSource
,ILcyCustomizerPanel
,ILcdPropertyChangeSource
,ImageObserver
,MenuContainer
,Serializable
,Accessible
For LayerContexts, the calls are delegated using a safe layer context, as determined by
ALcyAsynchronousPaintFacade.invokeNowOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
for canSetObject(java.lang.Object)
and
ALcyAsynchronousPaintFacade.invokeNowOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
for applyChanges()
and setObject(java.lang.Object)
.
For ModelContexts, DomainObjectContexts and ModelEncoderContexts,
the calls are delegated with read-write model locks.
Any produced layer-related and model-related undoables are also safe to use.
Please note that once setObject(java.lang.Object)
has exited, it is _not_ safe to use the layer
until applyChanges()
is called: asynchronous painting is allowed to continue while
the customizer panel is visible.
- 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
ConstructorDescriptionTLcyGXYAsynchronousLayerCustomizerPanel
(ILcyLucyEnv aLucyEnv, ILcyCustomizerPanel aPanel) Creates a new wrapper panel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.void
addPropertyChangeListener
(String aPropertyName, PropertyChangeListener aListener) Adds the given listener for the specific property with nameaPropertyName
.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
.Returns the object that was set usingsetObject
.Returns an array of all thePropertyChangeListener
s registered on thisILcyCustomizerPanel
.getPropertyChangeListeners
(String aPropertyName) Returns an array of all thePropertyChangeListener
s registered foraPropertyName
.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
De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
removePropertyChangeListener
(String aPropertyName, PropertyChangeListener aListener) Removes the givenPropertyChangeListener
for the specific propertyaPropertyName
.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, 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, 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, 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, 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
-
Constructor Details
-
TLcyGXYAsynchronousLayerCustomizerPanel
Creates a new wrapper panel. All calls are delegated. If calls to setObject, canSetObject and applyChanges apply to an ILcdGXYLayer or ILcdModel, they are either delegated using a safe layer context or surrounded with read-write locks.- Parameters:
aLucyEnv
- the Lucy environmentaPanel
- a panel to wrap. Must be an instance of java.awt.Component
-
-
Method Details
-
getWrappedPanel
-
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
-
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.
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
Registers the given
PropertyChangeListener
to be notified when this object's properties change.In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakPropertyChangeListener
instance as property change listener.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
aListener
- The listener to be notified- See Also:
-
addPropertyChangeListener
Description copied from interface:ILcyCustomizerPanel
Adds the given listener for the specific property with name
aPropertyName
.Property change events will be fired for the Bean properties of this class, as well for changes in the key-value pairs of this class (see
ILcyCustomizerPanel.putValue(String, Object)
).- Specified by:
addPropertyChangeListener
in interfaceILcyCustomizerPanel
- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
aPropertyName
- The property name for whichaListener
will receive events.aListener
- The listener. It only receives events for the given property name.- See Also:
-
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:
-
getPropertyChangeListeners
Description copied from interface:ILcyCustomizerPanel
Returns an array of all thePropertyChangeListener
s registered on thisILcyCustomizerPanel
.- Specified by:
getPropertyChangeListeners
in interfaceILcyCustomizerPanel
- Overrides:
getPropertyChangeListeners
in classComponent
- Returns:
- an array of all the
PropertyChangeListener
s registered on thisILcyCustomizerPanel
, or an empty array if noPropertyChangeListener
s are currently registered.
-
getPropertyChangeListeners
Description copied from interface:ILcyCustomizerPanel
Returns an array of all thePropertyChangeListener
s registered foraPropertyName
.- Specified by:
getPropertyChangeListeners
in interfaceILcyCustomizerPanel
- Overrides:
getPropertyChangeListeners
in classComponent
- Parameters:
aPropertyName
- The property name to retrieve the listeners for.- Returns:
- an array of all the
PropertyChangeListener
s registered foraPropertyName
, or an empty array if no listeners are registered for that property.
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
De-registers the given
PropertyChangeListener
from receiving property change events for this object.If the listener was added more than once, it will be notified one less time after being removed. If the listener is
null
, or was never added, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Overrides:
removePropertyChangeListener
in classComponent
- Parameters:
aListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcyCustomizerPanel
Removes the givenPropertyChangeListener
for the specific propertyaPropertyName
. This method should be used to removePropertyChangeListener
s that were registered for a specific property name.- Specified by:
removePropertyChangeListener
in interfaceILcyCustomizerPanel
- Overrides:
removePropertyChangeListener
in classComponent
- Parameters:
aPropertyName
- The property name.aListener
- The listener.- See Also:
-
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.
-
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:
-
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.
-
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.
-
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:
-
getPreferredSize
- Overrides:
getPreferredSize
in classJComponent
-