Search in sources :

Example 1 with HtmlResult

use of org.activityinfo.legacy.shared.command.result.HtmlResult in project activityinfo by bedatadriven.

the class RenderReportHtmlHandler method execute.

@Override
public CommandResult execute(RenderReportHtml cmd, User user) throws CommandException {
    ReportElement model = cmd.getModel();
    LOGGER.fine("Model: " + model);
    // don't show the title: it will be rendered by the container
    model.setTitle(null);
    generator.generateElement(user, model, new Filter(), new DateRange());
    StringWriter writer = new StringWriter();
    try {
        renderer.render(model, writer);
    } catch (IOException e) {
        throw new CommandException(e);
    }
    return new HtmlResult(writer.toString());
}
Also used : DateRange(org.activityinfo.legacy.shared.reports.model.DateRange) StringWriter(java.io.StringWriter) Filter(org.activityinfo.legacy.shared.command.Filter) HtmlResult(org.activityinfo.legacy.shared.command.result.HtmlResult) ReportElement(org.activityinfo.legacy.shared.reports.model.ReportElement) IOException(java.io.IOException) CommandException(org.activityinfo.legacy.shared.exception.CommandException)

Example 2 with HtmlResult

use of org.activityinfo.legacy.shared.command.result.HtmlResult in project activityinfo by bedatadriven.

the class ElementWidget method loadHtml.

private void loadHtml() {
    contentElement.setInnerHTML("");
    loadingElement.getStyle().setDisplay(Display.BLOCK);
    if (model instanceof TextReportElement) {
        renderStaticHtml();
    } else {
        dispatcher.execute(new RenderReportHtml(model), new AsyncCallback<HtmlResult>() {

            @Override
            public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub
            }

            @Override
            public void onSuccess(HtmlResult result) {
                updateHtml(result.getHtml());
            }
        });
    }
}
Also used : HtmlResult(org.activityinfo.legacy.shared.command.result.HtmlResult) RenderReportHtml(org.activityinfo.legacy.shared.command.RenderReportHtml) TextReportElement(org.activityinfo.legacy.shared.reports.model.TextReportElement)

Aggregations

HtmlResult (org.activityinfo.legacy.shared.command.result.HtmlResult)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Filter (org.activityinfo.legacy.shared.command.Filter)1 RenderReportHtml (org.activityinfo.legacy.shared.command.RenderReportHtml)1 CommandException (org.activityinfo.legacy.shared.exception.CommandException)1 DateRange (org.activityinfo.legacy.shared.reports.model.DateRange)1 ReportElement (org.activityinfo.legacy.shared.reports.model.ReportElement)1 TextReportElement (org.activityinfo.legacy.shared.reports.model.TextReportElement)1