org.zkoss.zk.ui.sys
Interface ExecutionCtrl

All Known Implementing Classes:
AbstractExecution, ExecutionImpl

public interface ExecutionCtrl

Additional interface to Execution for implementation.

Application developers shall never access any of this methods.

Author:
tomyeh

Method Summary
 void addDateHeader(java.lang.String name, long value)
          Adds a response header with the given name and date-value.
 void addHeader(java.lang.String name, java.lang.String value)
          Adds a responseheader with the given name and value.
 Page getCurrentPage()
          Returns the current page.
 PageDefinition getCurrentPageDefinition()
          Returns the current page definition, which is pushed when evaluating a page (from a page definition).
 Event getNextEvent()
          Returns the next event queued by Execution.postEvent(org.zkoss.zk.ui.event.Event), or null if no event queued.
 java.lang.Object getRequestAttribute(java.lang.String name)
          Returns the value of an attribute in the client request (e.g., HTTP request) that creates this execution.
 Visualizer getVisualizer()
          Returns the Visualizer for this execution (set by setVisualizer(org.zkoss.zk.ui.sys.Visualizer).
 boolean isActivated()
          Returns whether this execution is activated.
 boolean isRecovering()
          Returns whether this execution is in recovering.
 void onActivate()
          Called when this execution is about to become the current execution Executions.getCurrent().
 void onDeactivate()
          Called when this execution is about to become a non-current execution.
 void setCurrentPage(Page page)
          Sets the current page.
 void setCurrentPageDefinition(PageDefinition pgdef)
          Sets the current page definition.
 void setDateHeader(java.lang.String name, long value)
          Sets a response header with the given name and date-value.
 void setDesktop(Desktop desktop)
          Sets the desktop associated with this execution.
 void setHeader(java.lang.String name, java.lang.String value)
          Sets a responseheader with the given name and value.
 void setRequestAttribute(java.lang.String name, java.lang.Object value)
          Sets the value of an attribute to the client request (e.g., HTTP request) that creates this execution.
 void setVisualizer(Visualizer ei)
          Sets the Visualizer for this execution.
 

Method Detail

getCurrentPage

Page getCurrentPage()
Returns 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 conccept of the current page.

See Also:
Desktop.getPage(java.lang.String)

setCurrentPage

void setCurrentPage(Page page)
Sets 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.


getCurrentPageDefinition

PageDefinition getCurrentPageDefinition()
Returns the current page definition, which is pushed when evaluating a page (from a page definition).


setCurrentPageDefinition

void setCurrentPageDefinition(PageDefinition pgdef)
Sets the current page definition.

Parameters:
pgdef - the page definition. If null, it means it is the same as getCurrentPage().getPageDefinition().

getNextEvent

Event getNextEvent()
Returns the next event queued by Execution.postEvent(org.zkoss.zk.ui.event.Event), or null if no event queued.


isActivated

boolean isActivated()
Returns whether this execution is activated.


onActivate

void onActivate()
Called when this execution is about to become the current execution 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.


onDeactivate

void onDeactivate()
Called 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.

See Also:
onActivate()

isRecovering

boolean isRecovering()
Returns whether this execution is in recovering. In other words, it is in the invocation of 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.


setVisualizer

void setVisualizer(Visualizer ei)
Sets the Visualizer for this execution. It could be anything that UiEngine requires.


getVisualizer

Visualizer getVisualizer()
Returns the Visualizer for this execution (set by setVisualizer(org.zkoss.zk.ui.sys.Visualizer).


setHeader

void setHeader(java.lang.String name,
               java.lang.String value)
Sets a responseheader with the given name and value.

Parameters:
value - the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt).

setDateHeader

void setDateHeader(java.lang.String name,
                   long value)
Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. This method allows response headers to have multiple values.

Since:
3.0.0

addHeader

void addHeader(java.lang.String name,
               java.lang.String value)
Adds a responseheader with the given name and value.

Parameters:
value - the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt).
Since:
3.0.0

addDateHeader

void addDateHeader(java.lang.String name,
                   long value)
Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. This method allows response headers to have multiple values.

Since:
3.0.0

getRequestAttribute

java.lang.Object getRequestAttribute(java.lang.String name)
Returns the value of an attribute in the client request (e.g., HTTP request) that creates this execution.

Notice that a servlet might include serveral ZK pages, while an independent execution is created for adding a new page. It means, each client request might create several executions. Thus, the attribute set by this method might last for several executions (until the request ends).


setRequestAttribute

void setRequestAttribute(java.lang.String name,
                         java.lang.Object value)
Sets the value of an attribute to the client request (e.g., HTTP request) that creates this execution.


setDesktop

void setDesktop(Desktop desktop)
Sets 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.

Throws:
java.lang.IllegalArgumentException - if desktop is null
java.lang.IllegalStateException - if there is already a desktop is associated with it.
Since:
3.0.0


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.