Package org.gudy.azureus2.core3.tracker.client.impl.bt

Examples of org.gudy.azureus2.core3.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl


  private static DiskManagerFileInfo[] toDMFI(Object[] objects) {
    int count = 0;
    DiskManagerFileInfo[] result = new DiskManagerFileInfo[objects.length];
    for (Object object : objects) {
      if (object instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) object;
        result[count++] = fileInfo;
      } else if (object instanceof SelectedContent) {
        SelectedContent sc = (SelectedContent) object;
        int fileIndex = sc.getFileIndex();
        if (fileIndex >= 0 && sc.getDownloadManager() != null) {
View Full Code Here


              canStop = true;
            }
          } else {
            DiskManagerFileInfo[] fileInfos = dm.getDiskManagerFileInfo();
            if (fileIndex < fileInfos.length) {
              DiskManagerFileInfo fileInfo = fileInfos[fileIndex];
              if (!canStart && (fileInfo.isSkipped())) {
                canStart = true;
              }
             
              if (!canStop && !fileInfo.isSkipped()) {
                canStop = true;
              }
             
              if (!canRemoveFileInfo && !fileInfo.isSkipped()) {
                int storageType = fileInfo.getStorageType();
                if (storageType == DiskManagerFileInfo.ST_LINEAR
                    || storageType == DiskManagerFileInfo.ST_COMPACT) {
                  canRemoveFileInfo = true;
                }
              }
             
              if (!canRunFileInfo
                  && fileInfo.getAccessMode() == DiskManagerFileInfo.READ
                  && fileInfo.getDownloaded() == fileInfo.getLength()
                  && fileInfo.getFile(true).exists()) {
                canRunFileInfo = true;
              }
            }
          }
        }
View Full Code Here

    DownloadManager dm = (DownloadManager) ds;
    if (rowCore.getSubItemCount() == 0 && dm.getTorrent() != null
        && !dm.getTorrent().isSimpleTorrent() && rowCore.isVisible()
        && dm.getNumFileInfos() > 0) {
      DiskManagerFileInfoSet fileInfos = dm.getDiskManagerFileInfoSet();
      if (fileInfos != null) {
        DiskManagerFileInfo[] files = fileInfos.getFiles();
        boolean copied = false;
        int pos = 0;
        for (int i = 0; i < files.length; i++) {
          DiskManagerFileInfo fileInfo = files[i];
          if (fileInfo.isSkipped()
View Full Code Here

  public static DiskManager
  create(
    TOTorrent    torrent,
    DownloadManager manager)
  {
    DiskManagerImpl dm = new DiskManagerImpl( torrent, manager );
   
    if ( dm.getState() != DiskManager.FAULTY ){
     
      dm.start();
    }
   
    return dm;
  }
View Full Code Here

        }
        CategoryManager.addCategoryManagerListener(MyTorrentsView.this);
        globalManager.addListener(MyTorrentsView.this, false);
        DownloadManager[] dms = (DownloadManager[]) globalManager.getDownloadManagers().toArray(new DownloadManager[0]);
        for (int i = 0; i < dms.length; i++) {
          DownloadManager dm = dms[i];
          dm.addListener(MyTorrentsView.this);
          if (!isOurDownloadManager(dm)) {
            dms[i] = null;
          }
        }
        tv.addDataSources(dms);
View Full Code Here

        }
      }
    });
    Object[] dms = globalManager.getDownloadManagers().toArray();
    for (int i = 0; i < dms.length; i++) {
      DownloadManager dm = (DownloadManager) dms[i];
      dm.removeListener(this);
    }
    if (currentCategory != null) {
      currentCategory.removeCategoryListener(this);
    }
    CategoryManager.removeCategoryManagerListener(this);
View Full Code Here

          long ttlSize = 0;
          long ttlRSpeed = 0;
          long ttlSSpeed = 0;
          int count = 0;
          for (Iterator iter = dms.iterator(); iter.hasNext();) {
            DownloadManager dm = (DownloadManager) iter.next();

            if (!isInCategory(dm, currentCategory))
              continue;

            count++;
            if (dm.getState() == DownloadManager.STATE_DOWNLOADING
                || dm.getState() == DownloadManager.STATE_SEEDING)
              ttlActive++;
            ttlSize += dm.getSize();
            ttlRSpeed += dm.getStats().getDataReceiveRate();
            ttlSSpeed += dm.getStats().getDataSendRate();
          }

          String up_details = "";
          String down_details = "";
