891fadfb164faa412967542684cdef5474010146
2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.vaadin
.debug
;
11 import com
.vaadin
.data
.Container
.Sortable
;
12 import com
.vaadin
.data
.util
.ItemSorter
;
14 import eu
.etaxonomy
.cdm
.cache
.EntityCacherDebugResult
.CdmEntityInfo
;
17 * @author a.kohlbecker
21 public class CdmEntityInfoSorter
implements ItemSorter
{
23 private static final long serialVersionUID
= 1008554008146041297L;
32 public void setSortProperties(Sortable container
, Object
[] propertyId
, boolean[] ascending
) {
33 this.propertyId
= propertyId
;
34 this.ascending
= ascending
;
42 public int compare(Object itemId1
, Object itemId2
) {
43 if(! (itemId1
instanceof CdmEntityInfo
&& itemId2
instanceof CdmEntityInfo
) ){
44 throw new RuntimeException("Objects must be CdmEntityInfo");
46 CdmEntityInfo infoItem1
= (CdmEntityInfo
)itemId1
;
47 CdmEntityInfo infoItem2
= (CdmEntityInfo
)itemId2
;
49 return infoItem1
.getField().getName().compareToIgnoreCase(infoItem2
.getField().getName());