use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class SBC_ChatOverview method initTable.
private void initTable(Composite control) {
if (tv == null) {
tv = TableViewFactory.createTableViewSWT(ChatInstance.class, TABLE_CHAT, TABLE_CHAT, new TableColumnCore[0], ColumnChatName.COLUMN_ID, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
if (txtFilter != null) {
tv.enableFilterCheck(txtFilter, this);
}
tv.setRowDefaultHeightEM(1);
table_parent = new Composite(control, SWT.BORDER);
table_parent.setLayoutData(Utils.getFilledFormData());
GridLayout layout = new GridLayout();
layout.marginHeight = layout.marginWidth = layout.verticalSpacing = layout.horizontalSpacing = 0;
table_parent.setLayout(layout);
tv.addMenuFillListener(this);
tv.addSelectionListener(this, false);
tv.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.stateMask == 0 && e.keyCode == SWT.DEL) {
Object[] datasources = tv.getSelectedDataSources().toArray();
if (datasources.length > 0) {
List<ChatInstance> chats = new ArrayList<>();
String str = "";
for (Object object : datasources) {
if (object instanceof ChatInstance) {
ChatInstance chat = (ChatInstance) object;
chats.add(chat);
if (chats.size() == 1) {
str = chat.getDisplayName();
if (str == null) {
str = chat.getName();
}
} else if (chats.size() == 2) {
str += ", ...";
}
}
}
MessageBoxShell mb = new MessageBoxShell(MessageText.getString("message.confirm.delete.title"), MessageText.getString("message.confirm.delete.text", new String[] { str }), new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, 1);
mb.open(new UserPrompterResultListener() {
@Override
public void prompterClosed(int result) {
if (result == 0) {
for (ChatInstance chat : chats) {
chat.remove();
}
}
}
});
}
e.doit = false;
}
}
});
tv.initialize(table_parent);
}
control.layout(true);
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class PeersViewBase method initYourTableView.
protected TableViewSWT<PEPeer> initYourTableView(String table_id, boolean enable_tabs) {
if (table_id == TableManager.TABLE_TORRENT_PEERS) {
tv = TableViewFactory.createTableViewSWT(Peer.class, TableManager.TABLE_TORRENT_PEERS, getPropertiesPrefix(), basicItems, "pieces", SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
} else {
TableColumnCore[] items = PeersView.getBasicColumnItems(TableManager.TABLE_ALL_PEERS);
TableColumnCore[] basicItems = new TableColumnCore[items.length + 1];
System.arraycopy(items, 0, basicItems, 0, items.length);
basicItems[items.length] = new DownloadNameItem(TableManager.TABLE_ALL_PEERS);
TableColumnManager tcManager = TableColumnManager.getInstance();
tcManager.setDefaultColumnNames(TableManager.TABLE_ALL_PEERS, basicItems);
tv = TableViewFactory.createTableViewSWT(Peer.class, TableManager.TABLE_ALL_PEERS, getPropertiesPrefix(), basicItems, "connected_time", SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
}
tv.setRowDefaultHeightEM(1);
tv.setEnableTabViews(enable_tabs, true, null);
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
registerPluginViews(table_id, pluginUI);
}
tv.addLifeCycleListener(this);
tv.addMenuFillListener(this);
tv.addSelectionListener(this, false);
return tv;
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class ColumnTC_ChosenColumn method refresh.
// @see com.biglybt.pif.ui.tables.TableCellRefreshListener#refresh(com.biglybt.pif.ui.tables.TableCell)
@Override
public void refresh(TableCell cell) {
TableColumnCore column = (TableColumnCore) cell.getDataSource();
int colPos = column.getPosition();
// colPos can have gaps in numbers
if (!cell.setSortValue(colPos) && cell.isValid()) {
return;
}
String key = column.getTitleLanguageKey();
String s = MessageText.getString(key, column.getName());
// s = column.getPosition() + "] " + s;
cell.setText(s);
String info = MessageText.getString(key + ".info", "");
cell.setToolTip(info);
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class ColumnTC_Info method refresh.
// @see com.biglybt.pif.ui.tables.TableCellRefreshListener#refresh(com.biglybt.pif.ui.tables.TableCell)
@Override
public void refresh(TableCell cell) {
TableColumnCore column = (TableColumnCore) cell.getDataSource();
String key = column.getTitleLanguageKey();
if (!cell.setSortValue(key) && cell.isValid()) {
return;
}
cell.setText(MessageText.getString(key + ".info", ""));
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class ColumnTC_NameInfo method refresh.
// @see com.biglybt.pif.ui.tables.TableCellRefreshListener#refresh(com.biglybt.pif.ui.tables.TableCell)
@Override
public void refresh(TableCell cell) {
TableColumnCore column = (TableColumnCore) cell.getDataSource();
String key = column.getTitleLanguageKey();
cell.setSortValue(MessageText.getString(key, column.getName()));
}
Aggregations