Search this API

y.option
Class AbstractItemEditor

java.lang.Object
  extended by y.option.AbstractItemEditor
All Implemented Interfaces:
Editor, ItemEditor, PropertyChangeReporter, VetoableChangeReporter

public abstract class AbstractItemEditor
extends java.lang.Object
implements ItemEditor, PropertyChangeReporter, VetoableChangeReporter

A base class from which other ItemEditor classes can be derived.

 
Your browser does not support SVG content.

Nested Class Summary
 
Nested classes/interfaces inherited from interface y.option.Editor
Editor.Event, Editor.Listener
 
Field Summary
static java.lang.String PROPERTY_AUTO_ADOPT
          Name of property autoAdopt.
static java.lang.String PROPERTY_AUTO_COMMIT
          Name of property autoCommit.
static java.lang.String PROPERTY_ENABLED
          Name of property enabled.
static java.lang.String PROPERTY_VALUE
          Name of property value.
static java.lang.String PROPERTY_VALUE_UNDEFINED
          Name of property valueUndefined.
 
Fields inherited from interface y.option.ItemEditor
ATTRIBUTE_AUTO_ADOPT, ATTRIBUTE_AUTO_COMMIT, ATTRIBUTE_FONT_NAME, ATTRIBUTE_SELECT_TEXT_ON_FOCUS
 
Constructor Summary
protected AbstractItemEditor(OptionItem item)
          Constructs a new AbstractItemEditor for the specified option item.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyname, java.beans.PropertyChangeListener pcl)
          Adds a PropertyChangeListener to the listener list for a specific property.
 void addVetoableChangeListener(java.lang.String propertyname, java.beans.VetoableChangeListener vcl)
          Adds a VetoableChangeListener to the listener list for a specific property.
 void addVetoableChangeListener(java.beans.VetoableChangeListener vcl)
          Adds a VetoableChangeListener to the listener list.
 void adoptItemValue()
          Adopts the value and state of the underlying option item into the editor.
 void commitValue()
          Commits the editor value to the underlying option item.
protected  void firePropertyChange(java.beans.PropertyChangeEvent pce)
          Fires a PropertyChangeEvent in response to a change in a bound property.
protected  void firePropertyChange(java.lang.String pn, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a PropertyChangeEvent in response to a change in a bound property.
protected  void fireVetoableChange(java.beans.PropertyChangeEvent pce)
          Fires a PropertyChangeEvent in response to a change in a vetoable property.
protected  void fireVetoableChange(java.lang.String pn, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a PropertyChangeEvent in response to a change in a vetoable property.
 OptionItem getItem()
          Returns the option item whose value can be edited with this editor.
 boolean isAutoAdopt()
          Returns whether this editor is in autoAdopt state, i.e. if changes in the properties value, valueUndefined, and enabled of the underlying option item be automatically adopted by the editor.
 boolean isAutoCommit()
          Returns whether this editor is in autoCommit state, i.e. if editor changes will be automatically propagated to the underlying option item.
protected  void publishEnabledChange(boolean oldValue, boolean newValue)
          Fires the appropriate PropertyChangeEvent.
protected  void publishValueChange(java.lang.Object oldValue, java.lang.Object newValue)
          Fires the appropriate PropertyChangeEvent.
protected  void publishValueUndefinedChange(boolean oldValue, boolean newValue)
          Fires the appropriate PropertyChangeEvent.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyname, java.beans.PropertyChangeListener pcl)
          Removes a PropertyChangeListener from the listener list for a specific property.
 void removeVetoableChangeListener(java.lang.String propertyname, java.beans.VetoableChangeListener vcl)
          Removes a VetoableChangeListener from the listener list for a specific property.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener vcl)
          Removes a VetoableChangeListener from the listener list.
 void resetValue()
          Resets the editor value to the backup value of the underlying option item.
 void setAutoAdopt(boolean autoAdopt)
          Specifies the autoAdopt state of this editor.
 void setAutoCommit(boolean autoCommit)
          Specifies the autoCommit state of this editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface y.option.ItemEditor
getValue, isEnabled, isValueUndefined, setEnabled, setValue, setValueUndefined
 
Methods inherited from interface y.option.Editor
getComponent
 

Field Detail

PROPERTY_ENABLED

