站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

ConnectionSupport (NetBeans Loaders API) - NetBeans API Javadoc 4.1.0

 

org.openide.loaders
Class ConnectionSupport

java.lang.Object
  extended byorg.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.


Nested Class Summary
 
Nested classes inherited from class org.openide.cookies.ConnectionCookie
ConnectionCookie.Event, ConnectionCookie.Listener, ConnectionCookie.Type
 
Constructor Summary
ConnectionSupport(MultiDataObject.Entry entry, ConnectionCookie.Type[] types)
          Creates new connection support for given file entry.
 
Method Summary
 void fireEvent(ConnectionCookie.Event ev)
          Fires info for all listeners of given type.
 List getRegisteredTypes()
          Get the list of all registered types in every (persistent or not persistent) connections.
 Set getTypes()
          Unmutable set of types supported by this connection source.
 Set listenersFor(ConnectionCookie.Type type)
          Obtains a set of all listeners for given type.
 void register(ConnectionCookie.Type type, Node listener)
          Attaches new node to listen to events produced by this event.
 void unregister(ConnectionCookie.Type type, Node listener)
          Unregisters an listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 attributes
types - a list of event types to support
Method Detail

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 cookie
listener - 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 to
listener - 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 May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.