litesoft
@ 540
litesoft / trunk / GWT_Sandbox / MultiModule / groupBack / src / org / litesoft / sandbox / multimodule / groupback / client / top / TopViewImpl.java
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 56 57 58 59 60 61 62 63 |
package org.litesoft.sandbox.multimodule.groupback.client.top; import org.litesoft.sandbox.infrastructure.client.widgets.*; import org.litesoft.sandbox.multimodule.foundation.client.*; import org.litesoft.sandbox.multimodule.foundation.client.support.*; import org.litesoft.sandbox.multimodule.foundation.client.widgets.*; import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; public class TopViewImpl implements TopView, FaceSwitcher { private final DieRotator mDieRotator = new DieRotator( this ); private final Places mCenter = Places.Top; private final Widget mAsWidget; private Presenter mPresenter; private Long mLuckyId; public TopViewImpl() { String zSection = "BackGroup"; VerticalPanel zPanel = new VerticalPanel(); zPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); zPanel.add( new HelpWidget( zSection, "" + mCenter ) ); zPanel.add( new Label( "" + mCenter ) ); zPanel.add( mDieRotator ); zPanel.add( new Button( "Feeling Lucky", new ClickHandler() { @Override public void onClick( ClickEvent event ) { switchTo( PlacesSupport.deNull( mLuckyId, mCenter.getOppositeFace() ) ); } } ) ); zPanel.add( new HelpWidget( zSection, "Lucky" ) ); mAsWidget = zPanel; } @Override public void setPresenter( Presenter pPresenter ) { mDieRotator.setDie( (mPresenter = pPresenter).getDie() ); } @Override public void setLuckyId( Long pLuckyId ) { mLuckyId = pLuckyId; } @Override public Widget asWidget() { return mAsWidget; } @Override public void switchTo( Places pPlace ) { mPresenter.goTo( PlacesSupport.createPlace( pPlace, (long) mCenter.getOppositeFace().ordinal() ) ); } } |