Examples of ModelDefinition


Examples of com.adaptrex.core.ext.ModelDefinition

    String fullModelName = namespace +  ".model." + modelName;
   
    /*
     * Get the model definition
     */
    ModelDefinition modelDefinition = new ModelDefinition(this.extConfig);
   
    /*
     * Add the rest API to the model
     */
    modelDefinition.setProxy(this.restProxy);
   
    if (request.getAttribute("adaptrex_touch") == null) {
      modelDefinitionStrings.add("Ext.define('" + fullModelName + "', " +
          StringUtilities.json(modelDefinition) + ")");
    } else {
      modelDefinitionStrings.add("Ext.define('" + fullModelName + "', {extend:'Ext.data.Model', config:" +
          StringUtilities.json(modelDefinition) + "})");
    }
   
   
    /*
     * Get the model's association definitions
     */
    getAllAssociations(modelDefinition);
    for (Association association : associations) {
      ModelDefinition assocModelDef = association.getModelDefinition();
      if (assocModelDef != null) {
        if (request.getAttribute("adaptrex_touch") == null) {
          modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', " +
              StringUtilities.json(assocModelDef) + ")");
        } else {
          modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', {extend:'Ext.data.Model', config:" +
              StringUtilities.json(assocModelDef) + "})");       
        }
      }
    }
   
View Full Code Here

Examples of com.adaptrex.core.ext.ModelDefinition

    String fullModelName = namespace +  ".model." + modelName;
   
    /*
     * Get the model definition
     */
    ModelDefinition modelDefinition = new ModelDefinition(this.extConfig);
   
    /*
     * Add the rest API to the model
     */
    modelDefinition.setProxy(this.restProxy);
   
    if (request.getAttribute("adaptrex_touch") == null) {
      modelDefinitionStrings.add("Ext.define('" + fullModelName + "', " +
          StringUtilities.json(modelDefinition) + ")");
    } else {
      modelDefinitionStrings.add("Ext.define('" + fullModelName + "', {extend:'Ext.data.Model', config:" +
          StringUtilities.json(modelDefinition) + "})");
    }
   
   
    /*
     * Get the model's association definitions
     */
    getAllAssociations(modelDefinition);
    for (Association association : associations) {
      ModelDefinition assocModelDef = association.getModelDefinition();
      if (assocModelDef != null) {
        if (request.getAttribute("adaptrex_touch") == null) {
          modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', " +
              StringUtilities.json(assocModelDef) + ")");
        } else {
          modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', {extend:'Ext.data.Model', config:" +
              StringUtilities.json(assocModelDef) + "})");       
        }
      }
    }
   
View Full Code Here

Examples of com.adaptrex.core.ext.ModelDefinition

    String fullModelName = namespace +  ".model." + modelName;
   
    /*
     * Get the model definition
     */
    ModelDefinition modelDefinition = new ModelDefinition(this.extConfig);
   
    /*
     * Add the rest API to the model
     */
    modelDefinition.setProxy(this.restProxy);
   
    if (request.getAttribute("adaptrex_touch") == null) {
      modelDefinitionStrings.add("Ext.define('" + fullModelName + "', " +
          StringUtilities.json(modelDefinition) + ")");
    } else {
      modelDefinitionStrings.add("Ext.define('" + fullModelName + "', {extend:'Ext.data.Model', config:" +
          StringUtilities.json(modelDefinition) + "})");
    }
   
   
    /*
     * Get the model's association definitions
     */
    getAllAssociations(modelDefinition);
    for (Association association : associations) {
      ModelDefinition assocModelDef = association.getModelDefinition();
      if (assocModelDef != null) {
        if (request.getAttribute("adaptrex_touch") == null) {
          modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', " +
              StringUtilities.json(assocModelDef) + ")");
        } else {
          modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', {extend:'Ext.data.Model', config:" +
              StringUtilities.json(assocModelDef) + "})");       
        }
      }
    }
   
View Full Code Here

