From 02924f4c822fafef6b72bc44cdd05f02d0b1c5d2 Mon Sep 17 00:00:00 2001 From: moly Date: Thu, 11 Jul 2013 16:43:26 +0100 Subject: [PATCH] fixed completion listener firing when looping in gwt --- .../badlogic/gdx/backends/gwt/GwtApplication.java | 21 +++++++++++---------- .../src/com/badlogic/gdx/backends/gwt/GwtMusic.java | 3 +-- .../backends/gwt/emu/java/io/RandomAccessFile.java | 2 +- .../backends/gwt/widgets/PlaceholderTextBox.java | 2 +- .../gwt/widgets/ResizableWidgetCollection.java | 8 ++++---- .../backends/gwt/widgets/TextInputDialogBox.java | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java index 39c2f3aee..680a626cb 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java @@ -60,19 +60,20 @@ import com.google.gwt.user.client.ui.VerticalPanel; * {@link #getPreloaderCallback()} and implement any loading screen drawing via GWT widgets. * @author mzechner */ public abstract class GwtApplication implements EntryPoint, Application { - private ApplicationListener listener; + protected ApplicationListener listener; private GwtApplicationConfiguration config; - private GwtGraphics graphics; - private GwtInput input; + protected GwtGraphics graphics; + protected GwtInput input; private GwtNet net; - private Panel root = null; + protected Panel root = null; private TextArea log = null; private int logLevel = LOG_ERROR; - private Array runnables = new Array(); - private Array runnablesHelper = new Array(); + protected Array runnables = new Array(); + protected Array runnablesHelper = new Array(); private Array lifecycleListeners = new Array(); - private int lastWidth, lastHeight; - private Preloader preloader; + protected int lastWidth; + protected int lastHeight; + protected Preloader preloader; private static AgentInfo agentInfo; private ObjectMap prefs = new ObjectMap(); @@ -81,7 +82,7 @@ public abstract class GwtApplication implements EntryPoint, Application { @Override public void onModuleLoad () { - this.agentInfo = computeAgentInfo(); + GwtApplication.agentInfo = computeAgentInfo(); this.listener = getApplicationListener(); this.config = getConfig(); this.log = config.log; @@ -144,7 +145,7 @@ public abstract class GwtApplication implements EntryPoint, Application { }.scheduleRepeating(100); } - private void setupLoop () { + protected void setupLoop () { // setup modules try { graphics = new GwtGraphics(root, config); diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtMusic.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtMusic.java index 3f2110d82..fd6d58849 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtMusic.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtMusic.java @@ -118,8 +118,7 @@ public class GwtMusic implements Music, SMSoundCallback { public void onfinish () { if (isLooping) play(); - - if (onCompletionListener != null) + else if (onCompletionListener != null) onCompletionListener.onCompletion(this); } } \ No newline at end of file diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/RandomAccessFile.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/RandomAccessFile.java index 24dcad113..e15b8a285 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/RandomAccessFile.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/RandomAccessFile.java @@ -146,7 +146,7 @@ public class RandomAccessFile /* implements DataOutput, DataInput, Closeable */{ } } - private void consolidate () { + protected void consolidate () { if (newData == null) { return; } diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/PlaceholderTextBox.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/PlaceholderTextBox.java index 9cae89cf3..d748cef56 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/PlaceholderTextBox.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/PlaceholderTextBox.java @@ -35,7 +35,7 @@ public class PlaceholderTextBox extends TextBox { /** Sets the placeholder text displayed in the text box. * - * @param placeholder the placeholder text */ + * @param text the placeholder text */ public void setPlaceholder (String text) { placeholder = (text != null ? text : ""); getElement().setPropertyString("placeholder", placeholder); diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/ResizableWidgetCollection.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/ResizableWidgetCollection.java index f9854fee9..c4a9f9de2 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/ResizableWidgetCollection.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/ResizableWidgetCollection.java @@ -130,19 +130,19 @@ public class ResizableWidgetCollection implements WindowResizeListener, Iterable private Map widgets = new HashMap(); /** The current window height. */ - private int windowHeight = 0; + protected int windowHeight = 0; /** The current window width. */ - private int windowWidth = 0; + protected int windowWidth = 0; /** The hook used to remove the window handler. */ private HandlerRegistration windowHandler; /** The delay between resize checks. */ - private int resizeCheckDelay = DEFAULT_RESIZE_CHECK_DELAY; + protected int resizeCheckDelay = DEFAULT_RESIZE_CHECK_DELAY; /** A boolean indicating that resize checking should run. */ - private boolean resizeCheckingEnabled; + protected boolean resizeCheckingEnabled; /** Create a ResizableWidget. */ public ResizableWidgetCollection () { diff --git a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/TextInputDialogBox.java b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/TextInputDialogBox.java index b0614bbba..707f02396 100644 --- a/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/TextInputDialogBox.java +++ b/backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/TextInputDialogBox.java @@ -72,14 +72,14 @@ public class TextInputDialogBox extends DialogBox { setWidget(vPanel); } - private void onPositive () { + protected void onPositive () { if (listener != null) { listener.onPositive(textBox.getText()); } this.hide(); } - private void onNegative () { + protected void onNegative () { if (listener != null) { listener.onNegative(); } -- 2.11.0