Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/GWT_Sandbox/MultiModuleSingleSrc/main/src/org/litesoft/sandbox/multimodule/client/module/groupback/top/TopViewImpl.java

Diff revisions: vs.
  @@ -1,70 +1,70 @@
1 - package org.litesoft.sandbox.multimodule.client.module.groupback.top;
2 -
3 - import org.litesoft.GWT.client.pavsupport.*;
4 - import org.litesoft.GWT.client.util.*;
5 - import org.litesoft.GWT.client.widgets.*;
6 - import org.litesoft.sandbox.multimodule.client.foundation.places.*;
7 - import org.litesoft.sandbox.multimodule.client.foundation.support.*;
8 - import org.litesoft.sandbox.multimodule.client.foundation.widgets.*;
9 -
10 - import com.google.gwt.event.dom.client.*;
11 - import com.google.gwt.user.client.ui.Button;
12 - import com.google.gwt.user.client.ui.*;
13 -
14 - public class TopViewImpl extends AbstractViewImpl<TopView.Presenter> implements TopView,
15 - FaceSwitcher {
16 - private final DieRotator mDieRotator = new DieRotator( this );
17 - private final EnumPlaces mCenter = EnumPlaces.Top;
18 - private final Widget mAsWidget;
19 - private Long mLuckyId;
20 -
21 - public TopViewImpl() {
22 - VerticalPanel zPanel = new VerticalPanel();
23 - zPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
24 - zPanel.add( new Label( "" + mCenter ) );
25 - zPanel.add( mDieRotator );
26 - zPanel.add( Panels.horizontal( new Button( "Home", createHomeClickHandler() ), //
27 - new NewSpacer().width( 20 ), //
28 - new Button( "Gamble", createFeelingLuckyClickHandler() ) ) );
29 - mAsWidget = zPanel;
30 - }
31 -
32 - private ClickHandler createHomeClickHandler() {
33 - return new ClickHandler() {
34 - @Override
35 - public void onClick( ClickEvent event ) {
36 - switchTo( EnumPlaces.Home );
37 - }
38 - };
39 - }
40 -
41 - private ClickHandler createFeelingLuckyClickHandler() {
42 - return new ClickHandler() {
43 - @Override
44 - public void onClick( ClickEvent event ) {
45 - switchTo( EnumPlaces.deNull( mLuckyId, mCenter.getOppositeFace() ) );
46 - }
47 - };
48 - }
49 -
50 - @Override
51 - public void setPresenter( Presenter pPresenter ) {
52 - super.setPresenter( pPresenter );
53 - mDieRotator.setDie( pPresenter.getDie() );
54 - }
55 -
56 - @Override
57 - public void setLuckyId( Long pLuckyId ) {
58 - mLuckyId = pLuckyId;
59 - }
60 -
61 - @Override
62 - public Widget asWidget() {
63 - return mAsWidget;
64 - }
65 -
66 - @Override
67 - public void switchTo( EnumPlaces pPlace ) {
68 - mPresenter.goForwardTo( EnumPlaces.createPlace( pPlace, (long) mCenter.getOppositeFace().ordinal() ) );
69 - }
70 - }
1 + package org.litesoft.sandbox.multimodule.client.module.groupback.top;
2 +
3 + import org.litesoft.GWT.client.pavsupport.*;
4 + import org.litesoft.GWT.client.util.*;
5 + import org.litesoft.GWT.client.widgets.*;
6 + import org.litesoft.sandbox.multimodule.client.foundation.places.*;
7 + import org.litesoft.sandbox.multimodule.client.foundation.support.*;
8 + import org.litesoft.sandbox.multimodule.client.foundation.widgets.*;
9 +
10 + import com.google.gwt.event.dom.client.*;
11 + import com.google.gwt.user.client.ui.Button;
12 + import com.google.gwt.user.client.ui.*;
13 +
14 + public class TopViewImpl extends AbstractViewImpl<TopView.Presenter> implements TopView,
15 + FaceSwitcher {
16 + private final DieRotator mDieRotator = new DieRotator( this );
17 + private final EnumPlaces mCenter = EnumPlaces.Top;
18 + private final Widget mAsWidget;
19 + private Long mLuckyId;
20 +
21 + public TopViewImpl() {
22 + VerticalPanel zPanel = new VerticalPanel();
23 + zPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
24 + zPanel.add( new Label( "" + mCenter ) );
25 + zPanel.add( mDieRotator );
26 + zPanel.add( Panels.horizontal( new Button( "Home", createHomeClickHandler() ), //
27 + new NewSpacer().width( 20 ), //
28 + new Button( "Gamble", createFeelingLuckyClickHandler() ) ) );
29 + mAsWidget = zPanel;
30 + }
31 +
32 + private ClickHandler createHomeClickHandler() {
33 + return new ClickHandler() {
34 + @Override
35 + public void onClick( ClickEvent event ) {
36 + switchTo( EnumPlaces.Home );
37 + }
38 + };
39 + }
40 +
41 + private ClickHandler createFeelingLuckyClickHandler() {
42 + return new ClickHandler() {
43 + @Override
44 + public void onClick( ClickEvent event ) {
45 + switchTo( EnumPlaces.deNull( mLuckyId, mCenter.getOppositeFace() ) );
46 + }
47 + };
48 + }
49 +
50 + @Override
51 + public void setPresenter( Presenter pPresenter ) {
52 + super.setPresenter( pPresenter );
53 + mDieRotator.setDie( pPresenter.getDie() );
54 + }
55 +
56 + @Override
57 + public void setLuckyId( Long pLuckyId ) {
58 + mLuckyId = pLuckyId;
59 + }
60 +
61 + @Override
62 + public Widget asWidget() {
63 + return mAsWidget;
64 + }
65 +
66 + @Override
67 + public void switchTo( EnumPlaces pPlace ) {
68 + mPresenter.goForwardTo( EnumPlaces.createPlace( pPlace, (long) mCenter.getOppositeFace().ordinal() ) );
69 + }
70 + }