35package com.jogamp.newt.event;
51@SuppressWarnings(
"serial")
52public class
NEWTEvent extends java.util.EventObject {
56 public static final Object consumedTag =
new Object();
58 private final short eventType;
59 private final long when;
60 private Object attachment;
62 static final boolean DEBUG =
false;
64 protected NEWTEvent(
final short eventType,
final Object source,
final long when) {
66 this.eventType = eventType;
90 this.attachment = attachment;
106 return consumedTag == attachment;
128 setAttachment( consumedTag );
129 }
else if( consumedTag == attachment ) {
130 setAttachment(
null );
136 return toString(
null).toString();
141 sb =
new StringBuilder();
143 return sb.append(
"NEWTEvent[source:").append(getSource().getClass().getName()).append(
", consumed ").append(isConsumed()).append(
", when:").append(getWhen()).append(
" d ").append((System.currentTimeMillis()-getWhen())).append(
"ms]");
147 return "0x" + Integer.toHexString( hex & 0x0000FFFF );
NEWT events are provided for notification purposes ONLY; The NEWT will automatically handle the even...
final boolean isConsumed()
Returns true if this events has been consumed, otherwise false.
final void setConsumed(final boolean consumed)
If consumed is true, this event is marked as consumed, ie.
StringBuilder toString(StringBuilder sb)
NEWTEvent(final short eventType, final Object source, final long when)
final short getEventType()
Returns the event type of this event.
final Object getAttachment()
static String toHexString(final short hex)
final long getWhen()
Returns the timestamp, in milliseconds, of this event.
final void setAttachment(final Object attachment)
Attach the passed object to this event.