public abstract class AbstractMeshController extends java.lang.Object implements IUpdateableListener
This class provides a basic controller for a component of a mesh.
The controller acts as a mediator between the mesh model and its view, which is a wrapper around a jME3 scene component. User input modifies the controller, which passes on the update to the model. When updated, the model notifies the controller, which can then push updates to the view. In order to ensure updates are handled in the jME3 SimpleApplication's simpleUpdate() loop, an AbstractMeshController puts itself into a queue in the SimpleApplication.
component
Constructor and Description |
---|
AbstractMeshController(IUpdateable model,
java.util.concurrent.ConcurrentLinkedQueue<AbstractMeshController> queue)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Object |
clone()
This operation returns a clone of the AbstractMeshController using a deep
copy.
|
void |
copy(AbstractMeshController controller)
This operation copies the contents of a AbstractMeshController into the
current object using a deep copy.
|
void |
dispose()
Disposes of the AbstractMeshController and its associated view.
|
boolean |
equals(java.lang.Object otherObject)
This operation is used to check equality between this
AbstractMeshController and another AbstractMeshController.
|
float |
getInverseScale() |
com.jme3.scene.Node |
getParentNode()
Gets the current parent jME3 Node for the view managed by this
AbstractMeshController.
|
float |
getScale()
Gets the current scale of the mesh controller's view.
|
float |
getSize()
Gets the current size of the mesh controller's view.
|
StateType |
getState()
Gets the current state of the Mesh object managed by the
AbstractMeshController.
|
int |
hashCode()
This operation returns the hash value of the AbstractMeshController.
|
void |
setParentNode(com.jme3.scene.Node node)
Sets the parent jME3 Node for the view managed by this
AbstractMeshController.
|
void |
setScale(float scale)
Sets the current scale of the mesh controller's view.
|
void |
setSize(float size)
Sets the current size of the mesh controller's view.
|
void |
setState(StateType state)
Sets the current state of the Mesh object managed by the
AbstractMeshController.
|
void |
syncView()
Synchronizes the view managed by the AbstractMeshController with its
associated model.
|
void |
update(IUpdateable component)
Implements the method from the IUpdateableListener interface.
|
public AbstractMeshController(IUpdateable model, java.util.concurrent.ConcurrentLinkedQueue<AbstractMeshController> queue)
The default constructor. Requires a the model that the controller listens to and a concurrent queue that the controller will publish to when it needs to update its view.
model
- The part of the mesh listened to and managed by this controller.
queue
- The queue used for updating views handled by this and other controllers.
public void syncView()
Synchronizes the view managed by the AbstractMeshController with its
associated model. This method should be implemented by subclasses to
properly dispose of resources using the application's simpleUpdate()
thread and to sync the view with any properties not marked as dirty with
setDirtyProperty(String)
. However, this method should still be
called by subclasses so that dirty properties are updated properly.
public StateType getState()
Gets the current state of the Mesh object managed by the AbstractMeshController.
The current state of the view supported by the controller.
public void setState(StateType state)
Sets the current state of the Mesh object managed by the AbstractMeshController.
state
- The new state of the view supported by the controller.
public com.jme3.scene.Node getParentNode()
Gets the current parent jME3 Node for the view managed by this AbstractMeshController.
The current parent jME3 Node for the view associated with this controller.
public final void setParentNode(com.jme3.scene.Node node)
Sets the parent jME3 Node for the view managed by this AbstractMeshController.
node
- The new parent jME3 Node for the view associated with this controller.
public void dispose()
Disposes of the AbstractMeshController and its associated view.
public float getSize()
Gets the current size of the mesh controller's view.
public void setSize(float size)
Sets the current size of the mesh controller's view.
size
- The new size of the mesh controller's view.public float getScale()
Gets the current scale of the mesh controller's view.
public float getInverseScale()
public void setScale(float scale)
Sets the current scale of the mesh controller's view.
scale
- The new scale of the mesh controller's view.public boolean equals(java.lang.Object otherObject)
This operation is used to check equality between this AbstractMeshController and another AbstractMeshController. It returns true if the objects are equal and false if they are not.
equals
in class java.lang.Object
otherObject
- The other object that should be compared with this one.
True if the objects are equal, false otherwise.
public int hashCode()
This operation returns the hash value of the AbstractMeshController.
hashCode
in class java.lang.Object
The hashcode of the object.
public void copy(AbstractMeshController controller)
This operation copies the contents of a AbstractMeshController into the current object using a deep copy.
controller
- The object from which the values should be copied.
public abstract java.lang.Object clone()
This operation returns a clone of the AbstractMeshController using a deep copy.
clone
in class java.lang.Object
The new clone.
public void update(IUpdateable component)
Implements the method from the IUpdateableListener interface. If this method is called, the IUpdateable the controller has registered with has been changed. This method adds the controller to the update queue to have its view synced by the MeshApplication.
update
in interface IUpdateableListener
component
-