net.xoetrope.optional.data.pojo
Class XPojoIterator

java.lang.Object
  extended by net.xoetrope.xui.data.XModel
      extended by net.xoetrope.optional.data.pojo.XPojoModel
          extended by net.xoetrope.optional.data.pojo.XPojoIterator
All Implemented Interfaces:
XIterator

public class XPojoIterator
extends XPojoModel
implements XIterator


Field Summary
protected  int curIdx
           
protected  XPojoModel[] elements
           
 
Fields inherited from class net.xoetrope.optional.data.pojo.XPojoModel
adapter, collectionElements, dataSource, dirty, elIdx, getter, getterArgValues, pojo, properties, propertyName, setter
 
Fields inherited from class net.xoetrope.xui.data.XModel
parentModel, tagName
 
Constructor Summary
XPojoIterator(XModel parent, XPojoDataSource ds)
          Creates a new instance of XPojoIterator.
 
Method Summary
 java.lang.Object current()
          Returns the model node wrapping the current element in the iteration
 java.lang.Object first()
          Returns the model node wrapping the first object from the iterated collection and resets the iteration index to 0
 java.lang.String getId()
          Gets the values of the ID attribute
 boolean hasNext()
          Indicates whether the iterator has more elements
 boolean hasPrevious()
          Indicates whether this iterator has more elements while traversing the iterated collection in the reverse direction
 java.lang.Object last()
          Returns the model node wrapping the last element of the iterated collection
 java.lang.Object next()
          Gets the model node wrapping the next element in the iterated collection
 java.lang.Object previous()
          Returns the model node wrapping the previous element in the iteration.
 void sync()
          Syncs this node with the collection that is stored in the parent node
 
Methods inherited from class net.xoetrope.optional.data.pojo.XPojoModel
append, append, clear, copyTo, executeGetter, executeSetter, get, get, get, getAttribName, getAttribute, getAttribValue, getAttribValueAsDouble, getAttribValueAsDouble, getAttribValueAsInt, getAttribValueAsString, getCollectionElements, getDataSource, getElIdx, getGetter, getGetterArguments, getNumAttributes, getNumChildren, getPojo, getPropertyName, getPropertyValue, getSetter, getValueAsDouble, getValueAsInt, getValueAsString, hasAutoId, hashCode, hasTransientAncestestor, isCollection, isDirty, isPropertyTransient, isTransient, markSubtreeAsDirty, retrieveModelNode, saveModelNode, set, set, setAttribValue, setAttribValue, setDirty, setGetter, setId, setNumChildren, setPojo, setPropertyValue, setSetter
 
Methods inherited from class net.xoetrope.xui.data.XModel
addModelListener, fireModelUpdated, getParent, getTagName, hasAutoId, prefixOutputPath, removeChildren, reset, resetAttributes, setNumAttributes, setParent, setTagName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected XPojoModel[] elements

curIdx

protected int curIdx
Constructor Detail

XPojoIterator

public XPojoIterator(XModel parent,
                     XPojoDataSource ds)
Creates a new instance of XPojoIterator.

Parameters:
parent - the parent model node wich pojo is expected to be a collection
ds - the data source object
Method Detail

sync

public void sync()
Syncs this node with the collection that is stored in the parent node

Overrides:
sync in class XPojoModel

current

public java.lang.Object current()
Returns the model node wrapping the current element in the iteration

Specified by:
current in interface XIterator
Returns:
current element

hasNext

public boolean hasNext()
Indicates whether the iterator has more elements

Specified by:
hasNext in interface XIterator
Returns:
true if the iterator has more elements, false otherwise.

next

public java.lang.Object next()
Gets the model node wrapping the next element in the iterated collection

Specified by:
next in interface XIterator
Returns:
the next element in the iteration if there is one or the current element if there is no more elements in the iteration.

first

public java.lang.Object first()
Returns the model node wrapping the first object from the iterated collection and resets the iteration index to 0

Specified by:
first in interface XIterator
Returns:
first element of the iteration

last

public java.lang.Object last()
Returns the model node wrapping the last element of the iterated collection

Specified by:
last in interface XIterator
Returns:
iteration last element

hasPrevious

public boolean hasPrevious()
Indicates whether this iterator has more elements while traversing the iterated collection in the reverse direction

Specified by:
hasPrevious in interface XIterator
Returns:
true if the iterator has more elements, false otherwise

previous

public java.lang.Object previous()
Returns the model node wrapping the previous element in the iteration.

Specified by:
previous in interface XIterator
Returns:
previous element

getId

public java.lang.String getId()
Gets the values of the ID attribute

Overrides:
getId in class XPojoModel
Returns:
the ID attribute