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) {
|
EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
replaceColumnByExpressionType = ReplaceColumnByExpressionType.Template;
|
replaceColumnByExpressionType = ReplaceColumnByExpressionType.Template;
|
||||||
this.columns = columns;
|
|
||||||
ColumnDataType targetType = ColumnDataType
|
ColumnDataType targetType = ColumnDataType
|
||||||
.getColumnDataTypeFromId(column.getDataTypeName());
|
.getColumnDataTypeFromId(column.getDataTypeName());
|
||||||
create(column.getTrId(), targetType, WIDTH, HEIGHT, eventBus);
|
create(column.getTrId(), targetType, WIDTH, HEIGHT, eventBus);
|
||||||
setup();
|
columnsConfig(columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReplaceWidget(ColumnData column, ArrayList<ColumnData> columns,
|
public ReplaceWidget(ColumnData column, ArrayList<ColumnData> columns,
|
||||||
String width, String height, EventBus eventBus) {
|
String width, String height, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
replaceColumnByExpressionType = ReplaceColumnByExpressionType.Template;
|
replaceColumnByExpressionType = ReplaceColumnByExpressionType.Template;
|
||||||
this.columns = columns;
|
|
||||||
ColumnDataType targetType = ColumnDataType
|
ColumnDataType targetType = ColumnDataType
|
||||||
.getColumnDataTypeFromId(column.getDataTypeName());
|
.getColumnDataTypeFromId(column.getDataTypeName());
|
||||||
create(column.getTrId(), targetType, width, height, eventBus);
|
create(column.getTrId(), targetType, width, height, eventBus);
|
||||||
setup();
|
columnsConfig(columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(TRId trId, ColumnDataType targetColumnType,
|
protected void create(TRId trId, ColumnDataType targetColumnType,
|
||||||
|
@ -208,12 +206,18 @@ public class ReplaceWidget extends SimpleContainer {
|
||||||
|
|
||||||
public void onSuccess(ArrayList<ColumnData> result) {
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
Log.trace("loaded " + result.size() + " ColumnData");
|
Log.trace("loaded " + result.size() + " ColumnData");
|
||||||
|
columnsConfig(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void columnsConfig(ArrayList<ColumnData> result) {
|
||||||
columns = result;
|
columns = result;
|
||||||
arithmeticColumns = new ArrayList<ColumnData>();
|
arithmeticColumns = new ArrayList<ColumnData>();
|
||||||
for (ColumnData col : result) {
|
for (ColumnData col : result) {
|
||||||
ColumnDataType colDataType = ColumnDataType
|
ColumnDataType colDataType = ColumnDataType
|
||||||
.getColumnDataTypeFromId(col
|
.getColumnDataTypeFromId(col.getDataTypeName());
|
||||||
.getDataTypeName());
|
|
||||||
if (C_ArithmeticExpression.isAccepted(colDataType)) {
|
if (C_ArithmeticExpression.isAccepted(colDataType)) {
|
||||||
arithmeticColumns.add(col);
|
arithmeticColumns.add(col);
|
||||||
}
|
}
|
||||||
|
@ -222,9 +226,6 @@ public class ReplaceWidget extends SimpleContainer {
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setup() {
|
protected void setup() {
|
||||||
itemIdComboConcat = "ComboConcat" + trId.getId();
|
itemIdComboConcat = "ComboConcat" + trId.getId();
|
||||||
itemIdComboLeaf = "ComboLeaf" + trId.getId();
|
itemIdComboLeaf = "ComboLeaf" + trId.getId();
|
||||||
|
@ -376,9 +377,13 @@ public class ReplaceWidget extends SimpleContainer {
|
||||||
ListStore<ReplaceElement> storeReplaceElementsOperations = new ListStore<ReplaceElement>(
|
ListStore<ReplaceElement> storeReplaceElementsOperations = new ListStore<ReplaceElement>(
|
||||||
props.id());
|
props.id());
|
||||||
Log.debug("Store Operations: " + storeReplaceElementsOperations);
|
Log.debug("Store Operations: " + storeReplaceElementsOperations);
|
||||||
|
if (arithmeticColumns == null || arithmeticColumns.size() < 1) {
|
||||||
|
storeReplaceElementsOperations
|
||||||
|
.addAll(factory.replaceElementsOperationsNoArithmetic);
|
||||||
|
} else {
|
||||||
storeReplaceElementsOperations
|
storeReplaceElementsOperations
|
||||||
.addAll(factory.replaceElementsOperations);
|
.addAll(factory.replaceElementsOperations);
|
||||||
|
}
|
||||||
Log.debug("Store created");
|
Log.debug("Store created");
|
||||||
final ComboBox<ReplaceElement> comboReplaceElementsOperations = new ComboBox<ReplaceElement>(
|
final ComboBox<ReplaceElement> comboReplaceElementsOperations = new ComboBox<ReplaceElement>(
|
||||||
storeReplaceElementsOperations, props.label());
|
storeReplaceElementsOperations, props.label());
|
||||||
|
@ -705,8 +710,13 @@ public class ReplaceWidget extends SimpleContainer {
|
||||||
ListStore<ReplaceElement> storeReplaceElementsOperations = new ListStore<ReplaceElement>(
|
ListStore<ReplaceElement> storeReplaceElementsOperations = new ListStore<ReplaceElement>(
|
||||||
props.id());
|
props.id());
|
||||||
Log.debug("Store Concat: " + storeReplaceElementsOperations);
|
Log.debug("Store Concat: " + storeReplaceElementsOperations);
|
||||||
|
if (arithmeticColumns == null || arithmeticColumns.size() < 1) {
|
||||||
|
storeReplaceElementsOperations
|
||||||
|
.addAll(factory.replaceElementsOperationsNoArithmetic);
|
||||||
|
} else {
|
||||||
storeReplaceElementsOperations
|
storeReplaceElementsOperations
|
||||||
.addAll(factory.replaceElementsOperations);
|
.addAll(factory.replaceElementsOperations);
|
||||||
|
}
|
||||||
|
|
||||||
Log.debug("Store created");
|
Log.debug("Store created");
|
||||||
final ComboBox<ReplaceElement> comboReplaceElementsOperations = new ComboBox<ReplaceElement>(
|
final ComboBox<ReplaceElement> comboReplaceElementsOperations = new ComboBox<ReplaceElement>(
|
||||||
|
|
|
@ -36,6 +36,27 @@ public class ReplaceElementStore {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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>() {
|
public ArrayList<ReplaceElement> replaceElements = new ArrayList<ReplaceElement>() {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1690916203781730778L;
|
private static final long serialVersionUID = 1690916203781730778L;
|
||||||
|
|
Loading…
Reference in New Issue