swingx
Version 2005-08-19

org.jdesktop.swingx.event
Class MessageEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.jdesktop.swingx.event.MessageEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ProgressEvent

public class MessageEvent
extends EventObject

Represents a message passed from a MessageSource. This class contains properties which indicate the level of the message, a string which represents the user visible message text and an indication of when the message occured.

The message could represent text messages and exceptions. If this message represents an exception then the value of getThrowable() will be non null. Messages are categorized using the Level constants.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
MessageEvent(Object source)
           
MessageEvent(Object source, Object message)
          Create a Level.INFO message.
MessageEvent(Object source, Object value, Level level)
           
MessageEvent(Object source, Object value, Level level, long when)
          Constructs a MessageEvent
 
Method Summary
 Level getLevel()
          Returns the level of message.
 String getMessage()
          Returns the value as a String message.
 Throwable getThrowable()
          Returns the value as a Throwable.
 Object getValue()
          Returns the contents of the message.
 long getWhen()
          Time in milliseconds when the event occured.
 String 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
 

Constructor Detail

MessageEvent

public MessageEvent(Object source)

MessageEvent

public MessageEvent(Object source,
                    Object message)
Create a Level.INFO message.


MessageEvent

public MessageEvent(Object source,
                    Object value,
                    Level level)

MessageEvent

public MessageEvent(Object source,
                    Object value,
                    Level level,
                    long when)
Constructs a MessageEvent

Parameters:
source - the object that originated the event
value - an object which represents the contents of the event
level - indicate the level of the event
when - timestamp of the message
Method Detail

getMessage

public String getMessage()
Returns the value as a String message. If the value represents an exception, then the message from the exception is returned.

Returns:
the value as a String or the empty string if the value is null

getThrowable

public Throwable getThrowable()
Returns the value as a Throwable.

Returns:
the exception passed as a value or null if it is not an exception

getValue

public Object getValue()
Returns the contents of the message. This level is based on the context of the message.


getWhen

public long getWhen()
Time in milliseconds when the event occured.


getLevel

public Level getLevel()
Returns the level of message. This method will always return a valid value. The default is set to Level.INFO.

Returns:
the level of the message

toString

public String toString()
Overrides:
toString in class EventObject

swingx
Version 2005-08-19