Package muntjac :: Package data :: Module property :: Class IProperty
[hide private]
[frames] | no frames]

Class IProperty

source code

object --+
         |
        IProperty

The IProperty is a simple data object that contains one typed value. This interface contains methods to inspect and modify the stored value and its type, and the object's read-only state.

The IProperty also defines the events IReadOnlyStatusChangeEvent and ValueChangeEvent, and the associated listener and notifier interfaces.

The IViewer interface should be used to attach the IProperty to an external data source. This way the value in the data source can be inspected using the IProperty interface.

The IProperty.editor interface should be implemented if the value needs to be changed through the implementing class.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
getValue(self)
Gets the value stored in the IProperty.
source code
 
setValue(self, newValue)
Sets the value of the IProperty.
source code
 
__str__(self)
Returns the value of the IProperty in human readable textual format.
source code
 
getType(self)
Returns the type of the IProperty.
source code
 
isReadOnly(self)
Tests if the IProperty is in read-only mode.
source code
 
setReadOnly(self, newStatus)
Sets the IProperty's read-only mode to the specified status.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

getValue(self)

source code 

Gets the value stored in the IProperty. The returned object is compatible with the class returned by getType().

Returns:
the value stored in the IProperty

setValue(self, newValue)

source code 

Sets the value of the IProperty.

Implementing this functionality is optional. If the functionality is missing, one should declare the IProperty to be in read-only mode and throw ReadOnlyException in this function.

Note: It is not required, but highly recommended to support setting the value also as a String in addition to the native type of the IProperty (as given by the getType method). If the string conversion fails or is unsupported, the method should throw ConversionException. The string conversion should at least understand the format returned by the __str__ method of the IProperty.

Parameters:
  • newValue - New value of the IProperty. This should be assignable to the type returned by getType, but also String type should be supported
Raises:

__str__(self)
(Informal representation operator)

source code 

Returns the value of the IProperty in human readable textual format. The return value should be assignable to the setValue method if the IProperty is not in read-only mode.

Returns:
String representation of the value stored in the IProperty
Overrides: object.__str__

getType(self)

source code 

Returns the type of the IProperty. The methods getValue and setValue must be compatible with this type: one must be able to safely cast the value returned from getValue to the given type and pass any variable assignable to this type as an argument to setValue.

Returns:
type of the IProperty

isReadOnly(self)

source code 

Tests if the IProperty is in read-only mode. In read-only mode calls to the method setValue will throw ReadOnlyException and will not modify the value of the IProperty.

Returns:
True if the IProperty is in read-only mode, False if it's not

setReadOnly(self, newStatus)

source code 

Sets the IProperty's read-only mode to the specified status.

This functionality is optional, but all properties must implement the isReadOnly mode query correctly.

Parameters:
  • newStatus - new read-only status of the IProperty