Package net.jangaroo.exml.json

Examples of net.jangaroo.exml.json.JsonObject


    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(
                            "xtype", "component",
                            "margins", "5" // not the number 5!
                    ),
                    new JsonObject(
                            "xtype", "component",
                            "id", "false"  // not the boolean false!
                    )

            )
    );
    System.out.println(model.getJsonObject().toString(2));
    Assert.assertEquals(expectedJsonObject.toString(2), model.getJsonObject().toString(2));
  }
View Full Code Here


    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(
                            "propertyThree", "3"
                    ).settingWrapperClass("testNamespace.config.testComponent2")
            ),
            "columns", new JsonObject("xtype", "agridcolumn")
    );
    System.out.println(model.getJsonObject().toString(2));
    Assert.assertEquals(expectedJsonObject.toString(2), model.getJsonObject().toString(2));
  }
View Full Code Here

    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",
            "propertyWithExpressionDefault", "{'foo' + 'bar'}",
            "propertyWithDefaultElement",
              new JsonObject(
                      "xtype", "button",
                      "text", "click me!"
              ),
            "propertyWithDefaultElementUsingConfig",
              new JsonObject(
                      "xtype", "button",
                      "text", "{config.title + '!'}"
              ),
            "arrayPropertyWithDefaultElement",
              new JsonArray(
                      new JsonObject(
                              "xtype", "button",
                              "text", "button1"
                      ),
                      new JsonObject(
                              "xtype", "button",
                              "text", "button2"
                      )
              ),
            "title", "{config.defaultTitle}"
    );
    System.out.println(model.getJsonObject().toString(2));
    Assert.assertEquals(expectedJsonObject.toString(2), model.getJsonObject().toString(2));
  }
View Full Code Here

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

    ExmlModel model = exmlToModelParser.parse(getFile("/testPackage/TestContainerDefaults.exml"));
    JsonObject expectedJsonObject = new JsonObject(
            "defaults", new JsonObject(
              "text", "it works!"
            ),
            "defaultType", "button",
            "items", new JsonArray(new JsonObject(
              "xtype", "container",
              "defaults", new JsonObject(
                "propertyOne", true
              ),
              "defaultType", "testNamespace.config.testComponent"
            ))
    );
    System.out.println(model.getJsonObject().toString(2));
    Assert.assertEquals(expectedJsonObject.toString(2), model.getJsonObject().toString(2));
  }
View Full Code Here

    ExmlToModelParser exmlToModelParser = new ExmlToModelParser(getConfigClassRegistry());

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

    JsonObject expectedJsonObject = new JsonObject(
            "items", new JsonArray(
                    new JsonObject(
                            "propertyThree", "3"
                    ).settingWrapperClass("testNamespace.config.testComponent2")
            ),
            "items$at", "{net.jangaroo.ext.Exml.APPEND}",
            "propertyFive", new JsonArray(new JsonObject("xtype", "agridcolumn")),
            "propertyFive$at", "{net.jangaroo.ext.Exml.PREPEND}",
            "layoutConfig", new JsonObject(
                    "mode", "foo"
            )
    );
    System.out.println(model.getJsonObject().toString(2));
    Assert.assertEquals(expectedJsonObject.toString(2), model.getJsonObject().toString(2));
  }
View Full Code Here

TOP

Related Classes of net.jangaroo.exml.json.JsonObject

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.