Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Desktop


    if (_image instanceof Image)
      return Utils.getDynamicMediaURI( //already encoded
        this, _imgver,
        "c/" + ((Image)_image).getName(), ((Image)_image).getFormat());

    final Desktop dt = getDesktop(); //it might not belong to any desktop
    return dt != null && _image != null ?
      dt.getExecution().encodeURL((String)_image): null;
  }
View Full Code Here


    if (_hoverimg instanceof Image)
      return Utils.getDynamicMediaURI(
        this, _hoverimgver,
        "h/" + ((Image)_hoverimg).getName(), ((Image)_hoverimg).getFormat());

    final Desktop dt = getDesktop(); //it might not belong to any desktop
    return dt != null && _hoverimg != null ?
      dt.getExecution().encodeURL((String)_hoverimg): null;
  }
View Full Code Here

   *
   * @since 3.0.2
   */
  public static String getDynamicMediaURI(AbstractComponent comp,
  int version, String name, String format) {
    final Desktop desktop = comp.getDesktop();
    if (desktop == null) return ""; //no avail at client

    final StringBuffer sb = new StringBuffer(64).append('/');
    Strings.encode(sb, version & 0xffff);
    if (name != null || format != null) {
      sb.append('/');
      boolean bExtRequired = true;
      if (name != null && name.length() != 0) {
        name = name.replace('\\', '/');
        if (name.charAt(0) == '/') {
          name = name.substring(1);
          if (name.length() == 0) name = "ua";
        }
        sb.append(name);
        bExtRequired = name.lastIndexOf('.') < 0;
      } else {
        sb.append(comp.getId());
      }
      if (bExtRequired && format != null)
        sb.append('.').append(format);
    }
    return desktop.getDynamicMediaURI(comp, sb.toString()); //already encoded
  }
View Full Code Here

   * @since 5.0.4
   */
  public static Component getComponentById(Component comp, String id) {
    final int len = id.length();
    if (id.startsWith("uuid(") && id.charAt(len - 1) == ')') {
      Desktop dt = comp.getDesktop();
      if (dt == null) {
        final Execution exec = Executions.getCurrent();
        if (exec == null)
          return null;
        dt = exec.getDesktop();
      }
      return dt != null ? dt.getComponentByUuidIfAny(id.substring(5, len - 1)): null;
    }
    return comp.getFellowIfAny(id);
  }
View Full Code Here

  public Page getChildPage() {
    return _childpg;
  }
  public void setChildPage(Page page) {
    if (_childpg != null && page == null) {
      final Desktop desktop = getDesktop();
      if (desktop != null)
        ((DesktopCtrl)desktop).removePage(_childpg);
    }
    _childpg = page;
  }
View Full Code Here

        restoreDynams(exec, old);
      }
    }
  }
  private Execution getExecution() {
    final Desktop desktop = getDesktop();
    return desktop != null ? desktop.getExecution(): Executions.getCurrent();
  }
View Full Code Here

    } finally {
      ueng.setOwner(old);
    }
  }
  private void include(Writer out) throws IOException {
    final Desktop desktop = getDesktop();
    final Execution exec = getExecution();
    final String src = exec.toAbsoluteURI(_src, false);
    final Map old = setupDynams(exec);
    ComponentRedraws.beforeRedraw(true); //starting a new page
    try {
      exec.include(out, src, null, 0);
    } catch (Throwable err) {
      setChildPage(null);
    //though DHtmlLayoutServlet handles exception, we still have to
    //handle it because src might not be ZUML
      final String errpg =
        desktop.getWebApp().getConfiguration().getErrorPage(
          desktop.getDeviceType(), err);
      if (errpg != null) {
        try {
          exec.setAttribute("javax.servlet.error.message", Exceptions.getMessage(err));
          exec.setAttribute("javax.servlet.error.exception", err);
          exec.setAttribute("javax.servlet.error.exception_type", err.getClass());
View Full Code Here

   */
  public Object getValue(Component comp) {
    if (_value != null)
      return _value.getValue(_evalr, comp);

    Desktop desktop = comp.getDesktop();
    Page page;
    if (desktop == null) {
      Execution exec = Executions.getCurrent();
      if (exec == null)
        throw new IllegalStateException("Not attached, nor execution");
      desktop = exec.getDesktop();
      page = ((ExecutionCtrl)exec).getCurrentPage();
    } else {
      page = comp.getPage();
    }
    return ((WebAppCtrl)desktop.getWebApp()).getUiEngine()
      .getNativeContent(comp, _navval.getChildren(),
      ((Native)_navval.newInstance(page, comp)).getHelper());
  }
View Full Code Here

    return true;
  }
  private static boolean isObsolete(AuRequest request) {
    final Component comp = request.getComponent();
    if (comp != null) {
      final Desktop dt = comp.getDesktop();
      return dt != null && dt != request.getDesktop();
      //Since 3.5.0, we allow a component to process events even
      //if it is detached (due to implementation of EventQueue)
    }
    return false;
View Full Code Here

    final HttpServletRequest httpreq = RenderHttpServletRequest.getInstance(request);
    final HttpServletResponse httpres = RenderHttpServletResponse.getInstance(response);
    final ServletContext svlctx = (ServletContext)wapp.getNativeContext();

    final DesktopRecycle dtrc = wapp.getConfiguration().getDesktopRecycle();
    Desktop desktop = dtrc != null ? Utils.beforeService(dtrc, svlctx, sess, httpreq, httpres, path): null;

    try {
      if (desktop != null) { //recycle
        final Page page = Utils.getMainPage(desktop);
        if (page != null) {
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.Desktop

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.