org.openfaces.component.util
Class IterationStatus

java.lang.Object
  extended by org.openfaces.component.util.IterationStatus

public class IterationStatus
extends java.lang.Object

IterationStatus is simple storage object class for OpenFaces's ForEach component class. After it is been created all it's values may be read only. It's constructor called by org.openfaces.component.foreach.ForEach class into setVarStatus() method.

See Also:
ForEach

Constructor Summary
IterationStatus(java.lang.Object current, int index, int count, boolean first, boolean last, java.lang.Integer begin, java.lang.Integer end, java.lang.Integer step)
          see constructor call sequence into setVarStatus() method of org.openfaces.component.foreach.ForEach class.
 
Method Summary
 java.lang.Integer getBegin()
          Returns the value of the 'begin' tag attribute's value, or null if no 'begin' attribute was specified.
 int getCount()
          Retrieves the "count" of the current round of the iteration.
 java.lang.Object getCurrent()
          Retrieves the current item in the value-bound collection of data.
 java.lang.Integer getEnd()
          Returns the value of the 'end' tag attribute's value, or null if no 'end' attribute was specified.
 int getIndex()
          Retrieves the index of the current round of the iteration.
 java.lang.Integer getStep()
          Returns the value of the 'step' tag attribute's value, or null if no 'step' attribute was specified.
 boolean isFirst()
          Returns information about whether the current round of the iteration is the first one.
 boolean isLast()
          Returns information about whether the current round of the iteration is the last one.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterationStatus

public IterationStatus(java.lang.Object current,
                       int index,
                       int count,
                       boolean first,
                       boolean last,
                       java.lang.Integer begin,
                       java.lang.Integer end,
                       java.lang.Integer step)
see constructor call sequence into setVarStatus() method of org.openfaces.component.foreach.ForEach class.

Parameters:
current - is current iterated object in the value-bound collection of data. If no value-bound collection is exist current must be a null.
index - is index of current iteration. If value-bound data collection is specified it also the index of currend data object into collection.
count - is count of current iteration.
first - is equal true if current index is first into iteration sequence and it is equal false otherwise.
last - is equal true if current index is last into iteration sequence and it is equal false otherwise.
begin - is begin tag attribute's value of <o:forEach> tag.
end - is end tag attribute's value of <o:forEach> tag.
step - is step attribute's value of <o:forEach> tag.
See Also:
ForEach.setIterationStatus()
Method Detail

getCurrent

public java.lang.Object getCurrent()
Retrieves the current item in the value-bound collection of data.

Returns:
current item as an java.lang.Object or null if no value-bound data collection is specified.

getIndex

public int getIndex()

Retrieves the index of the current round of the iteration. If firstIndex tag attribute is specified index start from it's value. If value-bound data collection is specified it also the index of currend data object into collection.

As an example, an iteration with firstIndex = 10, lastIndex = 5, and step = -1 produces the indexes 10, 9, 8, 7, 6 and 5 in that order (of course if value-bound collection allow this indexes, or if it is not specified completely).

Returns:
current index of the iteration

getCount

public int getCount()

Retrieves the "count" of the current round of the iteration. The count is a relative, 1-based sequence number identifying the current "round" of iteration (in context with all rounds the current iteration will perform).

As an example, an iteration with begin = 5, end = 15, and step = 5 produces the counts 1, 2, and 3 in that order.

Returns:
the 1-based count of the current round of the iteration

isFirst

public boolean isFirst()
Returns information about whether the current round of the iteration is the first one. This current round may be the 'first' even when getIndex() != 0, for 'index' refers to the absolute index of the current 'item' in the context of its underlying collection. It is always that case that a true result from isFirst() implies getCount() == 1.

Returns:
true if the current round is the first in the iteration, false otherwise.

isLast

public boolean isLast()
Returns information about whether the current round of the iteration is the last one. As with isFirst(), subsetting is taken into account. isLast() is refer to whether or not the current round will be the final round of iteration.

Returns:
true if the current round is the last in the iteration, false otherwise.

getBegin

public java.lang.Integer getBegin()
Returns the value of the 'begin' tag attribute's value, or null if no 'begin' attribute was specified.

Returns:
the 'begin' value for the associated <o:forEach> tag, or null if no 'begin' attribute was specified.

getEnd

public java.lang.Integer getEnd()
Returns the value of the 'end' tag attribute's value, or null if no 'end' attribute was specified.

Returns:
the 'end' value for the associated <o:forEach> tag, or null if no 'end' attribute was specified.

getStep

public java.lang.Integer getStep()
Returns the value of the 'step' tag attribute's value, or null if no 'step' attribute was specified.

Returns:
the 'step' value for the associated <o:forEach> tag, or null if no 'step' attribute was specified.


Copyright © 1998-2010 TeamDev Ltd. All Rights Reserved.