This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/src/jrummikub/control/ApplicationControl.java
Matthias Schiffer d6b8b23c6d Disable player panel while settings panel is shown
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@313 72836036-5685-4462-b002-a69064685172
2011-05-29 21:19:20 +02:00

53 lines
1.2 KiB
Java

package jrummikub.control;
import jrummikub.model.GameSettings;
import jrummikub.util.IListener;
import jrummikub.util.IListener1;
import jrummikub.view.IView;
/**
* The application control controls the settings for a new games and create the
* game control
*/
public class ApplicationControl {
private IView view;
/**
* Creates a new application control
*
* @param view
* the view to use
*/
public ApplicationControl(IView view) {
this.view = view;
}
/**
* Starts the application by showing the game settings dialog panel
*/
public void startApplication() {
view.showScorePanel(false);
view.enableWinPanel(false);
view.showInterface(false);
SettingsControl settingsControl = new SettingsControl(view,
new GameSettings());
settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() {
@Override
public void handle(GameSettings settings) {
GameControl gameControl = new GameControl(settings, view);
gameControl.getEndOfGameEvent().add(new IListener() {
@Override
public void handle() {
startApplication();
}
});
view.showInterface(true);
gameControl.startGame();
}
});
settingsControl.startSettings();
}
}