1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.ui.section.occurrence;
|
12
|
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.events.SelectionListener;
|
15
|
import org.eclipse.swt.graphics.Color;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
18
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
19
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
23
|
|
24
|
/**
|
25
|
* <p>DeterminationEventDetailSection class.</p>
|
26
|
*
|
27
|
* @author n.hoffmann
|
28
|
* @created Oct 13, 2010
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public abstract class AbstractDeterminationEventDetailSection extends
|
32
|
AbstractEntityCollectionSection<DerivedUnitFacade, DeterminationEvent> {
|
33
|
|
34
|
/**
|
35
|
* @param formFactory
|
36
|
* @param conversation
|
37
|
* @param parentElement
|
38
|
* @param title
|
39
|
* @param style
|
40
|
*/
|
41
|
public AbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
|
42
|
ConversationHolder conversation, ICdmFormElement parentElement,
|
43
|
String title, int style) {
|
44
|
super(formFactory, conversation, parentElement, title, style);
|
45
|
}
|
46
|
|
47
|
/* (non-Javadoc)
|
48
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
|
49
|
*/
|
50
|
/** {@inheritDoc} */
|
51
|
@Override
|
52
|
public DeterminationEvent createNewElement() {
|
53
|
DeterminationEvent instance = DeterminationEvent.NewInstance();
|
54
|
instance.setIdentifiedUnit(getEntity().innerDerivedUnit());
|
55
|
return instance;
|
56
|
}
|
57
|
|
58
|
/* (non-Javadoc)
|
59
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
60
|
*/
|
61
|
/** {@inheritDoc} */
|
62
|
@Override
|
63
|
public void addElement(DeterminationEvent determination) {
|
64
|
getEntity().addDetermination(determination);
|
65
|
}
|
66
|
|
67
|
/* (non-Javadoc)
|
68
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
|
69
|
*/
|
70
|
/** {@inheritDoc} */
|
71
|
@Override
|
72
|
public void removeElement(DeterminationEvent determination) {
|
73
|
getEntity().removeDetermination(determination);
|
74
|
}
|
75
|
|
76
|
/* (non-Javadoc)
|
77
|
* @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
|
78
|
*/
|
79
|
/** {@inheritDoc} */
|
80
|
@Override
|
81
|
public String getEmptyString() {
|
82
|
return "No determinations yet.";
|
83
|
}
|
84
|
|
85
|
/* (non-Javadoc)
|
86
|
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createElementComposite(java.lang.Object, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.graphics.Color)
|
87
|
*/
|
88
|
@Override
|
89
|
protected void createElementComposite(DeterminationEvent element, SelectionListener removeListener, Color backgroundColor) {
|
90
|
formFactory.createDeterminationEventDetailElementComposite(this, element, removeListener, backgroundColor, SWT.NULL);
|
91
|
}
|
92
|
|
93
|
}
|