litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/WrappingNamedLabel.java
|
@@ -1,7 +1,6 @@ |
1 |
1 |
|
package com.temp.client.foundation.widget; |
2 |
2 |
|
|
3 |
|
- |
import com.temp.shared.utils.SafeHtmlizer; |
4 |
|
- |
import com.temp.shared.utils.StringUtils; |
|
3 |
+ |
import com.temp.shared.utils.*; |
5 |
4 |
|
|
6 |
5 |
|
public class WrappingNamedLabel extends NamedLabel { |
7 |
6 |
|
|
|
@@ -12,24 +11,24 @@ |
12 |
11 |
|
public WrappingNamedLabel() { |
13 |
12 |
|
} |
14 |
13 |
|
|
15 |
|
- |
public WrappingNamedLabel(int maxLineCharacterLength, String text) { |
16 |
|
- |
setMaxLineCharacterLength(maxLineCharacterLength); |
17 |
|
- |
setText(text); |
|
14 |
+ |
public WrappingNamedLabel( int maxLineCharacterLength, String text ) { |
|
15 |
+ |
setMaxLineCharacterLength( maxLineCharacterLength ); |
|
16 |
+ |
setText( text ); |
18 |
17 |
|
} |
19 |
18 |
|
|
20 |
|
- |
public WrappingNamedLabel style(String className) { |
21 |
|
- |
addStyleName(className); |
|
19 |
+ |
public WrappingNamedLabel style( String className ) { |
|
20 |
+ |
addStyleName( className ); |
22 |
21 |
|
return this; |
23 |
22 |
|
} |
24 |
23 |
|
|
25 |
|
- |
public WrappingNamedLabel wrapAfter(int maxLineCharacterLength) { |
26 |
|
- |
setMaxLineCharacterLength(maxLineCharacterLength); |
|
24 |
+ |
public WrappingNamedLabel wrapAfter( int maxLineCharacterLength ) { |
|
25 |
+ |
setMaxLineCharacterLength( maxLineCharacterLength ); |
27 |
26 |
|
return this; |
28 |
27 |
|
} |
29 |
28 |
|
|
30 |
|
- |
public void setMaxLineCharacterLength(Integer maxLineCharacterLength) { |
31 |
|
- |
if ( (maxLineCharacterLength != null) && (maxLineCharacterLength < MINIMUM_MAX_LINE_CHARACTER_LENGTH)){ |
32 |
|
- |
throw new IllegalArgumentException("maxLineCharacterLength too small"); |
|
29 |
+ |
public void setMaxLineCharacterLength( Integer maxLineCharacterLength ) { |
|
30 |
+ |
if ( (maxLineCharacterLength != null) && (maxLineCharacterLength < MINIMUM_MAX_LINE_CHARACTER_LENGTH) ) { |
|
31 |
+ |
throw new IllegalArgumentException( "maxLineCharacterLength too small" ); |
33 |
32 |
|
} |
34 |
33 |
|
this.maxLineCharacterLength = maxLineCharacterLength; |
35 |
34 |
|
} |
|
@@ -39,14 +38,14 @@ |
39 |
38 |
|
} |
40 |
39 |
|
|
41 |
40 |
|
@Override |
42 |
|
- |
public void setText(String text, Direction dir) { |
|
41 |
+ |
public void setText( String text, Direction dir ) { |
43 |
42 |
|
throw new UnsupportedOperationException(); |
44 |
43 |
|
} |
45 |
44 |
|
|
46 |
45 |
|
@Override |
47 |
|
- |
public void setText(String text) { |
48 |
|
- |
String adjustedText = StringUtils.wrap(text, maxLineCharacterLength); |
49 |
|
- |
String html = SafeHtmlizer.getInstance().noEmpty(adjustedText); |
50 |
|
- |
getElement().setInnerHTML(html); |
|
46 |
+ |
public void setText( String text ) { |
|
47 |
+ |
String adjustedText = StringUtils.wrap( text, maxLineCharacterLength ); |
|
48 |
+ |
String html = SafeHtmlizer.getInstance().noEmpty( adjustedText ); |
|
49 |
+ |
getElement().setInnerHTML( html ); |
51 |
50 |
|
} |
52 |
51 |
|
} |