com.iplanet.jato.view
Class BooleanDisplayFieldImpl
java.lang.Object
|
+--com.iplanet.jato.view.ViewBase
|
+--com.iplanet.jato.view.DisplayFieldImpl
|
+--com.iplanet.jato.view.BooleanDisplayFieldImpl
- All Implemented Interfaces:
- BooleanDisplayField, DisplayField, View
- public class BooleanDisplayFieldImpl
- extends DisplayFieldImpl
- implements BooleanDisplayField
A simple extension of DisplayFieldImpl
that supports the
additional boolean operations defined in the BooleanDisplayField
interface.
- Version:
- JATO/1.2.2 $Id: BooleanDisplayFieldImpl.java,v 1.8 2002/03/16 03:26:39 todd Exp $
Constructor Summary |
BooleanDisplayFieldImpl(ContainerView parent,
Model model,
java.lang.String name,
java.lang.String boundName,
java.lang.Object trueValue,
java.lang.Object falseValue,
boolean initialState,
DisplayFieldDescriptor descriptor)
This constructor can be used when creating a BooleanDisplayField
directly |
BooleanDisplayFieldImpl(ContainerView parent,
java.lang.String name,
java.lang.Object trueValue,
java.lang.Object falseValue,
boolean initialState)
Construct a minimal instance using the parent's default model
and the field's name as its bound name |
BooleanDisplayFieldImpl(View parent,
Model model,
java.lang.String name,
java.lang.Object trueValue,
java.lang.Object falseValue,
boolean initialState)
Construct a minimal instance using the parent's default model
and the field's name as its bound name |
Method Summary |
boolean |
booleanValue()
Returns the boolean state of the field derived from the current
value. |
java.lang.Object |
getFalseValue()
Returns the value judged to represent a negative value of this
field. |
java.lang.Object |
getTrueValue()
Returns the value judged to represent a positive value of this
field. |
java.lang.Object |
getValue()
Returns the current bound model value. |
void |
setBooleanValue(boolean value)
|
void |
setFalseValue(java.lang.Object value)
Sets the value judged to represent a negative value of this
field. |
void |
setTrueValue(java.lang.Object value)
Sets the value judged to represent a positive value of this
field. |
void |
setValue(java.lang.Object value)
Sets the boolean value. |
void |
setValue(java.lang.Object value,
boolean overwrite)
Sets the boolean value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BooleanDisplayFieldImpl
public BooleanDisplayFieldImpl(ContainerView parent,
java.lang.String name,
java.lang.Object trueValue,
java.lang.Object falseValue,
boolean initialState)
- Construct a minimal instance using the parent's default model
and the field's name as its bound name
- Parameters:
parent
- The parent view of this objectname
- This view's name and model bound nametrueValue
- The value that will be associated with a selected fieldfalseValue
- The value that will be associated with an unselected fieldinitialState
- if true, this field's value is set to its true value
if false, this field's value is set to its false value
BooleanDisplayFieldImpl
public BooleanDisplayFieldImpl(View parent,
Model model,
java.lang.String name,
java.lang.Object trueValue,
java.lang.Object falseValue,
boolean initialState)
- Construct a minimal instance using the parent's default model
and the field's name as its bound name
- Parameters:
parent
- The parent view of this objectmodel
- The model to which this DisplayField is boundname
- This view's name and model bound nametrueValue
- The value that will be associated with a selected fieldfalseValue
- The value that will be associated with an unselected fieldinitialState
- if true, this field's value is set to its true value
if false, this field's value is set to its false value
BooleanDisplayFieldImpl
public BooleanDisplayFieldImpl(ContainerView parent,
Model model,
java.lang.String name,
java.lang.String boundName,
java.lang.Object trueValue,
java.lang.Object falseValue,
boolean initialState,
DisplayFieldDescriptor descriptor)
- This constructor can be used when creating a BooleanDisplayField
directly
- Parameters:
parent
- The parent view of this objectmodel
- The model to which this DisplayField is boundname
- This view's name.boundName
- The name of the model field to which this DisplayField is boundtrueValue
- The value that will be associated with a selected fieldfalseValue
- The value that will be associated with an unselected fieldinitialState
- if true, this field's value is set to its true value
if false, this field's value is set to its false valuedescriptor
- This DisplayField's DisplayFieldDescriptor
getValue
public java.lang.Object getValue()
- Returns the current bound model value.
This method defensively checks to see if the bound model value is a Boolean object.
If the model value is a Boolean then this method will
return the field's trueValue or falseValue according to the Boolean
state. If the model value is not a Boolean, then this method will simply
return the raw model value.
- Specified by:
getValue
in interface DisplayField
- Overrides:
getValue
in class DisplayFieldImpl
- Returns:
- the current bound model value
setValue
public void setValue(java.lang.Object value)
- Sets the boolean value. Same as
setValue(value,true)
.
- Specified by:
setValue
in interface DisplayField
- Overrides:
setValue
in class DisplayFieldImpl
- Parameters:
value
- The value is compared to this fields "true value" and
"false value". If the value matches either of these
legal values, then the field value is adjusted. Otherwise
an IllegalArgumentException
will be thrown- Throws:
java.lang.IllegalArgumentException
- Thrown if the incoming value does not match either the true
value or the false value
setValue
public void setValue(java.lang.Object value,
boolean overwrite)
- Sets the boolean value
- Overrides:
setValue
in class DisplayFieldImpl
- Parameters:
value
- The value is compared to this fields "true value" and
"false value". If the value matches either of these
legal values, then the field value is adjusted. Otherwise
an IllegalArgumentException
will be thrownoverwrite
- Specifies whether to overwrite an already existing value- Throws:
java.lang.IllegalArgumentException
- Thrown if the incoming value does not match either the true
value or the false value
booleanValue
public boolean booleanValue()
- Returns the boolean state of the field derived from the current
value. Generally, if the current value available from
DisplayField.getValue()
matches the value of
getTrueValue()
, this method will return true
.
- Specified by:
booleanValue
in interface BooleanDisplayField
setBooleanValue
public void setBooleanValue(boolean value)
getTrueValue
public java.lang.Object getTrueValue()
- Returns the value judged to represent a positive value of this
field. Generally, if the current value available from
DisplayField.getValue()
matches the return from this method,
the booleanValue()
should return true
.
- Specified by:
getTrueValue
in interface BooleanDisplayField
getFalseValue
public java.lang.Object getFalseValue()
- Returns the value judged to represent a negative value of this
field. Generally, if the current value available from
DisplayField.getValue()
matches the return from this method,
the booleanValue()
should return false
.
- Specified by:
getFalseValue
in interface BooleanDisplayField
setTrueValue
public void setTrueValue(java.lang.Object value)
- Sets the value judged to represent a positive value of this
field.
- Parameters:
value
- value judged to represent a positive value of this field.
setFalseValue
public void setFalseValue(java.lang.Object value)
- Sets the value judged to represent a negative value of this
field.
- Parameters:
value
- value judged to represent a negative value of this field.