Examples of Template


Examples of com.vtence.molecule.templating.Template

    public void run(WebServer server) throws IOException {
        // We use Mustache templates with an .html extension
        Templates templates = new Templates(
                new JMustacheRenderer().fromDir(locateOnClasspath("examples/templates")).extension("html"));
        final Template layout = templates.named("layout");
        final Template greeting = templates.named("greeting");

        // Apply a common layout to all rendered pages
        server.filter("/", Layout.html(layout))
              .start(new DynamicRoutes() {{
                  get("/hello").to(new Application() {
                      public void handle(final Request request, final Response response) throws Exception {
                          response.contentType("text/html; charset=utf-8");
                          String name = request.parameter("name") != null ? request.parameter("name") : "World";
                          // Mustache can use any object or a Map as a rendering context
                          response.body(greeting.render(new User(name)));
                      }
                  });
              }});
    }
View Full Code Here

Examples of com.xfltr.hapax.Template

import com.xfltr.hapax.TemplateDictionary;
import com.xfltr.hapax.TemplateException;

class HelloWorldExample {
  public static void main(String[] args) throws TemplateException {
    Template tmpl = Template.parse("Hello, {{WORLD:h}}");
    TemplateDictionary dict = TemplateDictionary.create();
    dict.put("WORLD", "Iapetus");
    System.out.println(tmpl.renderToString(dict));
  }
View Full Code Here

Examples of edu.pitt.dbmi.nlp.noble.extract.model.Template

 
  /**
   * do preview
   */
  private void doPreview() {
    Template t = templateList.getSelectedValue();
    if(t == null)
      return;
   
    StringBuffer b = new StringBuffer();
    b.append("<h2>"+t.getName()+"</h2>");
    b.append(t.getDescription()+"<hr>");
    b.append("<ul>");
    for(TemplateItem i: t.getTemplateItems()){
      b.append("<li><b>"+i.getName()+"</b>");
    }
    b.append("</ul>");
   
    JEditorPane text = new JEditorPane();
View Full Code Here

Examples of edu.pitt.info.extract.model.Template

 
  /**
   * do preview
   */
  private void doPreview() {
    Template t = templateList.getSelectedValue();
    if(t == null)
      return;
   
    StringBuffer b = new StringBuffer();
    b.append("<h2>"+t.getName()+"</h2>");
    b.append(t.getDescription()+"<hr>");
    b.append("<ul>");
    for(TemplateItem i: t.getTemplateItems()){
      b.append("<li><b>"+i.getName()+"</b>");
    }
    b.append("</ul>");
   
    JEditorPane text = new JEditorPane();
View Full Code Here

Examples of eu.planets_project.ifr.core.wee.api.workflow.generated.WorkflowConf.Template

     * @throws Exception in the case of an invalid WorkflowConf
     */
    public WorkflowConf buildWorkflowConf(String wfTemplateName, List<ServiceBean> sbs) throws Exception{
     
      //1.add the template retrieved from the uploaded wfconfig
      Template serTempl = new Template();
      serTempl.setClazz(wfTemplateName);
     
      Services services = new Services();
      //2.browse through the provided services and build the Services object
      for(ServiceBean sb : sbs){
        Service service = new Service();
View Full Code Here

Examples of freemarker.template.Template

    DataHandler merged = null;
    try {
      freemarker.template.Configuration cfg = new freemarker.template.Configuration();
      cfg.setObjectWrapper(new DefaultObjectWrapper());
      cfg.setTemplateUpdateDelay(0);
      Template temp = new Template(name, new InputStreamReader(src), cfg);
      final ByteArrayOutputStream bout = new ByteArrayOutputStream();
      Writer out = new OutputStreamWriter(bout);
      temp.process(renderContext, out);
      out.flush();
      merged = new DataHandler(new DataSource() {
        public InputStream getInputStream() throws IOException {
          return new ByteArrayInputStream(bout.toByteArray());
        }
View Full Code Here

Examples of galoot.Template

  static {
  }
 
  public void renderToWriter(Writer writer) throws HttpException {
    try {
      Template t = new Template(new File(template));
      t.render(new ContextStack(context), writer);
      writer.flush();
    } catch (IOException e) {
      log.error(e,e);
      throw new HttpException(e);
    }
View Full Code Here

Examples of gap.hapax.Template

    }
    private TemplateRenderer getTemplate(String path)
        throws TemplateException
    {
        jauk.Resource templateResource = new jauk.Resource(path,ResourcePrefix,ResourceSuffix);
        Template template = this.get(templateResource);
        if (null == template){
            template = new Template(path);
            jauk.Resource templateFileResource = new jauk.Resource(ResourceDir,templateResource);
            try {
                template.setTemplateSourceHapax(gap.Strings.TextFromString(ReadToString(templateFileResource)));
                template.setLastModified(templateFileResource.getLastModified());
                this.put(templateResource,template);

                return new gap.hapax.TemplateRendererImpl(this,template);
            }
            catch (IOException tryresource){
                try {
                    template.setTemplateSourceHapax(gap.Strings.TextFromString(ReadToString(templateResource)));
                    template.setLastModified(templateResource.getLastModified());
                    this.put(templateResource,template);

                    return new gap.hapax.TemplateRendererImpl(this,template);
                }
                catch (IOException iox){
View Full Code Here

Examples of groovy.text.Template

    public void expand(final Map<String, ?> properties) {
        transformers.add(new Transformer<Reader>() {
            public Reader transform(Reader original) {
                try {
                    Template template;
                    try {
                        SimpleTemplateEngine engine = new SimpleTemplateEngine();
                        template = engine.createTemplate(original);
                    } finally {
                        original.close();
                    }
                    StringWriter writer = new StringWriter();
                    template.make(properties).writeTo(writer);
                    return new StringReader(writer.toString());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
View Full Code Here

Examples of hapax.Template

            final String templateFile, final JavaType templateType,
            final String moduleName) {
        try {
            final TemplateLoader templateLoader = TemplateResourceLoader
                    .create();
            final Template template = templateLoader.getTemplate(templateFile);
            Validate.notNull(template, "Template required for '%s'",
                    templateFile);
            final String templateContents = template
                    .renderToString(dataDictionary);
            final String templateId = PhysicalTypeIdentifier.createIdentifier(
                    templateType,
                    LogicalPath.getInstance(Path.SRC_MAIN_JAVA, moduleName));
            return typeParsingService.getTypeFromString(templateContents,
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.