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
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends AppState>
TaddChild
(T state) protected <T extends AppState>
TaddChild
(T state, boolean overrideEnable) protected void
cleanup
(Application app) Called after the app state is detached or during application shutdown if the state is still attached.protected void
protected <T extends AppState>
Tprotected void
initialize
(Application app) Called during initialization once the app state is attached and before onEnable() is called.protected void
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 void
onEnable()
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 void
removeChild
(AppState state) protected void
setChildrenEnabled
(boolean b) void
setOverrideEnabled
(AppState state, boolean override) Overrides the automatic synching of a child's enabled state.void
stateAttached
(AppStateManager stateManager) Called byAppStateManager.attach(com.jme3.app.state.AppState)
when transitioning thisAppState
from detached to initializing.void
stateDetached
(AppStateManager stateManager) Called byAppStateManager.detach(com.jme3.app.state.AppState)
when transitioning thisAppState
from 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:AppState
Called byAppStateManager.attach(com.jme3.app.state.AppState)
when transitioning thisAppState
from 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:
stateAttached
in interfaceAppState
- Overrides:
stateAttached
in classBaseAppState
- Parameters:
stateManager
- State manager to which the state was attached to.
-
stateDetached
Description copied from interface:AppState
Called byAppStateManager.detach(com.jme3.app.state.AppState)
when transitioning thisAppState
from 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:
stateDetached
in interfaceAppState
- Overrides:
stateDetached
in 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:BaseAppState
Called during initialization once the app state is attached and before onEnable() is called.- Specified by:
initialize
in classBaseAppState
- Parameters:
app
- the application
-
cleanup
Description copied from class:BaseAppState
Called 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:
cleanup
in classBaseAppState
- Parameters:
app
- the application
-
onEnable
protected void onEnable()Description copied from class:BaseAppState
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.- Specified by:
onEnable
in classBaseAppState
-
onDisable
protected void onDisable()Description copied from class:BaseAppState
Called 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:
onDisable
in classBaseAppState
-