From ed0e9fdef31deb92dce0563edf677564b004784e Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 16 May 2014 14:21:10 +0000 Subject: [PATCH] Added SessionExpiredShow git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@95793 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ChangeTableTypePanel.java | 136 +++++------ .../client/CloneTabularResource.java | 28 ++- .../client/history/HistoryDiscard.java | 30 ++- .../client/history/HistoryPanel.java | 56 +++-- .../ChangeTableTypeProgressDialog.java | 220 ++++++++--------- .../progress/DeleteRowsProgressDialog.java | 222 +++++++++--------- .../DuplicatesRowsProgressDialog.java | 219 ++++++++--------- .../progress/EditRowProgressDialog.java | 217 ++++++++--------- .../progress/RollBackProgressDialog.java | 217 +++++++++-------- .../tablewidget/client/rows/DeleteRows.java | 53 +++-- .../client/rows/DuplicatesRowsPanel.java | 88 ++++--- .../tablewidget/client/rows/EditRowPanel.java | 62 ++--- .../validation/ValidationsTablePanel.java | 57 +++-- .../validation/ValidationsTasksPanel.java | 68 +++--- 14 files changed, 890 insertions(+), 783 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/ChangeTableTypePanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/ChangeTableTypePanel.java index 4528649..e03188e 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/ChangeTableTypePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/ChangeTableTypePanel.java @@ -1,8 +1,7 @@ package org.gcube.portlets.user.td.tablewidget.client; - - import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.tablewidget.client.progress.ChangeTableTypeProgressDialog; @@ -10,6 +9,8 @@ import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeElement; import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeProperties; import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeStore; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -29,50 +30,47 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.FieldLabel; - /** * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ -public class ChangeTableTypePanel extends FramedPanel { +public class ChangeTableTypePanel extends FramedPanel { protected String WIDTH = "640px"; protected String HEIGHT = "520px"; - + protected TRId trId; protected TableData table; protected String headingTitle; protected VerticalLayoutContainer vl; protected EventBus eventBus; protected ChangeTableTypeSession changeTableTypeSession; - protected ChangeTableTypeProgressDialog changeTableTypeProgressDialog; - + protected ChangeTableTypeProgressDialog changeTableTypeProgressDialog; + protected ComboBox comboTableType; protected TextButton change; - - public ChangeTableTypePanel(TRId trId, EventBus eventBus) { super(); - this.trId=trId; + this.trId = trId; this.eventBus = eventBus; - forceLayoutOnResize=true; + forceLayoutOnResize = true; create(); } - - protected void create(){ + + protected void create() { setWidth(WIDTH); setHeight(HEIGHT); setHeaderVisible(false); setBodyBorder(false); - - + TableTypeProperties props = GWT.create(TableTypeProperties.class); - ListStore storeTableType = new ListStore(props.id()); - + ListStore storeTableType = new ListStore( + props.id()); + storeTableType.addAll(TableTypeStore.getTableTypes()); - + Log.trace("Store created"); comboTableType = new ComboBox(storeTableType, @@ -80,104 +78,110 @@ public class ChangeTableTypePanel extends FramedPanel { Log.trace("ComboTableType created"); - comboTableType.setEmptyText("Select a Table Type..."); comboTableType.setItemId("ComboTableType"); comboTableType.setWidth("200px"); comboTableType.setEditable(false); comboTableType.setTriggerAction(TriggerAction.ALL); - - change=new TextButton("Change"); + change = new TextButton("Change"); change.addSelectHandler(new SelectHandler() { - + public void onSelect(SelectEvent event) { onChangeTableType(); - + } }); - + vl = new VerticalLayoutContainer(); vl.setScrollMode(ScrollMode.AUTO); vl.setAdjustForScroll(true); - - vl.add(new FieldLabel(comboTableType, "Table Type"), new VerticalLayoutData(1, - -1)); - vl.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); - + vl.add(new FieldLabel(comboTableType, "Table Type"), + new VerticalLayoutData(1, -1)); + vl.add(change, + new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); + add(vl); show(); load(); - + } - - protected void onChangeTableType(){ + + protected void onChangeTableType() { TableTypeElement tableTypeElement = comboTableType.getCurrentValue(); - if(tableTypeElement!=null){ - changeTableTypeSession=new ChangeTableTypeSession(trId,tableTypeElement.getTableType()); + if (tableTypeElement != null) { + changeTableTypeSession = new ChangeTableTypeSession(trId, + tableTypeElement.getTableType()); callChangeTableType(); } else { UtilsGXT3.alert("Attention", "Select a table type!"); } } - + private void callChangeTableType() { - TDGWTServiceAsync.INSTANCE.startChangeTableType( - changeTableTypeSession, new AsyncCallback() { + TDGWTServiceAsync.INSTANCE.startChangeTableType(changeTableTypeSession, + new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Change The Table Type Error: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error Changing The Table Type", - "Error in invocation of Change Table Type operation!"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("Change The Table Type Error: " + + caught.getLocalizedMessage()); + UtilsGXT3 + .alert("Error Changing The Table Type", + "Error in invocation of Change Table Type operation!"); + } } public void onSuccess(Void result) { - changeTableTypeProgressDialog= new ChangeTableTypeProgressDialog(changeTableTypeSession, eventBus); + changeTableTypeProgressDialog = new ChangeTableTypeProgressDialog( + changeTableTypeSession, eventBus); } }); } - - - protected void setCurrentType(){ - TableTypeElement tElement=TableTypeStore.getTableTypeElement(table.getTypeName()); - comboTableType.setValue(tElement); - + + protected void setCurrentType() { + TableTypeElement tElement = TableTypeStore.getTableTypeElement(table + .getTypeName()); + comboTableType.setValue(tElement); + } - - + private void load() { TDGWTServiceAsync.INSTANCE.getTable(trId, new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error retrieving table: " - + caught.getMessage()); - UtilsGXT3.alert("Error retrieving table",caught.getMessage()); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving table: " + + caught.getMessage()); + UtilsGXT3.alert("Error retrieving table", + caught.getMessage()); + } } public void onSuccess(TableData result) { - Log.debug("Retrieved table: "+result.toString()); - table=result; + Log.debug("Retrieved table: " + result.toString()); + table = result; setCurrentType(); - + } }); } - - - + public void update(TRId trId) { this.trId = trId; load(); } - - + } - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/CloneTabularResource.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/CloneTabularResource.java index bcd87ae..0858af5 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/CloneTabularResource.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/CloneTabularResource.java @@ -1,11 +1,14 @@ package org.gcube.portlets.user.td.tablewidget.client; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.clone.CloneTabularResourceSession; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -34,24 +37,29 @@ public class CloneTabularResource { cloneTabularResourceSession, new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Clone Error: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error Cloning Tabular Resource", - "Error in clone operation!"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("Clone Error: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error Cloning Tabular Resource", + "Error in clone operation!"); + } } public void onSuccess(TRId result) { - Log.info("TR Clone:"+result); - final ChangeTableRequestEvent event=new ChangeTableRequestEvent(ChangeTableRequestType.CLONETABULARRESOURCE,result,ChangeTableWhy.TABLEUPDATED); + Log.info("TR Clone:" + result); + final ChangeTableRequestEvent event = new ChangeTableRequestEvent( + ChangeTableRequestType.CLONETABULARRESOURCE, + result, ChangeTableWhy.TABLEUPDATED); eventBus.fireEvent(event); - UtilsGXT3.info("Clone", "Clone Tabular Resource Succed"); + UtilsGXT3 + .info("Clone", "Clone Tabular Resource Succed"); } }); } - - } 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 b79cedf..1633d73 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 @@ -1,9 +1,12 @@ package org.gcube.portlets.user.td.tablewidget.client.history; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.tablewidget.client.progress.RollBackProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -26,11 +29,15 @@ public class HistoryDiscard { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error retrieving trId: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrieving current tabular resource id"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving trId: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving current tabular resource id"); + } } public void onSuccess(TRId result) { @@ -47,10 +54,15 @@ public class HistoryDiscard { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error in discard: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error in discard", "Error in discard"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error in discard: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error in discard", + "Error in discard"); + } } public void onSuccess(RollBackSession result) { diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java index 3f02cd0..d9c5205 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; @@ -12,6 +13,8 @@ import org.gcube.portlets.user.td.tablewidget.client.progress.RollBackProgressDi import org.gcube.portlets.user.td.tablewidget.client.properties.OpHistoryProperties; import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -120,8 +123,8 @@ public class HistoryPanel extends FramedPanel { @Override public void render(Context context, String value, SafeHtmlBuilder sb) { - sb.appendHtmlConstant("" - + value + ""); + sb.appendHtmlConstant("" + value + + ""); } @@ -132,8 +135,6 @@ public class HistoryPanel extends FramedPanel { ColumnConfig rollBackColumn = new ColumnConfig( props.date(), 40, "Undo"); - - ActionButtonCellNoFirst button = new ActionButtonCellNoFirst(); button.setIcon(ResourceBundle.INSTANCE.undo()); @@ -150,9 +151,7 @@ public class HistoryPanel extends FramedPanel { }); rollBackColumn.setCell(button); - - - + List> l = new ArrayList>(); l.add(expander); l.add(nameCol); @@ -219,7 +218,7 @@ public class HistoryPanel extends FramedPanel { protected void startSearchRollBackId(int rowIndex) { currentRowIndex = rowIndex; - currentOpHistory = store.get(rowIndex-1); + currentOpHistory = store.get(rowIndex - 1); Log.debug(currentOpHistory.toString() + " was clicked.[rowIndex=" + currentRowIndex + " ]"); callRollBack(); @@ -233,11 +232,15 @@ public class HistoryPanel extends FramedPanel { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error in rollback: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error in rollback", - "Error in rollback"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error in rollback: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error in rollback", + "Error in rollback"); + } } public void onSuccess(Void result) { @@ -262,10 +265,15 @@ public class HistoryPanel extends FramedPanel { new AsyncCallback>() { public void onFailure(Throwable caught) { - Log.error("Error Retrieving History: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error retrieving history", - "Error retrieving history"); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error Retrieving History: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error retrieving history", + "Error retrieving history"); + } callback.onFailure(caught); } @@ -288,11 +296,15 @@ public class HistoryPanel extends FramedPanel { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error retrieving current TRId: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrieving current tabular resource id"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving current TRId: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving current tabular resource id"); + } } public void onSuccess(TRId result) { diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/ChangeTableTypeProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/ChangeTableTypeProgressDialog.java index 020edc5..1ea39e9 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/ChangeTableTypeProgressDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/ChangeTableTypeProgressDialog.java @@ -1,10 +1,13 @@ package org.gcube.portlets.user.td.tablewidget.client.progress; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -19,125 +22,130 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; - - /** - * LabelColumnProgressDialog is a Dialog that show progress of change the column label + * LabelColumnProgressDialog is a Dialog that show progress of change the column + * label + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * */ -public class ChangeTableTypeProgressDialog extends Window implements ChangeTableTypeProgressListener { - public static final int STATUS_POLLING_DELAY = 1000; - protected String WIDTH = "400px"; - protected String HEIGHT = "120px"; - protected ChangeTableTypeSession changeTableTypeSession; - protected EventBus eventBus; - protected ChangeTableTypeProgressUpdater progressUpdater; - protected TextButton ok; - protected TRId trId; - private ChangeTableWhy why; - - public ChangeTableTypeProgressDialog(ChangeTableTypeSession changeTableTypeSession, EventBus eventBus) { - this.changeTableTypeSession=changeTableTypeSession; - this.eventBus=eventBus; - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(true); - setModal(true); - setHeadingText("Change The Table Type Progress"); - - trId=null; - - FramedPanel panel=new FramedPanel(); - panel.setHeaderVisible(false); - panel.setBodyBorder(false); - - VerticalLayoutContainer v = new VerticalLayoutContainer(); - - - ProgressBar progressBar = new ProgressBar(); - - ok=new TextButton("OK"); - ok.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - updateInvocation(); - - } - }); - - v.add(progressBar, new VerticalLayoutData(1, - 1, new Margins(5, 5, 5, 5))); - - panel.add(v); - panel.addButton(ok); - add(panel); - - - progressUpdater = new ChangeTableTypeProgressUpdater(); - progressUpdater.addListener(new ChangeTableTypeProgressBarUpdater(progressBar)); +public class ChangeTableTypeProgressDialog extends Window implements + ChangeTableTypeProgressListener { + public static final int STATUS_POLLING_DELAY = 1000; + protected String WIDTH = "400px"; + protected String HEIGHT = "120px"; + protected ChangeTableTypeSession changeTableTypeSession; + protected EventBus eventBus; + protected ChangeTableTypeProgressUpdater progressUpdater; + protected TextButton ok; + protected TRId trId; + private ChangeTableWhy why; - progressUpdater.addListener(this); - progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); - show(); - ok.setVisible(false); - - } + public ChangeTableTypeProgressDialog( + ChangeTableTypeSession changeTableTypeSession, EventBus eventBus) { + this.changeTableTypeSession = changeTableTypeSession; + this.eventBus = eventBus; + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(true); + setModal(true); + setHeadingText("Change The Table Type Progress"); - public void operationInitializing() { - // TODO Auto-generated method stub - - } + trId = null; - public void operationUpdate(float elaborated) { - // TODO Auto-generated method stub - - } + FramedPanel panel = new FramedPanel(); + panel.setHeaderVisible(false); + panel.setBodyBorder(false); - public void operationComplete(TRId trId) { - Log.debug("Operation Complete return: "+trId.toString()); - this.trId=trId; - why=ChangeTableWhy.TABLEUPDATED; - updateInvocation(); - } + VerticalLayoutContainer v = new VerticalLayoutContainer(); + + ProgressBar progressBar = new ProgressBar(); + + ok = new TextButton("OK"); + ok.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + updateInvocation(); - public void operationFailed(Throwable caught, String reason, - String failureDetails) { - ok.setVisible(true); - this.trId=null; - UtilsGXT3.alert("Error Changing The Table Type", reason); - - } - - public void updateInvocation(){ - if(trId!=null){ - ChangeTableRequestEvent changeTableRequestEvent= - new ChangeTableRequestEvent(ChangeTableRequestType.CHANGETABLETYPE, trId,why); - eventBus.fireEvent(changeTableRequestEvent); } - hide(); - } + }); - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); + v.add(progressBar, + new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5))); + + panel.add(v); + panel.addButton(ok); + add(panel); + + progressUpdater = new ChangeTableTypeProgressUpdater(); + progressUpdater.addListener(new ChangeTableTypeProgressBarUpdater( + progressBar)); + + progressUpdater.addListener(this); + progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); + show(); + ok.setVisible(false); + + } + + public void operationInitializing() { + // TODO Auto-generated method stub + + } + + public void operationUpdate(float elaborated) { + // TODO Auto-generated method stub + + } + + public void operationComplete(TRId trId) { + Log.debug("Operation Complete return: " + trId.toString()); + this.trId = trId; + why = ChangeTableWhy.TABLEUPDATED; + updateInvocation(); + } + + public void operationFailed(Throwable caught, String reason, + String failureDetails) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { ok.setVisible(true); - this.trId=trId; - why=ChangeTableWhy.TABLECURATION; + this.trId = null; + UtilsGXT3.alert("Error Changing The Table Type", reason); } + } - @Override - public void operationGeneratingView() { - // TODO Auto-generated method stub - + public void updateInvocation() { + if (trId != null) { + ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( + ChangeTableRequestType.CHANGETABLETYPE, trId, why); + eventBus.fireEvent(changeTableRequestEvent); } + hide(); + } - @Override - public void operationValidate(float elaborated) { - // TODO Auto-generated method stub - - } + @Override + public void operationStopped(TRId trId, String reason, String details) { + Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason + + ", " + details + "]"); + ok.setVisible(true); + this.trId = trId; + why = ChangeTableWhy.TABLECURATION; + } + + @Override + public void operationGeneratingView() { + // TODO Auto-generated method stub + + } + + @Override + public void operationValidate(float elaborated) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DeleteRowsProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DeleteRowsProgressDialog.java index b7e08c4..1eb16d4 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DeleteRowsProgressDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DeleteRowsProgressDialog.java @@ -1,10 +1,13 @@ package org.gcube.portlets.user.td.tablewidget.client.progress; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -19,126 +22,131 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; - - /** - * LabelColumnProgressDialog is a Dialog that show progress of change the column label + * LabelColumnProgressDialog is a Dialog that show progress of change the column + * label + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * */ -public class DeleteRowsProgressDialog extends Window implements DeleteRowsProgressListener { - public static final int STATUS_POLLING_DELAY = 1000; - protected String WIDTH = "400px"; - protected String HEIGHT = "120px"; - protected DeleteRowsSession deleteRowsSession; - protected EventBus eventBus; - protected DeleteRowsProgressUpdater progressUpdater; - protected TextButton ok; - protected TRId trId; - private ChangeTableWhy why; - - public DeleteRowsProgressDialog(DeleteRowsSession deleteRowsSession, EventBus eventBus) { - this.deleteRowsSession=deleteRowsSession; - this.eventBus=eventBus; - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(true); - setModal(true); - setHeadingText("Delete Rows Progress"); - - trId=null; - - FramedPanel panel=new FramedPanel(); - panel.setHeaderVisible(false); - panel.setBodyBorder(false); - - VerticalLayoutContainer v = new VerticalLayoutContainer(); - - - ProgressBar progressBar = new ProgressBar(); - - ok=new TextButton("OK"); - ok.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - updateInvocation(); - - } - }); - - v.add(progressBar, new VerticalLayoutData(1, - 1, new Margins(5, 5, 5, 5))); - - panel.add(v); - panel.addButton(ok); - add(panel); - - - progressUpdater = new DeleteRowsProgressUpdater(); - progressUpdater.addListener(new DeleteRowsProgressBarUpdater(progressBar)); +public class DeleteRowsProgressDialog extends Window implements + DeleteRowsProgressListener { + public static final int STATUS_POLLING_DELAY = 1000; + protected String WIDTH = "400px"; + protected String HEIGHT = "120px"; + protected DeleteRowsSession deleteRowsSession; + protected EventBus eventBus; + protected DeleteRowsProgressUpdater progressUpdater; + protected TextButton ok; + protected TRId trId; + private ChangeTableWhy why; - progressUpdater.addListener(this); - progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); - show(); - ok.setVisible(false); - - } + public DeleteRowsProgressDialog(DeleteRowsSession deleteRowsSession, + EventBus eventBus) { + this.deleteRowsSession = deleteRowsSession; + this.eventBus = eventBus; + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(true); + setModal(true); + setHeadingText("Delete Rows Progress"); - public void operationInitializing() { - // TODO Auto-generated method stub - - } + trId = null; - public void operationUpdate(float elaborated) { - // TODO Auto-generated method stub - - } + FramedPanel panel = new FramedPanel(); + panel.setHeaderVisible(false); + panel.setBodyBorder(false); - public void operationComplete(TRId trId) { - Log.debug("Operation Complete return: "+trId.toString()); - this.trId=trId; - why=ChangeTableWhy.TABLEUPDATED; - updateInvocation(); - - } + VerticalLayoutContainer v = new VerticalLayoutContainer(); + + ProgressBar progressBar = new ProgressBar(); + + ok = new TextButton("OK"); + ok.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + updateInvocation(); - public void operationFailed(Throwable caught, String reason, - String failureDetails) { - ok.setVisible(true); - this.trId=null; - UtilsGXT3.alert("Error Deleting Rows", reason); - - } - - public void updateInvocation(){ - if(trId!=null){ - ChangeTableRequestEvent changeTableRequestEvent= - new ChangeTableRequestEvent(ChangeTableRequestType.DELETEROWS, trId, why); - eventBus.fireEvent(changeTableRequestEvent); } - hide(); - } + }); - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); + v.add(progressBar, + new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5))); + + panel.add(v); + panel.addButton(ok); + add(panel); + + progressUpdater = new DeleteRowsProgressUpdater(); + progressUpdater.addListener(new DeleteRowsProgressBarUpdater( + progressBar)); + + progressUpdater.addListener(this); + progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); + show(); + ok.setVisible(false); + + } + + public void operationInitializing() { + // TODO Auto-generated method stub + + } + + public void operationUpdate(float elaborated) { + // TODO Auto-generated method stub + + } + + public void operationComplete(TRId trId) { + Log.debug("Operation Complete return: " + trId.toString()); + this.trId = trId; + why = ChangeTableWhy.TABLEUPDATED; + updateInvocation(); + + } + + public void operationFailed(Throwable caught, String reason, + String failureDetails) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { ok.setVisible(true); - this.trId=trId; - why=ChangeTableWhy.TABLECURATION; + this.trId = null; + UtilsGXT3.alert("Error Deleting Rows", reason); } + } - @Override - public void operationGeneratingView() { - // TODO Auto-generated method stub - + public void updateInvocation() { + if (trId != null) { + ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( + ChangeTableRequestType.DELETEROWS, trId, why); + eventBus.fireEvent(changeTableRequestEvent); } + hide(); + } - @Override - public void operationValidate(float elaborated) { - // TODO Auto-generated method stub - - } + @Override + public void operationStopped(TRId trId, String reason, String details) { + Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason + + ", " + details + "]"); + ok.setVisible(true); + this.trId = trId; + why = ChangeTableWhy.TABLECURATION; + } + + @Override + public void operationGeneratingView() { + // TODO Auto-generated method stub + + } + + @Override + public void operationValidate(float elaborated) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DuplicatesRowsProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DuplicatesRowsProgressDialog.java index c6951a0..9c4974b 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DuplicatesRowsProgressDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/DuplicatesRowsProgressDialog.java @@ -1,10 +1,13 @@ package org.gcube.portlets.user.td.tablewidget.client.progress; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -19,124 +22,130 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; - - /** - * LabelColumnProgressDialog is a Dialog that show progress of change the column label + * LabelColumnProgressDialog is a Dialog that show progress of change the column + * label + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * */ -public class DuplicatesRowsProgressDialog extends Window implements DuplicatesRowsProgressListener { - public static final int STATUS_POLLING_DELAY = 1000; - protected String WIDTH = "400px"; - protected String HEIGHT = "120px"; - protected DuplicatesSession duplicatesSession; - protected EventBus eventBus; - protected DuplicatesRowsProgressUpdater progressUpdater; - protected TextButton ok; - protected TRId trId; - private ChangeTableWhy why; - - public DuplicatesRowsProgressDialog(DuplicatesSession duplicatesSession, EventBus eventBus) { - this.duplicatesSession=duplicatesSession; - this.eventBus=eventBus; - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(true); - setModal(true); - setHeadingText("Duplicates Rows Progress"); - - trId=null; - - FramedPanel panel=new FramedPanel(); - panel.setHeaderVisible(false); - panel.setBodyBorder(false); - - VerticalLayoutContainer v = new VerticalLayoutContainer(); - - - ProgressBar progressBar = new ProgressBar(); - - ok=new TextButton("OK"); - ok.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - updateInvocation(); - - } - }); - - v.add(progressBar, new VerticalLayoutData(1, - 1, new Margins(5, 5, 5, 5))); - - panel.add(v); - panel.addButton(ok); - add(panel); - - - progressUpdater = new DuplicatesRowsProgressUpdater(); - progressUpdater.addListener(new DuplicatesRowsProgressBarUpdater(progressBar)); +public class DuplicatesRowsProgressDialog extends Window implements + DuplicatesRowsProgressListener { + public static final int STATUS_POLLING_DELAY = 1000; + protected String WIDTH = "400px"; + protected String HEIGHT = "120px"; + protected DuplicatesSession duplicatesSession; + protected EventBus eventBus; + protected DuplicatesRowsProgressUpdater progressUpdater; + protected TextButton ok; + protected TRId trId; + private ChangeTableWhy why; - progressUpdater.addListener(this); - progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); - show(); - ok.setVisible(false); - - } + public DuplicatesRowsProgressDialog(DuplicatesSession duplicatesSession, + EventBus eventBus) { + this.duplicatesSession = duplicatesSession; + this.eventBus = eventBus; + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(true); + setModal(true); + setHeadingText("Duplicates Rows Progress"); - public void operationInitializing() { - // TODO Auto-generated method stub - - } + trId = null; - public void operationUpdate(float elaborated) { - // TODO Auto-generated method stub - - } + FramedPanel panel = new FramedPanel(); + panel.setHeaderVisible(false); + panel.setBodyBorder(false); - public void operationComplete(TRId trId) { - Log.debug("Operation Complete return: "+trId.toString()); - this.trId=trId; - why=ChangeTableWhy.TABLEUPDATED; - updateInvocation(); - } + VerticalLayoutContainer v = new VerticalLayoutContainer(); - public void operationFailed(Throwable caught, String reason, - String failureDetails) { + ProgressBar progressBar = new ProgressBar(); + + ok = new TextButton("OK"); + ok.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + updateInvocation(); + + } + }); + + v.add(progressBar, + new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5))); + + panel.add(v); + panel.addButton(ok); + add(panel); + + progressUpdater = new DuplicatesRowsProgressUpdater(); + progressUpdater.addListener(new DuplicatesRowsProgressBarUpdater( + progressBar)); + + progressUpdater.addListener(this); + progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); + show(); + ok.setVisible(false); + + } + + public void operationInitializing() { + // TODO Auto-generated method stub + + } + + public void operationUpdate(float elaborated) { + // TODO Auto-generated method stub + + } + + public void operationComplete(TRId trId) { + Log.debug("Operation Complete return: " + trId.toString()); + this.trId = trId; + why = ChangeTableWhy.TABLEUPDATED; + updateInvocation(); + } + + public void operationFailed(Throwable caught, String reason, + String failureDetails) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { ok.setVisible(true); - this.trId=null; + this.trId = null; UtilsGXT3.alert("Error Deleting Rows", reason); } - - public void updateInvocation(){ - if(trId!=null){ - ChangeTableRequestEvent changeTableRequestEvent= - new ChangeTableRequestEvent(ChangeTableRequestType.DUPLICATES, trId,why); - eventBus.fireEvent(changeTableRequestEvent); - } - hide(); - } + } - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); - ok.setVisible(true); - this.trId=trId; - why=ChangeTableWhy.TABLECURATION; + public void updateInvocation() { + if (trId != null) { + ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( + ChangeTableRequestType.DUPLICATES, trId, why); + eventBus.fireEvent(changeTableRequestEvent); } + hide(); + } - @Override - public void operationGeneratingView() { - // TODO Auto-generated method stub - - } + @Override + public void operationStopped(TRId trId, String reason, String details) { + Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason + + ", " + details + "]"); + ok.setVisible(true); + this.trId = trId; + why = ChangeTableWhy.TABLECURATION; + } - @Override - public void operationValidate(float elaborated) { - // TODO Auto-generated method stub - - } + @Override + public void operationGeneratingView() { + // TODO Auto-generated method stub + + } + + @Override + public void operationValidate(float elaborated) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/EditRowProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/EditRowProgressDialog.java index cb06e84..a4bd83c 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/EditRowProgressDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/EditRowProgressDialog.java @@ -1,10 +1,13 @@ package org.gcube.portlets.user.td.tablewidget.client.progress; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.tablewidget.client.rows.EditRowPanel; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -20,123 +23,127 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; /** - * * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ -public class EditRowProgressDialog extends Window implements EditRowProgressListener { - public static final int STATUS_POLLING_DELAY = 1000; - protected String WIDTH = "400px"; - protected String HEIGHT = "120px"; - protected EditRowPanel parent; - protected EventBus eventBus; - protected EditRowProgressUpdater progressUpdater; - protected TextButton ok; - protected TRId trId; - private ChangeTableWhy why; - - public EditRowProgressDialog(EditRowPanel editRowPanel, EventBus eventBus) { - this.parent=editRowPanel; - this.eventBus=eventBus; - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(true); - setModal(true); - setHeadingText("Rollback Progress"); - - trId=null; - - FramedPanel panel=new FramedPanel(); - panel.setHeaderVisible(false); - panel.setBodyBorder(false); - - VerticalLayoutContainer v = new VerticalLayoutContainer(); - - - ProgressBar progressBar = new ProgressBar(); - - ok=new TextButton("OK"); - ok.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - updateInvocation(); - - } - }); - - v.add(progressBar, new VerticalLayoutData(1, - 1, new Margins(5, 5, 5, 5))); - - panel.add(v); - panel.addButton(ok); - add(panel); - - - progressUpdater = new EditRowProgressUpdater(); - progressUpdater.addListener(new EditRowProgressBarUpdater(progressBar)); +public class EditRowProgressDialog extends Window implements + EditRowProgressListener { + public static final int STATUS_POLLING_DELAY = 1000; + protected String WIDTH = "400px"; + protected String HEIGHT = "120px"; + protected EditRowPanel parent; + protected EventBus eventBus; + protected EditRowProgressUpdater progressUpdater; + protected TextButton ok; + protected TRId trId; + private ChangeTableWhy why; - progressUpdater.addListener(this); - progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); - show(); - ok.setVisible(false); - - } + public EditRowProgressDialog(EditRowPanel editRowPanel, EventBus eventBus) { + this.parent = editRowPanel; + this.eventBus = eventBus; + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(true); + setModal(true); + setHeadingText("Rollback Progress"); - public void operationInitializing() { - // TODO Auto-generated method stub - - } + trId = null; - public void operationUpdate(float elaborated) { - // TODO Auto-generated method stub - - } + FramedPanel panel = new FramedPanel(); + panel.setHeaderVisible(false); + panel.setBodyBorder(false); - public void operationComplete(TRId trId) { - Log.debug("Operation Complete return: "+trId.toString()); - this.trId=trId; - why=ChangeTableWhy.TABLEUPDATED; - updateInvocation(); - } + VerticalLayoutContainer v = new VerticalLayoutContainer(); + + ProgressBar progressBar = new ProgressBar(); + + ok = new TextButton("OK"); + ok.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + updateInvocation(); - public void operationFailed(Throwable caught, String reason, - String failureDetails) { - ok.setVisible(true); - this.trId=null; - UtilsGXT3.alert("Error", reason); - - } - - public void updateInvocation(){ - if(trId!=null){ - ChangeTableRequestEvent changeTableRequestEvent= - new ChangeTableRequestEvent(ChangeTableRequestType.EDITROW, trId,why); - eventBus.fireEvent(changeTableRequestEvent); } - parent.close(); - hide(); - } + }); - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); + v.add(progressBar, + new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5))); + + panel.add(v); + panel.addButton(ok); + add(panel); + + progressUpdater = new EditRowProgressUpdater(); + progressUpdater.addListener(new EditRowProgressBarUpdater(progressBar)); + + progressUpdater.addListener(this); + progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); + show(); + ok.setVisible(false); + + } + + public void operationInitializing() { + // TODO Auto-generated method stub + + } + + public void operationUpdate(float elaborated) { + // TODO Auto-generated method stub + + } + + public void operationComplete(TRId trId) { + Log.debug("Operation Complete return: " + trId.toString()); + this.trId = trId; + why = ChangeTableWhy.TABLEUPDATED; + updateInvocation(); + } + + public void operationFailed(Throwable caught, String reason, + String failureDetails) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { ok.setVisible(true); - this.trId=trId; - why=ChangeTableWhy.TABLECURATION; + this.trId = null; + UtilsGXT3.alert("Error", reason); } + } - @Override - public void operationGeneratingView() { - // TODO Auto-generated method stub - + public void updateInvocation() { + if (trId != null) { + ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( + ChangeTableRequestType.EDITROW, trId, why); + eventBus.fireEvent(changeTableRequestEvent); } + parent.close(); + hide(); + } - @Override - public void operationValidate(float elaborated) { - // TODO Auto-generated method stub - - } + @Override + public void operationStopped(TRId trId, String reason, String details) { + Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason + + ", " + details + "]"); + ok.setVisible(true); + this.trId = trId; + why = ChangeTableWhy.TABLECURATION; + } + + @Override + public void operationGeneratingView() { + // TODO Auto-generated method stub + + } + + @Override + public void operationValidate(float elaborated) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/RollBackProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/RollBackProgressDialog.java index d929d8f..67b6e32 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/RollBackProgressDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/progress/RollBackProgressDialog.java @@ -1,10 +1,13 @@ package org.gcube.portlets.user.td.tablewidget.client.progress; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -20,122 +23,128 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; /** - * * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ -public class RollBackProgressDialog extends Window implements RollBackProgressListener { - public static final int STATUS_POLLING_DELAY = 1000; - protected String WIDTH = "400px"; - protected String HEIGHT = "120px"; - protected RollBackSession rollBackSession; - protected EventBus eventBus; - protected RollBackProgressUpdater progressUpdater; - protected TextButton ok; - protected TRId trId; - private ChangeTableWhy why; - - public RollBackProgressDialog(RollBackSession rollBackSession, EventBus eventBus) { - this.rollBackSession=rollBackSession; - this.eventBus=eventBus; - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(true); - setModal(true); - setHeadingText("Rollback Progress"); - - trId=null; - - FramedPanel panel=new FramedPanel(); - panel.setHeaderVisible(false); - panel.setBodyBorder(false); - - VerticalLayoutContainer v = new VerticalLayoutContainer(); - - - ProgressBar progressBar = new ProgressBar(); - - ok=new TextButton("OK"); - ok.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - updateInvocation(); - - } - }); - - v.add(progressBar, new VerticalLayoutData(1, - 1, new Margins(5, 5, 5, 5))); - - panel.add(v); - panel.addButton(ok); - add(panel); - - - progressUpdater = new RollBackProgressUpdater(); - progressUpdater.addListener(new RollBackProgressBarUpdater(progressBar)); +public class RollBackProgressDialog extends Window implements + RollBackProgressListener { + public static final int STATUS_POLLING_DELAY = 1000; + protected String WIDTH = "400px"; + protected String HEIGHT = "120px"; + protected RollBackSession rollBackSession; + protected EventBus eventBus; + protected RollBackProgressUpdater progressUpdater; + protected TextButton ok; + protected TRId trId; + private ChangeTableWhy why; - progressUpdater.addListener(this); - progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); - show(); - ok.setVisible(false); - - } + public RollBackProgressDialog(RollBackSession rollBackSession, + EventBus eventBus) { + this.rollBackSession = rollBackSession; + this.eventBus = eventBus; + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(true); + setModal(true); + setHeadingText("Rollback Progress"); - public void operationInitializing() { - // TODO Auto-generated method stub - - } + trId = null; - public void operationUpdate(float elaborated) { - // TODO Auto-generated method stub - - } + FramedPanel panel = new FramedPanel(); + panel.setHeaderVisible(false); + panel.setBodyBorder(false); - public void operationComplete(TRId trId) { - Log.debug("Operation Complete return: "+trId.toString()); - this.trId=trId; - why=ChangeTableWhy.TABLEUPDATED; - updateInvocation(); - } + VerticalLayoutContainer v = new VerticalLayoutContainer(); + + ProgressBar progressBar = new ProgressBar(); + + ok = new TextButton("OK"); + ok.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + updateInvocation(); - public void operationFailed(Throwable caught, String reason, - String failureDetails) { - ok.setVisible(true); - this.trId=null; - UtilsGXT3.alert("Error in RollBack", reason); - - } - - public void updateInvocation(){ - if(trId!=null){ - ChangeTableRequestEvent changeTableRequestEvent= - new ChangeTableRequestEvent(ChangeTableRequestType.DELETEROWS, trId,why); - eventBus.fireEvent(changeTableRequestEvent); } - hide(); - } + }); - @Override - public void operationStopped(TRId trId,String reason, String details) { - Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); + v.add(progressBar, + new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5))); + + panel.add(v); + panel.addButton(ok); + add(panel); + + progressUpdater = new RollBackProgressUpdater(); + progressUpdater + .addListener(new RollBackProgressBarUpdater(progressBar)); + + progressUpdater.addListener(this); + progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); + show(); + ok.setVisible(false); + + } + + public void operationInitializing() { + // TODO Auto-generated method stub + + } + + public void operationUpdate(float elaborated) { + // TODO Auto-generated method stub + + } + + public void operationComplete(TRId trId) { + Log.debug("Operation Complete return: " + trId.toString()); + this.trId = trId; + why = ChangeTableWhy.TABLEUPDATED; + updateInvocation(); + } + + public void operationFailed(Throwable caught, String reason, + String failureDetails) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { ok.setVisible(true); - this.trId=trId; - why=ChangeTableWhy.TABLECURATION; + this.trId = null; + UtilsGXT3.alert("Error in RollBack", reason); } + } - @Override - public void operationGeneratingView() { - // TODO Auto-generated method stub - + public void updateInvocation() { + if (trId != null) { + ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent( + ChangeTableRequestType.DELETEROWS, trId, why); + eventBus.fireEvent(changeTableRequestEvent); } + hide(); + } - @Override - public void operationValidate(float elaborated) { - // TODO Auto-generated method stub - - } + @Override + public void operationStopped(TRId trId, String reason, String details) { + Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason + + ", " + details + "]"); + ok.setVisible(true); + this.trId = trId; + why = ChangeTableWhy.TABLECURATION; + } + + @Override + public void operationGeneratingView() { + // TODO Auto-generated method stub + + } + + @Override + public void operationValidate(float elaborated) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DeleteRows.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DeleteRows.java index 4e0caca..52313e3 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DeleteRows.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DeleteRows.java @@ -3,9 +3,12 @@ package org.gcube.portlets.user.td.tablewidget.client.rows; import java.util.ArrayList; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.tablewidget.client.progress.DeleteRowsProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -16,46 +19,50 @@ import com.google.web.bindery.event.shared.EventBus; * Delete rows in table * * @author "Giancarlo Panichi" - * + * */ public class DeleteRows { protected TRId trId; protected EventBus eventBus; protected ArrayList rows; protected DeleteRowsSession deleteRowsSession; - protected DeleteRowsProgressDialog deleteRowsProgressDialog; - - public DeleteRows(TRId trId, ArrayList rows,EventBus eventBus) { + protected DeleteRowsProgressDialog deleteRowsProgressDialog; + + public DeleteRows(TRId trId, ArrayList rows, EventBus eventBus) { this.trId = trId; - this.rows=rows; + this.rows = rows; this.eventBus = eventBus; } - - public void delete(){ - deleteRowsSession =new DeleteRowsSession(trId, rows); + + public void delete() { + deleteRowsSession = new DeleteRowsSession(trId, rows); onDelete(); } - - protected void onDelete(){ - TDGWTServiceAsync.INSTANCE.startDeleteRows( - deleteRowsSession, new AsyncCallback() { - public void onFailure(Throwable caught) { + protected void onDelete() { + TDGWTServiceAsync.INSTANCE.startDeleteRows(deleteRowsSession, + new AsyncCallback() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { Log.debug("Delete Rows Error: " + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error Deleting Rows", - "Error in invocation Delete Rows operation!"); - + UtilsGXT3 + .alert("Error Deleting Rows", + "Error in invocation Delete Rows operation!"); } + } - public void onSuccess(Void result) { - deleteRowsProgressDialog= new DeleteRowsProgressDialog(deleteRowsSession, eventBus); - } + public void onSuccess(Void result) { + deleteRowsProgressDialog = new DeleteRowsProgressDialog( + deleteRowsSession, eventBus); + } - }); + }); - } - - + } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DuplicatesRowsPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DuplicatesRowsPanel.java index 820c0d5..0e627a6 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DuplicatesRowsPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/DuplicatesRowsPanel.java @@ -4,11 +4,14 @@ import java.util.ArrayList; import java.util.List; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; import org.gcube.portlets.user.td.tablewidget.client.progress.DuplicatesRowsProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.properties.ColumnDataProperties; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -115,16 +118,16 @@ public class DuplicatesRowsPanel extends FramedPanel { sm.setSelectionMode(SelectionMode.MULTI); grid.setLoader(loader); grid.setSelectionModel(sm); - //grid.getView().setAutoExpandColumn(labelCol); + // grid.getView().setAutoExpandColumn(labelCol); grid.setHeight(360); grid.getView().setStripeRows(true); grid.getView().setColumnLines(true); - grid.getView().setAutoFill(true); + grid.getView().setAutoFill(true); grid.setBorders(false); grid.setLoadMask(true); grid.setColumnReordering(true); grid.setColumnResize(false); - + // Delete Button deleteButton = new TextButton("Delete"); SelectHandler deleteHandler = new SelectHandler() { @@ -146,21 +149,19 @@ public class DuplicatesRowsPanel extends FramedPanel { } }; validatesButton.addSelectHandler(validatesHandler); - FieldLabel columnsLabel = new FieldLabel(null, "Columns"); columnsLabel.getElement().applyStyles("font-weight:bold"); - HBoxLayoutContainer hBox=new HBoxLayoutContainer(); - hBox.add(validatesButton, new BoxLayoutData(new Margins(2,5,2,5))); - hBox.add(deleteButton,new BoxLayoutData(new Margins(2,5,2,5))); - - + HBoxLayoutContainer hBox = new HBoxLayoutContainer(); + hBox.add(validatesButton, new BoxLayoutData(new Margins(2, 5, 2, 5))); + hBox.add(deleteButton, new BoxLayoutData(new Margins(2, 5, 2, 5))); + VerticalLayoutContainer v = new VerticalLayoutContainer(); v.setScrollMode(ScrollMode.AUTO); - v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(2,1,5,1))); + v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(2, 1, 5, + 1))); v.add(grid, new VerticalLayoutData(1, -1, new Margins(0))); - v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, - 10, 0))); + v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); add(v, new VerticalLayoutData(-1, -1, new Margins(0))); } @@ -182,10 +183,15 @@ public class DuplicatesRowsPanel extends FramedPanel { new AsyncCallback>() { public void onFailure(Throwable caught) { - Log.error("load columns failure:" - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error retrieving columns", - "Error retrieving columns"); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("load columns failure:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error retrieving columns", + "Error retrieving columns"); + } callback.onFailure(caught); } @@ -201,10 +207,9 @@ public class DuplicatesRowsPanel extends FramedPanel { } protected void onDeleteDuplicate() { - ArrayList col=getSelectedItems(); - if(col==null||col.size()<1){ - UtilsGXT3.alert("Attention", - "Attention no column selected!"); + ArrayList col = getSelectedItems(); + if (col == null || col.size() < 1) { + UtilsGXT3.alert("Attention", "Attention no column selected!"); return; } duplicatesSession = new DuplicatesSession(trId, col, @@ -214,11 +219,16 @@ public class DuplicatesRowsPanel extends FramedPanel { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Delete Duplicates Error: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error Deleting Rows", - "Error in invocation Delete Duplicates operation!"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("Delete Duplicates Error: " + + caught.getLocalizedMessage()); + UtilsGXT3 + .alert("Error Deleting Rows", + "Error in invocation Delete Duplicates operation!"); + } } public void onSuccess(Void result) { @@ -229,13 +239,11 @@ public class DuplicatesRowsPanel extends FramedPanel { }); } - - + protected void onValidatesDuplicate() { - ArrayList col=getSelectedItems(); - if(col==null||col.size()<1){ - UtilsGXT3.alert("Attention", - "Attention no column selected!"); + ArrayList col = getSelectedItems(); + if (col == null || col.size() < 1) { + UtilsGXT3.alert("Attention", "Attention no column selected!"); return; } duplicatesSession = new DuplicatesSession(trId, col, @@ -245,11 +253,16 @@ public class DuplicatesRowsPanel extends FramedPanel { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Validates Duplicates Error: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error Deleting Rows", - "Error in invocation Validates Duplicates operation!"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("Validates Duplicates Error: " + + caught.getLocalizedMessage()); + UtilsGXT3 + .alert("Error Deleting Rows", + "Error in invocation Validates Duplicates operation!"); + } } public void onSuccess(Void result) { @@ -260,8 +273,5 @@ public class DuplicatesRowsPanel extends FramedPanel { }); } - - - } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java index a828e5d..1d35445 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/rows/EditRowPanel.java @@ -15,6 +15,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; import org.gcube.portlets.user.td.tablewidget.client.progress.EditRowProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.grid.model.RowRaw; @@ -72,9 +74,9 @@ public class EditRowPanel extends FramedPanel { protected ArrayList columns; protected RowRaw rowRaw; protected boolean editRow; - + protected EditRowProgressDialog editRowProgressDialog; - + protected VerticalLayoutContainer v; private TextButton btnSave; private TextButton btnClose; @@ -195,11 +197,15 @@ public class EditRowPanel extends FramedPanel { new AsyncCallback>() { public void onFailure(Throwable caught) { - Log.error("load columns failure:" - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error retrieving columns", - "Error retrieving columns"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("load columns failure:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error retrieving columns", + "Error retrieving columns"); + } } public void onSuccess(ArrayList result) { @@ -587,33 +593,31 @@ public class EditRowPanel extends FramedPanel { parent.close(); } } - - protected void callEditRow(EditRowSession editRowSession) { - final EditRowPanel panel=this; - - TDGWTServiceAsync.INSTANCE.startEditRow(editRowSession,new AsyncCallback() { + final EditRowPanel panel = this; - public void onFailure(Throwable caught) { - Log.debug("EditRow: " - + caught.getLocalizedMessage()); - if(caught instanceof TDGWTSessionExpiredException){ - UtilsGXT3.alert("Attention",caught.getLocalizedMessage()); - } else { - UtilsGXT3.alert("Error", - "Error in operation invocation!"); - } - } + TDGWTServiceAsync.INSTANCE.startEditRow(editRowSession, + new AsyncCallback() { - public void onSuccess(Void result) { - editRowProgressDialog = new EditRowProgressDialog( - panel, eventBus); - } + public void onFailure(Throwable caught) { + Log.debug("EditRow: " + caught.getLocalizedMessage()); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + UtilsGXT3.alert("Error", + "Error in operation invocation!"); + } + } + + public void onSuccess(Void result) { + editRowProgressDialog = new EditRowProgressDialog( + panel, eventBus); + } + + }); - - }); - } } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java index cae787c..0372954 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTablePanel.java @@ -4,12 +4,15 @@ import java.util.ArrayList; import java.util.List; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabValidationsMetadata; import org.gcube.portlets.user.td.tablewidget.client.properties.ValidationsProperties; import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.allen_sauer.gwt.log.client.Log; @@ -54,16 +57,15 @@ public class ValidationsTablePanel extends FramedPanel { protected ListLoader> loader; protected Grid grid; private boolean drawed; - + public ValidationsTablePanel(EventBus eventBus) { super(); this.eventBus = eventBus; forceLayoutOnResize = true; retrieveCurrentTR(); - + } - - + public ValidationsTablePanel(TRId trId, EventBus eventBus) { super(); this.trId = trId; @@ -77,7 +79,7 @@ public class ValidationsTablePanel extends FramedPanel { init(); create(); } - + protected void init() { setWidth(WIDTH); setHeight(HEIGHT); @@ -90,19 +92,18 @@ public class ValidationsTablePanel extends FramedPanel { ColumnConfig descriptionCol = new ColumnConfig( props.description(), 168, "Description"); - + descriptionCol.setCell(new AbstractCell() { @Override public void render(Context context, String value, SafeHtmlBuilder sb) { - sb.appendHtmlConstant("" - + value + ""); + sb.appendHtmlConstant("" + value + + ""); } }); - ColumnConfig validCol = new ColumnConfig( props.valid(), 28, "Valid"); validCol.setCell(new AbstractCell() { @@ -176,7 +177,6 @@ public class ValidationsTablePanel extends FramedPanel { grid.getView().setAutoExpandColumn(descriptionCol); grid.getView().setEmptyText("No validation"); - add(grid, new MarginData(0)); onResize(); @@ -190,11 +190,16 @@ public class ValidationsTablePanel extends FramedPanel { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Load validations metadata failure: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert( - "Error retrieving validations metadata", - "Error retrieving validations metadata"); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Load validations metadata failure: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert( + "Error retrieving validations metadata", + "Error retrieving validations metadata"); + } callback.onFailure(caught); } @@ -218,28 +223,29 @@ public class ValidationsTablePanel extends FramedPanel { } - - public void update() { retrieveCurrentTR(); loader.load(); } - + public void update(TRId trId) { - this.trId=trId; + this.trId = trId; loader.load(); } - protected void retrieveCurrentTR() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error retrieving current TRId: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrieving current tabular resource id"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving current TRId: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving current tabular resource id"); + } } public void onSuccess(TRId result) { @@ -253,6 +259,5 @@ public class ValidationsTablePanel extends FramedPanel { }); } - } diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java index a2aa5dd..941ac28 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/validation/ValidationsTasksPanel.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata; import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3; @@ -11,6 +12,8 @@ import org.gcube.portlets.user.td.tablewidget.client.validation.tree.BaseDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.FolderDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.TreeDataGenerator; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.ValidationDto; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import com.sencha.gxt.widget.core.client.event.CollapseItemEvent.CollapseItemHandler; import com.allen_sauer.gwt.log.client.Log; @@ -108,8 +111,8 @@ public class ValidationsTasksPanel extends FramedPanel { protected void create() { con = new VerticalLayoutContainer(); con.setScrollMode(ScrollMode.AUTO); - //con.setAdjustForScroll(true); - + // con.setAdjustForScroll(true); + store = new TreeStore(new KeyProvider()); FolderDto root = gen.getRoot(); @@ -149,7 +152,7 @@ public class ValidationsTasksPanel extends FramedPanel { * @Override public String getPath() { return "description"; } }); * cc2.setHeader("Description"); */ - + ColumnConfig cc3 = new ColumnConfig( new ValueProvider() { @@ -213,8 +216,7 @@ public class ValidationsTasksPanel extends FramedPanel { tree.setLoadMask(true); tree.setColumnResize(true); tree.getView().setAutoExpandColumn(cc1); - - + IconProvider iconProvider = new IconProvider() { @Override @@ -238,26 +240,25 @@ public class ValidationsTasksPanel extends FramedPanel { } }; tree.setIconProvider(iconProvider); - + tree.addExpandHandler(new ExpandItemHandler() { @Override public void onExpand(ExpandItemEvent event) { forceLayout(); - + } }); - + tree.addCollapseHandler(new CollapseItemHandler() { @Override public void onCollapse(CollapseItemEvent event) { forceLayout(); - + } }); - - + ToolBar toolBar = new ToolBar(); TextButton btnExpandAll = new TextButton(); @@ -273,8 +274,7 @@ public class ValidationsTasksPanel extends FramedPanel { } }); toolBar.add(btnExpandAll); - - + TextButton btnCollapseAll = new TextButton(); // btnReload.setText("Expand All"); btnCollapseAll.setIcon(ResourceBundle.INSTANCE.expandAll12()); @@ -288,16 +288,12 @@ public class ValidationsTasksPanel extends FramedPanel { } }); toolBar.add(btnCollapseAll); - - - + con.add(toolBar, new VerticalLayoutData(1, -1)); con.add(tree, new VerticalLayoutData(1, -1)); - - add(con,new MarginData(0)); - - - + + add(con, new MarginData(0)); + } protected void retrieveValidations() { @@ -306,12 +302,16 @@ public class ValidationsTasksPanel extends FramedPanel { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Load validations metadata failure: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert( - "Error retrieving validations metadata", - "Error retrieving validations metadata"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Load validations metadata failure: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert( + "Error retrieving validations metadata", + "Error retrieving validations metadata"); + } } public void onSuccess(ValidationsTasksMetadata result) { @@ -338,11 +338,15 @@ public class ValidationsTasksPanel extends FramedPanel { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() { public void onFailure(Throwable caught) { - Log.error("Error retrieving current TRId: " - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error", - "Error retrieving current tabular resource id"); - + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving current TRId: " + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving current tabular resource id"); + } } public void onSuccess(TRId result) {