de.cau.cs.kieler.sim.kiem.properties
Class KiemPropertyTypeInt

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.properties.KiemPropertyType
      extended by de.cau.cs.kieler.sim.kiem.properties.KiemPropertyTypeInt
All Implemented Interfaces:
IKiemPropertyType

public class KiemPropertyTypeInt
extends KiemPropertyType
implements IKiemPropertyType

This implements a sample KiemPropertyType for an integer type.

Rating yellow
(2009-01-15)

Constructor Summary
KiemPropertyTypeInt()
          Instantiates a new KiemPropertyType int.
 
Method Summary
 Object getValue(KiemProperty property)
          This method bridges integer values (encoded as Strings in property) to Strings of the string cell editor.
static int getValueAsInt(KiemProperty property)
          Gets the value as int.
 Image provideIcon()
          Provide an icon Image for this KiemPropertyType.
static void setValue(KiemProperty property, int value)
          Sets the value.
 void setValue(KiemProperty property, Object value)
          This method bridges integer values (encoded as Strings in property) to Strings of the string cell editor.
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.properties.KiemPropertyType
getCellEditor, getIcon, getId, provideCellEditor, setCellEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KiemPropertyTypeInt

public KiemPropertyTypeInt()
Instantiates a new KiemPropertyType int.

Method Detail

getValue

public Object getValue(KiemProperty property)
This method bridges integer values (encoded as Strings in property) to Strings of the string cell editor. It tries to encode the saved value as an Integer. If this fails, the default 0 value is taken. Gets the value of the property type. This method is called by the cell editor and its returned object depends on the latter. It returns the value that the cell editor can handle.
The concrete type of value is determined by the used cell editor and the type it can handle. The task of an implementation of this method is to bridge the property string type and the cell editor type.

Specified by:
getValue in interface IKiemPropertyType
Parameters:
property - the KiemProperty that this type operates on
Returns:
the value of the property with the type depending on the cell editor

setValue

public void setValue(KiemProperty property,
                     Object value)
This method bridges integer values (encoded as Strings in property) to Strings of the string cell editor. It tries to encode the saved value as an Integer. If this fails, the default 0 value is taken. Sets the value of the property type. This method is called by the cell editor and the object parameter depends on the latter. It gets the value from the cell editor and should store the appropriate string representation in the KIEM property.
The concrete type of value is determined by the used cell editor and the type it can handle. The task of an implementation of this method is to bridge the property string type and the cell editor type.

Specified by:
setValue in interface IKiemPropertyType
Parameters:
property - the KiemProperty that this type operates on
value - the value of the property with the type depending on the cell editor

getValueAsInt

public static int getValueAsInt(KiemProperty property)
Gets the value as int.

Parameters:
property - the property
Returns:
the value as int

setValue

public static void setValue(KiemProperty property,
                            int value)
Sets the value.

Parameters:
property - the property
value - the value

provideIcon

public Image provideIcon()
Description copied from class: KiemPropertyType
Provide an icon Image for this KiemPropertyType. This method may be overridden by implementing classes. By default it provides a plain property icon.

Overrides:
provideIcon in class KiemPropertyType
Returns:
the icon Image to display in the KiemView table-tree