use of com.biglybt.ui.common.table.TableRowCore in project BiglyBT by BiglySoftware.
the class OpenTorrentOptionsWindow method setupTVTorrents.
private void setupTVTorrents(Composite parent) {
GridLayout layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = layout.verticalSpacing = 0;
parent.setLayout(layout);
GridData gd;
// table
Composite table_area = new Composite(parent, SWT.NULL);
layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = layout.verticalSpacing = 0;
table_area.setLayout(layout);
gd = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(table_area, gd);
// toolbar area
Composite button_area = new Composite(parent, SWT.NULL);
layout = new GridLayout(5, false);
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = layout.verticalSpacing = 0;
layout.marginTop = 5;
button_area.setLayout(layout);
gd = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(button_area, gd);
Label label = new Label(button_area, SWT.NULL);
gd = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, gd);
buttonTorrentUp = new Button(button_area, SWT.PUSH);
buttonTorrentUp.setImage(loadImage("image.toolbar.up"));
buttonTorrentUp.setToolTipText(MessageText.getString("Button.moveUp"));
buttonTorrentUp.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
List<OpenTorrentInstance> selected = (List<OpenTorrentInstance>) (Object) tvTorrents.getSelectedDataSources();
if (selected.size() > 1) {
Collections.sort(selected, new Comparator<OpenTorrentInstance>() {
@Override
public int compare(OpenTorrentInstance o1, OpenTorrentInstance o2) {
return (o1.getIndex() - o2.getIndex());
}
});
}
boolean modified = false;
for (OpenTorrentInstance instance : selected) {
int index = instance.getIndex();
if (index > 0) {
open_instances.remove(instance);
open_instances.add(index - 1, instance);
modified = true;
}
}
if (modified) {
swt_updateTVTorrentButtons();
refreshTVTorrentIndexes();
}
}
});
buttonTorrentDown = new Button(button_area, SWT.PUSH);
buttonTorrentDown.setImage(loadImage("image.toolbar.down"));
buttonTorrentDown.setToolTipText(MessageText.getString("Button.moveDown"));
buttonTorrentDown.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
List<OpenTorrentInstance> selected = (List<OpenTorrentInstance>) (Object) tvTorrents.getSelectedDataSources();
if (selected.size() > 1) {
Collections.sort(selected, new Comparator<OpenTorrentInstance>() {
@Override
public int compare(OpenTorrentInstance o1, OpenTorrentInstance o2) {
return (o2.getIndex() - o1.getIndex());
}
});
}
boolean modified = false;
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
int index = instance.getIndex();
if (index < open_instances.size() - 1) {
open_instances.remove(instance);
open_instances.add(index + 1, instance);
modified = true;
}
}
if (modified) {
swt_updateTVTorrentButtons();
refreshTVTorrentIndexes();
}
}
});
buttonTorrentRemove = new Button(button_area, SWT.PUSH);
buttonTorrentRemove.setToolTipText(MessageText.getString("OpenTorrentWindow.torrent.remove"));
buttonTorrentRemove.setImage(loadImage("image.toolbar.remove"));
buttonTorrentRemove.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
List<Object> selected = tvTorrents.getSelectedDataSources();
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
removeInstance(instance, true);
}
}
});
buttonTorrentUp.setEnabled(false);
buttonTorrentDown.setEnabled(false);
buttonTorrentRemove.setEnabled(false);
label = new Label(button_area, SWT.NULL);
gd = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, gd);
TableColumnManager tcm = TableColumnManager.getInstance();
if (tcm.getDefaultColumnNames(TABLEID_TORRENTS) == null) {
tcm.registerColumn(OpenTorrentInstance.class, TableColumnOTOT_Position.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new TableColumnOTOT_Position(column);
}
});
tcm.registerColumn(OpenTorrentInstance.class, TableColumnOTOT_Name.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new TableColumnOTOT_Name(column);
}
});
tcm.registerColumn(OpenTorrentInstance.class, TableColumnOTOT_Size.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new TableColumnOTOT_Size(column);
}
});
tcm.setDefaultColumnNames(TABLEID_TORRENTS, new String[] { TableColumnOTOT_Position.COLUMN_ID, TableColumnOTOT_Name.COLUMN_ID, TableColumnOTOT_Size.COLUMN_ID });
tcm.setDefaultSortColumnName(TABLEID_TORRENTS, TableColumnOTOT_Position.COLUMN_ID);
}
tvTorrents = TableViewFactory.createTableViewSWT(OpenTorrentInstance.class, TABLEID_TORRENTS, TABLEID_TORRENTS, null, "#", SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
tvTorrents.initialize(table_area);
tvTorrents.setRowDefaultHeightEM(1.4f);
tvTorrents.addMenuFillListener(new TableViewSWTMenuFillListener() {
@Override
public void fillMenu(String sColumnName, Menu menu) {
final List<Object> selected = tvTorrents.getSelectedDataSources();
if (selected.size() > 0) {
final List<OpenTorrentInstance> instances = new ArrayList<>(selected.size());
final List<OpenTorrentInstance> non_simple_instances = new ArrayList<>();
boolean can_rtlf = false;
for (Object o : selected) {
OpenTorrentInstance oti = (OpenTorrentInstance) o;
instances.add(oti);
if (!oti.getOptions().isSimpleTorrent()) {
non_simple_instances.add(oti);
if (oti.canRemoveTopLevelFolder()) {
can_rtlf = true;
}
}
}
{
MenuItem item = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(item, "OpenTorrentWindow.fileList.changeDestination");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
instance.setSavePath();
}
}
});
}
{
MenuItem item = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(item, "OpenTorrentWindow.tlf.remove");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
if (instance.canRemoveTopLevelFolder()) {
instance.removeTopLevelFolder();
}
}
}
});
item.setEnabled(can_rtlf);
}
{
MenuItem item = new MenuItem(menu, SWT.CHECK);
item.setData(COConfigurationManager.getBooleanParameter("open.torrent.window.rename.on.tlf.change"));
Messages.setLanguageText(item, "OpenTorrentWindow.tlf.rename");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
COConfigurationManager.setParameter("open.torrent.window.rename.on.tlf.change", ((MenuItem) e.widget).getSelection());
}
});
item.setEnabled(non_simple_instances.size() > 0);
}
new MenuItem(menu, SWT.SEPARATOR);
MenuItem item = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(item, "Button.remove");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
removeInstance(instance, true);
}
}
});
new MenuItem(menu, SWT.SEPARATOR);
}
}
@Override
public void addThisColumnSubMenu(String sColumnName, Menu menuThisColumn) {
}
});
tvTorrents.addSelectionListener(new TableSelectionListener() {
@Override
public void selected(TableRowCore[] rows_not_used) {
TableRowCore[] rows = tvTorrents.getSelectedRows();
List<OpenTorrentInstance> instances = new ArrayList<>();
for (TableRowCore row : rows) {
instances.add((OpenTorrentInstance) row.getDataSource());
}
selectInstances(instances);
updateButtons();
}
@Override
public void mouseExit(TableRowCore row) {
}
@Override
public void mouseEnter(TableRowCore row) {
}
@Override
public void focusChanged(TableRowCore focus) {
}
@Override
public void deselected(TableRowCore[] rows) {
selected(rows);
}
private void updateButtons() {
Utils.execSWTThread(new Runnable() {
@Override
public void run() {
swt_updateTVTorrentButtons();
}
});
}
@Override
public void defaultSelected(TableRowCore[] rows, int stateMask) {
}
}, false);
}
use of com.biglybt.ui.common.table.TableRowCore in project BiglyBT by BiglySoftware.
the class OpenTorrentOptionsWindow method selectInstances.
private void selectInstances(List<OpenTorrentInstance> _instances) {
if (_instances.equals(selected_instances)) {
return;
}
final List<OpenTorrentInstance> instances = new ArrayList<>(_instances);
Iterator<OpenTorrentInstance> it = instances.iterator();
while (it.hasNext()) {
if (!open_instances.contains(it.next())) {
it.remove();
}
}
if (instances.size() == 0) {
if (selected_instances.size() > 0 && open_instances.contains(selected_instances.get(0))) {
instances.add(selected_instances.get(0));
} else if (open_instances.size() > 0) {
instances.add(open_instances.get(0));
}
}
selected_instances.clear();
selected_instances.addAll(instances);
Utils.execSWTThread(new Runnable() {
@Override
public void run() {
if (multi_selection_instance != null) {
multi_selection_instance.getComposite().dispose();
multi_selection_instance = null;
}
if (instances.size() == 1) {
OpenTorrentInstance first_instance = instances.get(0);
expand_stack.topControl = first_instance.getComposite();
expand_stack_area.layout(true);
first_instance.layout();
} else {
Composite expand_area = new Composite(expand_stack_area, SWT.NULL);
expand_area.setLayout(new FormLayout());
List<TorrentOpenOptions> toos = new ArrayList<>();
for (OpenTorrentInstance oti : instances) {
toos.add(oti.getOptions());
}
multi_selection_instance = new OpenTorrentInstance(expand_area, toos, optionListener);
multi_selection_instance.initialize();
expand_stack.topControl = multi_selection_instance.getComposite();
expand_stack_area.layout(true);
multi_selection_instance.layout();
}
}
});
List<TableRowCore> rows = new ArrayList<>();
for (OpenTorrentInstance instance : instances) {
TableRowCore row = tvTorrents.getRow(instance);
if (row != null) {
rows.add(row);
}
}
tvTorrents.setSelectedRows(rows.toArray(new TableRowCore[rows.size()]));
}
use of com.biglybt.ui.common.table.TableRowCore in project BiglyBT by BiglySoftware.
the class OpenTorrentOptionsWindow method swt_addTorrent.
protected void swt_addTorrent(HashWrapper hash, TorrentOpenOptions torrentOptions) {
final TorrentManagerImpl t_man = TorrentManagerImpl.getSingleton();
try {
if (dlg == null) {
dlg = new SkinnedDialog("skin3_dlg_opentorrent_options", "shell", SWT.RESIZE | SWT.MAX | SWT.DIALOG_TRIM);
final SWTSkin skin_outter = dlg.getSkin();
SWTSkinObject so;
if (COConfigurationManager.hasParameter(ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS, true)) {
so = skin_outter.getSkinObject("showagain-area");
if (so != null) {
so.setVisible(false);
}
}
SWTSkinObject soButtonArea = skin_outter.getSkinObject("button-area");
if (soButtonArea instanceof SWTSkinObjectContainer) {
buttonsArea = new StandardButtonsArea() {
@Override
protected void clicked(int intValue) {
if (intValue == SWT.OK) {
okPressed();
} else {
cancelPressed();
}
}
};
buttonsArea.setButtonIDs(new String[] { MessageText.getString("Button.ok"), MessageText.getString("Button.cancel") });
buttonsArea.setButtonVals(new Integer[] { SWT.OK, SWT.CANCEL });
buttonsArea.swt_createButtons(((SWTSkinObjectContainer) soButtonArea).getComposite());
}
sash_object = (SWTSkinObjectSash) skin_outter.getSkinObject("multi-sash");
SWTSkinObjectContainer select_area = (SWTSkinObjectContainer) skin_outter.getSkinObject("torrents-table");
setupTVTorrents(select_area.getComposite());
SWTSkinObjectContainer torrents_info = (SWTSkinObjectContainer) skin_outter.getSkinObject("torrents-info");
Composite info_area = torrents_info.getComposite();
info_area.setLayout(new GridLayout());
torrents_info_label = new Label(info_area, SWT.NULL);
Utils.setLayoutData(torrents_info_label, new GridData(GridData.FILL_HORIZONTAL));
sash_object.setVisible(false);
sash_object.setAboveVisible(false);
so = skin_outter.getSkinObject("expand-area");
expand_stack_area = ((SWTSkinObjectContainer) so).getComposite();
expand_stack = new StackLayout();
expand_stack_area.setLayout(expand_stack);
Composite expand_area = new Composite(expand_stack_area, SWT.NULL);
expand_area.setLayout(new FormLayout());
expand_stack.topControl = expand_area;
OpenTorrentInstance instance = new OpenTorrentInstance(hash, expand_area, torrentOptions, optionListener);
addInstance(instance);
selected_instances.add(instance);
UIUpdaterSWT.getInstance().addUpdater(this);
setupShowAgainOptions(skin_outter);
/*
* The bring-to-front logic for torrent addition is controlled by other parts of the code so we don't
* want the dlg to override this behaviour (main example here is torrents passed from, say, a browser,
* and the user has disabled the 'show vuze on external torrent add' feature)
*/
dlg.open("otow", false);
synchronized (active_windows) {
int num_active_windows = active_windows.size();
Shell shell = dlg.getShell();
if (num_active_windows > 1) {
int max_x = 0;
int max_y = 0;
for (OpenTorrentOptionsWindow window : active_windows.values()) {
if (window == this || !window.isInitialised()) {
continue;
}
Rectangle rect = window.getBounds();
max_x = Math.max(max_x, rect.x);
max_y = Math.max(max_y, rect.y);
}
Rectangle rect = shell.getBounds();
rect.x = max_x + 16;
rect.y = max_y + 16;
shell.setBounds(rect);
}
// String before = "disp="+shell.getDisplay().getBounds()+",shell=" + shell.getBounds();
Utils.verifyShellRect(shell, true);
// Debug.outNoStack( "Opening torrent options dialog: " + before + " -> " + shell.getBounds());
}
dlg.addCloseListener(new SkinnedDialog.SkinnedDialogClosedListener() {
@Override
public void skinDialogClosed(SkinnedDialog dialog) {
try {
dispose();
} finally {
synchronized (active_windows) {
Iterator<OpenTorrentOptionsWindow> it = active_windows.values().iterator();
while (it.hasNext()) {
OpenTorrentOptionsWindow window = it.next();
if (window == OpenTorrentOptionsWindow.this) {
it.remove();
}
}
TorrentManagerImpl t_man = TorrentManagerImpl.getSingleton();
for (OpenTorrentInstance inst : open_instances) {
inst.cancelPressed();
t_man.optionsRemoved(inst.getOptions());
}
}
}
}
});
window_initialised = true;
} else {
Composite expand_area = new Composite(expand_stack_area, SWT.NULL);
expand_area.setLayout(new FormLayout());
OpenTorrentInstance instance = new OpenTorrentInstance(hash, expand_area, torrentOptions, optionListener);
addInstance(instance);
if (!sash_object.isVisible()) {
sash_object.setVisible(true);
sash_object.setAboveVisible(true);
Utils.execSWTThreadLater(0, new Runnable() {
@Override
public void run() {
tvTorrents.processDataSourceQueueSync();
List<TableRowCore> rows = new ArrayList<>();
for (OpenTorrentInstance instance : selected_instances) {
TableRowCore row = tvTorrents.getRow(instance);
if (row != null) {
rows.add(row);
}
}
if (rows.size() > 0) {
tvTorrents.setSelectedRows(rows.toArray(new TableRowCore[rows.size()]));
}
}
});
}
}
} catch (Throwable e) {
Debug.out(e);
synchronized (active_windows) {
active_windows.remove(hash);
torrentOptions.cancel();
t_man.optionsRemoved(torrentOptions);
}
}
}
use of com.biglybt.ui.common.table.TableRowCore in project BiglyBT by BiglySoftware.
the class TorrentMenuFancy method buildTorrentCustomMenu_Content.
protected void buildTorrentCustomMenu_Content(final Composite detailArea, final DownloadManager[] dms) {
// Run Data File
if (hasSelection) {
createRow(detailArea, "MyTorrentsView.menu.open", "run", new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
TorrentUtil.runDataSources(dms);
}
});
}
// Explore (or open containing folder)
if (hasSelection) {
final boolean use_open_containing_folder = COConfigurationManager.getBooleanParameter("MyTorrentsView.menu.show_parent_folder_enabled");
createRow(detailArea, "MyTorrentsView.menu." + (use_open_containing_folder ? "open_parent_folder" : "explore"), null, new ListenerDMTask(dms, false) {
@Override
public void run(DownloadManager dm) {
ManagerUtils.open(dm, use_open_containing_folder);
}
});
}
if (hasSelection) {
createMenuRow(detailArea, "MyTorrentsView.menu.browse", null, new FancyMenuRowInfoListener() {
@Override
public void buildMenu(Menu menuBrowse) {
final MenuItem itemBrowsePublic = new MenuItem(menuBrowse, SWT.PUSH);
itemBrowsePublic.setText(MessageText.getString("label.public") + "...");
itemBrowsePublic.addListener(SWT.Selection, new ListenerDMTask(dms, false) {
@Override
public void run(DownloadManager dm) {
ManagerUtils.browse(dm, false, true);
}
});
final MenuItem itemBrowseAnon = new MenuItem(menuBrowse, SWT.PUSH);
itemBrowseAnon.setText(MessageText.getString("label.anon") + "...");
itemBrowseAnon.addListener(SWT.Selection, new ListenerDMTask(dms, false) {
@Override
public void run(DownloadManager dm) {
ManagerUtils.browse(dm, true, true);
}
});
new MenuItem(menuBrowse, SWT.SEPARATOR);
final MenuItem itemBrowseURL = new MenuItem(menuBrowse, SWT.PUSH);
Messages.setLanguageText(itemBrowseURL, "label.copy.url.to.clip");
itemBrowseURL.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
Utils.getOffOfSWTThread(new AERunnable() {
@Override
public void runSupport() {
String url = ManagerUtils.browse(dms[0], true, false);
if (url != null) {
ClipboardCopy.copyToClipBoard(url);
}
}
});
}
});
itemBrowseURL.setEnabled(dms.length == 1);
new MenuItem(menuBrowse, SWT.SEPARATOR);
final MenuItem itemBrowseDir = new MenuItem(menuBrowse, SWT.CHECK);
Messages.setLanguageText(itemBrowseDir, "library.launch.web.in.browser.dir.list");
itemBrowseDir.setSelection(COConfigurationManager.getBooleanParameter("Library.LaunchWebsiteInBrowserDirList"));
itemBrowseDir.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
COConfigurationManager.setParameter("Library.LaunchWebsiteInBrowserDirList", itemBrowseDir.getSelection());
}
});
}
});
}
// set thumbnail
createRow(detailArea, "MyTorrentsView.menu.torrent.set.thumb", null, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
FileDialog fDialog = new FileDialog(parentShell, SWT.OPEN | SWT.MULTI);
fDialog.setText(MessageText.getString("MainWindow.dialog.choose.thumb"));
String path = fDialog.open();
if (path == null)
return;
File file = new File(path);
try {
byte[] thumbnail = FileUtil.readFileAsByteArray(file);
String name = file.getName();
int pos = name.lastIndexOf(".");
String ext;
if (pos != -1) {
ext = name.substring(pos + 1);
} else {
ext = "";
}
String type = HTTPUtils.guessContentTypeFromFileType(ext);
for (DownloadManager dm : dms) {
try {
TOTorrent torrent = dm.getTorrent();
PlatformTorrentUtils.setContentThumbnail(torrent, thumbnail, type);
} catch (Throwable e) {
}
}
} catch (Throwable e) {
Debug.out(e);
}
}
});
boolean fileMove = true;
boolean locateFiles = false;
boolean exportFiles = true;
boolean canSetMOC = dms.length > 0;
boolean canClearMOC = false;
for (int i = 0; i < dms.length; i++) {
DownloadManager dm = dms[i];
if (!dm.canMoveDataFiles()) {
fileMove = false;
}
if (!dm.canExportDownload()) {
exportFiles = false;
}
if (!dm.isDownloadComplete(false)) {
locateFiles = true;
}
boolean incomplete = !dm.isDownloadComplete(true);
DownloadManagerState dm_state = dm.getDownloadState();
String moc_dir = dm_state.getAttribute(DownloadManagerState.AT_MOVE_ON_COMPLETE_DIR);
canSetMOC &= incomplete;
canClearMOC |= (moc_dir != null && moc_dir.length() > 0);
}
if (fileMove) {
createRow(detailArea, "MyTorrentsView.menu.movedata", null, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
TorrentUtil.moveDataFiles(parentShell, dms);
}
});
}
if (canSetMOC || canClearMOC) {
boolean f_canSetMOC = canSetMOC;
boolean f_canClearMOC = canClearMOC;
createMenuRow(detailArea, "label.move.on.comp", null, new FancyMenuRowInfoListener() {
@Override
public void buildMenu(Menu moc_menu) {
MenuItem clear_item = new MenuItem(moc_menu, SWT.PUSH);
Messages.setLanguageText(clear_item, "Button.clear");
clear_item.addListener(SWT.Selection, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
TorrentUtil.clearMOC(dms);
}
});
clear_item.setEnabled(f_canClearMOC);
MenuItem set_item = new MenuItem(moc_menu, SWT.PUSH);
Messages.setLanguageText(set_item, "label.set");
set_item.addListener(SWT.Selection, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
TorrentUtil.setMOC(parentShell, dms);
}
});
set_item.setEnabled(f_canSetMOC);
}
});
}
if (exportFiles) {
createRow(detailArea, "MyTorrentsView.menu.exportdownload", null, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
TorrentUtil.exportDownloads(parentShell, dms);
}
});
}
createRow(detailArea, "MyTorrentsView.menu.checkfilesexist", null, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager dm) {
dm.filesExist(true);
}
});
if (locateFiles) {
createRow(detailArea, "MyTorrentsView.menu.locatefiles", null, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
ManagerUtils.locateFiles(dms, parentShell);
}
});
}
if (dms.length == 1 && ManagerUtils.canFindMoreLikeThis()) {
createRow(detailArea, "MyTorrentsView.menu.findmorelikethis", null, new ListenerDMTask(dms) {
@Override
public void run(DownloadManager[] dms) {
ManagerUtils.findMoreLikeThis(dms[0], parentShell);
}
});
}
createRow(detailArea, "MyTorrentsView.menu.thisColumn.toClipboard", null, new Listener() {
@Override
public void handleEvent(Event event) {
String sToClipboard = "";
if (column == null) {
return;
}
String columnName = column.getName();
if (columnName == null) {
return;
}
TableRowCore[] rows = tv.getSelectedRows();
for (TableRowCore row : rows) {
if (row != rows[0]) {
sToClipboard += "\n";
}
TableCellCore cell = row.getTableCellCore(columnName);
if (cell != null) {
sToClipboard += cell.getClipboardText();
}
}
if (sToClipboard.length() == 0) {
return;
}
new Clipboard(Display.getDefault()).setContents(new Object[] { sToClipboard }, new Transfer[] { TextTransfer.getInstance() });
}
});
}
use of com.biglybt.ui.common.table.TableRowCore in project BiglyBT by BiglySoftware.
the class FilesViewMenuUtil method invalidateRows.
private static void invalidateRows(TableView tv, List<DiskManagerFileInfo> files) {
if (tv == null) {
return;
}
Set<TableRowCore> done = new HashSet<>();
for (DiskManagerFileInfo file : files) {
TableRowCore row = tv.getRow(file);
if (row == null) {
row = tv.getRow(file.getDownloadManager());
if (row != null) {
TableRowCore[] subrows = row.getSubRowsWithNull();
if (subrows != null) {
for (TableRowCore sr : subrows) {
if (sr.getDataSource(true) == file) {
row = sr;
break;
}
}
}
}
}
if (row != null && !done.contains(row)) {
done.add(row);
row.invalidate(true);
row.refresh(true);
}
}
}
Aggregations