Subversion Repository Public Repository

litesoft

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
64
65
66
67
68
69
70
package org.litesoft.sandbox.multimodule.client.module.groupback.back;

import org.litesoft.GWT.client.pavsupport.*;
import org.litesoft.GWT.client.util.*;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.sandbox.multimodule.client.foundation.places.*;
import org.litesoft.sandbox.multimodule.client.foundation.support.*;
import org.litesoft.sandbox.multimodule.client.foundation.widgets.*;

import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.*;

public class BackViewImpl extends AbstractViewImpl<BackView.Presenter> implements BackView,
                                                                                  FaceSwitcher {
    private final DieRotator mDieRotator = new DieRotator( this );
    private final EnumPlaces mCenter = EnumPlaces.Back;
    private final Widget mAsWidget;
    private Long mLuckyId;

    public BackViewImpl() {
        VerticalPanel zPanel = new VerticalPanel();
        zPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
        zPanel.add( new Label( "" + mCenter ) );
        zPanel.add( mDieRotator );
        zPanel.add( Panels.horizontal( new Button( "Home", createHomeClickHandler() ), //
                                       new NewSpacer().width( 20 ), //
                                       new Button( "Gamble", createFeelingLuckyClickHandler() ) ) );
        mAsWidget = zPanel;
    }

    private ClickHandler createHomeClickHandler() {
        return new ClickHandler() {
            @Override
            public void onClick( ClickEvent event ) {
                switchTo( EnumPlaces.Home );
            }
        };
    }

    private ClickHandler createFeelingLuckyClickHandler() {
        return new ClickHandler() {
            @Override
            public void onClick( ClickEvent event ) {
                switchTo( EnumPlaces.deNull( mLuckyId, mCenter.getOppositeFace() ) );
            }
        };
    }

    @Override
    public void setPresenter( Presenter pPresenter ) {
        super.setPresenter( pPresenter );
        mDieRotator.setDie( pPresenter.getDie() );
    }

    @Override
    public void setLuckyId( Long pLuckyId ) {
        mLuckyId = pLuckyId;
    }

    @Override
    public Widget asWidget() {
        return mAsWidget;
    }

    @Override
    public void switchTo( EnumPlaces pPlace ) {
        mPresenter.goForwardTo( EnumPlaces.createPlace( pPlace, (long) mCenter.getOppositeFace().ordinal() ) );
    }
}

Commits for litesoft/trunk/GWT_Sandbox/MultiModuleSingleSrc/main/src/org/litesoft/sandbox/multimodule/client/module/groupback/back/BackViewImpl.java

Diff revisions: vs.
Revision Author Commited Message
950 Diff Diff GeorgeS picture GeorgeS Thu 19 Jun, 2014 17:57:04 +0000

New Lines

948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

778 Diff Diff GeorgeS picture GeorgeS Mon 16 Jul, 2012 00:55:41 +0000
749 Diff Diff GeorgeS picture GeorgeS Fri 06 Jul, 2012 00:11:43 +0000
713 Diff Diff GeorgeS picture GeorgeS Sat 09 Jun, 2012 22:47:07 +0000
696 Diff Diff GeorgeS picture GeorgeS Mon 28 May, 2012 18:26:29 +0000
669 GeorgeS picture GeorgeS Sun 13 May, 2012 23:29:27 +0000