de.sciss.gui
Class NumberEvent
java.lang.Object
java.util.EventObject
de.sciss.app.BasicEvent
de.sciss.gui.NumberEvent
- All Implemented Interfaces:
- java.io.Serializable
public class NumberEvent
- extends BasicEvent
This kind of event is fired
from a NumberField
gadget when
the user modified its contents.
- Version:
- 0.25, 05-May-06
- Author:
- Hanns Holger Rutz
- See Also:
NumberField.addListener( NumberListener )
,
NumberListener
,
Number
,
Serialized Form
Field Summary |
static int |
CHANGED
returned by getID() : the number changed |
Fields inherited from class java.util.EventObject |
source |
Constructor Summary |
NumberEvent(java.lang.Object source,
int ID,
long when,
java.lang.Number number,
boolean adjusting)
Constructs a new NumberEvent |
Method Summary |
java.lang.Number |
getNumber()
Queries the new number |
boolean |
incorporate(BasicEvent oldEvent)
Asks the event to incorporate the action
described by another (older) event. |
boolean |
isAdjusting()
|
Methods inherited from class java.util.EventObject |
getSource, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CHANGED
public static final int CHANGED
- returned by getID() : the number changed
- See Also:
- Constant Field Values
NumberEvent
public NumberEvent(java.lang.Object source,
int ID,
long when,
java.lang.Number number,
boolean adjusting)
- Constructs a new
NumberEvent
- Parameters:
source
- who originated the actionID
- CHANGED
when
- system time when the event occurednumber
- the new number
isAdjusting
public boolean isAdjusting()
getNumber
public java.lang.Number getNumber()
- Queries the new number
- Returns:
- the new
Number
of the
NumberField
. This is either
an Long
or a Double
depening of the NumberField
's
NumberSpace
. - See Also:
NumberSpace.isInteger()
incorporate
public boolean incorporate(BasicEvent oldEvent)
- Description copied from class:
BasicEvent
- Asks the event to incorporate the action
described by another (older) event.
This method has been created to reduce overhead;
when many events are added to the event queue
of an ELM, this allows to fuse two adjectant
events. The idea is mainly based on the
replaceEdit()
method of the javax.swing.undo.UndoableEdit
interface; a pendant of a symmetric addEdit()
like method is not provided because it seems to
be unnecessary.
Implementation notes : the oldEvent
should
generally only be incorporated if it refers to
the same source object (getSource()
) and has
the same ID (getD()
). the
timestamp of the current event should not be modified.
- Specified by:
incorporate
in class BasicEvent
- Parameters:
oldEvent
- the most recent event in the queue
which might be incorporated by this
new event.
- Returns:
true
if this object was able to
incorporate the older event. in this
case the oldEvent
is removed from the
event queue. false
states
that the oldEvent
was incompatible and
should remain in the queue.- See Also:
UndoableEdit.replaceEdit( UndoableEdit )