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

The following are Jave code examples for showing how to use pack() 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: eZooKeeper   File: BaseZnodeModelTableFormPage.java   Source Code and License Vote up 5 votes
protected final void initFromModelInternal() {

        Table table = getTable();

        if (table == null || getModel().isDestroyed()) {
            return;
        }

        table.setRedraw(false);

        try {
            initTableItemsFromZnode();
            setDirtyInternal(false);
        }
        finally {
            table.setRedraw(true);
        }

        table.pack();
        forceLayout();

        TableColumn[] columns = getTable().getColumns();
        int[] columnWidths = getTableColumnWidths();
        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);
                }
            }
        }
    }