Package cn.org.rapid_framework.freemarker.directive.OverrideDirective

Examples of cn.org.rapid_framework.freemarker.directive.OverrideDirective.TemplateDirectiveBodyOverrideWraper


    Object value = params.get(key);
    return value == null ? defaultValue : value.toString();
  }
 
  static TemplateDirectiveBodyOverrideWraper getOverrideBody(Environment env, String name) throws TemplateModelException {
    TemplateDirectiveBodyOverrideWraper value = (TemplateDirectiveBodyOverrideWraper)env.getVariable(DirectiveUtils.getOverrideVariableName(name));
    return value;
  }
View Full Code Here


  }
 
  static void setTopBodyForParentBody(Environment env,
      TemplateDirectiveBodyOverrideWraper topBody,
      TemplateDirectiveBodyOverrideWraper overrideBody) {
    TemplateDirectiveBodyOverrideWraper parent = overrideBody;
    while(parent.parentBody != null) {
      parent = parent.parentBody;
    }
    parent.parentBody = topBody;
  }
View Full Code Here

 
  public void execute(Environment env,
            Map params, TemplateModel[] loopVars,
            TemplateDirectiveBody body) throws TemplateException, IOException {
   
    TemplateDirectiveBodyOverrideWraper current = (TemplateDirectiveBodyOverrideWraper)env.getVariable(DirectiveUtils.OVERRIDE_CURRENT_NODE);
    if(current == null) {
      throw new TemplateException("<@super/> direction must be child of override", env);
    }
    TemplateDirectiveBody parent = current.parentBody;
    if(parent == null) {
View Full Code Here

 
  public void execute(Environment env,
            Map params, TemplateModel[] loopVars,
            TemplateDirectiveBody body) throws TemplateException, IOException {
    String name = DirectiveUtils.getRequiredParam(params, "name");
    TemplateDirectiveBodyOverrideWraper overrideBody = DirectiveUtils.getOverrideBody(env, name);
    if(overrideBody == null) {
      if(body != null) {
        body.render(env.getOut());
      }
    }else {
      DirectiveUtils.setTopBodyForParentBody(env, new TemplateDirectiveBodyOverrideWraper(body,env), overrideBody);
      overrideBody.render(env.getOut());
    }
  }
View Full Code Here

TOP

Related Classes of cn.org.rapid_framework.freemarker.directive.OverrideDirective.TemplateDirectiveBodyOverrideWraper

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.