use of au.com.vaadinutils.jasper.ReportStatus in project VaadinUtils by rlsutton1.
the class JasperReportLayout method getProgressDialogRefreshListener.
private void getProgressDialogRefreshListener(final WorkingDialog dialog) {
final Table reportQueue = new Table();
reportQueue.addContainerProperty("Time", String.class, "");
reportQueue.addContainerProperty("Report Name", String.class, "");
reportQueue.addContainerProperty("User", String.class, "");
reportQueue.addContainerProperty("Status", String.class, "");
reportQueue.setSizeFull();
reportQueue.setHeight("150");
reportQueue.setWidth("100%");
reportQueue.setColumnWidth("Time", 50);
reportQueue.setColumnWidth("Report Name", 150);
reportQueue.setColumnWidth("User", 100);
// reportQueue.setColumnWidth("Status", 100);
UI.getCurrent().setPollInterval(500);
UI.getCurrent().addPollListener(new PollListener() {
int refreshDivider = 0;
boolean tableAdded = false;
private static final long serialVersionUID = -5641305025399715756L;
@SuppressWarnings("unchecked")
@Override
public void poll(PollEvent event) {
if (manager == null) {
return;
}
ReportStatus status = manager.getStatus();
dialog.progress(0, 0, status.getStatus());
if (refreshDivider % 4 == 0) {
if (status.getEntries().size() > 0) {
reportQueue.removeAllItems();
for (QueueEntry entry : status.getEntries()) {
Object id = reportQueue.addItem();
Item item = reportQueue.getItem(id);
item.getItemProperty("Time").setValue(entry.getTime());
item.getItemProperty("Report Name").setValue(entry.getReportName());
item.getItemProperty("User").setValue(entry.getUser());
item.getItemProperty("Status").setValue(entry.getStatus());
}
if (!tableAdded) {
dialog.addUserComponent(reportQueue);
tableAdded = true;
}
dialog.setWidth("600");
dialog.setHeight("350");
dialog.center();
} else {
dialog.removeUserComponent(reportQueue);
dialog.setWidth("300");
dialog.setHeight("150");
dialog.center();
}
}
if (cancelled) {
printButton.setEnabled(true);
exportButton.setEnabled(true);
showButton.setEnabled(true);
for (ExpanderComponent componet : components) {
componet.getComponent().setEnabled(true);
}
UI.getCurrent().removePollListener(this);
UI.getCurrent().setPollInterval(-1);
dialog.close();
}
refreshDivider++;
}
});
}
Aggregations