Package cn.org.rapid_framework.velocity.directive.OverrideDirective

Examples of cn.org.rapid_framework.velocity.directive.OverrideDirective.OverrideNodeWrapper


  }
 
  public static void setParentForTop(
      OverrideNodeWrapper topParentNode,
      OverrideNodeWrapper node) {
    OverrideNodeWrapper top = node;
    while(top.parentNode != null) {
      top = top.parentNode;
    }
    top.parentNode = topParentNode;
  }
View Full Code Here


  @Override
  public boolean render(InternalContextAdapter context, Writer writer, Node node)
      throws IOException, ResourceNotFoundException, ParseErrorException,MethodInvocationException {
   
    OverrideNodeWrapper current = (OverrideNodeWrapper)context.get(Utils.OVERRIDE_CURRENT_NODE);
    if(current == null) {
      throw new ParseErrorException("#super direction must be child of override");
    }
    OverrideNodeWrapper parent = current.parentNode;
    if(parent == null) {
      throw new ParseErrorException("not found parent block for #super ");
    }
    return parent.render(context,writer);
  }
View Full Code Here

  @Override
  public boolean render(InternalContextAdapter context, Writer writer, Node node)
      throws IOException, ResourceNotFoundException, ParseErrorException,MethodInvocationException {
    String name = Utils.getRequiredArgument(context, node, 0,getName());
   
    OverrideNodeWrapper overrideNode = getOverrideNode(context,name);
    Node topNode = node.jjtGetChild(1);
        if(overrideNode == null) {
          return topNode.render(context, writer);
        }else {
          Utils.setParentForTop(new OverrideNodeWrapper(topNode),overrideNode);
          return overrideNode.render(context, writer);
        }
  }
View Full Code Here

TOP

Related Classes of cn.org.rapid_framework.velocity.directive.OverrideDirective.OverrideNodeWrapper

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.