org.enhydra.barracuda.core.comp
Class BAction

java.lang.Object
  extended byorg.enhydra.barracuda.core.comp.AbstractBComponent
      extended byorg.enhydra.barracuda.core.comp.BComponent
          extended byorg.enhydra.barracuda.core.comp.BAction
All Implemented Interfaces:
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.enhydra.barracuda.core.comp.BComponent
attrs, enabled, name, rs, VISIBILITY_MARKER, visible
 
Fields inherited from class org.enhydra.barracuda.core.comp.AbstractBComponent
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
 void addEventListener(ListenerFactory lf)
          Add an event listener to this component.
 void 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()
          Get disable back button
 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
 void removeEventListener(ListenerFactory lf)
          Remove an event listener from this component
 void setAction(ControlEvent iactionEvent)
          Set the action to be fired by this component.
 void setAction(String iactionUrl)
          Set the action to be fired by this component.
 void setDisableBackButton(boolean idisableBackButton)
          Set disable back button (only works if your client supports Javascript)
 void setDisableFormLocking(boolean idisableFormLocking)
          Set disable form locking
 void setParam(String key, String val)
          Set any associated params
 void setParam(String key, String[] val)
          Set any associated list of params
 
Methods inherited from class org.enhydra.barracuda.core.comp.BComponent
addView, getAttr, getAttrMap, getFirstView, getName, getRenderStrategy, getViews, isEnabled, isVisible, postRender, preRender, removeAllViews, removeView, render, render, renderView, renderView, setAttr, setEnabled, setEnabled, setName, setRenderStrategy, setView, setVisible, setVisible, supports
 
Methods inherited from class org.enhydra.barracuda.core.comp.AbstractBComponent
addChild, addStepChild, addStepChild, addTempView, clearState, destroyCycle, findComponentMap, findRendererFactory, getChild, getChildren, getDefaultViewContext, getParent, getRenderer, getRenderer, getRootComponent, getState, getStateKeys, getStateValues, hasChildren, hasViews, initCycle, installRendererFactory, invalidate, isStepChild, printStackTrace, printStackTrace, printStackTrace, putState, removeAll, removeAllStepChildren, removeChild, removeChild, removeState, 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 void setAction(String iactionUrl)
Set the action to be fired by this component.

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

setAction

public void 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 void setParam(String key,
                     String val)
Set any associated params


setParam

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


getParams

public Map getParams()
Get any associated params


addScriptFunction

public void 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 void setDisableBackButton(boolean idisableBackButton)
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()
Get disable back button

Returns:
true if we want the back button disabled

setDisableFormLocking

public void 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 void addEventListener(ListenerFactory lf)
Add an event listener to this component.

Parameters:
lf - the event listener to be added

removeEventListener

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

Parameters:
lf - the event listener to be removed


Copyright © 2003 BarracudaMVC.org All Rights Reserved.