|
@@ -12,15 +12,13 @@ |
12 |
12 |
|
import com.google.gwt.user.client.*; |
13 |
13 |
|
import com.google.gwt.user.client.ui.*; |
14 |
14 |
|
|
15 |
|
- |
public class FormTextarea extends AbstractTextElement |
16 |
|
- |
{ |
|
15 |
+ |
public class FormTextarea extends AbstractTextElement { |
17 |
16 |
|
private DeckPanel mDeck; |
18 |
17 |
|
private DisabledTextArea mDisabledTextArea; |
19 |
18 |
|
|
20 |
19 |
|
public FormTextarea( String pFieldLabel, UiFont pLabelFont, String pTooltip, boolean pNoWrapContents, // |
21 |
20 |
|
Integer pInitialWidth, boolean pWidthNotStretchable, // |
22 |
|
- |
Integer pInitialLines, boolean pHeightNotStretchable ) |
23 |
|
- |
{ |
|
21 |
+ |
Integer pInitialLines, boolean pHeightNotStretchable ) { |
24 |
22 |
|
super( new TextAreaChangeListenable( pInitialWidth, pInitialLines, pNoWrapContents ), pTooltip, "frmTxtArea" ); |
25 |
23 |
|
mWidthHelper = pWidthNotStretchable ? NullWidthHelper.INSTANCE : new StretchableWidthHelper( this ); |
26 |
24 |
|
mHeightHelper = pHeightNotStretchable ? NullHeightHelper.INSTANCE : new StretchableHeightHelper( this ); |
|
@@ -34,101 +32,78 @@ |
34 |
32 |
|
} |
35 |
33 |
|
|
36 |
34 |
|
@Override |
37 |
|
- |
protected String buildInputRow( String pTrId, String pInputId, int pUniqueID ) |
38 |
|
- |
{ |
|
35 |
+ |
protected String buildInputRow( String pTrId, String pInputId, int pUniqueID ) { |
39 |
36 |
|
return "<tr>" + // |
40 |
37 |
|
"<td id='" + pInputId + "' class='litesoft-FormComponentInputRow'></td>" + // |
41 |
38 |
|
"<td valign='top'>" + // |
42 |
|
- |
"<table cellpadding='0' cellspacing='0'>" + "<tr><td style='font-size:1px;'> </td></tr><tr id='" + pTrId + "' class='litesoft-FormComponentInputRow'></tr>" + // |
|
39 |
+ |
"<table cellpadding='0' cellspacing='0'>" + "<tr><td style='font-size:1px;'> </td></tr><tr id='" + pTrId + |
|
40 |
+ |
"' class='litesoft-FormComponentInputRow'></tr>" + // |
43 |
41 |
|
"</table>" + // |
44 |
42 |
|
"</td>" +// |
45 |
43 |
|
"</tr>"; |
46 |
44 |
|
} |
47 |
45 |
|
|
48 |
46 |
|
@Override |
49 |
|
- |
protected Widget getInjectedInputWidget() |
50 |
|
- |
{ |
|
47 |
+ |
protected Widget getInjectedInputWidget() { |
51 |
48 |
|
return mDeck; |
52 |
49 |
|
} |
53 |
50 |
|
|
54 |
51 |
|
@Override |
55 |
|
- |
public void setEnabled( boolean pEnabled ) |
56 |
|
- |
{ |
|
52 |
+ |
public void setEnabled( boolean pEnabled ) { |
57 |
53 |
|
super.setEnabled( pEnabled ); |
58 |
|
- |
if ( pEnabled ) |
59 |
|
- |
{ |
|
54 |
+ |
if ( pEnabled ) { |
60 |
55 |
|
enableTextArea(); |
61 |
|
- |
} |
62 |
|
- |
else |
63 |
|
- |
{ |
|
56 |
+ |
} else { |
64 |
57 |
|
disableTextArea(); |
65 |
58 |
|
} |
66 |
59 |
|
} |
67 |
60 |
|
|
68 |
|
- |
public void disableTextArea() |
69 |
|
- |
{ |
|
61 |
+ |
public void disableTextArea() { |
70 |
62 |
|
copyValueToDisabledTextArea(); |
71 |
63 |
|
mDeck.showWidget( 1 ); |
72 |
64 |
|
} |
73 |
65 |
|
|
74 |
|
- |
public void enableTextArea() |
75 |
|
- |
{ |
|
66 |
+ |
public void enableTextArea() { |
76 |
67 |
|
mDeck.showWidget( 0 ); |
77 |
68 |
|
} |
78 |
69 |
|
|
79 |
|
- |
public String getValue() |
80 |
|
- |
{ |
|
70 |
+ |
public String getValue() { |
81 |
71 |
|
return ((TextArea) mInputWidget).getText(); |
82 |
72 |
|
} |
83 |
73 |
|
|
84 |
74 |
|
@Override |
85 |
|
- |
public void setCurrentText( String pNewText ) |
86 |
|
- |
{ |
|
75 |
+ |
public void setCurrentText( String pNewText ) { |
87 |
76 |
|
super.setCurrentText( pNewText ); |
88 |
|
- |
if ( !isEnabled() ) |
89 |
|
- |
{ |
|
77 |
+ |
if ( !isEnabled() ) { |
90 |
78 |
|
copyValueToDisabledTextArea(); |
91 |
79 |
|
} |
92 |
80 |
|
} |
93 |
81 |
|
|
94 |
82 |
|
// Support... |
95 |
83 |
|
|
96 |
|
- |
private void copyValueToDisabledTextArea() |
97 |
|
- |
{ |
|
84 |
+ |
private void copyValueToDisabledTextArea() { |
98 |
85 |
|
String value = getValue(); |
99 |
86 |
|
mDisabledTextArea.setText( convertDisplayText( value ) ); |
100 |
87 |
|
} |
101 |
88 |
|
|
102 |
|
- |
private String convertDisplayText( String pInput ) |
103 |
|
- |
{ |
|
89 |
+ |
private String convertDisplayText( String pInput ) { |
104 |
90 |
|
StringBuilder sb = new StringBuilder(); |
105 |
91 |
|
|
106 |
92 |
|
CharSource zCS = new CharSourceFromSequence( pInput ); |
107 |
|
- |
while ( zCS.anyRemaining() ) |
108 |
|
- |
{ |
|
93 |
+ |
while ( zCS.anyRemaining() ) { |
109 |
94 |
|
int c = zCS.get(); |
110 |
|
- |
if ( c == '\r' ) |
111 |
|
- |
{ |
112 |
|
- |
if ( '\n' == zCS.peek() ) |
113 |
|
- |
{ |
|
95 |
+ |
if ( c == '\r' ) { |
|
96 |
+ |
if ( '\n' == zCS.peek() ) { |
114 |
97 |
|
continue; |
115 |
98 |
|
} |
116 |
99 |
|
sb.append( "<br>" ); |
117 |
|
- |
} |
118 |
|
- |
else if ( (c == ' ') && (' ' == zCS.peek()) ) |
119 |
|
- |
{ |
|
100 |
+ |
} else if ( (c == ' ') && (' ' == zCS.peek()) ) { |
120 |
101 |
|
sb.append( HTMLConstants.NBSP ); |
121 |
|
- |
} |
122 |
|
- |
else if ( c == '\n' ) |
123 |
|
- |
{ |
|
102 |
+ |
} else if ( c == '\n' ) { |
124 |
103 |
|
sb.append( "<br>" ); |
125 |
|
- |
} |
126 |
|
- |
else if ( c == '<' ) |
127 |
|
- |
{ |
|
104 |
+ |
} else if ( c == '<' ) { |
128 |
105 |
|
sb.append( "<" ); |
129 |
|
- |
} |
130 |
|
- |
else |
131 |
|
- |
{ |
|
106 |
+ |
} else { |
132 |
107 |
|
sb.append( (char) c ); |
133 |
108 |
|
} |
134 |
109 |
|
} |
|
@@ -137,63 +112,51 @@ |
137 |
112 |
|
return sb.toString(); |
138 |
113 |
|
} |
139 |
114 |
|
|
140 |
|
- |
private static class StretchableHeightHelper extends AbstractHeightHelper |
141 |
|
- |
{ |
|
115 |
+ |
private static class StretchableHeightHelper extends AbstractHeightHelper { |
142 |
116 |
|
private FormTextarea mOurWidget; |
143 |
117 |
|
private Integer mInputDecorationSize = null; |
144 |
118 |
|
|
145 |
|
- |
public StretchableHeightHelper( FormTextarea pOurWidget ) |
146 |
|
- |
{ |
|
119 |
+ |
public StretchableHeightHelper( FormTextarea pOurWidget ) { |
147 |
120 |
|
super( true ); |
148 |
121 |
|
mOurWidget = pOurWidget; |
149 |
122 |
|
} |
150 |
123 |
|
|
151 |
124 |
|
@Override |
152 |
|
- |
public void setDimension( int pDimension ) |
153 |
|
- |
{ |
|
125 |
+ |
public void setDimension( int pDimension ) { |
154 |
126 |
|
setDimension( mOurWidget, pDimension ); |
155 |
127 |
|
} |
156 |
128 |
|
|
157 |
129 |
|
@Override |
158 |
|
- |
public int getDimension() |
159 |
|
- |
{ |
|
130 |
+ |
public int getDimension() { |
160 |
131 |
|
return getDimension( mOurWidget ); |
161 |
132 |
|
} |
162 |
133 |
|
|
163 |
134 |
|
@Override |
164 |
|
- |
public int getDimensionMaxShrinkability() |
165 |
|
- |
{ |
|
135 |
+ |
public int getDimensionMaxShrinkability() { |
166 |
136 |
|
return getDimension( mOurWidget.getInjectedInputWidget() ) - 6; |
167 |
137 |
|
} |
168 |
138 |
|
|
169 |
139 |
|
@Override |
170 |
|
- |
public int getDecorationSize() |
171 |
|
- |
{ |
|
140 |
+ |
public int getDecorationSize() { |
172 |
141 |
|
return getDimension() - getDimension( mOurWidget.mDeck ); |
173 |
142 |
|
} |
174 |
143 |
|
|
175 |
144 |
|
@Override |
176 |
|
- |
public void deligateSetDimensionFromWidget( int pDimension ) |
177 |
|
- |
{ |
|
145 |
+ |
public void deligateSetDimensionFromWidget( int pDimension ) { |
178 |
146 |
|
Label label = mOurWidget.mLabel; |
179 |
|
- |
if ( label != null ) |
180 |
|
- |
{ |
|
147 |
+ |
if ( label != null ) { |
181 |
148 |
|
pDimension -= getDimension( label ); |
182 |
149 |
|
} |
183 |
150 |
|
pDimension -= getInputDecorationSize(); |
184 |
151 |
|
pDimension -= getOuterSandwichDecorationSize(); |
185 |
|
- |
if ( pDimension > 6 ) |
186 |
|
- |
{ |
|
152 |
+ |
if ( pDimension > 6 ) { |
187 |
153 |
|
setDimension( mOurWidget.getInjectedInputWidget(), pDimension ); |
188 |
154 |
|
} |
189 |
155 |
|
} |
190 |
156 |
|
|
191 |
|
- |
private int getInputDecorationSize() |
192 |
|
- |
{ |
193 |
|
- |
if ( mInputDecorationSize == null ) |
194 |
|
- |
{ |
195 |
|
- |
if ( !mOurWidget.isAttached() ) |
196 |
|
- |
{ |
|
157 |
+ |
private int getInputDecorationSize() { |
|
158 |
+ |
if ( mInputDecorationSize == null ) { |
|
159 |
+ |
if ( !mOurWidget.isAttached() ) { |
197 |
160 |
|
return 9999; |
198 |
161 |
|
} |
199 |
162 |
|
mInputDecorationSize = getDimension( getGrandParent( mOurWidget.getInjectedInputWidget() ) ) - // |
|
@@ -204,12 +167,9 @@ |
204 |
167 |
|
|
205 |
168 |
|
private Integer mOuterSandwichDecorationSize = null; |
206 |
169 |
|
|
207 |
|
- |
private int getOuterSandwichDecorationSize() |
208 |
|
- |
{ |
209 |
|
- |
if ( mOuterSandwichDecorationSize == null ) |
210 |
|
- |
{ |
211 |
|
- |
if ( !mOurWidget.isAttached() ) |
212 |
|
- |
{ |
|
170 |
+ |
private int getOuterSandwichDecorationSize() { |
|
171 |
+ |
if ( mOuterSandwichDecorationSize == null ) { |
|
172 |
+ |
if ( !mOurWidget.isAttached() ) { |
213 |
173 |
|
return 9999; |
214 |
174 |
|
} |
215 |
175 |
|
Element zDivOrFS = mOurWidget.mInnerHTMLpanel.getElement(); |
|
@@ -220,51 +180,43 @@ |
220 |
180 |
|
return mOuterSandwichDecorationSize; |
221 |
181 |
|
} |
222 |
182 |
|
|
223 |
|
- |
private Element getGrandParent( Widget pWidget ) |
224 |
|
- |
{ |
|
183 |
+ |
private Element getGrandParent( Widget pWidget ) { |
225 |
184 |
|
return getGrandParent( pWidget.getElement() ); |
226 |
185 |
|
} |
227 |
186 |
|
|
228 |
|
- |
private Element getGrandParent( Element pElement ) |
229 |
|
- |
{ |
|
187 |
+ |
private Element getGrandParent( Element pElement ) { |
230 |
188 |
|
return getParent( getParent( pElement ) ); |
231 |
189 |
|
} |
232 |
190 |
|
|
233 |
|
- |
private Element getParent( Element pElement ) |
234 |
|
- |
{ |
|
191 |
+ |
private Element getParent( Element pElement ) { |
235 |
192 |
|
return DOM.getParent( pElement ); |
236 |
193 |
|
} |
237 |
194 |
|
} |
238 |
195 |
|
|
239 |
|
- |
private static class MyDeckPanel extends DeckPanel |
240 |
|
- |
{ |
|
196 |
+ |
private static class MyDeckPanel extends DeckPanel { |
241 |
197 |
|
private SizingWrapper mWidget0, mWidget1; |
242 |
198 |
|
|
243 |
|
- |
public MyDeckPanel( SizingWrapper pWidget0, SizingWrapper pWidget1 ) |
244 |
|
- |
{ |
|
199 |
+ |
public MyDeckPanel( SizingWrapper pWidget0, SizingWrapper pWidget1 ) { |
245 |
200 |
|
add( mWidget0 = pWidget0 ); |
246 |
201 |
|
add( mWidget1 = pWidget1 ); |
247 |
202 |
|
showWidget( 0 ); |
248 |
203 |
|
} |
249 |
204 |
|
|
250 |
205 |
|
@Override |
251 |
|
- |
public void showWidget( int index ) |
252 |
|
- |
{ |
|
206 |
+ |
public void showWidget( int index ) { |
253 |
207 |
|
super.showWidget( index ); |
254 |
208 |
|
mWidget0.shown( 0 == index ); |
255 |
209 |
|
mWidget1.shown( 1 == index ); |
256 |
210 |
|
} |
257 |
211 |
|
|
258 |
212 |
|
@Override |
259 |
|
- |
public void setWidth( String width ) |
260 |
|
- |
{ |
|
213 |
+ |
public void setWidth( String width ) { |
261 |
214 |
|
mWidget0.setWidth( width ); |
262 |
215 |
|
mWidget1.setWidth( width ); |
263 |
216 |
|
} |
264 |
217 |
|
|
265 |
218 |
|
@Override |
266 |
|
- |
public void setHeight( String height ) |
267 |
|
- |
{ |
|
219 |
+ |
public void setHeight( String height ) { |
268 |
220 |
|
mWidget0.setHeight( height ); |
269 |
221 |
|
mWidget1.setHeight( height ); |
270 |
222 |
|
} |
|
@@ -277,50 +229,42 @@ |
277 |
229 |
|
// } |
278 |
230 |
|
|
279 |
231 |
|
@Override |
280 |
|
- |
public void insert( Widget w, int beforeIndex ) |
281 |
|
- |
{ |
|
232 |
+ |
public void insert( Widget w, int beforeIndex ) { |
282 |
233 |
|
throw new IllegalStateException( "Only use add( w )" ); |
283 |
234 |
|
} |
284 |
235 |
|
} |
285 |
236 |
|
|
286 |
|
- |
private static class SizingWrapper extends HorizontalPanel |
287 |
|
- |
{ |
|
237 |
+ |
private static class SizingWrapper extends HorizontalPanel { |
288 |
238 |
|
private SizeHelper mHeightHelper, mWidthHelper; |
289 |
239 |
|
|
290 |
|
- |
public SizingWrapper( Widget pChild, Widget pSizingWidget ) |
291 |
|
- |
{ |
|
240 |
+ |
public SizingWrapper( Widget pChild, Widget pSizingWidget ) { |
292 |
241 |
|
add( pChild ); |
293 |
242 |
|
mHeightHelper = new HeightHelper( this, pSizingWidget ); |
294 |
243 |
|
mWidthHelper = new WidthHelper( this, pSizingWidget ); |
295 |
244 |
|
} |
296 |
245 |
|
|
297 |
|
- |
public void shown( boolean pShown ) |
298 |
|
- |
{ |
|
246 |
+ |
public void shown( boolean pShown ) { |
299 |
247 |
|
mHeightHelper.shown( pShown ); |
300 |
248 |
|
mWidthHelper.shown( pShown ); |
301 |
249 |
|
} |
302 |
250 |
|
|
303 |
251 |
|
@Override |
304 |
|
- |
public void setWidth( String width ) |
305 |
|
- |
{ |
|
252 |
+ |
public void setWidth( String width ) { |
306 |
253 |
|
mWidthHelper.setSize( width ); |
307 |
254 |
|
} |
308 |
255 |
|
|
309 |
256 |
|
@Override |
310 |
|
- |
public void setHeight( String height ) |
311 |
|
- |
{ |
|
257 |
+ |
public void setHeight( String height ) { |
312 |
258 |
|
mHeightHelper.setSize( height ); |
313 |
259 |
|
} |
314 |
260 |
|
|
315 |
|
- |
private static abstract class SizeHelper implements Command |
316 |
|
- |
{ |
|
261 |
+ |
private static abstract class SizeHelper implements Command { |
317 |
262 |
|
private SizingWrapper mWrapper; |
318 |
263 |
|
private Widget mSizingWidget; |
319 |
264 |
|
private Integer mPendingSize = null; |
320 |
265 |
|
private Integer mOverheadSize = null; |
321 |
266 |
|
|
322 |
|
- |
protected SizeHelper( SizingWrapper pWrapper, Widget pSizingWidget ) |
323 |
|
- |
{ |
|
267 |
+ |
protected SizeHelper( SizingWrapper pWrapper, Widget pSizingWidget ) { |
324 |
268 |
|
mWrapper = pWrapper; |
325 |
269 |
|
mSizingWidget = pSizingWidget; |
326 |
270 |
|
} |
|
@@ -329,37 +273,28 @@ |
329 |
273 |
|
|
330 |
274 |
|
abstract protected void setSize( Widget pWidget, int pSize ); |
331 |
275 |
|
|
332 |
|
- |
public void setSize( String pSize ) |
333 |
|
- |
{ |
334 |
|
- |
try |
335 |
|
- |
{ |
|
276 |
+ |
public void setSize( String pSize ) { |
|
277 |
+ |
try { |
336 |
278 |
|
mPendingSize = AbstractSizeableWidget.parse( pSize ); |
337 |
279 |
|
} |
338 |
|
- |
catch ( NumberFormatException e ) |
339 |
|
- |
{ |
|
280 |
+ |
catch ( NumberFormatException e ) { |
340 |
281 |
|
return; |
341 |
282 |
|
} |
342 |
283 |
|
applySize(); |
343 |
284 |
|
} |
344 |
285 |
|
|
345 |
|
- |
public void shown( boolean pShown ) |
346 |
|
- |
{ |
347 |
|
- |
if ( pShown ) |
348 |
|
- |
{ |
|
286 |
+ |
public void shown( boolean pShown ) { |
|
287 |
+ |
if ( pShown ) { |
349 |
288 |
|
applySize(); |
350 |
289 |
|
} |
351 |
290 |
|
} |
352 |
291 |
|
|
353 |
292 |
|
private boolean mDeferred = false; |
354 |
293 |
|
|
355 |
|
- |
private void applySize() |
356 |
|
- |
{ |
357 |
|
- |
if ( mOverheadSize == null ) |
358 |
|
- |
{ |
359 |
|
- |
if ( shouldDefer() ) |
360 |
|
- |
{ |
361 |
|
- |
if ( !mDeferred ) |
362 |
|
- |
{ |
|
294 |
+ |
private void applySize() { |
|
295 |
+ |
if ( mOverheadSize == null ) { |
|
296 |
+ |
if ( shouldDefer() ) { |
|
297 |
+ |
if ( !mDeferred ) { |
363 |
298 |
|
mDeferred = true; |
364 |
299 |
|
Scheduler.get().scheduleDeferred( this ); |
365 |
300 |
|
} |
|
@@ -370,14 +305,12 @@ |
370 |
305 |
|
// System.out.println( this + ".applySize: " + zWrapperSize + "|" + zSizingSize ); |
371 |
306 |
|
mOverheadSize = zWrapperSize - zSizingSize; |
372 |
307 |
|
} |
373 |
|
- |
if ( mPendingSize != null ) |
374 |
|
- |
{ |
|
308 |
+ |
if ( mPendingSize != null ) { |
375 |
309 |
|
setSize( mSizingWidget, mPendingSize - mOverheadSize ); |
376 |
310 |
|
} |
377 |
311 |
|
} |
378 |
312 |
|
|
379 |
|
- |
private boolean shouldDefer() |
380 |
|
- |
{ |
|
313 |
+ |
private boolean shouldDefer() { |
381 |
314 |
|
boolean zAttached = mWrapper.isAttached(); |
382 |
315 |
|
boolean zVisible = mWrapper.isVisible(); |
383 |
316 |
|
int zSize = getSize( mWrapper ); |
|
@@ -385,61 +318,50 @@ |
385 |
318 |
|
} |
386 |
319 |
|
|
387 |
320 |
|
@Override |
388 |
|
- |
public void execute() |
389 |
|
- |
{ |
|
321 |
+ |
public void execute() { |
390 |
322 |
|
mDeferred = false; |
391 |
323 |
|
applySize(); |
392 |
324 |
|
} |
393 |
325 |
|
} |
394 |
326 |
|
|
395 |
|
- |
private static class HeightHelper extends SizeHelper |
396 |
|
- |
{ |
397 |
|
- |
public HeightHelper( SizingWrapper pWrapper, Widget pSizingWidget ) |
398 |
|
- |
{ |
|
327 |
+ |
private static class HeightHelper extends SizeHelper { |
|
328 |
+ |
public HeightHelper( SizingWrapper pWrapper, Widget pSizingWidget ) { |
399 |
329 |
|
super( pWrapper, pSizingWidget ); |
400 |
330 |
|
} |
401 |
331 |
|
|
402 |
332 |
|
@Override |
403 |
|
- |
protected int getSize( Widget pWidget ) |
404 |
|
- |
{ |
|
333 |
+ |
protected int getSize( Widget pWidget ) { |
405 |
334 |
|
return pWidget.getOffsetHeight(); |
406 |
335 |
|
} |
407 |
336 |
|
|
408 |
337 |
|
@Override |
409 |
|
- |
protected void setSize( Widget pWidget, int pSize ) |
410 |
|
- |
{ |
|
338 |
+ |
protected void setSize( Widget pWidget, int pSize ) { |
411 |
339 |
|
pWidget.setHeight( "" + pSize ); |
412 |
340 |
|
} |
413 |
341 |
|
} |
414 |
342 |
|
|
415 |
|
- |
private static class WidthHelper extends SizeHelper |
416 |
|
- |
{ |
417 |
|
- |
public WidthHelper( SizingWrapper pWrapper, Widget pSizingWidget ) |
418 |
|
- |
{ |
|
343 |
+ |
private static class WidthHelper extends SizeHelper { |
|
344 |
+ |
public WidthHelper( SizingWrapper pWrapper, Widget pSizingWidget ) { |
419 |
345 |
|
super( pWrapper, pSizingWidget ); |
420 |
346 |
|
} |
421 |
347 |
|
|
422 |
348 |
|
@Override |
423 |
|
- |
protected int getSize( Widget pWidget ) |
424 |
|
- |
{ |
|
349 |
+ |
protected int getSize( Widget pWidget ) { |
425 |
350 |
|
return pWidget.getOffsetWidth(); |
426 |
351 |
|
} |
427 |
352 |
|
|
428 |
353 |
|
@Override |
429 |
|
- |
protected void setSize( Widget pWidget, int pSize ) |
430 |
|
- |
{ |
|
354 |
+ |
protected void setSize( Widget pWidget, int pSize ) { |
431 |
355 |
|
pWidget.setWidth( "" + pSize ); |
432 |
356 |
|
} |
433 |
357 |
|
} |
434 |
358 |
|
} |
435 |
359 |
|
|
436 |
|
- |
private static class DisabledTextArea extends SimplePanel |
437 |
|
- |
{ |
|
360 |
+ |
private static class DisabledTextArea extends SimplePanel { |
438 |
361 |
|
private InnerText mInnerTextAsHtml; |
439 |
362 |
|
private Widget mSizeablePanel; |
440 |
363 |
|
|
441 |
|
- |
public DisabledTextArea( boolean pNoWrapContents ) |
442 |
|
- |
{ |
|
364 |
+ |
public DisabledTextArea( boolean pNoWrapContents ) { |
443 |
365 |
|
//noinspection GWTStyleCheck |
444 |
366 |
|
addStyleName( "litesoft-OuterDisabledTextArea" ); |
445 |
367 |
|
|
|
@@ -450,17 +372,14 @@ |
450 |
372 |
|
|
451 |
373 |
|
mInnerTextAsHtml = new InnerText(); |
452 |
374 |
|
|
453 |
|
- |
if ( pNoWrapContents ) |
454 |
|
- |
{ |
|
375 |
+ |
if ( pNoWrapContents ) { |
455 |
376 |
|
SimplePanel zSimplePanel = new SimplePanel(); |
456 |
377 |
|
CommonElementHelper.setOverflowAuto( zSimplePanel.getElement() ); |
457 |
378 |
|
CommonElementHelper.setWhiteSpaceWrap( mInnerTextAsHtml.getElement(), false ); |
458 |
379 |
|
zSimplePanel.add( mInnerTextAsHtml ); |
459 |
380 |
|
|
460 |
381 |
|
mSizeablePanel = zSimplePanel; |
461 |
|
- |
} |
462 |
|
- |
else |
463 |
|
- |
{ |
|
382 |
+ |
} else { |
464 |
383 |
|
CommonElementHelper.setOverflowAuto( mInnerTextAsHtml.getElement() ); |
465 |
384 |
|
|
466 |
385 |
|
mSizeablePanel = mInnerTextAsHtml; |
|
@@ -469,57 +388,46 @@ |
469 |
388 |
|
mSizeablePanel.setSize( "50", "50" ); |
470 |
389 |
|
} |
471 |
390 |
|
|
472 |
|
- |
public Widget getSizeablePanel() |
473 |
|
- |
{ |
|
391 |
+ |
public Widget getSizeablePanel() { |
474 |
392 |
|
return mSizeablePanel; |
475 |
393 |
|
} |
476 |
394 |
|
|
477 |
|
- |
public void setText( String pText ) |
478 |
|
- |
{ |
479 |
|
- |
if ( pText != null ) |
480 |
|
- |
{ |
|
395 |
+ |
public void setText( String pText ) { |
|
396 |
+ |
if ( pText != null ) { |
481 |
397 |
|
mInnerTextAsHtml.setText( pText ); |
482 |
398 |
|
} |
483 |
399 |
|
} |
484 |
400 |
|
|
485 |
|
- |
public void setInnerHtml( String pText ) |
486 |
|
- |
{ |
487 |
|
- |
if ( pText != null ) |
488 |
|
- |
{ |
|
401 |
+ |
public void setInnerHtml( String pText ) { |
|
402 |
+ |
if ( pText != null ) { |
489 |
403 |
|
DOM.setInnerHTML( mInnerTextAsHtml.getElement(), pText ); |
490 |
404 |
|
} |
491 |
405 |
|
} |
492 |
406 |
|
|
493 |
407 |
|
@Override |
494 |
|
- |
public void setWidth( String pWidth ) |
495 |
|
- |
{ |
|
408 |
+ |
public void setWidth( String pWidth ) { |
496 |
409 |
|
mSizeablePanel.setWidth( pWidth ); |
497 |
410 |
|
} |
498 |
411 |
|
|
499 |
412 |
|
@Override |
500 |
|
- |
public void setHeight( String pHeight ) |
501 |
|
- |
{ |
|
413 |
+ |
public void setHeight( String pHeight ) { |
502 |
414 |
|
mSizeablePanel.setHeight( pHeight ); |
503 |
415 |
|
} |
504 |
416 |
|
} |
505 |
417 |
|
|
506 |
|
- |
private static class InnerText extends Widget |
507 |
|
- |
{ |
508 |
|
- |
public InnerText() |
509 |
|
- |
{ |
|
418 |
+ |
private static class InnerText extends Widget { |
|
419 |
+ |
public InnerText() { |
510 |
420 |
|
setElement( DOM.createDiv() ); |
511 |
421 |
|
//noinspection GWTStyleCheck |
512 |
422 |
|
setStyleName( "litesoft-DisabledTextareaInnerText" ); |
513 |
423 |
|
} |
514 |
424 |
|
|
515 |
|
- |
public InnerText( String pText ) |
516 |
|
- |
{ |
|
425 |
+ |
public InnerText( String pText ) { |
517 |
426 |
|
this(); |
518 |
427 |
|
setText( pText ); |
519 |
428 |
|
} |
520 |
429 |
|
|
521 |
|
- |
public void setText( String pText ) |
522 |
|
- |
{ |
|
430 |
+ |
public void setText( String pText ) { |
523 |
431 |
|
DOM.setInnerHTML( getElement(), pText ); |
524 |
432 |
|
} |
525 |
433 |
|
} |