OSDN Git Service

URL: http://jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/renaming...
authormulova <mulova@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Thu, 31 Mar 2011 00:26:13 +0000 (00:26 +0000)
committermulova <mulova@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Thu, 31 Mar 2011 00:26:13 +0000 (00:26 +0000)
Renaming AppState.setActive()/isActive() to setEnabled()/isEnabled() for consistency

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@7143 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

engine/src/core/com/jme3/app/state/AbstractAppState.java
engine/src/core/com/jme3/app/state/AppState.java
engine/src/core/com/jme3/app/state/AppStateManager.java
engine/src/core/com/jme3/cinematic/Cinematic.java
engine/src/jbullet/com/jme3/bullet/BulletAppState.java

index c075d02..bfc3201 100644 (file)
@@ -49,7 +49,7 @@ public class AbstractAppState implements AppState {
      * is set back to false.
      */
     protected boolean initialized = false;
-    private boolean active = true;
+    private boolean enabled = true;
 
     public void initialize(AppStateManager stateManager, Application app) {
         initialized = true;
@@ -59,12 +59,28 @@ public class AbstractAppState implements AppState {
         return initialized;
     }
 
+    /**
+     * Use setEnabled() instead
+     */
+    @Deprecated
     public void setActive(boolean active) {
-        this.active = active;
+        setEnabled(active);
     }
 
+    /**
+     * Use isEnabled() instead
+     */
+    @Deprecated
     public boolean isActive() {
-        return active;
+        return isEnabled();
+    }
+    
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+    
+    public boolean isEnabled() {
+        return enabled;
     }
 
     public void stateAttached(AppStateManager stateManager) {
index c8c1f66..77450b1 100644 (file)
@@ -64,22 +64,41 @@ public interface AppState {
     public boolean isInitialized();
 
     /**
+     * Use setEnabled() instead.
      * Activate or deactivate the functionality of the <code>AppState</code>.
      * The effect of this call depends on implementation. An 
      * <code>AppState</code> starts as being active by default.
      * 
      * @param active activate the AppState or not.
      */
+    @Deprecated
     public void setActive(boolean active);
 
     /**
+     * Use isEnabled() instead.
      * @return True if the <code>AppState</code> is active, false otherwise.
      * 
      * @see AppState#setActive(boolean)
      */
+    @Deprecated
     public boolean isActive();
 
     /**
+     * Enable or disable the functionality of the <code>AppState</code>.
+     * The effect of this call depends on implementation. An 
+     * <code>AppState</code> starts as being enabled by default.
+     * 
+     * @param active activate the AppState or not.
+     */
+    public void setEnabled(boolean active);
+    
+    /**
+     * @return True if the <code>AppState</code> is enabled, false otherwise.
+     * 
+     * @see AppState#setEnabled(boolean)
+     */
+    public boolean isEnabled();
+    /**
      * Called when the state was attached.
      *
      * @param stateManager State manager to which the state was attached to.
index 2ea5b5a..4af0798 100644 (file)
@@ -139,7 +139,7 @@ public class AppStateManager {
                 if (!state.isInitialized())\r
                     state.initialize(this, app);\r
 \r
-                if (state.isActive()) {\r
+                if (state.isEnabled()) {\r
                    state.update(tpf);\r
                 }\r
             }\r
@@ -158,7 +158,7 @@ public class AppStateManager {
                 if (!state.isInitialized())\r
                     state.initialize(this, app);\r
 \r
-                if (state.isActive()) {\r
+                if (state.isEnabled()) {\r
                    state.render(rm);\r
                 }\r
             }\r
@@ -177,7 +177,7 @@ public class AppStateManager {
                 if (!state.isInitialized())\r
                     state.initialize(this, app);\r
 \r
-                if (state.isActive()) {\r
+                if (state.isEnabled()) {\r
                    state.postRender();\r
                 }\r
             }\r
index 2ca24ba..e2a29fb 100644 (file)
@@ -198,16 +198,33 @@ public class Cinematic extends AbstractCinematicEvent implements Savable, AppSta
         return initialized;
     }
 
+    /**
+     * Use setEnabled() instead
+     */
+    @Deprecated
     public void setActive(boolean active) {
-        if (active) {
-            play();
-        }
+        setEnabled(active);
     }
 
+    /**
+     * Use isEnabled() instead
+     */
+    @Deprecated
     public boolean isActive() {
+        return isEnabled();
+    }
+    
+    public void setEnabled(boolean enabled) {
+        if (enabled) {
+            play();
+        }
+    }
+    
+    public boolean isEnabled() {
         return playState == PlayState.Playing;
     }
 
+
     public void stateAttached(AppStateManager stateManager) {
     }
 
index 3617d15..a947558 100644 (file)
@@ -149,11 +149,27 @@ public class BulletAppState implements AppState, PhysicsTickListener {
         return initialized;
     }
 
+    /**
+     * Use setEnabled() instead
+     */
+    @Deprecated
     public void setActive(boolean active) {
-        this.active = active;
+        setEnabled(active);
     }
 
+    /**
+     * Use isEnabled() instead
+     */
+    @Deprecated
     public boolean isActive() {
+        return isEnabled();
+    }
+    
+    public void setEnabled(boolean enabled) {
+        this.active = enabled;
+    }
+    
+    public boolean isEnabled() {
         return active;
     }