aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-05-17 23:09:26 +0200
committerPacien TRAN-GIRARD2014-05-17 23:09:26 +0200
commit9d3cef233e8d5afbeacbc9ede93c8f62d07ada94 (patch)
tree6ce0e12abd2445b41e8814912e41382c9a6abfdc /src
parentf64a72ae85720815d63692b7ec9c7322629ea86b (diff)
downloadesieequest-9d3cef233e8d5afbeacbc9ede93c8f62d07ada94.tar.gz
Add iframe illustrations for web view
Diffstat (limited to 'src')
-rw-r--r--src/esieequest/view/app/UserInterface.java6
-rw-r--r--src/esieequest/view/web/WebInterface.java7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/esieequest/view/app/UserInterface.java b/src/esieequest/view/app/UserInterface.java
index c4e072d..fffe440 100644
--- a/src/esieequest/view/app/UserInterface.java
+++ b/src/esieequest/view/app/UserInterface.java
@@ -293,11 +293,11 @@ abstract class UserInterface implements Viewable, ActionListener {
293 } 293 }
294 294
295 /** 295 /**
296 * Updates the room's illustration. 296 * Sets the Room's illustration.
297 * 297 *
298 * Placeholder generation from http://stackoverflow.com/a/17802477/1348634 298 * Placeholder generation from http://stackoverflow.com/a/17802477/1348634
299 */ 299 */
300 private void updateIllustration(final String imageName) { 300 private void setIllustration(final String imageName) {
301 final URL imageURL = this.getClass().getClassLoader().getResource(imageName + ".jpg"); 301 final URL imageURL = this.getClass().getClassLoader().getResource(imageName + ".jpg");
302 final StretchIcon imageIcon; 302 final StretchIcon imageIcon;
303 if (imageURL == null) { 303 if (imageURL == null) {
@@ -351,7 +351,7 @@ abstract class UserInterface implements Viewable, ActionListener {
351 @Override 351 @Override
352 public void updateLocation(final Room room, final Direction direction, final Side side) { 352 public void updateLocation(final Room room, final Direction direction, final Side side) {
353 this.echo(room.getInformations()); 353 this.echo(room.getInformations());
354 this.updateIllustration(room.name() + "_" + direction.name()); 354 this.setIllustration(room.name() + "_" + direction.name());
355 } 355 }
356 356
357 @Override 357 @Override
diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java
index 4099063..7174180 100644
--- a/src/esieequest/view/web/WebInterface.java
+++ b/src/esieequest/view/web/WebInterface.java
@@ -40,6 +40,9 @@ import esieequest.view.Viewable;
40 */ 40 */
41class WebInterface extends Composite implements Viewable { 41class WebInterface extends Composite implements Viewable {
42 42
43 private static final String ILLUSTRATION_DIR = "illustrations/";
44 private static final String ILLUSTRATION_EXT = ".html";
45
43 private GameEngine gameEngine; 46 private GameEngine gameEngine;
44 47
45 private static WebInterfaceUiBinder uiBinder = GWT.create(WebInterfaceUiBinder.class); 48 private static WebInterfaceUiBinder uiBinder = GWT.create(WebInterfaceUiBinder.class);
@@ -235,7 +238,7 @@ class WebInterface extends Composite implements Viewable {
235 * the illustration page URL 238 * the illustration page URL
236 */ 239 */
237 private void setIllustration(final String illustration) { 240 private void setIllustration(final String illustration) {
238 this.illustrationFrame.setUrl(illustration); 241 this.illustrationFrame.setUrl(WebInterface.ILLUSTRATION_DIR + illustration + WebInterface.ILLUSTRATION_EXT);
239 } 242 }
240 243
241 /** 244 /**
@@ -294,7 +297,7 @@ class WebInterface extends Composite implements Viewable {
294 297
295 @Override 298 @Override
296 public void updateLocation(final Room room, final Direction direction, final Side side) { 299 public void updateLocation(final Room room, final Direction direction, final Side side) {
297 // TODO: update illustration 300 this.setIllustration(room.name() + "_" + direction.name());
298 this.echo(room.getInformations()); 301 this.echo(room.getInformations());
299 } 302 }
300 303