public static final java.lang.String PROPERTY_ENABLED
Name of property enabled.


PROPERTY_VALUE

public static final java.lang.String PROPERTY_VALUE
Name of property value.


PROPERTY_VALUE_UNDEFINED

public static final java.lang.String PROPERTY_VALUE_UNDEFINED
Name of property valueUndefined.


PROPERTY_AUTO_COMMIT

public static final java.lang.String PROPERTY_AUTO_COMMIT
Name of property autoCommit.


PROPERTY_AUTO_ADOPT

public static final java.lang.String PROPERTY_AUTO_ADOPT
Name of property autoAdopt.

Constructor Detail

AbstractItemEditor

protected AbstractItemEditor(OptionItem item)
Constructs a new AbstractItemEditor for the specified option item.

Parameters:
item - the option item whose value can be edited with this editor
Method Detail

getItem

public OptionItem getItem()
Returns the option item whose value can be edited with this editor.

Specified by:
getItem in interface ItemEditor
Returns:
the option item whose value can be edited with this editor

isAutoCommit

public boolean isAutoCommit()
Returns whether this editor is in autoCommit state, i.e. if editor changes will be automatically propagated to the underlying option item.

Specified by:
isAutoCommit in interface ItemEditor
Returns:
whether this editor is in autoCommit state

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Specifies the autoCommit state of this editor.

Specified by:
setAutoCommit in interface ItemEditor
Parameters:
autoCommit - if true changes in this editor will be automatically propagated to the underlying option item

isAutoAdopt

public boolean isAutoAdopt()
Returns whether this editor is in autoAdopt state, i.e. if changes in the properties value, valueUndefined, and enabled of the underlying option item be automatically adopted by the editor.

Specified by:
isAutoAdopt in interface ItemEditor
Returns:
whether this editor is in autoAdopt state
See Also:
OptionItem.publishValue(Object), OptionItem.publishValueUndefined(boolean), OptionItem.publishEnabled(boolean)

setAutoAdopt

public void setAutoAdopt(boolean autoAdopt)
Specifies the autoAdopt state of this editor.

Specified by:
setAutoAdopt in interface ItemEditor
Parameters:
autoAdopt - if true changes in the properties value, valueUndefined, and enabled of the underlying option item will be automatically adopted by the editor

commitValue

public void commitValue()
Commits the editor value to the underlying option item.

Specified by:
commitValue in interface Editor

adoptItemValue

public void adoptItemValue()
Adopts the value and state of the underlying option item into the editor.

Specified by:
adoptItemValue in interface Editor

resetValue

public void resetValue()
Resets the editor value to the backup value of the underlying option item.

Specified by:
resetValue in interface Editor
Throws:
java.lang.UnsupportedOperationException - if the underlying option item does not implement BackupValueOwner

publishValueChange

protected void publishValueChange(java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fires the appropriate PropertyChangeEvent. If the editor is in autoCommit state, the value of the underlying option item is updated.

Parameters:
oldValue - the previous value
newValue - the new value

publishEnabledChange

protected void publishEnabledChange(boolean oldValue,
                                    boolean newValue)
Fires the appropriate PropertyChangeEvent. If the editor is in autoCommit state, the enabled property of the underlying option item is updated.

Parameters:
oldValue - the previous value
newValue - the new value

publishValueUndefinedChange

protected void publishValueUndefinedChange(boolean oldValue,
                                           boolean newValue)
Fires the appropriate PropertyChangeEvent. If the editor is in autoCommit state, the valueUndefined property of the underlying option item is updated.

Parameters:
oldValue - the previous value
newValue - the new value

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class, including the following: If listener is null, no exception is thrown and no action is performed.

Specified by:
addPropertyChangeListener in interface PropertyChangeReporter
Parameters:
pcl - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the listener list. This method should be used to remove the PropertyChangeListeners that were registered for all bound properties of this class.

If listener is null, no exception is thrown and no action is performed.

Specified by:
removePropertyChangeListener in interface PropertyChangeReporter
Parameters:
pcl - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(String,java.beans.PropertyChangeListener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyname,
                                      java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined, or one of the following: If listener is null, no exception is thrown and no action is performed.

Specified by:
addPropertyChangeListener in interface PropertyChangeReporter
Parameters:
propertyname - one of the property names listed above
pcl - the PropertyChangeListener to be added
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyname,
                                         java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

If listener is null, no exception is thrown and no action is performed.

Specified by:
removePropertyChangeListener in interface PropertyChangeReporter
Parameters:
propertyname - a valid property name
pcl - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(String,java.beans.PropertyChangeListener), removePropertyChangeListener(java.beans.PropertyChangeListener)

firePropertyChange

protected void firePropertyChange(java.lang.String pn,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fires a PropertyChangeEvent in response to a change in a bound property. The event will be delivered to all registered PropertyChangeListeners. No event will be delivered if oldValue and newValue are the same.

Parameters:
pn - the name of the property that has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(java.beans.PropertyChangeEvent pce)
Fires a PropertyChangeEvent in response to a change in a bound property. The event will be delivered to all registered PropertyChangeListeners. No event will be delivered if oldValue and newValue are the same.

Parameters:
pce - the PropertyChangeEvent to be fired

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener vcl)
Adds a VetoableChangeListener to the listener list. The listener is registered for all vetoable properties of this class.

If listener is null, no exception is thrown and no action is performed.

Specified by:
addVetoableChangeListener in interface VetoableChangeReporter
Parameters:
vcl - the VetoableChangeListener to be added
See Also:
removeVetoableChangeListener(java.beans.VetoableChangeListener), addVetoableChangeListener(String,java.beans.VetoableChangeListener)

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener vcl)
Removes a VetoableChangeListener from the listener list. This method should be used to remove the VetoableChangeListeners that were registered for all vetoable properties of this class.

If listener is null, no exception is thrown and no action is performed.

Specified by:
removeVetoableChangeListener in interface VetoableChangeReporter
Parameters:
vcl - the VetoableChangeListener to be removed
See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener), removeVetoableChangeListener(String,java.beans.VetoableChangeListener)

addVetoableChangeListener

public void addVetoableChangeListener(java.lang.String propertyname,
                                      java.beans.VetoableChangeListener vcl)
Adds a VetoableChangeListener to the listener list for a specific property.

If listener is null, no exception is thrown and no action is performed.

Specified by:
addVetoableChangeListener in interface VetoableChangeReporter
Parameters:
propertyname - one of the property names listed above
vcl - the VetoableChangeListener to be added
See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener), removeVetoableChangeListener(java.beans.VetoableChangeListener)

removeVetoableChangeListener

public void removeVetoableChangeListener(java.lang.String propertyname,
                                         java.beans.VetoableChangeListener vcl)
Removes a VetoableChangeListener from the listener list for a specific property. This method should be used to remove VetoableChangeListeners that were registered for a specific bound property.

If listener is null, no exception is thrown and no action is performed.

Specified by:
removeVetoableChangeListener in interface VetoableChangeReporter
Parameters:
propertyname - a valid property name
vcl - the VetoableChangeListener to be removed
See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener), removeVetoableChangeListener(java.beans.VetoableChangeListener)

fireVetoableChange

protected void fireVetoableChange(java.lang.String pn,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
                           throws java.beans.PropertyVetoException
Fires a PropertyChangeEvent in response to a change in a vetoable property. The event will be delivered to all registered VetoableChangeListeners. If a VetoableChangeListener throws a PropertyVetoException, a new event is fired reverting all VetoableChangeListeners to the old value and the exception is then rethrown. No event will be delivered if oldValue and newValue are the same.

Parameters:
pn - the name of the property that has changed
oldValue - the property's previous value
newValue - the property's new value
Throws:
java.beans.PropertyVetoException - if a VetoableChangeListener threw PropertyVetoException

fireVetoableChange

protected void fireVetoableChange(java.beans.PropertyChangeEvent pce)
                           throws java.beans.PropertyVetoException
Fires a PropertyChangeEvent in response to a change in a vetoable property. The event will be delivered to all registered VetoableChangeListeners. If a VetoableChangeListener throws a PropertyVetoException, a new event is fired reverting all VetoableChangeListeners to the old value and the exception is then rethrown. No event will be delivered if oldValue and newValue are the same.

Parameters:
pce - the PropertyChangeEvent to be fired
Throws:
java.beans.PropertyVetoException - if a VetoableChangeListener threw PropertyVetoException

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.