use of com.biglybt.ui.swt.views.FilesView in project BiglyBT by BiglySoftware.
the class ColumnFileCount method openFilesMiniView.
private void openFilesMiniView(DownloadManager dm, TableCell cell) {
Shell shell = ShellFactory.createShell(Utils.findAnyShell(), SWT.SHELL_TRIM);
FillLayout fillLayout = new FillLayout();
fillLayout.marginHeight = 2;
fillLayout.marginWidth = 2;
shell.setLayout(fillLayout);
Rectangle bounds = ((TableCellSWT) cell).getBoundsOnDisplay();
bounds.y += bounds.height;
bounds.width = 630;
bounds.height = (16 * dm.getNumFileInfos()) + 60;
Rectangle realBounds = shell.computeTrim(0, 0, bounds.width, bounds.height);
realBounds.width -= realBounds.x;
realBounds.height -= realBounds.y;
realBounds.x = bounds.x;
realBounds.y = bounds.y;
if (bounds.height > 500) {
bounds.height = 500;
}
shell.setBounds(realBounds);
shell.setAlpha(230);
Utils.verifyShellRect(shell, true);
final FilesView view = new FilesView(false);
view.dataSourceChanged(dm);
view.initialize(shell);
Composite composite = view.getComposite();
// composite.setLayoutData(null);
// shell.setLayout(new FillLayout());
view.viewActivated();
view.refresh();
final UIUpdatable viewUpdater = new UIUpdatable() {
@Override
public void updateUI() {
view.refresh();
}
@Override
public String getUpdateUIName() {
return view.getFullTitle();
}
};
UIUpdaterSWT.getInstance().addUpdater(viewUpdater);
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
UIUpdaterSWT.getInstance().removeUpdater(viewUpdater);
view.delete();
}
});
shell.layout(true, true);
shell.setText(dm.getDisplayName());
shell.open();
}
use of com.biglybt.ui.swt.views.FilesView in project BiglyBT by BiglySoftware.
the class TagUIUtils method showFilesView.
private static void showFilesView(final TagDownload tag) {
Shell shell = ShellFactory.createShell(Utils.findAnyShell(), SWT.SHELL_TRIM);
FillLayout fillLayout = new FillLayout();
fillLayout.marginHeight = 2;
fillLayout.marginWidth = 2;
shell.setLayout(fillLayout);
final FilesView view = new FilesView(false);
view.setDisableWhenEmpty(false);
Set<DownloadManager> dms = tag.getTaggedDownloads();
view.dataSourceChanged(dms.toArray());
view.initialize(shell);
view.viewActivated();
view.refresh();
final UIUpdatable viewUpdater = new UIUpdatable() {
@Override
public void updateUI() {
view.refresh();
}
@Override
public String getUpdateUIName() {
return view.getFullTitle();
}
};
UIUpdaterSWT.getInstance().addUpdater(viewUpdater);
final TagListener tag_listener = new TagListener() {
@Override
public void taggableSync(Tag tag) {
}
@Override
public void taggableRemoved(Tag t, Taggable tagged) {
Set<DownloadManager> dms = tag.getTaggedDownloads();
view.dataSourceChanged(dms.toArray());
}
@Override
public void taggableAdded(Tag t, Taggable tagged) {
Set<DownloadManager> dms = tag.getTaggedDownloads();
view.dataSourceChanged(dms.toArray());
}
};
tag.addTagListener(tag_listener, false);
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
tag.removeTagListener(tag_listener);
UIUpdaterSWT.getInstance().removeUpdater(viewUpdater);
view.delete();
}
});
shell.layout(true, true);
shell.setText(tag.getTagName(true));
shell.open();
}
Aggregations