litesoft
Diff Revisions
629
vs
630
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/NonWrappingLabel.java
|
@@ -1,33 +1,39 @@ |
1 |
1 |
|
package com.temp.client.foundation.widget; |
2 |
2 |
|
|
3 |
|
- |
import com.temp.client.foundation.widget.input.support.*; |
|
3 |
+ |
import com.temp.client.foundation.widget.input.support.TextLabel; |
|
4 |
+ |
import com.temp.shared.utils.SafeHtmlizer; |
4 |
5 |
|
|
5 |
6 |
|
/** |
6 |
7 |
|
* This Widget is a wrapper around a GWT HTML (Label). |
7 |
|
- |
* |
|
8 |
+ |
* <p/> |
8 |
9 |
|
* Its key features are: |
9 |
|
- |
* TODO: XXX |
10 |
|
- |
* <li></li> |
|
10 |
+ |
* <ul> |
|
11 |
+ |
* <li>Text will never wrap</li> |
|
12 |
+ |
* <li>Leading & Trailing white space can be preserved</li> |
|
13 |
+ |
* </ul> |
11 |
14 |
|
*/ |
12 |
|
- |
public class NonWrappingLabel extends TextLabel |
13 |
|
- |
{ |
14 |
|
- |
public NonWrappingLabel() |
15 |
|
- |
{ |
16 |
|
- |
initWidget( htmlWidget ); |
|
15 |
+ |
public class NonWrappingLabel extends TextLabel { |
|
16 |
+ |
public NonWrappingLabel() { |
|
17 |
+ |
initWidget(htmlWidget); |
17 |
18 |
|
} |
18 |
19 |
|
|
19 |
|
- |
public NonWrappingLabel( String text ) |
20 |
|
- |
{ |
|
20 |
+ |
public NonWrappingLabel(String text, boolean preserveLeadingAndTrailingWhiteSpace) { |
21 |
21 |
|
this(); |
22 |
|
- |
setText(text); |
|
22 |
+ |
if (preserveLeadingAndTrailingWhiteSpace) |
|
23 |
+ |
setTextNoTrim(text); |
|
24 |
+ |
else |
|
25 |
+ |
setText(text); |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
public NonWrappingLabel(String text) { |
|
29 |
+ |
this(text, false); |
23 |
30 |
|
} |
24 |
31 |
|
|
25 |
32 |
|
/** |
26 |
|
- |
* @param text will NOT be null or have any leading/trailing whitespace |
|
33 |
+ |
* @param text will NOT be null but MAT have leading/trailing whitespace |
27 |
34 |
|
*/ |
28 |
35 |
|
@Override |
29 |
|
- |
protected String normalizeHTML( String text ) |
30 |
|
- |
{ |
31 |
|
- |
return text; // TODO: XXX |
|
36 |
+ |
protected String normalizeHTML(String text) { |
|
37 |
+ |
return SafeHtmlizer.getInstance().noEmpty(text); |
32 |
38 |
|
} |
33 |
39 |
|
} |