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
package org.litesoft.sandbox.multimodule.common.client.infrastructure;

import com.google.gwt.safehtml.shared.*;
import com.google.gwt.user.client.ui.*;

/**
 * A Label that ALWAYS contains something and preserves spaces and escapes all HTML.
 * <p/>
 * Note: while it extends an HTML widget, you may NOT set the HTML, only the text!
 */
public class OurLabel extends HTML implements StyledSafeTextSink
{
    public OurLabel()
    {
        this( null );
    }

    public OurLabel( String text )
    {
        setText( text );
    }

    @Override
    public void setText( String text )
    {
        super.setHTML( SafeHtmlizer.getInstance().noEmpty1stLine( text ).asString() );
    }

    @Override
    public void setText( String text, Direction dir )
    {
        super.setHTML( SafeHtmlizer.getInstance().noEmpty1stLine( text ), dir );
    }

    @Override
    public void setHTML( String html )
    {
        unsupported();
    }

    @Override
    public void setHTML( String html, Direction dir )
    {
        unsupported();
    }

    @Override
    public void setHTML( SafeHtml html )
    {
        unsupported();
    }

    @Override
    public void setHTML( SafeHtml html, Direction dir )
    {
        unsupported();
    }

    private void unsupported()
    {
        throw new UnsupportedOperationException( "setting HTML directly NOT support on OurLabel - use setText()" );
    }
}

Commits for litesoft/trunk/GWT_Sandbox/MultiModule/common/src/org/litesoft/sandbox/multimodule/common/client/infrastructure/OurLabel.java

Diff revisions: vs.
Revision Author Commited Message
538 Diff Diff GeorgeS picture GeorgeS Sun 02 Oct, 2011 22:14:59 +0000
522 GeorgeS picture GeorgeS Tue 27 Sep, 2011 18:31:40 +0000

Upload Widget...