Renaming AppState.setActive()/isActive() to setEnabled()/isEnabled() for consistency

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7143 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
mul..va 14 years ago
parent 2762ba3b27
commit 16fc60c8a0
  1. 22
      engine/src/core/com/jme3/app/state/AbstractAppState.java
  2. 19
      engine/src/core/com/jme3/app/state/AppState.java
  3. 6
      engine/src/core/com/jme3/app/state/AppStateManager.java
  4. 21
      engine/src/core/com/jme3/cinematic/Cinematic.java
  5. 18
      engine/src/jbullet/com/jme3/bullet/BulletAppState.java

@ -49,7 +49,7 @@ public class AbstractAppState implements AppState {
* is set back to false. * is set back to false.
*/ */
protected boolean initialized = false; protected boolean initialized = false;
private boolean active = true; private boolean enabled = true;
public void initialize(AppStateManager stateManager, Application app) { public void initialize(AppStateManager stateManager, Application app) {
initialized = true; initialized = true;
@ -59,12 +59,28 @@ public class AbstractAppState implements AppState {
return initialized; return initialized;
} }
/**
* Use setEnabled() instead
*/
@Deprecated
public void setActive(boolean active) { public void setActive(boolean active) {
this.active = active; setEnabled(active);
} }
/**
* Use isEnabled() instead
*/
@Deprecated
public boolean isActive() { 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) { public void stateAttached(AppStateManager stateManager) {

@ -64,21 +64,40 @@ public interface AppState {
public boolean isInitialized(); public boolean isInitialized();
/** /**
* Use setEnabled() instead.
* Activate or deactivate the functionality of the <code>AppState</code>. * Activate or deactivate the functionality of the <code>AppState</code>.
* The effect of this call depends on implementation. An * The effect of this call depends on implementation. An
* <code>AppState</code> starts as being active by default. * <code>AppState</code> starts as being active by default.
* *
* @param active activate the AppState or not. * @param active activate the AppState or not.
*/ */
@Deprecated
public void setActive(boolean active); public void setActive(boolean active);
/** /**
* Use isEnabled() instead.
* @return True if the <code>AppState</code> is active, false otherwise. * @return True if the <code>AppState</code> is active, false otherwise.
* *
* @see AppState#setActive(boolean) * @see AppState#setActive(boolean)
*/ */
@Deprecated
public boolean isActive(); 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. * Called when the state was attached.
* *

@ -139,7 +139,7 @@ public class AppStateManager {
if (!state.isInitialized()) if (!state.isInitialized())
state.initialize(this, app); state.initialize(this, app);
if (state.isActive()) { if (state.isEnabled()) {
state.update(tpf); state.update(tpf);
} }
} }
@ -158,7 +158,7 @@ public class AppStateManager {
if (!state.isInitialized()) if (!state.isInitialized())
state.initialize(this, app); state.initialize(this, app);
if (state.isActive()) { if (state.isEnabled()) {
state.render(rm); state.render(rm);
} }
} }
@ -177,7 +177,7 @@ public class AppStateManager {
if (!state.isInitialized()) if (!state.isInitialized())
state.initialize(this, app); state.initialize(this, app);
if (state.isActive()) { if (state.isEnabled()) {
state.postRender(); state.postRender();
} }
} }

@ -198,16 +198,33 @@ public class Cinematic extends AbstractCinematicEvent implements Savable, AppSta
return initialized; return initialized;
} }
/**
* Use setEnabled() instead
*/
@Deprecated
public void setActive(boolean active) { public void setActive(boolean active) {
if (active) { setEnabled(active);
}
/**
* Use isEnabled() instead
*/
@Deprecated
public boolean isActive() {
return isEnabled();
}
public void setEnabled(boolean enabled) {
if (enabled) {
play(); play();
} }
} }
public boolean isActive() { public boolean isEnabled() {
return playState == PlayState.Playing; return playState == PlayState.Playing;
} }
public void stateAttached(AppStateManager stateManager) { public void stateAttached(AppStateManager stateManager) {
} }

@ -149,11 +149,27 @@ public class BulletAppState implements AppState, PhysicsTickListener {
return initialized; return initialized;
} }
/**
* Use setEnabled() instead
*/
@Deprecated
public void setActive(boolean active) { public void setActive(boolean active) {
this.active = active; setEnabled(active);
} }
/**
* Use isEnabled() instead
*/
@Deprecated
public boolean isActive() { public boolean isActive() {
return isEnabled();
}
public void setEnabled(boolean enabled) {
this.active = enabled;
}
public boolean isEnabled() {
return active; return active;
} }

Loading…
Cancel
Save