Paul,
A PropertyChangeListener receives PropertyChangeEvent objects which are quite generic.
It seems to me that if the type of events that are going to be generated is unknown, then PropertyChangeListener/PropertyChangeEvent might be the right way.
If however, the type of events are known in advance and their number small (number of types), then writing a specific interface (see o.a.l.spi.LoggerEventListener, HierarchyEventListener) might be most appropriate.
Do you know the types of events you are interested in for the plugins?
At 03:41 PM 9/5/2003 +1000, Paul Smith wrote:
Could we extend Plugins to support the concept of PropertyChangeListeners (java.bean package stuff)?
PropertyChangeListener and associated classes are a great way of binding objects together and being notified when certain properties change. This allows for a very nicely decoupled design, particular in GUI's.
What I would propose to do is modify PluginSkeleton to add the following methods:
public void addPropertyChangeListener(PropertyChangeListener l); public void removePropertyChangeListener(PropertyChangeListener l);
For each setter property in PluginSkeleton and it's children, modify the method to fire a PropertyChangeEvent. Listeners can then modify themselves based on the old/new value accordingly.
We can use the PropertyChangeSupport class to do most of the heavy lifting. Since Swing uses these classes extensively, they have been optimized to ensure that if no-one is listening, as little CPU/memory as possible is wasted.
Does anyone have any objects, or comments?
cheers,
Paul Smith
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Ceki G�lc�
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp See you in November at ApacheCon US 2003 in Las Vegas.
http://apachecon.com/--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
