/** Sets the default renderers to be used in the table. */ protected void setDefaultRenderers() { super.setDefaultRenderers(); TABLE.setDefaultRenderer(Date.class, DATE_RENDERER); TABLE.setDefaultRenderer(Float.class, PERCENTAGE_RENDERER); TABLE.setDefaultRenderer(SearchResultNameHolder.class, SEARCH_RESULT_NAME_RENDERER); TABLE.setDefaultRenderer(SearchResultActionsHolder.class, SEARCH_RESULT_ACTIONS_RENDERER); TABLE.setDefaultRenderer(SourceHolder.class, SOURCE_RENDERER); }
protected void setupMainPanelBase() { if (SearchSettings.ENABLE_SPAM_FILTER.getValue() && MAIN_PANEL != null) { MAIN_PANEL.add(createSchemaBox()); MAIN_PANEL.add(getScrolledTablePane()); addButtonRow(); } else { super.setupMainPanel(); } }
@Override public void add(UISearchResult o, int index) { super.add(o, index); schemaBox.updateCounters(o); }
/** Clears the table and converts the download button into a wishlist button. */ public void clearTable() { super.clearTable(); }
/** Sets all the listeners. */ protected void buildListeners() { super.buildListeners(); DOWNLOAD_LISTENER = new ActionListener() { public void actionPerformed(ActionEvent e) { SearchMediator.doDownload(SearchResultMediator.this); } }; TORRENT_DETAILS_LISTENER = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { final SearchResultDataLine[] lines = getAllSelectedLines(); if (lines.length == 1) { UISearchResult searchResult = lines[0].getSearchResult(); searchResult.showDetails(true); } } } }; COPY_MAGNET_ACTION_LISTENER = new ActionListener() { public void actionPerformed(ActionEvent e) { SearchResultDataLine[] lines = getAllSelectedLines(); String str = ""; for (SearchResultDataLine line : lines) { str += TorrentUtil.getMagnet(line.getInitializeObject().getHash()); str += "\n"; } GUIMediator.setClipboardContent(str); } }; COPY_HASH_ACTION_LISTENER = new ActionListener() { public void actionPerformed(ActionEvent e) { SearchResultDataLine[] lines = getAllSelectedLines(); String str = ""; for (SearchResultDataLine line : lines) { str += line.getInitializeObject().getHash(); str += "\n"; } GUIMediator.setClipboardContent(str); } }; CONFIGURE_SHARING_LISTENER = new ActionListener() { public void actionPerformed(ActionEvent e) { GUIMediator.instance().setOptionsVisible(true, I18n.tr("Options")); } }; DOWNLOAD_PARTIAL_FILES_LISTENER = new ActionListener() { public void actionPerformed(ActionEvent e) { SearchResultDataLine[] lines = getAllSelectedLines(); if (lines.length == 1 && lines[0] != null) { if (lines[0].getInitializeObject().getSearchResult() instanceof TorrentSearchResult) { GUIMediator.instance() .openTorrentSearchResult( (TorrentSearchResult) lines[0].getInitializeObject().getSearchResult(), true); } } } }; STOP_SEARCH_LISTENER = new ActionListener() { public void actionPerformed(ActionEvent e) { SearchMediator.instance().stopSearch(token); updateSearchIcon(false); setButtonEnabled(SearchButtons.STOP_SEARCH_BUTTON_INDEX, false); } }; }
@Override protected void addListeners() { super.addListeners(); }
public int compareTo(NameHolder o) { return AbstractTableMediator.compare(displayName, o.displayName); }