Package org.jmule.core

Examples of org.jmule.core.JMRunnable


    Utils.centreWindow(shell);
   
    shell.setAlpha(0);     
    shell.open();

    new JMThread(new JMRunnable() {
        int i;
        private static final int INCREMENT = 10;
        public void JMRun() {
          for(i = 0; i<255;i+=INCREMENT ) {
          display.syncExec(new JMRunnable() {
            public void JMRun() {
              shell.setAlpha(i);
            }
          });
          }
View Full Code Here


    this.search_tab = this;
    GridLayout layout;
    _core = core;
    listener = new SearchResultListener() {
      public void resultArrived(final SearchResult searchResult) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
            SearchResultTab tab = getSearchResultTab(searchResult.getSearchQuery());
           
            if (tab != null) {
              tab.addSearchResult(searchResult);
              MainWindow.getLogger().fine(Localizer._("mainwindow.logtab.message_search_result_arrived",
                  searchResult.getSearchQuery().getQuery(),searchResult.getSearchResultItemList().size()+""));
            }
          }
        });
      }

      public void searchCompleted(final SearchQuery query) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
            SearchResultTab tab = getSearchResultTab(query);
            if (tab==null) return; // tab closed
            tab.completeSearch();
          }
        });
      }

      public void searchStarted(final SearchQuery query) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
            SearchResultTab tab = getSearchResultTab(query);
            if (tab==null) return; // tab closed
            tab.searchStarted();
          }
View Full Code Here

    }
  }

  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;
View Full Code Here

  }

  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);
