Revision 4f22ac1d
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LabelElement.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
11 | 11 |
|
12 | 12 |
import org.eclipse.swt.SWT; |
13 | 13 |
import org.eclipse.swt.graphics.Color; |
14 |
import org.eclipse.swt.graphics.FontData; |
|
15 | 14 |
import org.eclipse.swt.widgets.Label; |
16 | 15 |
import org.eclipse.ui.forms.widgets.TableWrapData; |
17 | 16 |
|
... | ... | |
37 | 36 |
*/ |
38 | 37 |
public LabelElement(CdmFormFactory formFactory, ICdmFormElement formElement, String text) { |
39 | 38 |
super(formFactory, formElement); |
40 |
|
|
39 |
|
|
41 | 40 |
label = formFactory.createLabel(getLayoutComposite(), text, SWT.WRAP); |
42 | 41 |
label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
43 | 42 |
addControl(label); |
... | ... | |
49 | 48 |
* @param text a {@link java.lang.String} object. |
50 | 49 |
*/ |
51 | 50 |
public void setText(String text) { |
51 |
String pattern = "(.*[^&])&([^&].*)"; |
|
52 |
if(text.matches(pattern)){ |
|
53 |
text = text.replaceAll(pattern, "$1&&$2"); |
|
54 |
} |
|
52 | 55 |
label.setText(CdmUtils.Nz(text)); |
53 | 56 |
} |
54 |
|
|
57 |
|
|
55 | 58 |
public void setLayout(TableWrapData layoutConstants){ |
56 | 59 |
label.setLayoutData(layoutConstants); |
57 | 60 |
} |
58 |
|
|
61 |
|
|
59 | 62 |
public void setForeground(Color color){ |
60 | 63 |
label.setForeground(color); |
61 | 64 |
} |
62 |
|
|
65 |
|
|
63 | 66 |
public void setVisible(boolean setVisible){ |
64 | 67 |
label.setVisible(setVisible); |
65 | 68 |
} |
Also available in: Unified diff
fix #5698 Duplicate ampersand to avoid conversion to mnemonic