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