|
@@ -1,8 +1,6 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.client.nonpublic; |
3 |
3 |
|
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
4 |
|
import org.litesoft.GWT.client.*; |
7 |
5 |
|
import org.litesoft.GWT.client.widgets.*; |
8 |
6 |
|
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
@@ -14,10 +12,11 @@ |
14 |
12 |
|
import com.google.gwt.user.client.*; |
15 |
13 |
|
import com.google.gwt.user.client.ui.*; |
16 |
14 |
|
|
|
15 |
+ |
import java.util.*; |
|
16 |
+ |
|
17 |
17 |
|
public abstract class AbstractFloaterPanel extends AbstractSizeablePanel implements UiPositionAndSizeAdjustable, |
18 |
18 |
|
IndexedPanel, |
19 |
|
- |
SizeableSingleWidgetContainer |
20 |
|
- |
{ |
|
19 |
+ |
SizeableSingleWidgetContainer { |
21 |
20 |
|
public static final int BORDER_T_H = 7; |
22 |
21 |
|
public static final int BORDER_B_H = 7; |
23 |
22 |
|
|
|
@@ -36,8 +35,7 @@ |
36 |
35 |
|
private ContentPanel mContent; |
37 |
36 |
|
private Element mTR_Pining, mTR_RightAchoring, mTR_BottomAchoring; |
38 |
37 |
|
|
39 |
|
- |
protected AbstractFloaterPanel( String pForm ) |
40 |
|
- |
{ |
|
38 |
+ |
protected AbstractFloaterPanel( String pForm ) { |
41 |
39 |
|
initializeElements( getHelper().create_OeTable_SeIeTBody(), null ); |
42 |
40 |
|
|
43 |
41 |
|
/* |
|
@@ -56,55 +54,45 @@ |
56 |
54 |
|
LLstretchable(); |
57 |
55 |
|
} |
58 |
56 |
|
|
59 |
|
- |
protected DragGesture createTitleBarDragGesture( UiPositionable pUiPositionable ) |
60 |
|
- |
{ |
|
57 |
+ |
protected DragGesture createTitleBarDragGesture( UiPositionable pUiPositionable ) { |
61 |
58 |
|
return new DragPositionableController( pUiPositionable ); |
62 |
59 |
|
} |
63 |
60 |
|
|
64 |
|
- |
private static class ContentPanel extends ClippingSimplePanel |
65 |
|
- |
{ |
66 |
|
- |
public ContentPanel( String pForm ) |
67 |
|
- |
{ |
|
61 |
+ |
private static class ContentPanel extends ClippingSimplePanel { |
|
62 |
+ |
public ContentPanel( String pForm ) { |
68 |
63 |
|
super( "litesoft-NoSizeAffectingCSS-" + pForm + "ContentPane" ); |
69 |
64 |
|
} |
70 |
65 |
|
} |
71 |
66 |
|
|
72 |
67 |
|
@Override |
73 |
|
- |
public void relayout() |
74 |
|
- |
{ |
|
68 |
+ |
public void relayout() { |
75 |
69 |
|
mLogger.log( "relayout" ); |
76 |
70 |
|
mWidthHandler.relayout(); |
77 |
71 |
|
mHeightHandler.relayout(); |
78 |
72 |
|
} |
79 |
73 |
|
|
80 |
|
- |
public boolean isSizingPending() |
81 |
|
- |
{ |
|
74 |
+ |
public boolean isSizingPending() { |
82 |
75 |
|
return mWidthHandler.isPendingAny() || mHeightHandler.isPendingAny(); |
83 |
76 |
|
} |
84 |
77 |
|
|
85 |
|
- |
public Element getTR_Pinning() |
86 |
|
- |
{ |
|
78 |
+ |
public Element getTR_Pinning() { |
87 |
79 |
|
return mTR_Pining; |
88 |
80 |
|
} |
89 |
81 |
|
|
90 |
|
- |
public Element getTR_RightAnchoring() |
91 |
|
- |
{ |
|
82 |
+ |
public Element getTR_RightAnchoring() { |
92 |
83 |
|
return mTR_RightAchoring; |
93 |
84 |
|
} |
94 |
85 |
|
|
95 |
|
- |
public Element getTR_BottomAnchoring() |
96 |
|
- |
{ |
|
86 |
+ |
public Element getTR_BottomAnchoring() { |
97 |
87 |
|
return mTR_BottomAchoring; |
98 |
88 |
|
} |
99 |
89 |
|
|
100 |
|
- |
public int getTitleBarHeight() |
101 |
|
- |
{ |
|
90 |
+ |
public int getTitleBarHeight() { |
102 |
91 |
|
return mTitleBarPanel.getOffsetHeight(); |
103 |
92 |
|
} |
104 |
93 |
|
|
105 |
94 |
|
@Override |
106 |
|
- |
public String getTitle() |
107 |
|
- |
{ |
|
95 |
+ |
public String getTitle() { |
108 |
96 |
|
FloaterTitleBar zTitleBar = getTitleBar(); |
109 |
97 |
|
return (zTitleBar != null) ? zTitleBar.getTitleBarTitle() : null; |
110 |
98 |
|
} |
|
@@ -115,11 +103,9 @@ |
115 |
103 |
|
// } |
116 |
104 |
|
|
117 |
105 |
|
@Override |
118 |
|
- |
public void setTitle( String title ) |
119 |
|
- |
{ |
|
106 |
+ |
public void setTitle( String title ) { |
120 |
107 |
|
FloaterTitleBar zTitleBar = getTitleBar(); |
121 |
|
- |
if ( zTitleBar == null ) |
122 |
|
- |
{ |
|
108 |
+ |
if ( zTitleBar == null ) { |
123 |
109 |
|
setTitleBar( zTitleBar = new OurTextOnlyTitleBar() ); |
124 |
110 |
|
} |
125 |
111 |
|
zTitleBar.setTitleBarTitle( title ); |
|
@@ -135,14 +121,12 @@ |
135 |
121 |
|
// } |
136 |
122 |
|
|
137 |
123 |
|
@Override |
138 |
|
- |
public void setPosition( int pLeft, int pTop ) |
139 |
|
- |
{ |
|
124 |
+ |
public void setPosition( int pLeft, int pTop ) { |
140 |
125 |
|
setPosLeft( pLeft ); |
141 |
126 |
|
setPosTop( pTop ); |
142 |
127 |
|
} |
143 |
128 |
|
|
144 |
|
- |
public SizeWidthHeight getContentSize() |
145 |
|
- |
{ |
|
129 |
+ |
public SizeWidthHeight getContentSize() { |
146 |
130 |
|
Widget w = getWidget(); |
147 |
131 |
|
return (w != null) ? new SizeWidthHeight( w.getOffsetWidth(), w.getOffsetHeight() ) : null; |
148 |
132 |
|
} |
|
@@ -153,8 +137,7 @@ |
153 |
137 |
|
* @return the child widget, or <code>null</code> if none is present |
154 |
138 |
|
*/ |
155 |
139 |
|
@Override |
156 |
|
- |
public Widget getWidget() |
157 |
|
- |
{ |
|
140 |
+ |
public Widget getWidget() { |
158 |
141 |
|
return mContent.getWidget(); |
159 |
142 |
|
} |
160 |
143 |
|
|
|
@@ -162,31 +145,26 @@ |
162 |
145 |
|
* Sets this panel's widget. Any existing child widget will be removed. |
163 |
146 |
|
*/ |
164 |
147 |
|
@Override |
165 |
|
- |
public void setWidget( Widget pWidget ) |
166 |
|
- |
{ |
|
148 |
+ |
public void setWidget( Widget pWidget ) { |
167 |
149 |
|
mContent.setWidget( pWidget ); |
168 |
150 |
|
reinitializeSize(); |
169 |
151 |
|
} |
170 |
152 |
|
|
171 |
|
- |
public FloaterTitleBar getTitleBar() |
172 |
|
- |
{ |
|
153 |
+ |
public FloaterTitleBar getTitleBar() { |
173 |
154 |
|
return (FloaterTitleBar) mTitleBarPanel.getWidget(); |
174 |
155 |
|
} |
175 |
156 |
|
|
176 |
|
- |
public void setTitleBar( FloaterTitleBar pWidget ) |
177 |
|
- |
{ |
|
157 |
+ |
public void setTitleBar( FloaterTitleBar pWidget ) { |
178 |
158 |
|
mTitleBarPanel.setWidget( pWidget ); |
179 |
159 |
|
reinitializeSize(); |
180 |
160 |
|
} |
181 |
161 |
|
|
182 |
|
- |
public void initializeSize() |
183 |
|
- |
{ |
|
162 |
+ |
public void initializeSize() { |
184 |
163 |
|
initializeWidth(); |
185 |
164 |
|
initializeHeight(); |
186 |
165 |
|
} |
187 |
166 |
|
|
188 |
|
- |
protected void reinitializeSize() |
189 |
|
- |
{ |
|
167 |
+ |
protected void reinitializeSize() { |
190 |
168 |
|
mWidthHandler.reinitializeDimension(); |
191 |
169 |
|
mHeightHandler.reinitializeDimension(); |
192 |
170 |
|
} |
|
@@ -194,64 +172,50 @@ |
194 |
172 |
|
private boolean mSizingWorking = false; |
195 |
173 |
|
|
196 |
174 |
|
@Override |
197 |
|
- |
public void setSizingWorking() |
198 |
|
- |
{ |
|
175 |
+ |
public void setSizingWorking() { |
199 |
176 |
|
mSizingWorking = true; |
200 |
177 |
|
setVisible( true ); |
201 |
178 |
|
} |
202 |
179 |
|
|
203 |
180 |
|
@Override |
204 |
|
- |
public boolean isSizingWorking() |
205 |
|
- |
{ |
|
181 |
+ |
public boolean isSizingWorking() { |
206 |
182 |
|
return mSizingWorking; |
207 |
183 |
|
} |
208 |
184 |
|
|
209 |
|
- |
private int getPrefferredWidth( SizeableSimplePanel pOurWrapper ) |
210 |
|
- |
{ |
211 |
|
- |
if ( pOurWrapper != null ) |
212 |
|
- |
{ |
|
185 |
+ |
private int getPrefferredWidth( SizeableSimplePanel pOurWrapper ) { |
|
186 |
+ |
if ( pOurWrapper != null ) { |
213 |
187 |
|
Widget widget = pOurWrapper.getWidget(); |
214 |
|
- |
if ( widget != null ) |
215 |
|
- |
{ |
|
188 |
+ |
if ( widget != null ) { |
216 |
189 |
|
return widget.getOffsetWidth(); |
217 |
190 |
|
} |
218 |
191 |
|
} |
219 |
192 |
|
return 0; |
220 |
193 |
|
} |
221 |
194 |
|
|
222 |
|
- |
private int getPrefferredWidth( ContentPanel pOurWrapper ) |
223 |
|
- |
{ |
224 |
|
- |
if ( pOurWrapper != null ) |
225 |
|
- |
{ |
|
195 |
+ |
private int getPrefferredWidth( ContentPanel pOurWrapper ) { |
|
196 |
+ |
if ( pOurWrapper != null ) { |
226 |
197 |
|
Widget widget = pOurWrapper.getWidget(); |
227 |
|
- |
if ( widget != null ) |
228 |
|
- |
{ |
|
198 |
+ |
if ( widget != null ) { |
229 |
199 |
|
return widget.getOffsetWidth(); |
230 |
200 |
|
} |
231 |
201 |
|
} |
232 |
202 |
|
return 0; |
233 |
203 |
|
} |
234 |
204 |
|
|
235 |
|
- |
private int getPrefferredHeight( SizeableSimplePanel pOurWrapper ) |
236 |
|
- |
{ |
237 |
|
- |
if ( pOurWrapper != null ) |
238 |
|
- |
{ |
|
205 |
+ |
private int getPrefferredHeight( SizeableSimplePanel pOurWrapper ) { |
|
206 |
+ |
if ( pOurWrapper != null ) { |
239 |
207 |
|
Widget widget = pOurWrapper.getWidget(); |
240 |
|
- |
if ( widget != null ) |
241 |
|
- |
{ |
|
208 |
+ |
if ( widget != null ) { |
242 |
209 |
|
return widget.getOffsetHeight(); |
243 |
210 |
|
} |
244 |
211 |
|
} |
245 |
212 |
|
return 0; |
246 |
213 |
|
} |
247 |
214 |
|
|
248 |
|
- |
private int getPrefferredHeight( ContentPanel pOurWrapper ) |
249 |
|
- |
{ |
250 |
|
- |
if ( pOurWrapper != null ) |
251 |
|
- |
{ |
|
215 |
+ |
private int getPrefferredHeight( ContentPanel pOurWrapper ) { |
|
216 |
+ |
if ( pOurWrapper != null ) { |
252 |
217 |
|
Widget widget = pOurWrapper.getWidget(); |
253 |
|
- |
if ( widget != null ) |
254 |
|
- |
{ |
|
218 |
+ |
if ( widget != null ) { |
255 |
219 |
|
return widget.getOffsetHeight(); |
256 |
220 |
|
} |
257 |
221 |
|
} |
|
@@ -259,23 +223,19 @@ |
259 |
223 |
|
} |
260 |
224 |
|
|
261 |
225 |
|
@Override |
262 |
|
- |
public boolean setPrefferredWidth() |
263 |
|
- |
{ |
|
226 |
+ |
public boolean setPrefferredWidth() { |
264 |
227 |
|
int w1 = getPrefferredWidth( mTitleBarPanel ); |
265 |
228 |
|
int w2 = getPrefferredWidth( mContent ); |
266 |
229 |
|
return (w1 > 0) && (w2 > 0) && setWidths( Math.max( w1, w2 ) ); |
267 |
230 |
|
} |
268 |
231 |
|
|
269 |
232 |
|
@Override |
270 |
|
- |
public boolean adjustWidthBy( int pDelta ) |
271 |
|
- |
{ |
|
233 |
+ |
public boolean adjustWidthBy( int pDelta ) { |
272 |
234 |
|
// System.out.println( "adjustSizeBy(" + pDelta + ")" ); |
273 |
|
- |
if ( pDelta != 0 ) |
274 |
|
- |
{ |
|
235 |
+ |
if ( pDelta != 0 ) { |
275 |
236 |
|
int curWidth = mContent.getOffsetWidth(); |
276 |
237 |
|
int newWidthContent = curWidth + pDelta; |
277 |
|
- |
if ( (curWidth <= 0) || ((pDelta < 0) && (newWidthContent < MinContentWidth)) ) |
278 |
|
- |
{ |
|
238 |
+ |
if ( (curWidth <= 0) || ((pDelta < 0) && (newWidthContent < MinContentWidth)) ) { |
279 |
239 |
|
return false; |
280 |
240 |
|
} |
281 |
241 |
|
setWidths( newWidthContent ); |
|
@@ -283,41 +243,33 @@ |
283 |
243 |
|
return true; |
284 |
244 |
|
} |
285 |
245 |
|
|
286 |
|
- |
public void initializeWidth() |
287 |
|
- |
{ |
|
246 |
+ |
public void initializeWidth() { |
288 |
247 |
|
mWidthHandler.initializeDimension(); |
289 |
248 |
|
} |
290 |
249 |
|
|
291 |
250 |
|
@Override |
292 |
|
- |
public void setWidth( String pWidth ) |
293 |
|
- |
{ |
|
251 |
+ |
public void setWidth( String pWidth ) { |
294 |
252 |
|
mWidthHandler.setDimension( pWidth ); |
295 |
253 |
|
} |
296 |
254 |
|
|
297 |
|
- |
protected int getMaxPotentialWidth() |
298 |
|
- |
{ |
|
255 |
+ |
protected int getMaxPotentialWidth() { |
299 |
256 |
|
return -1; |
300 |
257 |
|
} |
301 |
258 |
|
|
302 |
|
- |
private FloaterPositionHandler createWidthPositionHandler() |
303 |
|
- |
{ |
304 |
|
- |
return new FloaterPositionHandler() |
305 |
|
- |
{ |
|
259 |
+ |
private FloaterPositionHandler createWidthPositionHandler() { |
|
260 |
+ |
return new FloaterPositionHandler() { |
306 |
261 |
|
@Override |
307 |
|
- |
public int getPos() |
308 |
|
- |
{ |
|
262 |
+ |
public int getPos() { |
309 |
263 |
|
return getPosLeft(); |
310 |
264 |
|
} |
311 |
265 |
|
|
312 |
266 |
|
@Override |
313 |
|
- |
public void setPos( int pNewPos ) |
314 |
|
- |
{ |
|
267 |
+ |
public void setPos( int pNewPos ) { |
315 |
268 |
|
setPosLeft( pNewPos ); |
316 |
269 |
|
} |
317 |
270 |
|
|
318 |
271 |
|
@Override |
319 |
|
- |
public int getMaxPotentialSize() |
320 |
|
- |
{ |
|
272 |
+ |
public int getMaxPotentialSize() { |
321 |
273 |
|
return getMaxPotentialWidth(); |
322 |
274 |
|
} |
323 |
275 |
|
}; |
|
@@ -327,20 +279,16 @@ |
327 |
279 |
|
new DeferableFloaterDimensionHandler( this, mLogger, getWidthHelper(), createWidthPositionHandler() ); |
328 |
280 |
|
|
329 |
281 |
|
@Override |
330 |
|
- |
public boolean setPrefferredHeight() |
331 |
|
- |
{ |
|
282 |
+ |
public boolean setPrefferredHeight() { |
332 |
283 |
|
return setTitleBarPrefferredHeight() & setContentPrefferredHeight(); |
333 |
284 |
|
} |
334 |
285 |
|
|
335 |
286 |
|
@Override |
336 |
|
- |
public boolean adjustHeightBy( int pDelta ) |
337 |
|
- |
{ |
338 |
|
- |
if ( pDelta != 0 ) |
339 |
|
- |
{ |
|
287 |
+ |
public boolean adjustHeightBy( int pDelta ) { |
|
288 |
+ |
if ( pDelta != 0 ) { |
340 |
289 |
|
int curHeight = mContent.getOffsetHeight(); |
341 |
290 |
|
int newHeightContent = curHeight + pDelta; |
342 |
|
- |
if ( (curHeight <= 0) || ((pDelta < 0) && (newHeightContent < MinContentHeight)) ) |
343 |
|
- |
{ |
|
291 |
+ |
if ( (curHeight <= 0) || ((pDelta < 0) && (newHeightContent < MinContentHeight)) ) { |
344 |
292 |
|
return false; |
345 |
293 |
|
} |
346 |
294 |
|
setContentHeight( newHeightContent ); |
|
@@ -348,41 +296,33 @@ |
348 |
296 |
|
return true; |
349 |
297 |
|
} |
350 |
298 |
|
|
351 |
|
- |
public void initializeHeight() |
352 |
|
- |
{ |
|
299 |
+ |
public void initializeHeight() { |
353 |
300 |
|
mHeightHandler.initializeDimension(); |
354 |
301 |
|
} |
355 |
302 |
|
|
356 |
303 |
|
@Override |
357 |
|
- |
public void setHeight( String pHeight ) |
358 |
|
- |
{ |
|
304 |
+ |
public void setHeight( String pHeight ) { |
359 |
305 |
|
mHeightHandler.setDimension( pHeight ); |
360 |
306 |
|
} |
361 |
307 |
|
|
362 |
|
- |
protected int getMaxPotentialHeight() |
363 |
|
- |
{ |
|
308 |
+ |
protected int getMaxPotentialHeight() { |
364 |
309 |
|
return -1; |
365 |
310 |
|
} |
366 |
311 |
|
|
367 |
|
- |
private FloaterPositionHandler createHeightPositionHandler() |
368 |
|
- |
{ |
369 |
|
- |
return new FloaterPositionHandler() |
370 |
|
- |
{ |
|
312 |
+ |
private FloaterPositionHandler createHeightPositionHandler() { |
|
313 |
+ |
return new FloaterPositionHandler() { |
371 |
314 |
|
@Override |
372 |
|
- |
public int getPos() |
373 |
|
- |
{ |
|
315 |
+ |
public int getPos() { |
374 |
316 |
|
return getPosTop(); |
375 |
317 |
|
} |
376 |
318 |
|
|
377 |
319 |
|
@Override |
378 |
|
- |
public void setPos( int pNewPos ) |
379 |
|
- |
{ |
|
320 |
+ |
public void setPos( int pNewPos ) { |
380 |
321 |
|
setPosTop( pNewPos ); |
381 |
322 |
|
} |
382 |
323 |
|
|
383 |
324 |
|
@Override |
384 |
|
- |
public int getMaxPotentialSize() |
385 |
|
- |
{ |
|
325 |
+ |
public int getMaxPotentialSize() { |
386 |
326 |
|
return getMaxPotentialHeight(); |
387 |
327 |
|
} |
388 |
328 |
|
}; |
|
@@ -391,38 +331,31 @@ |
391 |
331 |
|
protected DeferableFloaterDimensionHandler mHeightHandler = // |
392 |
332 |
|
new DeferableFloaterDimensionHandler( this, mLogger, getHeightHelper(), createHeightPositionHandler() ); |
393 |
333 |
|
|
394 |
|
- |
private boolean setTitleBarPrefferredHeight() |
395 |
|
- |
{ |
|
334 |
+ |
private boolean setTitleBarPrefferredHeight() { |
396 |
335 |
|
int height = getPrefferredHeight( mTitleBarPanel ); |
397 |
|
- |
if ( height > 0 ) |
398 |
|
- |
{ |
|
336 |
+ |
if ( height > 0 ) { |
399 |
337 |
|
setHeightOn( mTitleBarPanel, height, mTsLeftTitleBar, mTsRightTitleBar ); |
400 |
338 |
|
return true; |
401 |
339 |
|
} |
402 |
340 |
|
return false; |
403 |
341 |
|
} |
404 |
342 |
|
|
405 |
|
- |
private boolean setContentPrefferredHeight() |
406 |
|
- |
{ |
|
343 |
+ |
private boolean setContentPrefferredHeight() { |
407 |
344 |
|
int height = getPrefferredHeight( mContent ); |
408 |
|
- |
if ( height > 0 ) |
409 |
|
- |
{ |
|
345 |
+ |
if ( height > 0 ) { |
410 |
346 |
|
setContentHeight( height ); |
411 |
347 |
|
return true; |
412 |
348 |
|
} |
413 |
349 |
|
return false; |
414 |
350 |
|
} |
415 |
351 |
|
|
416 |
|
- |
private void setContentHeight( int pHeight ) |
417 |
|
- |
{ |
|
352 |
+ |
private void setContentHeight( int pHeight ) { |
418 |
353 |
|
mHeightHandler.LLsetDimension( mTitleBarPanel.getOffsetHeight() + BORDER_TB_H + setHeightOn( mContent, pHeight, mTsLeftContent, mTsRightContent ) ); |
419 |
354 |
|
} |
420 |
355 |
|
|
421 |
|
- |
private int setHeightOn( Widget pWidget, int pHeight, Widget pLeftBorder, Widget pRightBorder ) |
422 |
|
- |
{ |
|
356 |
+ |
private int setHeightOn( Widget pWidget, int pHeight, Widget pLeftBorder, Widget pRightBorder ) { |
423 |
357 |
|
int zBorderHeight = pHeight - CplusSize; |
424 |
|
- |
if ( zBorderHeight < 1 ) |
425 |
|
- |
{ |
|
358 |
+ |
if ( zBorderHeight < 1 ) { |
426 |
359 |
|
pHeight = CplusSize + (zBorderHeight = 1); // MinContentHeight |
427 |
360 |
|
} |
428 |
361 |
|
pWidget.setHeight( "" + pHeight ); |
|
@@ -432,28 +365,23 @@ |
432 |
365 |
|
} |
433 |
366 |
|
|
434 |
367 |
|
@Override |
435 |
|
- |
protected void distributeToChildrenChangedWidth() |
436 |
|
- |
{ |
|
368 |
+ |
protected void distributeToChildrenChangedWidth() { |
437 |
369 |
|
setWidths( getOurInnerSize( getWidthHelper() ) - BORDER_LR_W ); |
438 |
370 |
|
} |
439 |
371 |
|
|
440 |
372 |
|
@Override |
441 |
|
- |
protected void distributeToChildrenChangedHeight() |
442 |
|
- |
{ |
|
373 |
+ |
protected void distributeToChildrenChangedHeight() { |
443 |
374 |
|
int size = getOurInnerSize( getHeightHelper() ) - BORDER_TB_H; |
444 |
375 |
|
setContentHeight( size - mTitleBarPanel.getOffsetHeight() ); |
445 |
376 |
|
} |
446 |
377 |
|
|
447 |
|
- |
private int getOurInnerSize( ISizeableDimensionHelper pDimensionHelper ) |
448 |
|
- |
{ |
|
378 |
+ |
private int getOurInnerSize( ISizeableDimensionHelper pDimensionHelper ) { |
449 |
379 |
|
return pDimensionHelper.getDimension() - pDimensionHelper.getDecorationSize(); |
450 |
380 |
|
} |
451 |
381 |
|
|
452 |
|
- |
private boolean setWidths( int pDesiredWidth ) |
453 |
|
- |
{ |
|
382 |
+ |
private boolean setWidths( int pDesiredWidth ) { |
454 |
383 |
|
int zBorderWidth = pDesiredWidth - CplusSize2; |
455 |
|
- |
if ( zBorderWidth < 1 ) |
456 |
|
- |
{ |
|
384 |
+ |
if ( zBorderWidth < 1 ) { |
457 |
385 |
|
pDesiredWidth = CplusSize + (zBorderWidth = 1); // MinContentWidth |
458 |
386 |
|
} |
459 |
387 |
|
|
|
@@ -471,118 +399,98 @@ |
471 |
399 |
|
* @param w the child widget to be added |
472 |
400 |
|
*/ |
473 |
401 |
|
@Override |
474 |
|
- |
public void add( Widget w ) |
475 |
|
- |
{ |
|
402 |
+ |
public void add( Widget w ) { |
476 |
403 |
|
throw new IllegalStateException( "Use setWidget()" ); |
477 |
404 |
|
} |
478 |
405 |
|
|
479 |
406 |
|
@Override |
480 |
|
- |
public boolean remove( Widget w ) |
481 |
|
- |
{ |
|
407 |
+ |
public boolean remove( Widget w ) { |
482 |
408 |
|
throw new IllegalStateException( "Use setWidget()" ); |
483 |
409 |
|
} |
484 |
410 |
|
|
485 |
411 |
|
@Override |
486 |
|
- |
public boolean anyChildren() |
487 |
|
- |
{ |
|
412 |
+ |
public boolean anyChildren() { |
488 |
413 |
|
return (mChildren.size() != 0); |
489 |
414 |
|
} |
490 |
415 |
|
|
491 |
416 |
|
@Override |
492 |
|
- |
public Iterator<Widget> iterator() |
493 |
|
- |
{ |
|
417 |
+ |
public Iterator<Widget> iterator() { |
494 |
418 |
|
return mChildren.iterator(); |
495 |
419 |
|
} |
496 |
420 |
|
|
497 |
421 |
|
@Override |
498 |
|
- |
public Widget getWidget( int index ) |
499 |
|
- |
{ |
|
422 |
+ |
public Widget getWidget( int index ) { |
500 |
423 |
|
return mChildren.get( index ); |
501 |
424 |
|
} |
502 |
425 |
|
|
503 |
426 |
|
@Override |
504 |
|
- |
public int getWidgetCount() |
505 |
|
- |
{ |
|
427 |
+ |
public int getWidgetCount() { |
506 |
428 |
|
return mChildren.size(); |
507 |
429 |
|
} |
508 |
430 |
|
|
509 |
431 |
|
@Override |
510 |
|
- |
public int getWidgetIndex( Widget child ) |
511 |
|
- |
{ |
|
432 |
+ |
public int getWidgetIndex( Widget child ) { |
512 |
433 |
|
return mChildren.indexOf( child ); |
513 |
434 |
|
} |
514 |
435 |
|
|
515 |
436 |
|
@Override |
516 |
|
- |
public boolean remove( int index ) |
517 |
|
- |
{ |
|
437 |
+ |
public boolean remove( int index ) { |
518 |
438 |
|
return false; |
519 |
439 |
|
} |
520 |
440 |
|
|
521 |
|
- |
private static class OurTextOnlyTitleBar extends FloaterTitleBar |
522 |
|
- |
{ |
|
441 |
+ |
private static class OurTextOnlyTitleBar extends FloaterTitleBar { |
523 |
442 |
|
private SizeableLabel mLabel = new SizeableLabel( "", false ).stretchableHorizontally(); |
524 |
443 |
|
|
525 |
|
- |
public OurTextOnlyTitleBar() |
526 |
|
- |
{ |
|
444 |
+ |
public OurTextOnlyTitleBar() { |
527 |
445 |
|
add( mLabel ); |
528 |
446 |
|
add( new SizeableSpacer().width( 10 ).stretchableHorizontally() ); |
529 |
447 |
|
} |
530 |
448 |
|
|
531 |
449 |
|
@Override |
532 |
|
- |
public String getTitleBarTitle() |
533 |
|
- |
{ |
|
450 |
+ |
public String getTitleBarTitle() { |
534 |
451 |
|
return mLabel.getText(); |
535 |
452 |
|
} |
536 |
453 |
|
|
537 |
454 |
|
@Override |
538 |
|
- |
public void setTitleBarTitle( String pTitle ) |
539 |
|
- |
{ |
|
455 |
+ |
public void setTitleBarTitle( String pTitle ) { |
540 |
456 |
|
mLabel.setText( pTitle ); |
541 |
457 |
|
} |
542 |
458 |
|
} |
543 |
459 |
|
|
544 |
|
- |
private abstract static class AbstractResizer extends AbstractDragger |
545 |
|
- |
{ |
|
460 |
+ |
private abstract static class AbstractResizer extends AbstractDragger { |
546 |
461 |
|
private static final String MINIMUM_SIZE_REACHED = "Resizing Terminated, Minimum Size Reached"; |
547 |
462 |
|
|
548 |
463 |
|
private final UiPositionAndSizeAdjustable mTarget; |
549 |
464 |
|
|
550 |
|
- |
public AbstractResizer( UiPositionAndSizeAdjustable pTarget ) |
551 |
|
- |
{ |
|
465 |
+ |
public AbstractResizer( UiPositionAndSizeAdjustable pTarget ) { |
552 |
466 |
|
mTarget = pTarget; |
553 |
467 |
|
} |
554 |
468 |
|
|
555 |
|
- |
public UiPositionAndSizeAdjustable getTarget() |
556 |
|
- |
{ |
|
469 |
+ |
public UiPositionAndSizeAdjustable getTarget() { |
557 |
470 |
|
return mTarget; |
558 |
471 |
|
} |
559 |
472 |
|
|
560 |
|
- |
protected boolean adjustPositionBy( int pDeltaX, int pDeltaY ) |
561 |
|
- |
{ |
|
473 |
+ |
protected boolean adjustPositionBy( int pDeltaX, int pDeltaY ) { |
562 |
474 |
|
// System.out.println( "adjustPositionBy(" + pDeltaX + "," + pDeltaY + ")" ); |
563 |
475 |
|
getTarget().setPosition( getTarget().getPosLeft() + pDeltaX, getTarget().getPosTop() + pDeltaY ); |
564 |
476 |
|
return true; |
565 |
477 |
|
} |
566 |
478 |
|
|
567 |
|
- |
protected boolean adjustSizeBy( int pDeltaX, int pDeltaY ) |
568 |
|
- |
{ |
|
479 |
+ |
protected boolean adjustSizeBy( int pDeltaX, int pDeltaY ) { |
569 |
480 |
|
// System.out.println( "adjustSizeBy(" + pDeltaX + "," + pDeltaY + ")" ); |
570 |
481 |
|
return getTarget().adjustWidthBy( pDeltaX ) && getTarget().adjustHeightBy( pDeltaY ); |
571 |
482 |
|
} |
572 |
483 |
|
|
573 |
484 |
|
@Override |
574 |
|
- |
public void start( MouseEvent e ) |
575 |
|
- |
{ |
|
485 |
+ |
public void start( MouseEvent e ) { |
576 |
486 |
|
super.start( e ); |
577 |
487 |
|
StatusBar.remove( MINIMUM_SIZE_REACHED ); |
578 |
488 |
|
} |
579 |
489 |
|
|
580 |
490 |
|
@Override |
581 |
|
- |
protected final boolean dragBy( int pDeltaX, int pDeltaY ) |
582 |
|
- |
{ |
|
491 |
+ |
protected final boolean dragBy( int pDeltaX, int pDeltaY ) { |
583 |
492 |
|
boolean success = dragByInner( pDeltaX, pDeltaY ); |
584 |
|
- |
if ( !success ) |
585 |
|
- |
{ |
|
493 |
+ |
if ( !success ) { |
586 |
494 |
|
StatusBar.add( MINIMUM_SIZE_REACHED ); |
587 |
495 |
|
} |
588 |
496 |
|
return success; |
|
@@ -591,120 +499,95 @@ |
591 |
499 |
|
abstract protected boolean dragByInner( int pDeltaX, int pDeltaY ); |
592 |
500 |
|
} |
593 |
501 |
|
|
594 |
|
- |
private static class ResizerTopLeft extends AbstractResizer |
595 |
|
- |
{ |
596 |
|
- |
public ResizerTopLeft( UiPositionAndSizeAdjustable pTarget ) |
597 |
|
- |
{ |
|
502 |
+ |
private static class ResizerTopLeft extends AbstractResizer { |
|
503 |
+ |
public ResizerTopLeft( UiPositionAndSizeAdjustable pTarget ) { |
598 |
504 |
|
super( pTarget ); |
599 |
505 |
|
} |
600 |
506 |
|
|
601 |
507 |
|
@Override |
602 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
603 |
|
- |
{ |
|
508 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
604 |
509 |
|
return adjustSizeBy( -pDeltaX, -pDeltaY ) && adjustPositionBy( pDeltaX, pDeltaY ); |
605 |
510 |
|
} |
606 |
511 |
|
} |
607 |
512 |
|
|
608 |
|
- |
private static class ResizerTopRight extends AbstractResizer |
609 |
|
- |
{ |
610 |
|
- |
public ResizerTopRight( UiPositionAndSizeAdjustable pTarget ) |
611 |
|
- |
{ |
|
513 |
+ |
private static class ResizerTopRight extends AbstractResizer { |
|
514 |
+ |
public ResizerTopRight( UiPositionAndSizeAdjustable pTarget ) { |
612 |
515 |
|
super( pTarget ); |
613 |
516 |
|
} |
614 |
517 |
|
|
615 |
518 |
|
@Override |
616 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
617 |
|
- |
{ |
|
519 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
618 |
520 |
|
return adjustSizeBy( pDeltaX, -pDeltaY ) && adjustPositionBy( 0, pDeltaY ); |
619 |
521 |
|
} |
620 |
522 |
|
} |
621 |
523 |
|
|
622 |
|
- |
private static class ResizerBottomRight extends AbstractResizer |
623 |
|
- |
{ |
624 |
|
- |
public ResizerBottomRight( UiPositionAndSizeAdjustable pTarget ) |
625 |
|
- |
{ |
|
524 |
+ |
private static class ResizerBottomRight extends AbstractResizer { |
|
525 |
+ |
public ResizerBottomRight( UiPositionAndSizeAdjustable pTarget ) { |
626 |
526 |
|
super( pTarget ); |
627 |
527 |
|
} |
628 |
528 |
|
|
629 |
529 |
|
@Override |
630 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
631 |
|
- |
{ |
|
530 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
632 |
531 |
|
return adjustSizeBy( pDeltaX, pDeltaY ); |
633 |
532 |
|
} |
634 |
533 |
|
} |
635 |
534 |
|
|
636 |
|
- |
private static class ResizerBottomLeft extends AbstractResizer |
637 |
|
- |
{ |
638 |
|
- |
public ResizerBottomLeft( UiPositionAndSizeAdjustable pTarget ) |
639 |
|
- |
{ |
|
535 |
+ |
private static class ResizerBottomLeft extends AbstractResizer { |
|
536 |
+ |
public ResizerBottomLeft( UiPositionAndSizeAdjustable pTarget ) { |
640 |
537 |
|
super( pTarget ); |
641 |
538 |
|
} |
642 |
539 |
|
|
643 |
540 |
|
@Override |
644 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
645 |
|
- |
{ |
|
541 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
646 |
542 |
|
return adjustSizeBy( -pDeltaX, pDeltaY ) && adjustPositionBy( pDeltaX, 0 ); |
647 |
543 |
|
} |
648 |
544 |
|
} |
649 |
545 |
|
|
650 |
|
- |
private static class ResizerTop extends AbstractResizer |
651 |
|
- |
{ |
652 |
|
- |
public ResizerTop( UiPositionAndSizeAdjustable pTarget ) |
653 |
|
- |
{ |
|
546 |
+ |
private static class ResizerTop extends AbstractResizer { |
|
547 |
+ |
public ResizerTop( UiPositionAndSizeAdjustable pTarget ) { |
654 |
548 |
|
super( pTarget ); |
655 |
549 |
|
} |
656 |
550 |
|
|
657 |
551 |
|
@Override |
658 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
659 |
|
- |
{ |
|
552 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
660 |
553 |
|
return adjustSizeBy( 0, -pDeltaY ) && adjustPositionBy( 0, pDeltaY ); |
661 |
554 |
|
} |
662 |
555 |
|
} |
663 |
556 |
|
|
664 |
|
- |
private static class ResizerBottom extends AbstractResizer |
665 |
|
- |
{ |
666 |
|
- |
public ResizerBottom( UiPositionAndSizeAdjustable pTarget ) |
667 |
|
- |
{ |
|
557 |
+ |
private static class ResizerBottom extends AbstractResizer { |
|
558 |
+ |
public ResizerBottom( UiPositionAndSizeAdjustable pTarget ) { |
668 |
559 |
|
super( pTarget ); |
669 |
560 |
|
} |
670 |
561 |
|
|
671 |
562 |
|
@Override |
672 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
673 |
|
- |
{ |
|
563 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
674 |
564 |
|
return adjustSizeBy( 0, pDeltaY ); |
675 |
565 |
|
} |
676 |
566 |
|
} |
677 |
567 |
|
|
678 |
|
- |
private static class ResizerRight extends AbstractResizer |
679 |
|
- |
{ |
680 |
|
- |
public ResizerRight( UiPositionAndSizeAdjustable pTarget ) |
681 |
|
- |
{ |
|
568 |
+ |
private static class ResizerRight extends AbstractResizer { |
|
569 |
+ |
public ResizerRight( UiPositionAndSizeAdjustable pTarget ) { |
682 |
570 |
|
super( pTarget ); |
683 |
571 |
|
} |
684 |
572 |
|
|
685 |
573 |
|
@Override |
686 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
687 |
|
- |
{ |
|
574 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
688 |
575 |
|
return adjustSizeBy( pDeltaX, 0 ); |
689 |
576 |
|
} |
690 |
577 |
|
} |
691 |
578 |
|
|
692 |
|
- |
private static class ResizerLeft extends AbstractResizer |
693 |
|
- |
{ |
694 |
|
- |
public ResizerLeft( UiPositionAndSizeAdjustable pTarget ) |
695 |
|
- |
{ |
|
579 |
+ |
private static class ResizerLeft extends AbstractResizer { |
|
580 |
+ |
public ResizerLeft( UiPositionAndSizeAdjustable pTarget ) { |
696 |
581 |
|
super( pTarget ); |
697 |
582 |
|
} |
698 |
583 |
|
|
699 |
584 |
|
@Override |
700 |
|
- |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) |
701 |
|
- |
{ |
|
585 |
+ |
protected boolean dragByInner( int pDeltaX, int pDeltaY ) { |
702 |
586 |
|
return adjustSizeBy( -pDeltaX, 0 ) && adjustPositionBy( pDeltaX, 0 ); |
703 |
587 |
|
} |
704 |
588 |
|
} |
705 |
589 |
|
|
706 |
|
- |
private Element LLaddTD( Element pTR, Widget pWidget ) |
707 |
|
- |
{ |
|
590 |
+ |
private Element LLaddTD( Element pTR, Widget pWidget ) { |
708 |
591 |
|
mChildren.add( pWidget ); |
709 |
592 |
|
|
710 |
593 |
|
Element zTD = DOM.createTD(); |
|
@@ -715,8 +598,7 @@ |
715 |
598 |
|
return zTD; |
716 |
599 |
|
} |
717 |
600 |
|
|
718 |
|
- |
private Element addTDWithColSpan3( Element pTR, Widget pWidget ) |
719 |
|
- |
{ |
|
601 |
+ |
private Element addTDWithColSpan3( Element pTR, Widget pWidget ) { |
720 |
602 |
|
Element zTD = LLaddTD( pTR, pWidget ); |
721 |
603 |
|
|
722 |
604 |
|
DOM.setElementPropertyInt( zTD, "colSpan", 3 ); |
|
@@ -724,50 +606,42 @@ |
724 |
606 |
|
return zTD; |
725 |
607 |
|
} |
726 |
608 |
|
|
727 |
|
- |
private void addTD( Element pTR, Widget pWidget ) |
728 |
|
- |
{ |
|
609 |
+ |
private void addTD( Element pTR, Widget pWidget ) { |
729 |
610 |
|
Element zTD = addTDWithColSpan3( pTR, pWidget ); |
730 |
611 |
|
DOM.setElementPropertyInt( zTD, "rowSpan", 2 ); |
731 |
612 |
|
} |
732 |
613 |
|
|
733 |
|
- |
private Widget addTD( Element pTR, String pBorderID, String pClassPlus, int pWidth, int pHeight, DragGesture pResizer ) |
734 |
|
- |
{ |
|
614 |
+ |
private Widget addTD( Element pTR, String pBorderID, String pClassPlus, int pWidth, int pHeight, DragGesture pResizer ) { |
735 |
615 |
|
Border border = new Border( "litesoft-" + mForm + "Border" + pBorderID + pClassPlus ); |
736 |
616 |
|
border.addController( createBorderDragController( pResizer ) ); |
737 |
617 |
|
border.addController( PreventSelectionController.getInstance() ); |
738 |
618 |
|
|
739 |
619 |
|
LLaddTD( pTR, border ); |
740 |
620 |
|
|
741 |
|
- |
if ( pWidth > 0 ) |
742 |
|
- |
{ |
|
621 |
+ |
if ( pWidth > 0 ) { |
743 |
622 |
|
border.setWidth( "" + pWidth ); |
744 |
623 |
|
} |
745 |
|
- |
if ( pHeight > 0 ) |
746 |
|
- |
{ |
|
624 |
+ |
if ( pHeight > 0 ) { |
747 |
625 |
|
border.setHeight( "" + pHeight ); |
748 |
626 |
|
} |
749 |
627 |
|
return border; |
750 |
628 |
|
} |
751 |
629 |
|
|
752 |
|
- |
private void addTDCorner( Element pTR, String pBorderID, int pWidth, int pHeight, DragGesture pResizer ) |
753 |
|
- |
{ |
|
630 |
+ |
private void addTDCorner( Element pTR, String pBorderID, int pWidth, int pHeight, DragGesture pResizer ) { |
754 |
631 |
|
addTD( pTR, pBorderID, "", pWidth, pHeight, pResizer ); |
755 |
632 |
|
} |
756 |
633 |
|
|
757 |
|
- |
private Widget addTDHorizontal( Element pTR, String pBorderID, int pHeight, DragGesture pResizer ) |
758 |
|
- |
{ |
|
634 |
+ |
private Widget addTDHorizontal( Element pTR, String pBorderID, int pHeight, DragGesture pResizer ) { |
759 |
635 |
|
return addTD( pTR, pBorderID, "", 0, pHeight, pResizer ); |
760 |
636 |
|
} |
761 |
637 |
|
|
762 |
|
- |
private Widget addTDVertical( Element pTR, String pBorderID, String pClassPlus, int pWidth, DragGesture pResizer ) |
763 |
|
- |
{ |
|
638 |
+ |
private Widget addTDVertical( Element pTR, String pBorderID, String pClassPlus, int pWidth, DragGesture pResizer ) { |
764 |
639 |
|
return addTD( pTR, pBorderID, pClassPlus, pWidth, 0, pResizer ); |
765 |
640 |
|
} |
766 |
641 |
|
|
767 |
642 |
|
abstract protected DragController createBorderDragController( DragGesture pResizer ); |
768 |
643 |
|
|
769 |
|
- |
protected void finishContainerTable( UiPositionAndSizeAdjustable pTarget ) |
770 |
|
- |
{ |
|
644 |
+ |
protected void finishContainerTable( UiPositionAndSizeAdjustable pTarget ) { |
771 |
645 |
|
Element zTR, tBody = getContainerElement(); |
772 |
646 |
|
|
773 |
647 |
|
DragGesture resizerTopLeft = new ResizerTopLeft( pTarget ); |
|
@@ -828,10 +702,8 @@ |
828 |
702 |
|
|
829 |
703 |
|
private Widget mTsTop, mTsBottom, mTsLeftTitleBar, mTsRightTitleBar, mTsLeftContent, mTsRightContent; |
830 |
704 |
|
|
831 |
|
- |
private static class Border extends CWrapper |
832 |
|
- |
{ |
833 |
|
- |
public Border( String pStyle ) |
834 |
|
- |
{ |
|
705 |
+ |
private static class Border extends CWrapper { |
|
706 |
+ |
public Border( String pStyle ) { |
835 |
707 |
|
super( new SimplePanel() ); |
836 |
708 |
|
SimplePanel panel = (SimplePanel) getWidget(); |
837 |
709 |
|
panel.setWidget( new Spacer( 0 ) ); |
|
@@ -839,28 +711,22 @@ |
839 |
711 |
|
} |
840 |
712 |
|
} |
841 |
713 |
|
|
842 |
|
- |
protected boolean allowDragging() |
843 |
|
- |
{ |
|
714 |
+ |
protected boolean allowDragging() { |
844 |
715 |
|
return true; |
845 |
716 |
|
} |
846 |
717 |
|
|
847 |
|
- |
protected DragController createDragController( DragGesture pDragGesture ) |
848 |
|
- |
{ |
849 |
|
- |
return new DragController( new MousePerformanceFilter( new MouseDragHandler( pDragGesture ) ) ) |
850 |
|
- |
{ |
|
718 |
+ |
protected DragController createDragController( DragGesture pDragGesture ) { |
|
719 |
+ |
return new DragController( new MousePerformanceFilter( new MouseDragHandler( pDragGesture ) ) ) { |
851 |
720 |
|
@Override |
852 |
|
- |
public void onBrowserEvent( Widget widget, Event event ) |
853 |
|
- |
{ |
854 |
|
- |
if ( allowDragging() ) |
855 |
|
- |
{ |
|
721 |
+ |
public void onBrowserEvent( Widget widget, Event event ) { |
|
722 |
+ |
if ( allowDragging() ) { |
856 |
723 |
|
super.onBrowserEvent( widget, event ); |
857 |
724 |
|
} |
858 |
725 |
|
} |
859 |
726 |
|
}; |
860 |
727 |
|
} |
861 |
728 |
|
|
862 |
|
- |
protected DragGesture createThresholdFilter( DragGesture pDragGesture ) |
863 |
|
- |
{ |
|
729 |
+ |
protected DragGesture createThresholdFilter( DragGesture pDragGesture ) { |
864 |
730 |
|
/* |
865 |
731 |
|
* using a 1px drag tolerance prevents drag style from being applied |
866 |
732 |
|
* (and scrollbar flickering in FF) when a window is brought to front |