01: /*=============================================================================
02: * Copyright Texas Instruments 2002. All Rights Reserved.
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package ti.chimera.registry;
20:
21: /**
22: * A node subscriber decorator that calls the wrapped subscriber (<code>ns</code>)
23: * from the context of the Swing/AWT Event Thread. This is for convenience,
24: * because many swing APIs can only be called from the context of the Swing/AWT
25: * Event Thread.
26: *
27: * @author ;Rob Clark;a0873619;San Diego;;
28: * @version 0.1
29: */
30: public class SwingNodeSubscriber implements NodeSubscriber {
31: private final NodeSubscriber ns;
32:
33: /**
34: * Class Constructor.
35: *
36: * @param ns the node subscriber to wrap
37: */
38: public SwingNodeSubscriber(NodeSubscriber ns) {
39: this .ns = ns;
40: }
41:
42: /**
43: * Called to publish the new node value to the subscriber.
44: *
45: * @param node the node doing the publishing
46: * @param value the node's new value
47: */
48: public void publish(final Node node, final Object value) {
49: // javax.swing.SwingUtilities.invokeLater( new Runnable() {
50: // public void run()
51: // {
52: ns.publish(node, value);
53: // }
54: // } );
55: }
56: }
57:
58: /*
59: * Local Variables:
60: * tab-width: 2
61: * indent-tabs-mode: nil
62: * mode: java
63: * c-indentation-style: java
64: * c-basic-offset: 2
65: * eval: (c-set-offset 'substatement-open '0)
66: * eval: (c-set-offset 'case-label '+)
67: * eval: (c-set-offset 'inclass '+)
68: * eval: (c-set-offset 'inline-open '0)
69: * End:
70: */
|