Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@94984 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-17 14:44:58 +00:00 committed by Giancarlo Panichi
parent bfc947448f
commit ea37ddcac2
1 changed files with 20 additions and 17 deletions

View File

@ -13,15 +13,15 @@ import com.google.web.bindery.event.shared.EventBus;
public class HistoryDiscard { public class HistoryDiscard {
protected TRId trId; protected TRId trId;
protected EventBus eventBus; protected EventBus eventBus;
public HistoryDiscard(EventBus eventBus) { public HistoryDiscard(EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
} }
public void discard(){ public void discard() {
retrieveCurrentTR(); retrieveCurrentTR();
} }
protected void retrieveCurrentTR() { protected void retrieveCurrentTR() {
TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() {
@ -41,33 +41,36 @@ public class HistoryDiscard {
}); });
} }
protected void callDiscard() {
protected void callDiscard(){ TDGWTServiceAsync.INSTANCE.discard(trId,
TDGWTServiceAsync.INSTANCE.discard(trId, new AsyncCallback<RollBackSession>() { new AsyncCallback<RollBackSession>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error in discard: " Log.error("Error in discard: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error in discard", UtilsGXT3.alert("Error in discard", "Error in discard");
"Error in discard");
} }
public void onSuccess(RollBackSession result) { public void onSuccess(RollBackSession result) {
Log.debug("Discard started "+result); Log.debug("Discard Session " + result);
callRollBackProgressDialog(result); if (result == null) {
Log.info("Attention: undo not applicable");
UtilsGXT3.info("Attention", "Undo not applicable");
} else {
callRollBackProgressDialog(result);
}
} }
}); });
} }
protected void callRollBackProgressDialog(RollBackSession rollBackSession) { protected void callRollBackProgressDialog(RollBackSession rollBackSession) {
RollBackProgressDialog dialog = new RollBackProgressDialog( RollBackProgressDialog dialog = new RollBackProgressDialog(
rollBackSession, eventBus); rollBackSession, eventBus);
dialog.show(); dialog.show();
} }
} }