use of org.activityinfo.legacy.shared.reports.model.TextReportElement in project activityinfo by bedatadriven.
the class ElementWidget method renderStaticHtml.
private void renderStaticHtml() {
String text = ((TextReportElement) model).getText();
SplitResult lines = RegExp.compile("\r?\n").split(Strings.nullToEmpty(text));
SafeHtmlBuilder html = new SafeHtmlBuilder();
for (int i = 0; i < lines.length(); i++) {
if (i > 0) {
html.appendHtmlConstant("<br>");
}
html.appendEscaped(lines.get(i));
}
updateHtml(html.toSafeHtml().asString());
}
use of org.activityinfo.legacy.shared.reports.model.TextReportElement 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());
}
});
}
}
use of org.activityinfo.legacy.shared.reports.model.TextReportElement in project activityinfo by bedatadriven.
the class GenerateDashboardElementHandler method execute.
@Override
public CommandResult execute(GenerateDashboardElement cmd, User user) throws CommandException {
ReportDTO report = dispatcher.execute(new GetReportModel(cmd.getReportId()));
if (report.getReport().getElements().isEmpty()) {
return new TextReportElement("The report is empty");
} else {
ReportElement element = report.getReport().getElements().get(0);
element.setContent(generator.generateElement(user, element, null, new DateRange()));
return element;
}
}
Aggregations