public void valueChanged(ListSelectionEvent event)
{
...
}
public interface WorkspaceListener {
public void documentOpened(WorkspaceEvent e);
}
public class WorkspaceEvent extends EventObject {
private SimpleDocument document;
public WorkspaceEvent(SimpleDocument document) {
this.document = document;
}
public SimpleDocument getDocument() {
return this.document;
private List listeners = new Vector();
protected List docs = new Vector();
public void addWorkspaceListener(WorkspaceListener l) {
if(!listeners.contains(l))
listeners.add(l);
}
protected void fireDocumentOpened(WorkspaceEvent e) {
for(int i=0; i<listeners.size(); i++) {
((WorkspaceListener) listeners.get(i)).documentOpened(e);
}
}
public void openDocument(SimpleDocument d) {
WorkspaceEvent ev = new WorkspaceEvent(d);
if(!docs.contains(d)) {
docs.add(d);
fireDocumentOpened(ev);
} else {
fireDocumentActivated(ev);
}
}