org.eclipse.swt.widgets.Table#addControlListener ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Table#addControlListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: olca-app   文件: Tables.java
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);
}
 
源代码2 项目: nebula   文件: PTWidgetTable.java
/**
 * @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());
	});

}
 
源代码3 项目: birt   文件: AutoResizeTableLayout.java
/** 
 * 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);  
}