Project

General

Profile

Download (2.25 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.section.supplemental;
5

    
6
import java.util.Collection;
7

    
8
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
9
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
10
import eu.etaxonomy.cdm.model.media.Rights;
11
import eu.etaxonomy.taxeditor.ui.dialog.selection.RightsSelectionDialog;
12
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
13
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
14
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
15

    
16
/**
17
 * <p>RightsSection class.</p>
18
 *
19
 * @author nho
20
 * @version $Id: $
21
 */
22
public class RightsSection extends AbstractEntityCollectionSection<IdentifiableEntity, Rights> {
23

    
24
	/**
25
	 * <p>Constructor for RightsSection.</p>
26
	 *
27
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
28
	 * @param style a int.
29
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
30
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
31
	 */
32
	public RightsSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
33
		super(cdmFormFactory, conversation, parentElement, "Rights", style);
34
	}
35

    
36
	/** {@inheritDoc} */
37
	@Override
38
	public Rights createNewElement() {
39
		return Rights.NewInstance();
40
	}
41

    
42
	/** {@inheritDoc} */
43
	@Override
44
	public Collection<Rights> getCollection(IdentifiableEntity entity) {
45
		return entity.getRights();
46
	}
47

    
48
	/** {@inheritDoc} */
49
	@Override
50
	public String getEmptyString() {
51
		return "No rights yet.";
52
	}
53

    
54
	/** {@inheritDoc} */
55
	@Override
56
	protected String getTooltipString() {
57
		// TODO Auto-generated method stub
58
		return "Create new rights.";
59
	}
60

    
61
	/** {@inheritDoc} */
62
	@Override
63
	public void addElement(Rights element) {
64
		getEntity().addRights(element);
65
	}
66

    
67
	/** {@inheritDoc} */
68
	@Override
69
	public void removeElement(Rights element) {
70
		getEntity().removeRights(element);
71
	}
72

    
73
    /**
74
     * {@inheritDoc}
75
     */
76
    @Override
77
    public Rights addExisting() {
78
        return RightsSelectionDialog.select(getShell(), //getConversationHolder(),
79
                null);
80
    }
81

    
82
    /**
83
     * {@inheritDoc}
84
     */
85
    @Override
86
    public boolean allowAddExisting() {
87
        return true;
88
    }
89

    
90

    
91

    
92

    
93
}
(16-16/19)