javax.infobus
Class InfoBusMemberSupport

java.lang.Object
  |
  +--javax.infobus.InfoBusMemberSupport
Direct Known Subclasses:
InfoBusBeanSupport

public class InfoBusMemberSupport
extends java.lang.Object
implements InfoBusMember

Implements the methods of the InfoBusMember interface with the functionality specified by the InfoBus protocol. Encapsulates an InfoBus property, plus PropertyChangeSupport and VetoableChangeSupport objects to ensure the property is bound and constrained.

Methods documented here as "Internally Synchronized" contain internal synchronized blocks that lock on a common instance variable.

See Also:
InfoBusMember

Constructor Summary
InfoBusMemberSupport()
          The no-argument constructor is provided for subclasses which want to be Serializable.
InfoBusMemberSupport(InfoBusMember member)
          Creates a new InfoBusMemberSupport object.
 
Method Summary
 void addInfoBusPropertyListener(java.beans.PropertyChangeListener pcl)
          Adds a PropertyChangeListener that will be alerted whenever the InfoBusMember's setInfoBus method is called and not vetoed.
 void addInfoBusVetoableListener(java.beans.VetoableChangeListener vcl)
          Adds a VetoableChangeListener to the list of listeners that will be alerted whenever the InfoBusMember's setInfoBus method is called.
 InfoBus getInfoBus()
          Returns the InfoBus which is currently assigned to the InfoBusMemberSupport's InfoBus property (null means that it is currently not a member of any bus).
 void joinInfoBus(java.awt.Component component)
          Attempts to obtain a default bus and join it.
 void joinInfoBus(java.lang.String busName)
          Attempts to obtain a named bus and join it.
 void leaveInfoBus()
          Calls the leave method on the InfoBus to which this InfoBusMemberSupport is attached, effectively setting the InfoBus property to null.
 void removeInfoBusPropertyListener(java.beans.PropertyChangeListener pcl)
          Removes a PropertyChangeListener from the list of listeners requesting notification of an InfoBus change.
 void removeInfoBusVetoableListener(java.beans.VetoableChangeListener vcl)
          Removes a VetoableChangeListener from the list of listeners that will be alerted whenever the InfoBusMember's setInfoBus method is called.
 void setInfoBus(InfoBus newInfoBus)
          Attempts to set the InfoBus property and register with the InfoBus.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InfoBusMemberSupport

public InfoBusMemberSupport(InfoBusMember member)
Creates a new InfoBusMemberSupport object. The member parameter allows the parent of InfoBusMemberSupport to implement the InfoBusMember interface and have the parent -- instead of the InfoBusMemberSupport object -- specified in all PropertyChangeEvents and on the InfoBus itself. If member is null, the InfoBusMemberSupport object is specified in these cases.
Parameters:
member - used as the "source" of PropertyChangeEvents issued by the InfoBusMemberSupport. If null, the InfoBusMemberSupport object is used as the "source."

InfoBusMemberSupport

public InfoBusMemberSupport()
The no-argument constructor is provided for subclasses which want to be Serializable. It has the same effect as calling new InfoBusMemberSupport(null)
Method Detail

setInfoBus

public void setInfoBus(InfoBus newInfoBus)
                throws java.beans.PropertyVetoException
Attempts to set the InfoBus property and register with the InfoBus. First, it checks with any registered VetoableChangeListeners, and rethrows the PropertyVetoException if the attempt is denied. If successful, it sends notification to all registered PropertyChangeListeners.

Internally Synchronized.

Specified by:
setInfoBus in interface InfoBusMember
Parameters:
newInfoBus - the InfoBus that will be assigned to the InfoBus property if the action is not vetoed
Throws:
java.beans.PropertyVetoException - if one or more of the VetoableChangeListeners reject the proposed change of InfoBus

getInfoBus

public InfoBus getInfoBus()
Returns the InfoBus which is currently assigned to the InfoBusMemberSupport's InfoBus property (null means that it is currently not a member of any bus).
Specified by:
getInfoBus in interface InfoBusMember
Returns:
the current value of the InfoBus property

joinInfoBus

public void joinInfoBus(java.lang.String busName)
                 throws InfoBusMembershipException,
                        java.beans.PropertyVetoException
Attempts to obtain a named bus and join it.

Internally Synchronized.

Parameters:
busName - the name of the bus that the InfoBusMemberSupport should join
Throws:
InfoBusMembershipException - if joinInfoBus is called when the InfoBus property is already set
java.beans.PropertyVetoException - if a VetoableChangeListener is registered and rejects the attempt to set the InfoBus property

joinInfoBus

public void joinInfoBus(java.awt.Component component)
                 throws InfoBusMembershipException,
                        java.beans.PropertyVetoException
Attempts to obtain a default bus and join it. The component specified, or a parent in the AWT hierarchy, must be an applet.

Internally Synchronized.

Parameters:
component - the Component on which the default bus should be based
Throws:
InfoBusMembershipException - if joinInfoBus is called when the InfoBus property is already set
java.beans.PropertyVetoException - if a VetoableChangeListener is registered and rejects the attempt to set the InfoBus property

leaveInfoBus

public void leaveInfoBus()
                  throws InfoBusMembershipException,
                         java.beans.PropertyVetoException
Calls the leave method on the InfoBus to which this InfoBusMemberSupport is attached, effectively setting the InfoBus property to null. This method should be called when the holder of the InfoBusMemberSupport is shutting down or finalizing to release unneeded resources.

Internally Synchronized.

Throws:
InfoBusMembershipException - if the InfoBus property is already set to null
java.beans.PropertyVetoException - if a VetoableChangeListener refuses to allow the InfoBus to be set to null

addInfoBusVetoableListener

public void addInfoBusVetoableListener(java.beans.VetoableChangeListener vcl)
Adds a VetoableChangeListener to the list of listeners that will be alerted whenever the InfoBusMember's setInfoBus method is called. Any of these listeners can veto the setInfoBus action by throwing a PropertyVetoException.
Specified by:
addInfoBusVetoableListener in interface InfoBusMember
Parameters:
vcl - the VetoableChangeListener to be added

removeInfoBusVetoableListener

public void removeInfoBusVetoableListener(java.beans.VetoableChangeListener vcl)
Removes a VetoableChangeListener from the list of listeners that will be alerted whenever the InfoBusMember's setInfoBus method is called.
Specified by:
removeInfoBusVetoableListener in interface InfoBusMember
Parameters:
vcl - the VetoableChangeListener to be removed

addInfoBusPropertyListener

public void addInfoBusPropertyListener(java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener that will be alerted whenever the InfoBusMember's setInfoBus method is called and not vetoed.
Specified by:
addInfoBusPropertyListener in interface InfoBusMember
Parameters:
pcl - the PropertyChangeListener to be added

removeInfoBusPropertyListener

public void removeInfoBusPropertyListener(java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener from the list of listeners requesting notification of an InfoBus change.
Specified by:
removeInfoBusPropertyListener in interface InfoBusMember
Parameters:
pcl - the PropertyChangeListener to be removed