Project

General

Profile

« Previous | Next » 

Revision 84561e1b

Added by Patrick Plitzner over 10 years ago

  • DefinedTerm is ordered as in enum (#3752)

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/OccurrenceCreator.java
1 1
// $Id$
2 2
/**
3 3
 * Copyright (C) 2007 EDIT
4
 * European Distributed Institute of Taxonomy 
4
 * European Distributed Institute of Taxonomy
5 5
 * http://www.e-taxonomy.eu
6
 * 
6
 *
7 7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
 * See LICENSE.TXT at the top of this package for the full license terms.
9 9
 */
10 10

  
11 11
package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
12 12

  
13
import java.util.Comparator;
14
import java.util.HashMap;
15 13
import java.util.Map;
16 14
import java.util.TreeMap;
17 15

  
......
30 28
 * <p>
31 29
 * OccurrenceCreator class.
32 30
 * </p>
33
 * 
31
 *
34 32
 * @author n.hoffmann
35 33
 * @created Jun 16, 2010
36 34
 * @version 1.0
......
50 48
	/** {@inheritDoc} */
51 49
	@Override
52 50
	public SpecimenOrObservationBase createEntity(Object key, String text) {
53
		
51

  
54 52
		SpecimenOrObservationBase specimenOrObservation = null;
55 53
		NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard((SpecimenOrObservationType)key);
56 54
		wizard.init(null, null);
......
59 57
			int status = dialog.open();
60 58

  
61 59
			if (status == IStatus.OK) {
62
				specimenOrObservation = wizard.getEntity();								
60
				specimenOrObservation = wizard.getEntity();
63 61
			}
64
		} 
62
		}
65 63
		return specimenOrObservation;
66 64
	}
67 65

  
......
69 67
	 * <p>
70 68
	 * getKeyLabelPairs
71 69
	 * </p>
72
	 * 
70
	 *
73 71
	 * @return a {@link java.util.Map} object.
74 72
	 */
75 73
	@Override
76 74
	public Map<Object, String> getKeyLabelPairs() {
77
		Comparator<Object> comparator = new Comparator<Object>() {
78
			  public int compare(Object o1, Object o2) {
79
			    String key1 = ((SpecimenOrObservationType)o1).getKey();
80
			    String key2 = ((SpecimenOrObservationType)o2).getKey();
81
			    return key1.compareTo(key2);
82
			  }
83
			};
84
		Map<Object, String> result = new TreeMap<Object, String>(comparator);
85

  
86
		for(SpecimenOrObservationType sooType : SpecimenOrObservationType.values()) {				
87
			result.put(sooType, sooType.getMessage());				
75
//		Comparator<Object> comparator = new Comparator<Object>() {
76
//			  public int compare(Object o1, Object o2) {
77
//			    String key1 = ((SpecimenOrObservationType)o1).getKey();
78
//			    String key2 = ((SpecimenOrObservationType)o2).getKey();
79
//			    return key1.compareTo(key2);
80
//			  }
81
//			};
82
//		Map<Object, String> result = new TreeMap<Object, String>(comparator);
83
//	    Map<Object, String> result = new HashMap<Object, String>();
84
		Map<Object, String> result = new TreeMap<Object, String>();
85

  
86
		for(SpecimenOrObservationType sooType : SpecimenOrObservationType.values()) {
87
			result.put(sooType, sooType.getMessage());
88 88
		}
89 89

  
90 90
		return result;
......
95 95
		// TODO Auto-generated method stub
96 96
		return true;
97 97
	}
98
	
98

  
99 99

  
100 100
}

Also available in: Unified diff