-// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.ui.element;
+import org.eclipse.jface.resource.FontDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.TableWrapData;
*/
public LabelElement(CdmFormFactory formFactory, ICdmFormElement formElement, String text) {
super(formFactory, formElement);
-
+
label = formFactory.createLabel(getLayoutComposite(), text, SWT.WRAP);
label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(label);
* @param text a {@link java.lang.String} object.
*/
public void setText(String text) {
+ String pattern = "(.*[^&])&([^&].*)";
+ if(text.matches(pattern)){
+ text = text.replaceAll(pattern, "$1&&$2");
+ }
label.setText(CdmUtils.Nz(text));
}
-
+
public void setLayout(TableWrapData layoutConstants){
label.setLayoutData(layoutConstants);
}
-
+
+
+
public void setForeground(Color color){
label.setForeground(color);
}
+
+ public void setVisible(boolean setVisible){
+ label.setVisible(setVisible);
+ }
+
+ public boolean isDisposed(){
+ return label.isDisposed();
+ }
+
+ public void setBold(){
+ FontDescriptor boldDescriptor = FontDescriptor.createFrom(label.getFont()).setStyle(SWT.BOLD);
+ Font boldFont = boldDescriptor.createFont(label.getDisplay());
+ label.setFont( boldFont );
+ }
}