Refactoring of selection elements. Additional minor refactoring. Fixed a bug with...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / LabelElement.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.element;
12
13 import org.eclipse.swt.SWT;
14 import org.eclipse.swt.widgets.Label;
15
16 import eu.etaxonomy.cdm.common.CdmUtils;
17
18 /**
19 * <p>LabelElement class.</p>
20 *
21 * @author n.hoffmann
22 * @created Jun 1, 2010
23 * @version 1.0
24 */
25 public class LabelElement extends AbstractCdmFormElement {
26
27 private Label label;
28
29 /**
30 * <p>Constructor for LabelElement.</p>
31 *
32 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
33 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
34 * @param text a {@link java.lang.String} object.
35 */
36 public LabelElement(CdmFormFactory formFactory, ICdmFormElement formElement, String text) {
37 super(formFactory, formElement);
38
39 label = formFactory.createLabel(getLayoutComposite(), text, SWT.WRAP);
40 label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
41 addControl(label);
42 }
43
44 /**
45 * <p>setText</p>
46 *
47 * @param text a {@link java.lang.String} object.
48 */
49 public void setText(String text) {
50 label.setText(CdmUtils.Nz(text));
51 }
52 }