org.enhydra.barracuda.contrib.dbroggisch.display
Class IterativeListModel
java.lang.Object
org.enhydra.barracuda.core.comp.AbstractTemplateModel
org.enhydra.barracuda.contrib.dbroggisch.display.IterativeListModel
- All Implemented Interfaces:
- Contextual, IterativeModel, Model, TemplateModel
- public class IterativeListModel
- extends AbstractTemplateModel
- implements IterativeModel
Support class to build IterativeModels
Use this class to build IterativeModels bassed on arbitrary Lists.
The class will iterate over the List and store the current item
in the _current variable.
To make this class work, you will have to subclass it and provide a
getItem implementation.
A possible usage as anonymous inner class could look like this:
IterativeListModel ilm = new IterativeListModel() {
public Object getItem(Strink key) {
if(key.equals("MYKEY"))= {
return _current;
}
}}
If the List is of type TemplateModel, it could look like this:
IterativeListModel ilm = new IterativeListModel() {
public Object getItem(Strink key) {
return ((TemplateModel)_current).getItem(key);
}
}}
- Version:
- 1.0
- Author:
- Diez B. Roggisch
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_current
protected Object _current
- The current item of the list.
IterativeListModel
public IterativeListModel(String name,
List models)
- Creates a new
IterativeListModel
instance.
- Parameters:
name
- a String
valuemodels
- a List
value
IterativeListModel
public IterativeListModel(String name)
- Creates a new
IterativeListModel
instance.
- Parameters:
name
- a String
value
IterativeListModel
public IterativeListModel()
- Creates a new
IterativeListModel
instance.
setName
public void setName(String name)
- Sets the modelname
- Parameters:
name
- a String
value
getName
public String getName()
- getName.
- Specified by:
getName
in interface TemplateModel
- Returns:
- a
String
value
getModels
public List getModels()
- Gets the value of _models
- Returns:
- the value of _models
setModels
public void setModels(List arg_models)
- Sets the value of _models
- Parameters:
arg_models
- Value to assign to this._models
add
public void add(Object val)
- Describe
add
method here.
- Parameters:
val
- an Object
value
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface IterativeModel
preIterate
public void preIterate()
- Specified by:
preIterate
in interface IterativeModel
postIterate
public void postIterate()
- Specified by:
postIterate
in interface IterativeModel
loadNext
public void loadNext()
- Specified by:
loadNext
in interface IterativeModel
Copyright © 2003 BarracudaMVC.org All Rights Reserved.