Project

General

Profile

Download (1.7 KB) Statistics
| Branch: | Tag: | Revision:
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.graphics.Color;
15
import org.eclipse.swt.graphics.FontData;
16
import org.eclipse.swt.widgets.Label;
17
import org.eclipse.ui.forms.widgets.TableWrapData;
18

    
19
import eu.etaxonomy.cdm.common.CdmUtils;
20

    
21
/**
22
 * <p>LabelElement class.</p>
23
 *
24
 * @author n.hoffmann
25
 * @created Jun 1, 2010
26
 * @version 1.0
27
 */
28
public class LabelElement extends AbstractCdmFormElement {
29

    
30
	private Label label;
31

    
32
	/**
33
	 * <p>Constructor for LabelElement.</p>
34
	 *
35
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
36
	 * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
37
	 * @param text a {@link java.lang.String} object.
38
	 */
39
	public LabelElement(CdmFormFactory formFactory, ICdmFormElement formElement, String text) {
40
		super(formFactory, formElement);
41
		
42
		label = formFactory.createLabel(getLayoutComposite(), text, SWT.WRAP);
43
		label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
44
		addControl(label);
45
	}
46

    
47
	/**
48
	 * <p>setText</p>
49
	 *
50
	 * @param text a {@link java.lang.String} object.
51
	 */
52
	public void setText(String text) {
53
		label.setText(CdmUtils.Nz(text));
54
	}
55
	
56
	public void setLayout(TableWrapData layoutConstants){
57
		label.setLayoutData(layoutConstants);
58
	}
59
	
60
	public void setForeground(Color color){
61
		label.setForeground(color);
62
	}
63
	
64
	public void setVisible(boolean setVisible){
65
		label.setVisible(setVisible);
66
	}
67
}
(26-26/44)