Examples of UploadSession


Examples of org.jmule.core.uploadmanager.UploadSession

  public void refresh() {
    if (isDisposed()) return ;
   
    List<Peer> upload_peers = null;
    UploadSession upload_session = null;
   
    if (upload_manager.hasUpload(download_session.getFileHash())) {
      try {
        upload_session = upload_manager.getUpload(download_session.getFileHash());
        upload_peers = upload_session.getPeers();
      } catch (UploadManagerException e) {
        e.printStackTrace();
        return ;
      }
     
    }
   
    List<Peer> download_peers = download_session.getPeers();
   
    for(Peer peer : shown_peers) {
      boolean remove = false;
      if (!download_session.hasPeer(peer))
        if (upload_session == null)
          remove = true;
        else
          remove = !upload_session.hasPeer(peer);
      if (remove)
        peers_table.removeRow(peer);
    }

    for(Peer peer : download_peers) {
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

  public void uploadAdded(final FileHash fileHash) {
    if (SWTThread.getDisplay().isDisposed()) return;
    SWTThread.getDisplay().asyncExec(new JMRunnable() {
      public void JMRun() {
        UploadSession session;
        try {
          session = upload_manager.getUpload(fileHash);
          if (hasObject(session)) return;
          if (session.sharingCompleteFile()) {
            addRow(session);
            MainWindow.getLogger().fine(Localizer._("mainwindow.logtab.message_upload_added",session.getSharingName()));
          }
        } catch (UploadManagerException e) {
          e.printStackTrace();
        }
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

  public void uploadRemoved(final FileHash fileHash) {
    if (fileHash == null) return ;
    if (SWTThread.getDisplay().isDisposed()) return;
    SWTThread.getDisplay().asyncExec(new JMRunnable() {
      public void JMRun() {
        UploadSession session = null;
       
        for(BufferedTableRow s : line_list) {
          UploadSession x = (UploadSession) s.getData(SWTConstants.ROW_OBJECT_KEY);
          if (x.getFileHash().equals(fileHash)) {
            session = x;
            break;
          }
        }
        if (session == null) return ;
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

   
    setRowText(session,  SWTConstants.DOWNLOAD_LIST_UPLOAD_SPEED_COLUMN_ID,SpeedFormatter.formatSpeed(upload_speed));
   
    int peerCount = session.getPeerCount();
    int partialSources = session.getPartialSources();
    UploadSession upload_session;
    try {
      if (upload_manager.hasUpload(session.getFileHash())) {
        upload_session = upload_manager.getUpload(session.getFileHash());
        peerCount += upload_session.getPeerCount();
        partialSources += upload_session.getPeerCount();
      }
    } catch (UploadManagerException e) {
      e.printStackTrace();
      return ;
    }
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

      status.setCellRenderer(new StatusTableCellRenderer());
      status.setComparator(new Comparator() {
      public int compare(Object o1, Object o2) {
        Object[] objects1 = (Object[])o1;
        Object[] objects2 = (Object[])o2;
        UploadSession session1 = (UploadSession)objects1[0];
        Peer peer1 = (Peer)objects1[1];   
        UploadSession session2 = (UploadSession)objects2[0];
            Peer peer2 = (Peer)objects2[1];
            int peer_position1 = 0;
        try {
          peer_position1 = _upload_manager.getUploadQueue().getPeerPosition(peer1);
        } catch (UploadQueueException e) {
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

    class StatusTableCellRenderer extends UploadPeersTableCellRenderer {
      public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
          Object[] objects = (Object[])value;
          UploadSession session = (UploadSession)objects[0];
          Peer peer = (Peer)objects[1];
          int peer_position = 0;
      try {
        peer_position = _upload_manager.
                     getUploadQueue().getPeerPosition(peer);
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

        Float u_speed1 = null;
        Float u_speed2 = null;
        try {
          DownloadSession d_session1 = (DownloadSession)o1;
          DownloadSession d_session2 = (DownloadSession)o2;
          UploadSession u_session1 = null;
          UploadSession u_session2 = null;
          if(_upload_manager.hasUpload(d_session1.getFileHash()))
            u_session1 = _upload_manager.getUpload(d_session1.getFileHash());
           if(_upload_manager.hasUpload(d_session2.getFileHash()))
            u_session2 = _upload_manager.getUpload(d_session2.getFileHash());
           u_speed1 = new Float((u_session1!=null)?u_session1.getSpeed():0.0f);
           u_speed2 = new Float((u_session2!=null)?u_session2.getSpeed():0.0f);
        }catch(Throwable cause) {
          cause.printStackTrace();
        }
         return Misc.compareAllObjects(u_speed1, u_speed2, "floatValue", true);
     
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

    try {

      if (upload_manager.hasUpload(fileHash)) { // JMule is now uploading
                            // file, need to
                            // synchronize moving
        UploadSession upload_sessison = upload_manager
            .getUpload(fileHash);
        synchronized (upload_sessison.getSharedFile()) {
          sharedFiles.remove(fileHash);
          // FileUtils.moveFile(shared_partial_file.getFile(),
          // completed_file);
          shared_partial_file.getFile().renameTo(completed_file);
          CompletedFile shared_completed_file = new CompletedFile(
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

        
         properties = new JMenuItem("Properties");
         properties.setIcon(ImgRep.getIcon("info.png"));
         properties.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             UploadSession sessions[] = getSelectedUploadSessions();
             UploadDetailsDialog udd = new UploadDetailsDialog(parent, sessions[0]);
             SwingUtils.setWindowLocationRelativeTo(udd, parent);
             udd.setVisible(true);
           }
         });
View Full Code Here

Examples of org.jmule.core.uploadmanager.UploadSession

        
         properties = new JMenuItem("Properties");
         properties.setIcon(ImgRep.getIcon("info.png"));
         properties.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             UploadSession sessions[] = getSelectedUploadSessions();
             UploadDetailsDialog udd = new UploadDetailsDialog(parent, sessions[0]);
             SwingUtils.setWindowLocationRelativeTo(udd, parent);
             udd.setVisible(true);
           }
         });
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.