net.infonode.properties.types
Class NumberProperty

java.lang.Object
  extended by net.infonode.properties.util.AbstractProperty
      extended by net.infonode.properties.util.ValueHandlerProperty
          extended by net.infonode.properties.types.NumberProperty
All Implemented Interfaces:
Property
Direct Known Subclasses:
IntegerProperty

public class NumberProperty
extends ValueHandlerProperty

Base class for number properties.

Version:
$Revision: 1.4 $
Author:
$Author: jesper $

Field Summary
private  long maxValue
           
private  long minValue
           
private  int preferredDigitCount
           
 
Constructor Summary
NumberProperty(PropertyGroup group, java.lang.String name, java.lang.Class cl, java.lang.String description, long minValue, long maxValue, int preferredDigitCount, PropertyValueHandler valueHandler)
          Constructor.
 
Method Summary
 boolean canBeAssiged(java.lang.Object value)
          Returns true if the value can be assigned to this property.
 long getLongValue(java.lang.Object valueContainer)
          Returns the long value of this property in a value container.
 long getMaxValue()
          Returns the largest value that this property can have.
 long getMinValue()
          Returns the smallest value that this property can have.
 int getPreferredDigitCount()
          Returns the preferred number of digits to allocate space for in an editor for a property value
 
Methods inherited from class net.infonode.properties.util.ValueHandlerProperty
getValue, removeValue, setValue, valueIsRemovable, valueIsSet
 
Methods inherited from class net.infonode.properties.util.AbstractProperty
getDescription, getGroup, getName, getType, isMutable, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minValue

private long minValue

maxValue

private long maxValue

preferredDigitCount

private int preferredDigitCount
Constructor Detail

NumberProperty

public NumberProperty(PropertyGroup group,
                      java.lang.String name,
                      java.lang.Class cl,
                      java.lang.String description,
                      long minValue,
                      long maxValue,
                      int preferredDigitCount,
                      PropertyValueHandler valueHandler)
Constructor.

Parameters:
group - the property group
name - the property name
cl - the property type
description - the property description
minValue - the smallest value that this property can have
maxValue - the largest value that this property can have
preferredDigitCount - the preferred number of digits to allocate space for in an editor for a property value
valueHandler - handles values for this property
Method Detail

getPreferredDigitCount

public int getPreferredDigitCount()
Returns the preferred number of digits to allocate space for in an editor for a property value

Returns:
the preferred number of digits to allocate space for in an editor for a property value

getMinValue

public long getMinValue()
Returns the smallest value that this property can have.

Returns:
the smallest value that this property can have

getMaxValue

public long getMaxValue()
Returns the largest value that this property can have.

Returns:
the largest value that this property can have

getLongValue

public long getLongValue(java.lang.Object valueContainer)
Returns the long value of this property in a value container.

Parameters:
valueContainer - the value container
Returns:
the long value of this property

canBeAssiged

public boolean canBeAssiged(java.lang.Object value)
Description copied from interface: Property
Returns true if the value can be assigned to this property.

Specified by:
canBeAssiged in interface Property
Overrides:
canBeAssiged in class AbstractProperty
Parameters:
value - the value to assign
Returns:
true if the value can be assigned to this property