Fixed Final and Lock error

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@100289 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-30 12:38:31 +00:00
parent b4158cf9a1
commit 11a6c4e54a
5 changed files with 139 additions and 68 deletions

View File

@ -1,10 +1,16 @@
package org.gcube.portlets.user.td.expressionwidget.client; package org.gcube.portlets.user.td.expressionwidget.client;
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources; import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
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.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression; import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
@ -17,8 +23,8 @@ import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox; import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.event.HideEvent; import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/** /**
@ -145,8 +151,21 @@ public class ColumnExpressionDialog extends Window {
new AsyncCallback<ColumnData>() { new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving column: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getMessage()); eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving column: "
+ caught.getMessage());
UtilsGXT3.alert("Error","Error retrieving column: "
+ caught.getMessage());
}
}
} }

View File

@ -4,6 +4,8 @@ import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionRe
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; 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.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
@ -137,10 +139,22 @@ public class ColumnFilterDialog extends Window implements MonitorDialogListener
new AsyncCallback<ColumnData>() { new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving column: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error retrieving column", SessionExpiredType.EXPIREDONSERVER));
caught.getMessage()); } else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving column: "
+ caught.getMessage());
UtilsGXT3.alert("Error retrieving column",
caught.getMessage());
}
}
} }
public void onSuccess(ColumnData result) { public void onSuccess(ColumnData result) {
@ -180,12 +194,24 @@ public class ColumnFilterDialog extends Window implements MonitorDialogListener
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error("Error submitting the column filter: " if (caught instanceof TDGWTIsLockedException) {
+ caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
caught.printStackTrace(); UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert( caught.getLocalizedMessage());
"Error submitting the column filter", } else {
caught.getLocalizedMessage()); if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else {
Log.error("Error submitting the column filter: "
+ caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3
.alert("Error submitting the column filter",
caught.getLocalizedMessage());
}
}
} }
} }

View File

@ -4,7 +4,11 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
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.ColumnData;
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 org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -12,18 +16,15 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.SimplePanel;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.event.BeforeShowEvent; import com.sencha.gxt.widget.core.client.event.BeforeShowEvent;
import com.sencha.gxt.widget.core.client.event.BeforeShowEvent.BeforeShowHandler; import com.sencha.gxt.widget.core.client.event.BeforeShowEvent.BeforeShowHandler;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/** /**
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class MultiColumnFilterPanel extends SimplePanel { public class MultiColumnFilterPanel extends SimplePanel {
protected String WIDTH = "648px"; protected String WIDTH = "648px";
@ -31,69 +32,70 @@ public class MultiColumnFilterPanel extends SimplePanel {
protected TRId trId; protected TRId trId;
protected ArrayList<ColumnData> columns; protected ArrayList<ColumnData> columns;
protected EventBus eventBus; protected EventBus eventBus;
protected MultiColumnFilterDialog multiColumnFilterDialog; protected MultiColumnFilterDialog multiColumnFilterDialog;
public MultiColumnFilterPanel( public MultiColumnFilterPanel(
MultiColumnFilterDialog multiColumnFilterDialog, MultiColumnFilterDialog multiColumnFilterDialog, TRId trId,
TRId trId, EventBus eventBus) { EventBus eventBus) {
super(); super();
Log.debug("Create MultiColumnFilterPanel"); Log.debug("Create MultiColumnFilterPanel");
setHeight(HEIGHT); setHeight(HEIGHT);
setWidth(WIDTH); setWidth(WIDTH);
this.multiColumnFilterDialog=multiColumnFilterDialog; this.multiColumnFilterDialog = multiColumnFilterDialog;
this.trId=trId; this.trId = trId;
this.eventBus = eventBus; this.eventBus = eventBus;
UtilsGXT3.mask(this.getElement()); UtilsGXT3.mask(this.getElement());
load(trId); load(trId);
} }
protected void create() {
protected void create(){
UtilsGXT3.umask(this.getElement()); UtilsGXT3.umask(this.getElement());
VerticalLayoutContainer vl=new VerticalLayoutContainer(); VerticalLayoutContainer vl = new VerticalLayoutContainer();
vl.setBorders(false); vl.setBorders(false);
final MultiColumnFilterTabPanel mcfTabPanel=new MultiColumnFilterTabPanel(this,eventBus); final MultiColumnFilterTabPanel mcfTabPanel = new MultiColumnFilterTabPanel(
this, eventBus);
vl.add(mcfTabPanel); vl.add(mcfTabPanel);
mcfTabPanel.addBeforeShowHandler(new BeforeShowHandler() { mcfTabPanel.addBeforeShowHandler(new BeforeShowHandler() {
public void onBeforeShow(BeforeShowEvent event) { public void onBeforeShow(BeforeShowEvent event) {
mcfTabPanel.forceLayout(); mcfTabPanel.forceLayout();
} }
}); });
final SimplePanel bo=new SimplePanel(); final SimplePanel bo = new SimplePanel();
bo.add(new HTML("Expression")); bo.add(new HTML("Expression"));
vl.add(bo); vl.add(bo);
add(vl); add(vl);
} }
protected void load(TRId trId) { protected void load(TRId trId) {
TDGWTServiceAsync.INSTANCE.getColumns(trId, TDGWTServiceAsync.INSTANCE.getColumns(trId,
new AsyncCallback<ArrayList<ColumnData>>() { new AsyncCallback<ArrayList<ColumnData>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving columns: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getMessage()); eventBus.fireEvent(new SessionExpiredEvent(
AlertMessageBox d = new AlertMessageBox( SessionExpiredType.EXPIREDONSERVER));
"Error retrieving columns", caught.getMessage()); } else {
d.addHideHandler(new HideHandler() { if (caught instanceof TDGWTIsLockedException) {
public void onHide(HideEvent event) { Log.error(caught.getLocalizedMessage());
multiColumnFilterDialog.hide(); UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving columns: "
+ caught.getMessage());
UtilsGXT3.alert("Error",
"Error retrieving columns: "+caught.getMessage());
} }
}); }
d.show();
} }
@Override @Override

View File

@ -4,6 +4,8 @@ import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionRe
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; 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.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
@ -102,12 +104,12 @@ public class ReplaceColumnByExpressionDialog extends Window implements
protected void create() { protected void create() {
if (column != null if (column != null
&& column.getDataTypeName().compareTo( && column.getDataTypeName().compareTo(
ColumnDataType.Text.toString())==0) { ColumnDataType.Text.toString()) == 0) {
setHeight(HEIGHT); setHeight(HEIGHT);
} else { } else {
setHeight(HEIGHT_REDUCE); setHeight(HEIGHT_REDUCE);
} }
if (column.getTypeCode() if (column.getTypeCode()
.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0 .compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0
|| column.getTypeCode().compareTo( || column.getTypeCode().compareTo(
@ -166,10 +168,21 @@ public class ReplaceColumnByExpressionDialog extends Window implements
new AsyncCallback<ColumnData>() { new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving column: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error retrieving column", SessionExpiredType.EXPIREDONSERVER));
caught.getMessage()); } else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving column: "
+ caught.getMessage());
UtilsGXT3.alert("Error retrieving column",
caught.getMessage());
}
}
} }
public void onSuccess(ColumnData result) { public void onSuccess(ColumnData result) {
@ -210,12 +223,24 @@ public class ReplaceColumnByExpressionDialog extends Window implements
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error("Error submitting replace column by expression: " if (caught instanceof TDGWTIsLockedException) {
+ caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
caught.printStackTrace(); UtilsGXT3.alert("Error Locked",
UtilsGXT3 caught.getLocalizedMessage());
.alert("Error submitting replace column by expression", } else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else {
Log.error("Error submitting replace column by expression: "
+ caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3
.alert("Error submitting replace column by expression",
caught.getLocalizedMessage());
}
}
} }
} }

View File

@ -19,7 +19,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.exception.ExpressionSe
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil; import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
import org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl; import org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.FilterColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnByExpressionSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -71,7 +70,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
return taskId; return taskId;
} catch (TDGWTSessionExpiredException e) { } catch (TDGWTServiceException e) {
throw e; throw e;
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
@ -124,7 +123,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
replaceExpression, session); replaceExpression, session);
return taskId; return taskId;
} catch (TDGWTSessionExpiredException e) { } catch (TDGWTServiceException e) {
throw e; throw e;
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
@ -187,7 +186,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
logger.debug("Retrieved TRId basic info:" + newTRId.toString()); logger.debug("Retrieved TRId basic info:" + newTRId.toString());
return newTRId; return newTRId;
} catch (TDGWTSessionExpiredException e) { } catch (TDGWTServiceException e) {
throw e; throw e;
} catch (SecurityException e) { } catch (SecurityException e) {
e.printStackTrace(); e.printStackTrace();