|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.binding.beans.Model
com.jgoodies.binding.value.AbstractValueModel
public abstract class AbstractValueModel
An abstract class that minimizes the effort required to implement
the ValueModel
interface. It provides convenience methods
to convert boolean, double, float, int, and long to their
corresponding Object values and vice versa.
Subclasses must implement getValue()
and
setValue(Object)
to get and set this model's value.
ExtendedPropertyChangeSupport
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
PROPERTYNAME_VALUE
The name of the bound property value. |
Constructor Summary | |
---|---|
AbstractValueModel()
|
Method Summary | |
---|---|
void |
addValueChangeListener(java.beans.PropertyChangeListener l)
Registers the given PropertyChangeListener with this model. |
boolean |
booleanValue()
Converts this model's value and returns it as a boolean . |
double |
doubleValue()
Converts this model's value and returns it as a double . |
void |
fireValueChange(boolean oldValue,
boolean newValue)
Notifies all listeners that have registered interest for notification on this event type. |
void |
fireValueChange(double oldValue,
double newValue)
Notifies all listeners that have registered interest for notification on this event type. |
void |
fireValueChange(float oldValue,
float newValue)
Notifies all listeners that have registered interest for notification on this event type. |
void |
fireValueChange(int oldValue,
int newValue)
Notifies all listeners that have registered interest for notification on this event type. |
void |
fireValueChange(long oldValue,
long newValue)
Notifies all listeners that have registered interest for notification on this event type. |
void |
fireValueChange(java.lang.Object oldValue,
java.lang.Object newValue)
Notifies all listeners that have registered interest for notification on this event type. |
void |
fireValueChange(java.lang.Object oldValue,
java.lang.Object newValue,
boolean checkIdentity)
Notifies all listeners that have registered interest for notification on this event type. |
float |
floatValue()
Converts this model's value and returns it as a float . |
java.lang.String |
getString()
Converts this model's value and returns it as a String . |
int |
intValue()
Converts this model's value and returns it as an int . |
long |
longValue()
Converts this model's value and returns it as a long . |
void |
removeValueChangeListener(java.beans.PropertyChangeListener l)
Removes the given PropertyChangeListener from the model. |
void |
setValue(boolean b)
Converts the given boolean to a Boolean and
sets it as new value. |
void |
setValue(double d)
Converts the given double to a Double and
sets it as new value. |
void |
setValue(float f)
Converts the given float to a Float and
sets it as new value. |
void |
setValue(int i)
Converts the given int to an Integer and
sets it as new value. |
void |
setValue(long l)
Converts the given long to a Long and
sets it as new value. |
java.lang.String |
toString()
Returns a string representation of this value model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jgoodies.binding.value.ValueModel |
---|
getValue, setValue |
Field Detail |
---|
public static final java.lang.String PROPERTYNAME_VALUE
Constructor Detail |
---|
public AbstractValueModel()
Method Detail |
---|
public final void addValueChangeListener(java.beans.PropertyChangeListener l)
The PropertyChangeEvents delivered to the listener have the name set to "value". In other words, the listeners won't get notified when a PropertyChangeEvent is fired that has a null object as the name to indicate an arbitrary set of the event source's properties have changed.
In the rare case, where you want to notify a PropertyChangeListener even with PropertyChangeEvents that have no property name set, you can register the listener with #addPropertyChangeListener, not #addValueChangeListener.
addValueChangeListener
in interface ValueModel
l
- the listener to addValueModel
public final void removeValueChangeListener(java.beans.PropertyChangeListener l)
removeValueChangeListener
in interface ValueModel
l
- the listener to removepublic final void fireValueChange(java.lang.Object oldValue, java.lang.Object newValue)
oldValue
- the value before the changenewValue
- the value after the changePropertyChangeSupport
public final void fireValueChange(java.lang.Object oldValue, java.lang.Object newValue, boolean checkIdentity)
The boolean parameter specifies whether differences between the old
and new value are tested using ==
or #equals
.
oldValue
- the value before the changenewValue
- the value after the changecheckIdentity
- true to compare the old and new value using
==
, false to use #equals
PropertyChangeSupport
public final void fireValueChange(boolean oldValue, boolean newValue)
oldValue
- the boolean value before the changenewValue
- the boolean value after the changePropertyChangeSupport
public final void fireValueChange(int oldValue, int newValue)
oldValue
- the int value before the changenewValue
- the int value after the changePropertyChangeSupport
public final void fireValueChange(long oldValue, long newValue)
oldValue
- the long value before the changenewValue
- the long value after the changePropertyChangeSupport
public final void fireValueChange(double oldValue, double newValue)
oldValue
- the double value before the changenewValue
- the double value after the changePropertyChangeSupport
public final void fireValueChange(float oldValue, float newValue)
oldValue
- the float value before the changenewValue
- the float value after the changePropertyChangeSupport
public final boolean booleanValue()
boolean
.
boolean
value
java.lang.ClassCastException
- if the observed value is not of type
Boolean
java.lang.NullPointerException
- if the value is null
public final double doubleValue()
double
.
double
value
java.lang.ClassCastException
- if the observed value is not of type
Double
java.lang.NullPointerException
- if the value is null
public final float floatValue()
float
.
float
value
java.lang.ClassCastException
- if the observed value is not of type
Float
java.lang.NullPointerException
- if the value is null
public final int intValue()
int
.
int
value
java.lang.ClassCastException
- if the observed value is not of type
Integer
java.lang.NullPointerException
- if the value is null
public final long longValue()
long
.
long
value
java.lang.ClassCastException
- if the observed value is not of type
Long
java.lang.NullPointerException
- if the value is null
public java.lang.String getString()
String
.
java.lang.ClassCastException
- if the observed value is not of type
String
public final void setValue(boolean b)
boolean
to a Boolean
and
sets it as new value.
b
- the value to be converted and set as new valuepublic final void setValue(double d)
double
to a Double
and
sets it as new value.
d
- the value to be converted and set as new valuepublic final void setValue(float f)
float
to a Float
and
sets it as new value.
f
- the value to be converted and set as new valuepublic final void setValue(int i)
int
to an Integer
and
sets it as new value.
i
- the value to be converted and set as new valuepublic final void setValue(long l)
long
to a Long
and
sets it as new value.
l
- the value to be converted and set as new valuepublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |