From ea37ddcac25ba93b526f6a99837c012f7c082a0e Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 17 Apr 2014 14:44:58 +0000 Subject: [PATCH] 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 --- .../client/history/HistoryDiscard.java | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryDiscard.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryDiscard.java index b9ea937..b79cedf 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryDiscard.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryDiscard.java @@ -13,15 +13,15 @@ import com.google.web.bindery.event.shared.EventBus; public class HistoryDiscard { protected TRId trId; protected EventBus eventBus; - + public HistoryDiscard(EventBus eventBus) { this.eventBus = eventBus; } - - public void discard(){ - retrieveCurrentTR(); + + public void discard() { + retrieveCurrentTR(); } - + protected void retrieveCurrentTR() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() { @@ -41,33 +41,36 @@ public class HistoryDiscard { }); } - - - protected void callDiscard(){ - TDGWTServiceAsync.INSTANCE.discard(trId, new AsyncCallback() { + + protected void callDiscard() { + TDGWTServiceAsync.INSTANCE.discard(trId, + new AsyncCallback() { public void onFailure(Throwable caught) { Log.error("Error in discard: " + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error in discard", - "Error in discard"); - + UtilsGXT3.alert("Error in discard", "Error in discard"); + } public void onSuccess(RollBackSession result) { - Log.debug("Discard started "+result); - callRollBackProgressDialog(result); + Log.debug("Discard Session " + result); + if (result == null) { + Log.info("Attention: undo not applicable"); + UtilsGXT3.info("Attention", "Undo not applicable"); + } else { + callRollBackProgressDialog(result); + } } }); } - - + protected void callRollBackProgressDialog(RollBackSession rollBackSession) { RollBackProgressDialog dialog = new RollBackProgressDialog( rollBackSession, eventBus); dialog.show(); } - + }