org.barracudamvc.core.comp
Class BLabel

java.lang.Object
  extended by org.barracudamvc.core.comp.AbstractBComponent
      extended by org.barracudamvc.core.comp.BComponent
          extended by org.barracudamvc.core.comp.BLabel
All Implemented Interfaces:
Attrs, BContainer, StateMap

public class BLabel
extends BComponent

BLabel is used for rendering a LABEL tag. It will use the label node it is bound to, or will override the node with its default label node when returned from a model.
If a BLabel has a BInput child, it will then set the BInput's id attribute to BLabel's forId value.
Beware, 'id's should be unique in a HTML document !


Field Summary
protected  String forId
           
protected static org.apache.log4j.Logger log
           
protected  String text
           
 
Fields inherited from class org.barracudamvc.core.comp.BComponent
DEFAULT_ENCODING, enabled, enc, logger, 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
BLabel()
          Public noargs constructor
BLabel(String label, BInput bi)
          Public constructor which creates the component, add a BInput as child and sets forId to BInput's name.
BLabel(String text, String id)
          Public constructor which creates the component, and sets label and forId.
 
Method Summary
 BContainer addChild(BContainer child)
          Overrides addChild in BContainer, to check if the added child is a BInput.
 String getForId()
          Get the forId attribute for this label component
 String getText()
          Get the text for this particular component
 BLabel setForId(String id)
          Set the forId attribute for this label component
 BLabel setText(String itext)
          Set the label text for this particular component
 String toString()
          Get a String representation of 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
addStepChild, addStepChild, addTempView, clearState, destroyCycle, findComponentMap, findRendererFactory, getAttr, getAttrMap, getChild, getChildren, getDefaultViewContext, getParent, getRenderer, getRenderer, getRendererFactory, getRootComponent, getState, getStateKeys, getStateStore, hasChildren, hasViews, initCycle, installRendererFactory, invalidate, isStepChild, printStackTrace, printStackTrace, printStackTrace, putState, removeAll, removeAllStepChildren, removeChild, removeChild, removeState, setAttr, setDefaultViewContext, setParent, toRef, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log

text

protected String text

forId

protected String forId
Constructor Detail

BLabel

public BLabel()
Public noargs constructor


BLabel

public BLabel(String label,
              BInput bi)
Public constructor which creates the component, add a BInput as child and sets forId to BInput's name. It will also set the Binput id attr to thesame value.

Parameters:
label - the label string that backs this component
bi - the BInput this label refers to

BLabel

public BLabel(String text,
              String id)
Public constructor which creates the component, and sets label and forId. It can be used if BLabel is returned to refer to a static input field. A BInput can also be added later, and it will have its id set to forId.

Parameters:
label - the label string that backs this component
id - the forId attribute of BLabel. Should refer to the id of an input
Method Detail

addChild

public BContainer addChild(BContainer child)
Overrides addChild in BContainer, to check if the added child is a BInput. If it is the case, the id attribute of the child will be set to forId.

Specified by:
addChild in interface BContainer
Overrides:
addChild in class AbstractBComponent
Parameters:
child - the child container to be added

setText

public BLabel setText(String itext)
Set the label text for this particular component

Parameters:
itext - the text of this label

getText

public String getText()
Get the text for this particular component

Returns:
the text for this particular label

setForId

public BLabel setForId(String id)
Set the forId attribute for this label component

Parameters:
id - the forId attribute for this label component

getForId

public String getForId()
Get the forId attribute for this label component

Returns:
forId the forId attribute for this label component

toString

public String toString()
Get a String representation of the component

Overrides:
toString in class AbstractBComponent
Returns:
a String representation of the component


Copyright © 2006 BarracudaMVC.org All Rights Reserved.