Added Stop support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@92481 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-28 13:17:25 +00:00
parent 6590d42e11
commit de3cd1b883
12 changed files with 154 additions and 3 deletions

View File

@ -64,4 +64,11 @@ public class ChangeColumnTypeProgressBarUpdater implements ChangeColumnTypeProgr
} }
@Override
public void operationStopped(String reason, String details) {
Log.info("Stopped");
progressBar.updateText("Stopped");
}
} }

View File

@ -122,4 +122,18 @@ public class ChangeColumnTypeProgressDialog extends Window implements ChangeColu
} }
hide(); hide();
} }
@Override
public void operationStopped(String reason, String details) {
ok.setVisible(true);
this.trId=null;
AlertMessageBox d = new AlertMessageBox("Stopped Changing Column Type", reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
}
} }

View File

@ -38,4 +38,12 @@ public interface ChangeColumnTypeProgressListener {
* @param reason the failure reason. * @param reason the failure reason.
*/ */
public void operationFailed(Throwable caught, String reason, String failureDetails); public void operationFailed(Throwable caught, String reason, String failureDetails);
/**
* Called when the operation is failed.
* @param caught the failure exception.
* @param reason the failure reason.
*/
public void operationStopped(String reason, String details);
} }

View File

@ -62,7 +62,7 @@ public class ChangeColumnTypeProgressUpdater extends Timer {
break; break;
case STOPPED: case STOPPED:
cancel(); cancel();
errorMessage(result); stopMessage(result);
break; break;
case FAILED: case FAILED:
cancel(); cancel();
@ -103,6 +103,21 @@ public class ChangeColumnTypeProgressUpdater extends Timer {
fireOperationFailed(th, failure, details); fireOperationFailed(th, failure, details);
} }
protected void stopMessage(ChangeColumnTypeMonitor result) {
Log.info("Change Column Type Stopped");
String failure = null;
String details = null;
if (result.getError() != null) {
failure = "Stopped changing the column type";
details = result.getError().getLocalizedMessage();
} else {
failure = "Stopped changing the column type";
details = "Change the column type stopped";
}
fireOperationStopped(failure, details);
}
protected String getStack(Throwable e) { protected String getStack(Throwable e) {
String message = e.getLocalizedMessage() + " -> <br>"; String message = e.getLocalizedMessage() + " -> <br>";
Throwable c = e.getCause(); Throwable c = e.getCause();
@ -132,6 +147,11 @@ public class ChangeColumnTypeProgressUpdater extends Timer {
listener.operationFailed(caught, failure, failureDetails); listener.operationFailed(caught, failure, failureDetails);
} }
protected void fireOperationStopped(String reason, String details) {
for (ChangeColumnTypeProgressListener listener : listeners)
listener.operationStopped(reason, details);
}
/** /**
* Add a new {@link ChangeColumnTypeProgressListener} to this * Add a new {@link ChangeColumnTypeProgressListener} to this
* {@link ChangeColumnTypeProgressUpdater}. * {@link ChangeColumnTypeProgressUpdater}.

View File

@ -64,4 +64,11 @@ public class DeleteColumnProgressBarUpdater implements DeleteColumnProgressListe
} }
@Override
public void operationStopped(String reason, String details) {
Log.info("Stopped");
progressBar.updateText("Stopped");
}
} }

View File

@ -122,4 +122,18 @@ public class DeleteColumnProgressDialog extends Window implements DeleteColumnPr
} }
hide(); hide();
} }
@Override
public void operationStopped(String reason, String details) {
ok.setVisible(true);
this.trId=null;
AlertMessageBox d = new AlertMessageBox("Stopped Delete Column", reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
}
} }

View File

@ -39,4 +39,13 @@ public interface DeleteColumnProgressListener {
* @param reason the failure reason. * @param reason the failure reason.
*/ */
public void operationFailed(Throwable caught, String reason, String failureDetails); public void operationFailed(Throwable caught, String reason, String failureDetails);
/**
* Called when the operation is failed.
* @param caught the failure exception.
* @param reason the failure reason.
*/
public void operationStopped(String reason, String details);
} }

View File

