Package com.aelitis.azureus.activities

Examples of com.aelitis.azureus.activities.VuzeActivitiesEntry


  public static DownloadManager getDM(Object ds) {
    try {
      if (ds instanceof DownloadManager) {
        return (DownloadManager) ds;
      } else if (ds instanceof VuzeActivitiesEntry) {
        VuzeActivitiesEntry entry = (VuzeActivitiesEntry) ds;
        DownloadManager dm = entry.getDownloadManger();
        if (dm == null) {
          String assetHash = entry.getAssetHash();
          if (assetHash != null && AzureusCoreFactory.isCoreRunning()) {
            GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
            dm = gm.getDownloadManager(new HashWrapper(Base32.decode(assetHash)));
            entry.setDownloadManager(dm);
          }
        }
        return dm;
      } else if ((ds instanceof TOTorrent) && AzureusCoreFactory.isCoreRunning()) {
        GlobalManager gm = AzureusCoreFactory.getSingleton().getGlobalManager();
View Full Code Here


      } else if (ds instanceof TOTorrent) {
        return ((TOTorrent) ds).getHashWrapper().toBase32String();
      } else if (ds instanceof DeviceOfflineDownload) {
        return( getHash(PluginCoreUtils.unwrap(((DeviceOfflineDownload)ds).getDownload())));
      } else if (ds instanceof VuzeActivitiesEntry) {
        VuzeActivitiesEntry entry = (VuzeActivitiesEntry) ds;
        return entry.getAssetHash();
      } else if (ds instanceof ISelectedContent) {
        return ((ISelectedContent)ds).getHash();
      } else if (ds instanceof String) {
        return (String) ds;
      }
View Full Code Here

      } else if (ds instanceof TOTorrent) {
        id = PlatformTorrentUtils.getContentNetworkID((TOTorrent) ds);
      } else if (ds instanceof DeviceOfflineDownload) {
        return( getContentNetwork(PluginCoreUtils.unwrap(((DeviceOfflineDownload)ds).getDownload())));
      } else if (ds instanceof VuzeActivitiesEntry) {
        VuzeActivitiesEntry entry = (VuzeActivitiesEntry) ds;
        return entry.getContentNetwork();
      } else if (ds instanceof ISelectedContent) {
        return getContentNetwork(((ISelectedContent)ds).getDownloadManager());
      } else if ((ds instanceof String) && ((String)ds).length() == 32) {
        // assume 32 byte string is a hash and that it belongs to the def. network
        id = ConstantsVuze.getDefaultContentNetwork().getID();
View Full Code Here

    colorLinkHover = skinProperties.getColor("color.links.hover");
  }

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.ui.swt.views.table.TableCellSWT)
  public void cellPaint(GC gc, TableCellSWT cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();
    if (entry == null) {
      return;
    }

    String text = cell.getText();
View Full Code Here

    cell.setMarginHeight(0);
  }

  // @see org.gudy.azureus2.plugins.ui.tables.TableCellRefreshListener#refresh(org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void refresh(TableCell cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();
   
    if(entry == null) return;
   
    if (!cell.setSortValue(entry.getTypeID()) && cell.isValid()) {
      return;
    }

    DownloadManager dm = entry.getDownloadManger();
    boolean canPlay = PlayUtils.canPlayDS(entry, -1);
    boolean canDL = dm == null && entry.getDownloadManger() == null
        && (entry.getTorrent() != null || entry.getAssetHash() != null);
    boolean canRun = !canPlay && dm != null;
    if (canRun && dm != null && !dm.getAssumedComplete()) {
      canRun = false;
    }
