Examples of PEPiece


Examples of org.gudy.azureus2.core3.peer.PEPiece

  }
 
  public void refresh(TableCell cell)
  {
    int  value =0;
    final PEPiece piece = (PEPiece)cell.getDataSource();
    if (piece !=null)
    {
      value =piece.getResumePriority();

      if(!cell.setSortValue(value) &&cell.isValid())
      {
        return;
      }
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

    }

    public void refresh(TableCell cell)
    {
        boolean value =false;
        final PEPiece pePiece =(PEPiece) cell.getDataSource();
        if (pePiece !=null)
        {
             value = pePiece.isRequested();
        }
        if (!cell.setSortValue(value ?1 :0) &&cell.isValid())
            return;
        cell.setText(value?"*" :"");
    }
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

    if (img != null && !img.isDisposed())
      img.dispose();
  }

  public void refresh(TableCell cell) {
    PEPiece pePiece = (PEPiece) cell.getDataSource();
    if (pePiece == null) {
      cell.setSortValue(0);
      dispose(cell);
      cell.setGraphic(null);
      return;
    }

    cell.setSortValue(pePiece.getNbWritten());
    long lNumBlocks = pePiece.getNbBlocks();

    int newWidth = cell.getWidth();
    if (newWidth <= 0) {
      dispose(cell);
      cell.setGraphic(null);
      return;
    }
    int newHeight = cell.getHeight();

    int x1 = newWidth - 2;
    int y1 = newHeight - 3;
    if (x1 < 10 || y1 < 3) {
      dispose(cell);
      cell.setGraphic(null);
      return;
    }
    Image image = new Image(SWTThread.getInstance().getDisplay(), newWidth,
        newHeight);
    Color color;
    GC gcImage = new GC(image);
    gcImage.setForeground(Colors.grey);
    gcImage.drawRectangle(0, 0, x1 + 1, y1 + 1);
    int blocksPerPixel = 0;
    int iPixelsPerBlock = 0;
    int pxRes = 0;
    long pxBlockStep = 0;
    int factor = 4;

    while (iPixelsPerBlock <= 0) {
      blocksPerPixel++;
      iPixelsPerBlock = (int) ((x1 + 1) / (lNumBlocks / blocksPerPixel));
    }

    pxRes = (int) (x1 - ((lNumBlocks / blocksPerPixel) * iPixelsPerBlock)); // kolik mi zbyde
    if (pxRes <= 0)
      pxRes = 1;
    pxBlockStep = (lNumBlocks * factor) / pxRes; // kolikaty blok na +1 k sirce
    long addBlocks = (lNumBlocks * factor) / pxBlockStep;
    if ((addBlocks * iPixelsPerBlock) > pxRes)
      pxBlockStep += 1;

    /*      String msg = "iPixelsPerBlock = "+iPixelsPerBlock + ", blocksPerPixel = " + blocksPerPixel;
          msg += ", pxRes = " + pxRes + ", pxBlockStep = " + pxBlockStep + ", addBlocks = " + addBlocks + ", x1 = " + x1;
          Debug.out(msg);*/

    TOTorrent torrent = pePiece.getManager().getDiskManager().getTorrent();

    boolean[] written = pePiece.getDMPiece().getWritten();
    boolean piece_written = pePiece.isWritten();
    int drawnWidth = 0;
    int blockStep = 0;

    int pieceNumber = pePiece.getPieceNumber();
    long[] offsets = new long[(int) lNumBlocks];
    long[] lengths = (long[]) offsets.clone();
    Arrays.fill(offsets,
        (long) pePiece.getManager().getDiskManager().getPieceLength()
            * (long) pieceNumber);
    for (int i = 0; i < lNumBlocks; lengths[i] = pePiece.getBlockSize(i), offsets[i] += DiskManager.BLOCK_SIZE * i, i++)
      ;

    boolean[] isCached = cacheStats == null ? null
        : cacheStats.getBytesInCache(torrent, offsets, lengths);

    for (int i = 0; i < lNumBlocks; i += blocksPerPixel) {
      int nextWidth = iPixelsPerBlock;

      blockStep += blocksPerPixel * factor;
      if (blockStep >= pxBlockStep) { // pokud jsem prelezl dany pocet bloku, zvys tomuhle sirku
        nextWidth += (int) (blockStep / pxBlockStep);
        blockStep -= pxBlockStep;
      }

      if (i >= lNumBlocks - blocksPerPixel) { // pokud je posledni, at zasahuje az na konec
        nextWidth = x1 - drawnWidth;
      }
      color = Colors.white;

      if ((written == null && piece_written) || (written != null && written[i])) {

        color = colors[COLOR_WRITTEN];

      } else if (pePiece.isDownloaded(i)) {

        color = colors[COLOR_DOWNLOADED];

      } else if (pePiece.isRequested(i)) {

        color = colors[COLOR_REQUESTED];
      }

      gcImage.setBackground(color);
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

    super("reservedby", ALIGN_TRAIL, POSITION_INVISIBLE, 80, TableManager.TABLE_TORRENT_PIECES);
    setRefreshInterval(INTERVAL_LIVE);
  }

  public void refresh(TableCell cell) {
    PEPiece piece = (PEPiece)cell.getDataSource();
    String reservedBy = (piece == null) ? null : piece.getReservedBy();
    String value = reservedBy == null ? "---" : reservedBy;   
    if( !cell.setSortValue( value ) && cell.isValid() ) {
      return;
    }
   
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

      CAT_PROGRESS,
    });
  }

  public void refresh(TableCell cell) {
    PEPiece piece = (PEPiece)cell.getDataSource();
    long value = (piece == null) ? 0 : piece.getNbWritten();

    if( !cell.setSortValue( value ) && cell.isValid() ) {
      return;
    }
   
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

      CAT_BYTES,
    });
  }
 
  public void refresh(TableCell cell) {
    PEPiece piece = (PEPiece)cell.getDataSource();
    int value =0;
    if (null !=piece)
    {
      value =piece.getSpeed();
     
      if( !cell.setSortValue( value ) && cell.isValid() )
      {
        return;
      }
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

  public PieceNumberItem() {
    super("#", ALIGN_TRAIL, POSITION_LAST, 50, TableManager.TABLE_TORRENT_PIECES);
  }

  public void refresh(TableCell cell) {
    PEPiece piece = (PEPiece)cell.getDataSource();
    long value = (piece == null) ? 0 : piece.getPieceNumber();

    if( !cell.setSortValue( value ) && cell.isValid() ) {
      return;
    }
   
View Full Code Here

Examples of org.gudy.azureus2.core3.peer.PEPiece

      }
    }

    if (coreDataSource instanceof PEPiece) {
      // XXX There is no Piece object for plugins yet
      PEPiece piece = (PEPiece) coreDataSource;
      if (piece != null) {
        pluginDataSource = null;
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.