com.cc.framework.ui.control
Class ControlAction

java.lang.Object
  extended bycom.cc.framework.ui.control.ControlAction
All Implemented Interfaces:
ActionBehavior

public class ControlAction
extends java.lang.Object
implements ActionBehavior

This class encapsulate an action which is triggered by a control

Since:
1.0
Version:
$Revision: 1.44 $
Author:
Harald Schulz

Field Summary
static java.lang.String ACTION_INPUT_CONTROL
          Hidden form field for the control action invocation string
static java.lang.String ACTION_URL_ACTION
          URL parameter for the action name
static java.lang.String ACTION_URL_CONTROL
          URL parameter for the control name
static java.lang.String ACTION_URL_PARAMETER
          URL parameter for the parameter list
private  ControlActionDef actiondef
          The base parameter definition
private  java.lang.String actionName
          The action to which should be forwarded
private  boolean ajax
          Indicates that additional AJAX script handlers should be attached to this command
private  java.lang.String controlName
          The controls name
private  boolean formElement
          This flag indicates if this Action should be rendered as a hyperlink or input field
private  int insertPos
          position used to insert the next parameter into the array.
private  java.lang.Object[] parameter
          Array with parameters for the action
private  boolean transaction
          Indicates if the transaction token (if any) should be generated for this hyperlink.
 
Constructor Summary
ControlAction(ControlActionDef action, Control control)
          Constructor of ControlAction The instance is initialized with the action definition.
ControlAction(ControlActionDef action, Control control, java.lang.String actionName)
          Constructor of ControlAction The instance is initialized with the action definition.
 
Method Summary
private  void addActionParams(Hyperlink link)
          Adds the action parameters to the given hyperlink
 void addParameter(boolean value)
          Adds a parameter
 void addParameter(java.lang.Boolean value)
          Adds a parameter
 void addParameter(int value)
          Adds a parameter
 void addParameter(java.lang.Integer value)
          Adds a parameter
 void addParameter(long value)
          Adds a parameter
 void addParameter(java.lang.Long value)
          Adds a parameter
 void addParameter(java.lang.Object obj)
          Adds a parameter
 void addParameter(java.lang.String value)
          Adds a parameter
 java.lang.String createHref(javax.servlet.jsp.PageContext pageContext)
          Creates a hyperlink
 Hyperlink createHyperlink(javax.servlet.jsp.PageContext pageContext)
          Creates a hyperlink
 java.lang.String createSubmitHandler(javax.servlet.jsp.PageContext pageContext)
          Creates a JavaScript Submit handler for the enclosing form
 java.lang.String createSubmitHandler(javax.servlet.jsp.PageContext pageContext, java.lang.String userScript)
          Creates a JavaScript Submit handler for the enclosing form
 void enableAjax(boolean enable)
           
 boolean equals(java.lang.Object obj)
           
 ControlActionDef getActionDef()
          Returns the action definition (the actions prototype)
private static java.lang.String getActionMappingURL(javax.servlet.jsp.PageContext pageContext, java.lang.String action)
          Method getActionMappingURL
 boolean getTransaction()
          Checks if the framework should include a transaction token (if any) in all generated hyperlinks for this action.
 boolean isAjaxEnabled()
          This method checks if the element should send AJAX requests to the server
 boolean isFormAction()
          Check if the action is a form action.
 void setBehavior(ActionBehavior behavior)
          Sets some information about how action should behave on the client.
 void setTransaction(boolean enable)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_INPUT_CONTROL

public static final java.lang.String ACTION_INPUT_CONTROL
Hidden form field for the control action invocation string

See Also:
Constant Field Values

ACTION_URL_CONTROL

public static final java.lang.String ACTION_URL_CONTROL
URL parameter for the control name

See Also:
Constant Field Values

ACTION_URL_ACTION

public static final java.lang.String ACTION_URL_ACTION
URL parameter for the action name

See Also:
Constant Field Values

ACTION_URL_PARAMETER

public static final java.lang.String ACTION_URL_PARAMETER
URL parameter for the parameter list

See Also:
Constant Field Values

controlName

private java.lang.String controlName
The controls name


actionName

private java.lang.String actionName
The action to which should be forwarded


formElement

private boolean formElement
This flag indicates if this Action should be rendered as a hyperlink or input field


transaction

private boolean transaction
Indicates if the transaction token (if any) should be generated for this hyperlink.


ajax

