|
@@ -1,65 +1,65 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.widgets; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.user.client.*; |
7 |
|
- |
import com.google.gwt.user.client.ui.*; |
8 |
|
- |
|
9 |
|
- |
public class SimpleLabel extends AbstractBrowserEventListenableWidget implements HasText, |
10 |
|
- |
HasWordWrap { |
11 |
|
- |
/** |
12 |
|
- |
* Creates an empty label. |
13 |
|
- |
*/ |
14 |
|
- |
public SimpleLabel() { |
15 |
|
- |
setElement( DOM.createDiv() ); |
16 |
|
- |
//noinspection GWTStyleCheck |
17 |
|
- |
setStyleName( "SimpleLabel" ); |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
/** |
21 |
|
- |
* Creates a label with the specified text. |
22 |
|
- |
* |
23 |
|
- |
* @param text the new label's text |
24 |
|
- |
*/ |
25 |
|
- |
public SimpleLabel( String text ) { |
26 |
|
- |
this(); |
27 |
|
- |
setText( text ); |
28 |
|
- |
} |
29 |
|
- |
|
30 |
|
- |
/** |
31 |
|
- |
* Creates a label with the specified text. |
32 |
|
- |
* |
33 |
|
- |
* @param text the new label's text |
34 |
|
- |
* @param wordWrap <code>false</code> to disable word wrapping |
35 |
|
- |
*/ |
36 |
|
- |
public SimpleLabel( String text, boolean wordWrap ) { |
37 |
|
- |
this( text ); |
38 |
|
- |
setWordWrap( wordWrap ); |
39 |
|
- |
} |
40 |
|
- |
|
41 |
|
- |
public SimpleLabel style( String pStyleClass ) { |
42 |
|
- |
addStyleName( pStyleClass ); |
43 |
|
- |
return this; |
44 |
|
- |
} |
45 |
|
- |
|
46 |
|
- |
@Override |
47 |
|
- |
public String getText() { |
48 |
|
- |
return DOM.getInnerText( getElement() ); |
49 |
|
- |
} |
50 |
|
- |
|
51 |
|
- |
@Override |
52 |
|
- |
public void setText( String text ) { |
53 |
|
- |
DOM.setInnerText( getElement(), text ); |
54 |
|
- |
} |
55 |
|
- |
|
56 |
|
- |
@Override |
57 |
|
- |
public void setWordWrap( boolean wrap ) { |
58 |
|
- |
CommonElementHelper.setWhiteSpaceWrap( getElement(), wrap ); |
59 |
|
- |
} |
60 |
|
- |
|
61 |
|
- |
@Override |
62 |
|
- |
public boolean getWordWrap() { |
63 |
|
- |
return CommonElementHelper.isWhiteSpaceWrap( getElement() ); |
64 |
|
- |
} |
65 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.widgets; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.user.client.*; |
|
7 |
+ |
import com.google.gwt.user.client.ui.*; |
|
8 |
+ |
|
|
9 |
+ |
public class SimpleLabel extends AbstractBrowserEventListenableWidget implements HasText, |
|
10 |
+ |
HasWordWrap { |
|
11 |
+ |
/** |
|
12 |
+ |
* Creates an empty label. |
|
13 |
+ |
*/ |
|
14 |
+ |
public SimpleLabel() { |
|
15 |
+ |
setElement( DOM.createDiv() ); |
|
16 |
+ |
//noinspection GWTStyleCheck |
|
17 |
+ |
setStyleName( "SimpleLabel" ); |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
/** |
|
21 |
+ |
* Creates a label with the specified text. |
|
22 |
+ |
* |
|
23 |
+ |
* @param text the new label's text |
|
24 |
+ |
*/ |
|
25 |
+ |
public SimpleLabel( String text ) { |
|
26 |
+ |
this(); |
|
27 |
+ |
setText( text ); |
|
28 |
+ |
} |
|
29 |
+ |
|
|
30 |
+ |
/** |
|
31 |
+ |
* Creates a label with the specified text. |
|
32 |
+ |
* |
|
33 |
+ |
* @param text the new label's text |
|
34 |
+ |
* @param wordWrap <code>false</code> to disable word wrapping |
|
35 |
+ |
*/ |
|
36 |
+ |
public SimpleLabel( String text, boolean wordWrap ) { |
|
37 |
+ |
this( text ); |
|
38 |
+ |
setWordWrap( wordWrap ); |
|
39 |
+ |
} |
|
40 |
+ |
|
|
41 |
+ |
public SimpleLabel style( String pStyleClass ) { |
|
42 |
+ |
addStyleName( pStyleClass ); |
|
43 |
+ |
return this; |
|
44 |
+ |
} |
|
45 |
+ |
|
|
46 |
+ |
@Override |
|
47 |
+ |
public String getText() { |
|
48 |
+ |
return DOM.getInnerText( getElement() ); |
|
49 |
+ |
} |
|
50 |
+ |
|
|
51 |
+ |
@Override |
|
52 |
+ |
public void setText( String text ) { |
|
53 |
+ |
DOM.setInnerText( getElement(), text ); |
|
54 |
+ |
} |
|
55 |
+ |
|
|
56 |
+ |
@Override |
|
57 |
+ |
public void setWordWrap( boolean wrap ) { |
|
58 |
+ |
CommonElementHelper.setWhiteSpaceWrap( getElement(), wrap ); |
|
59 |
+ |
} |
|
60 |
+ |
|
|
61 |
+ |
@Override |
|
62 |
+ |
public boolean getWordWrap() { |
|
63 |
+ |
return CommonElementHelper.isWhiteSpaceWrap( getElement() ); |
|
64 |
+ |
} |
|
65 |
+ |
} |