Exemplo n.º 1
0
  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);
  }
Exemplo n.º 2
0
 /**
  * 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);
 }