Пример #1
0
  /**
   * Generates the special JavaScript code, such as the application's name. It shall be called,
   * before generating "zkmx(" and "zkx(".
   *
   * @since 5.0.6
   */
  public static final String outSpecialJS(Desktop desktop) {
    final StringBuffer sb = new StringBuffer();

    // output application name
    String oldnm = (String) desktop.getAttribute(ATTR_APPNM);
    if (oldnm == null) oldnm = "ZK";
    final String appnm = desktop.getWebApp().getAppName();
    if (!oldnm.equals(appnm)) {
      sb.append("zk.appName='");
      Strings.escape(sb, appnm, Strings.ESCAPE_JAVASCRIPT).append("';");
      desktop.setAttribute(ATTR_APPNM, appnm);
    }

    // output zktheme cookie
    String oldthemenm = (String) desktop.getAttribute(ATTR_THEMENM);
    if (oldthemenm == null) oldthemenm = "";
    final Object request = desktop.getExecution().getNativeRequest();
    String themenm = "";
    if (request instanceof HttpServletRequest) {
      themenm = ThemeFns.getThemeResolver().getTheme((HttpServletRequest) request);
    }
    if (!oldthemenm.equals(themenm)) {
      sb.append("zk.themeName='");
      Strings.escape(sb, themenm, Strings.ESCAPE_JAVASCRIPT).append("';");
      desktop.setAttribute(ATTR_THEMENM, themenm);
    }

    // output ZK ICON
    final Session sess = Sessions.getCurrent();
    if (sess != null) {
      WebApp wapp = desktop.getWebApp();
      if (wapp == null
          || "CE".equals(WebApps.getEdition())
          || wapp.getAttribute("org.zkoss.zk.ui.notice") != null) {
        final PI pi = (PI) sess.getAttribute(ATTR_PI);
        boolean show = pi == null;
        if (show) sess.setAttribute(ATTR_PI, new PI());
        else show = pi.show();
        if (show) sb.append("zk.pi=1;");
      }
    }
    return sb.toString();
  }
  public static Object[] getItensComboTiposControlador() {
    String[] tiposControle = {
      SELECIONE.getDescricao(),
      P.getDescricao(),
      PI.getDescricao(),
      PD.getDescricao(),
      PID.getDescricao(),
      PI_D.getDescricao(),
      SEM_CONTROLADOR.getDescricao()
    };

    return tiposControle;
  }