|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.iface.util.CatchingActionListener
public class CatchingActionListener
An ActionListener that catches and reports exceptions. It can
be used as a wrapper around a plain ActionListener or as a base
for subclasses that redefine innerActionPerformed(ActionEvent)
.
The static method listener(ActionListener)
is a
convenient way to wrap a listener that might be used more than
once.
Field Summary | |
---|---|
protected java.awt.event.ActionListener |
innerListener
|
(package private) static java.util.Map |
listenerCache
|
Constructor Summary | |
---|---|
protected |
CatchingActionListener()
Constructs a catching listener without an inner listener. |
|
CatchingActionListener(java.awt.event.ActionListener innerListener)
Constructs a catching listener around the specified inner listener. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Calls innerActionPerformed(ActionEvent) on the same
event, but inside a try-catch statement that
catches any exception or error thrown. |
java.awt.event.ActionListener |
getInnerListener()
Returns the inner action-listener that is wrapped in this CatchingActionListener. |
void |
handleException(java.awt.event.ActionEvent event,
java.lang.Throwable except)
Called if the innerActionPerformed method throws an exception or error. |
protected void |
innerActionPerformed(java.awt.event.ActionEvent event)
Called by actionPerformed(ActionEvent) inside a
catch that will report any exceptions thrown. |
static java.awt.event.ActionListener |
listener(java.awt.event.ActionListener inner)
Returns the outer listener, if any, that was recorded for the specified inner listener, or else constructs and records a new CatchingActionListener. |
static void |
recordListener(java.awt.event.ActionListener inner,
java.awt.event.ActionListener outer)
Records a specific outer listener for cases where it must be an instance of class other than CatchingActionListener, for instance a subclass. |
void |
setInnerListener(java.awt.event.ActionListener innerListener)
Sets the inner action-listener that is wrapped in this CatchingActionListener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.event.ActionListener innerListener
static java.util.Map listenerCache
Constructor Detail |
---|
public CatchingActionListener(java.awt.event.ActionListener innerListener)
protected CatchingActionListener()
innerActionPerformed(ActionEvent)
method or when
setInnerListener(ActionListener)
method will be
called.
Method Detail |
---|
public java.awt.event.ActionListener getInnerListener()
public void setInnerListener(java.awt.event.ActionListener innerListener)
public void actionPerformed(java.awt.event.ActionEvent event)
innerActionPerformed(ActionEvent)
on the same
event, but inside a try-catch
statement that
catches any exception or error thrown. The ActionEvent and the
exception or error are then passed to this object's handleException
method after a call to Debug.noteException(e)
.
Note that the innerActionPerformed method define by this calls calls the inner listener's actionPerformed method; but that can be overridden in subclasses.
actionPerformed
in interface java.awt.event.ActionListener
Debug.noteException(Throwable)
protected void innerActionPerformed(java.awt.event.ActionEvent event)
actionPerformed(ActionEvent)
inside a
catch that will report any exceptions thrown. This method
just calls the inner listener's actionPerformed method,
and it should be overridden in subclasses that do not use
an inner listener.
public void handleException(java.awt.event.ActionEvent event, java.lang.Throwable except)
Debug.foldException(Throwable)
public static java.awt.event.ActionListener listener(java.awt.event.ActionListener inner)
public static void recordListener(java.awt.event.ActionListener inner, java.awt.event.ActionListener outer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |