Package jadex.commons.gui.future
Class SwingDelegationResultListener<E>
- java.lang.Object
-
- jadex.commons.gui.future.SwingDelegationResultListener<E>
-
- All Implemented Interfaces:
IFunctionalExceptionListener
,IFunctionalResultListener<E>
,IFutureCommandResultListener<E>
,IResultListener<E>
,IUndoneResultListener<E>
public class SwingDelegationResultListener<E> extends java.lang.Object implements IUndoneResultListener<E>, IFutureCommandResultListener<E>
Delegation result listener that calls customResultAvailable and customExceptionOccurred on swing thread.
-
-
Field Summary
Fields Modifier and Type Field Description protected IFunctionalExceptionListener
customExceptionListener
Custom result listenerprotected IFunctionalResultListener<E>
customResultListener
Custom result listenerprotected Future<E>
future
The future to which calls are delegated.protected boolean
undone
Flag if undone methods should be used.
-
Constructor Summary
Constructors Constructor Description SwingDelegationResultListener(Future<E> future)
Create a new listener.SwingDelegationResultListener(Future<E> fut, IFunctionalResultListener<E> customResultListener)
Create a new listener with functional interfaces.SwingDelegationResultListener(Future<E> fut, IFunctionalResultListener<E> customResultListener, IFunctionalExceptionListener customExceptionListener)
Create a new listener with functional interfaces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commandAvailable(java.lang.Object command)
Called when a command is available.void
customCommandAvailable(java.lang.Object command)
Called when a command is available.void
customExceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.void
customResultAvailable(E result)
Called when the result is available.void
exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.void
exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.boolean
isUndone()
Get the undone.void
resultAvailable(E result)
Called when the result is available.void
resultAvailableIfUndone(E result)
Called when the result is available.
-
-
-
Field Detail
-
undone
protected boolean undone
Flag if undone methods should be used.
-
customResultListener
protected IFunctionalResultListener<E> customResultListener
Custom result listener
-
customExceptionListener
protected IFunctionalExceptionListener customExceptionListener
Custom result listener
-
-
Constructor Detail
-
SwingDelegationResultListener
public SwingDelegationResultListener(Future<E> fut, IFunctionalResultListener<E> customResultListener)
Create a new listener with functional interfaces.- Parameters:
fut
- The Delegate.customResultListener
- The listener.
-
SwingDelegationResultListener
public SwingDelegationResultListener(Future<E> fut, IFunctionalResultListener<E> customResultListener, IFunctionalExceptionListener customExceptionListener)
Create a new listener with functional interfaces.- Parameters:
fut
- The Delegate.customResultListener
- The custom result listener.customExceptionListener
- The listener that is called on exceptions.
-
-
Method Detail
-
resultAvailable
public final void resultAvailable(E result)
Called when the result is available.- Specified by:
resultAvailable
in interfaceIFunctionalResultListener<E>
- Parameters:
result
- The result.
-
exceptionOccurred
public final void exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurred
in interfaceIFunctionalExceptionListener
- Parameters:
exception
- The exception.
-
customResultAvailable
public void customResultAvailable(E result)
Called when the result is available.- Parameters:
result
- The result.
-
customExceptionOccurred
public void customExceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.- Parameters:
exception
- The exception.
-
commandAvailable
public final void commandAvailable(java.lang.Object command)
Called when a command is available.- Specified by:
commandAvailable
in interfaceIFutureCommandResultListener<E>
-
customCommandAvailable
public void customCommandAvailable(java.lang.Object command)
Called when a command is available.
-
resultAvailableIfUndone
public void resultAvailableIfUndone(E result)
Called when the result is available.- Specified by:
resultAvailableIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
result
- The result.
-
exceptionOccurredIfUndone
public void exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
exception
- The exception.
-
isUndone
public boolean isUndone()
Get the undone.- Returns:
- The undone.
-
-