UIX 2.2.16

oracle.cabo.ui.action
Class ClientAction

java.lang.Object
  |
  +--oracle.cabo.ui.action.ClientAction
Direct Known Subclasses:
FireAction, LovOpenWindowAction

public abstract class ClientAction
extends java.lang.Object

The ClientAction object is used to associate client-side behavior with a UINode. The ClientAction is responsible for providing a script which can be called in response to user interaction on the client. The actual user action that results in the execution of the ClientAction's script varies from component to component. For example, the ClientAction's script might be executed in response to clicking on a link or button or selecting an item from a choice.


Constructor Summary
ClientAction()
           
 
Method Summary
 Parameter[] getParameters(RenderingContext context, UINode node)
          Returns an array of all parameters to this ClientAction.
abstract  java.lang.String getScript(RenderingContext context, UINode node, java.lang.Boolean returnVal)
          Returns the script which implements this ClientAction.
 boolean isTriggerRequired(RenderingContext context, UINode node)
          Tests whether the ClientAction should be invoked using an explicit trigger such as a button or link.
 boolean renderAsEvent(RenderingContext context, UINode node)
          Returns true if it's OK to render this ClientAction's script as an event (e.g.
 void renderTrigger(RenderingContext context, UINode node)
          Renders a trigger (a link or button) which can be used to invoke the ClientAction.
 void renderTrigger(RenderingContext context, UINode node, java.lang.Object text)
          Renders a trigger (a link or button) which can be used to invoke the ClientAction.
 void writeDependencies(RenderingContext context, UINode node)
          Called by the UIX Component rendering engine before getScript in order to give the ClientAction the opportunity to generate its client-side dependencies before getScript and in a more suitable output scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientAction

public ClientAction()
Method Detail

getScript

public abstract java.lang.String getScript(RenderingContext context,
                                           UINode node,
                                           java.lang.Boolean returnVal)
Returns the script which implements this ClientAction. The returned script is called from client-side event handlers as required by the specified UINode. The returnVal parameter determines whether the final script will return true or false
Parameters:
context - The current RenderingContext.
node - The target UINode.
returnVal - Determines whether the final script will return. true or false.

writeDependencies

public void writeDependencies(RenderingContext context,
                              UINode node)
                       throws java.io.IOException
Called by the UIX Component rendering engine before getScript in order to give the ClientAction the opportunity to generate its client-side dependencies before getScript and in a more suitable output scope.
Parameters:
context - The current RenderingContext.
node - The target UINode.

isTriggerRequired

public boolean isTriggerRequired(RenderingContext context,
                                 UINode node)
Tests whether the ClientAction should be invoked using an explicit trigger such as a button or link.

In general, ClientActions are executed in response to user interaction with an input control, such as selecting an item from a choice component or radio button group, or tabbing out of a text input component. In some cases the ClientAction may provide a script which should not be fired in response to the normal user input, but instead should only be executed in response to an explicit request from the end user. For example, the partial page rendering ClientActions revert to full page rendering in environments where partial page rendering is not supported (such as Netscape 4.x). However, performing a full page render in response to user interaction such as tabbing out of a text input component would be confusing to the end user. Instead, the isTriggerRequired() method can be used to indicate that an explicit trigger, such as a "Go" button, should be used to invoke the action.

Components which support ClientActions should call this method before calling getScript() to determine whether or not an explicit trigger is required. If isTriggerRequired() returns true, renderTrigger() should be called to render content which includes a trigger (a link or button) which invokes the action.

Components which are themselves explict triggers (link or button components) may call getScript() instead of renderTrigger() even if isTriggerRequired() returns true. In some cases the ClientAction implementation may be able to provide a script which can be invoked by link/button components, in which case an auxiliary trigger is not necessary.

Parameters:
context - The current RenderingContext.
node - The target UINode.
See Also:
renderTrigger()

renderTrigger

public void renderTrigger(RenderingContext context,
                          UINode node)
                   throws java.io.IOException
Renders a trigger (a link or button) which can be used to invoke the ClientAction.

This method should be called by components which support ClientActions when isTriggerRequired() returns true. It is up to each component to determine when/where the trigger should be rendered. For example, a choice component might render the trigger next to the choice, whereas a radio group would probably render the trigger beneath all of the radio buttons in the group. This method renders a button with the text "GO". Use the three argument method to specify alternate button text.

Parameters:
context - The current RenderingContext.
node - The target UINode.
See Also:
isTriggerRequired()

renderTrigger

public void renderTrigger(RenderingContext context,
                          UINode node,
                          java.lang.Object text)
                   throws java.io.IOException
Renders a trigger (a link or button) which can be used to invoke the ClientAction.

This method should be called by components which support ClientActions when isTriggerRequired() returns true. It is up to each component to determine when/where the trigger should be rendered. For example, a choice component might render the trigger next to the choice, whereas a radio group would probably render the trigger beneath all of the radio buttons in the group. This method renders a button with the given text.

Parameters:
context - The current RenderingContext.
node - The target UINode.
See Also:
isTriggerRequired()

getParameters

public Parameter[] getParameters(RenderingContext context,
                                 UINode node)
Returns an array of all parameters to this ClientAction. This array will include any parameters generated by this ClientAction itself (e.g. event, source), and all parameters provided by the client.
Parameters:
context - The current RenderingContext.
node - The target UINode.

renderAsEvent

public boolean renderAsEvent(RenderingContext context,
                             UINode node)
Returns true if it's OK to render this ClientAction's script as an event (e.g. onClick, onChange, etc.). If this method ever returns false, interested renderers will try to render in the best way for that renderer using the parameters returned from the getParameters() method, and other information on the parent node. As an example, the LinkRenderer might render an onClick script in the case of a formSubmitted Action, but it can render a simple href if there is nothing special to be done.
Parameters:
context - The current RenderingContext.
node - The target UINode.
See Also:
getParameters()

UIX 2.2.16