View Full Code Here

   
    file_not_rated = new MenuItem(rating_menu, SWT.RADIO);
    file_not_rated.setText(_._("mainwindow.searchtab.popupmenu.rating_submenu.not_rated"));
    file_not_rated.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
            file_fake.setSelection(false);
            file_poor.setSelection(false);
            file_fair.setSelection(false);
            file_good.setSelection(false);
            file_excellent.setSelection(false);
            SharedFile shared_file = shared_files_table.getSelectedObject();
            shared_file.setFileQuality(FileQuality.NOTRATED);
          }
        });
    }});
   
    file_fake = new MenuItem(rating_menu, SWT.RADIO);
    file_fake.setText(_._("mainwindow.searchtab.popupmenu.rating_submenu.fake"));
    file_fake.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
        file_not_rated.setSelection(false);
        file_poor.setSelection(false);
        file_fair.setSelection(false);
        file_good.setSelection(false);
        file_excellent.setSelection(false);
        SharedFile shared_file = shared_files_table.getSelectedObject();
        shared_file.setFileQuality(FileQuality.FAKE);
          }});
    }});

    file_poor = new MenuItem(rating_menu, SWT.RADIO);
    file_poor.setText(_._("mainwindow.searchtab.popupmenu.rating_submenu.poor"));
    file_poor.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
        file_not_rated.setSelection(false);
        file_fake.setSelection(false);
        file_fair.setSelection(false);
        file_good.setSelection(false);
        file_excellent.setSelection(false)
        SharedFile shared_file = shared_files_table.getSelectedObject();
        shared_file.setFileQuality(FileQuality.POOR);
          }});
    }});
   
    file_fair = new MenuItem(rating_menu, SWT.RADIO);
    file_fair.setText(_._("mainwindow.searchtab.popupmenu.rating_submenu.fair"));
    file_fair.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
        file_not_rated.setSelection(false);
        file_fake.setSelection(false);
        file_poor.setSelection(false);
        file_good.setSelection(false);
        file_excellent.setSelection(false);
        SharedFile shared_file = shared_files_table.getSelectedObject();
        shared_file.setFileQuality(FileQuality.FAIR);
          }});
    }});
   
    file_good = new MenuItem(rating_menu, SWT.RADIO);
    file_good.setText(_._("mainwindow.searchtab.popupmenu.rating_submenu.good"));
    file_good.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
        file_not_rated.setSelection(false);
        file_fake.setSelection(false);
        file_poor.setSelection(false);
        file_fair.setSelection(false);
        file_excellent.setSelection(false)
        SharedFile shared_file = shared_files_table.getSelectedObject();
        shared_file.setFileQuality(FileQuality.GOOD);
          }});
    }});
   
    file_excellent = new MenuItem(rating_menu, SWT.RADIO);
    file_excellent.setText(_._("mainwindow.searchtab.popupmenu.rating_submenu.excellent"));
    file_excellent.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTThread.getDisplay().asyncExec(new JMRunnable() {
          public void JMRun() {
        file_not_rated.setSelection(false);
        file_fake.setSelection(false);
        file_poor.setSelection(false);
        file_fair.setSelection(false);
View Full Code Here

      shared_files_table.removeRow(shared_file);
    }
  }

  private void updateDirList(final java.util.List<File> directoryList) {
    SWTThread.getDisplay().asyncExec(new JMRunnable() {
      public void JMRun() {
        shared_dir_list.removeAll();
        shared_dir_list.add(_._("mainwindow.sharedtab.shared_dirs.incoming"));
        shared_dir_list.add(_._("mainwindow.sharedtab.shared_dirs.partial"));
        shared_dir_list.add(_._("mainwindow.sharedtab.shared_dirs.all"));
View Full Code Here

        interrupt();
      }
     
      public void run() {
        File shared_dir = null;
        SWTThread.getDisplay().syncExec(new JMRunnable() {
          public void JMRun() {
            shared_files_table.clear();
        }});
       
        if (dir.equals(_._("mainwindow.sharedtab.shared_dirs.partial"))) {     
          final java.util.List<PartialFile> partial_file_list = sharing_manager.getPartialFiles();
              for(final SharedFile partial_file : partial_file_list ) {
                if (stop) return ;
                SWTThread.getDisplay().syncExec(new JMRunnable() {
                  public void JMRun() {
                    shared_files_table.addRow(partial_file);
                  }});
                }
              return ;
          }
       
        if (dir.equals(_._("mainwindow.sharedtab.shared_dirs.incoming")))
          shared_dir = new File(ConfigurationManager.INCOMING_DIR)
         
        if (!dir.equals(_._("mainwindow.sharedtab.shared_dirs.all"))) {
         
            // files from selected dir
            if (shared_dir == null)
              shared_dir = new File(dir);
           
            java.util.List<File> list_of_files = FileUtils.traverseDirAndReturnListOfFiles( shared_dir );
            if (stop) return ;
           
            for(File shared_file : list_of_files) {
              if (stop) return ;
             
              if (shared_file.isDirectory()) continue;
              final SharedFile file = sharing_manager.getSharedFile(shared_file);
              if (file!=null)
                SWTThread.getDisplay().asyncExec(new JMRunnable() {
                  public void JMRun() {
                    shared_files_table.addRow(file);
                  }
                });
             
             
              java.util.List<CompletedFile> unhashed_file_list = sharing_manager.getUnhashedFiles();
              if (unhashed_file_list == null) continue ;
              for(final SharedFile unhashed_file : unhashed_file_list) {
                if (stop) return ;
                if (unhashed_file.getFile().equals(shared_file)) {
                  SWTThread.getDisplay().syncExec(new JMRunnable() {
                      public void JMRun() {
                      shared_files_table.addRow(unhashed_file);
                  }});
                  break;
                }
              }
              }
           
          } else { // all files
            java.util.List<CompletedFile> unhashed_file_list = sharing_manager.getUnhashedFiles();
            if (unhashed_file_list != null) {
              for(final SharedFile file : unhashed_file_list) {
                SWTThread.getDisplay().syncExec(new JMRunnable() {
                  public void JMRun() {
                    if (isDisposed()) return ;
                    if (stop) return;
                    shared_files_table.addRow(file);
                  }
                });
              }
            }
           
            if (stop) return ;
            final JMIterable<SharedFile> shared_files = sharing_manager.getSharedFiles();
            for(final SharedFile file : shared_files) {
              if (stop) return ;
              SWTThread.getDisplay().syncExec(new JMRunnable() {
                  public void JMRun() {
                  shared_files_table.addRow(file);
               }});
            }
          }
View Full Code Here

      ed2k_links+=session.getED2KLink() + System.getProperty("line.separator");
    Utils.setClipBoardText(ed2k_links);
  }
 
  public void downloadAdded(final FileHash fileHash) {
    SWTThread.getDisplay().asyncExec(new JMRunnable() {
      public void JMRun() {
        DownloadSession session;
        try {
          session = download_manager.getDownload(fileHash);
          addDownlaodSession(session);
View Full Code Here

    });
   
  }

  public void downloadRemoved(final FileHash fileHash) {
    SWTThread.getDisplay().asyncExec(new JMRunnable() {
      public void JMRun() {
        DownloadSession session = null;
       
        for(BufferedTableRow s : line_list) {
          DownloadSession x = (DownloadSession) s.getData(SWTConstants.ROW_OBJECT_KEY);
View Full Code Here

      }
    });
  }

  public void downloadStarted(final FileHash fileHash) {
    SWTThread.getDisplay().asyncExec(new JMRunnable() {
      public void JMRun() {
        DownloadSession downloadSession;
        try {
          downloadSession = download_manager.getDownload(fileHash);
        } catch (DownloadManagerException e) {
View Full Code Here

TOP

Related Classes of org.jmule.core.JMRunnable

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.