aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/esieequest/Main.java1
-rw-r--r--src/esieequest/controller/GameEngine.java2
-rw-r--r--src/esieequest/view/View.java5
-rw-r--r--src/esieequest/view/app/Applet.java3
-rw-r--r--src/esieequest/view/app/UserInterface.java4
-rw-r--r--src/esieequest/view/app/Window.java4
-rw-r--r--src/esieequest/view/console/Console.java7
-rw-r--r--src/esieequest/view/web/WebInterface.java6
8 files changed, 27 insertions, 5 deletions
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java
index 86e6c5e..2ad11b1 100755
--- a/src/esieequest/Main.java
+++ b/src/esieequest/Main.java
@@ -49,7 +49,6 @@ public class Main extends JApplet {
49 49
50 if (Arrays.asList(args).contains("--nogui")) { 50 if (Arrays.asList(args).contains("--nogui")) {
51 view = new Console(); 51 view = new Console();
52
53 } else { 52 } else {
54 view = new Window(); 53 view = new Window();
55 } 54 }
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java
index c072e77..6c25fb3 100644
--- a/src/esieequest/controller/GameEngine.java
+++ b/src/esieequest/controller/GameEngine.java
@@ -32,6 +32,8 @@ public class GameEngine {
32 this.view.setController(this); 32 this.view.setController(this);
33 33
34 this.interpreter = new Interpreter(this.game, this.view); 34 this.interpreter = new Interpreter(this.game, this.view);
35
36 this.view.show();
35 } 37 }
36 38
37 /** 39 /**
diff --git a/src/esieequest/view/View.java b/src/esieequest/view/View.java
index b41a214..545879a 100644
--- a/src/esieequest/view/View.java
+++ b/src/esieequest/view/View.java
@@ -30,6 +30,11 @@ public interface View {
30 public void setController(GameEngine gameEngine); 30 public void setController(GameEngine gameEngine);
31 31
32 /** 32 /**
33 * Displays the user interface.
34 */
35 public void show();
36
37 /**
33 * Enables the user interface. 38 * Enables the user interface.
34 */ 39 */
35 public void enable(); 40 public void enable();
diff --git a/src/esieequest/view/app/Applet.java b/src/esieequest/view/app/Applet.java
index 3d5bc75..8ad1564 100644
--- a/src/esieequest/view/app/Applet.java
+++ b/src/esieequest/view/app/Applet.java
@@ -22,8 +22,7 @@ public class Applet extends UserInterface {
22 } 22 }
23 23
24 @Override 24 @Override
25 public void enable() { 25 public void show() {
26 this.applet.add(this.getLayout()); 26 this.applet.add(this.getLayout());
27 } 27 }
28
29} 28}
diff --git a/src/esieequest/view/app/UserInterface.java b/src/esieequest/view/app/UserInterface.java
index b6035c5..23384c7 100644
--- a/src/esieequest/view/app/UserInterface.java
+++ b/src/esieequest/view/app/UserInterface.java
@@ -301,6 +301,10 @@ abstract class UserInterface implements View, ActionListener {
301 this.infoTextPane.setText(message); 301 this.infoTextPane.setText(message);
302 this.clearInputField(); 302 this.clearInputField();
303 } 303 }
304
305 @Override
306 public void enable() {
307 }
304 308
305 @Override 309 @Override
306 public void disable() { 310 public void disable() {
diff --git a/src/esieequest/view/app/Window.java b/src/esieequest/view/app/Window.java
index e400fde..82e3a2e 100644
--- a/src/esieequest/view/app/Window.java
+++ b/src/esieequest/view/app/Window.java
@@ -2,6 +2,8 @@ package esieequest.view.app;
2 2
3import javax.swing.JFrame; 3import javax.swing.JFrame;
4 4
5import com.google.gwt.user.client.ui.RootLayoutPanel;
6
5/** 7/**
6 * The window view. 8 * The window view.
7 * 9 *
@@ -25,7 +27,7 @@ public class Window extends UserInterface {
25 } 27 }
26 28
27 @Override 29 @Override
28 public void enable() { 30 public void show() {
29 this.window.setVisible(true); 31 this.window.setVisible(true);
30 } 32 }
31 33
diff --git a/src/esieequest/view/console/Console.java b/src/esieequest/view/console/Console.java
index a8acbe0..0f3247a 100644
--- a/src/esieequest/view/console/Console.java
+++ b/src/esieequest/view/console/Console.java
@@ -2,6 +2,8 @@ package esieequest.view.console;
2 2
3import java.util.Scanner; 3import java.util.Scanner;
4 4
5import com.google.gwt.user.client.ui.RootLayoutPanel;
6
5import esieequest.controller.GameEngine; 7import esieequest.controller.GameEngine;
6import esieequest.model.Game; 8import esieequest.model.Game;
7import esieequest.view.View; 9import esieequest.view.View;
@@ -48,6 +50,11 @@ public class Console implements View {
48 } 50 }
49 51
50 @Override 52 @Override
53 public void show() {
54 this.enable();
55 }
56
57 @Override
51 public void enable() { 58 public void enable() {
52 if (!this.running) { 59 if (!this.running) {
53 this.running = true; 60 this.running = true;
diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java
index ca1598c..221eea9 100644
--- a/src/esieequest/view/web/WebInterface.java
+++ b/src/esieequest/view/web/WebInterface.java
@@ -78,7 +78,6 @@ class WebInterface extends Composite implements View {
78 this.initWidget(WebInterface.uiBinder.createAndBindUi(this)); 78 this.initWidget(WebInterface.uiBinder.createAndBindUi(this));
79 this.bindInputField(); 79 this.bindInputField();
80 this.bindButtons(); 80 this.bindButtons();
81 RootLayoutPanel.get().add(this);
82 } 81 }
83 82
84 /** 83 /**
@@ -254,6 +253,11 @@ class WebInterface extends Composite implements View {
254 } 253 }
255 254
256 @Override 255 @Override
256 public void show() {
257 RootLayoutPanel.get().add(this);
258 }
259
260 @Override
257 public void enable() { 261 public void enable() {
258 this.setControlsEnabled(true); 262 this.setControlsEnabled(true);
259 } 263 }