Revision 7f1d6816
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/AggregationConfiguration.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.editor.workingSet.matrix; |
10 | 10 |
|
11 |
import java.util.HashSet; |
|
12 |
import java.util.Set; |
|
13 |
|
|
14 |
import org.apache.commons.lang.StringUtils; |
|
11 | 15 |
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; |
12 | 16 |
import org.eclipse.nebula.widgets.nattable.data.IDataProvider; |
13 | 17 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
... | ... | |
20 | 24 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
21 | 25 |
import eu.etaxonomy.cdm.model.description.Feature; |
22 | 26 |
import eu.etaxonomy.cdm.model.description.QuantitativeData; |
23 |
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
|
|
27 |
import eu.etaxonomy.cdm.model.description.State;
|
|
24 | 28 |
|
25 | 29 |
/** |
26 | 30 |
* @author pplitzner |
... | ... | |
79 | 83 |
} |
80 | 84 |
} |
81 | 85 |
} |
82 |
String summaryString = ""; |
|
83 |
if(minTotal!=null){ |
|
84 |
summaryString += "from "+minTotal; |
|
85 |
} |
|
86 |
if(maxTotal!=null){ |
|
87 |
summaryString += " up to "+maxTotal; |
|
88 |
} |
|
86 |
String summaryString = (minTotal==null?"?":minTotal.toString()) |
|
87 |
+" - " |
|
88 |
+(maxTotal==null?"?":maxTotal.toString()); |
|
89 | 89 |
return summaryString; |
90 | 90 |
} |
91 | 91 |
} |
... | ... | |
93 | 93 |
private class CategoricalSummaryProvider implements ISummaryProvider { |
94 | 94 |
@Override |
95 | 95 |
public Object summarize(int columnIndex) { |
96 |
String summaryString = ""; |
|
97 |
String separator = ", "; |
|
98 | 96 |
int rowCount = AggregationConfiguration.this.dataProvider.getRowCount(); |
97 |
Set<State> states = new HashSet<>(); |
|
99 | 98 |
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { |
100 | 99 |
Object dataValue = AggregationConfiguration.this.dataProvider.getDataValue(columnIndex, |
101 | 100 |
rowIndex); |
102 | 101 |
if(dataValue instanceof CategoricalData){ |
103 | 102 |
CategoricalData categoricalData = (CategoricalData)dataValue; |
104 |
summaryString += DescriptionHelper.getLabel(categoricalData)+separator;
|
|
103 |
states.addAll(categoricalData.getStatesOnly());
|
|
105 | 104 |
} |
106 | 105 |
} |
107 |
if(summaryString.length()>separator.length()){ |
|
108 |
summaryString = summaryString.substring(0, summaryString.length()-separator.length()); |
|
109 |
} |
|
110 |
return summaryString; |
|
106 |
return StringUtils.join(states, ", "); |
|
111 | 107 |
} |
112 | 108 |
} |
113 |
|
|
114 | 109 |
} |
Also available in: Unified diff
ref #7095 Optimize aggregation and display of description elements