org.barracudamvc.contrib.dbroggisch.display
Class IterativeCollectionModel
java.lang.Object
org.barracudamvc.core.comp.AbstractTemplateModel
org.barracudamvc.contrib.dbroggisch.display.IterativeCollectionModel
- All Implemented Interfaces:
- Contextual, IterativeModel, Model, TemplateModel
- Direct Known Subclasses:
- ErrorModel
public class IterativeCollectionModel
- extends AbstractTemplateModel
- implements IterativeModel
Support class to build IterativeModels
Use this class to build IterativeModels bassed on arbitrary Collections.
The class will iterate over the Collection 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:
IterativeCollectionModel ilm = new IterativeCollectionModel() {
public Object getItem(Strink key) {
if(key.equals("MYKEY"))= {
return _current;
}
}}
If the Collection is of type TemplateModel, it could look like this:
IterativeCollectionModel ilm = new IterativeCollectionModel() {
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.
IterativeCollectionModel
public IterativeCollectionModel(String name,
Collection models)
- Creates a new
IterativeCollectionModel
instance.
- Parameters:
name
- a String
valuemodels
- a Collection
value
IterativeCollectionModel
public IterativeCollectionModel(String name)
- Creates a new
IterativeCollectionModel
instance.
- Parameters:
name
- a String
value
IterativeCollectionModel
public IterativeCollectionModel()
- Creates a new
IterativeCollectionModel
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 Collection getModels()
- Gets the value of _models
- Returns:
- the value of _models
setModels
public void setModels(Collection 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 © 2006 BarracudaMVC.org All Rights Reserved.