Examples of com.adaptrex.core.ext.ModelDefinition

   
    /*
     * Get the model definition
     */
    log.debug("Creating model definition for " + fullModelName);
    ModelDefinition modelDefinition = new ModelDefinition(this.extConfig);
   
    /*
     * Add the rest API to the model
     */
    modelDefinition.setProxy(this.restProxy);
    modelDefinitionStrings.add("Ext.define('" + fullModelName + "', " +
        (isTouch ? "{extend:'Ext.data.Model', config:" : "") +
        StringUtilities.json(modelDefinition, this.request.getServletContext()) + (isTouch ? "}" : "") + ");\n");
   
   
    /*
     * Get the model's association definitions
     */
    getAllAssociations(modelDefinition);
    for (Association association : associations) {
      ModelDefinition assocModelDef = association.getModelDefinition();
      if (assocModelDef != null) {
        /*
         * If we have a rest proxy for the parent model, add one for associated models
         */
        if (this.restProxy != null) {
          String restPath = getRestPath(association.getEntityClassName().toLowerCase());
          if (!restPath.equals("false")) {
            RestProxy associatedProxy = new RestProxy(restPath, extConfig, this.configComponent.isTouch());
            assocModelDef.setProxy(associatedProxy);
          }
         
        }

        modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', " +
            (isTouch ? "{extend:'Ext.data.Model', config:" : "") +
            StringUtilities.json(assocModelDef, this.request.getServletContext()) + (isTouch ? "}" : "") + ");\n");
      }
    }
   
View Full Code Here

Examples of com.adaptrex.core.ext.ModelDefinition

   
    /*
     * Get the model definition
     */
    log.debug("Creating model definition for " + fullModelName);
    ModelDefinition modelDefinition = new ModelDefinition(this.extConfig);
   
    /*
     * Add the rest API to the model
     */
    modelDefinition.setProxy(this.restProxy);
    modelDefinitionStrings.add("Ext.define('" + fullModelName + "', " +
        (isTouch ? "{extend:'Ext.data.Model', config:" : "") +
        StringUtilities.json(modelDefinition, this.request.getServletContext()) + (isTouch ? "}" : "") + ");\n");
   
   
    /*
     * Get the model's association definitions
     */
    getAllAssociations(modelDefinition);
    for (Association association : associations) {
      ModelDefinition assocModelDef = association.getModelDefinition();
      if (assocModelDef != null) {
        /*
         * If we have a rest proxy for the parent model, add one for associated models
         */
        if (this.restProxy != null) {
          String restPath = getRestPath(association.getEntityClassName().toLowerCase());
          if (!restPath.equals("false")) {
            RestProxy associatedProxy = new RestProxy(restPath, extConfig, this.configComponent.isTouch());
            assocModelDef.setProxy(associatedProxy);
          }
         
        }

        modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', " +
            (isTouch ? "{extend:'Ext.data.Model', config:" : "") +
            StringUtilities.json(assocModelDef, this.request.getServletContext()) + (isTouch ? "}" : "") + ");\n");
      }
    }
   
View Full Code Here

