Package io.guise.framework.model
Class ValueConverterInfoModel<V>
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.model.AbstractModel
-
- io.guise.framework.model.DefaultLabelModel
-
- io.guise.framework.model.DefaultInfoModel
-
- io.guise.framework.model.ValueConverterInfoModel<V>
-
- Type Parameters:
V
- The type of value represented by the label.
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,InfoModel
,LabelModel
,Model
public class ValueConverterInfoModel<V> extends DefaultInfoModel
An info model that converts a value to a string for the label. If no label is explicitly set, the label will represent the given value converted to a string using the given converter.- Author:
- Garret Wilson
-
-
Field Summary
-
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
-
Fields inherited from interface io.guise.framework.model.InfoModel
DESCRIPTION_CONTENT_TYPE_PROPERTY, DESCRIPTION_PROPERTY, INFO_CONTENT_TYPE_PROPERTY, INFO_PROPERTY
-
Fields inherited from interface io.guise.framework.model.LabelModel
GLYPH_URI_PROPERTY, LABEL_CONTENT_TYPE_PROPERTY, LABEL_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description ValueConverterInfoModel(V value, Converter<V,java.lang.String> converter)
Value and converter constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Converter<V,java.lang.String>
getConverter()
java.lang.String
getLabel()
V
getValue()
-
Methods inherited from class io.guise.framework.model.DefaultInfoModel
getDescription, getDescriptionContentType, getInfo, getInfoContentType, setDescription, setDescriptionContentType, setInfo, setInfoContentType
-
Methods inherited from class io.guise.framework.model.DefaultLabelModel
getGlyphURI, getLabelContentType, setGlyphURI, setLabel, setLabelContentType, toString
-
Methods inherited from class io.guise.framework.model.AbstractModel
getEventListenerManager, getPlainText
-
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, 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 io.guise.framework.model.LabelModel
getGlyphURI, getLabelContentType, setGlyphURI, setLabel, setLabelContentType
-
-
-
-
Constructor Detail
-
ValueConverterInfoModel
public ValueConverterInfoModel(V value, Converter<V,java.lang.String> converter)
Value and converter constructor.- Parameters:
value
- The value to represent as a label.converter
- The converter to use for displaying the value as a string.- Throws:
java.lang.NullPointerException
- if the given converter isnull
.
-
-
Method Detail
-
getValue
public final V getValue()
- Returns:
- The represented value.
-
getConverter
public Converter<V,java.lang.String> getConverter()
- Returns:
- The converter to use for displaying the value as a string.
-
getLabel
public java.lang.String getLabel()
- Specified by:
getLabel
in interfaceLabelModel
- Overrides:
getLabel
in classDefaultLabelModel
- Returns:
- The label text, which may include a resource reference, or
null
if there is no label text.
-
-