Class AbstractExecution
- java.lang.Object
-
- org.zkoss.zk.ui.impl.AbstractExecution
-
- All Implemented Interfaces:
Execution,Scope,ExecutionCtrl
- Direct Known Subclasses:
ExecutionImpl
public abstract class AbstractExecution extends java.lang.Object implements Execution, ExecutionCtrl
A skeletal implementation ofExecution.- Author:
- tomyeh
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringAdd_ON_ACTIVATEprotected static java.lang.StringAdd_ON_DEACTIVATE-
Fields inherited from interface org.zkoss.zk.ui.Execution
APPEND_PARAM, IGNORE_PARAM, OVERWRITE_URI, PASS_THRU_ATTR
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractExecution(Desktop desktop, Page creating)Constructs an execution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuResponse(java.lang.String key, AuResponse response)Adds an asynchronous response (AuResponse) with the given key instead ofAuResponse.getOverrideKey().voidaddAuResponse(AuResponse response)Adds an asynchronous response (AuResponse) which will be sent to client at the end of the execution.voidaddOnActivate(Callback callback)Adds a callback method to be executed only once after the execution activated.voidaddOnDeactivate(Callback callback)Adds a callback method to be executed only once after the execution deactivated.booleanaddVariableResolver(org.zkoss.xel.VariableResolver resolver)Adds a name resolver that will be used to resolve a variable (byExecution.getVariableResolver()).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.ComponentcreateComponents(java.lang.String uri, Component parent, java.util.Map<?,?> arg)Creates components from a page file specified by an URI.ComponentcreateComponents(java.lang.String uri, Component parent, Component insertBefore, org.zkoss.xel.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, org.zkoss.xel.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, Page page, org.zkoss.xel.VariableResolver resolver, java.util.Map<?,?> arg)Creates components that belong to the given page from a page file specified by an URI.Component[]createComponents(PageDefinition pagedef, java.util.Map<?,?> arg)Creates components that don't belong to any page from the specified page definition.ComponentcreateComponents(PageDefinition pagedef, Component parent, java.util.Map<?,?> arg)Creates components from the specified page definition.ComponentcreateComponents(PageDefinition pagedef, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver)Creates components from the specified page definition with a custom variable resolver and inserts before a particular component.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.ComponentcreateComponentsDirectly(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.ComponentcreateComponentsDirectly(java.io.Reader reader, java.lang.String ext, Component parent, Component insertBefore, org.zkoss.xel.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.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.ComponentcreateComponentsDirectly(java.lang.String content, java.lang.String ext, Component parent, java.util.Map<?,?> arg)Creates components from the raw content specified by a string.ComponentcreateComponentsDirectly(java.lang.String content, java.lang.String ext, Component parent, Component insertBefore, org.zkoss.xel.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(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.ComponentcreateComponentsDirectly(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.ComponentcreateComponentsDirectly(org.zkoss.idom.Document content, java.lang.String ext, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver)Creates components from the raw content specified by a DOM tree with a custom variable resolver and inserts before a particular component.java.util.Map<?,?>getArg()Returns the parameters (aka., arg) ifExecution.pushArg(java.util.Map<?, ?>)is called recently, or an empty map if not available.java.lang.ObjectgetAttribute(java.lang.String name, boolean recurse)Returns the custom attribute associated with this object.PagegetCurrentPage()Returns the current page.PageDefinitiongetCurrentPageDefinition()Returns the current page definition, which is pushed when evaluating a page (from a page definition).DesktopgetDesktop()Returns the desktop associated with this execution.ExecutionInfogetExecutionInfo()Returns the information of the event being served, or null if the execution is not under serving an event.java.lang.ObjectgetExtraXelVariable(java.lang.String name)Returns the object, if any, defined in any variable resolver added byExecution.addVariableResolver(org.zkoss.xel.VariableResolver).java.lang.ObjectgetExtraXelVariable(org.zkoss.xel.XelContext ctx, java.lang.Object base, java.lang.Object name)Returns the object, if any, defined in any variable resolver added byExecution.addVariableResolver(org.zkoss.xel.VariableResolver).EventgetNextEvent()Returns the next event queued byExecution.postEvent(org.zkoss.zk.ui.event.Event), or null if no event queued.java.lang.StringgetRequestId()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.SessiongetSession()Returns the session this execution belongs to.VisualizergetVisualizer()Returns theVisualizerfor this execution.booleanhasAttribute(java.lang.String name, boolean recurse)Returns if a custom attribute is associated with this object.booleanhasVariableResolver(java.lang.Class<? extends org.zkoss.xel.VariableResolver> cls)Returns if any instance of the give class has been registered.booleanhasVariableResolver(org.zkoss.xel.VariableResolver resolver)Returns if the specified variable resolved has been registeredbooleanisActivated()Returns whether this execution is activated.booleanisAsyncUpdate(Page page)Returns whether this execution is an asynchronous update for the specified page (thru ZK Update Engine).booleanisRecovering()Returns whether this execution is in recovering.voidlog(java.lang.String msg)Writes the specified message to a servlet log file, usually an event log.voidlog(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.voidonActivate()Called when this execution is about to become the current executionExecutions.getCurrent().voidonBeforeDeactivate()Called when this execution is about to become a non-current execution.voidonDeactivate()Called when this execution is about to become a non-current execution.voidpopArg()Pops the parameters (aka., arg) that is pushed byExecution.pushArg(java.util.Map<?, ?>).voidpostEvent(int priority, Component realTarget, Event evt)Queues the give event for the specified target to this execution.voidpostEvent(int priority, Event evt)Queues an event with the specified priority to this execution.voidpostEvent(Event evt)Queues an event to this execution.voidpushArg(java.util.Map<?,?> arg)Pushes the parameters (aka., arg) that EL could refer it by the arg variable.java.lang.ObjectremoveAttribute(java.lang.String name, boolean recurse)Removes the custom attribute associated with this scope.booleanremoveVariableResolver(org.zkoss.xel.VariableResolver resolver)Removes a name resolve that was added byExecution.addVariableResolver(org.zkoss.xel.VariableResolver).voidsendRedirect(java.lang.String uri)Sends a temporary redirect response to the client using the specified redirect location URL.voidsendRedirect(java.lang.String uri, boolean respRedirect)Send a redirect to the given url in the application the redirect is done via status 302 byAuRedirectif respRedirect is set to true.voidsendRedirect(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.ObjectsetAttribute(java.lang.String name, java.lang.Object value, boolean recurse)Sets the custom attribute associated with this scope, or the parent scope.voidsetCurrentPage(Page curpage)Sets the current page.voidsetCurrentPageDefinition(PageDefinition pgdef)Sets the current page definition.voidsetDesktop(Desktop desktop)Sets the desktop associated with this execution.voidsetExecutionInfo(ExecutionInfo execinf)Sets the information of the event being served, or null if not under serving an event.voidsetRequestId(java.lang.String reqId)Sets the sequence ID of the current request.voidsetResponses(java.util.Collection<AuResponse> responses)Sets the collection of the AU responses (AuResponse) that shall be generated to the output.java.lang.StringtoAbsoluteURI(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.StringtoString()-
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.Execution
addResponseHeader, addResponseHeader, containsResponseHeader, encodeURL, evaluate, evaluate, forward, forward, getAttribute, getAttributes, getBrowser, getBrowser, getContextPath, getContextURI, 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, isForwarded, isIncluded, isUserInRole, isVoided, locate, removeAttribute, setAttribute, setResponseHeader, setResponseHeader, setVoided
-
Methods inherited from interface org.zkoss.zk.ui.sys.ExecutionCtrl
setContentType
-
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, hasAttribute, removeScopeListener
-
-
-
-
Field Detail
-
Add_ON_ACTIVATE
protected static final java.lang.String Add_ON_ACTIVATE
- See Also:
- Constant Field Values
-
Add_ON_DEACTIVATE
protected static final java.lang.String Add_ON_DEACTIVATE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractExecution
protected AbstractExecution(Desktop desktop, Page creating)
Constructs an execution.- Parameters:
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
-
isAsyncUpdate
public boolean isAsyncUpdate(Page page)
Description copied from interface:ExecutionReturns whether this execution is an asynchronous update for the specified page (thru ZK Update Engine).- Specified by:
isAsyncUpdatein interfaceExecution- Returns:
- whether the specified page is being asynchronous updated by this execution. If the specified page is null, this method returns whether this execution is caused by an asynchronous update (i.e., caused by an AU request).
-
getDesktop
public Desktop getDesktop()
Description copied from interface:ExecutionReturns the desktop associated with this execution. Each execution is against exactly one desktop.- Specified by:
getDesktopin interfaceExecution
-
getSession
public Session getSession()
Description copied from interface:ExecutionReturns the session this execution belongs to.- Specified by:
getSessionin interfaceExecution
-
postEvent
public void postEvent(Event evt)
Description copied from interface:ExecutionQueues an event to this execution. In other words, the event is placed to the event queue.The priority of the event is assumed to be 0. Refer to
Execution.postEvent(int, Event)for more information.- Specified by:
postEventin interfaceExecution- See Also:
Execution.postEvent(int, Event),Execution.postEvent(int, Component, Event)
-
postEvent
public void postEvent(int priority, Event evt)Description copied from interface:ExecutionQueues an event with the specified priority to this execution. In other words, the event is placed to the event queue with the specified priority.The event will be sent to the component specified in
Event.getTarget(). IfEvent.getTarget()is null, it means broadcast, i.e., all root components will receive this event. If you prefer a different target, you could useExecution.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.- Specified by:
postEventin interfaceExecution- Parameters:
priority- the priority of the event. The default priority is 0 and the higher value means higher priority.- See Also:
Execution.postEvent(int, Component, Event)
-
postEvent
public void postEvent(int priority, Component realTarget, Event evt)Description copied from interface:ExecutionQueues the give event for the specified target to this execution. The target could be different fromEvent.getTarget().- Specified by:
postEventin interfaceExecution- Parameters:
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.
Notice that postEvent(n, event) is the same as postEvent(n, event.getTarget(), event), but different from postEvent(n, 0, event).
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name, boolean recurse)Description copied from interface:ScopeReturns the custom attribute associated with this object.- Specified by:
getAttributein interfaceScoperecurse- 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.
-
hasAttribute
public boolean hasAttribute(java.lang.String name, boolean recurse)Description copied from interface:ScopeReturns if a custom attribute is associated with this object.Notice that
nullis a valid value, so you can tell if an attribute is associated by examining the return value ofScope.getAttribute(java.lang.String).- Specified by:
hasAttributein interfaceScoperecurse- 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.
-
setAttribute
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value, boolean recurse)Description copied from interface:ScopeSets the custom attribute associated with this scope, or the parent scope.- Specified by:
setAttributein interfaceScoperecurse- whether to look up the parent scope for the existence of the attribute.
If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is replaced. Otherwise, it is the same asScope.setAttribute(String,Object).
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String name, boolean recurse)Description copied from interface:ScopeRemoves the custom attribute associated with this scope.- Specified by:
removeAttributein interfaceScoperecurse- whether to look up the parent scope for the existence of the attribute.
If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is removed. Otherwise, it is the same asScope.removeAttribute(String).
-
getCurrentPage
public final Page getCurrentPage()
Description copied from interface:ExecutionCtrlReturns the current page. Though an execution might process many pages, it processes update requests one-by-one and each update request is associated with a page.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).- Specified by:
getCurrentPagein interfaceExecutionCtrl- See Also:
Desktop.getPage(java.lang.String)
-
setCurrentPage
public final void setCurrentPage(Page curpage)
Description copied from interface:ExecutionCtrlSets the current page. Though an execution might process many pages, it processes update requests one-by-one and each update request is associated with a page.- Specified by:
setCurrentPagein interfaceExecutionCtrl
-
getCurrentPageDefinition
public PageDefinition getCurrentPageDefinition()
Description copied from interface:ExecutionCtrlReturns the current page definition, which is pushed when evaluating a page (from a page definition).- Specified by:
getCurrentPageDefinitionin interfaceExecutionCtrl
-
setCurrentPageDefinition
public void setCurrentPageDefinition(PageDefinition pgdef)
Description copied from interface:ExecutionCtrlSets the current page definition.- Specified by:
setCurrentPageDefinitionin interfaceExecutionCtrl- Parameters:
pgdef- the page definition. If null, it means it is the same as getCurrentPage().getPageDefinition().
-
getNextEvent
public Event getNextEvent()
Description copied from interface:ExecutionCtrlReturns the next event queued byExecution.postEvent(org.zkoss.zk.ui.event.Event), or null if no event queued.Implementation Notes:
Execution.postEvent(int,Component,Event)proxies the event withProxyEventif the real target is different fromEvent.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).- Specified by:
getNextEventin interfaceExecutionCtrl
-
isActivated
public boolean isActivated()
Description copied from interface:ExecutionCtrlReturns whether this execution is activated.- Specified by:
isActivatedin interfaceExecutionCtrl
-
onActivate
public void onActivate()
Description copied from interface:ExecutionCtrlCalled when this execution is about to become the current executionExecutions.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.
- Specified by:
onActivatein interfaceExecutionCtrl
-
onBeforeDeactivate
public void onBeforeDeactivate()
Description copied from interface:ExecutionCtrlCalled when this execution is about to become a non-current execution.It is used as callback notification.
Note: don't throw any exception in this method.
- Specified by:
onBeforeDeactivatein interfaceExecutionCtrl- See Also:
ExecutionCtrl.onDeactivate()
-
onDeactivate
public void onDeactivate()
Description copied from interface:ExecutionCtrlCalled when this execution is about to become a non-current execution.It is used as callback notification.
Note: don't throw any exception in this method.
- Specified by:
onDeactivatein interfaceExecutionCtrl- See Also:
ExecutionCtrl.onActivate()
-
isRecovering
public boolean isRecovering()
Description copied from interface:ExecutionCtrlReturns whether this execution is in recovering. In other words, it is in the invocation ofFailoverManager.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.- Specified by:
isRecoveringin interfaceExecutionCtrl
-
getVisualizer
public Visualizer getVisualizer()
Description copied from interface:ExecutionCtrlReturns theVisualizerfor this execution. It is the same asDesktopCtrl.getVisualizer().- Specified by:
getVisualizerin interfaceExecutionCtrl
-
toAbsoluteURI
public java.lang.String toAbsoluteURI(java.lang.String uri, boolean skipInclude)Description copied from interface:ExecutionConverts the specified URI to an absolute URI, if uri is related and the current execution is not included (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.
- Specified by:
toAbsoluteURIin interfaceExecutionskipInclude- 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.
-
createComponents
public Component createComponents(java.lang.String uri, Component parent, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components from a page file specified by an URI. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.It loads the page definition from the specified URI (by use
Execution.getPageDefinition(java.lang.String)), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsin interfaceExecutionparent- 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 byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Component, Map),Execution.createComponentsDirectly(String, String, Component, Map),Execution.createComponentsDirectly(Document, String, Component, Map),Execution.createComponentsDirectly(Reader, String, Component, Map)
-
createComponents
public Component createComponents(java.lang.String uri, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionCreates components from a page file specified by an URI with a custom variable resolver and inserts before a particular component. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.It loads the page definition from the specified URI (by use
Execution.getPageDefinition(java.lang.String)), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsin interfaceExecutionparent- 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.- See Also:
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)
-
createComponents
public Component[] createComponents(java.lang.String uri, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components from a page file specified by an URI with a custom variable resolver and inserts before a particular component. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.It loads the page definition from the specified URI (by use
Execution.getPageDefinition(java.lang.String)), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsin interfaceExecutionparent- 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 byExecution.getArg(). Ignored if null.- See Also:
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)
-
createComponents
public Component createComponents(PageDefinition pagedef, Component parent, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components from the specified page definition. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.- Specified by:
createComponentsin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- Returns:
- the first component being created.
- See Also:
Execution.createComponents(String, Component, Map)
-
createComponents
public Component createComponents(PageDefinition pagedef, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionCreates components from the specified page definition with a custom variable resolver and inserts before a particular component. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.- Specified by:
createComponentsin interfaceExecution- Parameters:
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.- Returns:
- the first component being created.
- See Also:
Execution.createComponents(String, Component, Component, VariableResolver)
-
createComponents
public Component[] createComponents(java.lang.String uri, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components that don't belong to any page from a page file specified by an URI.It loads the page definition from the specified URI (by use
Execution.getPageDefinition(java.lang.String)), and then invokesExecution.createComponents(PageDefinition,Map)to create components.- Specified by:
createComponentsin interfaceExecutionarg- a map of parameters that is accessible by the arg variable in EL, or byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Map),Execution.createComponentsDirectly(String, String, Map),Execution.createComponentsDirectly(Document, String, Map),Execution.createComponentsDirectly(Reader, String, Map)
-
createComponents
public Component[] createComponents(java.lang.String uri, Page page, org.zkoss.xel.VariableResolver resolver, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components that belong to the given page from a page file specified by an URI.It loads the page definition from the specified URI (by use
Execution.getPageDefinition(java.lang.String)), and then invokesExecution.createComponents(PageDefinition,Map)to create components.- Specified by:
createComponentsin interfaceExecutionpage- 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 byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Map),Execution.createComponentsDirectly(String, String, Map),Execution.createComponentsDirectly(Document, String, Map),Execution.createComponentsDirectly(Reader, String, Map)
-
createComponents
public Component[] createComponents(PageDefinition pagedef, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components that don't belong to any page from the specified page definition.- Specified by:
createComponentsin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- Returns:
- the first component being created.
- See Also:
Execution.createComponents(String, Map)
-
createComponentsDirectly
public Component createComponentsDirectly(java.lang.String content, java.lang.String ext, Component parent, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components from the raw content specified by a string. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(String, String), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Component, Map),Execution.createComponents(String, Component, Map),Execution.createComponentsDirectly(Document, String, Component, Map),Execution.createComponentsDirectly(Reader, String, Component, Map)
-
createComponentsDirectly
public Component createComponentsDirectly(java.lang.String content, java.lang.String ext, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionCreates components from the raw content specified by a string with a custom variable resolver and inserts before a particular component. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(String, String), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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.- See Also:
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)
-
createComponentsDirectly
public Component createComponentsDirectly(org.zkoss.idom.Document content, java.lang.String ext, Component parent, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components from the raw content specified by a DOM tree. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Document, String), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Component, Map),Execution.createComponents(String, Component, Map),Execution.createComponentsDirectly(Document, String, Component, Map),Execution.createComponentsDirectly(Reader, String, Component, Map)
-
createComponentsDirectly
public Component createComponentsDirectly(org.zkoss.idom.Document content, java.lang.String ext, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionCreates components from the raw content specified by a DOM tree with a custom variable resolver and inserts before a particular component. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Document, String), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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.- See Also:
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)
-
createComponentsDirectly
public Component createComponentsDirectly(java.io.Reader reader, java.lang.String ext, Component parent, java.util.Map<?,?> arg) throws java.io.IOException
Description copied from interface:ExecutionCreates components from the raw content read from the specified reader. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.The raw content is loaded and parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Reader,String), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- Throws:
java.io.IOException- See Also:
Execution.createComponents(PageDefinition, Component, Map),Execution.createComponents(String, Component, Map),Execution.createComponentsDirectly(Document, String, Component, Map),Execution.createComponentsDirectly(String, String, Component, Map)
-
createComponentsDirectly
public Component createComponentsDirectly(java.io.Reader reader, java.lang.String ext, Component parent, Component insertBefore, org.zkoss.xel.VariableResolver resolver) throws java.io.IOException
Description copied from interface:ExecutionCreates components from the raw content read from the specified reader with a custom variable resolver and inserts before a particular component. The created components become the child of the specified parent, or become the root components of the current page if parent is specified as null.The raw content is loaded and parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Reader,String), and then invokesExecution.createComponents(PageDefinition,Component,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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.- Throws:
java.io.IOException- See Also:
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)
-
createComponentsDirectly
public Component[] createComponentsDirectly(java.lang.String content, java.lang.String ext, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components that don't belong to any page from the raw content specified by a string.The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(String, String), and then invokesExecution.createComponents(PageDefinition,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Map),Execution.createComponents(String, Map),Execution.createComponentsDirectly(Document, String, Map),Execution.createComponentsDirectly(Reader, String, Map)
-
createComponentsDirectly
public Component[] createComponentsDirectly(org.zkoss.idom.Document content, java.lang.String ext, java.util.Map<?,?> arg)
Description copied from interface:ExecutionCreates components that don't belong to any page from the raw content specified by a DOM tree.The raw content is parsed to a page definition by use of
Execution.getPageDefinitionDirectly(Document, String), and then invokesExecution.createComponents(PageDefinition,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- See Also:
Execution.createComponents(PageDefinition, Map),Execution.createComponents(String, Map),Execution.createComponentsDirectly(Document, String, Map),Execution.createComponentsDirectly(Reader, String, Map)
-
createComponentsDirectly
public Component[] createComponentsDirectly(java.io.Reader reader, java.lang.String ext, java.util.Map<?,?> arg) throws java.io.IOException
Description copied from interface:ExecutionCreates components that don't belong to any page from the raw content read from the specified reader.The raw content is loaded and parsed to a page defintion by use of
Execution.getPageDefinitionDirectly(Reader,String), and then invokesExecution.createComponents(PageDefinition,Map)to create components.- Specified by:
createComponentsDirectlyin interfaceExecution- Parameters:
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 byExecution.getArg(). Ignored if null.- Throws:
java.io.IOException- See Also:
Execution.createComponents(PageDefinition, Map),Execution.createComponents(String, Map),Execution.createComponentsDirectly(Document, String, Map),Execution.createComponentsDirectly(String, String, Map)
-
sendRedirect
public void sendRedirect(java.lang.String uri)
Description copied from interface:ExecutionSends a temporary redirect response to the client using the specified redirect location URL.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.
- Specified by:
sendRedirectin interfaceExecution- Parameters:
uri- the URI to redirect to, or null to reload the same page
-
sendRedirect
public void sendRedirect(java.lang.String uri, java.lang.String target)Description copied from interface:ExecutionSends a temporary redirect response to the client using the specified redirect location URL and redirect to the specified browser window.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.
- Specified by:
sendRedirectin interfaceExecution- Parameters:
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 specified URI, or null if the current browser window is used.
-
sendRedirect
public void sendRedirect(java.lang.String uri, boolean respRedirect)Description copied from interface:ExecutionSend a redirect to the given url in the application the redirect is done via status 302 byAuRedirectif respRedirect is set to true. If respRedirect is set to false, it is the same withExecution.sendRedirect(String).- Specified by:
sendRedirectin interfaceExecution- Parameters:
uri- the URI to redirect to, or null to reload the same pagerespRedirect- whether to send redirect by HttpResponse or not
-
getArg
public java.util.Map<?,?> getArg()
Description copied from interface:ExecutionReturns the parameters (aka., arg) ifExecution.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 restoreExecution.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.
-
pushArg
public void pushArg(java.util.Map<?,?> arg)
Description copied from interface:ExecutionPushes the parameters (aka., arg) that EL could refer it by the arg variable. Remember to callExecution.popArg()in the finally clause.- Specified by:
pushArgin interfaceExecution- See Also:
Execution.getArg()
-
popArg
public void popArg()
Description copied from interface:ExecutionPops the parameters (aka., arg) that is pushed byExecution.pushArg(java.util.Map<?, ?>).It never throws an exception.
- Specified by:
popArgin interfaceExecution- See Also:
Execution.getArg()
-
addAuResponse
public void addAuResponse(AuResponse response)
Description copied from interface:ExecutionAdds an asynchronous response (AuResponse) which will be sent to client at the end of the execution. It is the same asaddAuResponse(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.- Specified by:
addAuResponsein interfaceExecution
-
addAuResponse
public void addAuResponse(java.lang.String key, AuResponse response)Description copied from interface:ExecutionAdds an asynchronous response (AuResponse) with the given key instead ofAuResponse.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.- Specified by:
addAuResponsein interfaceExecution- Parameters:
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.
-
setDesktop
public void setDesktop(Desktop desktop)
Description copied from interface:ExecutionCtrlSets the desktop associated with this execution. You rarely need to use this method, since the desktop is associated when this execution is created.Currently, it is used to communicate between WebManager.newDesktop and DesktopImpl's constructor.
- Specified by:
setDesktopin interfaceExecutionCtrl
-
setRequestId
public void setRequestId(java.lang.String reqId)
Description copied from interface:ExecutionCtrlSets the sequence ID of the current request.- Specified by:
setRequestIdin interfaceExecutionCtrl
-
getRequestId
public java.lang.String getRequestId()
Description copied from interface:ExecutionCtrlReturns the sequence ID of the current request, or null if not available. Not all clients support the request ID.- Specified by:
getRequestIdin interfaceExecutionCtrl
-
getResponses
public java.util.Collection<AuResponse> getResponses()
Description copied from interface:ExecutionCtrlReturns the collection of the AU responses (AuResponse) that shall be generated to the output, or null if not available.- Specified by:
getResponsesin interfaceExecutionCtrl
-
setResponses
public void setResponses(java.util.Collection<AuResponse> responses)
Description copied from interface:ExecutionCtrlSets the collection of the AU responses (AuResponse) that shall be generated to the output.- Specified by:
setResponsesin interfaceExecutionCtrl
-
getExecutionInfo
public ExecutionInfo getExecutionInfo()
Description copied from interface:ExecutionCtrlReturns the information of the event being served, or null if the execution is not under serving an event.Unlike most of other methods, this method could be accessed by another thread.
- Specified by:
getExecutionInfoin interfaceExecutionCtrl
-
setExecutionInfo
public void setExecutionInfo(ExecutionInfo execinf)
Description copied from interface:ExecutionCtrlSets the information of the event being served, or null if not under serving an event.- Specified by:
setExecutionInfoin interfaceExecutionCtrl
-
addVariableResolver
public boolean addVariableResolver(org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionAdds a name resolver that will be used to resolve a variable (byExecution.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.- Specified by:
addVariableResolverin interfaceExecution- Returns:
- whether the resolver is added successfully. Note: if the resolver was added before, it won't be added again and this method returns false.
-
removeVariableResolver
public boolean removeVariableResolver(org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionRemoves a name resolve that was added byExecution.addVariableResolver(org.zkoss.xel.VariableResolver).- Specified by:
removeVariableResolverin interfaceExecution- Returns:
- false if resolved is not added before.
-
hasVariableResolver
public boolean hasVariableResolver(org.zkoss.xel.VariableResolver resolver)
Description copied from interface:ExecutionReturns if the specified variable resolved has been registered- Specified by:
hasVariableResolverin interfaceExecution- See Also:
Execution.addVariableResolver(org.zkoss.xel.VariableResolver)
-
hasVariableResolver
public boolean hasVariableResolver(java.lang.Class<? extends org.zkoss.xel.VariableResolver> cls)
Description copied from interface:ExecutionReturns if any instance of the give class has been registered.- Specified by:
hasVariableResolverin interfaceExecution
-
getExtraXelVariable
public java.lang.Object getExtraXelVariable(java.lang.String name)
Description copied from interface:ExecutionCtrlReturns the object, if any, defined in any variable resolver added byExecution.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 useExecution.getVariableResolver()instead.- Specified by:
getExtraXelVariablein interfaceExecutionCtrl
-
getExtraXelVariable
public java.lang.Object getExtraXelVariable(org.zkoss.xel.XelContext ctx, java.lang.Object base, java.lang.Object name)Description copied from interface:ExecutionCtrlReturns the object, if any, defined in any variable resolver added byExecution.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 useExecution.getVariableResolver()instead.Unlike
ExecutionCtrl.getExtraXelVariable(String), this method can utilizeVariableResolverXif you'd like to retrieve a property of another object.- Specified by:
getExtraXelVariablein interfaceExecutionCtrl- Parameters:
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.- See Also:
ExecutionCtrl.getExtraXelVariable(String)
-
log
public void log(java.lang.String msg)
Description copied from interface:ExecutionWrites the specified message to a servlet log file, usually an event log. The name and type of the servlet log file is specific to the servlet container.
-
log
public void log(java.lang.String msg, java.lang.Throwable ex)Description copied from interface:ExecutionWrites an explanatory message and a stack trace for a given Throwable exception to the servlet log file. The name and type of the servlet log file is specific to the servlet container, usually an event log.
-
addOnActivate
public void addOnActivate(Callback callback)
Adds a callback method to be executed only once after the execution activated.- Specified by:
addOnActivatein interfaceExecutionCtrl- Parameters:
callback-- Since:
- 7.0.5
-
addOnDeactivate
public void addOnDeactivate(Callback callback)
Adds a callback method to be executed only once after the execution deactivated.- Specified by:
addOnDeactivatein interfaceExecutionCtrl- Parameters:
callback-- Since:
- 7.0.5
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-