|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.impl.AbstractExecution
public abstract class AbstractExecution
A skeletal implementation of Execution.
| Field Summary |
|---|
| Fields inherited from interface org.zkoss.zk.ui.Execution |
|---|
APPEND_PARAM, IGNORE_PARAM, OVERWRITE_URI, PASS_THRU_ATTR |
| Constructor Summary | |
|---|---|
protected |
AbstractExecution(Desktop desktop,
Page creating)
Constructs an execution. |
| Method Summary | |
|---|---|
void |
addAuResponse(java.lang.String key,
AuResponse response)
Adds an asynchronous response ( AuResponse) which will be
sent to client at the end of the execution. |
Component |
createComponents(PageDefinition pagedef,
Component parent,
java.util.Map arg)
Creates components from the specified page definition. |
Component[] |
createComponents(PageDefinition pagedef,
java.util.Map arg)
Creates components that don't belong to any page from the specified page definition. |
Component |
createComponents(java.lang.String uri,
Component parent,
java.util.Map arg)
Creates components from a page file specified by an URI. |
Component[] |
createComponents(java.lang.String uri,
java.util.Map arg)
Creates components that don't belong to any page from a page file specified by an URI. |
Component |
createComponentsDirectly(org.zkoss.idom.Document content,
java.lang.String ext,
Component parent,
java.util.Map arg)
Creates components from the raw content specified by a DOM tree. |
Component[] |
createComponentsDirectly(org.zkoss.idom.Document content,
java.lang.String ext,
java.util.Map arg)
Creates components that don't belong to any page from the raw content specified by a DOM tree. |
Component |
createComponentsDirectly(java.io.Reader reader,
java.lang.String ext,
Component parent,
java.util.Map arg)
Creates components from the raw content read from the specified reader. |
Component[] |
createComponentsDirectly(java.io.Reader reader,
java.lang.String ext,
java.util.Map arg)
Creates components that don't belong to any page from the raw content read from the specified reader. |
Component |
createComponentsDirectly(java.lang.String content,
java.lang.String ext,
Component parent,
java.util.Map arg)
Creates components from the raw content specified by a string. |
Component[] |
createComponentsDirectly(java.lang.String content,
java.lang.String ext,
java.util.Map arg)
Creates components that don't belong to any page from the raw content specified by a string. |
java.util.Map |
getArg()
Returns the parameters (aka., arg) if Execution.pushArg(java.util.Map) is called recently,
or an empty map if not available. |
Page |
getCurrentPage()
Returns the current page. |
PageDefinition |
getCurrentPageDefinition()
Returns the current page definition, which is pushed when evaluating a page (from a page definition). |
Desktop |
getDesktop()
Returns the desktop for this execution. |
Event |
getNextEvent()
Returns the next event queued by Execution.postEvent(org.zkoss.zk.ui.event.Event), or null if no event queued. |
Visualizer |
getVisualizer()
Returns the Visualizer for this execution
(set by ExecutionCtrl.setVisualizer(org.zkoss.zk.ui.sys.Visualizer). |
boolean |
isActivated()
Returns whether this execution is activated. |
boolean |
isAsyncUpdate(Page page)
Returns whether this execution is asynchronous updating the specified page (thru ZK Update Engine). |
boolean |
isRecovering()
Returns whether this execution is in recovering. |
void |
onActivate()
Called when this execution is about to become the current execution Executions.getCurrent(). |
void |
onDeactivate()
Called when this execution is about to become a non-current execution. |
void |
popArg()
Pops the parameters (aka., arg) that is pushed by Execution.pushArg(java.util.Map). |
void |
postEvent(Event evt)
Queues an event to the current execution. |
void |
pushArg(java.util.Map arg)
Pushes the parameters (aka., arg) that EL could refer it by the arg variable. |
void |
sendRedirect(java.lang.String uri)
Sends a temporary redirect response to the client using the specified redirect location URL. |
void |
sendRedirect(java.lang.String uri,
java.lang.String target)
Sends a temporary redirect response to the client using the specified redirect location URL and redirect to the specified browser window. |
void |
setCurrentPage(Page curpage)
Sets the current page. |
void |
setCurrentPageDefinition(PageDefinition pgdef)
Sets the current page definition. |
void |
setDesktop(Desktop desktop)
Sets the desktop associated with this execution. |
void |
setVisualizer(Visualizer ei)
Sets the Visualizer for this execution. |
java.lang.String |
toAbsoluteURI(java.lang.String uri,
boolean skipInclude)
Converts the specified URI to an absolute URI, if uri is related and the current execution is not included ( Execution.isIncluded()). |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zk.ui.sys.ExecutionCtrl |
|---|
addDateHeader, addHeader, getRequestAttribute, setDateHeader, setHeader, setRequestAttribute |
| Constructor Detail |
|---|
protected AbstractExecution(Desktop desktop,
Page creating)
creating - which page is being creating for this execution, or
null if none is being created.
isAsyncUpdate(org.zkoss.zk.ui.Page) returns based on this.| Method Detail |
|---|
public final boolean isAsyncUpdate(Page page)
Execution
isAsyncUpdate in interface Executionpublic Desktop getDesktop()
Execution
getDesktop in interface Executionpublic void postEvent(Event evt)
Execution
postEvent in interface Executionpublic final Page getCurrentPage()
ExecutionCtrlDesign decision: we put it here because user need not to know about the conccept of the current page.
getCurrentPage in interface ExecutionCtrlDesktop.getPage(java.lang.String)public final void setCurrentPage(Page curpage)
ExecutionCtrl
setCurrentPage in interface ExecutionCtrlpublic PageDefinition getCurrentPageDefinition()
ExecutionCtrl
getCurrentPageDefinition in interface ExecutionCtrlpublic void setCurrentPageDefinition(PageDefinition pgdef)
ExecutionCtrl
setCurrentPageDefinition in interface ExecutionCtrlpgdef - the page definition. If null, it means it is the same
as getCurrentPage().getPageDefinition().public Event getNextEvent()
ExecutionCtrlExecution.postEvent(org.zkoss.zk.ui.event.Event), or null if no event queued.
getNextEvent in interface ExecutionCtrlpublic boolean isActivated()
ExecutionCtrl
isActivated in interface ExecutionCtrlpublic void onActivate()
ExecutionCtrlExecutions.getCurrent().
Note: an execution might spread over several threads, so this method might be called several times to activate the states in each thread. Also, an execution might be activated before another is deactivate. For example, when a component includes another page, the second exec is activated to render the included page.
It is used as callback notification.
Note: don't throw any exception in this method.
onActivate in interface ExecutionCtrlpublic void onDeactivate()
ExecutionCtrlIt is used as callback notification.
Note: don't throw any exception in this method.
onDeactivate in interface ExecutionCtrlExecutionCtrl.onActivate()public boolean isRecovering()
ExecutionCtrlFailoverManager.recover(org.zkoss.zk.ui.Session, org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Desktop).
If in recovering, no response is sent to the client.
It assumes the server is recovering the desktop and all it contains
to match the client's status.
isRecovering in interface ExecutionCtrlpublic void setVisualizer(Visualizer ei)
ExecutionCtrlVisualizer for this execution.
It could be anything that UiEngine requires.
setVisualizer in interface ExecutionCtrlpublic Visualizer getVisualizer()
ExecutionCtrlVisualizer for this execution
(set by ExecutionCtrl.setVisualizer(org.zkoss.zk.ui.sys.Visualizer).
getVisualizer in interface ExecutionCtrl
public java.lang.String toAbsoluteURI(java.lang.String uri,
boolean skipInclude)
ExecutionExecution.isIncluded()).
Note: an asynchrous update is processed by the update servlet. It is different from the servlet for rendering the ZUML page. In other words, a relative URI won't be interpreted correctly, so you have to invoke this method to convert them if necessary.
In addtions, RequestDispatcher.include doesn't handle related URI well.
toAbsoluteURI in interface ExecutionskipInclude - whether not to convert to an absolute URI if
the current page is included by another page.
When use the include directive, skipInclude shall be true.
public Component createComponents(java.lang.String uri,
Component parent,
java.util.Map arg)
ExecutionIt loads the page definition from the specified URI (by
use Execution.getPageDefinition(java.lang.String) ), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponents in interface Executionparent - the parent component, or null if you want it to be
a root component. If parent is null, the page is assumed to be
the current page, which is determined by the execution context.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.Execution.createComponents(PageDefinition, Component, Map),
Execution.createComponentsDirectly(String, String, Component, Map),
Execution.createComponentsDirectly(Document, String, Component, Map),
Execution.createComponentsDirectly(Reader, String, Component, Map)
public Component createComponents(PageDefinition pagedef,
Component parent,
java.util.Map arg)
Execution
createComponents in interface Executionpagedef - the page definition to use. It cannot be null.parent - the parent component, or null if you want it to be
a root component. If parent is null, the page is assumed to be
the current page, which is determined by the execution context.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.
Execution.createComponents(String, Component, Map)
public Component createComponentsDirectly(java.lang.String content,
java.lang.String ext,
Component parent,
java.util.Map arg)
ExecutionThe raw content is parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(String, String), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly in interface Executioncontent - the raw content of the page. It must be in ZUML.ext - the default extension if the content doesn't specify
an language. In other words, if
the content doesn't specify an language, LanguageDefinition.getByExtension(java.lang.String)
is called.
If extension is null and the content doesn't specify a language,
the language called "xul/html" is assumed.parent - the parent component, or null if you want it to be
a root component. If parent is null, the page is assumed to be
the current page, which is determined by the execution context.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.Execution.createComponents(PageDefinition, Component, Map),
Execution.createComponents(String, Component, Map),
Execution.createComponentsDirectly(Document, String, Component, Map),
Execution.createComponentsDirectly(Reader, String, Component, Map)
public Component createComponentsDirectly(org.zkoss.idom.Document content,
java.lang.String ext,
Component parent,
java.util.Map arg)
ExecutionThe raw content is parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(Document, String), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly in interface Executioncontent - the raw content in DOM.ext - the default extension if the content doesn't specify
an language. In other words, if
the content doesn't specify an language, LanguageDefinition.getByExtension(java.lang.String)
is called.
If extension is null and the content doesn't specify a language,
the language called "xul/html" is assumed.parent - the parent component, or null if you want it to be
a root component. If parent is null, the page is assumed to be
the current page, which is determined by the execution context.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.Execution.createComponents(PageDefinition, Component, Map),
Execution.createComponents(String, Component, Map),
Execution.createComponentsDirectly(Document, String, Component, Map),
Execution.createComponentsDirectly(Reader, String, Component, Map)
public Component createComponentsDirectly(java.io.Reader reader,
java.lang.String ext,
Component parent,
java.util.Map arg)
throws java.io.IOException
ExecutionThe raw content is loaded and parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(Reader,String), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly in interface Executionreader - the reader to retrieve the raw content in ZUML.ext - the default extension if the content doesn't specify
an language. In other words, if
the content doesn't specify an language, LanguageDefinition.getByExtension(java.lang.String)
is called.
If extension is null and the content doesn't specify a language,
the language called "xul/html" is assumed.parent - the parent component, or null if you want it to be
a root component. If parent is null, the page is assumed to be
the current page, which is determined by the execution context.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.
java.io.IOExceptionExecution.createComponents(PageDefinition, Component, Map),
Execution.createComponents(String, Component, Map),
Execution.createComponentsDirectly(Document, String, Component, Map),
Execution.createComponentsDirectly(String, String, Component, Map)
public Component[] createComponents(java.lang.String uri,
java.util.Map arg)
ExecutionIt loads the page definition from the specified URI (by
use Execution.getPageDefinition(java.lang.String) ), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponents in interface Executionarg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.Execution.createComponents(PageDefinition, Map),
Execution.createComponentsDirectly(String, String, Map),
Execution.createComponentsDirectly(Document, String, Map),
Execution.createComponentsDirectly(Reader, String, Map)
public Component[] createComponents(PageDefinition pagedef,
java.util.Map arg)
Execution
createComponents in interface Executionpagedef - the page definition to use. It cannot be null.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.
Execution.createComponents(String, Map)
public Component[] createComponentsDirectly(java.lang.String content,
java.lang.String ext,
java.util.Map arg)
ExecutionThe raw content is parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(String, String), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly in interface Executioncontent - the raw content of the page. It must be in ZUML.ext - the default extension if the content doesn't specify
an language. In other words, if
the content doesn't specify an language, LanguageDefinition.getByExtension(java.lang.String)
is called.
If extension is null and the content doesn't specify a language,
the language called "xul/html" is assumed.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.Execution.createComponents(PageDefinition, Map),
Execution.createComponents(String, Map),
Execution.createComponentsDirectly(Document, String, Map),
Execution.createComponentsDirectly(Reader, String, Map)
public Component[] createComponentsDirectly(org.zkoss.idom.Document content,
java.lang.String ext,
java.util.Map arg)
ExecutionThe raw content is parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(Document, String), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly in interface Executioncontent - the raw content in DOM.ext - the default extension if the content doesn't specify
an language. In other words, if
the content doesn't specify an language, LanguageDefinition.getByExtension(java.lang.String)
is called.
If extension is null and the content doesn't specify a language,
the language called "xul/html" is assumed.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.Execution.createComponents(PageDefinition, Map),
Execution.createComponents(String, Map),
Execution.createComponentsDirectly(Document, String, Map),
Execution.createComponentsDirectly(Reader, String, Map)
public Component[] createComponentsDirectly(java.io.Reader reader,
java.lang.String ext,
java.util.Map arg)
throws java.io.IOException
ExecutionThe raw content is loaded and parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(Reader,String), and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly in interface Executionreader - the reader to retrieve the raw content in ZUML.ext - the default extension if the content doesn't specify
an language. In other words, if
the content doesn't specify an language, LanguageDefinition.getByExtension(java.lang.String)
is called.
If extension is null and the content doesn't specify a language,
the language called "xul/html" is assumed.arg - a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg().
Ignored if null.
java.io.IOExceptionExecution.createComponents(PageDefinition, Map),
Execution.createComponents(String, Map),
Execution.createComponentsDirectly(Document, String, Map),
Execution.createComponentsDirectly(String, String, Map)public void sendRedirect(java.lang.String uri)
ExecutionIt is the same as sendRedirect(url, null).
After calling this method, the caller shall end the processing immediately (by returning). All pending requests and events will be dropped.
sendRedirect in interface Executionuri - the URI to redirect to, or null to reload the same page
public void sendRedirect(java.lang.String uri,
java.lang.String target)
ExecutionAfter calling this method, the caller shall end the processing immediately (by returning). All pending requests and events will be dropped.
Note: if you specify target other than null and "_self", it'll fail if the browser prevent the server to popup a window.
sendRedirect in interface Executionuri - the URI to redirect to, or null to reload the same pagetarget - the name of the browser window that send-redirect will
load the sepcified URI, or null if the current browser window
is used.public java.util.Map getArg()
ExecutionExecution.pushArg(java.util.Map) is called recently,
or an empty map if not available.
The use of parameters is application dependent.
ZK only provides the way to store (Execution.pushArg(java.util.Map) and to
restore Execution.popArg(). And, let the parameters being accessible in
EL by referring it as the arg variable.
Currently, Execution.createComponents(String,Component,Map)
and similar methods use this mechanism to let caller customize a page
definition.
Notice that Execution.createComponents(String,Component,Map)
pops arg after creating components, and before processing any event.
In other words, it is not aviable for event listener, including onCreate.
However, CreateEvent.getArg() preserves
the map for its event listeners.
getArg in interface Executionpublic void pushArg(java.util.Map arg)
ExecutionExecution.popArg() in the finally clause.
pushArg in interface ExecutionExecution.getArg()public void popArg()
ExecutionExecution.pushArg(java.util.Map).
It never throws an exception.
popArg in interface ExecutionExecution.getArg()
public void addAuResponse(java.lang.String key,
AuResponse response)
ExecutionAuResponse) which will be
sent to client at the end of the execution.
If AuResponse.getDepends() is not null, the response
depends on the returned componet. In other words, the response
is removed if the component is removed.
If it is null, the response is component-independent.
addAuResponse in interface Executionkey - could be anything. The second invocation of this method
in the same execution with the same key will override the previous one.public void setDesktop(Desktop desktop)
ExecutionCtrlCurrently, it is used to communicate between WebManager.newDesktop and DesktopImpl's constructor.
setDesktop in interface ExecutionCtrlpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||