de.matthiasmann.twl.model
Interface Property<T>

Type Parameters:
T - The type of the property values
All Known Implementing Classes:
AbstractProperty, SimpleProperty, SimplePropertyList

public interface Property<T>

A genric property interface for use with the PropertySheet widget


Method Summary
 void addValueChangedCallback(java.lang.Runnable cb)
          Registers a value changed callback.
 boolean canBeNull()
          Returns true if this property can be set to null.
 java.lang.String getName()
          The property name as displayed in the UI
 T getPropertyValue()
          Retrieves the current property value
 java.lang.Class<T> getType()
          Returns the type of the property.
 boolean isReadOnly()
          Returns true if this property is read only.
 void removeValueChangedCallback(java.lang.Runnable cb)
          Removes a value changed callback
 void setPropertyValue(T value)
          Changes the property value.
 

Method Detail

getName

java.lang.String getName()
The property name as displayed in the UI

Returns:
the property name

isReadOnly

boolean isReadOnly()
Returns true if this property is read only. Calling the setValue() method on a read only property is undefined.

Returns:
true if this property is read only

canBeNull

boolean canBeNull()
Returns true if this property can be set to null. This is similar to a SQL null.

Returns:
true if this property can be null

getPropertyValue

T getPropertyValue()
Retrieves the current property value

Returns:
the current property value

setPropertyValue

void setPropertyValue(T value)
                      throws java.lang.IllegalArgumentException
Changes the property value. If the value is invalid then an IllegalArgumentException argument except should be thrown and the UI will indicate the invalid state of the input.

Parameters:
value - The new value
Throws:
java.lang.IllegalArgumentException - if the new value can't be accepted
java.lang.NullPointerException - if value is null and canBeNull returned false
See Also:
canBeNull()

getType

java.lang.Class<T> getType()
Returns the type of the property. This is used to select an editor widget in the PropertySheet.

Returns:
The class of the property values

addValueChangedCallback

void addValueChangedCallback(java.lang.Runnable cb)
Registers a value changed callback. It should be called when the value was changed from something other then setValue

Parameters:
cb - the value changed callback

removeValueChangedCallback

void removeValueChangedCallback(java.lang.Runnable cb)
Removes a value changed callback

Parameters:
cb - the value changed callback