Updated Rules
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@114359 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ec436a5051
commit
d1a0bbcbe4
|
@ -240,19 +240,6 @@ public class RuleApplyPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
|
||||||
propsRules.readableExpression(), 160, "Expression");
|
|
||||||
|
|
||||||
readableExpressionCol.setCell(new AbstractCell<String>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
|
||||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
|
||||||
.create(RuleApplyTemplates.class);
|
|
||||||
sb.append(ruleApplyTemplates.format(value));
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||||
l.add(nameCol);
|
l.add(nameCol);
|
||||||
|
@ -509,17 +496,37 @@ public class RuleApplyPanel extends FramedPanel {
|
||||||
ColumnData column = comboColumns.getCurrentValue();
|
ColumnData column = comboColumns.getCurrentValue();
|
||||||
if (column != null) {
|
if (column != null) {
|
||||||
ArrayList<RuleDescriptionData> selectedRules = getSelectedItems();
|
ArrayList<RuleDescriptionData> selectedRules = getSelectedItems();
|
||||||
ArrayList<RuleDescriptionData> rulesToBeApplied = new ArrayList<RuleDescriptionData>();
|
ArrayList<RuleDescriptionData> rulesThatWillBeDetach = new ArrayList<RuleDescriptionData>();
|
||||||
|
ArrayList<RuleDescriptionData> rulesThatWillBeApplied = new ArrayList<RuleDescriptionData>();
|
||||||
|
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
||||||
|
.getColumnRuleMapping();
|
||||||
|
if(columnRuleMapping!=null){
|
||||||
|
ArrayList<RuleDescriptionData> rulesApplied = columnRuleMapping
|
||||||
|
.get(column.getColumnId());
|
||||||
|
for(RuleDescriptionData ruleApplied:rulesApplied){
|
||||||
|
boolean ruleStillApplied = false;
|
||||||
|
for (RuleDescriptionData ruleSelected : selectedRules) {
|
||||||
|
if (ruleSelected.getId() == ruleApplied
|
||||||
|
.getId()) {
|
||||||
|
ruleStillApplied = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ruleStillApplied){
|
||||||
|
rulesThatWillBeDetach.add(ruleApplied);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (RuleDescriptionData ruleSelected : selectedRules) {
|
for (RuleDescriptionData ruleSelected : selectedRules) {
|
||||||
boolean ruleApplied = false;
|
boolean ruleApplied = false;
|
||||||
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
|
||||||
.getColumnRuleMapping();
|
|
||||||
|
|
||||||
if (columnRuleMapping != null) {
|
if (columnRuleMapping != null) {
|
||||||
ArrayList<RuleDescriptionData> applied = columnRuleMapping
|
ArrayList<RuleDescriptionData> rulesApplied = columnRuleMapping
|
||||||
.get(column.getColumnId());
|
.get(column.getColumnId());
|
||||||
if (applied != null) {
|
if (rulesApplied != null) {
|
||||||
for (RuleDescriptionData ruleAlreadyApplied : applied) {
|
for (RuleDescriptionData ruleAlreadyApplied : rulesApplied) {
|
||||||
if (ruleSelected.getId() == ruleAlreadyApplied
|
if (ruleSelected.getId() == ruleAlreadyApplied
|
||||||
.getId()) {
|
.getId()) {
|
||||||
ruleApplied = true;
|
ruleApplied = true;
|
||||||
|
@ -534,12 +541,12 @@ public class RuleApplyPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ruleApplied == false) {
|
if (ruleApplied == false) {
|
||||||
rulesToBeApplied.add(ruleSelected);
|
rulesThatWillBeApplied.add(ruleSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyColumnRulesSession applyColumnRulesSession = new ApplyColumnRulesSession(
|
ApplyColumnRulesSession applyColumnRulesSession = new ApplyColumnRulesSession(
|
||||||
trId, column, rulesToBeApplied);
|
trId, column, rulesThatWillBeApplied, rulesThatWillBeDetach);
|
||||||
parent.applyRules(applyColumnRulesSession);
|
parent.applyRules(applyColumnRulesSession);
|
||||||
} else {
|
} else {
|
||||||
Log.error("No column selected");
|
Log.error("No column selected");
|
||||||
|
|
Loading…
Reference in New Issue