litesoft
@ 804
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
package org.litesoft.mgwt.client; import org.litesoft.GWT.client.pavsupport.*; import org.litesoft.core.typeutils.*; import com.google.gwt.place.shared.*; import com.google.gwt.user.client.ui.*; import com.googlecode.mgwt.mvp.client.*; public class AnimatedDisplayAdaptor implements PlaceChangeListener, AcceptsOneWidget, AnimationEndCallback { private final AnimatableDisplay mAnimatableDisplay; private final AnimationMapper mAnimationMapper; private boolean currentIsFirst = false; private Animation mNextAnimation; public AnimatedDisplayAdaptor( AnimatableDisplay pAnimatableDisplay, AnimationMapper pAnimationMapper ) { mAnimatableDisplay = Objects.assertNotNull( "AnimatableDisplay", pAnimatableDisplay ); mAnimationMapper = Objects.assertNotNull( "AnimationMapper", pAnimationMapper ); } @Override public void placeChange( Source pSource, Place pPreviousPlace, Place pNewPlace ) { mNextAnimation = mAnimationMapper.getAnimation( pSource, pPreviousPlace, pNewPlace ); } @Override public void setWidget( IsWidget w ) { if ( mNextAnimation != null ) { currentIsFirst = !currentIsFirst; if ( currentIsFirst ) { mAnimatableDisplay.setFirstWidget( w ); } else { mAnimatableDisplay.setSecondWidget( w ); } mAnimatableDisplay.animate( mNextAnimation, currentIsFirst, this ); } } @Override public void onAnimationEnd() { } } |