Project

General

Profile

Revision bcc9b207

IDbcc9b207c1c83214bc401a9df17e8eec2d669293
Parent a7b9fdeb
Child fdb645e1

Added by Andreas Kohlbecker about 3 years ago

ref #6719 fixing bug releated to sorting

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationConverter.java
144 144
       List<TypedEntityReference> baseEntityKeyList = new LinkedList<>(stringsByTypeByBaseEntity.keySet());
145 145
       Collections.sort(baseEntityKeyList, new Comparator<TypedEntityReference>(){
146 146
        /**
147
         * Sorts the base entitoes (TypedEntityReference) in nthe following order:
147
         * Sorts the base entities (TypedEntityReference) in the following order:
148 148
         *
149 149
         * 1. FieldUnits
150 150
         * 2. DerivedUnit (in case of missing FieldUnit we expect the base type to be DerivedUnit)
......
154 154
         */
155 155
        @Override
156 156
        public int compare(TypedEntityReference o1, TypedEntityReference o2) {
157
            if(!o1.getType().equals(o2.getType())) {
158
                if(o1.equals(FieldUnit.class) || o2.equals(FieldUnit.class)){
157

  
158
            Class type1 = o1.getType();
159
            Class type2 = o2.getType();
160

  
161
            if(!type1.equals(type2)) {
162
                if(type1.equals(FieldUnit.class) || type2.equals(FieldUnit.class)){
159 163
                    // FieldUnits first
160
                    return o1.getType().equals(FieldUnit.class) ? -1 : 1;
164
                    return type1.equals(FieldUnit.class) ? -1 : 1;
161 165
                } else {
162 166
                    // name types last (in case of missing FieldUnit we expect the base type to be DerivedUnit which comes into the middle)
163
                    return o2.getType().equals(TaxonName.class) ? -1 : 1;
167
                    return type2.equals(TaxonName.class) ? -1 : 1;
164 168
                }
165 169
            } else {
166 170
                return o1.getLabel().compareTo(o2.getLabel());
......
584 588
            }
585 589
        }
586 590

  
591
        /**
592
         * @return
593
         */
594
        public boolean isSpecimenTypeDesigationWorkingSet() {
595
            return baseEntityReference.getType().isAssignableFrom(SpecimenOrObservationBase.class);
596
        }
597

  
587 598
    }
588 599

  
589 600
    @SuppressWarnings({ "deprecation", "serial" })

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)