public class BasicController extends java.lang.Object implements IManagedUpdateable, IManagedUpdateableListener, IController
Constructor and Description |
---|
BasicController()
The default constructor.
|
BasicController(BasicMesh model,
BasicView view)
Constructor for an IController with its associated model and view.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntity(IController newEntity)
Adds an entity to the model.
|
void |
addEntityToCategory(IController newEntity,
IMeshCategory category)
Add an entity to the part under the given category.
|
java.lang.Object |
clone() |
void |
copy(IController otherObject)
Deep copy the given object's data into this one.
|
void |
dispose()
Dispose the controller and its resources.
|
boolean |
equals(java.lang.Object otherObject) |
java.util.concurrent.atomic.AtomicBoolean |
getDisposed()
Checks whether or not this part and its resources have been disposed.
|
java.util.ArrayList<IController> |
getEntities()
Gets a list of all the part's children entities.
|
java.util.ArrayList<IController> |
getEntitiesFromCategory(IMeshCategory category)
Returns all the part's child entities of the given category
|
<T extends IController> |
getEntitiesFromCategory(IMeshCategory category,
java.lang.Class<T> returnType)
Return all of the part's children entities of a given category cast to a
list of the specified return type.
|
IMesh |
getModel()
Getter method for the part's model
|
java.lang.String |
getProperty(IMeshProperty property)
Get the specified property's value.
|
Representation |
getRepresentation()
Get a wrapper containing the part's representation as an object specific
to the application rendering it.
|
double[] |
getRotation()
Get the part's rotation in the x, y, and z directions
|
double[] |
getScale()
Get the part's scale in the x, y, and z directions.
|
double |
getSize()
Get the part's size.
|
double[] |
getSkew()
Get the part's skew in the x, y, and z directions
|
java.util.ArrayList<SubscriptionType> |
getSubscriptions(IManagedUpdateable source)
Polls the listener for a list of the types of events it wants to receive
from the given source.
|
Transformation |
getTransformation()
Get the part's transformation.
|
double[] |
getTranslation()
Get the part's translation in the x, y, and z directions
|
UpdateableSubscriptionManager |
getUpdateManager()
Getter method for the update manager.
|
BasicView |
getView()
Getter method for the part's view.
|
int |
hashCode() |
boolean |
isRoot()
Checks whether the part is the root node of the tree.
|
boolean |
isSelected()
Checks whether the part is selected.
|
void |
refresh()
Alerts the view to refresh itself based on changes in the model
|
void |
register(IManagedUpdateableListener listener)
Register a listener to receive managed updates.
|
void |
removeEntity(IController entity)
Remove an entity from the part's child entities.
|
void |
setDisposed(boolean newDisposed)
Set the the controller as being disposed.
|
void |
setEntities(EntityMapEntry[] newEntities)
Set the mesh's map of entities to be equal to the provided map.
|
void |
setProperties(java.util.Map<IMeshProperty,java.lang.String> properties)
Set the mesh's properties according to the given map.
|
void |
setProperty(IMeshProperty property,
java.lang.String value)
Set the given property to a new value
|
void |
setRoot(boolean root)
Set the part as being the root node of the tree.
|
void |
setRotation(double x,
double y,
double z)
Set the part's rotation in the x, y, and x directions.
|
void |
setScale(double x,
double y,
double z)
Set the part's scale in the x, y, and x directions.
|
void |
setSelected(boolean selected)
Set the part as being selected.
|
void |
setSize(double newSize)
Set the part's size
|
void |
setSkew(double x,
double y,
double z)
Set the part's skew in the x, y, and x directions.
|
void |
setTransformation(Transformation newTransformation)
Set the part's transformation
|
void |
setTranslation(double x,
double y,
double z)
Set the part's translation in the x, y, and x directions.
|
void |
setView(BasicView newView)
Setter method for the model's view.
|
void |
unregister(IManagedUpdateableListener listener)
Remove a registered listener.
|
void |
update(IManagedUpdateable component,
SubscriptionType[] type)
Receive an update, including the source component and type of event that
triggered the update.
|
public void refresh()
IController
refresh
in interface IController
public java.util.concurrent.atomic.AtomicBoolean getDisposed()
IController
getDisposed
in interface IController
public void setDisposed(boolean newDisposed)
IController
setDisposed
in interface IController
public IMesh getModel()
IController
getModel
in interface IController
public BasicView getView()
IController
getView
in interface IController
public void setView(BasicView newView)
IController
setView
in interface IController
public void addEntity(IController newEntity)
IController
addEntity
in interface IController
public void dispose()
IController
dispose
in interface IController
public java.util.ArrayList<IController> getEntities()
IController
getEntities
in interface IController
public java.util.ArrayList<IController> getEntitiesFromCategory(IMeshCategory category)
IController
getEntitiesFromCategory
in interface IController
public <T extends IController> java.util.ArrayList<T> getEntitiesFromCategory(IMeshCategory category, java.lang.Class<T> returnType)
IController
getEntitiesFromCategory
in interface IController
category
- The category of entities to returnreturnType
- The class to which members of the category belong.public java.lang.String getProperty(IMeshProperty property)
IController
getProperty
in interface IController
public Representation getRepresentation()
IController
getRepresentation
in interface IController
public double[] getRotation()
IController
getRotation
in interface IController
public double[] getScale()
IController
getScale
in interface IController
public double getSize()
IController
getSize
in interface IController
public double[] getSkew()
IController
getSkew
in interface IController
public Transformation getTransformation()
IController
getTransformation
in interface IController
public double[] getTranslation()
IController
getTranslation
in interface IController
public void removeEntity(IController entity)
IController
removeEntity
in interface IController
public void setProperty(IMeshProperty property, java.lang.String value)
IController
setProperty
in interface IController
public void setRotation(double x, double y, double z)
IController
setRotation
in interface IController
public void setScale(double x, double y, double z)
IController
setScale
in interface IController
public void setSize(double newSize)
IController
setSize
in interface IController
public void setSkew(double x, double y, double z)
IController
setSkew
in interface IController
public void setTransformation(Transformation newTransformation)
IController
setTransformation
in interface IController
public void setTranslation(double x, double y, double z)
IController
setTranslation
in interface IController
public void addEntityToCategory(IController newEntity, IMeshCategory category)
IController
addEntityToCategory
in interface IController
newEntity
- The child entity to be added to this partcategory
- The category under which to add the new child entitypublic UpdateableSubscriptionManager getUpdateManager()
IController
getUpdateManager
in interface IController
public boolean equals(java.lang.Object otherObject)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
public void copy(IController otherObject)
IController
copy
in interface IController
otherObject
- The object to copy into this one.public int hashCode()
hashCode
in class java.lang.Object
public void unregister(IManagedUpdateableListener listener)
IManagedUpdateable
unregister
in interface IManagedUpdateable
listener
- The object which will no longer receive notifications from
thispublic void update(IManagedUpdateable component, SubscriptionType[] type)
IManagedUpdateableListener
update
in interface IManagedUpdateableListener
component
- The updateable component the update is coming fromtype
- The event type that of the updatepublic void register(IManagedUpdateableListener listener)
IManagedUpdateable
register
in interface IManagedUpdateable
listener
- The object which will receive future updatespublic java.util.ArrayList<SubscriptionType> getSubscriptions(IManagedUpdateable source)
IManagedUpdateableListener
getSubscriptions
in interface IManagedUpdateableListener
source
- The object which this listener will listen topublic boolean isRoot()
IController
isRoot
in interface IController
public boolean isSelected()
IController
isSelected
in interface IController
public void setEntities(EntityMapEntry[] newEntities)
IController
setEntities
in interface IController
public void setProperties(java.util.Map<IMeshProperty,java.lang.String> properties)
IController
setProperties
in interface IController
properties
- The new map of properties for the mesh.public void setRoot(boolean root)
IController
setRoot
in interface IController
root
- Whether the part is the root node or notpublic void setSelected(boolean selected)
IController
setSelected
in interface IController
selected
- Whether the part is selected or not.