Class TextListModelTag.TextListModel
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.components.tags.TextListModelTag.TextListModel
-
- All Implemented Interfaces:
ListModel
- Enclosing class:
- TextListModelTag
protected static class TextListModelTag.TextListModel extends Object implements ListModel
A simple implementation of theListModel
interface that maintains a list of display texts and a list with the corresponding values. The value list can be null if no special values are needed.
-
-
Constructor Summary
Constructors Constructor Description TextListModel()
Creates a new instance ofTextListModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItem(String display, Object value)
Adds a new item to this list model.Object
getDisplayObject(int index)
Returns the display object with the given index.Class<?>
getType()
Returns the type of this model's value.Object
getValueObject(int index)
Returns the value object with the given index.void
setType(Class<?> type)
Sets the type of the values of this list model.int
size()
Returns this model's size.
-
-
-
Method Detail
-
addItem
public void addItem(String display, Object value)
Adds a new item to this list model.- Parameters:
display
- the display textvalue
- the value of this item (can be null )
-
size
public int size()
Returns this model's size.
-
getDisplayObject
public Object getDisplayObject(int index)
Returns the display object with the given index.- Specified by:
getDisplayObject
in interfaceListModel
- Parameters:
index
- the index- Returns:
- the display object with this index
-
getValueObject
public Object getValueObject(int index)
Returns the value object with the given index.- Specified by:
getValueObject
in interfaceListModel
- Parameters:
index
- the index- Returns:
- the value object with this index
-
getType
public Class<?> getType()
Returns the type of this model's value. If a type has explicitly been set, this type is returned. Otherwise the return value depends on the definition of value objects: if there are value objects, the type String is assumed, otherwise Integer.
-
setType
public void setType(Class<?> type)
Sets the type of the values of this list model.- Parameters:
type
- the type
-
-