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.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested 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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface com.luciad.lucy.gui.customizer.ILcyCustomizerPanel
HINT_PINNED, HORIZONTAL_ALIGNMENT_HINT, LONG_DESCRIPTION, NAME, SHORT_DESCRIPTION, SMALL_ICONFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionTLcyGXYAsynchronousLayerCustomizerPanel(ILcyLucyEnv aLucyEnv, ILcyCustomizerPanel aPanel) Creates a new wrapper panel. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aListener) Registers the givenPropertyChangeListenerto be notified when this object's properties change.voidaddPropertyChangeListener(String aPropertyName, PropertyChangeListener aListener) Adds the given listener for the specific property with nameaPropertyName.voidaddUndoableListener(ILcdUndoableListener aUndoableListener) Adds a listener to this source, so this listener is notified when something undoable has happened.booleanUpdates the setObjectaccording to the current state of the user interface.voidUpdates the user interface state according to the current state of the setObject.booleancanSetObject(Object aObject) Returnstrueif and only ifsetObjectwould not throw anIllegalArgumentException.Returns the object that was set usingsetObject.Returns an array of all thePropertyChangeListeners registered on thisILcyCustomizerPanel.getPropertyChangeListeners(String aPropertyName) Returns an array of all thePropertyChangeListeners registered foraPropertyName.Gets the property value for the given key.booleanReturnstrueif changes are pending.booleanReturnstrueif the pending changes are valid, or if there are no pending changes.voidSets the property value foraKeytoaValue.voidDe-registers the givenPropertyChangeListenerfrom receiving property change events for this object.voidremovePropertyChangeListener(String aPropertyName, PropertyChangeListener aListener) Removes the givenPropertyChangeListenerfor the specific propertyaPropertyName.voidremoveUndoableListener(ILcdUndoableListener aUndoableListener) Removes the specified listener so it is no longer notified.voidSet the object to be edited.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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:ILcyCustomizerPanelUpdates the setObjectaccording to the current state of the user interface. This means all pending changes are committed. If there were any pending changes, soisChangesPendingreturnedtrue, it should returnfalseafter this method has finished, and therefore also a"changesPending"property change event must be fired. E.g. consider that aILcdGXYLayerobject 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:
applyChangesin interfaceILcyCustomizerPanel- Returns:
Trueif the changes were applied or if there were no changes,falseif the changes could not be applied because they are invalid. In that event,isChangesValidreturnsfalse.
-
cancelChanges
public void cancelChanges()Description copied from interface:ILcyCustomizerPanelUpdates 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 anILcdGXYLayeris 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 theILcdGXYLayershould be put in the text field (ILcdGXYLayer.getLabel()).- Specified by:
cancelChangesin interfaceILcyCustomizerPanel
-
canSetObject
Description copied from interface:ILcyCustomizerPanelReturnstrueif and only ifsetObjectwould not throw anIllegalArgumentException.- Specified by:
canSetObjectin interfaceILcyCustomizerPanel- Parameters:
aObject- The object to check.- Returns:
trueifsetObjectwould accept the object,falseif it would throw an exception.
-
setObject
Description copied from interface:ILcyCustomizerPanelSet the object to be edited. This method should be called before theILcyCustomizerPanelhas 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 ofnullis set to inform thisILcyCustomizerPanelto (temporarily) deinitialize itself, it allows to perform cleanup tasks, such as removing listeners.- Specified by:
setObjectin interfaceILcyCustomizerPanel- Parameters:
aObject- The object to be customized, ornullto inform that editing is temporarily disabled.
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceRegisters the given
PropertyChangeListenerto 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
ALcdWeakPropertyChangeListenerinstance as property change listener.- Specified by:
addPropertyChangeListenerin interfaceILcdPropertyChangeSource- Overrides:
addPropertyChangeListenerin classContainer- Parameters:
aListener- The listener to be notified- See Also:
-
addPropertyChangeListener
Description copied from interface:ILcyCustomizerPanelAdds 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:
addPropertyChangeListenerin interfaceILcyCustomizerPanel- Overrides:
addPropertyChangeListenerin classContainer- Parameters:
aPropertyName- The property name for whichaListenerwill receive events.aListener- The listener. It only receives events for the given property name.- See Also:
-
getObject
Description copied from interface:ILcyCustomizerPanelReturns the object that was set usingsetObject. This can benull.- Specified by:
getObjectin interfaceILcyCustomizerPanel- Returns:
- the object that was set using
setObject. - See Also:
-
getPropertyChangeListeners
Description copied from interface:ILcyCustomizerPanelReturns an array of all thePropertyChangeListeners registered on thisILcyCustomizerPanel.- Specified by:
getPropertyChangeListenersin interfaceILcyCustomizerPanel- Overrides:
getPropertyChangeListenersin classComponent- Returns:
- an array of all the
PropertyChangeListeners registered on thisILcyCustomizerPanel, or an empty array if noPropertyChangeListeners are currently registered.
-
getPropertyChangeListeners
Description copied from interface:ILcyCustomizerPanelReturns an array of all thePropertyChangeListeners registered foraPropertyName.- Specified by:
getPropertyChangeListenersin interfaceILcyCustomizerPanel- Overrides:
getPropertyChangeListenersin classComponent- Parameters:
aPropertyName- The property name to retrieve the listeners for.- Returns:
- an array of all the
PropertyChangeListeners registered foraPropertyName, or an empty array if no listeners are registered for that property.
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSourceDe-registers the given
PropertyChangeListenerfrom 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:
removePropertyChangeListenerin interfaceILcdPropertyChangeSource- Overrides:
removePropertyChangeListenerin 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:ILcyCustomizerPanelRemoves the givenPropertyChangeListenerfor the specific propertyaPropertyName. This method should be used to removePropertyChangeListeners that were registered for a specific property name.- Specified by:
removePropertyChangeListenerin interfaceILcyCustomizerPanel- Overrides:
removePropertyChangeListenerin classComponent- Parameters:
aPropertyName- The property name.aListener- The listener.- See Also:
-
addUndoableListener
Description copied from interface:ILcdUndoableSourceAdds a listener to this source, so this listener is notified when something undoable has happened.- Specified by:
addUndoableListenerin interfaceILcdUndoableSource- Parameters:
aUndoableListener- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeUndoableListenerin interfaceILcdUndoableSource- Parameters:
aUndoableListener- The listener to remove.
-
getValue
Description copied from interface:ILcyCustomizerPanelGets the property value for the given key.- Specified by:
getValuein 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:ILcyCustomizerPanelReturnstrueif changes are pending. A change is a modification made by the user, e.g., the modified content of a text field. Pending means the methodapplyChangeswas 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:
isChangesPendingin interfaceILcyCustomizerPanel- Returns:
trueif there are pending changes,falseotherwise.
-
isChangesValid
public boolean isChangesValid()Description copied from interface:ILcyCustomizerPanelReturnstrueif the pending changes are valid, or if there are no pending changes. Returnsfalseif 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 methodapplyChangeswas not invoked after the change occurred.Falsecould 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:
isChangesValidin interfaceILcyCustomizerPanel- Returns:
trueif the changes can be applied,falseotherwise.
-
putValue
Description copied from interface:ILcyCustomizerPanelSets the property value foraKeytoaValue. If the value has changed, aPropertyChangeEventis sent to the listeners. The property name of the event equals the value ofaKey.- Specified by:
putValuein 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:
getPreferredSizein classJComponent
-