View Full Code Here

    Object[] dataSources = tv.getSelectedDataSources(true);
    DownloadManager[] dms = getSelectedDownloads();
   
    if (dms.length == 0 && dataSources.length > 0) {
      List<DiskManagerFileInfo> listFileInfos = new ArrayList<DiskManagerFileInfo>();
      DownloadManager firstFileDM = null;
      for (Object ds : dataSources) {
        if (ds instanceof DiskManagerFileInfo) {
          DiskManagerFileInfo info = (DiskManagerFileInfo) ds;
          // for now, FilesViewMenuUtil.fillmenu can only handle one DM
          if (firstFileDM != null && !firstFileDM.equals(info.getDownloadManager())) {
            break;
          }
          firstFileDM = info.getDownloadManager();
          listFileInfos.add(info);
        }
View Full Code Here

            boolean onlyDMs = true;
            StringBuffer sb = new StringBuffer();
            Object[] selectedDataSources = tv.getSelectedDataSources(true);
            for (Object ds : selectedDataSources) {
              if (ds instanceof DownloadManager) {
                DownloadManager dm = (DownloadManager) ds;
                TOTorrent torrent = dm.getTorrent();
                if (torrent != null) {
                  try {
                    sb.append(torrent.getHashWrapper().toBase32String());
                    sb.append('\n');
                  } catch (TOTorrentException e) {
                  }
                }
              } else if (ds instanceof DiskManagerFileInfo) {
                DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
                DownloadManager dm = fileInfo.getDownloadManager();
                TOTorrent torrent = dm.getTorrent();
                if (torrent != null) {
                  try {
                    sb.append(torrent.getHashWrapper().toBase32String());
                    sb.append(';');
                    sb.append(fileInfo.getIndex());
                    sb.append('\n');
                    onlyDMs = false;
                  } catch (TOTorrentException e) {
                  }
                }
              }
            }
           
            eventData = (onlyDMs ? "DownloadManager\n" : "DiskManagerFileInfo\n") + sb.toString();
          }

          public void dragSetData(DragSourceEvent event) {
            // System.out.println("DragSetData");
            event.data = eventData;
          }
        });
      }

      dropTarget = tv.createDropTarget(DND.DROP_DEFAULT | DND.DROP_MOVE
          | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_TARGET_MOVE);
      if (dropTarget != null) {
        dropTarget.setTransfer(new Transfer[] { HTMLTransfer.getInstance(),
            URLTransfer.getInstance(), FileTransfer.getInstance(),
            TextTransfer.getInstance() });

        dropTarget.addDropListener(new DropTargetAdapter() {
          Point enterPoint = null;
          public void dropAccept(DropTargetEvent event) {
            event.currentDataType = URLTransfer.pickBestType(event.dataTypes,
                event.currentDataType);
          }

          public void dragEnter(DropTargetEvent event) {
            // no event.data on dragOver, use drag_drop_line_start to determine
            // if ours
            if (drag_drop_line_start < 0) {
              if (event.detail != DND.DROP_COPY) {
                if ((event.operations & DND.DROP_LINK) > 0)
                  event.detail = DND.DROP_LINK;
                else if ((event.operations & DND.DROP_COPY) > 0)
                  event.detail = DND.DROP_COPY;
              }
            } else if (TextTransfer.getInstance().isSupportedType(
                event.currentDataType)) {
              event.detail = event.item == null ? DND.DROP_NONE : DND.DROP_MOVE;
              event.feedback = DND.FEEDBACK_SCROLL;
              enterPoint = new Point(event.x, event.y);
            }
          }

          public void dragOver(DropTargetEvent event) {
            if (drag_drop_line_start >= 0) {
              if (drag_drop_rows.length > 0
                  && !(drag_drop_rows[0].getDataSource(true) instanceof DownloadManager)) {
                event.detail = DND.DROP_NONE;
                return;
              }
              event.detail = event.item == null ? DND.DROP_NONE : DND.DROP_MOVE;
              event.feedback = DND.FEEDBACK_SCROLL
                  | ((enterPoint != null && enterPoint.y > event.y)
                      ? DND.FEEDBACK_INSERT_BEFORE : DND.FEEDBACK_INSERT_AFTER);
            }
          }

          public void drop(DropTargetEvent event) {
            if (!(event.data instanceof String)) {
              TorrentOpener.openDroppedTorrents(event, true);
              return;
            }
            String data = (String) event.data;
            if (data.startsWith("DiskManagerFileInfo\n")) {
              return;
            }
            if (!data.startsWith("DownloadManager\n")) {
              TorrentOpener.openDroppedTorrents(event, true);
              return;
            }

            event.detail = DND.DROP_NONE;
            // Torrent file from shell dropped
            if (drag_drop_line_start >= 0) { // event.data == null
              event.detail = DND.DROP_NONE;
              TableRowCore row = tv.getRow(event);
              if (row == null)
                return;
              if (row.getParentRowCore() != null) {
                row = row.getParentRowCore();
              }
              int drag_drop_line_end = row.getIndex();
              if (drag_drop_line_end != drag_drop_line_start) {
                DownloadManager dm = (DownloadManager) row.getDataSource(true);
                moveRowsTo(drag_drop_rows, dm.getPosition());
                event.detail = DND.DROP_MOVE;
              }
              drag_drop_line_start = -1;
              drag_drop_rows = null;
            }
View Full Code Here

      TableRowCore row = rows[i];
      Object ds = row.getDataSource(true);
      if (!(ds instanceof DownloadManager)) {
        continue;
      }
      DownloadManager dm = (DownloadManager) ds;
      int iOldPos = dm.getPosition();
     
      globalManager.moveTo(dm, iNewPos);
      if (isSortAscending) {
        if (iOldPos > iNewPos)
          iNewPos++;
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.