|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--quicktime.app.event.QTMouseController | +--quicktime.app.event.QTMouseTargetController
A QTMouseTargetController deals with mouse events in a space where the mouse event occurs over (or selects) a member of that space. Members are selected based on being the frontmost member of the space (or of the members explicitly added to the controller).
This controller is also a collection. It acts in two modes. If its wholespace variable is set to true then any of the members of the space can be selected. It wholespace is false then only those members of the space that are also members of the controller can be selected. Generally controllers represent a collection of members that will require the same kinds of mouse behaviours.
This class specialises the handling of the events of its superclass in that for the event to be dispatched to its listeners the controller must have a selected target. In these cases the target attribute of the mouse event is set and the mouse event is broadcast to the appropriate listeners. For instance, if the user clicks in an "empty" area of the space the mouse clicked event won't be broadcast. However, if the user clicks on a member of the space and either wholespace is true or the selected member is a member of the controller, then and only then will the event be broadcast. The exception to this rule is that MouseEnter and MouseExit events will be broadcast regardless. MouseDrag events are considered to be targeted to a target that was selected by a mouse press event and are broadcast until the user releases the mouse. MouseMove events will only be broadcast when they occur whilst over a selected target.
In addition to these events a listener can be registered with this controller which is interested in receiving notification of mouse move or drag events that enter and exit members of the space.
If members are added to the controller the controller will query the space it is attached to to see if those members are appropriate members for that space. This can only be done after the controller is attached to a space. If members are added to the controller before it is added to a space, this appropriateness test is performed. If a member is found to inappropriate it is removed without notification. The member must also be a member of the space.
Fields inherited from class quicktime.app.event.QTMouseController |
space |
Constructor Summary | |
QTMouseTargetController()
Creates a QTMouseTargetController with a default setting of wholespace equals true. |
|
QTMouseTargetController(boolean wholespace)
Creates a QTMouseTargetController. |
Method Summary | |
void |
addedToSpace(Space s)
This method is called by the space when a Controller is being addedTo the Space s. |
protected void |
addHandler()
This method is called when a controller is added to its space and the controller needs to create its event handler |
boolean |
addMember(java.lang.Object member)
If wholespace is set to false, then only objects that are explicitly added to the controller will be controlled by it. |
void |
addQTMouseListener(QTMouseListener l)
Add a QTMouseListener for this controller. |
protected void |
doMouseClicked(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseDragged(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseEntered(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseExited(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseMoved(QTMouseEvent e,
boolean isWithinItsSpace)
This method dispatches the event to the appropriate listeners. |
protected void |
doMousePressed(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseReleased(QTMouseEvent e,
boolean isWithin)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseTargetEnter(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected void |
doMouseTargetExit(QTMouseEvent e)
This method dispatches the event to the appropriate listeners. |
protected java.lang.Object |
getHitTarget(int x,
int y)
Returns the frontmost object at the specified location that is a member of the space if wholespace is true, or the frontmost object in the controller's collection if wholespace is false. |
boolean |
hasMember(java.lang.Object object)
Returns true if the member has been explicitly added to this controller. |
boolean |
isAppropriate(java.lang.Object object)
Returns true if the provided object is an appropriate candidate for membership in a collection. |
boolean |
isEmpty()
Returns true if the controller's collection of controllable objects is empty. |
boolean |
isWholespace()
Returns the current setting of the wholespace flag. |
java.util.Enumeration |
members()
Returns an enumeration of all members of this controller. |
void |
mouseDragged(QTMouseEvent e)
If the QTMouseController has a MouseMoveListener(s) it will dispatch drag events that occur within its Space's area to those listeners. |
void |
mouseEntered(QTMouseEvent e)
If the QTMouseController has a MouseEnterExitListener(s) it will dispatch a mouseEntered event when the mouse moves or is dragged into the space. |
void |
mouseExited(QTMouseEvent e)
If the QTMouseController has a MouseEnterExitListener(s) it will dispatch a mouseExited event when the mouse moves or is dragged out of the space. |
void |
mouseReleased(QTMouseEvent e)
If the QTMouseController has a MouseButtonListener(s) it will dispatch release events that occur within its Space's area to those listeners. |
protected void |
removeActiveHandler()
This method is called when a controller is removed from its space and it had an active event handler |
void |
removeMember(java.lang.Object member)
Removes a member from the collection of objects that the controller controls |
void |
removeQTMouseListener(QTMouseListener l)
Remove a QTMouseListener for this controller. |
void |
setWholespace(boolean flag)
Sets the new value of the wholespace flag. |
int |
size()
Returns the number of members that have been explicitly added to the Controller. |
Methods inherited from class quicktime.app.event.QTMouseController |
addedTo, doMouseReleased, getSpace, mouseClicked, mouseMoved, mousePressed, removedFrom, removedFromSpace, translateAndIsWithin |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QTMouseTargetController()
public QTMouseTargetController(boolean wholespace)
wholespace
- the initial setting of the wholespace variable.Method Detail |
public void addedToSpace(Space s)
This method will also ensure that any members of the controller are both appropriate objects for the space and are also members of the space.
addedToSpace
in class QTMouseController
s
- the Space being added tosetTargetSpace()
protected void removeActiveHandler()
removeActiveHandler
in class QTMouseController
protected void addHandler()
addHandler
in class QTMouseController
public boolean isWholespace()
public void setWholespace(boolean flag)
flag
- if true all objects in the controller's space are potentially controllable.public boolean addMember(java.lang.Object member)
addMember
in interface Collection
member
- the new member object that will be controlled.public boolean isAppropriate(java.lang.Object object)
isAppropriate
in interface Collection
object
- the object to testpublic void removeMember(java.lang.Object member)
removeMember
in interface Collection
member
- the object that will be removed from the controller.public java.util.Enumeration members()
members
in interface Collection
public boolean isEmpty()
isEmpty
in interface Collection
public int size()
size
in interface Collection
public boolean hasMember(java.lang.Object object)
hasMember
in interface Collection
quicktime.app.spaces.Collection
member
- the object to test for membershippublic void addQTMouseListener(QTMouseListener l)
addQTMouseListener
in class QTMouseController
l
- a new QTMouseListenerpublic void removeQTMouseListener(QTMouseListener l)
removeQTMouseListener
in class QTMouseController
l
- a new QTMouseListenerprotected void doMousePressed(QTMouseEvent e)
doMousePressed
in class QTMouseController
e
- the translated mouse eventpublic void mouseReleased(QTMouseEvent e)
mouseReleased
in class QTMouseController
e
- the QTMouseEvent of this type.protected void doMouseReleased(QTMouseEvent e, boolean isWithin)
e
- the translated mouse eventprotected void doMouseClicked(QTMouseEvent e)
doMouseClicked
in class QTMouseController
e
- the translated mouse eventpublic void mouseDragged(QTMouseEvent e)
mouseDragged
in class QTMouseController
e
- the QTMouseEvent of this type.protected void doMouseDragged(QTMouseEvent e)
doMouseDragged
in class QTMouseController
e
- the translated mouse eventprotected void doMouseTargetExit(QTMouseEvent e)
e
- the translated mouse eventprotected void doMouseTargetEnter(QTMouseEvent e)
e
- the translated mouse eventprotected void doMouseMoved(QTMouseEvent e, boolean isWithinItsSpace)
doMouseMoved
in class QTMouseController
e
- the translated mouse eventisWithinItsSpace
- if true the mouse moved event is within the enclosing space. If false
it isn't.public void mouseEntered(QTMouseEvent e)
mouseEntered
in class QTMouseController
e
- the QTMouseEvent of this type.protected void doMouseEntered(QTMouseEvent e)
doMouseEntered
in class QTMouseController
e
- the translated mouse eventpublic void mouseExited(QTMouseEvent e)
mouseExited
in class QTMouseController
e
- the QTMouseEvent of this type.protected void doMouseExited(QTMouseEvent e)
doMouseExited
in class QTMouseController
e
- the translated mouse eventprotected java.lang.Object getHitTarget(int x, int y)
x
- the x location in the local coordinates of the space.y
- the y location in the local coordinates of the space.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |