Skip to content

Commit

Permalink
Merge pull request #160 from anneferger/master
Browse files Browse the repository at this point in the history
Exakt: the names of the annotations are now sorted alphabetically in …
  • Loading branch information
berndmoos committed Jul 11, 2018
2 parents 6a3cda7 + 5a922ca commit aece572
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ public void actionPerformed(ActionEvent evt) {

// init the annotation combo box
DefaultComboBoxModel comboBoxModel2 = new DefaultComboBoxModel();
for (String an : corpus.getAnnotationNames()){
//here the sorting alphabetically should be done
//HashSet<String> sortedannotationsnames = corpus.getAnnotationNames(). sort();
ArrayList<String> sortedList = new ArrayList(corpus.getAnnotationNames());
Collections.sort(sortedList, new SortIgnoreCase());
for (String an : sortedList){
comboBoxModel2.addElement(an);
}
annotationComboBox.setModel(comboBoxModel2);
Expand Down Expand Up @@ -1298,6 +1302,12 @@ public Element getRegexLibraryEntry(){
return entry;
}


public class SortIgnoreCase implements Comparator<Object> {
public int compare(Object o1, Object o2) {
String s1 = (String) o1;
String s2 = (String) o2;
return s1.toLowerCase().compareTo(s2.toLowerCase());
}
}

}

0 comments on commit aece572

Please sign in to comment.