ソースを参照

Changed enable() and disable() methods in BaseAppState in onEnable() and onDisable()

Rémy Bouquet 10 年 前
コミット
74e4b9823a

+ 2 - 2
jme3-core/src/main/java/com/jme3/app/BasicProfilerState.java

@@ -209,7 +209,7 @@ public class BasicProfilerState extends BaseAppState {
     }
 
     @Override
-    protected void enable() {
+    protected void onEnable() {
     
         // Set the number of visible frames to the current width of the screen
         setFrameCount(getApplication().getCamera().getWidth());
@@ -221,7 +221,7 @@ public class BasicProfilerState extends BaseAppState {
     }
 
     @Override
-    protected void disable() {
+    protected void onDisable() {
         getApplication().setAppProfiler(null);
         graph.removeFromParent();
         background.removeFromParent();

+ 20 - 20
jme3-core/src/main/java/com/jme3/app/state/BaseAppState.java

@@ -43,7 +43,7 @@ import java.util.logging.Logger;
  *  A base app state implementation the provides more built-in
  *  management convenience than AbstractAppState, including methods
  *  for enable/disable/initialize state management.
- *  The abstract enable() and disable() methods are called
+ *  The abstract onEnable() and onDisable() methods are called
  *  appropriately during initialize(), terminate(), or setEnabled()
  *  depending on the mutual state of "initialized" and "enabled".
  *  
@@ -52,20 +52,20 @@ import java.util.logging.Logger;
  *  app state is attached.  This is useful for resources that might
  *  be expensive to create or load.</p>
  *
- *  <p>enable()/disable() can be used for managing things that
+ *  <p>onEnable()/onDisable() can be used for managing things that
  *  should only exist while the state is enabled.  Prime examples
  *  would be scene graph attachment or input listener attachment.</p>
  *
- *  <p>The base class logic is such that disable() will always be called
+ *  <p>The base class logic is such that onDisable() will always be called
  *  before cleanup() if the state is enabled.  Likewise, enable()
  *  will always be called after initialize() if the state is enable().
- *  enable()/disable() are also called appropriate when setEnabled()
+ *  onEnable()/onDisable() are also called appropriate when setEnabled()
  *  is called that changes the enabled state AND if the state is attached.
- *  In other words, enable()/disable() are only ever called on an already 
+ *  In other words, onEnable()/onDisable() are only ever called on an already 
  *  attached state.</p>
  *
  *  <p>It is technically safe to do all initialization and cleanup in
- *  the enable()/disable() methods.  Choosing to use initialize()
+ *  the onEnable()/onDisable() methods.  Choosing to use initialize()
  *  and cleanup() for this is a matter of performance specifics for the
  *  implementor.</p>
  *
@@ -81,14 +81,14 @@ public abstract class BaseAppState implements AppState {
 
     /**
      *  Called during initialization once the app state is
-     *  attached and before enable() is called.
+     *  attached and before onEnable() is called.
      */
     protected abstract void initialize( Application app );
     
     /**
      *  Called after the app state is detached or during
      *  application shutdown if the state is still attached.
-     *  disable() is called before this cleanup() method if
+     *  onDisable() is called before this cleanup() method if
      *  the state is enabled at the time of cleanup.
      */
     protected abstract void cleanup( Application app );
@@ -98,19 +98,19 @@ public abstract class BaseAppState implements AppState {
      *  and isEnabled() is true or when the setEnabled() status
      *  changes after the state is attached.
      */
-    protected abstract void enable();
+    protected abstract void onEnable();
     
     /**
      *  Called when the state was previously enabled but is
      *  now disabled either because setEnabled(false) was called
      *  or the state is being cleaned up.
      */
-    protected abstract void disable();
+    protected abstract void onDisable();
 
     /**
      *  Do not call directly: Called by the state manager to initialize this 
      *  state post-attachment.
-     *  This implementation calls initialize(app) and then enable() if the
+     *  This implementation calls initialize(app) and then onEnable() if the
      *  state is enabled.
      */
     public final void initialize( AppStateManager stateManager, Application app ) {
@@ -120,8 +120,8 @@ public abstract class BaseAppState implements AppState {
         initialized = true;
         initialize(app);
         if( isEnabled() ) {
-            log.log(Level.FINEST, "enable():{0}", this);
-            enable();
+            log.log(Level.FINEST, "onEnable():{0}", this);
+            onEnable();
         }
     }
 
@@ -149,11 +149,11 @@ public abstract class BaseAppState implements AppState {
         if( !isInitialized() )
             return;
         if( enabled ) {
-            log.log(Level.FINEST, "enable():{0}", this);
-            enable();
+            log.log(Level.FINEST, "onEnable():{0}", this);
+            onEnable();
         } else {
-            log.log(Level.FINEST, "disable():{0}", this);
-            disable();
+            log.log(Level.FINEST, "onDisable():{0}", this);
+            onDisable();
         }
     }
 
@@ -179,15 +179,15 @@ public abstract class BaseAppState implements AppState {
     /**
      *  Do not call directly: Called by the state manager to terminate this 
      *  state post-detachment or during state manager termination.
-     *  This implementation calls disable() if the state is enabled and
+     *  This implementation calls onDisable() if the state is enabled and
      *  then cleanup(app).
      */
     public final void cleanup() {
         log.log(Level.FINEST, "cleanup():{0}", this);
 
         if( isEnabled() ) {
-            log.log(Level.FINEST, "disable():{0}", this);
-            disable();
+            log.log(Level.FINEST, "onDisable():{0}", this);
+            onDisable();
         }
         cleanup(app);
         initialized = false;