Package net.jangaroo.exml.parser

Examples of net.jangaroo.exml.parser.ExmlToModelParser


      if (!classFile.exists()) {
        try {
          ExmlConfiguration config = configClassRegistry.getConfig();
          generatedTargetClassFile = config.computeGeneratedComponentClassFile(sourceFile);
          if (mustGenerate(generatedTargetClassFile)) {
            ExmlModel exmlModel = new ExmlToModelParser(configClassRegistry).parse(sourceFile);
            return new ExmlComponentClassGenerator(config).generateClass(exmlModel, generatedTargetClassFile);
          }
        } catch (Exception e) {
          throw new ExmlcException("unable to generate component class: " + e.getMessage(), sourceFile, e);
        }
View Full Code Here


public class ExmlToModelParserTest extends AbstractExmlTest {
  @Test
  public void testParseAllElements() throws Exception {
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/AllElements.exml"));
    Assert.assertEquals(new HashSet<String>(Arrays.asList("exmlparser.config.allElements", "ext.Panel", "ext.MessageBox")),
            model.getImports());
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
View Full Code Here

  }

  @Test
  public void testParseTestNumber() throws Exception{
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/TestNumber.exml"));
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "items", new JsonArray(
                    new JsonObject(
View Full Code Here

  }

  @Test
  public void testParseTestTrueFalse() throws Exception{
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/TestTrueFalse.exml"));
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "items", new JsonArray(
                    new JsonObject(
View Full Code Here

  }

  @Test
  public void testParseArrayAttribute() throws Exception{
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/TestArrayAttribute.exml"));
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "items", "{config.myItems}",
            "tools", new JsonArray("tools")
View Full Code Here

  }

  @Test
  public void testParseActions() throws Exception{
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/TestActions.exml"));
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "baseAction", "{net.jangaroo.ext.create(ext.config.action,{disabled: false})}"
    );
View Full Code Here

  }

  @Test
  public void testParseUntyped() throws Exception{
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/TestUntyped.exml"));
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "items", new JsonArray(
                    new JsonObject(
View Full Code Here

  }

  @Test
  public void testParseTyped() throws Exception{
    setUp("exmlparser.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/exmlparser/TestTyped.exml"));
    Assert.assertEquals("ext.Panel", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "items", new JsonArray(
                    new JsonObject(
View Full Code Here

  }

  @Test
  public void testInheritProperties() throws Exception{
    setUp("testNamespace.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/testPackage/TestComponent2.exml"));
    Assert.assertEquals("testPackage.TestComponent", model.getSuperClassName());

    JsonObject expectedJsonObject = new JsonObject(
            "items", new JsonArray(
                    new JsonObject(
View Full Code Here

  }

  @Test
  public void testConfigDefaultValues() throws Exception {
    setUp("testNamespace.config");
    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

    ExmlModel model = exmlToModelParser.parse(getFile("/testPackage/TestComponentWithCfgDefaults.exml"));
    List<ConfigAttribute> cfgs = model.getConfigClass().getDirectCfgs();
    Assert.assertEquals(5, cfgs.size());

    JsonObject expectedJsonObject = new JsonObject(
            "propertyWithLiteralDefault", "foobar",
View Full Code Here

TOP

Related Classes of net.jangaroo.exml.parser.ExmlToModelParser

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.