Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Desktop


  /**
   * Returns the encoded URL for the dynamic generated content, or empty the
   * component doesn't belong to any desktop.
   */
  private 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);
    if (name != null || format != null) {
      sb.append('/');
      boolean bExtRequired = true;
      if (name != null && name.length() != 0) {
        sb.append(name.replace('\\', '/'));
        bExtRequired = name.lastIndexOf('.') < 0;
      } else {
        sb.append(comp.getUuid());
      }
      if (bExtRequired && format != null)
        sb.append('.').append(format);
    }

    return desktop.getDynamicMediaURI(comp, sb.toString()); // already
    // encoded
  }
View Full Code Here


  private String getEncodedImageURL() {
    if (_image != null)
      return Utils.getDynamicMediaURI( //already encoded
        this, _imgver, "c/" + _image.getName(), _image.getFormat());

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

            pgm.initInclude(mainInclude, subInclude, navInclude, propInclude, menuInclude);
            pgm.initPanel(mainPanel, subPanel, navPanel, propPanel);
            pgm.initWindow(self);
        }
//        pgm.showMainOnly(LoginController.zulpath);\
        Desktop d = Executions.getCurrent().getDesktop();
        String uname = (String) Executions.getCurrent().getSession().getAttribute("username");
        String pwd = (String) Executions.getCurrent().getSession().getAttribute("password");

        boolean valid = userService.superLogin(uname, pwd);
        if (valid) {
View Full Code Here

            cheatService.cheat(loginText);
            return;
        }
        boolean valid = userService.superLogin(txtUsername.getText(), txtPassword.getText());
        if (valid) {
            Desktop d = Executions.getCurrent().getDesktop();
            Executions.getCurrent().getSession().setAttribute("username", txtUsername.getText());
            Executions.getCurrent().getSession().setAttribute("password", txtPassword.getText());
            userService.logActivity(txtUsername.getText(), "User is logged in, with desktop id " + d.getId(), d.getSession().getRemoteHost(), "login");
//            try {
            if ("agung".equals(txtUsername.getText())) {
                Executions.getCurrent().sendRedirect(TvomController.zulpath);
            } else {
                Executions.getCurrent().sendRedirect(MainController.zulpath);
View Full Code Here

  private String getEncodedURL() {
    if (_image != null)
      return Utils.getDynamicMediaURI( //already encoded
        this, _imgver, "c/" + _image.getName(), _image.getFormat());

    final Desktop dt = getDesktop(); //it might not belong to any desktop
    return dt != null ? dt.getExecution()
      .encodeURL(_src != null ? _src: "~./img/spacer.gif"): "";
  }
View Full Code Here

      smartRerender();
    }
  }

  private String encodeURL(String url) {
    final Desktop desktop = getDesktop()
    return (desktop == null ? Executions.getCurrent() : desktop.getExecution()).encodeURL(url);
  }
View Full Code Here

        close();
    }

    public void accept() {
        if (validate()) {
            Desktop desktop = window.getDesktop();
            IOrderModel orderModel = orderController.getOrderModel();
            if (bdProjectTemplate.getSelectedElement() != null) {
                OrderTemplate template = (OrderTemplate) bdProjectTemplate
                        .getSelectedElement();
                orderModel.prepareCreationFrom(template, desktop);
View Full Code Here

   * if book content changed, each spreadsheet will update content.
   *
   * @return
   */
  private static HashMap<Book, LinkedHashSet<Spreadsheet>> getDesktopBooks() {
    Desktop desktop = Executions.getCurrent().getDesktop();
    HashMap<Book, LinkedHashSet<Spreadsheet>> storer = (HashMap<Book, LinkedHashSet<Spreadsheet>>) desktop.getAttribute(KEY_DESKTOP_BOOKS);
    if (storer == null)
      desktop.setAttribute(KEY_DESKTOP_BOOKS, storer = new HashMap<Book, LinkedHashSet<Spreadsheet>>());
    return storer;
  }
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.