Project

General

Profile

Download (2.07 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
package eu.etaxonomy.taxeditor.ui.section.description;
10

    
11
import java.util.Collection;
12
import java.util.Comparator;
13

    
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.model.description.CategoricalData;
16
import eu.etaxonomy.cdm.model.description.StateData;
17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
20
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
21
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
22

    
23
/**
24
 * @author n.hoffmann
25
 * @created Sep 15, 2010
26
 */
27
public class StateDataSection extends AbstractEntityCollectionSection<CategoricalData, StateData> implements IEnableableFormElement {
28

    
29
	public StateDataSection(CdmFormFactory formFactory,
30
			ConversationHolder conversation, ICdmFormElement parentElement,
31
			int style) {
32
		super(formFactory, conversation, parentElement, "State Data", style);
33
	}
34

    
35
	@Override
36
	public Collection<StateData> getCollection(CategoricalData entity) {
37
		return entity.getStateData();
38
	}
39

    
40
	@Override
41
	public Comparator<StateData> getComparator() {
42
        return new DefaultCdmBaseComparator<>();
43
	}
44

    
45
	@Override
46
	public StateData createNewElement() {
47
		return StateData.NewInstance();
48
	}
49

    
50
	@Override
51
	public void addElement(StateData element) {
52
		getEntity().addStateData(element);
53
	}
54

    
55
	@Override
56
	public void removeElement(StateData element) {
57
		getEntity().removeStateData(element);
58
	}
59

    
60
	@Override
61
	public String getEmptyString() {
62
		return "No state data yet.";
63
	}
64

    
65
	@Override
66
	protected String getTooltipString() {
67
		return "Create new state data";
68
	}
69

    
70
    @Override
71
    public StateData addExisting() {
72
        return null;
73
    }
74

    
75
    @Override
76
    public boolean allowAddExisting() {
77
        return false;
78
    }
79
}
(24-24/26)