Examples of TemplateElement


Examples of freemarker.core.TemplateElement

        }

        @SuppressWarnings("unchecked")
        final Enumeration<TemplateElement> children = templateElement.children();
        while (children.hasMoreElements()) {
            final TemplateElement nextElement = children.nextElement();

            if (hasExpression(template, expression, nextElement)) {
                return true;
            }
        }
View Full Code Here

Examples of freemarker.core.ast.TemplateElement

    static public Template getPlainTextTemplate(String name, String content,
            Configuration config) {
         Template template = new Template(name, config, NULL_CODE_SOURCE);
        final char[] text = content.toCharArray();
        template.templateText = text;
        template.setRootElement(new TemplateElement() {
          public void execute(Environment env) throws IOException {
            env.getOut().write(text);
          }
        });
        DebuggerService.registerTemplate(template);
View Full Code Here

Examples of freemarker.core.ast.TemplateElement

     * permission.
     */
    public List<TemplateElement> containingElements(int column, int line) {
        checkModifyTemplate();
        ArrayList<TemplateElement> elements = new ArrayList<TemplateElement>();
        TemplateElement element = getRootElement();
mainloop:
        while (element.contains(column, line)) {
            elements.add(element);
            for (Enumeration enumeration = element.children(); enumeration.hasMoreElements();) {
                TemplateElement elem = (TemplateElement) enumeration.nextElement();
                if (elem.contains(column, line)) {
                    element = elem;
                    continue mainloop;
                }
            }
            break;
View Full Code Here

Examples of freemarker.core.ast.TemplateElement

        }
    }

    private static void insertDebugBreak(Template t, Breakpoint breakpoint)
    {
        TemplateElement te = findTemplateElement(t.getRootTreeNode(), breakpoint.getLine());
        if(te == null)
        {
            return;
        }
        TemplateElement parent = te.getParent();
        DebugBreak db = new DebugBreak(te);
        // TODO: Ensure there always is a parent by making sure
        // that the root element in the template is always a MixedContent
        // Also make sure it doesn't conflict with anyone's code.
        parent.setChildAt(parent.getIndex(te), db);
    }
View Full Code Here

Examples of freemarker.core.ast.TemplateElement

            return null;
        }
        // Find the narrowest match
        for(Enumeration children = te.children(); children.hasMoreElements();)
        {
            TemplateElement child = (TemplateElement)children.nextElement();
            TemplateElement childmatch = findTemplateElement(child, line);
            if(childmatch != null)
            {
                return childmatch;
            }
        }
View Full Code Here

Examples of freemarker.core.ast.TemplateElement

        }
    }

    private void removeDebugBreak(Template t, Breakpoint breakpoint)
    {
        TemplateElement te = findTemplateElement(t.getRootTreeNode(), breakpoint.getLine());
        if(te == null)
        {
            return;
        }
        DebugBreak db = null;
        while(te != null)
        {
            if(te instanceof DebugBreak)
            {
                db = (DebugBreak)te;
                break;
            }
            te = te.getParent();
        }
        if(db == null)
        {
            return;
        }
        TemplateElement parent = db.getParent();
        parent.setChildAt(parent.getIndex(db), db.getChildAt(0));
    }
View Full Code Here

Examples of freemarker.core.ast.TemplateElement

    private void removeDebugBreaks(TemplateElement te)
    {
        int count = te.getChildCount();
        for(int i = 0; i < count; ++i)
        {
            TemplateElement child = te.getChildAt(i);
            while(child instanceof DebugBreak)
            {
                TemplateElement dbchild = child.getChildAt(0);
                te.setChildAt(i, dbchild);
                child = dbchild;
            }
            removeDebugBreaks(child);
        }
View Full Code Here

Examples of org.ajax4jsf.templatecompiler.elements.TemplateElement

   * @see org.ajax4jsf.templatecompiler.builder.CompilationContext#getProcessor(org.w3c.dom.Node)
   */
  public TemplateElement getProcessor(Node nodeElement) throws CompilationException {
    for (Iterator<ElementsFactory> iter = elementFactories.listIterator(); iter.hasNext();) {
      ElementsFactory   factory = iter.next();
      TemplateElement processor = factory.getProcessor(nodeElement, this);
      if(null != processor){
        return processor;
      }
    }
    return null;
View Full Code Here

Examples of org.ajax4jsf.templatecompiler.elements.TemplateElement

   * @return
   * @throws CompilationException
   */
  private TemplateElement parseElement(Node element,
      CompilationContext context) throws CompilationException {
    TemplateElement templateElement = null;
    templateElement = context.getProcessor(element);

    if (templateElement == null) {
      return null;
    }


    if (!templateElement.isSkipBody()) {
      NodeList subNodes = element.getChildNodes();

      for (int iElement = 0; iElement != subNodes.getLength(); iElement++) {
        Node subElement = subNodes.item(iElement);
        templateElement.addSubElement(parseElement(subElement,
              context));
      } // for
    }// if
    return templateElement;

View Full Code Here

Examples of org.ajax4jsf.templatecompiler.elements.TemplateElement

          TemplateCompiler templateCompiler = new TemplateCompiler();
          InputStream templateStream = new FileInputStream(template);
          templateCompiler.processing(templateStream,
              compilationContext);

          TemplateElement root = compilationContext.getTree();

          String classname = renderer.getClassname();
          String packageName;
          int idx = classname.lastIndexOf('.');
          if (idx != -1) {
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.