diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java index a1c57e7..057d61e 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnExpressionDialog.java @@ -3,8 +3,6 @@ package org.gcube.portlets.user.td.expressionwidget.client; import org.gcube.portlets.user.td.expressionwidget.client.resource.ExpressionResources; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; 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.type.ExpressionType; 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.tr.column.ColumnDataType; @@ -15,6 +13,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.HTML; import com.google.web.bindery.event.shared.EventBus; import com.sencha.gxt.widget.core.client.Window; +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.HideHandler; public class ColumnExpressionDialog extends Window { protected String WIDTH = "650px"; @@ -48,8 +49,8 @@ public class ColumnExpressionDialog extends Window { load(trId, columnName); } - - protected void initWindow(){ + + protected void initWindow() { setWidth(WIDTH); setHeight(HEIGHT); setBodyBorder(false); @@ -80,6 +81,14 @@ public class ColumnExpressionDialog extends Window { HTML errorMessage = new HTML( "This type of column is not supported for now!"); add(errorMessage); + AlertMessageBox d = new AlertMessageBox("Error", + "This type of column is not supported for now!"); + d.addHideHandler(new HideHandler() { + public void onHide(HideEvent event) { + hide(); + } + }); + d.show(); } } @@ -113,8 +122,4 @@ public class ColumnExpressionDialog extends Window { } - - - - } diff --git a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java index b41dfab..a903fe3 100644 --- a/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/expressionwidget/client/ColumnFilterDialog.java @@ -32,9 +32,8 @@ public class ColumnFilterDialog extends Window { private ColumnFilterSession columnFilterSession; private ColumnFilterProgressDialog dialog; - public ColumnFilterDialog(String columnId, - ColumnTypeCode columnTypeCode, ColumnDataType dataTypeName, - EventBus eventBus) { + public ColumnFilterDialog(String columnId, ColumnTypeCode columnTypeCode, + ColumnDataType dataTypeName, EventBus eventBus) { initWindow(); this.eventBus = eventBus; column = new ColumnData(); @@ -45,8 +44,7 @@ public class ColumnFilterDialog extends Window { } - public ColumnFilterDialog(TRId trId, String columnName, - EventBus eventBus) { + public ColumnFilterDialog(TRId trId, String columnName, EventBus eventBus) { initWindow(); this.eventBus = eventBus; this.trId = trId; @@ -54,8 +52,8 @@ public class ColumnFilterDialog extends Window { load(trId, columnName); } - - protected void initWindow(){ + + protected void initWindow() { setWidth(WIDTH); setHeight(HEIGHT); setBodyBorder(false); @@ -79,18 +77,27 @@ public class ColumnFilterDialog extends Window { ColumnTypeCode.CODENAME.toString()) == 0 || column.getTypeCode().compareTo( ColumnTypeCode.MEASURE.toString()) == 0) { - columnExpressionPanel = new ColumnExpressionPanel(this, column, eventBus); + columnExpressionPanel = new ColumnExpressionPanel(this, column, + eventBus); add(columnExpressionPanel); - if(columnExpressionPanel.getBtnSave()!=null){ + if (columnExpressionPanel.getBtnSave() != null) { columnExpressionPanel.getBtnSave().setVisible(false); } - if(columnExpressionPanel.getBtnSearch()!=null){ + if (columnExpressionPanel.getBtnSearch() != null) { columnExpressionPanel.getBtnSearch().setVisible(false); } } else { HTML errorMessage = new HTML( "This type of column is not supported for now!"); add(errorMessage); + AlertMessageBox d = new AlertMessageBox("Error", + "This type of column is not supported for now!"); + d.addHideHandler(new HideHandler() { + public void onHide(HideEvent event) { + hide(); + } + }); + d.show(); } } @@ -102,18 +109,15 @@ public class ColumnFilterDialog extends Window { Log.debug("New Expression set:" + exp.toString()); this.exp = exp; } - - protected void applyFilter(C_Expression exp){ - this.exp=exp; + + protected void applyFilter(C_Expression exp) { + this.exp = exp; callApplyFilter(); } - - - protected void close(){ - - } - + protected void close() { + + } protected void load(TRId trId, String columnName) { TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName, @@ -122,9 +126,10 @@ public class ColumnFilterDialog extends Window { public void onFailure(Throwable caught) { Log.error("Error retrieving column: " + caught.getMessage()); - AlertMessageBox d = new AlertMessageBox("Error retrieving column", caught.getMessage()); + AlertMessageBox d = new AlertMessageBox( + "Error retrieving column", caught.getMessage()); d.addHideHandler(new HideHandler() { - public void onHide(HideEvent event) { + public void onHide(HideEvent event) { hide(); } }); @@ -141,42 +146,39 @@ public class ColumnFilterDialog extends Window { } - - - protected void callApplyFilter() { - columnFilterSession= new ColumnFilterSession(column,exp); - ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession, new AsyncCallback() { - - @Override - public void onSuccess(Void result) { - Log.debug("Submitted column filter"); - callColumnFilterProgressDialog(); - } - - @Override - public void onFailure(Throwable caught) { - Log.error("Error submitting the column filter: " - + caught.getMessage()); - AlertMessageBox d = new AlertMessageBox("Error submitting the column filter", caught.getMessage()); - d.addHideHandler(new HideHandler() { - public void onHide(HideEvent event) { - hide(); + columnFilterSession = new ColumnFilterSession(column, exp); + ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession, + new AsyncCallback() { + + @Override + public void onSuccess(Void result) { + Log.debug("Submitted column filter"); + callColumnFilterProgressDialog(); + } + + @Override + public void onFailure(Throwable caught) { + Log.error("Error submitting the column filter: " + + caught.getMessage()); + AlertMessageBox d = new AlertMessageBox( + "Error submitting the column filter", caught + .getMessage()); + d.addHideHandler(new HideHandler() { + public void onHide(HideEvent event) { + hide(); + } + }); + d.show(); + } }); - d.show(); - - } - }); - - + } - - protected void callColumnFilterProgressDialog(){ - dialog=new ColumnFilterProgressDialog(this,eventBus); + + protected void callColumnFilterProgressDialog() { + dialog = new ColumnFilterProgressDialog(this, eventBus); dialog.show(); } - - }