public void downloadActive(Download download) {
   synchronized (listeners) {
     for (int i = 0; i < listenersDownload.size(); i++) {
       Download lDownload = (Download) listenersDownload.get(i);
       if (download.equals(lDownload)) {
         MessageListener listener = (MessageListener) listeners.get(i);
         listener.downloadActive(download);
       }
     }
   }
 }
  @SuppressWarnings("unchecked")
  public void addMessageListener(MessageListener listener, Download download) {
    synchronized (listeners) {
      listeners.add(listener);
      listenersDownload.add(download);
    }

    listener.downloadAdded(download);
    if (controller.isDownloadActive(download)) {
      listener.downloadActive(download);
    } else {
      listener.downloadInactive(download);
    }
  }