org.barracudamvc.core.comp
Class BTemplate

java.lang.Object
  extended byorg.barracudamvc.core.comp.AbstractBComponent
      extended byorg.barracudamvc.core.comp.BComponent
          extended byorg.barracudamvc.core.comp.BTemplate
All Implemented Interfaces:
Attrs, BCompoundComponent, BContainer, StateMap

public class BTemplate
extends BComponent
implements BCompoundComponent

A BTemplate is used to process part of a DOM as a template--the component will look for directives and then query the models to return the data associated with a given key. BTemplate essentially brings "pull-mvc" to XMLC.

In the case of BTemplate, you will ALMOST ALWAYS need to manually bind it to a View, unless you happen to be returning it from a model (in which case this will be done for you automatically)


Field Summary
protected static org.apache.log4j.Logger logger
           
protected  HashMap templateModels
           
 
Fields inherited from class org.barracudamvc.core.comp.BComponent
DEFAULT_ENCODING, enabled, enc, name, rs, VISIBILITY_MARKER, visible
 
Fields inherited from class org.barracudamvc.core.comp.AbstractBComponent
attrs, children, dvc, isStepChild, parent, statemap, stepChildren, tempViews, validated, views
 
Constructor Summary
BTemplate()
          Public noargs constructor
BTemplate(TemplateModel imodel)
          Public constructor which creates the component and binds it to a specific model.
 
Method Summary
 void addModel(TemplateModel imodel)
          Add a model to the component.
 void addModels(List ilist)
          Add a whole list of models to the component.
 void destroyCycle()
          Destroy cycle.
 TemplateModel getModel(String modelName)
          Get the model that backs the table
 List getModels()
          Get a list of models associated with this view
 void removeAllModels()
          Remove all models from the component
 void removeModel(String modelName)
          Remove a model from the component by model name
 void removeModel(TemplateModel imodel)
          Remove a model from the component.
 
Methods inherited from class org.barracudamvc.core.comp.BComponent
addView, decodeStr, encodeStr, getEncoding, getFirstView, getName, getRenderStrategy, getViews, isEnabled, isVisible, postRender, preRender, removeAllViews, removeView, render, render, renderView, renderView, setEnabled, setEnabled, setEncoding, setName, setRenderStrategy, setView, setVisible, setVisible, supports
 
Methods inherited from class org.barracudamvc.core.comp.AbstractBComponent
addChild, addStepChild, addStepChild, addTempView, clearState, findComponentMap, findRendererFactory, getAttr, getAttrMap, getChild, getChildren, getDefaultViewContext, getParent, getRenderer, getRenderer, getRootComponent, getState, getStateKeys, getStateStore, hasChildren, hasViews, initCycle, installRendererFactory, invalidate, isStepChild, printStackTrace, printStackTrace, printStackTrace, putState, removeAll, removeAllStepChildren, removeChild, removeChild, removeState, setAttr, setDefaultViewContext, setParent, toRef, toString, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

templateModels

protected HashMap templateModels
Constructor Detail

BTemplate

public BTemplate()
Public noargs constructor


BTemplate

public BTemplate(TemplateModel imodel)
Public constructor which creates the component and binds it to a specific model. You will need to manually set the View if you use this constructor.

Parameters:
imodel - the specific model to back this component
Method Detail

addModel

public void addModel(TemplateModel imodel)
Add a model to the component. Unlike other components, the template component can have ant number of models...

Parameters:
imodel - a model that backs the template

addModels

public void addModels(List ilist)
Add a whole list of models to the component.

Parameters:
ilist - a list of TemplateModels to back the component

removeModel

public void removeModel(TemplateModel imodel)
Remove a model from the component.

Parameters:
imodel - a model that backs the template

removeModel

public void removeModel(String modelName)
Remove a model from the component by model name

Parameters:
modelName - the name of the model to be removed

removeAllModels

public void removeAllModels()
Remove all models from the component


getModel

public TemplateModel getModel(String modelName)
Get the model that backs the table

Parameters:
modelName - the name of the model we're interested in

getModels

public List getModels()
Get a list of models associated with this view

Returns:
a list of models associated with this view

destroyCycle

public void destroyCycle()
Destroy cycle. The component should use this cycle to perform any special cleanup.

Overrides:
destroyCycle in class AbstractBComponent


Copyright © 2004 BarracudaMVC.org All Rights Reserved.