Search in sources :

Example 1 with HtmlResult

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

the class RenderReportHtmlHandler method execute.

@Override
@LogException
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.shared.report.model.DateRange) StringWriter(java.io.StringWriter) Filter(org.activityinfo.shared.command.Filter) HtmlResult(org.activityinfo.shared.command.result.HtmlResult) ReportElement(org.activityinfo.shared.report.model.ReportElement) IOException(java.io.IOException) CommandException(org.activityinfo.shared.exception.CommandException) LogException(org.activityinfo.server.util.logging.LogException)

Example 2 with HtmlResult

use of org.activityinfo.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.shared.command.result.HtmlResult) RenderReportHtml(org.activityinfo.shared.command.RenderReportHtml) TextReportElement(org.activityinfo.shared.report.model.TextReportElement)

Aggregations

HtmlResult (org.activityinfo.shared.command.result.HtmlResult)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 LogException (org.activityinfo.server.util.logging.LogException)1 Filter (org.activityinfo.shared.command.Filter)1 RenderReportHtml (org.activityinfo.shared.command.RenderReportHtml)1 CommandException (org.activityinfo.shared.exception.CommandException)1 DateRange (org.activityinfo.shared.report.model.DateRange)1 ReportElement (org.activityinfo.shared.report.model.ReportElement)1 TextReportElement (org.activityinfo.shared.report.model.TextReportElement)1