Package org.gudy.azureus2.core3.disk

Examples of org.gudy.azureus2.core3.disk.DiskManagerFileInfo


  private int getPercentDone(Object ds) {
    if (ds instanceof DownloadManager) {
      return ((DownloadManager) ds).getStats().getDownloadCompleted(true);
    } else if (ds instanceof DiskManagerFileInfo) {
      DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
      long length = fileInfo.getLength();
      if (length == 0) {
        return 1000;
      }
      return (int) (fileInfo.getDownloaded() * 1000 / length);
    }
    return 0;
  }
View Full Code Here


    if (event.eventType != TableRowMouseEvent.EVENT_MOUSEDOWN) {
      return;
    }
    final Object dataSource = ((TableRowCore) event.row).getDataSource(true);
    if (dataSource instanceof DiskManagerFileInfo) {
      final DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) dataSource;
      Rectangle hilowBounds = (Rectangle) event.row.getData("hilowBounds");
      if (event.button == 1 && hilowBounds != null
          && hilowBounds.contains(event.x, event.y)) {
        if (fileInfo.getPriority() > 0) {
          fileInfo.setPriority(0);
        } else {
          fileInfo.setPriority(1);
        }
        ((TableRowCore) event.row).redraw();
      }

      Rectangle buttonBounds = (Rectangle) event.row.getData("buttonBounds");

      if (buttonBounds != null && buttonBounds.contains(event.x, event.y)) {
        Menu menu = new Menu(Display.getDefault().getActiveShell(), SWT.POP_UP);

        MenuItem itemHigh = new MenuItem(menu, SWT.RADIO);
        Messages.setLanguageText(itemHigh, "priority.high");
        itemHigh.addListener(SWT.Selection, new Listener() {
          public void handleEvent(Event event) {
            FilesViewMenuUtil.changePriority(FilesViewMenuUtil.PRIORITY_HIGH,
                new Object[] {
                  dataSource
                });
          }
        });
        itemHigh.setSelection(fileInfo.getPriority() != 0);

        MenuItem itemNormal = new MenuItem(menu, SWT.RADIO);
        Messages.setLanguageText(itemNormal, "priority.normal");
        itemNormal.addListener(SWT.Selection, new Listener() {
          public void handleEvent(Event event) {
            FilesViewMenuUtil.changePriority(FilesViewMenuUtil.PRIORITY_NORMAL,
                new Object[] {
                  dataSource
                });
          }
        });
        itemNormal.setSelection(fileInfo.getPriority() == 0);

        new MenuItem(menu, SWT.SEPARATOR);
       
        boolean canStart = fileInfo.isSkipped() || fileInfo.getDownloadManager().getState() == DownloadManager.STATE_STOPPED;

        MenuItem itemStop = new MenuItem(menu, SWT.PUSH);
        Messages.setLanguageText(itemStop, "v3.MainWindow.button.stop");
        itemStop.addListener(SWT.Selection, new Listener() {
          public void handleEvent(Event event) {
            FilesViewMenuUtil.changePriority(
                FilesViewMenuUtil.PRIORITY_SKIPPED, new Object[] {
                  dataSource
                });
          }
        });
        itemStop.setEnabled(!canStart);

        MenuItem itemStart = new MenuItem(menu, SWT.PUSH);
        Messages.setLanguageText(itemStart, "v3.MainWindow.button.start");
        itemStart.addListener(SWT.Selection, new Listener() {
          public void handleEvent(Event event) {
            if (fileInfo.getDownloadManager().getState() == DownloadManager.STATE_STOPPED) {
              TorrentUtil.queueDataSources(new Object[] { dataSource }, true);
            }
           
            FilesViewMenuUtil.changePriority(FilesViewMenuUtil.PRIORITY_NORMAL,
                new Object[] {
View Full Code Here

  public void refresh(TableCell cell, boolean sortOnlyRefresh) {
    String name = null;
    Object ds = cell.getDataSource();
    if (ds instanceof DiskManagerFileInfo) {
      DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
      if (fileInfo.isSkipped()
          && (fileInfo.getStorageType() == DiskManagerFileInfo.ST_COMPACT || fileInfo.getStorageType() == DiskManagerFileInfo.ST_REORDER_COMPACT)) {
        TableRowCore row = (TableRowCore) cell.getTableRow();
        if (row != null) {
          row.getParentRowCore().removeSubRow(ds);
        }
      }
View Full Code Here

    if (ds instanceof DownloadManager) {
      DownloadManager dm = (DownloadManager) ds;
     
      value = new sizeitemsort(dm.getSize(), dm.getStats().getRemaining());
    } else if (ds instanceof DiskManagerFileInfo) {
      DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
      value = new sizeitemsort(fileInfo.getLength(), fileInfo.getLength()
          - fileInfo.getDownloaded());
    } else {
      return;
    }

    // cell.setSortValue(value) always returns true and if I change it,
View Full Code Here

    int value;
    Object ds = cell.getDataSource();
    if (ds instanceof DownloadManager) {
      value = ((DownloadManager) ds).getStats().getCompleted();
    } else if (ds instanceof DiskManagerFileInfo) {
      DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
      long length = fileInfo.getLength();
      if (length == 0) {
        value = 1000;
      } else {
        value = (int) (fileInfo.getDownloaded() * 1000 / length);
      }
    } else {
      return;
    }
    if (!cell.setSortValue(value) && cell.isValid())
View Full Code Here

               
                DiskManagerFileInfo[] files = dm.getDiskManagerFileInfo();
               
                for (int j=0;j<files.length;j++){
                 
                  DiskManagerFileInfo file = files[j];
                 
                  try{
                    writeLineRaw( "<FILE>");
                   
                    indent();
                   
                    writeTag( "NAME", file.getTorrentFile().getRelativePath());
                   
                    writeTag( "DND", file.isSkipped());
                   
                    writeRawCookedTag( "SIZE", file.getLength());
                   
                    writeRawCookedTag( "DOWNLOADED", file.getDownloaded());
                                   
                  }finally{

                    exdent();
View Full Code Here

      DiskManagerFileInfo[]  files = dm.getDiskManagerFileInfo();
     
      int  total  = files.length;
     
      for (int i=0;i<files.length;i++){
        DiskManagerFileInfo  file = files[i];
       
        if ( file.getLength() == file.getDownloaded()){
          complete++;
          if ( file.isSkipped()){
            skipped++;
            skipped_complete++;
          }
        }else if ( file.isSkipped()){
          skipped++;
        }
      }
     
      if ( skipped == 0 ){
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

TOP

Related Classes of org.gudy.azureus2.core3.disk.DiskManagerFileInfo

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.