Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package com.temp.client.foundation.widget.input.support;

import com.google.gwt.user.client.ui.*;
import com.temp.shared.utils.*;

public abstract class TextLabel extends Composite implements HasName {
    protected final HTML htmlWidget = new HTML( HtmlUtils.NBSP );
    private String text = null;
    private String name;

    public final String getText() {
        return text;
    }

    public final void setText( String text ) {
        commonSetText( StringUtils.noEmpty( text ) );
    }

    @Override
    public void setName( String name ) {
        this.name = StringUtils.noEmpty( name );
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        return ObjectUtils.getSimpleClassName( this ) + ": '" + getText() + "'";
    }

    public final void setTextNoTrim( String text ) {
        text = StringUtils.deNull( text );
        commonSetText( "".equals( text ) ? null : text );
    }

    public final TextLabel text( String text ) {
        setText( text );
        return this;
    }

    public final TextLabel textNoTrim( String text ) {
        setTextNoTrim( text );
        return this;
    }

    public final TextLabel style( String className ) {
        className = StringUtils.noEmpty( className );
        if ( className != null ) {
            addStyleName( className );
        }
        return this;
    }

    protected final void commonSetText( String text ) {
        this.text = text;
        String html = StringUtils.deNull( (text == null) ? HtmlUtils.NBSP : StringUtils.noEmpty( normalizeHTML( text ) ), HtmlUtils.NBSP );
        htmlWidget.setHTML( html );
    }

    @Override
    protected void initWidget( Widget widget ) {
        super.initWidget( widget );
        setStyleName( ObjectUtils.getSimpleClassName( this ) );
    }

    /**
     * @param text will NOT be null or have any leading/trailing whitespace
     *
     * @return Html Safe Text
     */
    protected abstract String normalizeHTML( String text );
}

Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/input/support/TextLabel.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

630 Diff Diff GeorgeS picture GeorgeS Tue 17 Apr, 2012 20:22:17 +0000
626 GeorgeS picture GeorgeS Wed 11 Apr, 2012 19:39:41 +0000