|
@@ -1,84 +1,84 @@ |
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 SizeableTextArea extends AbstractSizeableTextBoxBase { |
10 |
|
- |
protected TextAreaChangeListenable mTextArea; |
11 |
|
- |
|
12 |
|
- |
public SizeableTextArea( boolean pNoWrap ) { |
13 |
|
- |
mTextArea = new TextAreaChangeListenable( 40, 4, pNoWrap ); |
14 |
|
- |
initWidget( new ConstrainingSizeableOuterLayers( mTextArea, "LayoutSizeableTextArea" ) ); |
15 |
|
- |
LLstretchable(); |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
@Override |
19 |
|
- |
protected TextBoxBase getTextBoxBase() { |
20 |
|
- |
return mTextArea; |
21 |
|
- |
} |
22 |
|
- |
|
23 |
|
- |
public SizeableTextArea style( String pStyleName ) { |
24 |
|
- |
addStyleName( pStyleName ); |
25 |
|
- |
return this; |
26 |
|
- |
} |
27 |
|
- |
|
28 |
|
- |
/** |
29 |
|
- |
* Gets the requested width of the text box (this is not an exact value, as |
30 |
|
- |
* not all characters are created equal). |
31 |
|
- |
* |
32 |
|
- |
* @return the requested width, in characters |
33 |
|
- |
*/ |
34 |
|
- |
public int getCharacterWidth() { |
35 |
|
- |
return mTextArea.getCharacterWidth(); |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
@Override |
39 |
|
- |
public int getCursorPos() { |
40 |
|
- |
return mTextArea.getCursorPos(); |
41 |
|
- |
} |
42 |
|
- |
|
43 |
|
- |
@Override |
44 |
|
- |
public int getSelectionLength() { |
45 |
|
- |
return mTextArea.getSelectionLength(); |
46 |
|
- |
} |
47 |
|
- |
|
48 |
|
- |
/** |
49 |
|
- |
* Gets the number of text lines that are visible. |
50 |
|
- |
* |
51 |
|
- |
* @return the number of visible lines |
52 |
|
- |
*/ |
53 |
|
- |
public int getVisibleLines() { |
54 |
|
- |
return mTextArea.getVisibleLines(); |
55 |
|
- |
} |
56 |
|
- |
|
57 |
|
- |
/** |
58 |
|
- |
* Sets the requested width of the text box (this is not an exact value, as |
59 |
|
- |
* not all characters are created equal). |
60 |
|
- |
* |
61 |
|
- |
* @param width the requested width, in characters |
62 |
|
- |
*/ |
63 |
|
- |
public void setCharacterWidth( int width ) { |
64 |
|
- |
mTextArea.setCharacterWidth( width ); |
65 |
|
- |
} |
66 |
|
- |
|
67 |
|
- |
/** |
68 |
|
- |
* Sets the number of text lines that are visible. |
69 |
|
- |
* |
70 |
|
- |
* @param lines the number of visible lines |
71 |
|
- |
*/ |
72 |
|
- |
public void setVisibleLines( int lines ) { |
73 |
|
- |
mTextArea.setVisibleLines( lines ); |
74 |
|
- |
} |
75 |
|
- |
|
76 |
|
- |
public boolean isReadOnly() { |
77 |
|
- |
String attribute = DOM.getElementProperty( getTextBoxBase().getElement(), "readonly" ); |
78 |
|
- |
return (attribute != null); |
79 |
|
- |
} |
80 |
|
- |
|
81 |
|
- |
public void setReadOnly( boolean pReadOnly ) { |
82 |
|
- |
DOM.setElementProperty( getTextBoxBase().getElement(), "readonly", pReadOnly ? "readonly" : null ); |
83 |
|
- |
} |
84 |
|
- |
} |
|
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 SizeableTextArea extends AbstractSizeableTextBoxBase { |
|
10 |
+ |
protected TextAreaChangeListenable mTextArea; |
|
11 |
+ |
|
|
12 |
+ |
public SizeableTextArea( boolean pNoWrap ) { |
|
13 |
+ |
mTextArea = new TextAreaChangeListenable( 40, 4, pNoWrap ); |
|
14 |
+ |
initWidget( new ConstrainingSizeableOuterLayers( mTextArea, "LayoutSizeableTextArea" ) ); |
|
15 |
+ |
LLstretchable(); |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
@Override |
|
19 |
+ |
protected TextBoxBase getTextBoxBase() { |
|
20 |
+ |
return mTextArea; |
|
21 |
+ |
} |
|
22 |
+ |
|
|
23 |
+ |
public SizeableTextArea style( String pStyleName ) { |
|
24 |
+ |
addStyleName( pStyleName ); |
|
25 |
+ |
return this; |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
/** |
|
29 |
+ |
* Gets the requested width of the text box (this is not an exact value, as |
|
30 |
+ |
* not all characters are created equal). |
|
31 |
+ |
* |
|
32 |
+ |
* @return the requested width, in characters |
|
33 |
+ |
*/ |
|
34 |
+ |
public int getCharacterWidth() { |
|
35 |
+ |
return mTextArea.getCharacterWidth(); |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
@Override |
|
39 |
+ |
public int getCursorPos() { |
|
40 |
+ |
return mTextArea.getCursorPos(); |
|
41 |
+ |
} |
|
42 |
+ |
|
|
43 |
+ |
@Override |
|
44 |
+ |
public int getSelectionLength() { |
|
45 |
+ |
return mTextArea.getSelectionLength(); |
|
46 |
+ |
} |
|
47 |
+ |
|
|
48 |
+ |
/** |
|
49 |
+ |
* Gets the number of text lines that are visible. |
|
50 |
+ |
* |
|
51 |
+ |
* @return the number of visible lines |
|
52 |
+ |
*/ |
|
53 |
+ |
public int getVisibleLines() { |
|
54 |
+ |
return mTextArea.getVisibleLines(); |
|
55 |
+ |
} |
|
56 |
+ |
|
|
57 |
+ |
/** |
|
58 |
+ |
* Sets the requested width of the text box (this is not an exact value, as |
|
59 |
+ |
* not all characters are created equal). |
|
60 |
+ |
* |
|
61 |
+ |
* @param width the requested width, in characters |
|
62 |
+ |
*/ |
|
63 |
+ |
public void setCharacterWidth( int width ) { |
|
64 |
+ |
mTextArea.setCharacterWidth( width ); |
|
65 |
+ |
} |
|
66 |
+ |
|
|
67 |
+ |
/** |
|
68 |
+ |
* Sets the number of text lines that are visible. |
|
69 |
+ |
* |
|
70 |
+ |
* @param lines the number of visible lines |
|
71 |
+ |
*/ |
|
72 |
+ |
public void setVisibleLines( int lines ) { |
|
73 |
+ |
mTextArea.setVisibleLines( lines ); |
|
74 |
+ |
} |
|
75 |
+ |
|
|
76 |
+ |
public boolean isReadOnly() { |
|
77 |
+ |
String attribute = DOM.getElementProperty( getTextBoxBase().getElement(), "readonly" ); |
|
78 |
+ |
return (attribute != null); |
|
79 |
+ |
} |
|
80 |
+ |
|
|
81 |
+ |
public void setReadOnly( boolean pReadOnly ) { |
|
82 |
+ |
DOM.setElementProperty( getTextBoxBase().getElement(), "readonly", pReadOnly ? "readonly" : null ); |
|
83 |
+ |
} |
|
84 |
+ |
} |