Package Controller

Source Code of Controller.OthelloController

package Controller;

import BlazeDS.OthelloClient;
import BlazeDS.OthelloServer;
import Model.Othello.ModeJeu;
import Model.Othello.GridOthello;
import Model.Player.PlayerAbstract;
import Model.Player.PlayerComputer;
import Model.Player.Player;
import Model.Couleur;
import View.ChoiceGameView;
import View.GridView;
import View.ListWaitingPlayerView;
import View.LoginView;
import View.SubscribeView;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

// <editor-fold defaultstate="collapsed" desc=" UML Marker ">
// #[regen=yes,id=DCE.A2B784A1-1D7B-289D-6249-CCDA45B65F0A]
// </editor-fold>
public class OthelloController extends MIDlet {
   
    private Display _display;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.5D166415-45DA-594B-2FD0-A954B419A8A7]
    // </editor-fold>
    private ModeJeu _modeJeu;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.A5F23C6F-7C2F-FB8A-B939-DF0603220BC6]
    // </editor-fold>
    private GridView _gridView;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.63B5D8F9-D751-26F4-AA74-88E895BA5A14]
    // </editor-fold>
    private ListWaitingPlayerView _listWaitingPlayerView;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.C5623E1E-FBDD-D6C8-44D7-DB74A50FF67D]
    // </editor-fold>
    private LoginView _loginView;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.28B92E1B-8689-108F-36D3-073A82111479]
    // </editor-fold>
    private SubscribeView _subscribeView;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.72B02B5B-3BAF-AE3E-4181-C3ED0C833F04]
    // </editor-fold>
    private ChoiceGameView _choiceGameView;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.1953DC39-9760-9E82-BB11-C7FFD3DDAEF6]
    // </editor-fold>
    private GridOthello _gridOthello;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.BB37471D-39C8-6A59-7ABB-229EC936C696]
    // </editor-fold>
    private PlayerAbstract _redPlayer;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.089A4C7B-578A-EFE9-CE55-2A7B87DD5C28]
    // </editor-fold>
    private PlayerAbstract _blackPlayer;

    private PlayerAbstract _currentPlayer;

    private boolean _partieFinie;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.4D082E9A-74CA-0B5B-5654-566217108C93]
    // </editor-fold>
    private OthelloClient _othelloClient;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.10F04828-9F96-2801-E085-4E87D00DE73F]
    // </editor-fold>
    private OthelloServer _othelloServer;

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.4EAB780E-F4D3-C916-0300-8934AD7DA253]
    // </editor-fold>
    public PlayerAbstract get_blackPlayer () {
        return _blackPlayer;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.E9B9A058-0464-FE05-2CD4-8E1891998414]
    // </editor-fold>
    public void set_blackPlayer (PlayerAbstract val) {
        this._blackPlayer = val;
    }

     // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.4EAB780E-F4D3-C916-0300-8934AD7DA253]
    // </editor-fold>
    public PlayerAbstract get_currentPlayer () {
        return _currentPlayer;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.E9B9A058-0464-FE05-2CD4-8E1891998414]
    // </editor-fold>
    public void set_currentPlayer (PlayerAbstract val) {
        this._currentPlayer = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.A9B2B251-05F8-B010-E269-94D0577F5AA1]
    // </editor-fold>
    public ChoiceGameView get_choiceGameView () {
        return _choiceGameView;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.F05D469D-3B64-4CBD-24F2-C58761BA90B9]
    // </editor-fold>
    public void set_choiceGameView (ChoiceGameView val) {
        this._choiceGameView = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.B16E2531-9487-E347-B9BE-8FCF9B0437E6]
    // </editor-fold>
    public GridOthello get_gridOthello () {
        return _gridOthello;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.33334487-AA70-AB93-ABDF-F91D9AB7B67D]
    // </editor-fold>
    public void set_gridOthello (GridOthello val) {
        this._gridOthello = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.AD64B349-FE5C-95A9-A725-F6FA3DFEC57E]
    // </editor-fold>
    public GridView get_gridView () {
        return _gridView;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.CB186EF0-2903-6C86-DC6E-F6D56A3A1ACA]
    // </editor-fold>
    public void set_gridView (GridView val) {
        this._gridView = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.B7E91A63-EB11-445D-481E-2AFA17F16D05]
    // </editor-fold>
    public ListWaitingPlayerView get_listWaitingPlayerView () {
        return _listWaitingPlayerView;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.76DE198B-BBD0-D763-024F-060F5C6E1981]
    // </editor-fold>
    public void set_listWaitingPlayerView (ListWaitingPlayerView val) {
        this._listWaitingPlayerView = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.47D4AB67-1661-A436-9582-594530EFA2FE]
    // </editor-fold>
    public LoginView get_loginView () {
        return _loginView;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.83381CF5-0FC6-81E7-A502-7EC217B8F23E]
    // </editor-fold>
    public void set_loginView (LoginView val) {
        this._loginView = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.85135C18-4012-8E72-A958-6EAE387DE30F]
    // </editor-fold>
    public ModeJeu get_modeJeu () {
        return _modeJeu;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.867DBF34-DEC3-28F9-6ADD-DD02B706D7D8]
    // </editor-fold>
    public void set_modeJeu (ModeJeu val) {
        this._modeJeu = val;
        if (this.get_modeJeu().get_mode() == ModeJeu.TYPE_JOUER_SEUL){
            this.get_choiceGameView().setParentAndChild(this.get_choiceGameView(), this.get_gridView());
            this.get_gridView().setParentAndChild(this.get_choiceGameView(), this.get_gridView());
            this.set_redPlayer(new Player(new Couleur(Couleur.RED)));
            this.set_blackPlayer(new PlayerComputer(new Couleur(Couleur.BLACK)));
            this.set_currentPlayer(this.get_redPlayer());
        } else if (this.get_modeJeu().get_mode() == ModeJeu.TYPE_JOUER_PLUSIEURS_SERVEUR) { // Mode Serveur
            this.get_choiceGameView().setParentAndChild(this.get_choiceGameView(), this.get_loginView());
            this.get_loginView().setParentAndChild(this.get_choiceGameView(), this.get_listWaitingPlayerView());
            this.get_listWaitingPlayerView().setParentAndChild(this.get_loginView(), this.get_gridView());
            this.get_gridView().setParentAndChild(this.get_listWaitingPlayerView(), this.get_gridView());
        }else if(this.get_modeJeu().get_mode() == ModeJeu.TYPE_JOUER_PLUSIEURS) {
            this.get_choiceGameView().setParentAndChild(this.get_choiceGameView(), this.get_gridView());
            this.get_gridView().setParentAndChild(this.get_choiceGameView(), this.get_gridView());
            this.set_redPlayer(new Player(new Couleur(Couleur.RED)));
            this.set_blackPlayer(new Player(new Couleur(Couleur.BLACK)));
            this.set_currentPlayer(this.get_redPlayer());
        }
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.5D409D77-742A-BA09-3A07-AA7FF51E0ACA]
    // </editor-fold>
    public OthelloClient get_othelloClient () {
        return _othelloClient;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.DB4DD9A7-7646-6E91-ACF1-993482FBF59F]
    // </editor-fold>
    public void set_othelloClient (OthelloClient val) {
        this._othelloClient = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.FCE4BCCD-E7BF-C8C5-90D2-ED573B8CB84A]
    // </editor-fold>
    public OthelloServer get_othelloServer () {
        return _othelloServer;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.7A249778-7544-F71E-9839-C6346ABAE76B]
    // </editor-fold>
    public void set_othelloServer (OthelloServer val) {
        this._othelloServer = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.44B64041-2D5A-08BF-B026-E6F3FAC3405A]
    // </editor-fold>
    public SubscribeView get_subscribeView () {
        return _subscribeView;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.95E18858-0AE8-21FE-AE73-0215D4E08802]
    // </editor-fold>
    public void set_subscribeView (SubscribeView val) {
        this._subscribeView = val;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.121B243D-E5D7-9A45-BBEC-AB04B728E0BF]
    // </editor-fold>
    public PlayerAbstract get_redPlayer () {
        return _redPlayer;
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,regenBody=yes,id=DCE.828FD152-7910-D737-E7D9-5E9684845FBE]
    // </editor-fold>
    public void set_redPlayer (PlayerAbstract val) {
        this._redPlayer = val;
    }

    public boolean get_partieFinie(){
        return this._partieFinie;
    }

    public void set_partieFinie (boolean val) {
        this._partieFinie = val;
    }

    public Display get_display () {
        return _display;
    }

    public void set_display (Display val) {
        this._display = val;
    }

    public OthelloController(){
         super();
        this.set_display(Display.getDisplay(this)) ;
        this.set_gridOthello(new GridOthello(8));

        this.set_choiceGameView(new ChoiceGameView(_display, this));
        this.set_loginView(new LoginView(_display, this));
        this.set_listWaitingPlayerView(new ListWaitingPlayerView(_display, this));
        this.set_gridView(new GridView(_display, this));
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.4F5ADC82-EB66-5C6F-1B4B-4523FB0B30CB]
    // </editor-fold>
    protected void startApp () {
        this.get_choiceGameView().display();
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.8CF6D3EC-BE5A-E98F-D957-5BD5BF3D6133]
    // </editor-fold>
    protected void pauseApp () {
    }

    // <editor-fold defaultstate="collapsed" desc=" UML Marker ">
    // #[regen=yes,id=DCE.7B5613D8-0F5C-ECC3-8CA3-77139C8FD190]
    // </editor-fold>
    protected void destroyApp (boolean arg) {
    }

}
TOP

Related Classes of Controller.OthelloController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.