public class IlxWActionHolder extends IlxWComponent
IlxWAction) that can be triggered by the program.
This means that once printed, it has no graphical representation
on the web browser.
Action holders provide the user with a way to perform some actions on the web server and be sure that the modified component queue has been flushed to the server before the action is performed.
The getJSPerformCall(IlxWPort, java.lang.String []) method
generates a JavaScript instruction which can be executed at any time on
the client HTML page. This instruction triggers the action associated
with the action holder.
Although the action holder is a hidden component, it
must be printed to a port via its print method, otherwise the
instruction generated by getJSPerformCall will not be valid.
Furthermore, the current page may not be completely loaded when
the user tries to trigger the action. To test whether the page is
completely loaded or not, use the getJSIsAvailable(ilog.webui.dhtml.IlxWPort)
method. This method returns a JavaScript boolean expression which tells
whether the page is complete or not.
Suppose you want to write an HTML link which, when clicked, triggers the action associated with an action holder. Here is an example that uses both the getJSIsAvailable and getJSPerformCall methods:
...
IlxWActionHolder ah = new IlxWActionHolder(myAction);
ah.print(port);
...
String isAvailable = ah.getJSIsAvailable(port);
String perform = ah.getJSPerformCall(port);
String code = "if ("+isAvailable+") { "+perform+" }";
out.print("<a href=\"javascript:void(0)\" onclick=\"+code+\">");
out.print("Click Me");
out.print("</a>");
...
IlxWAction,
IlxWController,
Serialized FormIlxWComponent.DynamicStyleMaplistenerList| Constructor and Description |
|---|
IlxWActionHolder()
Constructs a new action holder.
|
IlxWActionHolder(IlxWAction action)
Constructs a new action holder with the given action.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doPrint(IlxWPort port) |
IlxWAction |
getAction()
Gets the action held by this action holder.
|
java.lang.String |
getJSIsAvailable(IlxWPort port)
Generates a JavaScript instruction whose evaluation will be a Boolean
telling whether the page where this action holder has been printed is
completely loaded or not.
|
java.lang.String |
getJSPerformCall(IlxWPort port)
Calls the action with no argument.
|
java.lang.String |
getJSPerformCall(IlxWPort port,
java.lang.String arg)
Calls the action with one argument.
|
java.lang.String |
getJSPerformCall(IlxWPort port,
java.lang.String[] args)
Generates a JavaScript instruction whose evaluation performs a call to
the action associated with this action holder.
|
java.lang.String |
getJSPerformCall(IlxWPort port,
java.lang.String arg1,
java.lang.String arg2)
Calls the action with two arguments.
|
java.lang.String |
getJSPerformCall(IlxWPort port,
java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3)
Calls the action with three arguments.
|
void |
notifyDependencies(IlxWPort port) |
protected void |
printComponent(IlxWPort port)
Prints the HTML code that will display the graphical
representation of this component.
|
void |
setAction(IlxWAction action)
Sets the action held by this action holder.
|
addPropertyChangeListener, addPropertyChangeListener, detach, firePropertyChange, firePropertyChange, getName, getRealHtmlTagName, getStyle, invalidate, isInvalidated, print, removePropertyChangeListener, removePropertyChangeListener, setName, validateadd, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, getUserAgentRules, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizerpublic IlxWActionHolder()
null.public IlxWActionHolder(IlxWAction action)
public void setAction(IlxWAction action)
action - The action to be performed.public IlxWAction getAction()
protected void doPrint(IlxWPort port) throws java.io.IOException
doPrint in class IlxWComponentjava.io.IOExceptionprotected void printComponent(IlxWPort port) throws java.io.IOException
IlxWComponentIlxWComponent.print(ilog.webui.dhtml.IlxWPort) method.printComponent in class IlxWComponentjava.io.IOExceptionport - The port on which the component will be printed.IlxWComponent.print(ilog.webui.dhtml.IlxWPort)public java.lang.String getJSIsAvailable(IlxWPort port)
port - The port where the returned JavaScript expression will be
printed.public java.lang.String getJSPerformCall(IlxWPort port, java.lang.String[] args)
If the page is not completely loaded, calling the JavaScript code
generated by getJSPerformCall may throw a JavaScript error.
It is strongly recommended to test whether the page is completely loaded
or not via the getJSIsAvailable(ilog.webui.dhtml.IlxWPort) method before executing the code
returned by this method.
args - The JavaScript arguments to pass to the call. You will
get those arguments back in the IlxWAction.perform method of
the associated action.port - The port where the returned JavaScript instruction will be
printed.getJSIsAvailable(ilog.webui.dhtml.IlxWPort),
getJSPerformCall(ilog.webui.dhtml.IlxWPort, java.lang.String[])public java.lang.String getJSPerformCall(IlxWPort port)
port - The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)public java.lang.String getJSPerformCall(IlxWPort port, java.lang.String arg)
port - The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)public java.lang.String getJSPerformCall(IlxWPort port, java.lang.String arg1, java.lang.String arg2)
port - The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)public java.lang.String getJSPerformCall(IlxWPort port, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
port - The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)public void notifyDependencies(IlxWPort port)
notifyDependencies in interface ilog.webui.dhtml.IlxWDependencyProvidernotifyDependencies in class IlxWComponent© Copyright IBM Corp. 1987, 2017