org.zkoss.zk.ui.Execution.getDesktop()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.zkoss.zk.ui.Execution.getDesktop()方法的一些代码示例,展示了Execution.getDesktop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution.getDesktop()方法的具体详情如下:
包路径:org.zkoss.zk.ui.Execution
类名称:Execution
方法名:getDesktop

Execution.getDesktop介绍

[英]Returns the desktop associated with this execution. Each execution is against exactly one desktop.
[中]返回与此执行关联的桌面。每次执行仅针对一个桌面。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

/** Ensure the use of component is correct. */
private void checkDesktop(Component comp) {
  final Desktop dt = comp.getDesktop();
  if (dt != null && dt != _exec.getDesktop())
    throw new IllegalStateException(
        "Access denied: component, " + comp + ", belongs to another desktop: " + dt);
}

代码示例来源:origin: org.zkoss.zk/zkbind

public void init(Execution exec, Execution parent) throws Exception {
    Desktop desktop = exec.getDesktop();
    desktop.removeListener(_deferredActivator);
    BinderImpl.this.didActivate();
  }
}

代码示例来源:origin: org.zkoss.zk/zk

/** Constructor.
 *
 * @param exec the current execution, never null
 * @param locator the locator used to locate taglib and other resources.
 * If null, {@link #getWebApp} is used.
 */
public RequestInfoImpl(Execution exec, Locator locator) {
  this(exec.getDesktop(), exec.getNativeRequest(), locator);
}

代码示例来源:origin: org.zkoss.zk/zk

public void close() {
  _closed = true;
  final Execution exec = Executions.getCurrent();
  if (exec != null)
    close(exec.getDesktop());
  //queues of other desktops will be closed in EQService
}

代码示例来源:origin: org.zkoss.zk/zkplus

private static WebApp getWebApp() {
  WebApp app = null;
  final Execution exec = Executions.getCurrent();
  if (exec != null) {
    final Desktop desktop = exec.getDesktop();
    if (desktop != null) {
      app = desktop.getWebApp();
    }
  }
  return app;
}

代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.reporting

public Init() {
  Execution exec = Executions.getCurrent();
  exec.getDesktop().addListener(this);
}

代码示例来源:origin: org.zkoss.zk/zk

private static Desktop getDesktop(Component comp) {
  final Desktop dt = comp.getDesktop();
  if (dt != null)
    return dt;
  final Execution exec = Executions.getCurrent();
  return exec != null ? exec.getDesktop() : null;
}

代码示例来源:origin: org.zkoss.zk/zk

public ExecutionCarryOver(Desktop desktop) {
  _exec = Executions.getCurrent();
  if (_exec == null || _exec.getDesktop() != desktop)
    throw new IllegalStateException("Wrong execution: " + _exec);
  _locale = Locales.getCurrent();
  _timeZone = TimeZones.getCurrent();
}

代码示例来源:origin: org.zkoss.zk/zk

private static final UiEngine getUiEngine() {
    final Execution exec = getCurrent();
    if (exec == null)
      throw new IllegalStateException("This method can be called only under an event listener");
    return ((WebAppCtrl) exec.getDesktop().getWebApp()).getUiEngine();
  }
}

代码示例来源:origin: org.zkoss.zk/zk

public void preInit() {
  if (_desktop != null)
    throw new IllegalStateException("init twice");
  final Execution exec = Executions.getCurrent();
  _desktop = exec.getDesktop();
  if (_desktop == null)
    throw new IllegalArgumentException("null desktop");
  _desktop.getWebApp().getConfiguration().init(this);
}

代码示例来源:origin: org.zkoss.zk/zk

public void notifyAll(Object mutex) {
  final Execution exec = Executions.getCurrent();
  if (exec == null)
    throw new UiException("resume can be called only in processing a request");
  notifyAll(exec.getDesktop(), mutex);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Returns the UI engine of the current execution, or null
 * if no current execution.
 */
private UiEngine getCurrentUiEngine() {
  final Execution exec = Executions.getCurrent();
  return exec != null ? ((WebAppCtrl) exec.getDesktop().getWebApp()).getUiEngine() : null;
}

代码示例来源:origin: org.zkoss.zk/zk

/** Checks whether it is OK to detach the specified page.
 * @param page the page to detach (never null).
 */
private static void checkDetach(Page page) {
  final Execution exec = Executions.getCurrent();
  if (exec == null)
    throw new UiException("You cannot access a desktop other than an event listener");
  if (page.getDesktop() != exec.getDesktop())
    throw new UiException("You cannot access components belong to other desktop");
}

代码示例来源:origin: org.zkoss.zk/zk

public void execRecover(Execution exec, FailoverManager failover) {
  final Desktop desktop = exec.getDesktop();
  final Session sess = desktop.getSession();
  doActivate(exec, false, true, null, -1); //it must not return null
  try {
    failover.recover(sess, exec, desktop);
  } finally {
    doDeactivate(exec);
  }
}

代码示例来源:origin: org.zkoss.zk/zkplus

public HibernateSessionContextListener() {
  final WebApp app = Executions.getCurrent().getDesktop().getWebApp();
  _enabled = app.getConfiguration().isEventThreadEnabled();
}

代码示例来源:origin: org.zkoss.zk/zkplus

public SpringTransactionSynchronizationListener() {
  final WebApp app = Executions.getCurrent().getDesktop().getWebApp();
  _enabled = app.getConfiguration().isEventThreadEnabled();
}

代码示例来源:origin: org.zkoss.zk/zk

public void beginUpdate(Execution exec) {
  final UiVisualizer uv = doActivate(exec, true, false, null, -1);
  final Desktop desktop = exec.getDesktop();
  desktop.getWebApp().getConfiguration().invokeExecutionInits(exec, null);
  ((DesktopCtrl) desktop).invokeExecutionInits(exec, null);
}

代码示例来源:origin: org.zkoss.zk/zk

public Object startUpdate(Execution exec) throws IOException {
  final Desktop desktop = exec.getDesktop();
  UiVisualizer uv = doActivate(exec, true, false, null, -1);
  desktop.getWebApp().getConfiguration().invokeExecutionInits(exec, null);
  ((DesktopCtrl) desktop).invokeExecutionInits(exec, null);
  return new UpdateInfo(uv);
}

代码示例来源:origin: org.zkoss.zk/zul

private boolean isEventThreadEnabled(boolean attachedRequired) {
  Desktop desktop = getDesktop();
  if (desktop == null) {
    if (attachedRequired)
      throw new SuspendNotAllowedException("Not attached, " + this);
    final Execution exec = Executions.getCurrent();
    if (exec == null || (desktop = exec.getDesktop()) == null)
      return true; //assume enabled (safer)
  }
  return desktop.getWebApp().getConfiguration().isEventThreadEnabled();
}

代码示例来源:origin: org.zkoss.zk/zul

/** Open a download dialog to save the specified content at the client
 * with the suggested file name.
 *
 * @param media the media to download
 * @param flnm the suggested file name, e.g., myfile.pdf.
 * If null, {@link Media#getName} is assumed.
 */
public static void save(Media media, String flnm) {
  final Desktop desktop = Executions.getCurrent().getDesktop();
  ((WebAppCtrl) desktop.getWebApp()).getUiEngine().addResponse(new AuDownload(new DownloadURL(media, flnm))); //Bug 2114380
}

相关文章