Package com.jme3.app.state
Class CompositeAppState
java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.app.state.CompositeAppState
- All Implemented Interfaces:
AppState
An AppState that manages a set of child app states, making sure
they are attached/detached and optional enabled/disabled with the
parent state.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends AppState>
TaddChild(T state) protected <T extends AppState>
TaddChild(T state, boolean overrideEnable) protected voidcleanup(Application app) Called after the app state is detached or during application shutdown if the state is still attached.protected voidprotected <T extends AppState>
Tprotected voidinitialize(Application app) Called during initialization once the app state is attached and before onEnable() is called.protected voidCalled when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.protected voidonEnable()Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.protected voidremoveChild(AppState state) protected voidsetChildrenEnabled(boolean b) voidsetOverrideEnabled(AppState state, boolean override) Overrides the automatic synching of a child's enabled state.voidstateAttached(AppStateManager stateManager) Called byAppStateManager.attach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom detached to initializing.voidstateDetached(AppStateManager stateManager) Called byAppStateManager.detach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom running to terminating.Methods inherited from class com.jme3.app.state.BaseAppState
cleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, render, setEnabled, setId, update
-
Constructor Details
-
CompositeAppState
-
-
Method Details
-
addChild
-
addChild
-
removeChild
-
getChild
-
clearChildren
protected void clearChildren() -
stateAttached
Description copied from interface:AppStateCalled byAppStateManager.attach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom detached to initializing.There is no assumption about the thread from which this function is called, therefore it is unsafe to modify the scene graph from this method. Please use
AppState.initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)instead.- Specified by:
stateAttachedin interfaceAppState- Overrides:
stateAttachedin classBaseAppState- Parameters:
stateManager- State manager to which the state was attached to.
-
stateDetached
Description copied from interface:AppStateCalled byAppStateManager.detach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom running to terminating.There is no assumption about the thread from which this function is called, therefore it is unsafe to modify the scene graph from this method. Please use
AppState.cleanup()instead.- Specified by:
stateDetachedin interfaceAppState- Overrides:
stateDetachedin classBaseAppState- Parameters:
stateManager- The state manager from which the state was detached from.
-
setChildrenEnabled
protected void setChildrenEnabled(boolean b) -
setOverrideEnabled
Overrides the automatic synching of a child's enabled state. When override is true, a child will remember its old state when the parent's enabled state is false so that when the parent is re-enabled the child can resume its previous enabled state. This is useful for the cases where a child may want to be disabled independent of the parent... and then not automatically become enabled just because the parent does. Currently, the parent's disabled state always disables the children, too. Override is about remembering the child's state before that happened and restoring it when the 'family' is enabled again as a whole. -
initialize
Description copied from class:BaseAppStateCalled during initialization once the app state is attached and before onEnable() is called.- Specified by:
initializein classBaseAppState- Parameters:
app- the application
-
cleanup
Description copied from class:BaseAppStateCalled after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.- Specified by:
cleanupin classBaseAppState- Parameters:
app- the application
-
onEnable
protected void onEnable()Description copied from class:BaseAppStateCalled when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.- Specified by:
onEnablein classBaseAppState
-
onDisable
protected void onDisable()Description copied from class:BaseAppStateCalled when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.- Specified by:
onDisablein classBaseAppState
-