View Full Code Here

    cell.getTableRow().setData("text", sb.toString());
  }

  // @see org.gudy.azureus2.plugins.ui.tables.TableCellMouseListener#cellMouseTrigger(org.gudy.azureus2.plugins.ui.tables.TableCellMouseEvent)
  public void cellMouseTrigger(TableCellMouseEvent event) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) event.cell.getDataSource();

    String tooltip = null;
    boolean invalidateAndRefresh = false;

    Rectangle bounds = ((TableCellSWT) event.cell).getBounds();
    String text = (String) event.cell.getTableRow().getData("text");
    if (text == null) {
      return;
    }

    GCStringPrinter sp = null;
    GC gc = new GC(Display.getDefault());
    try {
      if (font != null) {
        gc.setFont(font);
      }
      Rectangle drawBounds = getDrawBounds((TableCellSWT) event.cell);
      sp = new GCStringPrinter(gc, text, drawBounds, true, true, SWT.WRAP
          | SWT.CENTER);
      sp.calculateMetrics();
    } catch (Exception e) {
      Debug.out(e);
    } finally {
      gc.dispose();
    }

    if (sp != null) {
      URLInfo hitUrl = sp.getHitUrl(event.x + bounds.x, event.y + bounds.y);
      int newCursor;
      if (hitUrl != null) {
        if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP) {
          if (hitUrl.url.equals("download")) {
            String referal = null;
            Object ds = event.cell.getDataSource();
            if (ds instanceof VuzeActivitiesEntry) {
              referal = DLReferals.DL_REFERAL_DASHACTIVITY + "-"
                  + ((VuzeActivitiesEntry) ds).getTypeID();
            }
            TorrentListViewsUtils.downloadDataSource(ds, false, referal);
           
          } else if (hitUrl.url.equals("play")) {
            String referal = null;
            Object ds = event.cell.getDataSource();
            if (ds instanceof VuzeActivitiesEntry) {
              referal = DLReferals.DL_REFERAL_PLAYDASHACTIVITY + "-"
                  + ((VuzeActivitiesEntry) ds).getTypeID();
            }
            TorrentListViewsUtils.playOrStreamDataSource(ds, referal, false, true );
           
          } else if (hitUrl.url.equals("launch")) {
            // run via play or stream so we get the security warning
            Object ds = event.cell.getDataSource();
            TorrentListViewsUtils.playOrStreamDataSource(ds,
                DLReferals.DL_REFERAL_LAUNCH, false, true);
           
          } else if (!UrlFilter.getInstance().urlCanRPC(hitUrl.url)) {
            Utils.launch(hitUrl.url);
          } else {
            UIFunctionsSWT uif = UIFunctionsManagerSWT.getUIFunctionsSWT();
            if (uif != null) {
              String target = hitUrl.target;
              if (target == null) {
                target = ContentNetworkUtils.getTarget(entry.getContentNetwork());
              }
              uif.viewURL(hitUrl.url, target, "column.activity.action");
              return;
            }
          }
View Full Code Here

    initializeAsGraphic(WIDTH);
  }

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, final TableCellSWT cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();

    Image imgIcon = null;
    String iconID = entry.getIconID();
    if (iconID != null) {
      ImageLoader imageLoader = ImageLoader.getInstance();
      if (iconID.startsWith("http")) {
        imgIcon = imageLoader.getUrlImage(iconID,
            new ImageDownloaderListener() {
View Full Code Here

    }
  }

  // @see org.gudy.azureus2.plugins.ui.tables.TableCellRefreshListener#refresh(org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void refresh(TableCell cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();
    if (cell.setSortValue(entry.getTypeID()) || !cell.isValid()) {
      String ts = timeFormat.format(new Date(entry.getTimestamp()));
      cell.setToolTip("Activity occurred on " + ts);
    }
  }
View Full Code Here

    imgOld = ImageLoader.getInstance().getImage("image.activity.read");
  }

  // @see org.gudy.azureus2.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void cellPaint(GC gc, TableCellSWT cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();

    Rectangle cellBounds = cell.getBounds();
    Image img = entry.getReadOn() <= 0 ? imgNew : imgOld;

    if (img != null && !img.isDisposed()) {
      Rectangle imgBounds = img.getBounds();
      gc.drawImage(img, cellBounds.x
          + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y
View Full Code Here

    cell.setMarginHeight(0);
  }

  // @see org.gudy.azureus2.plugins.ui.tables.TableCellRefreshListener#refresh(org.gudy.azureus2.plugins.ui.tables.TableCell)
  public void refresh(TableCell cell) {
    VuzeActivitiesEntry entry = (VuzeActivitiesEntry) cell.getDataSource();

    boolean isRead = entry.getReadOn() > 0;
    int sortVal = isRead ? 1 : 0;

    if (cell.setSortValue(sortVal)) {
      cell.invalidate();
    }
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.activities.VuzeActivitiesEntry

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.