org.barracudamvc.core.comp
Class BAction

java.lang.Object
  extended by org.barracudamvc.core.comp.AbstractBComponent
      extended by org.barracudamvc.core.comp.BComponent
          extended by org.barracudamvc.core.comp.BAction
All Implemented Interfaces:
Attrs, BContainer, StateMap
Direct Known Subclasses:
BLink

public class BAction
extends BComponent

A BAction component is a component that you can use to catch client side events. It can be used to render <a>, <form>, <button>, <input>, and <select> elements. It allow you to specify a specific action to be generated, or can simply default to what's in the template markup. You can also add event listeners directly to the component, and only those particular listeners will be notified when the event actually occurs on the client.

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  ControlEvent actionEvent
           
protected  String actionUrl
           
protected  boolean disableBackButton
           
protected  boolean disableFormLocking
           
protected  List listeners
           
protected static org.apache.log4j.Logger logger
           
protected  Map params
           
protected  Collection scriptFunctions
           
 
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
BAction()
          Public noargs constructor
BAction(ControlEvent iactionEvent)
          Public constructor which creates the component and binds it to a view.
BAction(String iactionUrl)
          Public constructor which creates the component and binds it to a view.
 
Method Summary
 BAction addEventListener(ListenerFactory lf)
          Add an event listener to this component.
 BAction addScriptFunction(String functionName)
          stores a Set of client-side script functions for use by the HTMLActionRenderer .
 String getAction(ViewContext vc)
          Get the action to be fired by this component.
 String getAction(ViewContext vc, boolean preventRewriting)
          Get the action to be fired by this component.
 boolean getDisableBackButton()
          Deprecated. csc_033005_1 - this functionality does not work in Firefox or Mozilla, due to the fact that those browsers ALWAYS add an item to the browser history when a form is submitted, even if that post occurs in an IFRAME. This still does work in IE.
 boolean getDisableFormLocking()
          Get disable form locking
 Map getParams()
          Get any associated params
 Collection getScriptFunctions()
          provides access any custom script functions added to a BAction component
 boolean hasAction()
          Check for an existing action
 BAction removeEventListener(ListenerFactory lf)
          Remove an event listener from this component
 BAction setAction(ControlEvent iactionEvent)
          Set the action to be fired by this component.
 BAction setAction(String iactionUrl)
          Set the action to be fired by this component.
 BAction setDisableBackButton(boolean idisableBackButton)
          Deprecated. csc_033005_1 - this functionality does not work in Firefox or Mozilla, due to the fact that those browsers ALWAYS add an item to the browser history when a form is submitted, even if that post occurs in an IFRAME. This still does work in IE.
 BAction setDisableFormLocking(boolean idisableFormLocking)
          Set disable form locking
 BAction setParam(String key, String val)
          Set any associated params
 BAction setParam(String key, String[] val)
          Set any associated list of params
 
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, 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, 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

actionEvent

protected ControlEvent actionEvent

actionUrl

protected String actionUrl

listeners

protected List listeners

params

protected Map params

scriptFunctions

protected Collection scriptFunctions

disableBackButton

protected boolean disableBackButton

disableFormLocking

protected boolean disableFormLocking
Constructor Detail

BAction

public BAction()
Public noargs constructor


BAction

public BAction(String iactionUrl)
Public constructor which creates the component and binds it to a view. Also allows you to specify that a custom url be fired.

Parameters:
iactionUrl - the action url to be fired

BAction

public BAction(ControlEvent iactionEvent)
Public constructor which creates the component and binds it to a view. Also allows you to specify that a custom event be fired.

Parameters:
iactionEvent - the action event to be fired
Method Detail

setAction

public BAction setAction(String iactionUrl)
Set the action to be fired by this component.

Parameters:
iactionUrl - the URL representing the action to be fired

setAction

public BAction setAction(ControlEvent iactionEvent)
Set the action to be fired by this component.

Parameters:
iactionEvent - the event to be fired by this component

hasAction

public boolean hasAction()
Check for an existing action

Returns:
true if either the action (either URL or Event) has been set

getAction

public String getAction(ViewContext vc)
Get the action to be fired by this component. The action will either be the URL or the Event that backs this component

Parameters:
vc - the ViewContext that determines the context of the action
Returns:
a string representing the action to be fired by this component

getAction

public String getAction(ViewContext vc,
                        boolean preventRewriting)
Get the action to be fired by this component. The action will either be the URL or the Event that backs this component

Parameters:
vc - the ViewContext that determines the context of the action
preventRewriting - this should be set to true only if you want to prevent URLRewriting from taking place. As a developer, you will probably never need to do this, unless to need to further modify the action prior to finally encoding it (HTMLActionRenderer does this)
Returns:
a string representing the action to be fired by this component

setParam

public BAction setParam(String key,
                        String val)
Set any associated params


setParam

public BAction setParam(String key,
                        String[] val)
Set any associated list of params


getParams

public Map getParams()
Get any associated params


addScriptFunction

public BAction addScriptFunction(String functionName)
stores a Set of client-side script functions for use by the HTMLActionRenderer . These script functions are javascript function names. The constraints for these functions is that they take a form element as an argument (or no arguments) and that it returns a boolean. These functions are called in the order given and can be used for custom client-side form validation.

Parameters:
functionName - the name of the javascript function with no parenthasis
Since:
1.2

getScriptFunctions

public Collection getScriptFunctions()
provides access any custom script functions added to a BAction component

Returns:
a Set of script functions or null if none added
Since:
1.2
See Also:
addScriptFunction(String)

setDisableBackButton

public BAction setDisableBackButton(boolean idisableBackButton)
Deprecated. csc_033005_1 - this functionality does not work in Firefox or Mozilla, due to the fact that those browsers ALWAYS add an item to the browser history when a form is submitted, even if that post occurs in an IFRAME. This still does work in IE.

Set disable back button (only works if your client supports Javascript)

Parameters:
idisableBackButton - true if we want the back button disabled

getDisableBackButton

public boolean getDisableBackButton()
Deprecated. csc_033005_1 - this functionality does not work in Firefox or Mozilla, due to the fact that those browsers ALWAYS add an item to the browser history when a form is submitted, even if that post occurs in an IFRAME. This still does work in IE.

Get disable back button

Returns:
true if we want the back button disabled

setDisableFormLocking

public BAction setDisableFormLocking(boolean idisableFormLocking)
Set disable form locking

Parameters:
idisableFormLocking - true to disable locking the form elements during submit.
Since:
saw_082603_2

getDisableFormLocking

public boolean getDisableFormLocking()
Get disable form locking

Returns:
true if we want to disable locking the form elements during submit.
Since:
saw_082603_2

addEventListener

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

Parameters:
lf - the event listener to be added

removeEventListener

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

Parameters:
lf - the event listener to be removed


Copyright © 2006 BarracudaMVC.org All Rights Reserved.