com.jgoodies.binding.value
Class ConverterFactory.BooleanToStringConverter

java.lang.Object
  extended by com.jgoodies.common.bean.AbstractBean
      extended by com.jgoodies.binding.beans.Model
          extended by com.jgoodies.binding.value.AbstractValueModel
              extended by com.jgoodies.binding.value.AbstractWrappedValueModel
                  extended by com.jgoodies.binding.value.AbstractConverter
                      extended by com.jgoodies.binding.value.ConverterFactory.BooleanToStringConverter
All Implemented Interfaces:
ComponentModel, ComponentValueModel, ValueModel, com.jgoodies.common.bean.ObservableBean, com.jgoodies.common.bean.ObservableBean2, Serializable
Enclosing class:
ConverterFactory

public static final class ConverterFactory.BooleanToStringConverter
extends AbstractConverter

Converts Booleans to Strings and vice-versa using given texts for true, false, and null. Throws a ClassCastException if the value to convert is not a Boolean, or not a String for the reverse conversion.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jgoodies.binding.value.AbstractConverter
subject
 
Fields inherited from class com.jgoodies.binding.value.AbstractValueModel
PROPERTYNAME_VALUE
 
Fields inherited from class com.jgoodies.common.bean.AbstractBean
changeSupport
 
Fields inherited from interface com.jgoodies.binding.value.ComponentValueModel
PROPERTYNAME_EDITABLE, PROPERTYNAME_ENABLED, PROPERTYNAME_VISIBLE
 
Fields inherited from interface com.jgoodies.binding.value.ComponentModel
PROPERTY_EDITABLE, PROPERTY_ENABLED, PROPERTY_VISIBLE
 
Method Summary
 Object convertFromSubject(Object subjectValue)
          Converts the subject value to associated text representation.
 void setValue(Object newValue)
          Converts the given String and sets the associated Boolean as the subject's new value.
 
Methods inherited from class com.jgoodies.binding.value.AbstractConverter
createValueChangeHandler, getValue
 
Methods inherited from class com.jgoodies.binding.value.AbstractWrappedValueModel
getWrappee, isEditable, isEnabled, isVisible, release, setEditable, setEnabled, setVisible
 
Methods inherited from class com.jgoodies.binding.value.AbstractValueModel
addValueChangeListener, booleanValue, doubleValue, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, floatValue, getString, intValue, longValue, paramString, removeValueChangeListener, setValue, setValue, setValue, setValue, setValue, toString, valueString
 
Methods inherited from class com.jgoodies.binding.beans.Model
createPropertyChangeSupport, firePropertyChange
 
Methods inherited from class com.jgoodies.common.bean.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
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
addValueChangeListener, removeValueChangeListener
 
Methods inherited from interface com.jgoodies.common.bean.ObservableBean2
addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
 
Methods inherited from interface com.jgoodies.common.bean.ObservableBean
addPropertyChangeListener, removePropertyChangeListener
 

Method Detail

convertFromSubject

public Object convertFromSubject(Object subjectValue)
Converts the subject value to associated text representation. Rejects non-Boolean values.

Specified by:
convertFromSubject in class AbstractConverter
Parameters:
subjectValue - the subject's new value
Returns:
the text that represents the subject value
Throws:
ClassCastException - if the subject's value is not a Boolean

setValue

public void setValue(Object newValue)
Converts the given String and sets the associated Boolean as the subject's new value. In case the new value equals neither this class' trueText, nor the falseText, nor the nullText, an IllegalArgumentException is thrown.

Parameters:
newValue - the value to be converted and set as new subject value
Throws:
ClassCastException - if the new value is not a String
IllegalArgumentException - if the new value does neither match the trueText nor the falseText nor the nullText


Copyright © 2002-2011 JGoodies Karsten Lentzsch. All Rights Reserved.