Project

General

Profile

« Previous | Next » 

Revision 5a26bee6

Added by Cherian Mathew over 10 years ago

NumberWithLabelElement : added getDouble method
CdmFormFactory : updated create methods for creating elements for DefinedTerm and DerivedUnit objects
DateDetailSection : FIXME:3.3MC tag
EnumComboElement : added SpecimenOrObservationType and OriginalSourceType to the data holders list and the default label method
EntitySelectionElement : updated label text

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java
23 23
import org.eclipse.swt.widgets.Label;
24 24

  
25 25
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
26
import eu.etaxonomy.cdm.model.common.IEnumTerm;
27
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
26 28
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
29
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
27 30
import eu.etaxonomy.cdm.model.reference.ReferenceType;
28 31
import eu.etaxonomy.taxeditor.preference.Resources;
29 32
import eu.etaxonomy.taxeditor.store.StoreUtil;
......
44 47
 * @created Mar 16, 2010
45 48
 * @version 1.0
46 49
 */
47
public class EnumComboElement<T extends IDefinedTerm> extends
50
public class EnumComboElement<T extends IEnumTerm> extends
48 51
		AbstractCdmFormElement implements SelectionListener,
49 52
		IEnableableFormElement, ISelectable {
50 53

  
......
84 87
				return ReferenceType.class;
85 88
			}
86 89
			
90
		},
91
		new CdmEnumDataHolder<SpecimenOrObservationType>(){
92

  
93
			@Override
94
			public String getName() {
95
				return "Specimen / Observation Type";
96
			}
97

  
98
			@Override
99
			public Collection<SpecimenOrObservationType> getElements() {
100
				return Arrays.asList(SpecimenOrObservationType.values());
101
			}
102

  
103
			@Override
104
			public Class<SpecimenOrObservationType> getClazz() {
105
				return SpecimenOrObservationType.class;
106
			}
107
			
108
		},
109
		new CdmEnumDataHolder<OriginalSourceType>(){
110

  
111
			@Override
112
			public String getName() {
113
				return "Original Source Type";
114
			}
115

  
116
			@Override
117
			public Collection<OriginalSourceType> getElements() {
118
				return Arrays.asList(OriginalSourceType.values());
119
			}
120

  
121
			@Override
122
			public Class<OriginalSourceType> getClazz() {
123
				return OriginalSourceType.class;
124
			}
125
			
87 126
		}
127
		
88 128
	};
89 129
	
90 130
	private static final int DEFAULT_VISIBLE_ITEMS = 10;
......
135 175
	private String getDefaultLabelString() {
136 176
		if(enumType.equals(ReferenceType.class)){
137 177
			return "Reference Type";
138
		}else if (enumType.equals(NomenclaturalCode.class)){
178
		} else if (enumType.equals(NomenclaturalCode.class)){
139 179
			return "Nomenclatural Code";
180
		} else if(enumType.equals(OriginalSourceType.class)) {
181
			return "Orig. Source Type";
182
		} else if(enumType.equals(SpecimenOrObservationType.class)) {
183
			return "Spec./Obs. Type";
140 184
		}
141 185
		return "No Label";
142 186
	}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
54 54
import eu.etaxonomy.cdm.model.common.Group;
55 55
import eu.etaxonomy.cdm.model.common.ICdmBase;
56 56
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
57
import eu.etaxonomy.cdm.model.common.IEnumTerm;
57 58
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
58 59
import eu.etaxonomy.cdm.model.common.Language;
59 60
import eu.etaxonomy.cdm.model.common.LanguageString;
60 61
import eu.etaxonomy.cdm.model.common.Marker;
62
import eu.etaxonomy.cdm.model.common.TermType;
61 63
import eu.etaxonomy.cdm.model.common.TimePeriod;
62 64
import eu.etaxonomy.cdm.model.common.User;
63 65
import eu.etaxonomy.cdm.model.common.VersionableEntity;
......
811 813
	 * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
812 814
	 *         object.
813 815
	 */
