Search in sources :

Example 1 with TemplateWriterFactory

use of net.parostroj.timetable.output2.template.TemplateWriterFactory in project grafikon by jub77.

the class GPdfOutputFactory method createOutput.

@Override
public Output createOutput(String type) throws OutputException {
    try {
        if (!OUTPUT_TYPES.contains(type)) {
            throw new OutputException("Unknown type: " + type);
        }
        TemplateWriterFactory templateFactory = () -> factory.getTemplate(type, this.getCharset());
        TemplateTransformerFactory transformerFactory = () -> (is, os, params) -> transformer.write(os, is, getResolver(params));
        return new TemplateOutput(getLocale(), templateFactory, transformerFactory);
    } catch (Exception e) {
        throw new OutputException(e);
    }
}
Also used : java.util(java.util) Logger(org.slf4j.Logger) GroovyTemplateFactory(net.parostroj.timetable.output2.groovy.GroovyTemplateFactory) TemplateTransformerFactory(net.parostroj.timetable.output2.template.TemplateTransformerFactory) StreamSource(javax.xml.transform.stream.StreamSource) URIResolver(javax.xml.transform.URIResolver) LoggerFactory(org.slf4j.LoggerFactory) PdfTransformer(net.parostroj.timetable.output2.pdf.PdfTransformer) Source(javax.xml.transform.Source) StandardCharsets(java.nio.charset.StandardCharsets) net.parostroj.timetable.output2(net.parostroj.timetable.output2) Charset(java.nio.charset.Charset) TransformerFactory(javax.xml.transform.TransformerFactory) TemplateWriterFactory(net.parostroj.timetable.output2.template.TemplateWriterFactory) TemplateOutput(net.parostroj.timetable.output2.template.TemplateOutput) InputStream(java.io.InputStream) TemplateTransformerFactory(net.parostroj.timetable.output2.template.TemplateTransformerFactory) TemplateWriterFactory(net.parostroj.timetable.output2.template.TemplateWriterFactory) TemplateOutput(net.parostroj.timetable.output2.template.TemplateOutput)

Aggregations

InputStream (java.io.InputStream)1 Charset (java.nio.charset.Charset)1 StandardCharsets (java.nio.charset.StandardCharsets)1 java.util (java.util)1 Source (javax.xml.transform.Source)1 TransformerFactory (javax.xml.transform.TransformerFactory)1 URIResolver (javax.xml.transform.URIResolver)1 StreamSource (javax.xml.transform.stream.StreamSource)1 net.parostroj.timetable.output2 (net.parostroj.timetable.output2)1 GroovyTemplateFactory (net.parostroj.timetable.output2.groovy.GroovyTemplateFactory)1 PdfTransformer (net.parostroj.timetable.output2.pdf.PdfTransformer)1 TemplateOutput (net.parostroj.timetable.output2.template.TemplateOutput)1 TemplateTransformerFactory (net.parostroj.timetable.output2.template.TemplateTransformerFactory)1 TemplateWriterFactory (net.parostroj.timetable.output2.template.TemplateWriterFactory)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1