public abstract class AbstractExecution extends java.lang.Object implements Execution, ExecutionCtrl
Execution
.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
Add_ON_ACTIVATE |
protected static java.lang.String |
Add_ON_DEACTIVATE |
APPEND_PARAM, IGNORE_PARAM, OVERWRITE_URI, PASS_THRU_ATTR
Modifier | Constructor and Description |
---|---|
protected |
AbstractExecution(Desktop desktop,
Page creating)
Constructs an execution.
|
Modifier and Type | Method and Description |
---|---|
void |
addAuResponse(AuResponse response)
Adds an asynchronous response (
AuResponse ) which will be
sent to client at the end of the execution. |
void |
addAuResponse(java.lang.String key,
AuResponse response)
Adds an asynchronous response (
AuResponse ) with the given
key instead of AuResponse.getOverrideKey() . |
void |
addOnActivate(Callback callback)
Adds a callback method to be executed only once after the execution
activated.
|
void |
addOnDeactivate(Callback callback)
Adds a callback method to be executed only once after the execution
deactivated.
|
boolean |
addVariableResolver(VariableResolver resolver)
Adds a name resolver that will be used to resolve a variable
(by
Execution.getVariableResolver() ). |
Component |
createComponents(PageDefinition pagedef,
Component parent,
Component insertBefore,
VariableResolver resolver)
Creates components from the specified page definition
with a custom variable resolver and inserts before a particular component.
|
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,
Component insertBefore,
VariableResolver resolver)
Creates components from a page file specified by an URI
with a custom variable resolver and inserts before a particular component.
|
Component[] |
createComponents(java.lang.String uri,
Component parent,
Component insertBefore,
VariableResolver resolver,
java.util.Map<?,?> arg)
Creates components from a page file specified by an URI
with a custom variable resolver and inserts before a particular component.
|
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[] |
createComponents(java.lang.String uri,
Page page,
VariableResolver resolver,
java.util.Map<?,?> arg)
Creates components that belong to the given page
from a page file specified by an URI.
|
Component |
createComponentsDirectly(Document content,
java.lang.String ext,
Component parent,
Component insertBefore,
VariableResolver resolver)
Creates components from the raw content specified by a DOM tree
with a custom variable resolver and inserts before a particular component.
|
Component |
createComponentsDirectly(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(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,
Component insertBefore,
VariableResolver resolver)
Creates components from the raw content read from the specified reader
with a custom variable resolver and inserts before a particular component.
|
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,
Component insertBefore,
VariableResolver resolver)
Creates components from the raw content specified by a string
with a custom variable resolver and inserts before a particular component.
|
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. |
java.lang.Object |
getAttribute(java.lang.String name,
boolean recurse)
Returns the custom attribute associated with this object.
|
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 associated with this execution.
|
ExecutionInfo |
getExecutionInfo()
Returns the information of the event being served, or null
if the execution is not under serving an event.
|
java.lang.Object |
getExtraXelVariable(java.lang.String name)
Returns the object, if any, defined in any variable resolver
added by
Execution.addVariableResolver(org.zkoss.xel.VariableResolver) . |
java.lang.Object |
getExtraXelVariable(XelContext ctx,
java.lang.Object base,
java.lang.Object name)
Returns the object, if any, defined in any variable resolver
added by
Execution.addVariableResolver(org.zkoss.xel.VariableResolver) . |
Event |
getNextEvent()
Returns the next event queued by
Execution.postEvent(org.zkoss.zk.ui.event.Event) , or null if no event queued. |
java.lang.String |
getRequestId()
Returns the sequence ID of the current request, or null if not
available.
|
java.util.Collection<AuResponse> |
getResponses()
Returns the collection of the AU responses (
AuResponse )
that shall be generated to the output, or null if not available. |
Session |
getSession()
Returns the session this execution belongs to.
|
Visualizer |
getVisualizer()
Returns the
Visualizer for this execution. |
boolean |
hasAttribute(java.lang.String name,
boolean recurse)
Returns if a custom attribute is associated with this object.
|
boolean |
hasVariableResolver(java.lang.Class<? extends VariableResolver> cls)
Returns if any instance of the give class has been registered.
|
boolean |
hasVariableResolver(VariableResolver resolver)
Returns if the specified variable resolved has been registered
|
boolean |
isActivated()
Returns whether this execution is activated.
|
boolean |
isAsyncUpdate(Page page)
Returns whether this execution is an asynchronous update for the
specified page (thru ZK Update Engine).
|
boolean |
isRecovering()
Returns whether this execution is in recovering.
|
void |
log(java.lang.String msg)
Writes the specified message to a servlet log file, usually an event log.
|
void |
log(java.lang.String msg,
java.lang.Throwable ex)
Writes an explanatory message and a stack trace for a given Throwable
exception to the servlet log file.
|
void |
onActivate()
Called when this execution is about to become the current execution
Executions.getCurrent() . |
void |
onBeforeDeactivate()
Called when this execution is about to become a non-current execution.
|
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 this execution.
|
void |
postEvent(int priority,
Component realTarget,
Event evt)
Queues the give event for the specified target to this execution.
|
void |
postEvent(int priority,
Event evt)
Queues an event with the specified priority to this execution.
|
void |
pushArg(java.util.Map<?,?> arg)
Pushes the parameters (aka., arg) that EL could refer it by the arg variable.
|
java.lang.Object |
removeAttribute(java.lang.String name,
boolean recurse)
Removes the custom attribute associated with this scope.
|
boolean |
removeVariableResolver(VariableResolver resolver)
Removes a name resolve that was added by
Execution.addVariableResolver(org.zkoss.xel.VariableResolver) . |
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,
boolean respRedirect)
Send a redirect to the given url in the application the redirect is done
via status 302 by
AuRedirect if respRedirect is set to true. |
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.
|
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value,
boolean recurse)
Sets the custom attribute associated with this scope, or the parent
scope.
|
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 |
setExecutionInfo(ExecutionInfo execinf)
Sets the information of the event being served, or null if not under
serving an event.
|
void |
setRequestId(java.lang.String reqId)
Sets the sequence ID of the current request.
|
void |
setResponses(java.util.Collection<AuResponse> responses)
Sets the collection of the AU responses (
AuResponse )
that shall be generated to the output. |
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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addResponseHeader, addResponseHeader, containsResponseHeader, encodeURL, evaluate, evaluate, forward, forward, getAttribute, getAttributes, getBrowser, getBrowser, getContextPath, getEvaluator, getEvaluator, getHeader, getHeaderNames, getHeaders, getLocalAddr, getLocalName, getLocalPort, getNativeRequest, getNativeResponse, getPageDefinition, getPageDefinitionDirectly, getPageDefinitionDirectly, getPageDefinitionDirectly, getParameter, getParameterMap, getParameterValues, getRemoteAddr, getRemoteHost, getRemoteUser, getScheme, getServerName, getServerPort, getUserAgent, getUserPrincipal, getVariableResolver, include, include, isBrowser, isBrowser, isExplorer, isExplorer7, isForwarded, isGecko, isGecko3, isHilDevice, isIncluded, isOpera, isRobot, isSafari, isUserInRole, isVoided, locate, removeAttribute, setAttribute, setResponseHeader, setResponseHeader, setVoided
addScopeListener, hasAttribute, removeScopeListener
setContentType
protected static final java.lang.String Add_ON_ACTIVATE
protected static final java.lang.String Add_ON_DEACTIVATE
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.public final boolean isAsyncUpdate(Page page)
Execution
isAsyncUpdate
in interface Execution
public Desktop getDesktop()
Execution
getDesktop
in interface Execution
public Session getSession()
Execution
getSession
in interface Execution
public void postEvent(Event evt)
Execution
The priority of the event is assumed to be 0. Refer to
Execution.postEvent(int, Event)
for more information.
postEvent
in interface Execution
Execution.postEvent(int, Event)
,
Execution.postEvent(int, Component, Event)
public void postEvent(int priority, Event evt)
Execution
The event will be sent to the component specified in Event.getTarget()
.
If Event.getTarget()
is null, it means broadcast, i.e.,
all root components will receive this event.
If you prefer a different target, you could use Execution.postEvent(int, Component, Event)
instead.
The posted events are processed from the higher priority to the lower one. If two events are posted with the same priority, the earlier the event being posted is processed earlier (first-in-first-out).
The priority posted by posted by Execution.postEvent(Event)
is
0.
Applications shall not use the priority higher than 10,000 and
lower than -10,000 since they are reserved for component
development.
postEvent
in interface Execution
priority
- the priority of the event. The default priority is 0
and the higher value means higher priority.Execution.postEvent(int, Component, Event)
public void postEvent(int priority, Component realTarget, Event evt)
Execution
Event.getTarget()
.postEvent
in interface Execution
priority
- the priority of the event. The default priority is 0
and the higher value means higher priority.realTarget
- the target component that will receive the event.
If null, it means broadcast, i.e., all root components will receive
this event.
public java.lang.Object getAttribute(java.lang.String name, boolean recurse)
Scope
getAttribute
in interface Scope
recurse
- whether to search its ancestor scope.
If true and the current scope doen't define the attribute,
it searches up its ancestor to see
any of them has defined the specified attribute.public boolean hasAttribute(java.lang.String name, boolean recurse)
Scope
Notice that null
is a valid value, so you can
tell if an attribute is associated by examining the return value
of Scope.getAttribute(java.lang.String)
.
hasAttribute
in interface Scope
recurse
- whether to search its ancestor scope.
If true and the current scope doen't define the attribute,
it searches up its ancestor to see
any of them has defined the specified attribute.public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value, boolean recurse)
Scope
setAttribute
in interface Scope
recurse
- whether to look up the parent scope for the
existence of the attribute.Scope.setAttribute(String,Object)
.public java.lang.Object removeAttribute(java.lang.String name, boolean recurse)
Scope
removeAttribute
in interface Scope
recurse
- whether to look up the parent scope for the
existence of the attribute.Scope.removeAttribute(String)
.public final Page getCurrentPage()
ExecutionCtrl
Design decision: we put it here because user need not to know about the concept of the current page.
Since 3.6.0, this method returns the first page if
ExecutionCtrl.setCurrentPage(org.zkoss.zk.ui.Page)
was not called (such as Server Push).
getCurrentPage
in interface ExecutionCtrl
Desktop.getPage(java.lang.String)
public final void setCurrentPage(Page curpage)
ExecutionCtrl
setCurrentPage
in interface ExecutionCtrl
public PageDefinition getCurrentPageDefinition()
ExecutionCtrl
getCurrentPageDefinition
in interface ExecutionCtrl
public void setCurrentPageDefinition(PageDefinition pgdef)
ExecutionCtrl
setCurrentPageDefinition
in interface ExecutionCtrl
pgdef
- the page definition. If null, it means it is the same
as getCurrentPage().getPageDefinition().public Event getNextEvent()
ExecutionCtrl
Execution.postEvent(org.zkoss.zk.ui.event.Event)
, or null if no event queued.
Implementation Notes:
Execution.postEvent(int,Component,Event)
proxies the event with ProxyEvent
if the real target is different from Event.getTarget()
.
Of course, it is transparent to the event listeners since the real
event will be passed to the listener (rather than the proxy event).
getNextEvent
in interface ExecutionCtrl
public boolean isActivated()
ExecutionCtrl
isActivated
in interface ExecutionCtrl
public void onActivate()
ExecutionCtrl
Executions.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 ExecutionCtrl
public void onBeforeDeactivate()
ExecutionCtrl
It is used as callback notification.
Note: don't throw any exception in this method.
onBeforeDeactivate
in interface ExecutionCtrl
ExecutionCtrl.onDeactivate()
public void onDeactivate()
ExecutionCtrl
It is used as callback notification.
Note: don't throw any exception in this method.
onDeactivate
in interface ExecutionCtrl
ExecutionCtrl.onActivate()
public boolean isRecovering()
ExecutionCtrl
FailoverManager.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 ExecutionCtrl
public Visualizer getVisualizer()
ExecutionCtrl
Visualizer
for this execution.
It is the same as DesktopCtrl.getVisualizer()
.getVisualizer
in interface ExecutionCtrl
public java.lang.String toAbsoluteURI(java.lang.String uri, boolean skipInclude)
Execution
Execution.isIncluded()
).
Note: an asynchronous 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 additions, RequestDispatcher.include doesn't handle related URI well.
toAbsoluteURI
in interface Execution
skipInclude
- whether not to convert to an absolute URI if
the current page is included by another page.
If you are not sure, you might specify false.public Component createComponents(java.lang.String uri, Component parent, java.util.Map<?,?> arg)
Execution
It 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 Execution
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.
In other words, the new component will be the root component
of the current page if parent is null.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(java.lang.String uri, Component parent, Component insertBefore, VariableResolver resolver)
Execution
It 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 Execution
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.
In other words, the new component will be the root component
of the current page if parent is null.insertBefore
- the sibling component that new components will be
inserted before. Ignored if null (i.e., append as last children).resolver
- the variable resolver used to resolve variables.
Ignored if null.Execution.createComponents(PageDefinition, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(String, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Document, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Reader, String, Component, Component, VariableResolver)
public Component[] createComponents(java.lang.String uri, Component parent, Component insertBefore, VariableResolver resolver, java.util.Map<?,?> arg)
Execution
It 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 Execution
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.
In other words, the new component will be the root component
of the current page if parent is null.insertBefore
- the sibling component that new components will be
inserted before. Ignored if null (i.e., append as last children).resolver
- the variable resolver used to resolve variables.
Ignored if null.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, Component, VariableResolver)
,
Execution.createComponentsDirectly(String, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Document, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Reader, String, Component, Component, VariableResolver)
public Component createComponents(PageDefinition pagedef, Component parent, java.util.Map<?,?> arg)
Execution
createComponents
in interface Execution
pagedef
- 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.
In other words, the new component will be the root component
of the current page if parent is 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, Component, Map)
public Component createComponents(PageDefinition pagedef, Component parent, Component insertBefore, VariableResolver resolver)
Execution
createComponents
in interface Execution
pagedef
- 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.
In other words, the new component will be the root component
of the current page if parent is null.insertBefore
- the sibling component that new components will be
inserted before. Ignored if null (i.e., append as last children).resolver
- the variable resolver used to resolve variables.
Ignored if null.Execution.createComponents(String, Component, Component, VariableResolver)
public Component[] createComponents(java.lang.String uri, java.util.Map<?,?> arg)
Execution
It loads the page definition from the specified URI (by
use Execution.getPageDefinition(java.lang.String)
), and then
invokes Execution.createComponents(PageDefinition,Map)
to create components.
createComponents
in interface Execution
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.createComponentsDirectly(String, String, Map)
,
Execution.createComponentsDirectly(Document, String, Map)
,
Execution.createComponentsDirectly(Reader, String, Map)
public Component[] createComponents(java.lang.String uri, Page page, VariableResolver resolver, java.util.Map<?,?> arg)
Execution
It loads the page definition from the specified URI (by
use Execution.getPageDefinition(java.lang.String)
), and then
invokes Execution.createComponents(PageDefinition,Map)
to create components.
createComponents
in interface Execution
page
- the page, or null if you want it to attach the created components.resolver
- the variable resolver used to resolve variables.
Ignored if null.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.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 Execution
pagedef
- 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, Component parent, java.util.Map<?,?> arg)
Execution
The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(String, String)
, and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly
in interface Execution
content
- 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.
In other words, the new component will be the root component
of the current page if parent is null.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.lang.String content, java.lang.String ext, Component parent, Component insertBefore, VariableResolver resolver)
Execution
The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(String, String)
, and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly
in interface Execution
content
- 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.
In other words, the new component will be the root component
of the current page if parent is null.insertBefore
- the sibling component that new components will be
inserted before. Ignored if null (i.e., append as last children).resolver
- the variable resolver used to resolve variables.Execution.createComponents(PageDefinition, Component, Component, VariableResolver)
,
Execution.createComponents(String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Document, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Reader, String, Component, Component, VariableResolver)
public Component createComponentsDirectly(Document content, java.lang.String ext, Component parent, java.util.Map<?,?> arg)
Execution
The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Document, String)
, and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly
in interface Execution
content
- 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.
In other words, the new component will be the root component
of the current page if parent is null.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(Document content, java.lang.String ext, Component parent, Component insertBefore, VariableResolver resolver)
Execution
The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Document, String)
, and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly
in interface Execution
content
- 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.
In other words, the new component will be the root component
of the current page if parent is null.insertBefore
- the sibling component that new components will be
inserted before. Ignored if null (i.e., append as last children).resolver
- the variable resolver used to resolve variables.
Ignored if null.Execution.createComponents(PageDefinition, Component, Component, VariableResolver)
,
Execution.createComponents(String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Document, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Reader, String, Component, Component, VariableResolver)
public Component createComponentsDirectly(java.io.Reader reader, java.lang.String ext, Component parent, java.util.Map<?,?> arg) throws java.io.IOException
Execution
The raw content is loaded and parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Reader,String)
, and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly
in interface Execution
reader
- 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.
In other words, the new component will be the root component
of the current page if parent is null.arg
- a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg()
.
Ignored if null.java.io.IOException
Execution.createComponents(PageDefinition, Component, Map)
,
Execution.createComponents(String, Component, Map)
,
Execution.createComponentsDirectly(Document, String, Component, Map)
,
Execution.createComponentsDirectly(String, String, Component, Map)
public Component createComponentsDirectly(java.io.Reader reader, java.lang.String ext, Component parent, Component insertBefore, VariableResolver resolver) throws java.io.IOException
Execution
The raw content is loaded and parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Reader,String)
, and then
invokes Execution.createComponents(PageDefinition,Component,Map)
to create components.
createComponentsDirectly
in interface Execution
reader
- 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.
In other words, the new component will be the root component
of the current page if parent is null.insertBefore
- the sibling component that new components will be
inserted before. Ignored if null (i.e., append as last children).resolver
- the variable resolver used to resolve variables.
Ignored if null.java.io.IOException
Execution.createComponents(PageDefinition, Component, Component, VariableResolver)
,
Execution.createComponents(String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(Document, String, Component, Component, VariableResolver)
,
Execution.createComponentsDirectly(String, String, Component, Component, VariableResolver)
public Component[] createComponentsDirectly(java.lang.String content, java.lang.String ext, java.util.Map<?,?> arg)
Execution
The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(String, String)
, and then
invokes Execution.createComponents(PageDefinition,Map)
to create components.
createComponentsDirectly
in interface Execution
content
- 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(Document content, java.lang.String ext, java.util.Map<?,?> arg)
Execution
The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Document, String)
, and then
invokes Execution.createComponents(PageDefinition,Map)
to create components.
createComponentsDirectly
in interface Execution
content
- 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
Execution
The raw content is loaded and parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(Reader,String)
, and then
invokes Execution.createComponents(PageDefinition,Map)
to create components.
createComponentsDirectly
in interface Execution
reader
- 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.IOException
Execution.createComponents(PageDefinition, Map)
,
Execution.createComponents(String, Map)
,
Execution.createComponentsDirectly(Document, String, Map)
,
Execution.createComponentsDirectly(String, String, Map)
public void sendRedirect(java.lang.String uri)
Execution
It 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 Execution
uri
- the URI to redirect to, or null to reload the same pagepublic void sendRedirect(java.lang.String uri, java.lang.String target)
Execution
After 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 Execution
uri
- 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 void sendRedirect(java.lang.String uri, boolean respRedirect)
Execution
AuRedirect
if respRedirect is set to true. If
respRedirect is set to false, it is the same with
Execution.sendRedirect(String)
.sendRedirect
in interface Execution
uri
- the URI to redirect to, or null to reload the same pagerespRedirect
- whether to send redirect by HttpResponse or notpublic java.util.Map<?,?> getArg()
Execution
Execution.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.
public void pushArg(java.util.Map<?,?> arg)
Execution
Execution.popArg()
in the finally clause.pushArg
in interface Execution
Execution.getArg()
public void popArg()
Execution
Execution.pushArg(java.util.Map<?, ?>)
.
It never throws an exception.
popArg
in interface Execution
Execution.getArg()
public void addAuResponse(AuResponse response)
Execution
AuResponse
) which will be
sent to client at the end of the execution.
It is the same as addAuResponse(response.getOverrideKey(), resposne)
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 Execution
public void addAuResponse(java.lang.String key, AuResponse response)
Execution
AuResponse
) with the given
key instead of AuResponse.getOverrideKey()
.
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 Execution
key
- could be anything.
If not null, the second invocation of this method
in the same execution with the same key and the same depends
(AuResponse.getDepends()
) will override the previous one.
In other words, the previous one will be dropped.
If null is specified, the response is simply appended to the end
without overriding any previous one.public void setDesktop(Desktop desktop)
ExecutionCtrl
Currently, it is used to communicate between WebManager.newDesktop and DesktopImpl's constructor.
setDesktop
in interface ExecutionCtrl
public void setRequestId(java.lang.String reqId)
ExecutionCtrl
setRequestId
in interface ExecutionCtrl
public java.lang.String getRequestId()
ExecutionCtrl
getRequestId
in interface ExecutionCtrl
public java.util.Collection<AuResponse> getResponses()
ExecutionCtrl
AuResponse
)
that shall be generated to the output, or null if not available.getResponses
in interface ExecutionCtrl
public void setResponses(java.util.Collection<AuResponse> responses)
ExecutionCtrl
AuResponse
)
that shall be generated to the output.setResponses
in interface ExecutionCtrl
public ExecutionInfo getExecutionInfo()
ExecutionCtrl
Unlike most of other methods, this method could be accessed by another thread.
getExecutionInfo
in interface ExecutionCtrl
public void setExecutionInfo(ExecutionInfo execinf)
ExecutionCtrl
setExecutionInfo
in interface ExecutionCtrl
public boolean addVariableResolver(VariableResolver resolver)
Execution
Execution.getVariableResolver()
).
The new added variable resolver is called first, so it has the higher
priority than the previous added variable resolver.
In additions, the priority of the variable resolver added with this method
is higher than the variable resolvers added to a page
(Page.addVariableResolver(org.zkoss.xel.VariableResolver)
).
However, its priority is lower than attributes defined in the execution and
components.
Notice that Execution.getVariableResolver()
returns a variable resolver
used to evaluate EL expressions. It
resolves all builtin names and all custom variable resolvers.
It is not any variable resolver added by this method.
addVariableResolver
in interface Execution
public boolean removeVariableResolver(VariableResolver resolver)
Execution
Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
.removeVariableResolver
in interface Execution
public boolean hasVariableResolver(VariableResolver resolver)
Execution
hasVariableResolver
in interface Execution
Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
public boolean hasVariableResolver(java.lang.Class<? extends VariableResolver> cls)
Execution
hasVariableResolver
in interface Execution
public java.lang.Object getExtraXelVariable(java.lang.String name)
ExecutionCtrl
Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
.
Notice that it looks only for the variables defined
in Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
. To get a variable an EL expression
can reference, please use Execution.getVariableResolver()
instead.
getExtraXelVariable
in interface ExecutionCtrl
public java.lang.Object getExtraXelVariable(XelContext ctx, java.lang.Object base, java.lang.Object name)
ExecutionCtrl
Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
.
Notice that it looks only for the variables defined
in Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
. To get a variable an EL expression
can reference, please use Execution.getVariableResolver()
instead.
Unlike ExecutionCtrl.getExtraXelVariable(String)
, this method
can utilize VariableResolverX
if you'd like
to retrieve a property of another object.
getExtraXelVariable
in interface ExecutionCtrl
ctx
- the XEL contextbase
- the base object. If null, it looks for a top-level variable.
If not null, it looks for a member of the base object (such as getter).name
- the property to retrieve.ExecutionCtrl.getExtraXelVariable(String)
public void log(java.lang.String msg)
Execution
public void log(java.lang.String msg, java.lang.Throwable ex)
Execution
public void addOnActivate(Callback callback)
addOnActivate
in interface ExecutionCtrl
callback
- public void addOnDeactivate(Callback callback)
addOnDeactivate
in interface ExecutionCtrl
callback
- public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2018 Potix Corporation. All Rights Reserved.