All Packages Class Hierarchy This Package Previous Next Index
Class quicktime.app.spaces.SimpleSpace
java.lang.Object
|
+----quicktime.app.spaces.SimpleSpace
- public abstract class SimpleSpace
- extends Object
- implements Space
SimpleSpace provides a default reference implementation of the Space interface.
The following actions are taken by the SimpleSpace class when members or controllers
are added to the Space.
- If the member is a Space then the contained Space will have the same source for
its Listener members as the parent Space. The Space's TimeBase will be slaved to
the parent Space.
- If the member or controller (TimeableController) implements the Timeable interface then the TimeBase
of the member or controller will be slaved to the Space.
- If the member or controller (ListenerController) implements the Listener interface then the source
of the Listener interest will be the source of the parent Space - that is all members
and controllers will have the same Listener source.
- If the controller implements the Ticklish interface (TicklishController) it will be added to the
ticklishList and the tickle and timeChanged methods of the Space will tickle and timeChange
all members of this ticklishList.
- If the controller implements the Collection interface (CollectionController) and the
isWholespace method of the controller returns true then all members that are added to the Space
will also be added to the controller. It is the responsibility of the Controller to determine
if the member is an appropriate member for it to control, and if so add it to its collection
of objects it controls. If isWholespace is false then members must explicitly added to the controllers.
When a member is removed from a Space the CollectionController will
be told to remove that member form its collection of objects it controls (regardless of the
isWholespace method).
- All Controllers that are added to a Space are considered to be active. There is no
explicit way for a Controller to deactivate itself, though internally a particular implementation
of the Controller interface may choose to be inactive or active. However the Space knows no such
state of the Controller and thus treats all attached Controllers as active.
The SimpleSpace can be used in different settings - ie. it has no predefined application
for managing display (presentation) or model contexts. The QTJava library provides DisplaySpaces
as extensions and concrete classes of the SimpleSpace. However applications can also use
SimpleSpace as a parent class for other kinds of Spaces, such as model spaces.
The SimpleSpace has no knowledge or implementation of the type of collection that is used to
hold the collection of members. It is a delegated responsibility of the subclass to implement
the Collection methods. There are two protected methods that the subclass should call after
they have successfully added or removed a member - memberAdded and memberRemoved respectively.
These methods ensure the behaviour of members as outlined.
- See Also:
- SWCompositor, GroupDrawable
-
containedSpaces
- This vector is used to collect any Spaces that are added as members to this Space
-
controllersVec
- This vector is used to collect the Controllers that are added to the Space
-
ticklers
- This TickleList is used to collect any ticklish controllers that are added to the Space
-
timer
- This is the Timer that both provides a TimeBase for the Space and tickles the Space
based on the scale and period of the Timer
-
SimpleSpace(Protocol)
- Called by classes that extend the SimpleSpace.
-
SimpleSpace(Protocol, int, int)
- Called by classes that extend the SimpleSpace.
-
addController(Controller)
- This method is used by the application to add a Controller to
the Space.
-
addedTo(Object)
- This method is called by some kind of container object when the Listener
is added to the object that is the source of the interest.
-
addMember(Object)
- Adds an object to the collection.
-
controllers()
- Returns an Enumeration of all Controllers that are currently
attached to the Space.
-
finalize()
-
-
getProtocol()
- Returns the Protocol object that defines if a member is an appropriate member of
the Space.
-
getSource()
- This object is the source for all of the members and controllers of the Space that
implement the Listener interface.
-
getTimer()
- Returns the Timer of the Space.
-
hasMember(Object)
- Returns true if the specified QTDrawable is a member of this Group.
-
isAppropriate(Object)
- Returns true if the Object object is an appropriate member of the Space.
-
isEmpty()
- Returns true if the collection contains no members, or false if
it has one or more members.
-
memberAdded(Object)
- When the sub-class defines the addMember method and has added the member
to its collection it should call memberAdded to ensure that the member
roles as defined within the Space are correctly established.
-
memberRemoved(Object)
- When the sub-class defines the removeMember method and has removed the member
from its collection it should call memberRemoved to ensure that the member
roles as defined within the Space are correctly maintained.
-
members()
- Returns an enumeration to iterate over the current members of a collection.
-
removeAllControllers()
- This method will remove all of the controllers that are currently attached
to the Space.
-
removeAllMembers()
- This method will remove all of the members that are currently contained
by the space.
-
removeController(Controller)
- Removes a controller that was previously added to the Space.
-
removedFrom(Object)
- This method is called by the specified object when the Listener object
is removed from the object that is the source of the interest.
-
removeMember(Object)
- If the object is a member of the collection it is removed.
-
size()
- Returns the number of members in the collection, ie.
-
tickle(float, int)
- The Timer invokes the tickle method when the invocation constraints of
the Timer are reached.
-
tickleList()
- Returns an Enumeration of all of the Controllers that implement the Ticklish interface
(TicklishControllers) that have been added to the Space.
-
timeChanged(int)
- Invoked by the timer when a time condition of its time base has changed.
controllersVec
protected Vector controllersVec
- This vector is used to collect the Controllers that are added to the Space
containedSpaces
protected Vector containedSpaces
- This vector is used to collect any Spaces that are added as members to this Space
ticklers
protected TickleList ticklers
- This TickleList is used to collect any ticklish controllers that are added to the Space
timer
protected Timer timer
- This is the Timer that both provides a TimeBase for the Space and tickles the Space
based on the scale and period of the Timer
SimpleSpace
protected SimpleSpace(Protocol protocols) throws QTException
- Called by classes that extend the SimpleSpace. The sub class must pass in
a Protocol object that defines the protocol (ie. the Class type of member objects)
that the sub-class Space knows how to deal with. This ensure that members of a Space
meet some minimal functionality.
This constructor does not create a Timer, the subclass must create a Timer in its
constructor. This is provided so that subclasses can customise the Timer.
- Parameters:
- protocols - the Protocol that is enforced on candidate member objects of this space.
- See Also:
- Protocol, Timer
SimpleSpace
protected SimpleSpace(Protocol protocols,
int scale,
int period) throws QTException
- Called by classes that extend the SimpleSpace. The sub class must pass in
a Protocol object that defines the protocol (ie. the Class type of member objects)
that the sub-class Space knows how to deal with. This ensure that members of a Space
meet some minimal functionality. The constructor also provides a scale and period
for the construction of the Space's Timer. This scale and period can be
reset at any time using appropriate methods on the Timer class.
- Parameters:
- protocols - the Protocol that is enforced on candidate member objects of this space.
- scale - the scale of the Space's Timer - this may NOT be zero.
- period - the period of the Space's Timer.
- See Also:
- Protocol, Timer
timeChanged
public void timeChanged(int newTime) throws QTException
- Invoked by the timer when a time condition of its time base has changed.
- Parameters:
- the - newTime of the time base resulting from the changed time line
of the timer
tickle
public boolean tickle(float er,
int time) throws QTException
- The Timer invokes the tickle method when the invocation constraints of
the Timer are reached. If the sub-class Space has its own tickle requirements
then it should overide the tickle method, however to ensure that any ticklish
controllers are tickled the overiding implementation should first call super.tickle.
- Parameters:
- er - the effective rate of the Timer when the time condition matches
- time - the time that the Timer invoked the tickle method.
- Returns:
- true if the Ticklish object should receive a consequent tickle, or false
if the Ticklish object should not be tickled again.
tickleList
public Enumeration tickleList()
- Returns an Enumeration of all of the Controllers that implement the Ticklish interface
(TicklishControllers) that have been added to the Space. These controllers are tickled
each time the Space itself is tickled by its Timer.
- Returns:
- an Enumeration of Ticklish objects
getSource
public Object getSource()
- This object is the source for all of the members and controllers of the Space that
implement the Listener interface. All such members and controllers will have the same
source as the parent space when it is addedTo a Listener source. If the parent Space
has not been added to a Listener source this returns null.
- Returns:
- the Listener source object
getProtocol
public Protocol getProtocol()
- Returns the Protocol object that defines if a member is an appropriate member of
the Space.
- Returns:
- a Protocol object.
isAppropriate
public boolean isAppropriate(Object object)
- Returns true if the Object object is an appropriate member of the Space. To be an
appropriate member the object must pass the passProtocol method of the Protocol
object of the Space.
- Parameters:
- object - the Object to test
- Returns:
- true if the object passes the current protocol of the Protocol object of the Space.
hasMember
public synchronized boolean hasMember(Object object)
- Returns true if the specified QTDrawable is a member of this Group.
- Returns:
- a boolean
addedTo
public synchronized void addedTo(Object interest)
- This method is called by some kind of container object when the Listener
is added to the object that is the source of the interest.
- Parameters:
- source - the object that is to be the source of interest for the
the Listener object.
removedFrom
public synchronized void removedFrom(Object interest)
- This method is called by the specified object when the Listener object
is removed from the object that is the source of the interest.
- Parameters:
- source - the object that is to be the source of interest for the
the Listener object.
addController
public synchronized void addController(Controller c) throws QTException
- This method is used by the application to add a Controller to
the Space. A Controller will control members of a Space.
- Parameters:
- c - the Controller to add to the Space.
removeController
public synchronized void removeController(Controller c) throws QTException
- Removes a controller that was previously added to the Space.
- Parameters:
- c - the Controller to remove from the Space.
controllers
public Enumeration controllers()
- Returns an Enumeration of all Controllers that are currently
attached to the Space.
- Returns:
- an Enumeration
getTimer
public Timer getTimer()
- Returns the Timer of the Space. This Timer provids a TimeBase for the Space and
if active will tickle and send timeChanged calls to the TicklishControllers that
are attached to the Space.
- Returns:
- a Timer
addMember
public abstract boolean addMember(Object member) throws QTException
- Adds an object to the collection. Returns true if the object is
appropriate member of the collection (and thus added) and false if not.
- Parameters:
- member - the object that should be added as a member to the collection
- Returns:
- a boolean.
removeMember
public abstract void removeMember(Object member) throws QTException
- If the object is a member of the collection it is removed.
- Parameters:
- member - the object to remove from the collection
memberAdded
protected synchronized void memberAdded(Object member) throws QTException
- When the sub-class defines the addMember method and has added the member
to its collection it should call memberAdded to ensure that the member
roles as defined within the Space are correctly established.
- Parameters:
- member - the object that has been added to the Space.
memberRemoved
protected synchronized void memberRemoved(Object member) throws QTException
- When the sub-class defines the removeMember method and has removed the member
from its collection it should call memberRemoved to ensure that the member
roles as defined within the Space are correctly maintained.
- Parameters:
- member - the object that has been added to the Space.
removeAllControllers
public synchronized void removeAllControllers() throws QTException
- This method will remove all of the controllers that are currently attached
to the Space.
removeAllMembers
public synchronized void removeAllMembers() throws QTException
- This method will remove all of the members that are currently contained
by the space.
finalize
protected void finalize() throws Throwable
- Overrides:
- finalize in class Object
All Packages Class Hierarchy This Package Previous Next Index