Examples of com.adaptrex.core.ext.data.ModelDefinition

    /*
     * TODO: Make sure we're outputting our model definition in the same way
     * as in the store
     */
    ModelDefinition modelDef = model.getModelDefinition();
    String output = "Ext.define(\"" + modelName + "\","
        + StringUtilities.json(modelDef) + ");\n";

    for (Association assoc : getAllAssociations(modelDef)) {
      ModelDefinition associatedModel = assoc
          .getAssociatedModelDefinition();
      if (associatedModel == null) {
        continue;
      }

View Full Code Here

Examples of com.adaptrex.core.ext.data.ModelDefinition

        config.setProxy(new RestProxy(restPath, config));
      }


      StoreDefinition storeDefinition = store.getStoreDefinition();
      ModelDefinition baseModelDefinition = store.getModelDefinition();

      /*
       * Write the javascript for this store/model.
       *
       * During development using Ext.Loader, we need to syncRequire Ext.data.Model.
       * If we asynchronously load all of our model's dependencies, they will not be
       * available at the time we define our store.  If they are not available, our
       * model definition will not yet be instantiated and Ext.Loader will attempt (and fail)
       * to load it dynamically.
       */
      String extBuild = param(a, AdaptrexConfig.EXT_BUILD);
      if (extBuild == null) extBuild = Adaptrex.getAdaptrex().getConfig().get(AdaptrexConfig.EXT_BUILD, "production")
     
      String storeName = namespace + ".store." + StringUtilities.pluralize(config.getSimpleModelName());
     
      /*
       * Build the output javascript
       */
      String output = "Ext.define(\"" + modelName + "\"," + StringUtilities.json(baseModelDefinition) + ");\n"
          + "Ext.define(\"" + storeName + "\"," + StringUtilities.json(storeDefinition) + ");\n";

      for (Association assoc : getAllAssociations(baseModelDefinition)) {
        ModelDefinition associatedModel = assoc.getAssociatedModelDefinition();
        if (associatedModel == null) {
          continue;
        }

        output += "Ext.define(\"" + assoc.getModelName() + "\"," + StringUtilities.json(associatedModel) + ");\n";
View Full Code Here

Examples of com.adaptrex.core.ext.data.ModelDefinition

      (rest.equals("true") ? clazz.getSimpleName().toLowerCase() : rest);
      config.setProxy(new RestProxy(restPath, config));
  }


  ModelDefinition modelDef = model.getModelDefinition();
  String output = "Ext.define(\"" + modelName + "\"," + StringUtilities.json(modelDef) + ");\n";

  for (Association assoc : getAllAssociations(modelDef)) {
      ModelDefinition associatedModel = assoc.getAssociatedModelDefinition();
      if (associatedModel == null) {
    continue;
      }

      output += "Ext.define(\"" + assoc.getModelName() + "\"," + StringUtilities.json(associatedModel) + ");\n";
View Full Code Here

Examples of com.adaptrex.core.ext.data.ModelDefinition

        config.setProxy(new RestProxy(restPath, config));
      }


      StoreDefinition storeDefinition = store.getStoreDefinition();
      ModelDefinition baseModelDefinition = store.getModelDefinition();

      /*
       * Write the javascript for this store/model.
       *
       * During development using Ext.Loader, we need to syncRequire Ext.data.Model.
       * If we asynchronously load all of our model's dependencies, they will not be
       * available at the time we define our store.  If they are not available, our
       * model definition will not yet be instantiated and Ext.Loader will attempt (and fail)
       * to load it dynamically.
       */
      String storeName = ns + ".store." + StringUtilities.pluralize(config.getSimpleModelName());
      String output = ""
          + "Ext.syncRequire(['Ext.data.Model','Ext.data.Store','Ext.data.reader.Json','Ext.data.writer.Json'], function(){;\n"
          + "Ext.define(\"" + modelName + "\"," + StringUtilities.json(baseModelDefinition) + ");\n"
          + "Ext.define(\"" + storeName + "\"," + StringUtilities.json(storeDefinition) + ");\n"
          + "Ext.onReady(function() {Ext.create(\"" + storeName + "\", {storeId:\"" + storeName.split(".store.")[1] + "\"})})\n";


      for (Association assoc : getAllAssociations(baseModelDefinition)) {
        ModelDefinition associatedModel = assoc.getAssociatedModelDefinition();
        if (associatedModel == null) {
          continue;
        }

        output += "Ext.define(\"" + assoc.getModelName() + "\"," + StringUtilities.json(associatedModel) + ");\n";
View Full Code Here

Examples of com.adaptrex.core.ext.data.ModelDefinition

        restPath += (rest.equals("true") ? model.getConfig().getClazz().getSimpleName().toLowerCase() : rest);
        model.proxy(restPath);
      }
     
     
      ModelDefinition modelDef = model.getModelDefinition();
      String modelName = ns + ".model." + model.getConfig().getModelName();
      String output =  "Ext.define(\"" + modelName + "\"," + StringUtilities.json(modelDef) + ");\n";

        for (Association assoc : getAllAssociations(modelDef)) {
          ModelDefinition associatedModel = assoc.getAssociatedModelDefinition();
          if (associatedModel == null) continue;
         
          output += "Ext.define(\"" + assoc.getModelName() + "\"," + StringUtilities.json(associatedModel) + ");\n";
        }
       
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.