Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/UIdesign/src/com/test/uidesign/client/AccordionVerticalPairPanel.java

Diff revisions: vs.
  @@ -1,68 +1,56 @@
1 1 package com.test.uidesign.client;
2 2
3 - import java.util.*;
4 -
5 3 import org.litesoft.GWT.client.widgets.*;
6 4
7 5 import com.google.gwt.animation.client.*;
8 6 import com.google.gwt.dom.client.*;
9 7 import com.google.gwt.user.client.ui.*;
10 8
11 - public class AccordionVerticalPairPanel extends Composite
12 - {
13 - public static class WidgetPair
14 - {
9 + import java.util.*;
10 +
11 + public class AccordionVerticalPairPanel extends Composite {
12 + public static class WidgetPair {
15 13 private Widget mPrime, mSubordinate;
16 14 private boolean mShowing;
17 15 private PairPanel mPairPanel;
18 16
19 - public WidgetPair( Widget pPrime, Widget pSubordinate )
20 - {
17 + public WidgetPair( Widget pPrime, Widget pSubordinate ) {
21 18 mPrime = pPrime;
22 19 mSubordinate = pSubordinate;
23 20 }
24 21
25 - public Widget getPrime()
26 - {
22 + public Widget getPrime() {
27 23 return mPrime;
28 24 }
29 25
30 - public Widget getSubordinate()
31 - {
26 + public Widget getSubordinate() {
32 27 return mSubordinate;
33 28 }
34 29
35 - public boolean isSubordinateShowing()
36 - {
37 - if ( mShowing )
38 - {
30 + public boolean isSubordinateShowing() {
31 + if ( mShowing ) {
39 32 mShowing = checkPrimeAncestry( mPrime ) && checkSubordinateAncestry( mSubordinate );
40 33 }
41 34 return mShowing;
42 35 }
43 36
44 - private boolean isShowing()
45 - {
37 + private boolean isShowing() {
46 38 return mShowing;
47 39 }
48 40
49 - private void setShowing( boolean pShowing )
50 - {
41 + private void setShowing( boolean pShowing ) {
51 42 mShowing = pShowing;
52 43 }
53 44
54 - private static boolean hasContent( WidgetPair pPair )
55 - {
45 + private static boolean hasContent( WidgetPair pPair ) {
56 46 return (pPair != null) && (pPair.mPrime != null);
57 47 }
58 48
59 - private PairPanel getPairPanel()
60 - {
49 + private PairPanel getPairPanel() {
61 50 return mPairPanel;
62 51 }
63 52
64 - private void setPairPanel( PairPanel pPairPanel )
65 - {
53 + private void setPairPanel( PairPanel pPairPanel ) {
66 54 mPairPanel = pPairPanel;
67 55 }
68 56 }
  @@ -70,18 +58,15 @@
70 58 private VerticalPanel mContainer = new VerticalPanel();
71 59 private List<WidgetPair> mMembers = new ArrayList<WidgetPair>();
72 60
73 - public AccordionVerticalPairPanel()
74 - {
61 + public AccordionVerticalPairPanel() {
75 62 initWidget( mContainer );
76 63 }
77 64
78 - public boolean isEmpty()
79 - {
65 + public boolean isEmpty() {
80 66 return mMembers.isEmpty();
81 67 }
82 68
83 - public int size()
84 - {
69 + public int size() {
85 70 return mMembers.size();
86 71 }
87 72
  @@ -90,8 +75,7 @@
90 75 *
91 76 * @return true if the widgets were actually added.
92 77 */
93 - public boolean add( Widget pPrimeWidget, Widget pSubordinateWidget )
94 - {
78 + public boolean add( Widget pPrimeWidget, Widget pSubordinateWidget ) {
95 79 return add( new WidgetPair( pPrimeWidget, pSubordinateWidget ) );
96 80 }
97 81
  @@ -100,10 +84,8 @@
100 84 *
101 85 * @return true if the WidgetPair was actually added.
102 86 */
103 - public boolean add( WidgetPair pWidgetPair )
104 - {
105 - if ( WidgetPair.hasContent( pWidgetPair ) )
106 - {
87 + public boolean add( WidgetPair pWidgetPair ) {
88 + if ( WidgetPair.hasContent( pWidgetPair ) ) {
107 89 mMembers.add( pWidgetPair );
108 90 mContainer.add( new PairPanel( this, pWidgetPair ) );
109 91 return true;
  @@ -111,31 +93,24 @@
111 93 return false;
112 94 }
113 95
114 - public int indexOf( WidgetPair pWidgetPair )
115 - {
96 + public int indexOf( WidgetPair pWidgetPair ) {
116 97 return mMembers.indexOf( pWidgetPair );
117 98 }
118 99
119 - public int indexOfSubordinateWidget( Widget pSubordinateWidget )
120 - {
121 - for ( int i = 0; i < mMembers.size(); i++ )
122 - {
100 + public int indexOfSubordinateWidget( Widget pSubordinateWidget ) {
101 + for ( int i = 0; i < mMembers.size(); i++ ) {
123 102 WidgetPair zMember = mMembers.get( i );
124 - if ( pSubordinateWidget == zMember.getSubordinate() )
125 - {
103 + if ( pSubordinateWidget == zMember.getSubordinate() ) {
126 104 return i;
127 105 }
128 106 }
129 107 return -1;
130 108 }
131 109
132 - public int indexOfPrimeWidget( Widget pPrimeWidget )
133 - {
134 - for ( int i = 0; i < mMembers.size(); i++ )
135 - {
110 + public int indexOfPrimeWidget( Widget pPrimeWidget ) {
111 + for ( int i = 0; i < mMembers.size(); i++ ) {
136 112 WidgetPair zMember = mMembers.get( i );
137 - if ( pPrimeWidget == zMember.getPrime() )
138 - {
113 + if ( pPrimeWidget == zMember.getPrime() ) {
139 114 return i;
140 115 }
141 116 }
  @@ -145,8 +120,7 @@
145 120 /**
146 121 * @return true if contents changed (i.e. actually removed)
147 122 */
148 - public boolean remove( WidgetPair pWidgetPair )
149 - {
123 + public boolean remove( WidgetPair pWidgetPair ) {
150 124 int zIndex = indexOf( pWidgetPair );
151 125 return (zIndex != -1) && (null != remove( zIndex ));
152 126 }
  @@ -155,14 +129,11 @@
155 129 * @return WidgetPair that "was" at pIndex.
156 130 */
157 131 public WidgetPair remove( int pIndex )
158 - throws IndexOutOfBoundsException
159 - {
132 + throws IndexOutOfBoundsException {
160 133 WidgetPair zRemoved = mMembers.remove( pIndex );
161 - if ( zRemoved != null )
162 - {
134 + if ( zRemoved != null ) {
163 135 PairPanel zPairPanel = zRemoved.getPairPanel();
164 - if ( zPairPanel != null )
165 - {
136 + if ( zPairPanel != null ) {
166 137 zPairPanel.clear();
167 138 }
168 139 zRemoved.setShowing( false );
  @@ -174,14 +145,11 @@
174 145 /**
175 146 * Removes all widgets (both the Prime and the Subordinate).
176 147 */
177 - public void clear()
178 - {
148 + public void clear() {
179 149 mContainer.clear();
180 - for ( WidgetPair zMember : mMembers )
181 - {
150 + for ( WidgetPair zMember : mMembers ) {
182 151 PairPanel zPairPanel = zMember.getPairPanel();
183 - if ( zPairPanel != null )
184 - {
152 + if ( zPairPanel != null ) {
185 153 zPairPanel.clear();
186 154 }
187 155 zMember.setShowing( false );
  @@ -189,13 +157,10 @@
189 157 mMembers.clear();
190 158 }
191 159
192 - public void collapseAll()
193 - {
194 - for ( WidgetPair zMember : mMembers )
195 - {
160 + public void collapseAll() {
161 + for ( WidgetPair zMember : mMembers ) {
196 162 PairPanel zPairPanel = zMember.getPairPanel();
197 - if ( zPairPanel != null )
198 - {
163 + if ( zPairPanel != null ) {
199 164 zPairPanel.collapse();
200 165 }
201 166 zMember.setShowing( false );
  @@ -210,8 +175,7 @@
210 175 *
211 176 * @return true if the Subordinate Widget was located
212 177 */
213 - public boolean show( Widget pSubordinateWidget, boolean pShow )
214 - {
178 + public boolean show( Widget pSubordinateWidget, boolean pShow ) {
215 179 return showSubordinateWidgetOf( getPairFor( pSubordinateWidget ), pShow );
216 180 }
217 181
  @@ -222,8 +186,7 @@
222 186 * @param pShow what to do with the Subordinate Widget
223 187 */
224 188 public void showSubordinateWidgetAt( int pIndex, boolean pShow )
225 - throws IndexOutOfBoundsException
226 - {
189 + throws IndexOutOfBoundsException {
227 190 showSubordinateWidgetOf( mMembers.get( pIndex ), pShow );
228 191 }
229 192
  @@ -235,19 +198,13 @@
235 198 *
236 199 * @return true if the Widget Pair was located
237 200 */
238 - public boolean showSubordinateWidgetOf( WidgetPair pWidgetPair, boolean pShow )
239 - {
240 - if ( mMembers.contains( pWidgetPair ) )
241 - {
201 + public boolean showSubordinateWidgetOf( WidgetPair pWidgetPair, boolean pShow ) {
202 + if ( mMembers.contains( pWidgetPair ) ) {
242 203 PairPanel zPairPanel = pWidgetPair.getPairPanel();
243 - if ( zPairPanel != null )
244 - {
245 - if ( pShow )
246 - {
204 + if ( zPairPanel != null ) {
205 + if ( pShow ) {
247 206 zPairPanel.expand();
248 - }
249 - else
250 - {
207 + } else {
251 208 zPairPanel.collapse();
252 209 }
253 210 pWidgetPair.setShowing( pShow );
  @@ -257,28 +214,22 @@
257 214 return false;
258 215 }
259 216
260 - public boolean isShowing( Widget pSubordinateWidget )
261 - {
217 + public boolean isShowing( Widget pSubordinateWidget ) {
262 218 return isSubordinateWidgetShowing( getPairFor( pSubordinateWidget ) );
263 219 }
264 220
265 221 public boolean isSubordinateWidgetShowingAt( int pIndex )
266 - throws IndexOutOfBoundsException
267 - {
222 + throws IndexOutOfBoundsException {
268 223 return isSubordinateWidgetShowing( mMembers.get( pIndex ) );
269 224 }
270 225
271 - public boolean isSubordinateWidgetShowing( WidgetPair pWidgetPair )
272 - {
226 + public boolean isSubordinateWidgetShowing( WidgetPair pWidgetPair ) {
273 227 return mMembers.contains( pWidgetPair ) && pWidgetPair.isShowing();
274 228 }
275 229
276 - private WidgetPair getPairFor( Widget pSubordinateWidget )
277 - {
278 - for ( WidgetPair zMember : mMembers )
279 - {
280 - if ( pSubordinateWidget == zMember.getSubordinate() )
281 - {
230 + private WidgetPair getPairFor( Widget pSubordinateWidget ) {
231 + for ( WidgetPair zMember : mMembers ) {
232 + if ( pSubordinateWidget == zMember.getSubordinate() ) {
282 233 return zMember;
283 234 }
284 235 }
  @@ -288,22 +239,18 @@
288 239 /**
289 240 * Only called by the PairPanel that should be removed because the PairPanel has lost one of its widgets.
290 241 */
291 - private void removePair( PairPanel pPairPanel )
292 - {
293 - for ( int i = 0; i < mMembers.size(); i++ )
294 - {
242 + private void removePair( PairPanel pPairPanel ) {
243 + for ( int i = 0; i < mMembers.size(); i++ ) {
295 244 WidgetPair zMember = mMembers.get( i );
296 245 PairPanel zPairPanel = zMember.getPairPanel();
297 - if ( pPairPanel == zPairPanel )
298 - {
246 + if ( pPairPanel == zPairPanel ) {
299 247 remove( i );
300 248 return;
301 249 }
302 250 }
303 251 }
304 252
305 - private static boolean checkSubordinateAncestry( Widget pWidget )
306 - {
253 + private static boolean checkSubordinateAncestry( Widget pWidget ) {
307 254 return (pWidget == null) || //
308 255 (null != parentClassIs( PairPanel.class, //
309 256 parentClassIs( ClippingPanel.class, //
  @@ -311,19 +258,14 @@
311 258 pWidget ) ) ));
312 259 }
313 260
314 - private static boolean checkPrimeAncestry( Widget pWidget )
315 - {
261 + private static boolean checkPrimeAncestry( Widget pWidget ) {
316 262 return (null != parentClassIs( PairPanel.class, pWidget ));
317 263 }
318 264
319 - private static Widget parentClassIs( Class<?> pClass, Widget pWidget )
320 - {
321 - if ( pWidget != null )
322 - {
323 - if ( null != (pWidget = pWidget.getParent()) )
324 - {
325 - if ( pWidget.getClass() == pClass )
326 - {
265 + private static Widget parentClassIs( Class<?> pClass, Widget pWidget ) {
266 + if ( pWidget != null ) {
267 + if ( null != (pWidget = pWidget.getParent()) ) {
268 + if ( pWidget.getClass() == pClass ) {
327 269 return pWidget;
328 270 }
329 271 }
  @@ -331,26 +273,22 @@
331 273 return null;
332 274 }
333 275
334 - private static class PairPanel extends VerticalPanel
335 - {
276 + private static class PairPanel extends VerticalPanel {
336 277 private AccordionVerticalPairPanel mParent;
337 278 private ClippingPanel mClippingPanel;
338 279
339 - private PairPanel( AccordionVerticalPairPanel pParent, WidgetPair pWidgetPair )
340 - {
280 + private PairPanel( AccordionVerticalPairPanel pParent, WidgetPair pWidgetPair ) {
341 281 mParent = pParent;
342 282 add( pWidgetPair.getPrime() );
343 283 add( mClippingPanel = new ClippingPanel( this, pWidgetPair.getSubordinate() ) );
344 284 pWidgetPair.setPairPanel( this );
345 285 }
346 286
347 - public void collapse()
348 - {
287 + public void collapse() {
349 288 mClippingPanel.collapse();
350 289 }
351 290
352 - public void expand()
353 - {
291 + public void expand() {
354 292 mClippingPanel.expand();
355 293 }
356 294
  @@ -359,12 +297,10 @@
359 297 * one of our children has been removed so we are no longer attached to our parent and are cleaning up).
360 298 */
361 299 @Override
362 - public void clear()
363 - {
300 + public void clear() {
364 301 mParent = null; // in case remove is called as part of the clear operation, then don't generate a potential infinite loop!
365 302 super.clear();
366 - if ( mClippingPanel != null )
367 - {
303 + if ( mClippingPanel != null ) {
368 304 mClippingPanel.clear();
369 305 mClippingPanel = null;
370 306 }
  @@ -376,11 +312,9 @@
376 312 * We Automatically remove ourselves from our Parent (AccordionVerticalPairPanel).
377 313 */
378 314 @Override
379 - public boolean remove( Widget w )
380 - {
315 + public boolean remove( Widget w ) {
381 316 boolean zRemoved = super.remove( w );
382 - if ( zRemoved )
383 - {
317 + if ( zRemoved ) {
384 318 if ( mParent != null ) // in case remove is called as part of the clear operation, then don't generate a potential infinite loop!
385 319 {
386 320 mParent.removePair( this );
  @@ -391,8 +325,7 @@
391 325 }
392 326 }
393 327
394 - private static class ClippingPanel extends SimplePanel
395 - {
328 + private static class ClippingPanel extends SimplePanel {
396 329 private PairPanel mParent;
397 330 private SubordinatePanel mSubordinatePanel;
398 331 private AnimatedVisibility mVisibility = AnimatedVisibility.Collapsed;
  @@ -401,8 +334,7 @@
401 334 private Integer mMaxHeight;
402 335 private HeightAnimator mAnimator;
403 336
404 - private ClippingPanel( PairPanel pParent, Widget pSubordinateWidget )
405 - {
337 + private ClippingPanel( PairPanel pParent, Widget pSubordinateWidget ) {
406 338 mParent = pParent;
407 339 setWidget( mSubordinatePanel = new SubordinatePanel( this, pSubordinateWidget ) );
408 340 getStyleElement().getStyle().setOverflow( Style.Overflow.HIDDEN );
  @@ -414,12 +346,10 @@
414 346 * our child has been removed so we are no longer attached to our parent and are cleaning up).
415 347 */
416 348 @Override
417 - public void clear()
418 - {
349 + public void clear() {
419 350 mParent = null; // in case remove is called as part of the clear operation, then don't generate a potential infinite loop!
420 351 super.clear();
421 - if ( mSubordinatePanel != null )
422 - {
352 + if ( mSubordinatePanel != null ) {
423 353 mSubordinatePanel.clear();
424 354 mSubordinatePanel = null;
425 355 }
  @@ -431,11 +361,9 @@
431 361 * We Automatically remove ourselves from our Parent (PairPanel).
432 362 */
433 363 @Override
434 - public boolean remove( Widget w )
435 - {
364 + public boolean remove( Widget w ) {
436 365 boolean zRemoved = super.remove( w );
437 - if ( zRemoved )
438 - {
366 + if ( zRemoved ) {
439 367 if ( mParent != null ) // in case remove is called as part of the clear operation, then don't generate a potential infinite loop!
440 368 {
441 369 mParent.remove( this );
  @@ -445,23 +373,18 @@
445 373 return zRemoved;
446 374 }
447 375
448 - public AnimatedVisibility getVisibility()
449 - {
376 + public AnimatedVisibility getVisibility() {
450 377 return mVisibility;
451 378 }
452 379
453 - public void collapse()
454 - {
455 - if ( sizingIsReadyWithNotReadyTarget( AnimatedVisibility.Collapsed ) && mVisibility.isExpandingOrExpanded() )
456 - {
380 + public void collapse() {
381 + if ( sizingIsReadyWithNotReadyTarget( AnimatedVisibility.Collapsed ) && mVisibility.isExpandingOrExpanded() ) {
457 382 transition( AnimatedVisibility.Collapsing, 1 );
458 383 }
459 384 }
460 385
461 - public void expand()
462 - {
463 - if ( sizingIsReadyWithNotReadyTarget( AnimatedVisibility.Expanded ) && mVisibility.isCollapsingOrCollapsed() )
464 - {
386 + public void expand() {
387 + if ( sizingIsReadyWithNotReadyTarget( AnimatedVisibility.Expanded ) && mVisibility.isCollapsingOrCollapsed() ) {
465 388 transition( AnimatedVisibility.Expanding, mMaxHeight );
466 389 }
467 390 }
  @@ -471,10 +394,8 @@
471 394 * it can take some time until it is actually rendered and hence actually has a size (of course if any
472 395 * element along the path to the root is display=none, then a size might NEVER arrive).
473 396 */
474 - private boolean sizingIsReadyWithNotReadyTarget( AnimatedVisibility pTargetVisibility )
475 - {
476 - if ( mMaxHeight == null )
477 - {
397 + private boolean sizingIsReadyWithNotReadyTarget( AnimatedVisibility pTargetVisibility ) {
398 + if ( mMaxHeight == null ) {
478 399 mTargetVisibility = pTargetVisibility;
479 400 return false;
480 401 }
  @@ -485,29 +406,23 @@
485 406 /**
486 407 * Called to indicate that Sizing is Ready!
487 408 */
488 - private void setMaxHeight( int pHeight )
489 - {
409 + private void setMaxHeight( int pHeight ) {
490 410 mMaxHeight = pHeight;
491 411 // Now dispatch the last request (if any) that occured before Sizing was Ready!
492 - if ( AnimatedVisibility.Collapsed == mTargetVisibility )
493 - {
412 + if ( AnimatedVisibility.Collapsed == mTargetVisibility ) {
494 413 collapse();
495 414 }
496 - if ( AnimatedVisibility.Expanded == mTargetVisibility )
497 - {
415 + if ( AnimatedVisibility.Expanded == mTargetVisibility ) {
498 416 expand();
499 417 }
500 418 }
501 419
502 - private void setCurrentHeight( int pHeight )
503 - {
504 - if ( pHeight < 2 )
505 - {
420 + private void setCurrentHeight( int pHeight ) {
421 + if ( pHeight < 2 ) {
506 422 mVisibility = AnimatedVisibility.Collapsed;
507 423 pHeight = 1;
508 424 }
509 - if ( mMaxHeight <= pHeight )
510 - {
425 + if ( mMaxHeight <= pHeight ) {
511 426 mVisibility = AnimatedVisibility.Expanded;
512 427 pHeight = mMaxHeight;
513 428 }
  @@ -515,10 +430,8 @@
515 430 setHeight( pHeight + "px" );
516 431 }
517 432
518 - private void transition( AnimatedVisibility pNewVisibility, int pTargetHeight )
519 - {
520 - if ( mAnimator != null )
521 - {
433 + private void transition( AnimatedVisibility pNewVisibility, int pTargetHeight ) {
434 + if ( mAnimator != null ) {
522 435 mAnimator.cancel();
523 436 mAnimator = null;
524 437 }
  @@ -528,13 +441,11 @@
528 441 }
529 442 }
530 443
531 - private static class SubordinatePanel extends VerticalPanel
532 - {
444 + private static class SubordinatePanel extends VerticalPanel {
533 445 private OurSizingDeterminer mSizingDeterminer = new OurSizingDeterminer();
534 446 private ClippingPanel mParent;
535 447
536 - private SubordinatePanel( ClippingPanel pParent, Widget pSubordinateWidget )
537 - {
448 + private SubordinatePanel( ClippingPanel pParent, Widget pSubordinateWidget ) {
538 449 mParent = pParent;
539 450 add( new TransparentImage() );
540 451 add( (null != pSubordinateWidget) ? pSubordinateWidget : new TransparentImage() );
  @@ -545,8 +456,7 @@
545 456 * one of our children has been removed so we are no longer attached to our parent and are cleaning up).
546 457 */
547 458 @Override
548 - public void clear()
549 - {
459 + public void clear() {
550 460 mParent = null; // in case remove is called as part of the clear operation, then don't generate a potential infinite loop!
551 461 super.clear();
552 462 }
  @@ -557,11 +467,9 @@
557 467 * We Automatically remove ourselves from our Parent (ClippingPanel).
558 468 */
559 469 @Override
560 - public boolean remove( Widget w )
561 - {
470 + public boolean remove( Widget w ) {
562 471 boolean zRemoved = super.remove( w );
563 - if ( zRemoved )
564 - {
472 + if ( zRemoved ) {
565 473 if ( mParent != null ) // in case remove is called as part of the clear operation, then don't generate a potential infinite loop!
566 474 {
567 475 mParent.remove( this );
  @@ -572,15 +480,13 @@
572 480 }
573 481
574 482 @Override
575 - protected void onAttach()
576 - {
483 + protected void onAttach() {
577 484 super.onAttach();
578 485 mSizingDeterminer.start();
579 486 }
580 487
581 488 @Override
582 - protected void onDetach()
583 - {
489 + protected void onDetach() {
584 490 super.onDetach();
585 491 mSizingDeterminer.stop();
586 492 }
  @@ -590,41 +496,33 @@
590 496 * it can take some time until it is actually rendered and hence actually has a size (of course if any
591 497 * element along the path to the root is display=none, then a size might NEVER arrive).
592 498 */
593 - private class OurSizingDeterminer extends com.google.gwt.user.client.Timer
594 - {
499 + private class OurSizingDeterminer extends com.google.gwt.user.client.Timer {
595 500 private Boolean mSizingDetermined;
596 501 private int mHeight = 1;
597 502
598 503 @Override
599 - public void run()
600 - {
504 + public void run() {
601 505 int zHeight = getOffsetHeight();
602 - if ( (1 < zHeight) && (zHeight == mHeight) )
603 - {
506 + if ( (1 < zHeight) && (zHeight == mHeight) ) {
604 507 mParent.setMaxHeight( zHeight );
605 508 mSizingDetermined = true;
606 509 return;
607 510 }
608 511 mHeight = zHeight;
609 - if ( mSizingDetermined != null )
610 - {
512 + if ( mSizingDetermined != null ) {
611 513 schedule( 50 );
612 514 }
613 515 }
614 516
615 - public void start()
616 - {
617 - if ( !Boolean.TRUE.equals( mSizingDetermined ) )
618 - {
517 + public void start() {
518 + if ( !Boolean.TRUE.equals( mSizingDetermined ) ) {
619 519 mSizingDetermined = false;
620 520 schedule( 50 );
621 521 }
622 522 }
623 523
624 - public void stop()
625 - {
626 - if ( Boolean.FALSE.equals( mSizingDetermined ) )
627 - {
524 + public void stop() {
525 + if ( Boolean.FALSE.equals( mSizingDetermined ) ) {
628 526 mSizingDetermined = null;
629 527 cancel();
630 528 }
  @@ -632,40 +530,34 @@
632 530 }
633 531 }
634 532
635 - private static class HeightAnimator extends Animation
636 - {
533 + private static class HeightAnimator extends Animation {
637 534 private ClippingPanel mClippingPanel;
638 535 private int mFromHeight;
639 536 private int mToHeight;
640 537 private int mDelta;
641 538 private boolean mCompleted = true;
642 539
643 - public HeightAnimator( ClippingPanel pClippingPanel, int pFromHeight, int pToHeight )
644 - {
540 + public HeightAnimator( ClippingPanel pClippingPanel, int pFromHeight, int pToHeight ) {
645 541 mClippingPanel = pClippingPanel;
646 542 mFromHeight = pFromHeight;
647 543 mToHeight = pToHeight;
648 544 mDelta = pToHeight - pFromHeight;
649 545 }
650 546
651 - public void start()
652 - {
547 + public void start() {
653 548 mCompleted = false;
654 549 run( Math.min( 700, Math.abs( 7 * mDelta ) ) );
655 550 }
656 551
657 552 @Override
658 - protected void onUpdate( double progress )
659 - {
660 - if ( !mCompleted )
661 - {
553 + protected void onUpdate( double progress ) {
554 + if ( !mCompleted ) {
662 555 mClippingPanel.setCurrentHeight( mFromHeight + (int) (progress * mDelta) );
663 556 }
664 557 }
665 558
666 559 @Override
667 - protected void onComplete()
668 - {
560 + protected void onComplete() {
669 561 mCompleted = true;
670 562 super.onComplete();
671 563 mClippingPanel.setCurrentHeight( mToHeight );