Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/support/TextLabel.java

Diff revisions: vs.
  @@ -1,75 +1,75 @@
1 - package com.temp.client.foundation.widget.input.support;
2 -
3 - import com.google.gwt.user.client.ui.*;
4 - import com.temp.shared.utils.*;
5 -
6 - public abstract class TextLabel extends Composite implements HasName {
7 - protected final HTML htmlWidget = new HTML( HtmlUtils.NBSP );
8 - private String text = null;
9 - private String name;
10 -
11 - public final String getText() {
12 - return text;
13 - }
14 -
15 - public final void setText( String text ) {
16 - commonSetText( StringUtils.noEmpty( text ) );
17 - }
18 -
19 - @Override
20 - public void setName( String name ) {
21 - this.name = StringUtils.noEmpty( name );
22 - }
23 -
24 - @Override
25 - public String getName() {
26 - return name;
27 - }
28 -
29 - @Override
30 - public String toString() {
31 - return ObjectUtils.getSimpleClassName( this ) + ": '" + getText() + "'";
32 - }
33 -
34 - public final void setTextNoTrim( String text ) {
35 - text = StringUtils.deNull( text );
36 - commonSetText( "".equals( text ) ? null : text );
37 - }
38 -
39 - public final TextLabel text( String text ) {
40 - setText( text );
41 - return this;
42 - }
43 -
44 - public final TextLabel textNoTrim( String text ) {
45 - setTextNoTrim( text );
46 - return this;
47 - }
48 -
49 - public final TextLabel style( String className ) {
50 - className = StringUtils.noEmpty( className );
51 - if ( className != null ) {
52 - addStyleName( className );
53 - }
54 - return this;
55 - }
56 -
57 - protected final void commonSetText( String text ) {
58 - this.text = text;
59 - String html = StringUtils.deNull( (text == null) ? HtmlUtils.NBSP : StringUtils.noEmpty( normalizeHTML( text ) ), HtmlUtils.NBSP );
60 - htmlWidget.setHTML( html );
61 - }
62 -
63 - @Override
64 - protected void initWidget( Widget widget ) {
65 - super.initWidget( widget );
66 - setStyleName( ObjectUtils.getSimpleClassName( this ) );
67 - }
68 -
69 - /**
70 - * @param text will NOT be null or have any leading/trailing whitespace
71 - *
72 - * @return Html Safe Text
73 - */
74 - protected abstract String normalizeHTML( String text );
75 - }
1 + package com.temp.client.foundation.widget.input.support;
2 +
3 + import com.google.gwt.user.client.ui.*;
4 + import com.temp.shared.utils.*;
5 +
6 + public abstract class TextLabel extends Composite implements HasName {
7 + protected final HTML htmlWidget = new HTML( HtmlUtils.NBSP );
8 + private String text = null;
9 + private String name;
10 +
11 + public final String getText() {
12 + return text;
13 + }
14 +
15 + public final void setText( String text ) {
16 + commonSetText( StringUtils.noEmpty( text ) );
17 + }
18 +
19 + @Override
20 + public void setName( String name ) {
21 + this.name = StringUtils.noEmpty( name );
22 + }
23 +
24 + @Override
25 + public String getName() {
26 + return name;
27 + }
28 +
29 + @Override
30 + public String toString() {
31 + return ObjectUtils.getSimpleClassName( this ) + ": '" + getText() + "'";
32 + }
33 +
34 + public final void setTextNoTrim( String text ) {
35 + text = StringUtils.deNull( text );
36 + commonSetText( "".equals( text ) ? null : text );
37 + }
38 +
39 + public final TextLabel text( String text ) {
40 + setText( text );
41 + return this;
42 + }
43 +
44 + public final TextLabel textNoTrim( String text ) {
45 + setTextNoTrim( text );
46 + return this;
47 + }
48 +
49 + public final TextLabel style( String className ) {
50 + className = StringUtils.noEmpty( className );
51 + if ( className != null ) {
52 + addStyleName( className );
53 + }
54 + return this;
55 + }
56 +
57 + protected final void commonSetText( String text ) {
58 + this.text = text;
59 + String html = StringUtils.deNull( (text == null) ? HtmlUtils.NBSP : StringUtils.noEmpty( normalizeHTML( text ) ), HtmlUtils.NBSP );
60 + htmlWidget.setHTML( html );
61 + }
62 +
63 + @Override
64 + protected void initWidget( Widget widget ) {
65 + super.initWidget( widget );
66 + setStyleName( ObjectUtils.getSimpleClassName( this ) );
67 + }
68 +
69 + /**
70 + * @param text will NOT be null or have any leading/trailing whitespace
71 + *
72 + * @return Html Safe Text
73 + */
74 + protected abstract String normalizeHTML( String text );
75 + }