public class PlantControllerManager
extends java.lang.Object
AbstractPlantController
s and also
serves as a sort of factory for creating them based on the type of
PlantComponent
model that needs a view and controller. Note that
views are managed strictly by the controllers, so this class does not provide
access to the created AbstractPlantView
s.Constructor and Description |
---|
PlantControllerManager()
A nullary constructor.
|
PlantControllerManager(PlantAppState app)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clearControllers()
Removes all
AbstractPlantController s from this manager and
disposes of them. |
AbstractPlantController |
createController(PlantComponent component,
com.jme3.material.Material material)
Creates an AbstractPlantController for the specified PlantComponent.
|
AbstractPlantController |
getController(PlantComponent component)
Gets an AbstractPlantController for a PlantComponent from this manager if
one exists.
|
void |
notifyListeners(PlantComponent component,
AbstractPlantController controller,
boolean added)
Notifies
IPlantControllerManagerListener s that a controller has
been created or deleted for a PlantComponent. |
void |
registerListener(IPlantControllerManagerListener listener)
Registers a listener to listen for controller creation and deletion
events.
|
AbstractPlantController |
removeController(PlantComponent component)
Removes and disposes the AbstractPlantController for a PlantComponent.
|
void |
unregisterListener(IPlantControllerManagerListener listener)
Unregisters a listener from listening for controller creation and
deletion events.
|
public PlantControllerManager()
public PlantControllerManager(PlantAppState app)
app
- The jME3 PlantAppState for which this class manages
controllers (and views).public AbstractPlantController createController(PlantComponent component, com.jme3.material.Material material)
component
- The PlantComponent that needs a view and controller.material
- The Material that should be used to render the view.public AbstractPlantController getController(PlantComponent component)
component
- The PlantComponent whose controller should be retrieved.public AbstractPlantController removeController(PlantComponent component)
component
- The PlantComponent whose controller should be removed from the
manager and disposed.public void clearControllers()
AbstractPlantController
s from this manager and
disposes of them.public void registerListener(IPlantControllerManagerListener listener)
listener
- The listener to register. Duplicate listeners are not
supported.public void unregisterListener(IPlantControllerManagerListener listener)
listener
- The listener to unregister.public void notifyListeners(PlantComponent component, AbstractPlantController controller, boolean added)
IPlantControllerManagerListener
s that a controller has
been created or deleted for a PlantComponent.component
- The component whose controller was added or removed.controller
- The controller that was added or removed.added
- Whether the controller was added or removed.