Project

General

Profile

Download (2.9 KB) Statistics
| Branch: | Tag: | Revision:
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.group;
12

    
13
import java.util.Collection;
14

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

    
17
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18
import eu.etaxonomy.cdm.model.common.Group;
19
import eu.etaxonomy.taxeditor.store.StoreUtil;
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
 * @author n.hoffmann
26
 * @created Mar 9, 2011
27
 * @version 1.0
28
 */
29
public class GrantedAuthorityDetailSection extends
30
		AbstractEntityCollectionSection<Group, GrantedAuthority> {
31

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

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

    
57
	/*
58
	 * (non-Javadoc)
59
	 * 
60
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
61
	 * createNewElement()
62
	 */
63
	@Override
64
	public GrantedAuthority createNewElement() {
65
		StoreUtil
66
				.warningDialog("Not implemented yet", getClass(),
67
						"This functionality needs to be implemented in CDM Library first.");
68
		// TODO GrantedAuthoritySelectionDialog.select(...);
69
		GrantedAuthority selection = null;
70
		return selection;
71
	}
72

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

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

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

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

    
118
}
(2-2/7)