i need to handle a change-interaction between 2 classes.
public class HeadClass {
private Subclass sub;
public void refresh() {...}
}
public class Subclass{
ArrayList store;
public void add(T data)
store.add(data);
firePropertyChange(...);
}
Whenever the method "add" in the subclass is called the method "refresh" in HeadClass should be called! But in which class i should implement this line:
private PropertyChangeSupport changes = new PropertyChangeSupport(/*WHAT SHOULD BE HERE?*/);
If i implement it in the HeadClass i can react like this:
changes.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
refresh();
}
});
But how should i fire propertyChangeEvents from the Subclass if i cant access the propertyChangeSupport "changes"??