private boolean ajax
Indicates that additional AJAX script handlers should be attached to this command


actiondef

private ControlActionDef actiondef
The base parameter definition


parameter

private java.lang.Object[] parameter
Array with parameters for the action


insertPos

private int insertPos
position used to insert the next parameter into the array.

Constructor Detail

ControlAction

public ControlAction(ControlActionDef action,
                     Control control)
Constructor of ControlAction The instance is initialized with the action definition. So a the types of the parameters can be checked.

Parameters:
action - ControlActionDef
control - Control

ControlAction

public ControlAction(ControlActionDef action,
                     Control control,
                     java.lang.String actionName)
Constructor of ControlAction The instance is initialized with the action definition. So a the types of the parameters can be checked.

Parameters:
action - ControlActionDef
control - Control
actionName - Name
Method Detail

getActionDef

public ControlActionDef getActionDef()
Returns the action definition (the actions prototype)

Returns:
Returns the action definition.

setBehavior

public void setBehavior(ActionBehavior behavior)
Sets some information about how action should behave on the client.

Parameters:
behavior - behavior information.

getActionMappingURL

private static java.lang.String getActionMappingURL(javax.servlet.jsp.PageContext pageContext,
                                                    java.lang.String action)
Method getActionMappingURL

Parameters:
pageContext - PageContext
action - Action
Returns:
String see org.apache.struts.util.RequestUtils#getActionMappingURL(String, PageContext)

isFormAction

public boolean isFormAction()
Check if the action is a form action. A form action always generates a form-submit handler

Returns:
boolean true if it's a form action

addParameter

public void addParameter(java.lang.Object obj)
Adds a parameter

Parameters:
obj - Object

addParameter

public void addParameter(java.lang.String value)
Adds a parameter

Parameters:
value - Value

addParameter

public void addParameter(java.lang.Integer value)
Adds a parameter

Parameters:
value - Value

addParameter

public void addParameter(int value)
Adds a parameter

Parameters:
value - Value

addParameter

public void addParameter(java.lang.Long value)
Adds a parameter

Parameters:
value - Value

addParameter

public void addParameter(long value)
Adds a parameter

Parameters:
value - Value

addParameter

public void addParameter(java.lang.Boolean value)
Adds a parameter

Parameters:
value - Value

addParameter

public void addParameter(boolean value)
Adds a parameter

Parameters:
value - Value

addActionParams

private void addActionParams(Hyperlink link)
Adds the action parameters to the given hyperlink

Parameters:
link - Hyperlink

createHyperlink

public Hyperlink createHyperlink(javax.servlet.jsp.PageContext pageContext)
Creates a hyperlink

Parameters:
pageContext - PageContext
Returns:
Hyperlink

createHref

public java.lang.String createHref(javax.servlet.jsp.PageContext pageContext)
Creates a hyperlink

Parameters:
pageContext - PageContext
Returns:
Hyperlink String

createSubmitHandler

public java.lang.String createSubmitHandler(javax.servlet.jsp.PageContext pageContext)
Creates a JavaScript Submit handler for the enclosing form

Parameters:
pageContext - PageContext
Returns:
JavaScript code

createSubmitHandler

public java.lang.String createSubmitHandler(javax.servlet.jsp.PageContext pageContext,
                                            java.lang.String userScript)
Creates a JavaScript Submit handler for the enclosing form

Parameters:
pageContext - PageContext
userScript - String an optional user defined JavaScript code that should be executed first
Returns:
JavaScript code

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
See Also:
Object.toString()

getTransaction

public boolean getTransaction()
Description copied from interface: ActionBehavior
Checks if the framework should include a transaction token (if any) in all generated hyperlinks for this action. The Transaction token is used to track form re-submissions.

Specified by:
getTransaction in interface ActionBehavior
Returns:
true if the transaction token should be generated
See Also:
ActionBehavior.getTransaction()

isAjaxEnabled

public boolean isAjaxEnabled()
Description copied from interface: ActionBehavior
This method checks if the element should send AJAX requests to the server

Specified by:
isAjaxEnabled in interface ActionBehavior
Returns:
returns true when the control should send AJAX requests.
See Also:
ActionBehavior.isAjaxEnabled()

setTransaction

public void setTransaction(boolean enable)
Parameters:
enable - set to true to enable transaction support

enableAjax

public void enableAjax(boolean enable)
Parameters:
enable - set to true to enable AJAX support


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.