Project

General

Profile

Download (3.25 KB) Statistics
| Branch: | Tag: | Revision:
1 a60842d7 n.hoffmann
/**
2 3878a377 n.hoffmann
 * Copyright (C) 2007 EDIT
3 f5b66699 Patrick Plitzner
 * European Distributed Institute of Taxonomy
4 3878a377 n.hoffmann
 * http://www.e-taxonomy.eu
5 f5b66699 Patrick Plitzner
 *
6 3878a377 n.hoffmann
 * 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 a60842d7 n.hoffmann
10 30a27c33 Andreas Kohlbecker
package eu.etaxonomy.taxeditor.ui.section.grantedAuthority;
11 a60842d7 n.hoffmann
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 28b3f4aa Andreas Kohlbecker
import eu.etaxonomy.taxeditor.ui.dialog.selection.GrantedAuthoritySelectionDialog;
19 78222507 n.hoffmann
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20 dacb59c9 Patric Plitzner
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21 a60842d7 n.hoffmann
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
22
23
/**
24
 * @author n.hoffmann
25
 * @created Mar 9, 2011
26
 * @version 1.0
27
 */
28 3878a377 n.hoffmann
public class GrantedAuthorityDetailSection extends
29
		AbstractEntityCollectionSection<Group, GrantedAuthority> {
30 a60842d7 n.hoffmann
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 3878a377 n.hoffmann
		super(formFactory, conversation, parentElement, "Granted Authorities",
42
				style);
43 a60842d7 n.hoffmann
	}
44
45 3878a377 n.hoffmann
	/*
46
	 * (non-Javadoc)
47 f5b66699 Patrick Plitzner
	 *
48 3878a377 n.hoffmann
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
49
	 * getCollection(java.lang.Object)
50 a60842d7 n.hoffmann
	 */
51
	@Override
52
	public Collection<GrantedAuthority> getCollection(Group entity) {
53
		return entity.getGrantedAuthorities();
54
	}
55
56 3878a377 n.hoffmann
	/*
57
	 * (non-Javadoc)
58 f5b66699 Patrick Plitzner
	 *
59 3878a377 n.hoffmann
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
60
	 * createNewElement()
61 a60842d7 n.hoffmann
	 */
62
	@Override
63
	public GrantedAuthority createNewElement() {
64 28b3f4aa Andreas Kohlbecker
//		StoreUtil
65
//				.warningDialog("Not implemented yet", getClass(),
66
//						"This functionality needs to be implemented in CDM Library first.");
67 f5b66699 Patrick Plitzner
68 28b3f4aa Andreas Kohlbecker
		GrantedAuthority selection = GrantedAuthoritySelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
69 a60842d7 n.hoffmann
		return selection;
70
	}
71
72 3878a377 n.hoffmann
	/*
73
	 * (non-Javadoc)
74 f5b66699 Patrick Plitzner
	 *
75 3878a377 n.hoffmann
	 * @see
76
	 * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement
77
	 * (java.lang.Object)
78 a60842d7 n.hoffmann
	 */
79
	@Override
80
	public void addElement(GrantedAuthority element) {
81
		getEntity().addGrantedAuthority(element);
82
	}
83
84 3878a377 n.hoffmann
	/*
85
	 * (non-Javadoc)
86 f5b66699 Patrick Plitzner
	 *
87 3878a377 n.hoffmann
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
88
	 * removeElement(java.lang.Object)
89 a60842d7 n.hoffmann
	 */
90
	@Override
91
	public void removeElement(GrantedAuthority element) {
92
		getEntity().removeGrantedAuthority(element);
93
	}
94
95 3878a377 n.hoffmann
	/*
96
	 * (non-Javadoc)
97 f5b66699 Patrick Plitzner
	 *
98 3878a377 n.hoffmann
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
99
	 * getEmptyString()
100 a60842d7 n.hoffmann
	 */
101
	@Override
102
	public String getEmptyString() {
103 28b3f4aa Andreas Kohlbecker
		return "No Granted Authorities yet.";
104 a60842d7 n.hoffmann
	}
105
106 3878a377 n.hoffmann
	/*
107
	 * (non-Javadoc)
108 f5b66699 Patrick Plitzner
	 *
109 3878a377 n.hoffmann
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
110
	 * getTooltipString()
111 a60842d7 n.hoffmann
	 */
112
	@Override
113
	protected String getTooltipString() {
114
		return "Add a Granted Authority";
115
	}
116
117 f5b66699 Patrick Plitzner
    /**
118
     * {@inheritDoc}
119
     */
120
    @Override
121
    public GrantedAuthority addExisting() {
122 a789364c Katja Luther
        System.err.println("Test");
123 f5b66699 Patrick Plitzner
        return null;
124
    }
125
126
    /**
127
     * {@inheritDoc}
128
     */
129
    @Override
130
    public boolean allowAddExisting() {
131
        return false;
132
    }
133
134 a60842d7 n.hoffmann
}