cleanup
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / LabelElement.java
index 7f8b769e162c9ef40d39177802b6895cbd0d17b3..4e5183abbee1bf0b06d716cb5227ebebcc828385 100644 (file)
@@ -1,20 +1,22 @@
-// $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.Font;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.TableWrapData;
 
 import eu.etaxonomy.cdm.common.CdmUtils;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 
 /**
  * <p>LabelElement class.</p>
@@ -36,7 +38,7 @@ public class LabelElement extends AbstractCdmFormElement {
         */
        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);
@@ -48,6 +50,34 @@ public class LabelElement extends AbstractCdmFormElement {
         * @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 );
+       }
 }