Package com.google.clearsilver.jsilver.template

Examples of com.google.clearsilver.jsilver.template.Template


  }

  // This method should ONLY be called from include()
  private void loadAndRenderIncludedTemplate(String templateName, boolean ignoreMissingFile,
      RenderingContext context) {
    Template template = null;
    try {
      template =
          templateLoader.load(templateName, context.getResourceLoader(), context
              .getAutoEscapeMode());
    } catch (RuntimeException e) {
      if (ignoreMissingFile && ExceptionUtil.isFileNotFoundException(e)) {
        return;
      } else {
        throw e;
      }
    }
    // Intepret loaded template.
    try {
      template.render(context);
    } catch (IOException e) {
      throw new JSilverInterpreterException(e.getMessage());
    }
  }
View Full Code Here


  private void evaluateVariable(PExpression expression, String stackTraceDescription) {
    // Evaluate expression.
    Value value = expressionEvaluator.evaluate(expression);

    // Now parse result, into new mini template.
    Template template =
        templateLoader.createTemp(stackTraceDescription, value.asString(), context
            .getAutoEscapeMode());

    // Intepret new template.
    try {
      template.render(context);
    } catch (IOException e) {
      throw new JSilverInterpreterException(e.getMessage());
    }
  }
View Full Code Here

  }

  // This method should ONLY be called from include()
  private void loadAndRenderIncludedTemplate(String templateName, boolean ignoreMissingFile) {
    // Now load new template with given name.
    Template template = null;
    try {
      template =
          templateLoader.load(templateName, context.getResourceLoader(), context
              .getAutoEscapeMode());
    } catch (RuntimeException e) {
      if (ignoreMissingFile && ExceptionUtil.isFileNotFoundException(e)) {
        return;
      } else {
        throw e;
      }
    }

    // Intepret loaded template.
    try {
      // TODO: Execute lincludes (but not includes) in a separate
      // context.
      template.render(context);
    } catch (IOException e) {
      throw new JSilverInterpreterException(e.getMessage());
    }
  }
View Full Code Here

  @Override
  public Template load(String templateName, ResourceLoader resourceLoader, EscapeMode escapeMode) {
    Object key = resourceLoader.getKey(templateName);
    PrecompiledTemplateMapKey mapKey = new PrecompiledTemplateMapKey(key, escapeMode);
    Template template = templateMap.get(mapKey);
    if (template != null) {
      return template;
    } else {
      return nextLoader.load(templateName, resourceLoader, escapeMode);
    }
View Full Code Here

TOP

Related Classes of com.google.clearsilver.jsilver.template.Template

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.