|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.EventObject
java.awt.AWTEvent
java.awt.event.ComponentEvent
java.awt.event.InputEvent
java.awt.event.MouseEvent
com.sun.dtv.ui.event.MouseEvent
public class MouseEvent
This class extends the MouseEvent
class by
implementing the UserInputEvent
interface.
Being just a marker interface, UserInputEvent
is derived from ScarceResource
interface
though, therefore methods from there have to be implemented here.
ScarceResource.reserve(boolean, long, com.sun.dtv.resources.ScarceResourceListener)
,
ScarceResource.release()
,
Serialized FormField Summary | |
---|---|
static int |
MOUSE_DRAG
Constant used for specification of a mouse code. |
static int |
MOUSE_ENTER
Constant used for specification of a mouse code. |
static int |
MOUSE_EXIT
Constant used for specification of a mouse code. |
static int |
MOUSE_LEFT_CLICK
Constant used for specification of a mouse code. |
static int |
MOUSE_LEFT_PRESS
Constant used for specification of a mouse code. |
static int |
MOUSE_LEFT_RELEASE
Constant used for specification of a mouse code. |
static int |
MOUSE_MOVE
Constant used for specification of a mouse code. |
static int |
MOUSE_RIGHT_CLICK
Constant used for specification of a mouse code. |
static int |
MOUSE_RIGHT_PRESS
Constant used for specification of a mouse code. |
static int |
MOUSE_RIGHT_RELEASE
Constant used for specification of a mouse code. |
Fields inherited from class java.awt.event.MouseEvent |
---|
BUTTON1, BUTTON2, BUTTON3, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_FIRST, MOUSE_LAST, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_WHEEL, NOBUTTON |
Fields inherited from class java.awt.event.InputEvent |
---|
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASK |
Fields inherited from class java.awt.event.ComponentEvent |
---|
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN |
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
MouseEvent(Component source,
int id,
long when,
int modifiers,
int x,
int y,
int clickCount,
boolean popupTrigger)
Constructs a MouseEvent object. |
|
MouseEvent(Component source,
int id,
long when,
int modifiers,
int x,
int y,
int clickCount,
boolean popupTrigger,
int button)
Constructs a MouseEvent object. |
Method Summary | |
---|---|
static void |
addResourceTypeListener(ResourceTypeListener listener)
Adds a ResourceTypeListener to the implementation. |
static MouseEvent[] |
getInstances()
Return the list of all existing instances of MouseEvent ,
whether they are already reserved or not. |
boolean |
isAvailable()
Checks whether the given resource is currently available for reservation. |
void |
release()
Releases this resource. |
static void |
removeResourceTypeListener(ResourceTypeListener listener)
Removes a previously attached listener. |
void |
reserve(boolean force,
long timeout,
ScarceResourceListener listener)
Requests reservation of the given scarce resource instance. |
static MouseEvent |
reserveOne(boolean force,
long timeoutms,
ScarceResourceListener listener,
int id)
Returns a reserved instance out of the pool of all MouseEvent
instances. |
Methods inherited from class java.awt.event.MouseEvent |
---|
getButton, getClickCount, getMouseModifiersText, getPoint, getX, getY, isPopupTrigger, paramString, translatePoint |
Methods inherited from class java.awt.event.InputEvent |
---|
consume, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown |
Methods inherited from class java.awt.event.ComponentEvent |
---|
getComponent |
Methods inherited from class java.awt.AWTEvent |
---|
getID, toString |
Methods inherited from class java.util.EventObject |
---|
getSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int MOUSE_LEFT_CLICK
public static int MOUSE_RIGHT_CLICK
public static int MOUSE_LEFT_PRESS
public static int MOUSE_RIGHT_PRESS
public static int MOUSE_LEFT_RELEASE
public static int MOUSE_RIGHT_RELEASE
public static int MOUSE_MOVE
public static int MOUSE_DRAG
public static int MOUSE_ENTER
public static int MOUSE_EXIT
Constructor Detail |
---|
public MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger)
source
- the Component that originated the eventid
- the integer that identifies the eventwhen
- a long int that gives the time the event occurredmodifiers
- the modifier keys down during event (e.g. shift, ctrl,
alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be
used, but both models should not be mixed in one event. Use of the
extended modifiers is preferred.x
- the horizontal x coordinate for the mouse locationy
- the vertical y coordinate for the mouse locationclickCount
- the number of mouse clicks associated with eventpopupTrigger
- a boolean, true if this event is a trigger for a popup menuMouseEvent
public MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int button)
source
- the Component that originated the eventid
- the integer that identifies the eventwhen
- a long int that gives the time the event occurredmodifiers
- the modifier keys down during event (e.g. shift, ctrl,
alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be
used, but both models should not be mixed in one event. Use of the
extended modifiers is preferred.x
- the horizontal x coordinate for the mouse locationy
- the vertical y coordinate for the mouse locationclickCount
- the number of mouse clicks associated with eventpopupTrigger
- a boolean, true if this event is a trigger for a popup menubutton
- which of the mouse buttons has changed state. NOBUTTON,
BUTTON1, BUTTON2 or BUTTON3 (as defined in java.awt.event.MouseEvent.MouseEvent
Method Detail |
---|
public void reserve(boolean force, long timeout, ScarceResourceListener listener) throws IllegalArgumentException, TimeoutException
First, if there is a security manager, its
checkPermission
method is called with the permission
ScarceResourcePermission(name, "reserve")
. If
force
is moreover set to true
, then
the permission is also checked on ScarceResourcePermission(name,
"force")
.
During the reservation process, if that resource instance is already
allocated, the implementation must notify
the current owner of that resource about the reservation request via
the ScarceResourceListener
interface:
ScarceResourceListener.releaseRequested()
if
force
is false
,ScarceResourceListener.releaseForced()
in the
other case.The listener will be used for such notification only until this resource is released. After releasing, the implementation must not call any of the listener's interface methods.
After that first event, the implementation will proceed accordingly
and release (or not) the requested resource. In case the
implementation releases the resource, it will trigger a
ScarceResourceListener.released()
event to the
original listening owner of the resource to inform him that the
resource does not belong to him anymore.
The application may control the time to wait for such a resource
to be available by setting timeoutms
. In case the
duration of the reservation exceeds the time expressed in
timeoutms
, a TimeoutException
is thrown.
Under normal operation, resources are released using the
release
method. However, in the case where the application
does not release resources when requested or the application is
terminated, the implementation must release
all resources allocated to the application to allow other applications
to be notified of changes in resource allocation and to be able to
reserve them. See the
Resource Cleanup
section of the application lifecycle.
reserve
in interface ScarceResource
force
- If true
, this method will withdraw
the resource from the current owner. If false
, the
implementation will block and wait until the resource is made available
(using release()
) or until timeoutms
.timeout
- A positive amount of time in millisecond until
which this method will wait for the resource to be released by its
current owner. The value of -1
indicates that the
implementation will wait forever.listener
- The listener to be attached to receive
notification about the status of the resource.
IllegalArgumentException
- If listener
is
null
or if the value specified in
timeoutms
is not valid i.e. not either a positive integer
or -1
.
TimeoutException
- If the time specified in
timeoutms
is over and the resource could not be reserved.public static MouseEvent reserveOne(boolean force, long timeoutms, ScarceResourceListener listener, int id) throws IllegalArgumentException, TimeoutException
MouseEvent
instances. This method either returns with the instance or throws an
exception according to the situation.
This method behaves exactly as the reserve()
method.
force
- If true
, this method is allowed to withdraw
any given resource from its current owner. If false
, the
implementation will block and wait until a resource of the given
type
is made available (using release()
) or
until timeoutms
milliseconds.timeoutms
- A positive amount of time in millisecond until
which this method will wait for any resource to be released by its
current owner. The value of -1
indicates that the
implementation will wait forever.listener
- The listener to be attached to receive
notification about the status of the resource.id
- the integer that identifies the event
MouseEvent
with the
specified identifier that has been reserved.
IllegalArgumentException
- If listener
is
null
or if the value specified in
timeoutms
is not valid i.e. not either a positive integer
or -1
.
TimeoutException
- If the time specified in
timeoutms
is over and the resource could not be reserved.reserve(boolean, long, com.sun.dtv.resources.ScarceResourceListener)
public void release()
The resource will be made available to another application across
the platform. After calling this method, it is no more possible to
interact with the given resource: calls to critical methods of that
scarce resource must be ignored and may
throw IllegalStateException
. This assertion is valid and
the behavior required for any class implementing the
ScarceResource
interface. In order to interact
again with the given resource, the application must call the
reserve()
method and become the owner again.
The implementation may dispose any system resources that this object is using. After the implementation must not call any of the methods of the listener that was attached at reservation time.
If the resource was already available (i.e. not reserved), this method does nothing.
release
in interface ScarceResource
public boolean isAvailable()
isAvailable
in interface ScarceResource
true
if the given resource is
currently available for reservation.public static MouseEvent[] getInstances()
MouseEvent
,
whether they are already reserved or not.
MouseEvent
.public static void addResourceTypeListener(ResourceTypeListener listener) throws NullPointerException
ResourceTypeListener
to the implementation.
Whenever a reserve()
or a release()
is
called on any resources of the same type, the implementation will
call the listener's corresponding methods.
listener
- The listener that is triggered for events on resources
of the same type.
NullPointerException
- If listener
is
null
.removeResourceTypeListener(com.sun.dtv.resources.ResourceTypeListener)
public static void removeResourceTypeListener(ResourceTypeListener listener) throws NullPointerException
listener
- The listener that is triggered for events on resources
of the same type.
NullPointerException
- If listener
is
null
.addResourceTypeListener(com.sun.dtv.resources.ResourceTypeListener)
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |