Examples of AdaptrexConfig


Examples of com.adaptrex.core.AdaptrexConfig

    this.contextPath = request.getContextPath();
    this.setNamespace(namespace);
  };
 
  public String toString() {
    AdaptrexConfig config = AdaptrexRegistry.getConfig();
   
    StringBuilder output = new StringBuilder("\n");
   
    String contextPathOut = this.contextPath;
   
    String extVersionOut = this.extVersion;
    if (extVersionOut == null) extVersionOut = config.get(AdaptrexConfig.EXT_VERSION);
   
    String extBuildOut = this.extBuild;
    if (extBuildOut == null) extBuildOut = config.get(AdaptrexConfig.EXT_BUILD, "production");
   
    String webLibPathOut = this.weblibPath;
    if (webLibPathOut == null) webLibPathOut = config.get(AdaptrexConfig.WEBLIB, "lib");
   
    String senchaTouchVersionOut = this.senchaTouchVersion;
    if (senchaTouchVersionOut == null) senchaTouchVersionOut = config.get(AdaptrexConfig.SENCHATOUCH_VERSION);

    String senchaTouchPathOut = this.senchaTouchPath;
    if (senchaTouchPathOut == null) senchaTouchPathOut = config.get(AdaptrexConfig.SENCHATOUCH_PATH);
   
   
    if (!this.touch){
      /*
       * Ext Desktop
       */
      String extPathOut = this.extPath;
      if (extPathOut == null) extPathOut = config.get(AdaptrexConfig.EXT_PATH);
      if (extPathOut == null && extVersionOut != null) {
        extPathOut = "/extjs-" + extVersionOut + "/ext" + (extBuildOut.equals("production") ? "" : "-" + extBuildOut) + ".js";
      }
     
      String extThemeOut = null;
      String extFolder = null;
      if (extPathOut != null) {
        extFolder = extPathOut.substring(0, extPathOut.lastIndexOf("/"));
       
        extThemeOut = this.extTheme;
        if (extThemeOut == null) extThemeOut = config.get(AdaptrexConfig.EXT_THEME, "all");
        if (!extThemeOut.contains("/")) {
          extThemeOut = extFolder + "/resources/css/ext-" + extThemeOut + ".css";
       
      }
     
View Full Code Here

Examples of com.adaptrex.core.AdaptrexConfig

    @SuppressWarnings("unchecked")
  @Override
    public void encodeBegin(FacesContext context) throws IOException {
      try {
    Adaptrex adaptrex = Adaptrex.getAdaptrex();
    AdaptrexConfig config = adaptrex.getConfig();
   
          Map<String,Object> a = getAttributes();
         
          Map<String,Object> extConfig = new HashMap<String,Object>();
          if (adaptrex.getConfig().get("ext") != null) {
            extConfig.putAll((Map<String,Object>) config.get("ext"));
          }
         
          /*
           * If we're configuring Ext, do it here
           */
 
View Full Code Here

Examples of com.adaptrex.core.AdaptrexConfig

  public ConfigComponent(HttpServletRequest request) {
    this.contextPath = request.getContextPath();
  };
 
  public String toString() {
    AdaptrexConfig config = AdaptrexServices.getConfig();
   
    StringBuilder output = new StringBuilder("\n");
   
    String contextPathOut = this.contextPath;
   
    String extVersionOut = this.extVersion;
    if (extVersionOut == null) extVersionOut = config.get(AdaptrexConfig.EXT_VERSION);
   
    String extBuildOut = this.extBuild;
    if (extBuildOut == null) extBuildOut = config.get(AdaptrexConfig.EXT_BUILD, "production");
   
    String webLibPathOut = this.weblibPath;
    if (webLibPathOut == null) webLibPathOut = config.get(AdaptrexConfig.WEBLIB, "lib");
   
    String senchaTouchVersionOut = this.senchaTouchVersion;
    if (senchaTouchVersionOut == null) senchaTouchVersionOut = config.get(AdaptrexConfig.SENCHATOUCH_VERSION);

    String senchaTouchPathOut = this.senchaTouchPath;
    if (senchaTouchPathOut == null) senchaTouchPathOut = config.get(AdaptrexConfig.SENCHATOUCH_PATH);
   
   
    if (!this.touch){
      /*
       * Ext Desktop
       */
      String extPathOut = this.extPath;
      if (extPathOut == null) extPathOut = config.get(AdaptrexConfig.EXT_PATH);
      if (extPathOut == null && extVersionOut != null) {
        extPathOut = "/extjs-" + extVersionOut + "/ext" + (extBuildOut.equals("production") ? "" : "-" + extBuildOut) + ".js";
      }
     
      String extThemeOut = null;
      String extFolder = null;
      if (extPathOut != null) {
        extFolder = extPathOut.substring(0, extPathOut.lastIndexOf("/"));
       
        extThemeOut = this.extTheme;
        if (extThemeOut == null) extThemeOut = config.get(AdaptrexConfig.EXT_THEME, "all");
        if (!extThemeOut.contains("/")) {
          extThemeOut = extFolder + "/resources/css/ext-" + extThemeOut + ".css";
       
      }
     
View Full Code Here

Examples of com.adaptrex.core.AdaptrexConfig

  private static Map<String,ORMPersistenceManager> persistenceManagers
    = new HashMap<String,ORMPersistenceManager>();
 
  public static AdaptrexConfig getConfig() {
    if (config == null) {
      config = new AdaptrexConfig();
    }
    return config;
  }
View Full Code Here

Examples of com.adaptrex.core.config.AdaptrexConfig

  public Adaptrex() {
    //System.out.println("Initializing Adaptrex");
  }
 
  private void initConfig() {
    config = new AdaptrexConfig();
  }
View Full Code Here

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);
     
          /*
           * Read and configure ext path and build information
           */
      String extVersion = (String) tagAttr.get(AdaptrexConfig.EXT_VERSION);
      if (extVersion == null) extVersion = config.get(AdaptrexConfig.EXT_VERSION);
     
      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) {
        if (extVersion != null) {
          extPath = weblibPath + "/extjs-" + extVersion + "/ext" + (extBuild.equals("production") ? "" : "-" + extBuild) + ".js";
        }
      }
     
      /*
       * Write ext bootstrap code
       */
      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>");
          }
           
            /*
             * Bootstrap Ext classes we need for adaptrex stores and models
             */
            write ("<script type='text/javascript' src='" + contextPath + weblibPath + "/adaptrex-bootstrap-ext-" + extVersion + ".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>");
      }
     
          /*
           * 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);
            write("<script type='text/javascript'>Ext.ns('" + namespace + "')</script>");
          }
     
View Full Code Here

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();
     
          /*
           * Read ext build configuration
           */
      String extBuild = (String) tagAttr.get(AdaptrexConfig.EXT_BUILD);
      if (extBuild == null) extBuild = config.get(AdaptrexConfig.EXT_BUILD, "production");     
     
      write("<script type='text/javascript' src='app" + (extBuild.equals("production") ? "-all" : "") + ".js'></script>");
     
      } catch (Exception e) {
        log.warn("Error", e);
View Full Code Here

Examples of com.adaptrex.core.config.AdaptrexConfig

  @Override
    public void encodeBegin(FacesContext context) throws IOException {
      try {
          Map<String,Object> a = getAttributes();
          ContextConfig contextConfig = CdiService.getContextConfig();
          AdaptrexConfig adaptrexConfig = CdiService.getAdaptrexConfig();
         
          Map<String,Object> extConfig = new HashMap<String,Object>();
          if (adaptrexConfig.get("ext") != null) {
            extConfig.putAll((Map<String,Object>) adaptrexConfig.get("ext"));
          }
          if (contextConfig.get("ext") != null) {
            extConfig.putAll((Map<String,Object>) contextConfig.get("ext"));
          }
         
View Full Code Here

Examples of com.adaptrex.core.config.AdaptrexConfig

  private static ObjectMapper mapper;
  private static ObjectWriter writer;
  public static String json(Object object) {
    if (mapper == null) mapper = new ObjectMapper();
    try {
      AdaptrexConfig config = CdiService.getAdaptrexConfig();
      if (config.get("debug") != null && (Boolean) config.get("debug")) {
        if (writer == null) {
          writer = mapper.writerWithDefaultPrettyPrinter();
        }
        return writer.writeValueAsString(object);
      } else {
View Full Code Here

Examples of com.adaptrex.core.config.AdaptrexConfig

  public Adaptrex() {
    //System.out.println("Initializing Adaptrex");
  }
 
  private void initConfig() {
    config = new AdaptrexConfig();
  }
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.