|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DesktopCtrl
An addition interface to Desktop
for implementation.
Note: applications shall never access this interface.
| Method Summary | |
|---|---|
boolean |
activateServerPush(long timeout)
Activates the server push. |
void |
addComponent(Component comp)
Adds a component to this page. |
void |
addPage(Page page)
Adds a page to this desktop. |
void |
afterComponentAttached(Component comp,
Page page)
Invokes UiLifeCycle.afterComponentAttached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page). |
void |
afterComponentDetached(Component comp,
Page prevpage)
Invokes UiLifeCycle.afterComponentDetached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page). |
void |
afterComponentMoved(Component parent,
Component child,
Component prevparent)
Invokes UiLifeCycle.afterComponentMoved(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component). |
void |
afterProcessEvent(Event event)
Invokes EventInterceptor.afterProcessEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object). |
Event |
beforePostEvent(Event event)
Invokes EventInterceptor.beforePostEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object). |
Event |
beforeProcessEvent(Event event)
Invokes EventInterceptor.beforeProcessEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object). |
Event |
beforeSendEvent(Event event)
Invokes EventInterceptor.beforeSendEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object). |
boolean |
ceaseSuspendedThread(EventProcessingThread evtthd,
java.lang.String cause)
Ceases the specified event thread. |
void |
deactivateServerPush()
Deactivates the server push. |
void |
destroy()
Called when the desktop is about to be destroyed. |
boolean |
enableServerPush(ServerPush serverpush)
Enables the server-push feature with the specified server-push controller. |
Media |
getDownloadMedia(java.lang.String medId,
boolean reserved)
Returns the media that is associated with Desktop.getDownloadMediaURI(org.zkoss.util.media.Media, java.lang.String), or
null if not found. |
java.lang.Object |
getLastResponse(java.lang.String channel,
java.lang.String reqId)
Returns the information of response for the last request, or null if no response yet, or the specified request ID doesn't match the last one (passed to responseSent(java.lang.String, java.lang.String, java.lang.Object)). |
int |
getNextKey()
Returns the next available key which is unique in the whole desktop. |
java.lang.String |
getNextUuid()
Returns the next available UUID for a component. |
RequestQueue |
getRequestQueue()
Returns the request queue. |
int |
getResponseId(boolean advance)
Returns the sequence ID of the response. |
ServerPush |
getServerPush()
Returns the server-push controller, or null if it is not enabled yet. |
java.util.Collection |
getSuspendedThreads()
Returns a collection of suspended event processing threads, or empty if no suspended thread at all. |
void |
invokeDesktopCleanups()
Invokes DesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop) for each relevant
listener registered by Desktop.addListener(java.lang.Object). |
void |
invokeExecutionCleanups(Execution exec,
Execution parent,
java.util.List errs)
Invokes ExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List) for each relevant
listener registered by Desktop.addListener(java.lang.Object). |
void |
invokeExecutionInits(Execution exec,
Execution parent)
Invokes ExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution) for each relevant
listener registered by Desktop.addListener(java.lang.Object). |
void |
onPiggyback()
Called each time ZK Update Engine processes all events. |
void |
onPiggybackListened(Component comp,
boolean listen)
Called when a component added or removed a listener for Events.ON_PIGGYBACK. |
void |
recoverDidFail(java.lang.Throwable ex)
Called when the recoving failed. |
void |
removeComponent(Component comp)
Removes a component to this page. |
void |
removePage(Page page)
Removes a page from this desktop. |
void |
responseSent(java.lang.String channel,
java.lang.String reqId,
java.lang.Object resInfo)
Called when ZK Update Engine has sent a response to the client. |
void |
sessionDidActivate(Session sess)
Notification that the session, which owns this desktop, has just been activated (aka., deserialized) by the Web container. |
void |
sessionWillPassivate(Session sess)
Notification that the session, which owns this desktop, is about to be passivated (aka., serialized) by the Web container. |
void |
setBookmarkByClient(java.lang.String name)
Sets the bookmark when receiving the onBookmarkChange command from the client. |
void |
setExecution(Execution exec)
Sets the execution (used to represent a lock). |
void |
setId(java.lang.String id)
Sets the desktop identifier. |
void |
setResponseId(int resId)
Sets the sequence ID of the response. |
| Method Detail |
|---|
RequestQueue getRequestQueue()
int getNextKey()
java.lang.String getNextUuid()
RawId is used
(developer's responsibility to avoid conflict),
or integer overflow (too many UUID in one session, which
can be considered as impossible).
void addComponent(Component comp)
It is used internally and developers shall not invoke it explicityly.
void removeComponent(Component comp)
It is used internally and developers shall not invoke it explicityly.
void addPage(Page page)
This is one of the only few method you could access before activating an execution.
void removePage(Page page)
NOTE: once a page is removed, you can NOT add it back. You shall just GC it.
void setExecution(Execution exec)
void setBookmarkByClient(java.lang.String name)
void setId(java.lang.String id)
It is callable only if it is the recovering phase, i.e.,
ExecutionCtrl.isRecovering() is true.
In other words, callable only in the invocation of
FailoverManager.recover(org.zkoss.zk.ui.Session, org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Desktop).
java.lang.IllegalStateException - if it is NOT in recovering.void recoverDidFail(java.lang.Throwable ex)
void sessionWillPassivate(Session sess)
void sessionDidActivate(Session sess)
void destroy()
java.util.Collection getSuspendedThreads()
An event processing thread is an instance of
EventProcessingThread
Note: if you access this method NOT in an event listener for
the SAME desktop, you have to synchronize the iteration
(though the returned collection is synchronized).
Of course, it is always safe to test whether it is empty
(Collection.isEmpty()).
//Use the following pathern IF it is not in the SAME desktop's listener
Collection c = otherDesktop.getSuspendedThreads();
if (c.isEmpty()) {
//do something accordingly
} else {
synchronized (c) {
for (Iterator it = c.iterator(); it.hasNext();) {
//...
}
}
}
boolean ceaseSuspendedThread(EventProcessingThread evtthd,
java.lang.String cause)
cause - an arbitrary text to describe the cause.
It will be the message of the thrown InterruptedException.
Media getDownloadMedia(java.lang.String medId,
boolean reserved)
Desktop.getDownloadMediaURI(org.zkoss.util.media.Media, java.lang.String), or
null if not found.
This method is used internally. Developers rarely need to access this method.
reserved - reserved for future use.
void onPiggybackListened(Component comp,
boolean listen)
Events.ON_PIGGYBACK.
The implementation usualy uses it to optimize whether to
call the listener when onPiggyback() is called.
comp - the component that adds an listener for
Events.ON_PIGGYBACK.
The component may or may not be a root component.listen - whether the listener is added (or removed).void onPiggyback()
Events.ON_PIGGYBACK).
Used only internally. Application develepers shall not call it.
ServerPush getServerPush()
boolean enableServerPush(ServerPush serverpush)
serverpush - the server-push controller. If null,
the server-push feature is disabled (for this desktop).
Note: this method will invoke ServerPush.start(org.zkoss.zk.ui.Desktop), so the
caller doesn't need to do it.Desktop.enableServerPush(boolean)Event beforeSendEvent(Event event)
EventInterceptor.beforeSendEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object).
Note: it invokes
Configuration.beforeSendEvent(org.zkoss.zk.ui.event.Event)
automatically.
Event beforePostEvent(Event event)
EventInterceptor.beforePostEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object).
Note: it invokes
Configuration.beforePostEvent(org.zkoss.zk.ui.event.Event)
automatically.
Event beforeProcessEvent(Event event)
EventInterceptor.beforeProcessEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object).
Note: it invokes
Configuration.beforeProcessEvent(org.zkoss.zk.ui.event.Event)
automatically.
void afterProcessEvent(Event event)
EventInterceptor.afterProcessEvent(org.zkoss.zk.ui.event.Event)
registered by Desktop.addListener(java.lang.Object).
Note: it invokes
Configuration.afterProcessEvent(org.zkoss.zk.ui.event.Event)
automatically.
void invokeDesktopCleanups()
DesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop) for each relevant
listener registered by Desktop.addListener(java.lang.Object).
Used only internally.
It never throws an exception.
void invokeExecutionInits(Execution exec,
Execution parent)
throws UiException
ExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution) for each relevant
listener registered by Desktop.addListener(java.lang.Object).
Used only internally.
exec - the execution that is createdparent - the previous execution, or null if no previous at all
UiException - to prevent an execution from being created
void invokeExecutionCleanups(Execution exec,
Execution parent,
java.util.List errs)
ExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List) for each relevant
listener registered by Desktop.addListener(java.lang.Object).
Used only internally.
It never throws an exception but logs and adds it to the errs argument, if not null.
exec - the execution that is being destroyedparent - the previous execution, or null if no previous at allerrs - a list of exceptions (java.lang.Throwable) if any exception
occured before this method is called, or null if no exeption at all.
Note: you can manipulate the list directly to add or clean up exceptions.
For example, if exceptions are fixed correctly, you can call errs.clear()
such that no error message will be displayed at the client.
void afterComponentAttached(Component comp,
Page page)
UiLifeCycle.afterComponentAttached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page).
void afterComponentDetached(Component comp,
Page prevpage)
UiLifeCycle.afterComponentDetached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page).
void afterComponentMoved(Component parent,
Component child,
Component prevparent)
UiLifeCycle.afterComponentMoved(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component).
prevparent - the previous parent. If it is the same as
comp's Component.getParent(), comp is moved in the same parent.
void responseSent(java.lang.String channel,
java.lang.String reqId,
java.lang.Object resInfo)
Note: the implementation has to maintain one last-sent response information for each channel, since a different channel has different set of request IDs and might resend in a different condition.
channel - the request channel.
For example, "au" for AU requests and "cm" for Comet requests.reqId - the request ID that the response is generated for.
Ingore if null.resInfo - the response infomation. Ignored if reqId is null.
The real value depends on the caller.
java.lang.Object getLastResponse(java.lang.String channel,
java.lang.String reqId)
responseSent(java.lang.String, java.lang.String, java.lang.Object)).
The return value is the value passed to resInfo when calling
responseSent(java.lang.String, java.lang.String, java.lang.Object). The real value depends on the caller.
int getResponseId(boolean advance)
The range of the sequence IDs is 1~999.
advance - whether to advance the number before returning.
If true, the ID is increased and then returned.
If false, the previous value is returnedvoid setResponseId(int resId)
It is rarely called other than in the recovering mode, i.e.,
ExecutionCtrl.isRecovering() is true.
resId - a value between 1 and 999.
You can reset the ID by passing a non-positive value.
boolean activateServerPush(long timeout)
throws java.lang.InterruptedException
Executions.activate(org.zkoss.zk.ui.Desktop).
Note: the server push must be enabled first (by use of
Desktop.enableServerPush(boolean)).
timeout - the maximum time to wait in milliseconds.
Ingored (i.e., never timeout) if non-positive.
java.lang.InterruptedExceptionvoid deactivateServerPush()
Executions.deactivate(org.zkoss.zk.ui.Desktop).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||