Table table = column.getParent(); TableColumn[] columns = table.getColumns(); int firstWidth = 0, restWidth = 0;
/** * Returns the index of the given column in the backing table for this page, or 0 * * @return the index of the column in the backing table for this page or 0 */ private int getColumnIndex() { int idx = this.column.getParent().indexOf(this.column); return (idx < 0 ? 0 : idx); } }
private static ITableAdapter getTableAdapter( TableColumn column ) { return column.getParent().getAdapter( ITableAdapter.class ); }
Composite getComposite(Widget column) { return ((TableColumn) column).getParent().getParent(); }
Composite getComposite(Widget column) { return ((TableColumn) column).getParent().getParent(); }
private static ITableAdapter getTableAdapter( TableColumn column ) { return column.getParent().getAdapter( ITableAdapter.class ); }
private static int getIndex( TableColumn column ) { return column.getParent().indexOf( column ); }
static int getZIndex( final TableColumn column ) { return ControlLCAUtil.getZIndex( column.getParent() ) + 1; }
Composite getComposite(Widget column) { return ((TableColumn) column).getParent().getParent(); }
private static Font getFont( TableColumn column ) { Table table = column.getParent(); IControlAdapter adapter = table.getAdapter( IControlAdapter.class ); return adapter.getUserFont(); }
public void renderInitialization( final Widget widget ) throws IOException { TableColumn column = ( TableColumn )widget; JSWriter writer = JSWriter.getWriterFor( column ); Object[] args = new Object[] { column.getParent() }; writer.newWidget( "org.eclipse.swt.widgets.TableColumn", args ); }
static int getLeft( final TableColumn column ) { Object adapter = column.getParent().getAdapter( ITableAdapter.class ); ITableAdapter tableAdapter = ( ITableAdapter )adapter; return tableAdapter.getColumnLeft( column ); }
/** * Sets the sorting direction for this sorter to use * * @param direction */ public void setDirection(int direction) { this.column.getParent().setSortColumn(this.column); this.direction = direction; this.column.getParent().setSortDirection(this.direction); if (this.cviewer.getComparator() == this) { this.cviewer.refresh(); } else { this.cviewer.setComparator(this); } }
static String getSortDirection( final TableColumn column ) { String result = null; Table table = column.getParent(); if( table.getSortColumn() == column ) { if( table.getSortDirection() == SWT.UP ) { result = "up"; } else if( table.getSortDirection() == SWT.DOWN ) { result = "down"; } } return result; }
@Override public void renderInitialization( TableColumn column ) throws IOException { RemoteObject remoteObject = createRemoteObject( column, TYPE ); remoteObject.setHandler( new TableColumnOperationHandler( column ) ); remoteObject.set( "parent", getId( column.getParent() ) ); }
@Override public void widgetSelected(SelectionEvent e) { if (ColumnSorter.this.cviewer.getComparator() != ColumnSorter.this) { setDirection(SWT.DOWN); } else { int tdirection = ColumnSorter.this.column.getParent().getSortDirection(); if (tdirection == SWT.NONE) { setDirection(SWT.DOWN); } else { setDirection(tdirection == SWT.UP ? SWT.DOWN : SWT.UP); } } } });
/** * @since 1.3 */ protected void updateColumnData(Widget column) { TableColumn tColumn = (TableColumn) column; Table t = tColumn.getParent(); if( ! IS_GTK || t.getColumn(t.getColumnCount()-1) != tColumn ){ tColumn.setData(LAYOUT_DATA, new ColumnPixelData(tColumn.getWidth())); layout(t.getParent(), true); } } }
/** * @since 3.5 */ @Override protected void updateColumnData(Widget column) { TableColumn tColumn = (TableColumn) column; Table t = tColumn.getParent(); if (!IS_GTK || t.getColumn(t.getColumnCount() - 1) != tColumn) { tColumn.setData(LAYOUT_DATA, new ColumnPixelData(tColumn.getWidth())); layout(t.getParent(), true); } } }
/** * @since 3.5 */ @Override protected void updateColumnData(Widget column) { TableColumn tColumn = (TableColumn) column; Table t = tColumn.getParent(); if (!IS_GTK || t.getColumn(t.getColumnCount() - 1) != tColumn) { tColumn.setData(LAYOUT_DATA, new ColumnPixelData(tColumn.getWidth())); layout(t.getParent(), true); } } }
static void moveColumn( TableColumn column, int newLeft ) { Table table = column.getParent(); int targetColumn = findMoveTarget( table, newLeft ); int[] columnOrder = table.getColumnOrder(); int index = table.indexOf( column ); int orderIndex = arrayIndexOf( columnOrder, index ); columnOrder = arrayRemove( columnOrder, orderIndex ); if( orderIndex < targetColumn ) { targetColumn--; } if( isFixed( column ) || isFixed( table.getColumn( targetColumn ) ) ) { targetColumn = table.indexOf( column ); } columnOrder = arrayInsert( columnOrder, targetColumn, index ); if( Arrays.equals( columnOrder, table.getColumnOrder() ) ) { // TODO [rh] HACK mark left as changed TableColumn[] columns = table.getColumns(); for( int i = 0; i < columns.length; i++ ) { getAdapter( columns[ i ] ).preserve( PROP_LEFT, null ); } } else { table.setColumnOrder( columnOrder ); // [if] HACK mark left as changed - see bug 336340 getAdapter( column ).preserve( PROP_LEFT, null ); } }