org.jdesktop.dataset
Class DataValue

java.lang.Object
  extended by org.jdesktop.dataset.DataValue

public class DataValue
extends java.lang.Object

A DataValue is represents an expression attached to a DataSet, which can be evaluated in the context of that DataSet to produce an Object end-value. The expression is a String expression intended to be processed by a subclass so that the getValue() method returns an Object representing the expression's result.

A DataValue has a name, which should be unique for a given DataSet.

A DataValue belongs to a single DataSet.

Author:
rbair
See Also:
DataSet

Field Summary
protected static java.lang.String DEFAULT_NAME_PREFIX
          Used as a prefix for auto-generated names.
 
Constructor Summary
DataValue(DataSet ds)
          Creates a new instance of DataValue with an auto-generated name, for a given DataSet.
DataValue(DataSet ds, java.lang.String name)
          Creates a new instance of DataValue, for a given DataSet.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this class for any changes to bean properties.
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this class for specific property changes.
 DataSet getDataSet()
          Returns the DataSet this DataValue belongs to.
 java.lang.String getExpression()
          Returns the expression which will be evaluated to result in an actual value for this DataValue.
 java.lang.String getName()
          Returns the current name for this DataValue.
 java.lang.Object getValue()
          Returns the actual value resulting from the DataValue's expression being evaluated in the context of a DataSet.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Stops notifying a specific listener of any changes to bean properties.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Stops notifying a specific listener of changes to a specific property.
 void setExpression(java.lang.String expression)
          Sets the string expression which, when evaluated, returns a DataValue.
 void setName(java.lang.String name)
          Changes the name for this DataValue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME_PREFIX

protected static final java.lang.String DEFAULT_NAME_PREFIX
Used as a prefix for auto-generated names.

See Also:
Constant Field Values
Constructor Detail

DataValue

public DataValue(DataSet ds)
Creates a new instance of DataValue with an auto-generated name, for a given DataSet.

Parameters:
ds - The DataSet that owns this DataValue

DataValue

public DataValue(DataSet ds,
                 java.lang.String name)
Creates a new instance of DataValue, for a given DataSet.

Parameters:
ds - The DataSet that owns this DataValue
name - The DataValue's name.
Method Detail

setName

public void setName(java.lang.String name)
Changes the name for this DataValue.

Parameters:
name - The new name.

getName

public java.lang.String getName()
Returns the current name for this DataValue.

Returns:
the DataValue's name.

getDataSet

public DataSet getDataSet()
Returns the DataSet this DataValue belongs to.

Returns:
the DataSet this DataValue belongs to.

getExpression

public java.lang.String getExpression()
Returns the expression which will be evaluated to result in an actual value for this DataValue.

Returns:
the expression that underlies this DataValue

setExpression

public void setExpression(java.lang.String expression)
Sets the string expression which, when evaluated, returns a DataValue.

Parameters:
expression - The new expression for this DataValue.

getValue

public java.lang.Object getValue()
Returns the actual value resulting from the DataValue's expression being evaluated in the context of a DataSet. This value may be constant or may change on each invocation--that's up to the expression.

Returns:
the actual value of this DataValue, once evaluated.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this class for any changes to bean properties.

Parameters:
listener - The PropertyChangeListener to notify of changes to this instance.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String property,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this class for specific property changes.

Parameters:
property - The name of the property to listen to changes for.
listener - The PropertyChangeListener to notify of changes to this instance.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Stops notifying a specific listener of any changes to bean properties.

Parameters:
listener - The listener to stop receiving notifications.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Stops notifying a specific listener of changes to a specific property.

Parameters:
propertyName - The name of the property to ignore from now on.
listener - The listener to stop receiving notifications.


Copyright © 2005 Sun Microsystems All Rights Reserved.