Java Code Examples for org.eclipse.swt.widgets.Table.getColumns()

The following are Jave code examples for showing how to use getColumns() of the org.eclipse.swt.widgets.Table class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: eZooKeeper   File: DataModelFormPage.java   Source Code and License Vote up 6 votes
protected void packTable(Table table, int[] columnWidths) {
    if (table == null) {
        return;
    }

    table.pack();

    TableColumn[] columns = table.getColumns();

    for (int i = 0; i < columns.length; i++) {

        int columnWidth = columnWidths[i];
        if (columnWidth == SWT.DEFAULT) {
            columns[i].pack();
        }
        else {
            columns[i].setWidth(columnWidth);
        }
    }
}
 
Example 2
Project: eZooKeeper   File: BaseElementType.java   Source Code and License Vote up 6 votes
@Override
public void packTable(Table table) {
    table.pack();

    TableColumn[] columns = table.getColumns();
    int[] columnWidths = getColumnWidths();
    for (int i = 0; i < columns.length; i++) {

        int columnWidth = columnWidths[i];
        if (columnWidth == SWT.DEFAULT) {
            columns[i].pack();
        }
        else {
            columns[i].setWidth(columnWidth);
        }
    }
}
 
Example 3
Project: eZooKeeper   File: ZnodeAclComposite.java   Source Code and License Vote up 6 votes
private void fixLayout() {

        Table table = getTable();

        // HACK to get the removed item to disappear.
        table.pack();
        layout(true);

        int[] columnWidths = TABLE_COLUMN_WIDTHS;
        TableColumn[] columns = table.getColumns();
        for (int i = 0; i < columns.length; i++) {

            if (columnWidths == null) {
                columns[i].pack();
            }
            else {
                int columnWidth = columnWidths[i];
                if (columnWidth == SWT.DEFAULT) {
                    columns[i].pack();
                }
                else {
                    columns[i].setWidth(columnWidth);
                }
            }
        }
    }
 
Example 4
Project: gw4e.project   File: TableHelper.java   Source Code and License Vote up 6 votes
public static void handleEvent(Event event) {

		Table table = (Table) event.widget;
		int columnCount = table.getColumnCount();
		if (columnCount == 0)
			return;
		Rectangle area = table.getClientArea();
		int totalAreaWdith = area.width;
		int lineWidth = table.getGridLineWidth();
		int totalGridLineWidth = (columnCount - 1) * lineWidth;
		int totalColumnWidth = 0;
		for (TableColumn column : table.getColumns()) {
			totalColumnWidth = totalColumnWidth + column.getWidth();
		}
		int diff = totalAreaWdith - (totalColumnWidth + totalGridLineWidth);

		TableColumn lastCol = table.getColumns()[columnCount - 1];

		lastCol.setWidth(diff + lastCol.getWidth());

	}
 
Example 5
Project: Hydrograph   File: SchemaPreviewPage.java   Source Code and License Vote up 5 votes
private void addControlListener(Table table, TableColumn tableColumn) {
	ControlListener controlistener= new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			for (TableColumn column : table.getColumns()) {
				column.setWidth(table.getSize().x / table.getColumnCount() - (4 - table.getColumnCount()));
			}
		}
	};
	table.addControlListener(controlistener);
}
 
Example 6
Project: SWET   File: TableEditorEx.java   Source Code and License Vote up 4 votes
public static void packTable(Table table) {
	for (TableColumn tc : table.getColumns()) {
		tc.pack();
	}
}