@ -63,7 +63,7 @@ public class DeleteColumnProgressUpdater extends Timer {
break; break;
case STOPPED: case STOPPED:
cancel(); cancel();
errorMessage(result); stopMessage(result);
break; break;
case FAILED: case FAILED:
cancel(); cancel();
@ -107,6 +107,22 @@ public class DeleteColumnProgressUpdater extends Timer {
fireOperationFailed(th, failure, details); fireOperationFailed(th, failure, details);
} }
protected void stopMessage(DeleteColumnMonitor result) {
Log.info("Delete Column Stopped");
String failure = null;
String details = null;
if (result.getError() != null) {
failure = "Stopped delete column";
details = result.getError().getLocalizedMessage();
} else {
failure = "Stopped delete column";
details = "Delete the column stopped";
}
fireOperationStopped(failure, details);
}
protected String getStack(Throwable e) { protected String getStack(Throwable e) {
String message = e.getLocalizedMessage() + " -> <br>"; String message = e.getLocalizedMessage() + " -> <br>";
Throwable c = e.getCause(); Throwable c = e.getCause();
@ -136,6 +152,11 @@ public class DeleteColumnProgressUpdater extends Timer {
listener.operationFailed(caught, failure, failureDetails); listener.operationFailed(caught, failure, failureDetails);
} }
protected void fireOperationStopped(String reason, String details) {
for (DeleteColumnProgressListener listener : listeners)
listener.operationStopped(reason, details);
}
/** /**
* Add a new {@link DeleteColumnProgressListener} to this * Add a new {@link DeleteColumnProgressListener} to this
* {@link DeleteColumnProgressUpdater}. * {@link DeleteColumnProgressUpdater}.

View File

@ -64,4 +64,11 @@ public class LabelColumnProgressBarUpdater implements LabelColumnProgressListene
} }
@Override
public void operationStopped(String reason, String details) {
Log.info("Stopped");
progressBar.updateText("Stopped");
}
} }

View File

@ -123,4 +123,17 @@ public class LabelColumnProgressDialog extends Window implements LabelColumnProg
} }
hide(); hide();
} }
@Override
public void operationStopped(String reason, String details) {
ok.setVisible(true);
this.trId=null;
AlertMessageBox d = new AlertMessageBox(reason, details);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
}
} }

View File

@ -39,4 +39,13 @@ public interface LabelColumnProgressListener {
* @param reason the failure reason. * @param reason the failure reason.
*/ */
public void operationFailed(Throwable caught, String reason, String failureDetails); public void operationFailed(Throwable caught, String reason, String failureDetails);
/**
* Called when the operation is failed.
* @param caught the failure exception.
* @param reason the failure reason.
*/
public void operationStopped(String reason, String details);
} }

View File

@ -63,7 +63,7 @@ public class LabelColumnProgressUpdater extends Timer {
break; break;
case STOPPED: case STOPPED:
cancel(); cancel();
errorMessage(result); stopMessage(result);
break; break;
case FAILED: case FAILED:
cancel(); cancel();
@ -107,6 +107,22 @@ public class LabelColumnProgressUpdater extends Timer {
fireOperationFailed(th, failure, details); fireOperationFailed(th, failure, details);
} }
protected void stopMessage(LabelColumnMonitor result) {
Log.info("Change Label Stopped");
String failure = null;
String details = null;
if (result.getError() != null) {
failure = "Stopped";
details = result.getError().getLocalizedMessage();
} else {
failure = "Stopped";
details = "Stopped changing the column label ";
}
fireOperationStopped(failure, details);
}
protected String getStack(Throwable e) { protected String getStack(Throwable e) {
String message = e.getLocalizedMessage() + " -> <br>"; String message = e.getLocalizedMessage() + " -> <br>";
Throwable c = e.getCause(); Throwable c = e.getCause();
@ -136,6 +152,12 @@ public class LabelColumnProgressUpdater extends Timer {
listener.operationFailed(caught, failure, failureDetails); listener.operationFailed(caught, failure, failureDetails);
} }
protected void fireOperationStopped(String reason, String details) {
for (LabelColumnProgressListener listener : listeners)
listener.operationStopped(reason, details);
}
/** /**
* Add a new {@link LabelColumnProgressListener} to this * Add a new {@link LabelColumnProgressListener} to this
* {@link LabelColumnProgressUpdater}. * {@link LabelColumnProgressUpdater}.