Merge branch 'release/4.6.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / grantedAuthority / GrantedAuthorityDetailElement.java
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 eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
13 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
14 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
15 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
16 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
17
18 /**
19 * @author n.hoffmann
20 * @author a.kohlbecker
21 * @created Mar 9, 2011
22 * @version 1.0
23 */
24 public class GrantedAuthorityDetailElement extends AbstractCdmDetailElement<GrantedAuthorityImpl> {
25
26 private TextWithLabelElement text_authority;
27
28 /**
29 * @param formFactory
30 * @param formElement
31 */
32 public GrantedAuthorityDetailElement(CdmFormFactory formFactory,
33 ICdmFormElement formElement) {
34 super(formFactory, formElement);
35 }
36
37 @Override
38 protected void createControls(ICdmFormElement formElement,
39 GrantedAuthorityImpl entity, int style) {
40
41 String labelText = null;
42 if (entity.getAuthority() != null){
43 labelText = GrantedAuthorityLabelTextProvider.getText(entity);
44 }
45 text_authority = formFactory.createTextWithLabelElement(formElement, "Authority", null, style);
46
47 }
48
49 @Override
50 public void handleEvent(Object eventSource) {
51 if(eventSource == text_authority){
52 getEntity().setAuthority(text_authority.getText());
53 }
54
55 }
56
57
58
59 }