2014-08-01 19:50:58 +02:00
|
|
|
package org.gcube.portlets.user.td.monitorwidget.client;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
2014-08-08 16:39:25 +02:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
2014-08-06 20:11:44 +02:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
2014-08-28 13:18:30 +02:00
|
|
|
import org.gcube.portlets.user.td.monitorwidget.client.details.MonitorDetailPanel;
|
2014-09-11 18:36:09 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.BackgroundRequestEvent;
|
2014-08-01 19:50:58 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
2014-09-11 18:36:09 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.BackgroundRequestType;
|
2014-08-01 19:50:58 +02:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
2015-01-29 18:30:37 +01:00
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
2014-08-01 19:50:58 +02:00
|
|
|
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
|
|
import com.google.web.bindery.event.shared.EventBus;
|
|
|
|
import com.sencha.gxt.core.client.util.Margins;
|
|
|
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
|
|
|
import com.sencha.gxt.widget.core.client.ProgressBar;
|
|
|
|
import com.sencha.gxt.widget.core.client.Window;
|
|
|
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
2014-08-07 17:45:30 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.button.ToolButton;
|
2014-08-28 20:12:34 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
|
|
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
2014-08-29 19:31:26 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
2014-08-28 20:12:34 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
2014-08-29 19:31:26 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
2014-08-01 19:50:58 +02:00
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* AddColumnProgressDialog is a Dialog that show progress of AddColumn
|
|
|
|
*
|
|
|
|
* @author "Giancarlo Panichi" <a
|
|
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
|
|
*
|
|
|
|
*/
|
2014-08-08 17:42:20 +02:00
|
|
|
public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
2014-10-31 15:49:37 +01:00
|
|
|
//private DateTimeFormat dateTimeFormat= DateTimeFormat.getFormat("yyyy/MM/dd HH:mm:ss SSS");
|
2014-09-09 19:17:22 +02:00
|
|
|
private static final int STATUS_POLLING_DELAY = 1000;
|
2014-08-29 19:31:26 +02:00
|
|
|
private static final String WIDTH = "640px";
|
2014-08-28 20:12:34 +02:00
|
|
|
private static final String HEIGHT = "378px";
|
2014-08-29 19:31:26 +02:00
|
|
|
private static final String PANELWIDTH = "620px";
|
2014-08-28 20:12:34 +02:00
|
|
|
private static final String PANELHEIGHT = "308px";
|
2014-08-29 19:31:26 +02:00
|
|
|
private static final String PROGRESSWIDTH = "618px";
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-07 17:45:30 +02:00
|
|
|
private EventBus eventBus;
|
2014-08-28 13:18:30 +02:00
|
|
|
private String taskId;
|
2014-08-08 16:39:25 +02:00
|
|
|
private MonitorUpdater progressUpdater;
|
2014-08-28 20:12:34 +02:00
|
|
|
private TextButton btnOk;
|
|
|
|
private TextButton btnBackground;
|
|
|
|
private TextButton btnAbort;
|
2015-01-29 18:30:37 +01:00
|
|
|
private OperationMonitor operationMonitorResult;
|
2014-08-01 19:50:58 +02:00
|
|
|
private String reason;
|
|
|
|
private String details;
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-07 17:45:30 +02:00
|
|
|
protected ToolButton backgroundBtn;
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-08 16:39:25 +02:00
|
|
|
protected ArrayList<MonitorDialogListener> listeners = new ArrayList<MonitorDialogListener>();
|
2014-09-03 17:43:18 +02:00
|
|
|
protected ArrayList<MonitorDialogEventUIListener> monitorDialogEventUIListeners = new ArrayList<MonitorDialogEventUIListener>();
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-09-03 17:43:18 +02:00
|
|
|
private MonitorDetailPanel monitorDetailPanel;
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-08 16:39:25 +02:00
|
|
|
public MonitorDialog(String taskId, EventBus eventBus) {
|
2014-08-01 19:50:58 +02:00
|
|
|
this.eventBus = eventBus;
|
2014-09-09 16:36:40 +02:00
|
|
|
this.taskId = taskId;
|
2015-01-29 18:30:37 +01:00
|
|
|
operationMonitorResult = null;
|
2014-10-31 15:49:37 +01:00
|
|
|
//Log.debug("Monitor Dialog Creation Start: "+dateTimeFormat.format(new Date()));
|
2014-08-28 13:18:30 +02:00
|
|
|
initWindow();
|
|
|
|
create();
|
|
|
|
|
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
|
|
|
protected void initWindow() {
|
2014-08-01 19:50:58 +02:00
|
|
|
setWidth(WIDTH);
|
|
|
|
setHeight(HEIGHT);
|
|
|
|
setBodyBorder(false);
|
|
|
|
setResizable(true);
|
|
|
|
setModal(true);
|
2014-08-29 19:31:26 +02:00
|
|
|
setClosable(true);
|
2014-08-28 13:18:30 +02:00
|
|
|
setHeadingText("Progress");
|
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
|
|
|
protected void create() {
|
2014-08-01 19:50:58 +02:00
|
|
|
FramedPanel panel = new FramedPanel();
|
2014-08-28 20:12:34 +02:00
|
|
|
panel.setWidth(PANELWIDTH);
|
|
|
|
panel.setHeight(PANELHEIGHT);
|
2014-08-01 19:50:58 +02:00
|
|
|
panel.setHeaderVisible(false);
|
|
|
|
panel.setBodyBorder(false);
|
|
|
|
|
|
|
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
2014-10-31 15:49:37 +01:00
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-01 19:50:58 +02:00
|
|
|
ProgressBar progressBar = new ProgressBar();
|
2014-08-29 19:31:26 +02:00
|
|
|
progressBar.setWidth(PROGRESSWIDTH);
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-10-31 15:49:37 +01:00
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
monitorDetailPanel = new MonitorDetailPanel(eventBus);
|
2014-10-31 15:49:37 +01:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
btnOk = new TextButton("Ok");
|
|
|
|
btnOk.setWidth("70px");
|
2014-09-09 16:36:40 +02:00
|
|
|
// btnOk.setIcon(ResourceBundle.INSTANCE.ok());
|
|
|
|
// btnOk.setIconAlign(IconAlign.RIGHT);
|
2014-08-28 20:12:34 +02:00
|
|
|
btnOk.setTitle("Ok");
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
btnOk.addSelectHandler(new SelectHandler() {
|
2014-08-01 19:50:58 +02:00
|
|
|
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
updateInvocation();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
btnBackground = new TextButton("Background");
|
|
|
|
btnBackground.setWidth("70px");
|
2014-09-09 16:36:40 +02:00
|
|
|
// btnBackground.setIcon(ResourceBundle.INSTANCE.background());
|
|
|
|
// btnBackground.setIconAlign(IconAlign.RIGHT);
|
2014-08-28 20:12:34 +02:00
|
|
|
btnBackground.setTitle("Background");
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
btnBackground.addSelectHandler(new SelectHandler() {
|
|
|
|
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
startBackground();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
btnAbort = new TextButton("Abort");
|
|
|
|
btnAbort.setWidth("70px");
|
2014-09-09 16:36:40 +02:00
|
|
|
// btnAbort.setIcon(ResourceBundle.INSTANCE.abort());
|
|
|
|
// btnAbort.setIconAlign(IconAlign.RIGHT);
|
2014-08-28 20:12:34 +02:00
|
|
|
btnAbort.setTitle("Abort");
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
btnAbort.addSelectHandler(new SelectHandler() {
|
|
|
|
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
startAbort();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
|
|
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
|
|
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
2014-08-01 19:50:58 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
flowButton.add(btnOk, new BoxLayoutData(new Margins(0, 4, 0, 4)));
|
2014-09-09 16:36:40 +02:00
|
|
|
flowButton.add(btnBackground,
|
|
|
|
new BoxLayoutData(new Margins(0, 4, 0, 4)));
|
2014-08-28 20:12:34 +02:00
|
|
|
flowButton.add(btnAbort, new BoxLayoutData(new Margins(0, 4, 0, 4)));
|
2014-09-09 16:36:40 +02:00
|
|
|
|
|
|
|
v.add(progressBar, new VerticalLayoutData(1, -1,
|
2014-08-28 20:12:34 +02:00
|
|
|
new Margins(5, 5, 5, 5)));
|
2014-09-09 16:36:40 +02:00
|
|
|
|
|
|
|
v.add(monitorDetailPanel, new VerticalLayoutData(1, -1, new Margins(5,
|
|
|
|
5, 5, 5)));
|
|
|
|
|
|
|
|
v.add(flowButton,
|
|
|
|
new VerticalLayoutData(1, 36, new Margins(5, 5, 5, 5)));
|
|
|
|
|
2014-10-31 15:49:37 +01:00
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-01 19:50:58 +02:00
|
|
|
panel.add(v);
|
|
|
|
add(panel);
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-07 17:45:30 +02:00
|
|
|
OperationMonitorSession operationMonitorSession = new OperationMonitorSession(
|
|
|
|
taskId);
|
2014-08-08 16:39:25 +02:00
|
|
|
progressUpdater = new MonitorUpdater(operationMonitorSession);
|
|
|
|
progressUpdater.addListener(new MonitorBarUpdater(progressBar));
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-01 19:50:58 +02:00
|
|
|
progressUpdater.addListener(this);
|
2014-08-29 19:31:26 +02:00
|
|
|
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
2014-09-04 12:58:55 +02:00
|
|
|
addMonitorDialogEventUIListener(progressUpdater);
|
2014-08-01 19:50:58 +02:00
|
|
|
show();
|
2014-08-29 19:31:26 +02:00
|
|
|
btnOk.setVisible(false);
|
2014-10-31 15:49:37 +01:00
|
|
|
//Log.debug("Monitor Dialog Creation End: "+dateTimeFormat.format(new Date()));
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-28 20:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void startAbort() {
|
2014-08-29 19:31:26 +02:00
|
|
|
btnOk.setEnabled(false);
|
|
|
|
btnBackground.setEnabled(false);
|
|
|
|
btnAbort.setEnabled(false);
|
2014-09-09 16:36:40 +02:00
|
|
|
fireRequestAborted();
|
2014-08-28 20:12:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void startBackground() {
|
2014-08-29 19:31:26 +02:00
|
|
|
btnOk.setEnabled(false);
|
|
|
|
btnBackground.setEnabled(false);
|
|
|
|
btnAbort.setEnabled(false);
|
2014-09-04 12:58:55 +02:00
|
|
|
fireRequestPutInBackground();
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
2014-08-07 17:45:30 +02:00
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
public boolean isAbortBtnEnabled() {
|
|
|
|
if (btnAbort != null) {
|
|
|
|
return btnAbort.isEnabled();
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAbortBtnEnabled(boolean abortBtnEnabled) {
|
|
|
|
if (btnBackground != null) {
|
|
|
|
btnBackground.setEnabled(abortBtnEnabled);
|
|
|
|
btnBackground.setVisible(abortBtnEnabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isBackgroundBtnEnabled() {
|
|
|
|
if (btnBackground != null) {
|
|
|
|
return btnBackground.isEnabled();
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBackgroundBtnEnabled(boolean backgroundBtnEnabled) {
|
|
|
|
if (btnBackground != null) {
|
|
|
|
btnBackground.setEnabled(backgroundBtnEnabled);
|
|
|
|
btnBackground.setVisible(backgroundBtnEnabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-08 16:39:25 +02:00
|
|
|
public void addProgressDialogListener(MonitorDialogListener listener) {
|
2014-08-01 19:50:58 +02:00
|
|
|
listeners.add(listener);
|
|
|
|
}
|
2014-08-07 17:45:30 +02:00
|
|
|
|
2014-08-08 16:39:25 +02:00
|
|
|
public void removeProgressDialogListener(MonitorDialogListener listener) {
|
2014-08-01 19:50:58 +02:00
|
|
|
listeners.remove(listener);
|
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
|
|
|
public void addMonitorDialogEventUIListener(
|
|
|
|
MonitorDialogEventUIListener listener) {
|
2014-09-03 17:43:18 +02:00
|
|
|
monitorDialogEventUIListeners.add(listener);
|
|
|
|
}
|
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
public void removeMonitorDialogEventUIListener(
|
|
|
|
MonitorDialogEventUIListener listener) {
|
2014-09-03 17:43:18 +02:00
|
|
|
monitorDialogEventUIListeners.remove(listener);
|
|
|
|
}
|
2014-08-07 17:45:30 +02:00
|
|
|
|
2014-08-01 19:50:58 +02:00
|
|
|
@Override
|
2014-08-28 13:18:30 +02:00
|
|
|
public void monitorInitializing(OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:18:30 +02:00
|
|
|
}
|
2014-08-28 20:12:34 +02:00
|
|
|
forceLayout();
|
2014-08-01 19:50:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-08-26 16:20:34 +02:00
|
|
|
public void monitorUpdate(OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:18:30 +02:00
|
|
|
}
|
2014-08-28 20:12:34 +02:00
|
|
|
forceLayout();
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-01-29 18:30:37 +01:00
|
|
|
public void monitorComplete(OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:20:32 +02:00
|
|
|
}
|
2015-01-29 18:30:37 +01:00
|
|
|
Log.debug("Operation Complete return: " + operationMonitor.getTrId());
|
|
|
|
this.operationMonitorResult = operationMonitor;
|
2014-08-29 19:31:26 +02:00
|
|
|
btnBackground.setVisible(false);
|
|
|
|
btnAbort.setVisible(false);
|
|
|
|
forceLayout();
|
2015-01-29 18:30:37 +01:00
|
|
|
fireOperationComplete(operationMonitor);
|
2014-08-29 19:31:26 +02:00
|
|
|
close();
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-09-09 16:36:40 +02:00
|
|
|
public void monitorFailed(Throwable caught, String reason, String details,
|
|
|
|
OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-10-21 17:07:35 +02:00
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:20:32 +02:00
|
|
|
}
|
2014-08-28 20:12:34 +02:00
|
|
|
forceLayout();
|
2014-08-01 19:50:58 +02:00
|
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
} else {
|
2014-09-09 16:36:40 +02:00
|
|
|
fireOperationFailed(caught, reason, details);
|
2014-08-29 19:31:26 +02:00
|
|
|
close();
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void updateInvocation() {
|
2015-01-29 18:30:37 +01:00
|
|
|
if (operationMonitorResult != null) {
|
|
|
|
fireOperationStopped(operationMonitorResult, reason, details);
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
2014-08-29 19:31:26 +02:00
|
|
|
close();
|
2014-08-01 19:50:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-01-29 18:30:37 +01:00
|
|
|
public void monitorStopped(String reason, String details,
|
2014-09-09 16:36:40 +02:00
|
|
|
OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:20:32 +02:00
|
|
|
}
|
2015-01-29 18:30:37 +01:00
|
|
|
Log.debug("Operation Stopped: [" + operationMonitor.getTrId() + ", " + reason
|
2014-08-01 19:50:58 +02:00
|
|
|
+ ", " + details + "]");
|
2015-01-29 18:30:37 +01:00
|
|
|
this.operationMonitorResult = operationMonitor;
|
2014-08-07 17:45:30 +02:00
|
|
|
this.reason = reason;
|
|
|
|
this.details = details;
|
2014-08-28 20:12:34 +02:00
|
|
|
btnOk.setVisible(true);
|
2014-08-29 19:31:26 +02:00
|
|
|
btnBackground.setVisible(false);
|
|
|
|
btnAbort.setVisible(false);
|
2014-08-28 20:12:34 +02:00
|
|
|
forceLayout();
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-08-26 16:20:34 +02:00
|
|
|
public void monitorGeneratingView(OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:20:32 +02:00
|
|
|
}
|
2014-08-28 20:12:34 +02:00
|
|
|
forceLayout();
|
2014-08-01 19:50:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-08-26 16:20:34 +02:00
|
|
|
public void monitorValidate(OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 13:20:32 +02:00
|
|
|
}
|
2014-08-28 20:12:34 +02:00
|
|
|
forceLayout();
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
2014-08-08 18:50:46 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void monitorAborted() {
|
|
|
|
fireOperationAborted();
|
2014-08-29 19:31:26 +02:00
|
|
|
close();
|
2014-08-08 18:50:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void monitorPutInBackground() {
|
|
|
|
fireOperationPutInBackground();
|
2014-08-29 19:31:26 +02:00
|
|
|
close();
|
2014-09-11 18:36:09 +02:00
|
|
|
Log.debug("Request Background");
|
|
|
|
BackgroundRequestEvent e = new BackgroundRequestEvent(
|
2014-10-21 17:07:35 +02:00
|
|
|
BackgroundRequestType.BACKGROUND);
|
2014-09-11 18:36:09 +02:00
|
|
|
eventBus.fireEvent(e);
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-08 18:50:46 +02:00
|
|
|
}
|
2014-08-07 17:45:30 +02:00
|
|
|
|
2015-01-29 18:30:37 +01:00
|
|
|
protected void fireOperationComplete(OperationMonitor operationMonitor) {
|
|
|
|
for (MonitorDialogListener listener : listeners){
|
|
|
|
OperationResult operationResult=new OperationResult(operationMonitor.getTrId(),
|
2015-01-30 18:36:02 +01:00
|
|
|
operationMonitor.getTask().getCollateralTRIds());
|
2015-01-29 18:30:37 +01:00
|
|
|
listener.operationComplete(operationResult);
|
|
|
|
}
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
protected void fireOperationFailed(Throwable caught, String reason,
|
|
|
|
String details) {
|
2014-08-08 16:39:25 +02:00
|
|
|
for (MonitorDialogListener listener : listeners)
|
2014-09-09 16:36:40 +02:00
|
|
|
listener.operationFailed(caught, reason, details);
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
2014-08-07 17:45:30 +02:00
|
|
|
|
2015-01-29 18:30:37 +01:00
|
|
|
protected void fireOperationStopped(OperationMonitor operationMonitor, String reason, String details) {
|
|
|
|
for (MonitorDialogListener listener : listeners){
|
|
|
|
OperationResult operationResult=new OperationResult(operationMonitor.getTrId(),
|
2015-01-30 18:36:02 +01:00
|
|
|
operationMonitor.getTask().getCollateralTRIds());
|
2015-01-29 18:30:37 +01:00
|
|
|
listener.operationStopped(operationResult, reason, details);
|
|
|
|
}
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-08 18:50:46 +02:00
|
|
|
protected void fireOperationAborted() {
|
|
|
|
for (MonitorDialogListener listener : listeners)
|
|
|
|
listener.operationAborted();
|
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-08 18:50:46 +02:00
|
|
|
protected void fireOperationPutInBackground() {
|
|
|
|
for (MonitorDialogListener listener : listeners)
|
|
|
|
listener.operationPutInBackground();
|
2014-10-21 17:07:35 +02:00
|
|
|
|
2014-08-08 18:50:46 +02:00
|
|
|
}
|
2014-10-21 17:07:35 +02:00
|
|
|
|
|
|
|
// UI event Fire
|
2014-09-09 16:36:40 +02:00
|
|
|
protected void fireRequestAborted() {
|
|
|
|
for (MonitorDialogEventUIListener listener : monitorDialogEventUIListeners) {
|
2014-09-03 17:43:18 +02:00
|
|
|
listener.requestAborted();
|
|
|
|
}
|
|
|
|
}
|
2014-09-09 16:36:40 +02:00
|
|
|
|
|
|
|
protected void fireRequestPutInBackground() {
|
|
|
|
for (MonitorDialogEventUIListener listener : monitorDialogEventUIListeners) {
|
2014-09-03 17:43:18 +02:00
|
|
|
listener.requestPutInBackground();
|
|
|
|
}
|
2014-10-21 17:07:35 +02:00
|
|
|
|
2014-09-03 17:43:18 +02:00
|
|
|
}
|
2014-08-07 17:45:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void initTools() {
|
2014-09-09 16:36:40 +02:00
|
|
|
/*
|
|
|
|
* if (backgroundBtnEnabled) { backgroundBtn = new
|
|
|
|
* ToolButton(ToolButton.CLOSE);
|
|
|
|
* backgroundBtn.setToolTip("Put in the background");
|
|
|
|
* backgroundBtn.addSelectHandler(new SelectHandler() {
|
|
|
|
*
|
|
|
|
* @Override public void onSelect(SelectEvent event) { hide(); } });
|
|
|
|
*
|
|
|
|
* header.addTool(backgroundBtn); }
|
|
|
|
*/
|
|
|
|
|
2014-08-07 17:45:30 +02:00
|
|
|
super.initTools();
|
2014-09-09 16:36:40 +02:00
|
|
|
|
2014-08-29 19:31:26 +02:00
|
|
|
closeBtn.setVisible(false);
|
2014-08-28 20:12:34 +02:00
|
|
|
/*
|
2014-09-09 16:36:40 +02:00
|
|
|
* closeBtn.addSelectHandler(new SelectHandler() {
|
|
|
|
*
|
|
|
|
* public void onSelect(SelectEvent event) { close(); } });
|
|
|
|
*/
|
2014-08-07 17:45:30 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void close() {
|
|
|
|
hide();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-09-09 16:36:40 +02:00
|
|
|
public void updateOperationMonitor(OperationMonitor operationMonitor) {
|
2014-10-21 17:07:35 +02:00
|
|
|
try {
|
|
|
|
if (monitorDetailPanel != null) {
|
|
|
|
monitorDetailPanel.update(operationMonitor);
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Log.debug(e.getLocalizedMessage());
|
2014-08-28 20:12:34 +02:00
|
|
|
}
|
|
|
|
forceLayout();
|
|
|
|
}
|
2014-08-08 16:39:25 +02:00
|
|
|
|
2014-08-01 19:50:58 +02:00
|
|
|
}
|