Package cambridge.runtime

Examples of cambridge.runtime.DefaultTemplateBindings


               try {
                  FragmentList fragmentList = doc.select("except #s");

                  Writer writer = new OutputStreamWriter(System.out);
                  for (Fragment f : fragmentList) {
                     f.eval(new DefaultTemplateBindings(), writer);
                  }

               } catch (BehaviorInstantiationException e) {
                  e.printStackTrace();
               } catch (IOException e) {
View Full Code Here


   public void testSetDirective() throws Exception {
      TemplateTokenizer tokenizer = new TemplateTokenizer(ParserTest.class.getResourceAsStream("set.html"));
      TemplateParser parser = new TemplateParser(tokenizer);
      TemplateDocument doc = parser.parse();
      FragmentList fragmentList = doc.normalize();
      Map<String, Object> prop = new DefaultTemplateBindings();
      StringWriter out = new StringWriter();
      for (Fragment f : fragmentList) {
         f.eval(prop, out);
      }
View Full Code Here

   Map<String, Object> bindings;

   @Before
   public void setUp() {
      bindings = new DefaultTemplateBindings();

   }
View Full Code Here

   @Test
   public void testWithBehavior() throws Exception {
      TemplateTokenizer tokenizer = new TemplateTokenizer(ConditionalAttributeBehaviorTest.class.getResourceAsStream("withbehavior.html"));
      TemplateParser parser = new TemplateParser(tokenizer);
      Map<String, Object> bindings = new DefaultTemplateBindings();

      User user = new User("test", "test@test.com");
      bindings.put("user", user);

      TemplateDocument t = parser.parse();
      assertNotNull(t);
      FragmentList fragments = t.normalize();
View Full Code Here

   @Test
   public void test() {
      try {
         TemplateTokenizer tokenizer = new TemplateTokenizer(ConditionalAttributeBehaviorTest.class.getResourceAsStream("conditionalattribute.html"));
         TemplateParser parser = new TemplateParser(tokenizer);
         Map<String, Object> bindings = new DefaultTemplateBindings();
         bindings.put("condition", true);

         TemplateDocument t = parser.parse();
         assertNotNull(t);
         FragmentList fragments = t.normalize();
View Full Code Here

public class ParserTest {
   private static Map<String, Object> bindings;

   @BeforeClass
   public static void init() {
      bindings = new DefaultTemplateBindings();
      bindings.put("var", "simple");
      bindings.put("id", "test");
      bindings.put("exp", "class=\"x\"");
      ArrayList<Integer> list = new ArrayList<Integer>();
      list.add(1);
View Full Code Here

   @Test
   public void testBasic() {
      try {
         TemplateTokenizer tokenizer = new TemplateTokenizer(ParserTest.class.getResourceAsStream("basic.html"));
         TemplateParser parser = new TemplateParser(tokenizer);
         Map<String, Object> p = new DefaultTemplateBindings();
         p.put("class", "test");
         TemplateDocument t = parser.parse();

         assertNotNull(t);

         Attribute a = t.locateTag("/div").getAttribute("class");
View Full Code Here

   @Test
   public void testComplex() {
      try {
         TemplateTokenizer tokenizer = new TemplateTokenizer(ParserTest.class.getResourceAsStream("complex.html"));
         TemplateParser parser = new TemplateParser(tokenizer);
         Map<String, Object> p = new DefaultTemplateBindings();
         p.put("a", "AAA");
         p.put("b", "BBB");
         TemplateDocument t = parser.parse();

         assertNotNull(t);

         Attribute a = t.locateTag("/div").getAttribute("id");
View Full Code Here

   @Test
   public void testDymnamic() {
      try {
         TemplateTokenizer tokenizer = new TemplateTokenizer(ParserTest.class.getResourceAsStream("dynamic.html"));
         TemplateParser parser = new TemplateParser(tokenizer);
         Map<String, Object> p = new DefaultTemplateBindings();
         p.put("style", "style");

         TemplateDocument t = parser.parse();

         assertNotNull(t);
View Full Code Here

   private final FragmentList fragments;

   public DynamicTemplate(FragmentList fragments, Locale locale) {
      this.fragments = fragments;
      bindings = new DefaultTemplateBindings(locale);
   }
View Full Code Here

TOP

Related Classes of cambridge.runtime.DefaultTemplateBindings

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.