Examples of AdaptrexConfig


Examples of com.adaptrex.core.config.AdaptrexConfig

  @Override
    public void encodeBegin(FacesContext context) throws IOException {
      try {
      Adaptrex adaptrex = Adaptrex.getAdaptrex();
     
      AdaptrexConfig config = adaptrex.getConfig();
          Map<String,Object> tagAttr = getAttributes();
       
      String contextPath = context.getExternalContext().getRequestContextPath();
      if (contextPath.isEmpty()) contextPath = "/";

      /*
       * Weblib path
       */
      String weblibPath = (String) tagAttr.get(AdaptrexConfig.WEBLIB);
      if (weblibPath == null) weblibPath = config.get(AdaptrexConfig.WEBLIB);
     
          /*
           * If we're configuring Ext, do it here
           */
      String extBuild = (String) tagAttr.get(AdaptrexConfig.EXT_BUILD);
      if (extBuild == null) extBuild = config.get(AdaptrexConfig.EXT_BUILD, "production");     
     
     
      String extPath = (String) tagAttr.get(AdaptrexConfig.EXT_PATH);       
      if (extPath == null) extPath = config.get(AdaptrexConfig.EXT_PATH);
      if (extPath == null) {
        String extVersion = (String) tagAttr.get(AdaptrexConfig.EXT_VERSION);
        if (extVersion == null) extVersion = config.get(AdaptrexConfig.EXT_VERSION);
       
        if (extVersion != null) {
          extPath = weblibPath + "/extjs-" + extVersion + "/ext" + (extBuild.equals("production") ? "" : "-" + extBuild) + ".js";
        }
      }
     
      if (extPath != null) {
        write("<script type='text/javascript' src='" + contextPath + extPath + "'></script>");
        String extFolder = extPath.substring(0, extPath.lastIndexOf("/"));
       
        String theme = (String) tagAttr.get(AdaptrexConfig.EXT_THEME);
        if (theme == null) theme = config.get(AdaptrexConfig.EXT_THEME, "all");
        if (!theme.contains("/")) {
          theme = extFolder + "/resources/css/ext-" + theme + ".css";
        }
       
        write("<link rel='stylesheet' type='text/css' href='" + contextPath + theme + "' />");
       
            if (theme.contains("neptune")) {
            write("<script type='text/javascript' src='" + contextPath + extFolder + "/ext-neptune.js'></script>");
          }
       
         if (!extBuild.equals("production")) {
          write("<script type='text/javascript' src='app.js'></script>");
         }       
      }

         
         
              /*
               * Set up adaptrex loader if we're in debug mode
               */
          String adaptrexFolder = contextPath + weblibPath + "/adaptrexjs";
          write("<script type='text/javascript' src='" + adaptrexFolder + "/adaptrex.js'></script>");
          write("<script type='text/javascript'>Adaptrex.Context={path:'" + contextPath + "'}</script>");
          if (config.get(AdaptrexConfig.DEBUG).equals("true")) {
            write("<script type='text/javascript'>" +
                "Ext.Loader.setPath('Adaptrex', '" + adaptrexFolder + "/src')</script>");
          }

//
//         if (tagAttr.get("touch") != null) {
//           setAttribute("touch", Boolean.parseBoolean((String) tagAttr.get("touch")));
//         } else {
//           setAttribute("touch", false);
//         }

     
          /*
           * Set up namespace
           */
          String namespace = (String) tagAttr.get(AdaptrexConfig.EXT_NAMESPACE);
      if (namespace == null) namespace = (String) tagAttr.get("ns");
      if (namespace == null) namespace = (String) tagAttr.get("namespace");
      if (namespace == null) namespace = config.get(AdaptrexConfig.EXT_NAMESPACE);
          if (namespace != null) {
            setAttribute("namespace", namespace);
          }
     
      } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.