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.element;
|
11
|
|
12
|
import org.eclipse.swt.SWT;
|
13
|
import org.eclipse.swt.graphics.Color;
|
14
|
import org.eclipse.swt.graphics.FontData;
|
15
|
import org.eclipse.swt.widgets.Label;
|
16
|
import org.eclipse.ui.forms.widgets.TableWrapData;
|
17
|
|
18
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
19
|
|
20
|
/**
|
21
|
* <p>LabelElement class.</p>
|
22
|
*
|
23
|
* @author n.hoffmann
|
24
|
* @created Jun 1, 2010
|
25
|
* @version 1.0
|
26
|
*/
|
27
|
public class LabelElement extends AbstractCdmFormElement {
|
28
|
|
29
|
private Label label;
|
30
|
|
31
|
/**
|
32
|
* <p>Constructor for LabelElement.</p>
|
33
|
*
|
34
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
35
|
* @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
36
|
* @param text a {@link java.lang.String} object.
|
37
|
*/
|
38
|
public LabelElement(CdmFormFactory formFactory, ICdmFormElement formElement, String text) {
|
39
|
super(formFactory, formElement);
|
40
|
|
41
|
label = formFactory.createLabel(getLayoutComposite(), text, SWT.WRAP);
|
42
|
label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
|
43
|
addControl(label);
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* <p>setText</p>
|
48
|
*
|
49
|
* @param text a {@link java.lang.String} object.
|
50
|
*/
|
51
|
public void setText(String text) {
|
52
|
label.setText(CdmUtils.Nz(text));
|
53
|
}
|
54
|
|
55
|
public void setLayout(TableWrapData layoutConstants){
|
56
|
label.setLayoutData(layoutConstants);
|
57
|
}
|
58
|
|
59
|
public void setForeground(Color color){
|
60
|
label.setForeground(color);
|
61
|
}
|
62
|
|
63
|
public void setVisible(boolean setVisible){
|
64
|
label.setVisible(setVisible);
|
65
|
}
|
66
|
}
|