Project

General

Profile

Download (3.22 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.grantedAuthority;
11

    
12
import java.util.Collection;
13

    
14
import org.springframework.security.core.GrantedAuthority;
15

    
16
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17
import eu.etaxonomy.cdm.model.common.Group;
18
import eu.etaxonomy.taxeditor.ui.dialog.selection.GrantedAuthoritySelectionDialog;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
22

    
23
/**
24
 * @author n.hoffmann
25
 * @created Mar 9, 2011
26
 * @version 1.0
27
 */
28
public class GrantedAuthorityDetailSection extends
29
		AbstractEntityCollectionSection<Group, GrantedAuthority> {
30

    
31
	/**
32
	 * @param formFactory
33
	 * @param conversation
34
	 * @param parentElement
35
	 * @param title
36
	 * @param style
37
	 */
38
	public GrantedAuthorityDetailSection(CdmFormFactory formFactory,
39
			ConversationHolder conversation, ICdmFormElement parentElement,
40
			int style) {
41
		super(formFactory, conversation, parentElement, "Granted Authorities",
42
				style);
43
	}
44

    
45
	/*
46
	 * (non-Javadoc)
47
	 *
48
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
49
	 * getCollection(java.lang.Object)
50
	 */
51
	@Override
52
	public Collection<GrantedAuthority> getCollection(Group entity) {
53
		return entity.getGrantedAuthorities();
54
	}
55

    
56
	/*
57
	 * (non-Javadoc)
58
	 *
59
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
60
	 * createNewElement()
61
	 */
62
	@Override
63
	public GrantedAuthority createNewElement() {
64
//		StoreUtil
65
//				.warningDialog("Not implemented yet", getClass(),
66
//						"This functionality needs to be implemented in CDM Library first.");
67

    
68
		GrantedAuthority selection = GrantedAuthoritySelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
69
		return selection;
70
	}
71

    
72
	/*
73
	 * (non-Javadoc)
74
	 *
75
	 * @see
76
	 * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement
77
	 * (java.lang.Object)
78
	 */
79
	@Override
80
	public void addElement(GrantedAuthority element) {
81
		getEntity().addGrantedAuthority(element);
82
	}
83

    
84
	/*
85
	 * (non-Javadoc)
86
	 *
87
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
88
	 * removeElement(java.lang.Object)
89
	 */
90
	@Override
91
	public void removeElement(GrantedAuthority element) {
92
		getEntity().removeGrantedAuthority(element);
93
	}
94

    
95
	/*
96
	 * (non-Javadoc)
97
	 *
98
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
99
	 * getEmptyString()
100
	 */
101
	@Override
102
	public String getEmptyString() {
103
		return "No Granted Authorities yet.";
104
	}
105

    
106
	/*
107
	 * (non-Javadoc)
108
	 *
109
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
110
	 * getTooltipString()
111
	 */
112
	@Override
113
	protected String getTooltipString() {
114
		return "Add a Granted Authority";
115
	}
116

    
117
    /**
118
     * {@inheritDoc}
119
     */
120
    @Override
121
    public GrantedAuthority addExisting() {
122
      
123
        return null;
124
    }
125

    
126
    /**
127
     * {@inheritDoc}
128
     */
129
    @Override
130
    public boolean allowAddExisting() {
131
        return false;
132
    }
133

    
134
}
(3-3/5)