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) {
if (caught instanceof TDGWTSessionExpiredException) {
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: " Log.error("Error retrieving column: "
+ caught.getMessage()); + 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,11 +139,23 @@ public class ColumnFilterDialog extends Window implements MonitorDialogListener
new AsyncCallback<ColumnData>() { new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
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: " Log.error("Error retrieving column: "
+ caught.getMessage()); + caught.getMessage());
UtilsGXT3.alert("Error retrieving column", UtilsGXT3.alert("Error retrieving column",
caught.getMessage()); caught.getMessage());
} }
}
}
public void onSuccess(ColumnData result) { public void onSuccess(ColumnData result) {
Log.debug("Retrived column: " + result); Log.debug("Retrived column: " + result);
@ -179,14 +193,26 @@ public class ColumnFilterDialog extends Window implements MonitorDialogListener
if (caught instanceof TDGWTSessionExpiredException) { if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else { } else {
Log.error("Error submitting the column filter: " Log.error("Error submitting the column filter: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
caught.printStackTrace(); caught.printStackTrace();
UtilsGXT3.alert( UtilsGXT3
"Error submitting the column filter", .alert("Error submitting the column filter",
caught.getLocalizedMessage()); 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,17 +16,14 @@ 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 {
@ -36,27 +37,27 @@ public class MultiColumnFilterPanel extends SimplePanel {
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() {
@ -67,33 +68,34 @@ public class MultiColumnFilterPanel extends SimplePanel {
} }
}); });
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) {
if (caught instanceof TDGWTSessionExpiredException) {
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 columns: " Log.error("Error retrieving columns: "
+ caught.getMessage()); + caught.getMessage());
AlertMessageBox d = new AlertMessageBox( UtilsGXT3.alert("Error",
"Error retrieving columns", caught.getMessage()); "Error retrieving columns: "+caught.getMessage());
d.addHideHandler(new HideHandler() { }
public void onHide(HideEvent event) {
multiColumnFilterDialog.hide();
} }
});
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,7 +104,7 @@ 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);
@ -166,11 +168,22 @@ public class ReplaceColumnByExpressionDialog extends Window implements
new AsyncCallback<ColumnData>() { new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
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: " Log.error("Error retrieving column: "
+ caught.getMessage()); + caught.getMessage());
UtilsGXT3.alert("Error retrieving column", UtilsGXT3.alert("Error retrieving column",
caught.getMessage()); caught.getMessage());
} }
}
}
public void onSuccess(ColumnData result) { public void onSuccess(ColumnData result) {
Log.debug("Retrived column: " + result); Log.debug("Retrived column: " + result);
@ -209,6 +222,16 @@ public class ReplaceColumnByExpressionDialog extends Window implements
if (caught instanceof TDGWTSessionExpiredException) { if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent( eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else { } else {
Log.error("Error submitting replace column by expression: " Log.error("Error submitting replace column by expression: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
@ -217,6 +240,8 @@ public class ReplaceColumnByExpressionDialog extends Window implements
.alert("Error submitting replace column by expression", .alert("Error submitting replace column by expression",
caught.getLocalizedMessage()); 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();