public class TLcyGXYAsynchronousLayerCustomizerPanel extends JPanel implements ILcyCustomizerPanel
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.
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
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
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TLcyGXYAsynchronousLayerCustomizerPanel(ILcyLucyEnv aLucyEnv,
ILcyCustomizerPanel aPanel)
Creates a new wrapper panel.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aListener)
Registers the given
PropertyChangeListener to be notified when this object's
properties change. |
void |
addPropertyChangeListener(String aPropertyName,
PropertyChangeListener aListener)
Adds the given listener for the specific property with name
aPropertyName . |
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 . |
Object |
getObject()
Returns the object that was set using
setObject . |
Dimension |
getPreferredSize() |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the
PropertyChangeListener s registered on this
ILcyCustomizerPanel . |
PropertyChangeListener[] |
getPropertyChangeListeners(String aPropertyName)
Returns an array of all the
PropertyChangeListener s registered for aPropertyName . |
Object |
getValue(String aKey)
Gets the property value for the given key.
|
ILcyCustomizerPanel |
getWrappedPanel() |
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 |
removePropertyChangeListener(PropertyChangeListener aListener)
De-registers the given
PropertyChangeListener from receiving property change events
for this object. |
void |
removePropertyChangeListener(String aPropertyName,
PropertyChangeListener aListener)
Removes the given
PropertyChangeListener for the specific property aPropertyName . |
void |
removeUndoableListener(ILcdUndoableListener aUndoableListener)
Removes the specified listener so it is no longer notified.
|
void |
setObject(Object aObject)
Set the object to be edited.
|
getAccessibleContext, getUI, getUIClassID, paramString, 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, 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
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
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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public TLcyGXYAsynchronousLayerCustomizerPanel(ILcyLucyEnv aLucyEnv, ILcyCustomizerPanel aPanel)
aLucyEnv
- the Lucy environmentaPanel
- a panel to wrap. Must be an instance of java.awt.Componentpublic ILcyCustomizerPanel getWrappedPanel()
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
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 void addPropertyChangeListener(PropertyChangeListener aListener)
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.
addPropertyChangeListener
in interface ILcdPropertyChangeSource
addPropertyChangeListener
in class Container
aListener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void addPropertyChangeListener(String aPropertyName, PropertyChangeListener aListener)
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)
).
addPropertyChangeListener
in interface ILcyCustomizerPanel
addPropertyChangeListener
in class Container
aPropertyName
- The property name for which aListener
will receive events.aListener
- The listener. It only receives events for the given property name.ILcyCustomizerPanel.removePropertyChangeListener(String, java.beans.PropertyChangeListener)
,
ILcyCustomizerPanel.getPropertyChangeListeners(String)
public Object getObject()
ILcyCustomizerPanel
setObject
. This can be null
.getObject
in interface ILcyCustomizerPanel
setObject
.ILcyCustomizerPanel.setObject(Object)
public PropertyChangeListener[] getPropertyChangeListeners()
ILcyCustomizerPanel
PropertyChangeListener
s registered on this
ILcyCustomizerPanel
.getPropertyChangeListeners
in interface ILcyCustomizerPanel
getPropertyChangeListeners
in class Component
PropertyChangeListener
s registered on this
ILcyCustomizerPanel
, or an empty array if no PropertyChangeListener
s are
currently registered.public PropertyChangeListener[] getPropertyChangeListeners(String aPropertyName)
ILcyCustomizerPanel
PropertyChangeListener
s registered for aPropertyName
.getPropertyChangeListeners
in interface ILcyCustomizerPanel
getPropertyChangeListeners
in class Component
aPropertyName
- The property name to retrieve the listeners for.PropertyChangeListener
s registered for aPropertyName
, or an
empty array if no listeners are registered for that property.public void removePropertyChangeListener(PropertyChangeListener aListener)
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.
removePropertyChangeListener
in interface ILcdPropertyChangeSource
removePropertyChangeListener
in class Component
aListener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(String aPropertyName, PropertyChangeListener aListener)
ILcyCustomizerPanel
PropertyChangeListener
for the specific property aPropertyName
. This
method should be used to remove PropertyChangeListener
s that were registered for a specific property
name.removePropertyChangeListener
in interface ILcyCustomizerPanel
removePropertyChangeListener
in class Component
aPropertyName
- The property name.aListener
- The listener.ILcyCustomizerPanel.addPropertyChangeListener(String, java.beans.PropertyChangeListener)
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.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 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 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 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 Dimension getPreferredSize()
getPreferredSize
in class JComponent