jodd.servlet.tag
Class IteratorStatus

java.lang.Object
  extended by jodd.servlet.tag.IteratorStatus

public class IteratorStatus
extends java.lang.Object

Status of iteration of some looping tag. The iterator tag can export an IteratorStatus object so that one can get information about the status of the iteration, such as:

Example

   <re:iter status="status" value='%{0, 1}'>
      Index: <s:property value="%{#status.index}" /> <br />
      Count: <s:property value="%{#status.count}" /> <br />
   </re:iter>
 

will print

      Index: 0
      Count: 1
      Index: 1
      Count: 2
 


Field Summary
protected  int count
           
protected  boolean last
           
protected  int modulus
           
 
Constructor Summary
IteratorStatus()
           
IteratorStatus(int modulus)
           
 
Method Summary
 int getCount()
          Returns current item count (1-based).
 int getIndex()
          Returns current index (zero-based).
 int getModulus()
          Returns modulus of current count.
 boolean isEven()
          Returns true if current count is even.
 boolean isFirst()
          Returns true if current item is the first one.
 boolean isLast()
          Returns true if current item is the last one.
 boolean isOdd()
          Returns true if current count is odd.
 int modulus(int operand)
          Calculates modulus of current count.
protected  void next(boolean isLast)
          Performs the iterations to the next item and specifies if this is the last iteration.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

modulus

protected final int modulus

last

protected boolean last

count

protected int count
Constructor Detail

IteratorStatus

public IteratorStatus()

IteratorStatus

public IteratorStatus(int modulus)
Method Detail

getCount

public int getCount()
Returns current item count (1-based).


getIndex

public int getIndex()
Returns current index (zero-based).


isEven

public boolean isEven()
Returns true if current count is even.


isOdd

public boolean isOdd()
Returns true if current count is odd.


modulus

public int modulus(int operand)
Calculates modulus of current count.


getModulus

public int getModulus()
Returns modulus of current count.


isFirst

public boolean isFirst()
Returns true if current item is the first one.


isLast

public boolean isLast()
Returns true if current item is the last one.


next

protected void next(boolean isLast)
Performs the iterations to the next item and specifies if this is the last iteration.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2012 Jodd Team