|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object spin.Spin
public class Spin
Spin offers a transparent threading solution for developing non-freezing Swing applications.
Let bean
be a reference to a non-visual (possibly
multithreaded) bean implementing the interface Bean
whose
methods have to be called by a Swing component. You can avoid any freezing by
using one line of code:
bean = (Bean) Spin.off(bean);Now each method call on
bean
is executed on a separate thread,
while the EDT is continuing to dispatch events. All return values or
exceptions are handled by Spin and transparently returned to the
calling method.
For calls from other threads than the EDT to your Swing component you can use
the following (being
bean.addXYListener((XYListener)Spin.over(component);
Now all required updates to your component (and/or its model) are
transparently excuted on the EDT.
off(Object)
,
over(Object)
,
ProxyFactory
,
SpinOffEvaluator
,
SpinOverEvaluator
Constructor Summary | |
---|---|
Spin(java.lang.Object object,
Evaluator evaluator)
Create a Spin wrapper for the given object. |
|
Spin(java.lang.Object object,
ProxyFactory proxyFactory,
Evaluator evaluator)
Create a Spin wrapper for the given object. |
Method Summary | |
---|---|
static Evaluator |
getDefaultOffEvaluator()
Get the default evaluator for spin-off. |
static Evaluator |
getDefaultOverEvaluator()
Get the default evaluator for spin-over. |
static ProxyFactory |
getDefaultProxyFactory()
Get the default proxy factory. |
java.lang.Object |
getProxy()
Get a proxy for the wrapped object. |
static java.lang.Object |
off(java.lang.Object object)
Convenience method to spin-off the given object from Swing. |
static java.lang.Object |
over(java.lang.Object object)
Convenience method to spin-over the given object with Swing. |
static void |
setDefaultOffEvaluator(Evaluator evaluator)
Set the default evaluator for spin-off. |
static void |
setDefaultOverEvaluator(Evaluator evaluator)
Set the default evaluator for spin-over. |
static void |
setDefaultProxyFactory(ProxyFactory factory)
Set the default factory of proxies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Spin(java.lang.Object object, Evaluator evaluator)
object
- object to wrapevaluator
- evaluator of invocations on the given objectpublic Spin(java.lang.Object object, ProxyFactory proxyFactory, Evaluator evaluator)
object
- object to wrapproxyFactory
- factory for a proxyevaluator
- evaluator of invocations on the given objectMethod Detail |
---|
public java.lang.Object getProxy()
public static java.lang.Object off(java.lang.Object object)
Convenience method to spin-off the given object from Swing.
The returned object can safely be casted to any interface the given object implements.
object
- the object to spin-off
setDefaultProxyFactory(ProxyFactory)
,
setDefaultOffEvaluator(Evaluator)
public static java.lang.Object over(java.lang.Object object)
object
- the object to spin-over
setDefaultProxyFactory(ProxyFactory)
,
setDefaultOverEvaluator(Evaluator)
public static void setDefaultProxyFactory(ProxyFactory factory)
factory
- proxy factore to use as defaultpublic static void setDefaultOffEvaluator(Evaluator evaluator)
evaluator
- evaluator to use for spin-offpublic static void setDefaultOverEvaluator(Evaluator evaluator)
evaluator
- evaluator for spin-overpublic static ProxyFactory getDefaultProxyFactory()
public static Evaluator getDefaultOffEvaluator()
public static Evaluator getDefaultOverEvaluator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |