import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
+import eu.etaxonomy.cdm.model.common.IEnumTerm;
+import eu.etaxonomy.cdm.model.common.OriginalSourceType;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.cdm.model.reference.ReferenceType;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
* @created Mar 16, 2010
* @version 1.0
*/
-public class EnumComboElement<T extends IDefinedTerm> extends
+public class EnumComboElement<T extends IEnumTerm> extends
AbstractCdmFormElement implements SelectionListener,
IEnableableFormElement, ISelectable {
return ReferenceType.class;
}
+ },
+ new CdmEnumDataHolder<SpecimenOrObservationType>(){
+
+ @Override
+ public String getName() {
+ return "Specimen / Observation Type";
+ }
+
+ @Override
+ public Collection<SpecimenOrObservationType> getElements() {
+ return Arrays.asList(SpecimenOrObservationType.values());
+ }
+
+ @Override
+ public Class<SpecimenOrObservationType> getClazz() {
+ return SpecimenOrObservationType.class;
+ }
+
+ },
+ new CdmEnumDataHolder<OriginalSourceType>(){
+
+ @Override
+ public String getName() {
+ return "Original Source Type";
+ }
+
+ @Override
+ public Collection<OriginalSourceType> getElements() {
+ return Arrays.asList(OriginalSourceType.values());
+ }
+
+ @Override
+ public Class<OriginalSourceType> getClazz() {
+ return OriginalSourceType.class;
+ }
+
}
+
};
private static final int DEFAULT_VISIBLE_ITEMS = 10;
private String getDefaultLabelString() {
if(enumType.equals(ReferenceType.class)){
return "Reference Type";
- }else if (enumType.equals(NomenclaturalCode.class)){
+ } else if (enumType.equals(NomenclaturalCode.class)){
return "Nomenclatural Code";
+ } else if(enumType.equals(OriginalSourceType.class)) {
+ return "Orig. Source Type";
+ } else if(enumType.equals(SpecimenOrObservationType.class)) {
+ return "Spec./Obs. Type";
}
return "No Label";
}
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
+import eu.etaxonomy.cdm.model.common.IEnumTerm;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.common.Marker;
+import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TimePeriod;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
* @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
* object.
*/
- public <T extends IDefinedTerm> EnumComboElement<T> createEnumComboElement(
+ public <T extends IEnumTerm> EnumComboElement<T> createEnumComboElement(
Class<T> enumComboType, ICdmFormElement parentElement,
int style) {
EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
element = new IdentifiableSourceElement(this, parentElement,
(IdentifiableSource) entity, removeListener, style);
} else if (entity instanceof DefinedTerm) {
- //FIXME:3.3MC
- element = new ScopeElement(this, parentElement, (DefinedTerm) entity,
- removeListener, style);
- } else if (entity instanceof DefinedTerm) {
- element = new ModifierElement(this, parentElement,
- (DefinedTerm) entity, removeListener, style);
+ switch(((DefinedTerm)entity).getTermType()) {
+ case Scope:
+ element = new ScopeElement(this,
+ parentElement,
+ (DefinedTerm) entity,
+ removeListener,
+ style);
+ break;
+ case Modifier:
+ element = new ModifierElement(this,
+ parentElement,
+ (DefinedTerm) entity,
+ removeListener,
+ style);
+ break;
+ default:
+ //FIXME : Actually we should through an exception here
+ element = null;
+ break;
+
+ }
} else if (entity instanceof Reference) {
element = new DescriptionSourceElement(this, parentElement,
(Reference) entity, removeListener, style);
parentElement, (StatisticalMeasurementValue) entity,
removeListener, style);
} else if (entity instanceof DerivedUnit) {
- //FIXME:3.3MC
- element = new DerivedUnitElement(this, parentElement,
- (DerivedUnit) entity, removeListener, style);
+ switch(((DerivedUnit)entity).getRecordBasis()) {
+ case LivingSpecimen:
+ case PreservedSpecimen:
+ case OtherSpecimen:
+ element = new SpecimenCollectionDetailElement(this,
+ parentElement,
+ (DerivedUnit) entity,
+ removeListener,
+ style);
+ break;
+ default:
+ element = new DerivedUnitElement(this,
+ parentElement,
+ (DerivedUnit) entity,
+ removeListener,
+ style);
+ }
+
} else if (entity instanceof NamedArea) {
element = new NamedAreaDetailElement(this, parentElement,
(NamedArea) entity, removeListener, style);
} else if (entity instanceof DeterminationEvent) {
element = new DeterminationEventDetailElement(this, parentElement,
(DeterminationEvent) entity, removeListener, style);
- } else if (entity instanceof DerivedUnit) {
- //FIXME:3.3MC
- element = new SpecimenCollectionDetailElement(this, parentElement,
- (DerivedUnit) entity, removeListener, style);
} else if (entity instanceof User) {
element = new MemberDetailElement(this, parentElement,
(User) entity, removeListener, style);