OSDN Git Service

fixed completion listener firing when looping in gwt
authormoly <tsweston@gmail.com>
Thu, 11 Jul 2013 15:43:26 +0000 (16:43 +0100)
committermoly <tsweston@gmail.com>
Thu, 11 Jul 2013 15:43:26 +0000 (16:43 +0100)
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtMusic.java
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/io/RandomAccessFile.java
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/PlaceholderTextBox.java
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/ResizableWidgetCollection.java
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/widgets/TextInputDialogBox.java

index 39c2f3a..680a626 100644 (file)
@@ -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<Runnable> runnables = new Array<Runnable>();
-       private Array<Runnable> runnablesHelper = new Array<Runnable>();
+       protected Array<Runnable> runnables = new Array<Runnable>();
+       protected Array<Runnable> runnablesHelper = new Array<Runnable>();
        private Array<LifecycleListener> lifecycleListeners = new Array<LifecycleListener>();
-       private int lastWidth, lastHeight;
-       private Preloader preloader;
+       protected int lastWidth;
+       protected int lastHeight;
+       protected Preloader preloader;
        private static AgentInfo agentInfo;
        private ObjectMap<String, Preferences> prefs = new ObjectMap<String, Preferences>();
 
@@ -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);                       
index 3f2110d..fd6d588 100644 (file)
@@ -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
index 24dcad1..e15b8a2 100644 (file)
@@ -146,7 +146,7 @@ public class RandomAccessFile /* implements DataOutput, DataInput, Closeable */{
                }
        }
 
-       private void consolidate () {
+       protected void consolidate () {
                if (newData == null) {
                        return;
                }
index 9cae89c..d748cef 100644 (file)
@@ -35,7 +35,7 @@ public class PlaceholderTextBox extends TextBox {
 \r
        /** Sets the placeholder text displayed in the text box.\r
         * \r
-        * @param placeholder the placeholder text */\r
+        * @param text the placeholder text */\r
        public void setPlaceholder (String text) {\r
                placeholder = (text != null ? text : "");\r
                getElement().setPropertyString("placeholder", placeholder);\r
index f9854fe..c4a9f9d 100644 (file)
@@ -130,19 +130,19 @@ public class ResizableWidgetCollection implements WindowResizeListener, Iterable
        private Map<ResizableWidget, ResizableWidgetInfo> widgets = new HashMap<ResizableWidget, ResizableWidgetInfo>();
 
        /** 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 () {
index b0614bb..707f023 100644 (file)
@@ -72,14 +72,14 @@ public class TextInputDialogBox extends DialogBox {
                setWidget(vPanel);\r
        }\r
 \r
-       private void onPositive () {\r
+       protected void onPositive () {\r
                if (listener != null) {\r
                        listener.onPositive(textBox.getText());\r
                }\r
                this.hide();\r
        }\r
 \r
-       private void onNegative () {\r
+       protected void onNegative () {\r
                if (listener != null) {\r
                        listener.onNegative();\r
                }\r