com.sun.interview
Class PropertiesQuestion.FloatConstraints

java.lang.Object
  extended by com.sun.interview.PropertiesQuestion.ValueConstraints
      extended by com.sun.interview.PropertiesQuestion.FloatConstraints
Enclosing class:
PropertiesQuestion

public static class PropertiesQuestion.FloatConstraints
extends PropertiesQuestion.ValueConstraints


Field Summary
protected  boolean custom
           
protected  float[] suggestions
           
 
Constructor Summary
PropertiesQuestion.FloatConstraints()
           
PropertiesQuestion.FloatConstraints(float[] suggestions)
           
PropertiesQuestion.FloatConstraints(float min, float max)
           
PropertiesQuestion.FloatConstraints(float min, float max, float[] suggestions)
           
 
Method Summary
 float getLowerBound()
           
 float getResolution()
          Get the resolution for responses to this question.
 float[] getSuggestions()
          Get the suggested values.
 float getUpperBound()
           
 boolean isCustomValuesAllowed()
          Are custom user values allowed?
 java.lang.String isValid(float v)
          Is the given value valid for this field?
 java.lang.String isValid(java.lang.String v)
          Is the given value valid for this field? The basic check for validity is to see if the given string can be parsed as an floating point value in the current locale.
 void setBounds(float min, float max)
          Set the max/min possible value that should be considered valid.
 void setCustomValuesAllowed(boolean state)
          Are user specified values allowed? If not, there must be suggestions present.
 void setResolution(float resolution)
          Set the resolution for responses to this question.
 void setSuggestions(float[] sugs)
          Supply some possible values that the user may want to select from.
 
Methods inherited from class com.sun.interview.PropertiesQuestion.ValueConstraints
isReadOnly, isUnsetAllowed, isVisible, setReadOnly, setUnsetAllowed, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

suggestions

protected float[] suggestions

custom

protected boolean custom
Constructor Detail

PropertiesQuestion.FloatConstraints

public PropertiesQuestion.FloatConstraints()

PropertiesQuestion.FloatConstraints

public PropertiesQuestion.FloatConstraints(float min,
                                           float max)

PropertiesQuestion.FloatConstraints

public PropertiesQuestion.FloatConstraints(float[] suggestions)

PropertiesQuestion.FloatConstraints

public PropertiesQuestion.FloatConstraints(float min,
                                           float max,
                                           float[] suggestions)
Method Detail

setBounds

public void setBounds(float min,
                      float max)
Set the max/min possible value that should be considered valid. The range in inclusive. The defaults are the MIN and MAX values for the float type.


getLowerBound

public float getLowerBound()

getUpperBound

public float getUpperBound()

getSuggestions

public float[] getSuggestions()
Get the suggested values. Not a copy, do not alter the array.


setCustomValuesAllowed

public void setCustomValuesAllowed(boolean state)
Are user specified values allowed? If not, there must be suggestions present.

Throws:
java.lang.IllegalStateException - If no suggestions have been provided.
See Also:
#setSuggestion

isCustomValuesAllowed

public boolean isCustomValuesAllowed()
Are custom user values allowed?

See Also:
setCustomValuesAllowed(boolean), setSuggestions(float[])

setSuggestions

public void setSuggestions(float[] sugs)
Supply some possible values that the user may want to select from.


setResolution

public void setResolution(float resolution)
Set the resolution for responses to this question. Responses may be rounded to the nearest multiple of the resolution.

Parameters:
resolution - the resolution for responses to this question
See Also:
getResolution(), PropertiesQuestion.setValue(java.lang.String)

getResolution

public float getResolution()
Get the resolution for responses to this question. Responses may be rounded to the nearest multiple of the resolution.

Returns:
the resolution for responses to this question
See Also:
setResolution(float), PropertiesQuestion.setValue(java.lang.String)

isValid

public java.lang.String isValid(java.lang.String v)
Is the given value valid for this field? The basic check for validity is to see if the given string can be parsed as an floating point value in the current locale.

Overrides:
isValid in class PropertiesQuestion.ValueConstraints
Parameters:
v - The value to check.
Returns:
Null if the valid is valid, a localized reason string otherwise.
See Also:
PropertiesQuestion.getInvalidKeys()

isValid

public java.lang.String isValid(float v)
Is the given value valid for this field?

Returns:
Null if the valid is valid, a localized reason string otherwise.


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.