Minor Updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@91851 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-18 14:57:20 +00:00
parent f083213e20
commit 707913be84
2 changed files with 67 additions and 60 deletions

View File

@ -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.expressionwidget.client.resource.ExpressionResources;
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.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.type.ExpressionType;
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;
@ -15,6 +13,9 @@ 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.web.bindery.event.shared.EventBus; 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.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
public class ColumnExpressionDialog extends Window { public class ColumnExpressionDialog extends Window {
protected String WIDTH = "650px"; protected String WIDTH = "650px";
@ -48,8 +49,8 @@ public class ColumnExpressionDialog extends Window {
load(trId, columnName); load(trId, columnName);
} }
protected void initWindow(){ protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
@ -80,6 +81,14 @@ public class ColumnExpressionDialog extends Window {
HTML errorMessage = new HTML( HTML errorMessage = new HTML(
"This type of column is not supported for now!"); "This type of column is not supported for now!");
add(errorMessage); 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 {
} }
} }

View File

@ -32,9 +32,8 @@ public class ColumnFilterDialog extends Window {
private ColumnFilterSession columnFilterSession; private ColumnFilterSession columnFilterSession;
private ColumnFilterProgressDialog dialog; private ColumnFilterProgressDialog dialog;
public ColumnFilterDialog(String columnId, public ColumnFilterDialog(String columnId, ColumnTypeCode columnTypeCode,
ColumnTypeCode columnTypeCode, ColumnDataType dataTypeName, ColumnDataType dataTypeName, EventBus eventBus) {
EventBus eventBus) {
initWindow(); initWindow();
this.eventBus = eventBus; this.eventBus = eventBus;
column = new ColumnData(); column = new ColumnData();
@ -45,8 +44,7 @@ public class ColumnFilterDialog extends Window {
} }
public ColumnFilterDialog(TRId trId, String columnName, public ColumnFilterDialog(TRId trId, String columnName, EventBus eventBus) {
EventBus eventBus) {
initWindow(); initWindow();
this.eventBus = eventBus; this.eventBus = eventBus;
this.trId = trId; this.trId = trId;
@ -54,8 +52,8 @@ public class ColumnFilterDialog extends Window {
load(trId, columnName); load(trId, columnName);
} }
protected void initWindow(){ protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
@ -79,18 +77,27 @@ public class ColumnFilterDialog extends Window {
ColumnTypeCode.CODENAME.toString()) == 0 ColumnTypeCode.CODENAME.toString()) == 0
|| column.getTypeCode().compareTo( || column.getTypeCode().compareTo(
ColumnTypeCode.MEASURE.toString()) == 0) { ColumnTypeCode.MEASURE.toString()) == 0) {
columnExpressionPanel = new ColumnExpressionPanel(this, column, eventBus); columnExpressionPanel = new ColumnExpressionPanel(this, column,
eventBus);
add(columnExpressionPanel); add(columnExpressionPanel);
if(columnExpressionPanel.getBtnSave()!=null){ if (columnExpressionPanel.getBtnSave() != null) {
columnExpressionPanel.getBtnSave().setVisible(false); columnExpressionPanel.getBtnSave().setVisible(false);
} }
if(columnExpressionPanel.getBtnSearch()!=null){ if (columnExpressionPanel.getBtnSearch() != null) {
columnExpressionPanel.getBtnSearch().setVisible(false); columnExpressionPanel.getBtnSearch().setVisible(false);
} }
} else { } else {
HTML errorMessage = new HTML( HTML errorMessage = new HTML(
"This type of column is not supported for now!"); "This type of column is not supported for now!");
add(errorMessage); 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()); Log.debug("New Expression set:" + exp.toString());
this.exp = exp; this.exp = exp;
} }
protected void applyFilter(C_Expression exp){ protected void applyFilter(C_Expression exp) {
this.exp=exp; this.exp = exp;
callApplyFilter(); callApplyFilter();
} }
protected void close(){
}
protected void close() {
}
protected void load(TRId trId, String columnName) { protected void load(TRId trId, String columnName) {
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName, TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
@ -122,9 +126,10 @@ public class ColumnFilterDialog extends Window {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving column: " Log.error("Error retrieving column: "
+ caught.getMessage()); + caught.getMessage());
AlertMessageBox d = new AlertMessageBox("Error retrieving column", caught.getMessage()); AlertMessageBox d = new AlertMessageBox(
"Error retrieving column", caught.getMessage());
d.addHideHandler(new HideHandler() { d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) { public void onHide(HideEvent event) {
hide(); hide();
} }
}); });
@ -141,42 +146,39 @@ public class ColumnFilterDialog extends Window {
} }
protected void callApplyFilter() { protected void callApplyFilter() {
columnFilterSession= new ColumnFilterSession(column,exp); columnFilterSession = new ColumnFilterSession(column, exp);
ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession, new AsyncCallback<Void>() { ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession,
new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) { @Override
Log.debug("Submitted column filter"); public void onSuccess(Void result) {
callColumnFilterProgressDialog(); Log.debug("Submitted column filter");
} callColumnFilterProgressDialog();
}
@Override
public void onFailure(Throwable caught) { @Override
Log.error("Error submitting the column filter: " public void onFailure(Throwable caught) {
+ caught.getMessage()); Log.error("Error submitting the column filter: "
AlertMessageBox d = new AlertMessageBox("Error submitting the column filter", caught.getMessage()); + caught.getMessage());
d.addHideHandler(new HideHandler() { AlertMessageBox d = new AlertMessageBox(
public void onHide(HideEvent event) { "Error submitting the column filter", caught
hide(); .getMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
hide();
}
});
d.show();
} }
}); });
d.show();
}
});
} }
protected void callColumnFilterProgressDialog(){ protected void callColumnFilterProgressDialog() {
dialog=new ColumnFilterProgressDialog(this,eventBus); dialog = new ColumnFilterProgressDialog(this, eventBus);
dialog.show(); dialog.show();
} }
} }