org.openide.loaders
Class ConnectionSupport
java.lang.Object
|
+--org.openide.loaders.ConnectionSupport
- All Implemented Interfaces:
- ConnectionCookie, Node.Cookie
- public class ConnectionSupport
- extends Object
- implements ConnectionCookie
Support implementing ConnectionCookie, that stores
listeners in extended attributes of associated entry.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConnectionSupport
public ConnectionSupport(MultiDataObject.Entry entry,
ConnectionCookie.Type[] types)
- Creates new connection support for given file entry.
- Parameters:
entry
- entry to store listener to its extended attributestypes
- a list of event types to support
register
public void register(ConnectionCookie.Type type,
Node listener)
throws IOException
- Attaches new node to listen to events produced by this
event. The type must be one of event types supported by this
cookie and the listener should have ConnectionCookie.Listener cookie
attached so it can be notified when event of requested type occurs.
- Specified by:
register
in interface ConnectionCookie
- Parameters:
type
- the type of event, must be supported by the cookielistener
- the node that should be notified- Throws:
InvalidObjectException
- if the type is not supported by the cookie (subclass of IOException)IOException
- if the type is persistent and the listener does not
have serializable handle (listener.getHandle () is null or its serialization
throws an exception)
unregister
public void unregister(ConnectionCookie.Type type,
Node listener)
throws IOException
- Unregisters an listener.
- Specified by:
unregister
in interface ConnectionCookie
- Parameters:
type
- type of event to unregister the listener from listening tolistener
- to unregister- Throws:
IOException
- if there is I/O operation error when the removing
the listener from persistent storage
getTypes
public Set getTypes()
- Unmutable set of types supported by this connection source.
- Specified by:
getTypes
in interface ConnectionCookie
- Returns:
- a set of Type objects
getRegisteredTypes
public List getRegisteredTypes()
- Get the list of all registered types in every (persistent
or not persistent) connections.
- Returns:
- the list of ConnectionCookie.Type objects
fireEvent
public void fireEvent(ConnectionCookie.Event ev)
- Fires info for all listeners of given type.
- Parameters:
ev
- the event
listenersFor
public Set listenersFor(ConnectionCookie.Type type)
- Obtains a set of all listeners for given type.
- Parameters:
type
- type of events to test- Returns:
- unmutable set of all listeners (Node) for a type
Built on December 12 2001. | Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.