Project

General

Profile

Download (2.3 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2012 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.grantedAuthority;
12

    
13
import org.eclipse.swt.events.SelectionListener;
14
import org.eclipse.swt.graphics.Color;
15

    
16
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
17
import eu.etaxonomy.cdm.model.common.Group;
18
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
22
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
23

    
24
/**
25
 * @author a.kohlbecker
26
 * @date Sept 12 2012
27
 *
28
 */
29
public class GrantedAuthorityCollectionElement extends AbstractEntityCollectionElement<GrantedAuthorityImpl> {
30
	
31
	private EntitySelectionElement<GrantedAuthorityImpl> selection_authority;
32

    
33

    
34
	public GrantedAuthorityCollectionElement(CdmFormFactory formFactory,
35
			AbstractFormSection section, GrantedAuthorityImpl entity,
36
			SelectionListener removeListener, int style) {
37
		super(formFactory, section, entity, removeListener, null, style);		
38
		// TODO Auto-generated constructor stub
39
	}
40

    
41
	/* (non-Javadoc)
42
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
43
	 */
44
	@Override
45
	public void setEntity(GrantedAuthorityImpl entity) {
46
		selection_authority.setEntity(entity);
47
		
48
	}
49

    
50
	/* (non-Javadoc)
51
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, int)
52
	 */
53
	@Override
54
	public void createControls(ICdmFormElement element, int style) {
55
		selection_authority = formFactory.createSelectionElement(
56
					GrantedAuthorityImpl.class, getConversationHolder(), element, "", getEntity(), EntitySelectionElement.SELECTABLE, style);
57
	}
58

    
59
	/* (non-Javadoc)
60
	 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
61
	 */
62
	@Override
63
	public void handleEvent(Object eventSource) {
64
		if (eventSource == selection_authority) {
65
			setEntity(selection_authority.getEntity());
66
		}
67
	}
68

    
69

    
70
}
(1-1/4)