Revision 1c3cb06b
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.ui.section; |
5 | 5 |
|
6 |
import java.util.ArrayList; |
|
6 | 7 |
import java.util.Collection; |
8 |
import java.util.Collections; |
|
9 |
import java.util.Comparator; |
|
7 | 10 |
import java.util.EnumSet; |
11 |
import java.util.List; |
|
8 | 12 |
import java.util.Observable; |
9 | 13 |
import java.util.Observer; |
10 | 14 |
|
... | ... | |
212 | 216 |
*/ |
213 | 217 |
private void renderContent(boolean forceExpansion) |
214 | 218 |
{ |
215 |
Collection<ELEMENT> elements = getCollection(getEntity()); |
|
219 |
List<ELEMENT> elements = new ArrayList<>(getCollection(getEntity())); |
|
220 |
Collections.sort(elements, getComparator()); |
|
216 | 221 |
|
217 | 222 |
if(elements == null || elements.isEmpty()){ |
218 | 223 |
createEmptyContent(); |
... | ... | |
341 | 346 |
return entityCollectionElement; |
342 | 347 |
} |
343 | 348 |
|
349 |
/** |
|
350 |
* Returns the {@link Comparator} specific for the ELEMENTs |
|
351 |
* which is used to sort the elements |
|
352 |
* @return the comparator for ELEMENT |
|
353 |
*/ |
|
354 |
public abstract Comparator<ELEMENT> getComparator(); |
|
344 | 355 |
|
345 | 356 |
/** |
346 | 357 |
* Get the specific collection of this entity |
... | ... | |
350 | 361 |
*/ |
351 | 362 |
public abstract Collection<ELEMENT> getCollection(ENTITY entity); |
352 | 363 |
|
364 |
|
|
353 | 365 |
/** |
354 | 366 |
* Create a new Element for this collection |
355 | 367 |
* |
Also available in: Unified diff
fix #6330 Add default sorting for all entity collections