Examples of JapidLayoutCompiler


Examples of cn.bran.japid.compiler.JapidLayoutCompiler

    // the compiler assumes the path separator is system specific separator
    fileName = fileName.replace('/', File.separatorChar);
    JapidTemplate temp = new JapidTemplate(fileName, src);
    JapidAbstractCompiler c = null;
    if (JapidTemplateTransformer.looksLikeLayout(src)) {
      c = new JapidLayoutCompiler();
    } else {
      // regular template and tag are the same thing
      c = new JapidTemplateCompiler();
    }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

    for(String line = br.readLine(); line != null; line = br.readLine()) {
      src += line + "\n";
    }
   
    JapidTemplate bt = new JapidTemplate("tag/Layout.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    System.out.println(bt.javaSource);
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

  @Test
  public void testOpenFor() throws IOException {
    String src = readFile("tests/openFor.html");
    JapidTemplate bt = new JapidTemplate("tests/openFor.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

  @Test
  public void testCompileLayout() throws IOException {
    String src = readFile("JapidSample/app/japidviews/_layouts/Layout.html");
    JapidTemplate bt = new JapidTemplate("tag/Layout.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

 
  @Test
  public void testIfCommand() throws IOException {
    String src = readFile("JapidSample/app/japidviews/Application/ifs.html");
    JapidTemplate bt = new JapidTemplate("Application/ifs.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    String javaSource = bt.javaSource;
    System.out.println(javaSource);
    assertTrue(javaSource.contains("if(!asBoolean(ss))"));
    assertTrue(javaSource.contains("else if(!asBoolean(ss))"));
    assertTrue("invalid java code", JavaSyntaxTool.isValid(javaSource));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

 
  @Test
  public void testLayoutWithArgs() throws IOException {
    String src = readFile("JapidSample/app/japidviews/more/Perf/perfmain.html");
    JapidTemplate bt = new JapidTemplate("more/Perf/perfmain.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

 
  @Test
  public void testAnotherLayout() throws IOException, ParseException {
    String src = readFile("JapidSample/app/japidviews/_layouts/TagLayout.html");
    JapidTemplate bt = new JapidTemplate("japidviews/_layouts/TagLayout.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    String srccode = bt.javaSource;
    System.out.println(srccode);
    CompilationUnit cu = JavaSyntaxTool.parse(srccode);
    assertTrue(srccode.contains("package japidviews._layouts;"));
    assertTrue(srccode.contains("public abstract class TagLayout extends cn.bran.play.JapidTemplateBase"));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

 
  @Test
  public void testNoPlayCommand() throws IOException, ParseException {
    String src = readFile("JapidSample/app/japidviews/templates/noplay.html");
    JapidTemplate bt = new JapidTemplate("japidviews/templates/noplay.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    String srccode = bt.javaSource;
    System.out.println(srccode);
    CompilationUnit cu = JavaSyntaxTool.parse(srccode);
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

 
  @Test
  public void testSubLayout() throws IOException {
    String src = readFile("JapidSample/app/japidviews/_layouts/SubLayout.html");
    JapidTemplate bt = new JapidTemplate("japidviews/_layouts/SubLayout.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    String srccode = bt.javaSource;
    System.out.println(srccode);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    assertTrue(srccode.contains("package japidviews._layouts;"));
    assertTrue(srccode.contains("public abstract class SubLayout extends Layout"));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidLayoutCompiler

  public void testGetDirective() throws IOException, ParseException {
    String srcFile = "tests/getTag.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tests/getTag.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    System.out.println(bt.javaSource);
//    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
    assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "title", Modifier.PROTECTED, "void", ""));
    assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "footer", Modifier.PROTECTED, "void", ""));
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.