Updated OperationMonitor
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-monitor-widget@99248 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b641e01ae6
commit
440b7d8e13
|
@ -15,7 +15,7 @@ import com.sencha.gxt.widget.core.client.ProgressBar;
|
|||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorBarUpdater implements MonitorListener {
|
||||
public class MonitorBarUpdater implements MonitorUpdaterListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class MonitorBarUpdater implements MonitorListener {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
public void monitorComplete(TRId trId) {
|
||||
Log.info("Completed");
|
||||
progressBar.updateProgress(1, "Completed");
|
||||
|
||||
|
@ -43,19 +43,19 @@ public class MonitorBarUpdater implements MonitorListener {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||
public void monitorFailed(Throwable caught, String reason, String failureDetails) {
|
||||
Log.info("Failed");
|
||||
progressBar.updateText("Failed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationInitializing() {
|
||||
public void monitorInitializing() {
|
||||
Log.info("Inizializing");
|
||||
progressBar.updateProgress(0, "Initializing...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
public void monitorUpdate(float elaborated) {
|
||||
Log.info("Elaborated: "+elaborated);
|
||||
if (elaborated>=0 && elaborated<1) {
|
||||
Log.trace("progress "+elaborated);
|
||||
|
@ -67,7 +67,7 @@ public class MonitorBarUpdater implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
public void monitorValidate(float elaborated) {
|
||||
Log.info("Validation Elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Start Validation...");
|
||||
if (elaborated>0 && elaborated<1) {
|
||||
|
@ -79,14 +79,14 @@ public class MonitorBarUpdater implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId,String reason, String details) {
|
||||
public void monitorStopped(TRId trId,String reason, String details) {
|
||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
||||
progressBar.updateText("Validations failed");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
public void monitorGeneratingView() {
|
||||
Log.info("Generating View...");
|
||||
progressBar.updateText("Generating View...");
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class MonitorBarUpdater implements MonitorListener {
|
|||
|
||||
|
||||
@Override
|
||||
public void operationMonitorChanged(OperationMonitor operationMonitor) {
|
||||
public void monitorChanged(OperationMonitor operationMonitor) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorDialog extends Window implements MonitorListener {
|
||||
public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
private static final String WIDTH = "400px";
|
||||
|
@ -103,19 +103,19 @@ public class MonitorDialog extends Window implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationInitializing() {
|
||||
public void monitorInitializing() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
public void monitorUpdate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
public void monitorComplete(TRId trId) {
|
||||
Log.debug("Operation Complete return: " + trId.toString());
|
||||
this.trId = trId;
|
||||
fireOperationComplete(trId);
|
||||
|
@ -123,13 +123,12 @@ public class MonitorDialog extends Window implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
public void monitorFailed(Throwable caught, String reason, String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
fireOperationFailed(caught, reason);
|
||||
fireOperationFailed(caught,reason);
|
||||
hide();
|
||||
|
||||
}
|
||||
|
@ -144,7 +143,7 @@ public class MonitorDialog extends Window implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId, String reason, String details) {
|
||||
public void monitorStopped(TRId trId, String reason, String details) {
|
||||
Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
|
||||
+ ", " + details + "]");
|
||||
this.trId = trId;
|
||||
|
@ -155,13 +154,13 @@ public class MonitorDialog extends Window implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
public void monitorGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
public void monitorValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
@ -173,7 +172,7 @@ public class MonitorDialog extends Window implements MonitorListener {
|
|||
|
||||
protected void fireOperationFailed(Throwable caught, String reason) {
|
||||
for (MonitorDialogListener listener : listeners)
|
||||
listener.operationFailed(caught, reason);
|
||||
listener.operationFailed(caught,reason);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
|
@ -217,7 +216,7 @@ public class MonitorDialog extends Window implements MonitorListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationMonitorChanged(OperationMonitor operationMonitor) {
|
||||
public void monitorChanged(OperationMonitor operationMonitor) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client;
|
||||
|
||||
public interface MonitorDialogEventUIListener {
|
||||
/**
|
||||
* Called when the operation is aborted
|
||||
*
|
||||
*/
|
||||
public void requestAborted();
|
||||
|
||||
|
||||
/**
|
||||
* Called when the operation is put in the background
|
||||
*
|
||||
*/
|
||||
public void requestPutInBackground();
|
||||
|
||||
|
||||
}
|
|
@ -19,8 +19,8 @@ public interface MonitorDialogListener {
|
|||
|
||||
/**
|
||||
* Called when the operation is failed.
|
||||
* @param caught the failure exception.
|
||||
* @param reason the failure reason.
|
||||
* @param caught
|
||||
* @param reason
|
||||
*/
|
||||
public void operationFailed(Throwable caught, String reason);
|
||||
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines a listener for operation progress.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface MonitorListener {
|
||||
|
||||
/**
|
||||
* Called when the operation is starting.
|
||||
*/
|
||||
public void operationInitializing();
|
||||
|
||||
/**
|
||||
* Called when there is a progress for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void operationUpdate(float elaborated);
|
||||
|
||||
/**
|
||||
* Called when there is a validate for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void operationValidate(float elaborated);
|
||||
|
||||
/**
|
||||
* Called when the operation is complete.
|
||||
*/
|
||||
public void operationComplete(TRId trId);
|
||||
|
||||
/**
|
||||
* Called when the operation is failed.
|
||||
* @param caught the failure exception.
|
||||
* @param reason the failure reason.
|
||||
*/
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails);
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void operationStopped(TRId trId, String reason, String details);
|
||||
|
||||
/**
|
||||
* Called when the operation is generating the view
|
||||
*/
|
||||
public void operationGeneratingView();
|
||||
|
||||
|
||||
/**
|
||||
* Called when the operation montor is changed
|
||||
*
|
||||
* @param operationMonitor
|
||||
*/
|
||||
public void operationMonitorChanged(OperationMonitor operationMonitor);
|
||||
|
||||
}
|
|
@ -18,9 +18,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MonitorUpdater extends Timer implements MonitorUpdaterListener {
|
||||
public class MonitorUpdater extends Timer implements MonitorDialogEventUIListener {
|
||||
|
||||
protected ArrayList<MonitorListener> listeners = new ArrayList<MonitorListener>();
|
||||
protected ArrayList<MonitorUpdaterListener> listeners = new ArrayList<MonitorUpdaterListener>();
|
||||
protected OperationMonitorSession operationMonitorSession;
|
||||
|
||||
public MonitorUpdater(OperationMonitorSession operationMonitorSession){
|
||||
|
@ -138,61 +138,61 @@ public class MonitorUpdater extends Timer implements MonitorUpdaterListener {
|
|||
}
|
||||
|
||||
protected void fireOperationInitializing() {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (MonitorListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
for (MonitorUpdaterListener listener : listeners)
|
||||
listener.monitorStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link MonitorListener} to this
|
||||
* Add a new {@link MonitorUpdaterListener} to this
|
||||
* {@link AddColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(MonitorListener listener) {
|
||||
public void addListener(MonitorUpdaterListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link MonitorListener} from this
|
||||
* Removes the specified {@link MonitorUpdaterListener} from this
|
||||
* {@link AddColumnProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(MonitorListener listener) {
|
||||
public void removeListener(MonitorUpdaterListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
|
@ -200,14 +200,14 @@ public class MonitorUpdater extends Timer implements MonitorUpdaterListener {
|
|||
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
public void requestAborted() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
public void requestPutInBackground() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +1,69 @@
|
|||
package org.gcube.portlets.user.td.monitorwidget.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines a listener for operation progress.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface MonitorUpdaterListener {
|
||||
|
||||
/**
|
||||
* Called when the operation is aborted
|
||||
*
|
||||
* Called when the operation is starting.
|
||||
*/
|
||||
public void operationAborted();
|
||||
public void monitorInitializing();
|
||||
|
||||
/**
|
||||
* Called when there is a progress for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void monitorUpdate(float elaborated);
|
||||
|
||||
/**
|
||||
* Called when there is a validate for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void monitorValidate(float elaborated);
|
||||
|
||||
/**
|
||||
* Called when the operation is complete.
|
||||
*/
|
||||
public void monitorComplete(TRId trId);
|
||||
|
||||
/**
|
||||
* Called when the operation is failed.
|
||||
* @param caught the failure exception.
|
||||
* @param reason the failure reason.
|
||||
*/
|
||||
public void monitorFailed(Throwable caught, String reason, String failureDetails);
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void monitorStopped(TRId trId, String reason, String details);
|
||||
|
||||
/**
|
||||
* Called when the operation is generating the view
|
||||
*/
|
||||
public void monitorGeneratingView();
|
||||
|
||||
|
||||
/**
|
||||
* Called when the operation is put in the background
|
||||
* Called when the operation montor is changed
|
||||
*
|
||||
* @param operationMonitor
|
||||
*/
|
||||
public void operationPutInBackground();
|
||||
|
||||
public void monitorChanged(OperationMonitor operationMonitor);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue