use of com.biglybt.ui.swt.mdi.TabbedEntry in project BiglyBT by BiglySoftware.
the class TorrentInfoView method initialize.
private void initialize(Composite composite) {
this.parent = composite;
// cheap trick to allow datasource changes. Normally we'd just
// refill the components with new info, but I didn't write this and
// I don't want to waste my time :) [tux]
Utils.disposeComposite(parent, false);
if (download_manager == null) {
ViewUtils.setViewRequiresOneDownload(composite);
return;
}
Composite panel = Utils.createScrolledComposite(composite);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 1;
panel.setLayout(layout);
// int userMode = COConfigurationManager.getIntParameter("User Mode");
// header
boolean showHeader = true;
if (swtView instanceof TabbedEntry) {
showHeader = ((TabbedEntry) swtView).getMDI().getAllowSubViews();
}
if (showHeader) {
Composite cHeader = new Composite(panel, SWT.BORDER);
GridLayout configLayout = new GridLayout();
configLayout.marginHeight = 3;
configLayout.marginWidth = 0;
cHeader.setLayout(configLayout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
cHeader.setLayoutData(gridData);
Display d = panel.getDisplay();
cHeader.setBackground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION));
cHeader.setForeground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION_TEXT));
Label lHeader = new Label(cHeader, SWT.NULL);
lHeader.setBackground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION));
lHeader.setForeground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION_TEXT));
FontData[] fontData = lHeader.getFont().getFontData();
fontData[0].setStyle(SWT.BOLD);
int fontHeight = (int) (fontData[0].getHeight() * 1.2);
fontData[0].setHeight(fontHeight);
headerFont = new Font(d, fontData);
lHeader.setFont(headerFont);
lHeader.setText(" " + MessageText.getString("authenticator.torrent") + " : " + download_manager.getDisplayName().replaceAll("&", "&&"));
gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
lHeader.setLayoutData(gridData);
}
Composite gTorrentInfo = new Composite(panel, SWT.NULL);
GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
gTorrentInfo.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
gTorrentInfo.setLayout(layout);
// torrent encoding
Label label = new Label(gTorrentInfo, SWT.NULL);
gridData = new GridData();
label.setLayoutData(gridData);
label.setText(MessageText.getString("TorrentInfoView.torrent.encoding") + ": ");
TOTorrent torrent = download_manager.getTorrent();
BufferedLabel blabel = new BufferedLabel(gTorrentInfo, SWT.NULL);
gridData = new GridData();
blabel.setLayoutData(gridData);
if (torrent == null) {
blabel.setText("");
} else {
int tt = torrent.getTorrentType();
String tt_str = MessageText.getString("label.torrent.type") + ": " + MessageText.getString("label.torrent.type." + tt);
int ett = torrent.getEffectiveTorrentType();
if (ett != tt) {
tt_str += ", " + MessageText.getString("label.effective") + ": " + MessageText.getString("label.torrent.type." + ett);
}
blabel.setText(LocaleTorrentUtil.getCurrentTorrentEncoding(torrent) + "; " + tt_str);
}
// trackers
label = new Label(gTorrentInfo, SWT.NULL);
gridData = new GridData();
label.setLayoutData(gridData);
label.setText(MessageText.getString("label.tracker") + ": ");
String trackers = "";
if (torrent != null) {
TOTorrentAnnounceURLGroup group = torrent.getAnnounceURLGroup();
TOTorrentAnnounceURLSet[] sets = group.getAnnounceURLSets();
List<String> tracker_list = new ArrayList<>();
URL url = torrent.getAnnounceURL();
tracker_list.add(url.getHost() + (url.getPort() == -1 ? "" : (":" + url.getPort())));
for (int i = 0; i < sets.length; i++) {
TOTorrentAnnounceURLSet set = sets[i];
URL[] urls = set.getAnnounceURLs();
for (int j = 0; j < urls.length; j++) {
url = urls[j];
String str = url.getHost() + (url.getPort() == -1 ? "" : (":" + url.getPort()));
if (!tracker_list.contains(str)) {
tracker_list.add(str);
}
}
}
TRTrackerAnnouncer announcer = download_manager.getTrackerClient();
URL active_url = null;
if (announcer != null) {
active_url = announcer.getTrackerURL();
} else {
TRTrackerScraperResponse scrape = download_manager.getTrackerScrapeResponse();
if (scrape != null) {
active_url = scrape.getURL();
}
}
if (active_url == null) {
active_url = torrent.getAnnounceURL();
}
trackers = active_url.getHost() + (active_url.getPort() == -1 ? "" : (":" + active_url.getPort()));
tracker_list.remove(trackers);
if (tracker_list.size() > 0) {
trackers += " (";
for (int i = 0; i < tracker_list.size(); i++) {
trackers += (i == 0 ? "" : ", ") + tracker_list.get(i);
}
trackers += ")";
}
}
blabel = new BufferedLabel(gTorrentInfo, SWT.WRAP);
blabel.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
blabel.setText(trackers);
// columns
Group gColumns = new Group(panel, SWT.NULL);
Messages.setLanguageText(gColumns, "TorrentInfoView.columns");
gridData = new GridData(GridData.FILL_BOTH);
gColumns.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 4;
gColumns.setLayout(layout);
Map<String, FakeTableCell> usable_cols = new HashMap<>();
TableColumnManager col_man = TableColumnManager.getInstance();
TableColumnCore[][] cols_sets = { col_man.getAllTableColumnCoreAsArray(DownloadTypeIncomplete.class, TableManager.TABLE_MYTORRENTS_INCOMPLETE), col_man.getAllTableColumnCoreAsArray(DownloadTypeComplete.class, TableManager.TABLE_MYTORRENTS_COMPLETE) };
for (int i = 0; i < cols_sets.length; i++) {
TableColumnCore[] cols = cols_sets[i];
for (int j = 0; j < cols.length; j++) {
TableColumnCore col = cols[j];
String id = col.getName();
if (usable_cols.containsKey(id)) {
continue;
}
FakeTableCell fakeTableCell = null;
try {
fakeTableCell = new FakeTableCell(col, download_manager);
fakeTableCell.setOrentation(SWT.LEFT);
fakeTableCell.setWrapText(false);
col.invokeCellAddedListeners(fakeTableCell);
// One refresh to see if it throws up
fakeTableCell.refresh();
usable_cols.put(id, fakeTableCell);
} catch (Throwable t) {
// System.out.println("not usable col: " + id + " - " + Debug.getCompressedStackTrace());
try {
if (fakeTableCell != null) {
fakeTableCell.dispose();
}
} catch (Throwable t2) {
// ignore;
}
}
}
}
Collection<FakeTableCell> values = usable_cols.values();
cells = new FakeTableCell[values.size()];
values.toArray(cells);
Arrays.sort(cells, new Comparator<FakeTableCell>() {
@Override
public int compare(FakeTableCell o1, FakeTableCell o2) {
TableColumnCore c1 = (TableColumnCore) o1.getTableColumn();
TableColumnCore c2 = (TableColumnCore) o2.getTableColumn();
String key1 = MessageText.getString(c1.getTitleLanguageKey());
String key2 = MessageText.getString(c2.getTitleLanguageKey());
return key1.compareToIgnoreCase(key2);
}
});
for (int i = 0; i < cells.length; i++) {
final FakeTableCell cell = cells[i];
CLabel cLabel = new CLabel(gColumns, SWT.NULL);
gridData = new GridData();
if (i % 2 == 1) {
gridData.horizontalIndent = 16;
}
cLabel.setLayoutData(gridData);
TableColumnCore tc = (TableColumnCore) cell.getTableColumn();
String key = tc.getTitleLanguageKey();
cLabel.setText(MessageText.getString(key) + ": ");
Utils.setTT(cLabel, MessageText.getString(key + ".info", ""));
String iconReference = tc.getIconReference();
if (iconReference != null) {
Utils.setMenuItemImage(cLabel, iconReference);
}
cLabel.setData("ColumnName", tc.getName());
DragSource dragSource = DragDropUtils.createDragSource(cLabel, DND.DROP_MOVE | DND.DROP_COPY);
dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
dragSource.addDragListener(this);
final Composite c = new Composite(gColumns, SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.heightHint = 16;
c.setLayoutData(gridData);
cell.setControl(c);
cell.invalidate();
cell.refresh();
c.addListener(SWT.MouseHover, new Listener() {
@Override
public void handleEvent(Event event) {
Object toolTip = cell.getToolTip();
if (toolTip instanceof String) {
String s = (String) toolTip;
Utils.setTT(c, s);
}
}
});
}
refresh();
composite.layout();
}
use of com.biglybt.ui.swt.mdi.TabbedEntry in project BiglyBT by BiglySoftware.
the class DownloadActivityView method create.
private void create() {
swtView.setTitle(getFullTitle());
swtView.setToolBarListener(this);
COConfigurationManager.addParameterListener("DownloadActivity.show.eta", this);
show_time = COConfigurationManager.getBooleanParameter("DownloadActivity.show.eta");
if (swtView instanceof TabbedEntry) {
TabbedEntry tabView = (TabbedEntry) swtView;
tabView.addListener(this);
legend_at_bottom = tabView.getMDI().getAllowSubViews();
}
}
use of com.biglybt.ui.swt.mdi.TabbedEntry in project BiglyBT by BiglySoftware.
the class DownloadActivityView method delete.
private void delete() {
Utils.disposeComposite(panel);
COConfigurationManager.removeParameterListener("DownloadActivity.show.eta", this);
if (mpg != null) {
mpg.dispose();
mpg = null;
}
if (eta != null) {
eta.dispose();
eta = null;
}
if (swtView instanceof TabbedEntry) {
TabbedEntry tabView = (TabbedEntry) swtView;
tabView.removeListener(this);
}
}
use of com.biglybt.ui.swt.mdi.TabbedEntry in project BiglyBT by BiglySoftware.
the class TorrentOptionsView method initialize.
private void initialize(Composite composite) {
this.parent = composite;
GridLayout layout;
// I don't want to waste my time :) [tux]
if (sc != null && !sc.isDisposed()) {
sc.dispose();
}
sc = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
sc.getVerticalBar().setIncrement(16);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1);
sc.setLayoutData(gridData);
Composite panel = new Composite(sc, SWT.NULL);
sc.setContent(panel);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 1;
panel.setLayout(layout);
Layout parentLayout = parent.getLayout();
if (parentLayout instanceof FormLayout) {
panel.setLayoutData(Utils.getFilledFormData());
} else {
panel.setLayoutData(new GridData(GridData.FILL_BOTH));
}
if (managers == null) {
return;
}
int userMode = COConfigurationManager.getIntParameter("User Mode");
// header
boolean showHeader = true;
if (swtView instanceof TabbedEntry) {
showHeader = ((TabbedEntry) swtView).getMDI().getAllowSubViews();
}
if (showHeader) {
Composite cHeader = new Composite(panel, SWT.BORDER);
GridLayout configLayout = new GridLayout();
configLayout.marginHeight = 3;
configLayout.marginWidth = 0;
cHeader.setLayout(configLayout);
gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
cHeader.setLayoutData(gridData);
Display d = panel.getDisplay();
cHeader.setBackground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION));
cHeader.setForeground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION_TEXT));
Label lHeader = new Label(cHeader, SWT.NULL);
lHeader.setBackground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION));
lHeader.setForeground(Colors.getSystemColor(d, SWT.COLOR_LIST_SELECTION_TEXT));
FontData[] fontData = lHeader.getFont().getFontData();
fontData[0].setStyle(SWT.BOLD);
int fontHeight = (int) (fontData[0].getHeight() * 1.2);
fontData[0].setHeight(fontHeight);
headerFont = new Font(d, fontData);
lHeader.setFont(headerFont);
if (managers.length == 1) {
if (managers[0].getDownloadManager() == null) {
lHeader.setText(" " + managers[0].getName().replaceAll("&", "&&"));
} else {
lHeader.setText(" " + MessageText.getString("authenticator.torrent") + " : " + managers[0].getName().replaceAll("&", "&&"));
}
} else {
String str = "";
for (int i = 0; i < Math.min(3, managers.length); i++) {
str += (i == 0 ? "" : ", ") + managers[i].getName().replaceAll("&", "&&");
}
if (managers.length > 3) {
str += "...";
}
lHeader.setText(" " + managers.length + " " + MessageText.getString("ConfigView.section.torrents") + " : " + str);
}
gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
lHeader.setLayoutData(gridData);
}
Group gTorrentOptions = new Group(panel, SWT.NULL);
Messages.setLanguageText(gTorrentOptions, "ConfigView.section.transfer");
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
gTorrentOptions.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
gTorrentOptions.setLayout(layout);
// Disabled for release. Need to convert from user-specified units to
// KB/s before restoring the following line
// String k_unit = DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB).trim()
String k_unit = DisplayFormatters.getRateUnitBase10(DisplayFormatters.UNIT_KB).trim();
// max upload speed
Label label;
IntSwtParameter max_upload = new IntSwtParameter(gTorrentOptions, MAX_UPLOAD, "", null, adhoc_param_adapter);
max_upload.setLabelText(k_unit + " " + MessageText.getString("GeneralView.label.maxuploadspeed.tooltip"));
adhoc_parameters.put(MAX_UPLOAD, max_upload);
if (userMode > 0) {
// max upload when busy
IntSwtParameter max_upload_when_busy = new IntSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_MAX_UPLOAD_WHEN_BUSY, "TorrentOptionsView.param.max.uploads.when.busy", null, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_UPLOAD_WHEN_BUSY, max_upload_when_busy);
}
// max download speed
IntSwtParameter max_download = new IntSwtParameter(gTorrentOptions, MAX_DOWNLOAD, "", null, adhoc_param_adapter);
max_download.setLabelText(k_unit + " " + MessageText.getString("GeneralView.label.maxdownloadspeed.tooltip"));
adhoc_parameters.put(MAX_DOWNLOAD, max_download);
if (userMode > 0) {
IntSwtParameter max_uploads = new IntSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_MAX_UPLOADS, "TorrentOptionsView.param.max.uploads", null, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_UPLOADS, max_uploads);
max_uploads.setMinimumValue(2);
// max uploads when seeding enabled
final Composite cMaxUploadsOptionsArea = new Composite(gTorrentOptions, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
cMaxUploadsOptionsArea.setLayout(layout);
gridData = new GridData();
gridData.horizontalSpan = 2;
cMaxUploadsOptionsArea.setLayoutData(gridData);
BooleanSwtParameter max_uploads_when_seeding_enabled = new BooleanSwtParameter(cMaxUploadsOptionsArea, DownloadManagerState.PARAM_MAX_UPLOADS_WHEN_SEEDING_ENABLED, "TorrentOptionsView.param.alternative.value.enable", null, ds_boolparam_adapter);
max_uploads_when_seeding_enabled.setIndent(1, true);
ds_parameters.put(DownloadManagerState.PARAM_MAX_UPLOADS_WHEN_SEEDING_ENABLED, max_uploads_when_seeding_enabled);
IntSwtParameter max_uploads_when_seeding = new IntSwtParameter(cMaxUploadsOptionsArea, DownloadManagerState.PARAM_MAX_UPLOADS_WHEN_SEEDING, null, null, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_UPLOADS_WHEN_SEEDING, max_uploads_when_seeding);
max_uploads_when_seeding.setMinimumValue(2);
max_uploads_when_seeding_enabled.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(max_uploads_when_seeding));
// max peers
IntSwtParameter max_peers = new IntSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_MAX_PEERS, "TorrentOptionsView.param.max.peers", null, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_PEERS, max_peers);
// max peers when seeding
final Composite cMaxPeersOptionsArea = new Composite(gTorrentOptions, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
cMaxPeersOptionsArea.setLayout(layout);
gridData = new GridData();
gridData.horizontalSpan = 2;
cMaxPeersOptionsArea.setLayoutData(gridData);
BooleanSwtParameter max_peers_when_seeding_enabled = new BooleanSwtParameter(cMaxPeersOptionsArea, DownloadManagerState.PARAM_MAX_PEERS_WHEN_SEEDING_ENABLED, "TorrentOptionsView.param.alternative.value.enable", null, ds_boolparam_adapter);
max_peers_when_seeding_enabled.setIndent(1, true);
ds_parameters.put(DownloadManagerState.PARAM_MAX_PEERS_WHEN_SEEDING_ENABLED, max_peers_when_seeding_enabled);
IntSwtParameter max_peers_when_seeding = new IntSwtParameter(cMaxPeersOptionsArea, DownloadManagerState.PARAM_MAX_PEERS_WHEN_SEEDING, null, null, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_PEERS_WHEN_SEEDING, max_peers_when_seeding);
max_peers_when_seeding_enabled.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(max_peers_when_seeding));
// max seeds
IntSwtParameter max_seeds = new IntSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_MAX_SEEDS, "TorrentOptionsView.param.max.seeds", null, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_SEEDS, max_seeds);
}
if (userMode > 0) {
IntSwtParameter upload_priority_enabled = new IntSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_UPLOAD_PRIORITY, "TorrentOptionsView.param.upload.priority", null, 0, 1, ds_intparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_UPLOAD_PRIORITY, upload_priority_enabled);
// min sr
FloatSwtParameter min_sr = new FloatSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_MIN_SHARE_RATIO, "TableColumn.header.min_sr", null, 0, Float.MAX_VALUE, true, 3, ds_floatparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MIN_SHARE_RATIO, min_sr);
// max sr
FloatSwtParameter max_sr = new FloatSwtParameter(gTorrentOptions, DownloadManagerState.PARAM_MAX_SHARE_RATIO, "TableColumn.header.max_sr", null, 0, Float.MAX_VALUE, true, 3, ds_floatparam_adapter);
ds_parameters.put(DownloadManagerState.PARAM_MAX_SHARE_RATIO, max_sr);
}
// reset
Label reset_label = new Label(gTorrentOptions, SWT.NULL);
Messages.setLanguageText(reset_label, "TorrentOptionsView.param.reset.to.default");
Button reset_button = new Button(gTorrentOptions, SWT.PUSH);
Messages.setLanguageText(reset_button, "TorrentOptionsView.param.reset.button");
reset_button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
setDefaults();
}
});
for (int i = 0; i < managers.length; i++) {
managers[i].addListener(this);
}
Group gTorrentInfo = new Group(panel, SWT.NULL);
Messages.setLanguageText(gTorrentInfo, "label.aggregate.info");
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
gTorrentInfo.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
gTorrentInfo.setLayout(layout);
// total size
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("TableColumn.header.size") + ": ");
agg_size = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_size.setLayoutData(gridData);
// remaining
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("TableColumn.header.remaining") + ": ");
agg_remaining = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_remaining.setLayoutData(gridData);
// uploaded
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("MyTracker.column.uploaded") + ": ");
agg_uploaded = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_uploaded.setLayoutData(gridData);
// downloaded
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("MyTracker.column.downloaded") + ": ");
agg_downloaded = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_downloaded.setLayoutData(gridData);
// upload speed
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("SpeedView.uploadSpeed.title") + ": ");
agg_upload_speed = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_upload_speed.setLayoutData(gridData);
// download speed
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("SpeedView.downloadSpeed.title") + ": ");
agg_download_speed = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_download_speed.setLayoutData(gridData);
// share ratio
label = new Label(gTorrentInfo, SWT.NULL);
label.setText(MessageText.getString("TableColumn.header.shareRatio") + ": ");
agg_share_ratio = new BufferedLabel(gTorrentInfo, SWT.LEFT | SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
agg_share_ratio.setLayoutData(gridData);
// reset
Label stats_reset_label = new Label(gTorrentInfo, SWT.NULL);
Messages.setLanguageText(stats_reset_label, "TorrentOptionsView.param.reset.stats");
Button stats_reset_button = new Button(gTorrentInfo, SWT.PUSH);
Messages.setLanguageText(stats_reset_button, "TorrentOptionsView.param.reset.button");
stats_reset_button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
for (DownloadManagerOptionsHandler dm : managers) {
if (dm.getDownloadManager() != null) {
dm.getDownloadManager().getStats().resetTotalBytesSentReceived(0, 0);
}
}
}
});
sc.setMinSize(panel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
composite.layout();
}
Aggregations