Updated Filter

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113669 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-19 17:52:18 +00:00
parent 5748639757
commit d1683cd8ff
4 changed files with 51 additions and 34 deletions

View File

@ -84,7 +84,7 @@ public class ColumnExpressionPanel extends FramedPanel {
this.column = column;
this.columns = null;
this.eventBus = eventBus;
Log.debug(column.toString());
Log.debug("Column:"+column);
createOnMultiColumnFilter();
}
@ -99,7 +99,7 @@ public class ColumnExpressionPanel extends FramedPanel {
this.column = column;
this.columns = columns;
this.eventBus = eventBus;
Log.debug(column.toString());
Log.debug("Column:"+column);
createOnFilter();
}
@ -118,7 +118,7 @@ public class ColumnExpressionPanel extends FramedPanel {
this.column = column;
this.columns = null;
this.eventBus = eventBus;
Log.debug(column.toString());
Log.debug("Column:"+column);
createOnTemplate();
}

View File

@ -145,7 +145,7 @@ public class ColumnFilterDialog extends Window implements MonitorDialogListener
c.getTypeCode().compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0 ){
removableColumn.add(c);
} else {
if(c.getColumnId().compareTo(columnLocalId)==0){
if(columnLocalId!=null && c.getColumnId().compareTo(columnLocalId)==0){
column=c;
}
}

View File

@ -101,15 +101,21 @@ public class ConditionWidget extends SimpleContainer {
forceLayoutOnResize = true;
thisCont = this;
String sign="columnX";
if(column!=null&& column.getName()!=null){
sign=column.getName();
}
itemIdCombo = "ComboConditions" + column.getName();
itemIdFirstArg = "FirstArg" + column.getName();
itemIdSecondArg = "SecondArg" + column.getName();
itemIdFirstArgDate = "FirstArgDate" + column.getName();
itemIdSecondArgDate = "SecondArgDate" + column.getName();
itemIdComboThreshold = "ComboThreshold" + column.getName();
itemIdBtnAdd = "BtnAdd" + column.getName();
itemIdBtnDel = "BtnDel" + column.getName();
itemIdCombo = "ComboConditions" + sign;
itemIdFirstArg = "FirstArg" + sign;
itemIdSecondArg = "SecondArg" + sign;
itemIdFirstArgDate = "FirstArgDate" + sign;
itemIdSecondArgDate = "SecondArgDate" + sign;
itemIdComboThreshold = "ComboThreshold" + sign;
itemIdBtnAdd = "BtnAdd" + sign;
itemIdBtnDel = "BtnDel" + sign;
VerticalLayoutContainer baseLayout = new VerticalLayoutContainer();
@ -244,7 +250,7 @@ public class ConditionWidget extends SimpleContainer {
ListStore<Operation> storeOp = new ListStore<Operation>(props.id());
Log.debug("Store: " + storeOp);
OperationsStore factory = new OperationsStore();
storeOp.addAll(factory.getAll(column.getDataTypeName()));
storeOp.addAll(factory.getAll(column));
Log.debug("Store created");
ComboBox<Operation> comboOp = new ComboBox<Operation>(storeOp,
@ -400,18 +406,18 @@ public class ConditionWidget extends SimpleContainer {
comboOp.setTriggerAction(TriggerAction.ALL);
horiz.add(comboOp, new BoxLayoutData(new Margins(0)));
if (column.getDataTypeName().compareTo("Date") == 0) {
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(andText, new BoxLayoutData(new Margins(0)));
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
} else {
if (column==null|| column.getDataTypeName().compareTo("Date") != 0) {
horiz.add(firstArg, new BoxLayoutData(new Margins(0)));
horiz.add(andText, new BoxLayoutData(new Margins(0)));
horiz.add(secondArg, new BoxLayoutData(new Margins(0)));
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
} else {
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(andText, new BoxLayoutData(new Margins(0)));
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
}
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 0, 2, 0)));
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 0, 2, 0)));
@ -522,7 +528,7 @@ public class ConditionWidget extends SimpleContainer {
ListStore<Operation> storeOp = new ListStore<Operation>(props.id());
Log.debug("Store: " + storeOp);
OperationsStore factory = new OperationsStore();
storeOp.addAll(factory.getAll(column.getDataTypeName()));
storeOp.addAll(factory.getAll(column));
Log.trace("Store created");
@ -679,18 +685,18 @@ public class ConditionWidget extends SimpleContainer {
comboOp.setTriggerAction(TriggerAction.ALL);
horiz.add(comboOp, new BoxLayoutData(new Margins(0)));
if (column.getDataTypeName().compareTo("Date") == 0) {
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(andText, new BoxLayoutData(new Margins(0)));
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
} else {
if (column==null|| column.getDataTypeName().compareTo("Date") != 0) {
horiz.add(firstArg, new BoxLayoutData(new Margins(0)));
horiz.add(andText, new BoxLayoutData(new Margins(0)));
horiz.add(secondArg, new BoxLayoutData(new Margins(0)));
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
} else {
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(andText, new BoxLayoutData(new Margins(0)));
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
}
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 0, 2, 0)));
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 0, 2, 0)));
@ -712,8 +718,12 @@ public class ConditionWidget extends SimpleContainer {
DateField secondArgDate;
ComboBox<Threshold> comboThreshold;
C_Expression expression;
C_Expression expression=null;
if(column==null){
return expression;
}
DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
ConditionTypeMap mapOp = new ConditionTypeMap();
@ -723,8 +733,8 @@ public class ConditionWidget extends SimpleContainer {
horiz = (HBoxLayoutContainer) iteratorVert.next();
ComboBox<Operation> comboOp = (ComboBox<Operation>) horiz
.getItemByItemId(itemIdCombo);
Log.debug("combo: " + comboOp.getCurrentValue().toString());
Log.debug("combo: " + comboOp.getCurrentValue());
if (column.getDataTypeName().compareTo(
ColumnDataType.Date.toString()) == 0) {
firstArgDate = (DateField) horiz

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.expressionwidget.client.operation;
import java.util.ArrayList;
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
@ -105,8 +106,14 @@ public class OperationsStore {
public ArrayList<Operation> getAll(String dataTypeName){
ColumnDataType dataType=ColumnDataType.getColumnDataTypeFromId(dataTypeName);
public ArrayList<Operation> getAll(ColumnData column){
if(column==null){
operations=new ArrayList<Operation>();
return operations;
}
ColumnDataType dataType=ColumnDataType.getColumnDataTypeFromId(column.getDataTypeName());
if(dataType==null){
operations=new ArrayList<Operation>();