merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / grantedAuthority / GrantedAuthorityCollectionElement.java
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
15 import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
16 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
17 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
18 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
20 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
21
22 /**
23 * @author a.kohlbecker
24 * @date Sept 12 2012
25 *
26 */
27 public class GrantedAuthorityCollectionElement extends AbstractEntityCollectionElement<GrantedAuthorityImpl> {
28
29 private EntitySelectionElement<GrantedAuthorityImpl> selection_authority;
30
31
32 public GrantedAuthorityCollectionElement(CdmFormFactory formFactory,
33 AbstractFormSection section, GrantedAuthorityImpl entity,
34 SelectionListener removeListener, int style) {
35 super(formFactory, section, entity, removeListener, null, style);
36 // TODO Auto-generated constructor stub
37 }
38
39 /* (non-Javadoc)
40 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
41 */
42 @Override
43 public void setEntity(GrantedAuthorityImpl entity) {
44 selection_authority.setEntity(entity);
45
46 }
47
48 /* (non-Javadoc)
49 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, int)
50 */
51 @Override
52 public void createControls(ICdmFormElement element, int style) {
53 selection_authority = formFactory.createSelectionElement(
54 GrantedAuthorityImpl.class, getConversationHolder(), element, "", getEntity(), EntitySelectionElement.SELECTABLE, style);
55 }
56
57 /* (non-Javadoc)
58 * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
59 */
60 @Override
61 public void handleEvent(Object eventSource) {
62 if (eventSource == selection_authority) {
63 setEntity(selection_authority.getEntity());
64 }
65 }
66
67
68 }