org.barracudamvc.core.comp
Interface BlockIterator

All Known Implementing Classes:
AbstractBlockIterator

public interface BlockIterator

This interface defines the methods necessary to implement a BlockIterator


Field Summary
static String BLOCK_ITERATOR_CONTEXT
           
 
Method Summary
 String getName()
          Get the block iterator name (from the block iterator template directive)
 Object getTemplateModels()
          Provide the template models which back this iterator.
 boolean hasNext()
          Allows the developer to return true if there are more rows to be processed
 void invalidateTemplateModels()
          Clear the current template models (which will cause the component to be repopulated using getTemplateModels()
 boolean loadNext()
          Actually allows developer to increment forward in the data layer.
 Node next(ViewContext vc, Node templateNode)
          Asks the developer to process a node (given the current data layer context)
 void postIterate()
          Gets called after iteration is complete.
 void preIterate()
          Gets called prior to iteration.
 void setName(String name)
          Set the block iterator name (from the block iterator template directive)
 void updateTemplateModels(Object templateModels)
          Provide a method to immeditately force an update on the model(s) that back this iterator.
 

Field Detail

BLOCK_ITERATOR_CONTEXT

static final String BLOCK_ITERATOR_CONTEXT
Method Detail

setName

void setName(String name)
Set the block iterator name (from the block iterator template directive)


getName

String getName()
Get the block iterator name (from the block iterator template directive)


preIterate

void preIterate()
Gets called prior to iteration. If you override this method, its always good practice to call super.preIterate() just to be safe.


hasNext

boolean hasNext()
Allows the developer to return true if there are more rows to be processed


loadNext

boolean loadNext()
Actually allows developer to increment forward in the data layer. Returning false here just means 'skip this particular iteration'


next

Node next(ViewContext vc,
          Node templateNode)
          throws RenderException
Asks the developer to process a node (given the current data layer context)

Throws:
RenderException

getTemplateModels

Object getTemplateModels()
Provide the template models which back this iterator. This may be an individual TemplateModel, or a List of such models. By default, this method is only called ONCE for the entire iteration (ie. models reused across each item in the iteration). If you want to update the models as you go, you need to either call invalidateModels() or updateModel(TemplateModel) (and the best place to do this is in the loadNext() method)


postIterate

void postIterate()
Gets called after iteration is complete. If you override this method, you MUST call super.postIterate() to allow the parent class a chance to perform cleanup


invalidateTemplateModels

void invalidateTemplateModels()
Clear the current template models (which will cause the component to be repopulated using getTemplateModels()


updateTemplateModels

void updateTemplateModels(Object templateModels)
Provide a method to immeditately force an update on the model(s) that back this iterator. The object passed may either be a single TemplateModel or a List of such models.



Copyright © 2006 BarracudaMVC.org All Rights Reserved.