public int compare(Object o1, Object o2) {\r
String titleCache1 = getTitleCache(o1);\r
String titleCache2 = getTitleCache(o2);\r
+ if (titleCache1 == null && titleCache2 == null) {\r
+ return 0;\r
+ }\r
+ if (titleCache1 == null) {\r
+ return -1;\r
+ }\r
+ if (titleCache2 == null) {\r
+ return 1;\r
+ } \r
return fIgnoreCase ? titleCache1.compareToIgnoreCase(titleCache2) : \r
titleCache1.compareTo(titleCache2);\r
}\r
if (text == null) {\r
return "";\r
}\r
- TimePeriod datePublished = ((StrictReferenceBase) reference).getDatePublished();\r
- \r
- String date = datePublished == null ? null : datePublished.toString();\r
- if (date != null) {\r
- text += " [" + date + "]";\r
- }\r
+ // Nobody seems to like displaying the date\r
+// TimePeriod datePublished = ((StrictReferenceBase) reference).getDatePublished();\r
+// \r
+// String date = datePublished == null ? null : datePublished.toString();\r
+// if (date != null) {\r
+// text += " [" + date + "]";\r
+// }\r
return text;\r
}\r
if (entity instanceof TaxonNameBase) {\r
if (input instanceof ReferenceEditorInput) {\r
addMenuItem(menu, "Year", new ReferenceYearComparator(), false);\r
}\r
+\r
+ if (input instanceof ReferenceEditorInput) {\r
+ addMenuItem(menu, "Reference Type", new ReferenceTypeComparator(), false);\r
+ }\r
\r
return menu;\r
}\r
if (yearString2 == null) {\r
return 1;\r
}\r
- return yearString1.compareToIgnoreCase(yearString2);\r
+ int returnVal = yearString1.compareToIgnoreCase(yearString2);\r
+ if (returnVal == 0) {\r
+ return new IdentifiableEntityComparator().compare(o1, 02);\r
+ } else {\r
+ return returnVal;\r
+ }\r
+ } \r
+ }\r
+ \r
+ class ReferenceTypeComparator implements Comparator {\r
+ \r
+ /* (non-Javadoc)\r
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)\r
+ */\r
+ public int compare(Object o1, Object o2) {\r
+ String typeString1 = o1.getClass().toString();\r
+ String typeString2 = o2.getClass().toString();\r
+ if (typeString1 == null) {\r
+ if (typeString2 == null) {\r
+ return 0;\r
+ } else {\r
+ return -1;\r
+ }\r
+ }\r
+ if (typeString2 == null) {\r
+ return 1;\r
+ }\r
+ int returnVal = typeString1.compareToIgnoreCase(typeString2);\r
+ if (returnVal == 0) {\r
+ return new IdentifiableEntityComparator().compare(o1, 02);\r
+ } else {\r
+ return returnVal;\r
+ }\r
} \r
}\r
}
\ No newline at end of file
\r
import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;\r
-import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;\r
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;\r
\r
/**\r
* @author p.ciardelli\r
* @see eu.etaxonomy.taxeditor.bulkeditor.IEntityCreator#createEntity(java.lang.String)\r
*/\r
public TaxonNameBase createEntity(String text) {\r
- TaxonNameBase name = NomenclaturalCodeHelper.getInstanceOfPreferredNameClass();\r
+ TaxonNameBase name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);\r
name.setTitleCache(text);\r
return name;\r
}\r