Search in sources :

Example 1 with PebbleTemplate

use of com.mitchellbosecke.pebble.template.PebbleTemplate in project symja_android_library by axkr.

the class Scatter3DTrace method asJavascript.

@Override
public String asJavascript(int i) {
    Writer writer = new StringWriter();
    PebbleTemplate compiledTemplate;
    try {
        compiledTemplate = engine.getTemplate("trace_template.html");
        Map<String, Object> context = getContext(i);
        compiledTemplate.evaluate(writer, context);
    } catch (PebbleException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return writer.toString();
}
Also used : PebbleException(com.mitchellbosecke.pebble.error.PebbleException) StringWriter(java.io.StringWriter) PebbleTemplate(com.mitchellbosecke.pebble.template.PebbleTemplate) UncheckedIOException(java.io.UncheckedIOException) Utils.dataAsString(tech.tablesaw.plotly.Utils.dataAsString) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) StringWriter(java.io.StringWriter) Writer(java.io.Writer)

Example 2 with PebbleTemplate

use of com.mitchellbosecke.pebble.template.PebbleTemplate in project symja_android_library by axkr.

the class ScatterTrace method asJavascript.

@Override
public String asJavascript(int i) {
    Writer writer = new StringWriter();
    PebbleTemplate compiledTemplate;
    try {
        compiledTemplate = engine.getTemplate("trace_template.html");
        Map<String, Object> context = getContext(i);
        compiledTemplate.evaluate(writer, context);
    } catch (PebbleException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return writer.toString();
}
Also used : PebbleException(com.mitchellbosecke.pebble.error.PebbleException) StringWriter(java.io.StringWriter) PebbleTemplate(com.mitchellbosecke.pebble.template.PebbleTemplate) UncheckedIOException(java.io.UncheckedIOException) Utils.dataAsString(tech.tablesaw.plotly.Utils.dataAsString) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) StringWriter(java.io.StringWriter) Writer(java.io.Writer)

Example 3 with PebbleTemplate

use of com.mitchellbosecke.pebble.template.PebbleTemplate in project symja_android_library by axkr.

the class ViolinTrace method asJavascript.

@Override
public String asJavascript(int i) {
    Writer writer = new StringWriter();
    PebbleTemplate compiledTemplate;
    try {
        compiledTemplate = engine.getTemplate("trace_template.html");
        compiledTemplate.evaluate(writer, getContext(i));
    } catch (PebbleException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return writer.toString();
}
Also used : PebbleException(com.mitchellbosecke.pebble.error.PebbleException) StringWriter(java.io.StringWriter) PebbleTemplate(com.mitchellbosecke.pebble.template.PebbleTemplate) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) StringWriter(java.io.StringWriter) Writer(java.io.Writer)

Example 4 with PebbleTemplate

use of com.mitchellbosecke.pebble.template.PebbleTemplate in project symja_android_library by axkr.

the class Scene method asJavascript.

@Override
public String asJavascript() {
    Writer writer = new StringWriter();
    PebbleTemplate compiledTemplate;
    try {
        compiledTemplate = getEngine().getTemplate("scene_template.html");
        compiledTemplate.evaluate(writer, getContext());
    } catch (PebbleException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return writer.toString();
}
Also used : PebbleException(com.mitchellbosecke.pebble.error.PebbleException) StringWriter(java.io.StringWriter) PebbleTemplate(com.mitchellbosecke.pebble.template.PebbleTemplate) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) StringWriter(java.io.StringWriter) Writer(java.io.Writer)

Example 5 with PebbleTemplate

use of com.mitchellbosecke.pebble.template.PebbleTemplate in project symja_android_library by axkr.

the class AbstractTrace method toString.

@Override
public String toString() {
    Writer writer = new StringWriter();
    PebbleTemplate compiledTemplate;
    try {
        compiledTemplate = engine.getTemplate("trace_template.html");
        compiledTemplate.evaluate(writer, getContext());
    } catch (PebbleException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return writer.toString();
}
Also used : PebbleException(com.mitchellbosecke.pebble.error.PebbleException) StringWriter(java.io.StringWriter) PebbleTemplate(com.mitchellbosecke.pebble.template.PebbleTemplate) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) StringWriter(java.io.StringWriter) Writer(java.io.Writer)

Aggregations

PebbleTemplate (com.mitchellbosecke.pebble.template.PebbleTemplate)20 StringWriter (java.io.StringWriter)19 Writer (java.io.Writer)17 PebbleException (com.mitchellbosecke.pebble.error.PebbleException)15 IOException (java.io.IOException)15 UncheckedIOException (java.io.UncheckedIOException)15 HashMap (java.util.HashMap)2 Utils.dataAsString (tech.tablesaw.plotly.Utils.dataAsString)2 PebbleEngine (com.mitchellbosecke.pebble.PebbleEngine)1 LanguageHeader (io.vertx.ext.web.LanguageHeader)1 Locale (java.util.Locale)1 Map (java.util.Map)1