|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ilog.webui.dhtml.IlxWContainer ilog.webui.dhtml.IlxWComponent ilog.webui.dhtml.components.IlxWActionHolder
public class IlxWActionHolder
An action holder is a hidden component that holds an action
(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 Form
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ilog.webui.dhtml.IlxWComponent |
---|
IlxWComponent.DynamicStyleMap |
Field Summary |
---|
Fields inherited from class ilog.webui.dhtml.IlxWContainer |
---|
listenerList |
Constructor Summary | |
---|---|
IlxWActionHolder()
Constructs a new action holder. |
|
IlxWActionHolder(IlxWAction action)
Constructs a new action holder with the given action. |
Method Summary | |
---|---|
protected void |
doPrint(IlxWPort port)
|
IlxWAction |
getAction()
Gets the action held by this action holder. |
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. |
String |
getJSPerformCall(IlxWPort port)
Calls the action with no argument. |
String |
getJSPerformCall(IlxWPort port,
String arg)
Calls the action with one argument. |
String |
getJSPerformCall(IlxWPort port,
String[] args)
Generates a JavaScript instruction whose evaluation performs a call to the action associated with this action holder. |
String |
getJSPerformCall(IlxWPort port,
String arg1,
String arg2)
Calls the action with two arguments. |
String |
getJSPerformCall(IlxWPort port,
String arg1,
String arg2,
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. |
Methods inherited from class ilog.webui.dhtml.IlxWComponent |
---|
addPropertyChangeListener, addPropertyChangeListener, detach, firePropertyChange, firePropertyChange, getName, getRealHtmlTagName, getStyle, invalidate, isInvalidated, print, removePropertyChangeListener, removePropertyChangeListener, setName, validate |
Methods inherited from class ilog.webui.dhtml.IlxWContainer |
---|
add, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, getUserAgentRules, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IlxWActionHolder()
null
.
public IlxWActionHolder(IlxWAction action)
Method Detail |
---|
public void setAction(IlxWAction action)
action
- The action to be performed.public IlxWAction getAction()
protected void doPrint(IlxWPort port) throws IOException
doPrint
in class IlxWComponent
IOException
protected void printComponent(IlxWPort port) throws IOException
IlxWComponent
IlxWComponent.print(ilog.webui.dhtml.IlxWPort)
method.
printComponent
in class IlxWComponent
IOException
port
- The port on which the component will be printed.IlxWComponent.print(ilog.webui.dhtml.IlxWPort)
public String getJSIsAvailable(IlxWPort port)
port
- The port where the returned JavaScript expression will be
printed.
public String getJSPerformCall(IlxWPort port, 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 String getJSPerformCall(IlxWPort port)
port
- The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)
public String getJSPerformCall(IlxWPort port, String arg)
port
- The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)
public String getJSPerformCall(IlxWPort port, String arg1, String arg2)
port
- The port where the returned JavaScript instruction will be
printed.getJSPerformCall(IlxWPort, java.lang.String [] args)
public String getJSPerformCall(IlxWPort port, String arg1, String arg2, 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.IlxWDependencyProvider
notifyDependencies
in class IlxWComponent
|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |