public void processEvent(BasicEvent e) { PathListener listener; int i; for (i = 0; i < elm.countListeners(); i++) { listener = (PathListener) elm.getListener(i); switch (e.getID()) { case PathEvent.CHANGED: listener.pathChanged((PathEvent) e); break; default: assert false : e.getID(); } } // for( i = 0; i < elm.countListeners(); i++ ) }
public final void addAsyncListener(AsyncListener l) { if (!isBusy()) { l.asyncFinished(new AsyncEvent(this, AsyncEvent.FINISHED, System.currentTimeMillis(), this)); return; } if (asyncManager == null) { asyncManager = new EventManager( new EventManager.Processor() { public void processEvent(BasicEvent e) { final AsyncEvent ae = (AsyncEvent) e; AsyncListener al; for (int i = 0; i < asyncManager.countListeners(); i++) { al = (AsyncListener) asyncManager.getListener(i); switch (e.getID()) { case AsyncEvent.UPDATE: al.asyncUpdate(ae); break; case AsyncEvent.FINISHED: al.asyncFinished(ae); break; default: assert false : e.getID(); break; } } } }); } asyncManager.addListener(l); }
public final void removeAsyncListener(AsyncListener l) { if (asyncManager != null) asyncManager.removeListener(l); }
/** * Unregister a <code>PathListener</code> from receiving path change events. * * @param listener the <code>PathListener</code> to unregister * @see de.sciss.app.EventManager#removeListener( Object ) */ public void removePathListener(PathListener listener) { elm.removeListener(listener); }
/** * Register a <code>PathListener</code> which will be informed about changes of the path (i.e. * user selections in the file chooser). * * @param listener the <code>PathListener</code> to register * @see de.sciss.app.EventManager#addListener( Object ) */ public void addPathListener(PathListener listener) { elm.addListener(listener); }
/* * Sets a new path and dispatches a <code>PathEvent</code> * to registered listeners * * @param path the new path for the button and the event */ protected void setPathAndDispatchEvent(File path) { setPath(path); elm.dispatchEvent(new PathEvent(this, PathEvent.CHANGED, System.currentTimeMillis(), path)); }