Minor Updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@91844 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-18 14:07:10 +00:00
parent bfe5aed0c7
commit 1754f18670
4 changed files with 74 additions and 6 deletions

View File

@ -206,7 +206,7 @@ public class ColumnExpressionPanel extends FramedPanel {
parentRuleDialog.hide();
eventBus.fireEvent(expressionEvent);
} else {
parentFilterDialog.setExpression(exp);
parentFilterDialog.applyFilter(exp);
}
}

View File

@ -1,6 +1,9 @@
package org.gcube.portlets.user.td.expressionwidget.client;
import org.gcube.portlets.user.td.expressionwidget.client.progress.ColumnFilterProgressDialog;
import org.gcube.portlets.user.td.expressionwidget.client.resource.ExpressionResources;
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
import org.gcube.portlets.user.td.expressionwidget.shared.session.ColumnFilterSession;
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.shared.TRId;
@ -13,6 +16,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 FilterColumnDialog extends Window {
protected String WIDTH = "650px";
@ -23,6 +29,8 @@ public class FilterColumnDialog extends Window {
protected TRId trId;
protected String columnName = null;
protected EventBus eventBus;
private ColumnFilterSession columnFilterSession;
private ColumnFilterProgressDialog dialog;
public FilterColumnDialog(String columnId,
ColumnTypeCode columnTypeCode, ColumnDataType dataTypeName,
@ -72,6 +80,8 @@ public class FilterColumnDialog extends Window {
|| column.getTypeCode().compareTo(
ColumnTypeCode.MEASURE.toString()) == 0) {
columnExpressionPanel = new ColumnExpressionPanel(this, column);
columnExpressionPanel.getBtnSave().setVisible(false);
columnExpressionPanel.getBtnSearch().setVisible(false);
add(columnExpressionPanel);
} else {
HTML errorMessage = new HTML(
@ -87,10 +97,14 @@ public class FilterColumnDialog extends Window {
protected void setExpression(C_Expression exp) {
Log.debug("New Expression set:" + exp.toString());
this.exp = exp;
}
protected void applyFilter(C_Expression exp){
this.exp=exp;
callApplyFilter();
}
protected void close(){
}
@ -104,7 +118,13 @@ public class FilterColumnDialog extends Window {
public void onFailure(Throwable caught) {
Log.error("Error retrieving column: "
+ caught.getMessage());
AlertMessageBox d = new AlertMessageBox("Error retrieving column", caught.getMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
hide();
}
});
d.show();
}
public void onSuccess(ColumnData result) {
@ -119,6 +139,40 @@ public class FilterColumnDialog extends Window {
protected void callApplyFilter() {
columnFilterSession= new ColumnFilterSession(column,exp);
ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession, new AsyncCallback<Void>() {
@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();
}
});
}
protected void callColumnFilterProgressDialog(){
dialog=new ColumnFilterProgressDialog(this,eventBus);
dialog.show();
}
}

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.td.expressionwidget.client.progress;
import org.gcube.portlets.user.td.expressionwidget.client.FilterColumnDialog;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -36,8 +37,10 @@ public class ColumnFilterProgressDialog extends Window implements ColumnFilterPr
protected ColumnFilterProgressUpdater progressUpdater;
protected TextButton ok;
protected TRId trId;
protected FilterColumnDialog dialog;
public ColumnFilterProgressDialog(EventBus eventBus) {
public ColumnFilterProgressDialog(FilterColumnDialog dialog,EventBus eventBus) {
this.dialog=dialog;
this.eventBus=eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
@ -79,7 +82,7 @@ public class ColumnFilterProgressDialog extends Window implements ColumnFilterPr
progressUpdater.addListener(this);
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
show();
ok.setVisible(false);
}
@ -118,6 +121,7 @@ public class ColumnFilterProgressDialog extends Window implements ColumnFilterPr
new ChangeTableRequestEvent(ChangeTableRequestType.COLUMNFILTER, trId);
eventBus.fireEvent(changeTableRequestEvent);
}
dialog.hide();
hide();
}
}

View File

@ -11,6 +11,16 @@ public class ColumnFilterSession implements Serializable{
protected ColumnData column;
protected C_Expression cexpression;
public ColumnFilterSession(){
}
public ColumnFilterSession(ColumnData column, C_Expression cexpression){
this.column=column;
this.cexpression=cexpression;
}
public ColumnData getColumn() {
return column;
}