Search in sources :

Example 1 with TemplateOutputResources

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

the class OutputWriter method generateOutput.

private void generateOutput(net.parostroj.timetable.model.Output modelOutput) throws OutputException {
    OutputTemplate template = modelOutput.getTemplate();
    String type = template.getAttribute(OutputTemplate.ATTR_OUTPUT_TYPE, String.class);
    OutputFactory factory = OutputFactory.newInstance(template.getOutput());
    factory.setParameter("locale", modelOutput.getLocale() != null ? modelOutput.getLocale() : settings.getLocale());
    Output output = factory.createOutput(type);
    TextTemplate textTemplate = template.getTemplate();
    OutputResources resources = new TemplateOutputResources(template);
    List<OutputSettings> outputNames = this.createOutputs(modelOutput);
    if (outputNames == null) {
        this.generateOutput(output, this.getFile(null, getOutputKey(modelOutput), template.getAttributes().get(OutputTemplate.ATTR_OUTPUT_EXTENSION, String.class), factory.getType()), textTemplate, type, null, this.updateContext(modelOutput, template, null), resources, null);
    } else {
        for (OutputSettings outputName : outputNames) {
            this.generateOutput(output, this.getFile(outputName.directory, outputName.name), textTemplate, type, outputName.params, this.updateContext(modelOutput, template, outputName.context), resources, outputName.encoding);
        }
    }
}
Also used : TemplateOutputResources(net.parostroj.timetable.output2.template.TemplateOutputResources) TemplateOutputResources(net.parostroj.timetable.output2.template.TemplateOutputResources)

Aggregations

TemplateOutputResources (net.parostroj.timetable.output2.template.TemplateOutputResources)1