org.barracudamvc.core.comp
Class BInput

java.lang.Object
  extended byorg.barracudamvc.core.comp.AbstractBComponent
      extended byorg.barracudamvc.core.comp.BComponent
          extended byorg.barracudamvc.core.comp.BInput
All Implemented Interfaces:
Attrs, BContainer, StateMap
Direct Known Subclasses:
BToggleButton

public class BInput
extends BComponent

BInput is used to manipulate the <input> element in a DOM template.

In most cases you will not actually need to bind the component to a view in order to use it--if you return it from a model, this will be done for you automatically. If however, you intend to use the component standalone (ie. manually attaching it to a specific node in the DOM) or inline (ie. in a toString()), then you MUST BIND IT TO A VIEW before rendering, or an error will be generated.


Field Summary
protected  BAction baction
           
static String BUTTON
           
static String CHECKBOX
           
protected  boolean disableBackButton
           
static String FILE
           
static String HIDDEN
           
static String IMAGE
           
protected  List listeners
           
protected static org.apache.log4j.Logger logger
           
static String PASSWORD
           
static String RADIO
           
static String RESET
           
static String SUBMIT
           
static String TEXT
           
protected  String type
           
protected  String value
           
 
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
BInput()
          Public noargs constructor
BInput(String itype, String iname, String ivalue)
          Public constructor which creates the component and sets the initial data.
 
Method Summary
 BInput addEventListener(ListenerFactory lf)
          Add an event listener to this component.
 BInput addEventListener(ListenerFactory lf, boolean idisableBackButton)
          Add an event listener to this component.
 BAction getAction()
          Returns the action associated with this component (if any)
 String getType()
          Get the type of input.
 String getValue()
          Get the value for this input.
protected  void preRender(ViewContext vc, int depth)
          Here in the pre-render phase we actually add BAction step children for any of the listeners that might have been added to this component
 BInput removeEventListener(ListenerFactory lf)
          Remove an event listener from this component
 BInput setAction(BAction ibaction)
          Specify an action for this component (rather than adding an even listener)
 BInput setType(String itype)
          Set the input type (TEXT, PASSWORD, SUBMIT, RESET, FILE, HIDDEN, IMAGE, BUTTON, RADIO, or CHECKBOX).
 BInput setValue(Object ivalue)
          Convenience mechanism to set the value for this input using an Object.
 BInput setValue(String ivalue)
          Set the value for this input.
 
Methods inherited from class org.barracudamvc.core.comp.BComponent
addView, decodeStr, encodeStr, getEncoding, getFirstView, getName, getRenderStrategy, getViews, isEnabled, isVisible, postRender, 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, destroyCycle, 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

TEXT

public static final String TEXT
See Also:
Constant Field Values

PASSWORD

public static final String PASSWORD
See Also:
Constant Field Values

SUBMIT

public static final String SUBMIT
See Also:
Constant Field Values

RESET

public static final String RESET
See Also:
Constant Field Values

FILE

public static final String FILE
See Also:
Constant Field Values

HIDDEN

public static final String HIDDEN
See Also:
Constant Field Values

IMAGE

public static final String IMAGE
See Also:
Constant Field Values

BUTTON

public static final String BUTTON
See Also:
Constant Field Values

RADIO

public static final String RADIO
See Also:
Constant Field Values

CHECKBOX

public static final String CHECKBOX
See Also:
Constant Field Values

listeners

protected List listeners

type

protected String type

value

protected String value

disableBackButton

protected boolean disableBackButton

baction

protected BAction baction
Constructor Detail

BInput

public BInput()
Public noargs constructor


BInput

public BInput(String itype,
              String iname,
              String ivalue)
Public constructor which creates the component and sets the initial data.

Null values may be passed in for any parameters, but if you do so you will need manually provide these values (via the accessor methods) prior to actually rendering the component

Parameters:
itype - valid input type. May be null (indicating don't render this attribute)
iname - the name of the button, or null (indicating don't render this attribute)
ivalue - a String value for the input. May be null (indicating don't render this attribute)
Method Detail

setType

public BInput setType(String itype)
Set the input type (TEXT, PASSWORD, SUBMIT, RESET, FILE, HIDDEN, IMAGE, BUTTON, RADIO, or CHECKBOX). If this value remains null, the type will default to whatever is specified in the underlying markup. If you set this value, then the type will be overridden in all the views associated with this component.

Parameters:
itype - an string value representing the size.

getType

public String getType()
Get the type of input. May return a null if the type has not been manually specified.

Returns:
the component type

setValue

public BInput setValue(Object ivalue)
Convenience mechanism to set the value for this input using an Object.

Parameters:
ivalue - the value object

setValue

public BInput setValue(String ivalue)
Set the value for this input. In most cases, the value object will simply be rendered as the 'value' attribute. If this value remains null, the type will default to whatever is specified in the underlying markup. If you set this value, then the type will be overridden in all the views associated with this component.

Parameters:
ivalue - the value object

getValue

public String getValue()
Get the value for this input. May return a null if the type has not been manually specified.

Returns:
the value for this input

setAction

public BInput setAction(BAction ibaction)
Specify an action for this component (rather than adding an even listener)

Parameters:
ibaction - the action to be fired when the BSelect is activated on the client

getAction

public BAction getAction()
Returns the action associated with this component (if any)

Returns:
the action associated with this component (if any)

addEventListener

public BInput addEventListener(ListenerFactory lf)
Add an event listener to this component.

Parameters:
lf - the event listener to be added

addEventListener

public BInput addEventListener(ListenerFactory lf,
                               boolean idisableBackButton)
Add an event listener to this component.

Parameters:
lf - the event listener to be added
idisableBackButton - true if the back button should be disabled when the action occurs

removeEventListener

public BInput removeEventListener(ListenerFactory lf)
Remove an event listener from this component

Parameters:
lf - the event listener to be removed

preRender

protected void preRender(ViewContext vc,
                         int depth)
Here in the pre-render phase we actually add BAction step children for any of the listeners that might have been added to this component

Overrides:
preRender in class BComponent


Copyright © 2004 BarracudaMVC.org All Rights Reserved.