Java Code Examples for org.eclipse.swt.widgets.Table#addControlListener()
The following examples show how to use
org.eclipse.swt.widgets.Table#addControlListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Tables.java From olca-app with Mozilla Public License 2.0 | 5 votes |
public static void bindColumnWidths(Table table, int minimum, double... percents) { if (table == null || percents == null) return; TableResizeListener tableListener = new TableResizeListener(table, percents, minimum); // see resize listener declaration for comment on why this is done ColumnResizeListener columnListener = new ColumnResizeListener(tableListener); for (TableColumn column : table.getColumns()) column.addControlListener(columnListener); table.addControlListener(tableListener); }
Example 2
Source File: PTWidgetTable.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * @see org.eclipse.nebula.widgets.opal.propertytable.AbstractPTWidget#buildWidget(org.eclipse.swt.widgets.Composite) */ @Override protected void buildWidget(final Composite parent) { table = new Table(parent, SWT.FULL_SELECTION); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 3, 1)); final TableColumn propertyColumn = new TableColumn(table, SWT.NONE); propertyColumn.setText(ResourceManager.getLabel(ResourceManager.PROPERTY)); final TableColumn valueColumn = new TableColumn(table, SWT.NONE); valueColumn.setText(ResourceManager.getLabel(ResourceManager.VALUE)); fillData(); table.addControlListener(new ControlAdapter() { /** * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent) */ @Override public void controlResized(final ControlEvent e) { final Rectangle area = table.getParent().getClientArea(); final Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT); final ScrollBar vBar = table.getVerticalBar(); int width = area.width - table.computeTrim(0, 0, 0, 0).width - vBar.getSize().x; if (size.y > area.height + table.getHeaderHeight()) { // Subtract the scrollbar width from the total column width // if a vertical scrollbar will be required final Point vBarSize = vBar.getSize(); width -= vBarSize.x; } propertyColumn.pack(); valueColumn.setWidth(width - propertyColumn.getWidth()); table.removeControlListener(this); } }); table.addListener(SWT.Selection, event -> { if (table.getSelectionCount() == 0 || table.getSelection()[0] == null) { return; } updateDescriptionPanel(table.getSelection()[0].getData()); }); }
Example 3
Source File: AutoResizeTableLayout.java From birt with Eclipse Public License 1.0 | 2 votes |
/** * COMMENT - Add concise description of this constructor. * Description should go beyond the constructor's name. * * */ public AutoResizeTableLayout(final Table table) { this.table = table; table.addControlListener(this); }