814
	public <T extends IDefinedTerm> EnumComboElement<T> createEnumComboElement(
816
	public <T extends IEnumTerm> EnumComboElement<T> createEnumComboElement(
815 817
			Class<T> enumComboType, ICdmFormElement parentElement,
816 818
			int style) {
817 819
		EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
......
2021 2023
			element = new IdentifiableSourceElement(this, parentElement,
2022 2024
					(IdentifiableSource) entity, removeListener, style);
2023 2025
		} else if (entity instanceof DefinedTerm) {
2024
			//FIXME:3.3MC
2025
			element = new ScopeElement(this, parentElement, (DefinedTerm) entity,
2026
					removeListener, style);
2027
		} else if (entity instanceof DefinedTerm) {
2028
			element = new ModifierElement(this, parentElement,
2029
					(DefinedTerm) entity, removeListener, style);
2026
			switch(((DefinedTerm)entity).getTermType()) {
2027
				case Scope:
2028
					element = new ScopeElement(this, 
2029
							parentElement, 
2030
							(DefinedTerm) entity,
2031
							removeListener, 
2032
							style);
2033
					break;
2034
				case Modifier:
2035
					element = new ModifierElement(this, 
2036
							parentElement,
2037
							(DefinedTerm) entity, 
2038
							removeListener, 
2039
							style);
2040
					break;
2041
				default:
2042
					//FIXME : Actually we should through an exception here
2043
					element = null;
2044
					break;
2045
			
2046
			}
2030 2047
		} else if (entity instanceof Reference) {
2031 2048
			element = new DescriptionSourceElement(this, parentElement,
2032 2049
					(Reference) entity, removeListener, style);
......
2047 2064
					parentElement, (StatisticalMeasurementValue) entity,
2048 2065
					removeListener, style);
2049 2066
		} else if (entity instanceof DerivedUnit) {
2050
			//FIXME:3.3MC
2051
			element = new DerivedUnitElement(this, parentElement,
2052
					(DerivedUnit) entity, removeListener, style);
2067
			switch(((DerivedUnit)entity).getRecordBasis()) {
2068
				case LivingSpecimen:
2069
				case PreservedSpecimen:
2070
				case OtherSpecimen:
2071
					element = new SpecimenCollectionDetailElement(this, 
2072
								parentElement,
2073
								(DerivedUnit) entity, 
2074
								removeListener, 
2075
								style);
2076
					break;
2077
				default:
2078
					element = new DerivedUnitElement(this, 
2079
								parentElement,
2080
								(DerivedUnit) entity, 
2081
								removeListener, 
2082
								style);
2083
			}			
2084

  
2053 2085
		} else if (entity instanceof NamedArea) {
2054 2086
			element = new NamedAreaDetailElement(this, parentElement,
2055 2087
					(NamedArea) entity, removeListener, style);
2056 2088
		} else if (entity instanceof DeterminationEvent) {
2057 2089
			element = new DeterminationEventDetailElement(this, parentElement,
2058 2090
					(DeterminationEvent) entity, removeListener, style);			
2059
		} else if (entity instanceof DerivedUnit) {
2060
			//FIXME:3.3MC
2061
			element = new SpecimenCollectionDetailElement(this, parentElement,
2062
					(DerivedUnit) entity, removeListener, style);
2063 2091
		} else if (entity instanceof User) {
2064 2092
			element = new MemberDetailElement(this, parentElement,
2065 2093
					(User) entity, removeListener, style);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/DateDetailSection.java
146 146
		} else if (eventSource == text_parseText) {
147 147
			cursorPosition = ((Text) text_parseText.getMainControl())
148 148
					.getCaretPosition();
149
			setEntityInternally(TimePeriod.parseString(text_parseText.getText()));
149
			//FIXME:3.3MC----
150
			//setEntityInternally(TimePeriod.parseString(text_parseText.getText()));
151
			//FIXME:3.3MC----
150 152
		} else if (eventSource == text_freeText) {
151 153
			getEntity().setFreeText(text_freeText.getText());
152 154
		}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java
82 82
	 *
83 83
	 * @return a {@link java.lang.Float} object.
84 84
	 */
85
	public Float getDouble(){
85
	public Double getDouble(){
86 86
		String text = super.getText();
87
		return new Float(text);
87
		return new Double(text);
88 88
	}
89 89
	
90 90
	private String getStringRepresentation(Object number){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java
145 145

  
146 146
	private void createControls(Composite parent, int style) {
147 147

  
148
		label = formFactory.createLabel(getLayoutComposite(), labelString,
148
		label = formFactory.createLabel(getLayoutComposite(), labelString + " : ",
149 149
				SWT.NULL);
150 150

  
151 151
		addControl(label);
......
442 442
	@Override
443 443
	public String getLabel() {
444 444
		if (label != null) {
445
			return label.getText();
445
			return label.getText() + " : ";
446 446
		}
447 447
		return null;
448 448
	}

Also available in: Unified diff