Project

General

Profile

« Previous | Next » 

Revision 842781d0

Added by Niels Hoffmann over 12 years ago

Fixes the specimen part of #2607. Minor layout fixes.

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DerivedUnitElement.java
18 18
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
19 19
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
20 20
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
21
import eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement;
22 21
import eu.etaxonomy.taxeditor.ui.selection.DerivedUnitBaseSelectionElement;
23 22

  
24 23
/**
......
33 32
public class DerivedUnitElement extends
34 33
		AbstractEntityCollectionElement<SpecimenOrObservationBase> {
35 34

  
36
	private AbstractSelectionElement selection_derivedUnit;
35
	private DerivedUnitBaseSelectionElement selection_derivedUnit;
37 36

  
38 37
	/**
39 38
	 * <p>
......
71 70
	/** {@inheritDoc} */
72 71
	@Override
73 72
	public void createControls(ICdmFormElement element, int style) {
74
		selection_derivedUnit = formFactory.createSelectionElement(
73
		selection_derivedUnit = (DerivedUnitBaseSelectionElement) formFactory.createSelectionElement(
75 74
				SelectionType.DERIVED_UNIT, getConversationHolder(), element,
76
				"Specimen", null, DerivedUnitBaseSelectionElement.DEFAULT,
75
				"Specimen", null, DerivedUnitBaseSelectionElement.SELECTABLE | DerivedUnitBaseSelectionElement.EDITABLE,
77 76
				style);
78 77
	}
79 78

  
......
87 86
	/** {@inheritDoc} */
88 87
	@Override
89 88
	public void handleEvent(Object eventSource) {
90

  
89
		if(eventSource == selection_derivedUnit){
90
			setEntity(selection_derivedUnit.getSelection());
91
		}
91 92
	}
92 93

  
93 94
	/** {@inheritDoc} */
94 95
	@Override
95 96
	public void setEntity(SpecimenOrObservationBase entity) {
96

  
97
		this.entity = entity;
97 98
	}
99

  
98 100
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescribedSpecimenSection.java
15 15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 16
import eu.etaxonomy.cdm.model.description.TaxonDescription;
17 17
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
18
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
18 19
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
20
import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.DerivedUnitSelectionDialog;
19 21
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
20 22
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
21 23
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
......
53 55
	/** {@inheritDoc} */
54 56
	@Override
55 57
	public SpecimenOrObservationBase createNewElement() {
56
		return DerivedUnit.NewInstance();
58
		DerivedUnitBase selection = DerivedUnitSelectionDialog.select(getShell(), getConversationHolder(), null);
59
		return selection;
57 60
	}
58 61

  
59 62
	/** {@inheritDoc} */
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java
53 53
	public AbstractCdmDetailElement createElement(ICdmFormElement rootElement) {
54 54
		GeneralDetailElement detailElement = (GeneralDetailElement) formFactory.createCdmDetailElement(DetailType.DERIVED_UNIT_GENERAL, rootElement, SWT.NULL);
55 55
		detailElement.setEntity(getEntity());
56
		checkComplete();
56 57
		return detailElement;
57 58
	}
58 59

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailElement.java
85 85
		selection_derivedUnit = (DerivedUnitBaseSelectionElement) formFactory
86 86
				.createSelectionElement(SelectionType.DERIVED_UNIT,
87 87
						getConversationHolder(), element, "Derived Unit", null,
88
						DerivedUnitBaseSelectionElement.DEFAULT, style);
88
						DerivedUnitBaseSelectionElement.EDITABLE | DerivedUnitBaseSelectionElement.SELECTABLE, style);
89 89
	}
90 90

  
91 91
	/*

Also available in: Unified diff