Fixed Arithmetic operations
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113564 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ddfd29683c
commit
2995538566
|
@ -138,22 +138,20 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
EventBus eventBus) {
|
||||
super();
|
||||
replaceColumnByExpressionType = ReplaceColumnByExpressionType.Template;
|
||||
this.columns = columns;
|
||||
ColumnDataType targetType = ColumnDataType
|
||||
.getColumnDataTypeFromId(column.getDataTypeName());
|
||||
create(column.getTrId(), targetType, WIDTH, HEIGHT, eventBus);
|
||||
setup();
|
||||
columnsConfig(columns);
|
||||
}
|
||||
|
||||
public ReplaceWidget(ColumnData column, ArrayList<ColumnData> columns,
|
||||
String width, String height, EventBus eventBus) {
|
||||
super();
|
||||
replaceColumnByExpressionType = ReplaceColumnByExpressionType.Template;
|
||||
this.columns = columns;
|
||||
ColumnDataType targetType = ColumnDataType
|
||||
.getColumnDataTypeFromId(column.getDataTypeName());
|
||||
create(column.getTrId(), targetType, width, height, eventBus);
|
||||
setup();
|
||||
columnsConfig(columns);
|
||||
}
|
||||
|
||||
protected void create(TRId trId, ColumnDataType targetColumnType,
|
||||
|
@ -208,23 +206,26 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
|
||||
public void onSuccess(ArrayList<ColumnData> result) {
|
||||
Log.trace("loaded " + result.size() + " ColumnData");
|
||||
columns = result;
|
||||
arithmeticColumns = new ArrayList<ColumnData>();
|
||||
for (ColumnData col : result) {
|
||||
ColumnDataType colDataType = ColumnDataType
|
||||
.getColumnDataTypeFromId(col
|
||||
.getDataTypeName());
|
||||
if (C_ArithmeticExpression.isAccepted(colDataType)) {
|
||||
arithmeticColumns.add(col);
|
||||
}
|
||||
|
||||
}
|
||||
setup();
|
||||
columnsConfig(result);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected void columnsConfig(ArrayList<ColumnData> result) {
|
||||
columns = result;
|
||||
arithmeticColumns = new ArrayList<ColumnData>();
|
||||
for (ColumnData col : result) {
|
||||
ColumnDataType colDataType = ColumnDataType
|
||||
.getColumnDataTypeFromId(col.getDataTypeName());
|
||||
if (C_ArithmeticExpression.isAccepted(colDataType)) {
|
||||
arithmeticColumns.add(col);
|
||||
}
|
||||
|
||||
}
|
||||
setup();
|
||||
}
|
||||
|
||||
protected void setup() {
|
||||
itemIdComboConcat = "ComboConcat" + trId.getId();
|
||||
itemIdComboLeaf = "ComboLeaf" + trId.getId();
|
||||
|
@ -304,8 +305,8 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
case ColumnValue:
|
||||
case Upper:
|
||||
case Lower:
|
||||
case Trim:
|
||||
case MD5:
|
||||
case Trim:
|
||||
case MD5:
|
||||
comboColumns.clear();
|
||||
comboColumns.setVisible(true);
|
||||
firstArg.setVisible(false);
|
||||
|
@ -376,9 +377,13 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
ListStore<ReplaceElement> storeReplaceElementsOperations = new ListStore<ReplaceElement>(
|
||||
props.id());
|
||||
Log.debug("Store Operations: " + storeReplaceElementsOperations);
|
||||
storeReplaceElementsOperations
|
||||
.addAll(factory.replaceElementsOperations);
|
||||
|
||||
if (arithmeticColumns == null || arithmeticColumns.size() < 1) {
|
||||
storeReplaceElementsOperations
|
||||
.addAll(factory.replaceElementsOperationsNoArithmetic);
|
||||
} else {
|
||||
storeReplaceElementsOperations
|
||||
.addAll(factory.replaceElementsOperations);
|
||||
}
|
||||
Log.debug("Store created");
|
||||
final ComboBox<ReplaceElement> comboReplaceElementsOperations = new ComboBox<ReplaceElement>(
|
||||
storeReplaceElementsOperations, props.label());
|
||||
|
@ -409,8 +414,8 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
case ColumnValue:
|
||||
case Upper:
|
||||
case Lower:
|
||||
case Trim:
|
||||
case MD5:
|
||||
case Trim:
|
||||
case MD5:
|
||||
comboReplaceElementsLeaf.setVisible(false);
|
||||
storeColumns.clear();
|
||||
storeColumns.addAll(columns);
|
||||
|
@ -460,7 +465,7 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
.commitChanges();
|
||||
comboReplaceElementsLeaf.setVisible(true);
|
||||
comboReplaceElementsLeaf.redraw();
|
||||
|
||||
|
||||
storeColumns.clear();
|
||||
storeColumns.addAll(arithmeticColumns);
|
||||
storeColumns.commitChanges();
|
||||
|
@ -705,9 +710,14 @@ public class ReplaceWidget extends SimpleContainer {
|
|||
ListStore<ReplaceElement> storeReplaceElementsOperations = new ListStore<ReplaceElement>(
|
||||
props.id());
|
||||
Log.debug("Store Concat: " + storeReplaceElementsOperations);
|
||||
storeReplaceElementsOperations
|
||||
.addAll(factory.replaceElementsOperations);
|
||||
|
||||
if (arithmeticColumns == null || arithmeticColumns.size() < 1) {
|
||||
storeReplaceElementsOperations
|
||||
.addAll(factory.replaceElementsOperationsNoArithmetic);
|
||||
} else {
|
||||
storeReplaceElementsOperations
|
||||
.addAll(factory.replaceElementsOperations);
|
||||
}
|
||||
|
||||
Log.debug("Store created");
|
||||
final ComboBox<ReplaceElement> comboReplaceElementsOperations = new ComboBox<ReplaceElement>(
|
||||
storeReplaceElementsOperations, props.label());
|
||||
|
|
|
@ -35,6 +35,27 @@ public class ReplaceElementStore {
|
|||
add(new ReplaceElement(16, ReplaceType.MD5));
|
||||
}
|
||||
};
|
||||
|
||||
public ArrayList<ReplaceElement> replaceElementsOperationsNoArithmetic = new ArrayList<ReplaceElement>() {
|
||||
|
||||
private static final long serialVersionUID = 1690916203781730778L;
|
||||
|
||||
{
|
||||
add(new ReplaceElement(1, ReplaceType.Value));
|
||||
add(new ReplaceElement(2, ReplaceType.ColumnValue));
|
||||
add(new ReplaceElement(3, ReplaceType.SubstringByRegex));
|
||||
add(new ReplaceElement(4, ReplaceType.SubstringByIndex));
|
||||
add(new ReplaceElement(5, ReplaceType.SubstringByCharSeq));
|
||||
add(new ReplaceElement(6, ReplaceType.TextReplaceMatchingRegex));
|
||||
add(new ReplaceElement(7, ReplaceType.Concat));
|
||||
add(new ReplaceElement(8, ReplaceType.Upper));
|
||||
add(new ReplaceElement(9, ReplaceType.Lower));
|
||||
add(new ReplaceElement(10, ReplaceType.Trim));
|
||||
add(new ReplaceElement(11, ReplaceType.MD5));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
public ArrayList<ReplaceElement> replaceElements = new ArrayList<ReplaceElement>() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue