Project

General

Profile

Download (1.87 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.ui.section.occurrence;
11

    
12
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
13
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
14
import eu.etaxonomy.cdm.model.occurrence.OccurrenceStatus;
15
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
16
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
20

    
21
/**
22
 * @author n.hoffmann
23
 * @created Dec 17, 2010
24
 * @version 1.0
25
 */
26
public class DerivedUnitGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
27

    
28
	public DerivedUnitGeneralWizardPage(CdmFormFactory formFactory, DerivedUnitFacade entity) {
29
		super(formFactory, entity);
30
		setTitle("General Specimen Data");
31
	}
32

    
33
	@Override
34
	protected void checkComplete() {
35
		SpecimenOrObservationBase<?> baseUnit = this.entity.baseUnit();
36
		boolean complete = true;
37
		if (baseUnit instanceof DerivedUnit) {
38
			for (OccurrenceStatus status :((DerivedUnit)baseUnit).getStatus()) {
39
				if (status.getType() == null) {
40
					complete = false;
41
					break;
42
				}
43
			}
44
		}
45
		setPageComplete(complete);
46
	}
47

    
48
	@Override
49
	public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
50
		DerivedUnitGeneralDetailElement detailElement = formFactory.createDerivedUnitGeneralDetailElement(rootElement);
51
		detailElement.setShowSpecimenType(false);
52
		detailElement.setShowOnlyDerivedUnitData(false);
53
		detailElement.setEntity(getEntity());
54
		checkComplete();
55
		return detailElement;
56
	}
57

    
58
}
(14-14/38)