I'm installing my location handlers into the application bean context by
overriding the AbstractLocationHandler.setLayer(LocationLayer layer) method:
// MyLocationHandler.java
public class MyLocationHandler extends AbstractLocationHandler implements
PropertyChangeListener, beanContextmembershipListener {
private beanContext bc;
public void setLayer(LocationLayer layer) {
setBeanContext(layer.getbeanContext());
layer.addPropertyChangeListener("beanContext", this);
}
private void setBeanContext(BeanContext newBC) {
if (bc != null) {
bc.removeBeanContextMembershipListener(this);
}
bc = newBC;
if (bc != null) {
bc.addBeanContextMembershipListener(this);
}
}
}
This way, if the layer has a context set, the handler gets it right away.
Otherwise, when the layer has its context set, this finds out:
Objects that implement this interface, shall fire a
java.beans.PropertyChangeEvent, with
parameters: propertyName "beanContext", oldValue (the previous nesting
BeanContext
instance, or null), newValue (the current nesting BeanContext instance, or
null).
-- JavaDoc, BeanContextChild interface.
Eric
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Mon Sep 24 16:22:25 2001
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT