/** * Adds a column to the TableLayoutManager. If you add a column to a managed table after calling * {@link #manageTable}, you have to call this method to inform the TableLayoutManager about the * new column. * @param column index of the new column in the SWT-Table. */ public void addColumn(int column) { float[] newpercent = new float[percent.length+1]; System.arraycopy(percent,0,newpercent,0,column); newpercent[column]=-1; System.arraycopy(percent,column,newpercent,column+1,percent.length-column); percent = newpercent; int[] newint = new int[min.length+1]; System.arraycopy(min,0,newint,0,column); newint[column]=defaultMinWidth; System.arraycopy(min,column,newint,column+1,min.length-column); min = newint; newint = new int[max.length+1]; System.arraycopy(max,0,newint,0,column); newint[column]=defaultMaxWidth; System.arraycopy(max,column,newint,column+1,max.length-column); max = newint; newint = new int[absolut.length+1]; System.arraycopy(absolut,0,newint,0,column); newint[column]=defaultAbsolutWidth; System.arraycopy(absolut,column,newint,column+1,absolut.length-column); absolut = newint; table.getColumn(column).addControlListener(this); }
/** * Adds a column to the TableLayoutManager. If you add a column to a managed table after calling * {@link #manageTable}, you have to call this method to inform the TableLayoutManager about the * new column. * @param column index of the new column in the SWT-Table. */ public void addColumn(int column) { float[] newpercent = new float[percent.length+1]; System.arraycopy(percent,0,newpercent,0,column); newpercent[column]=-1; System.arraycopy(percent,column,newpercent,column+1,percent.length-column); percent = newpercent; int[] newint = new int[min.length+1]; System.arraycopy(min,0,newint,0,column); newint[column]=defaultMinWidth; System.arraycopy(min,column,newint,column+1,min.length-column); min = newint; newint = new int[max.length+1]; System.arraycopy(max,0,newint,0,column); newint[column]=defaultMaxWidth; System.arraycopy(max,column,newint,column+1,max.length-column); max = newint; newint = new int[absolut.length+1]; System.arraycopy(absolut,0,newint,0,column); newint[column]=defaultAbsolutWidth; System.arraycopy(absolut,column,newint,column+1,absolut.length-column); absolut = newint; table.getColumn(column).addControlListener(this); }
/** * Resize column to the preferred size. */ @Override public void resizeColumnsToPreferredSize() { if (!fIsCreated) { return; } fTableViewer.resizeColumnsToPreferredSize(); if (!fIsShowAddressColumn) { final TableColumn column = fTableViewer.getTable().getColumn(0); column.addControlListener(new ControlListener() { @Override public void controlMoved(ControlEvent e) { } @Override public void controlResized(ControlEvent e) { column.removeControlListener(this); column.setWidth(0); } }); } }
TableColumn[] columns= table.getColumns(); for (int i= 0; i < columns.length; i++) { columns[i].addControlListener(resizer);
/** * Sets the zero based index of the column of the cell being tracked by this editor. * * @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; resize(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); resize(); } /**
/** * Sets the zero based index of the column of the cell being tracked by this editor. * * @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; resize(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); resize(); } /**
/** * Sets the zero based index of the column of the cell being tracked by this editor. * * @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; resize(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); resize(); } /**
/** * Sets the zero based index of the column of the cell being tracked by this editor. * * @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; resize(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); resize(); } /**
/** * Sets the zero based index of the column of the cell being tracked by this editor. * * @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; resize(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); resize(); } /**
/** * Sets the zero based index of the column of the cell being tracked by this editor. * * @param column the zero based index of the column of the cell being tracked by this editor */ public void setColumn(int column) { int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; resize(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); resize(); } /**
public void setColumn(int column) { Table table = tableTree.getTable(); int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; layout(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); layout(); } public void setItem (TableTreeItem item) {
public void setColumn(int column) { Table table = tableTree.getTable(); int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; layout(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); layout(); } public void setItem (TableTreeItem item) {
/** * Attaches the TableLayoutManager to an SWT-Table. From this time on, the column widths are controled by * the TableLayoutManager. * @param table to manage * @param take defines which layout information should be calculated from the current width of the columns. * possible values: {@link #PERCENT}, {@link #SCALEDPERCENT}, {@link #MIN}, {@link #MAX}, {@link #ABSOLUT}. These value may be ored * together to take more information. */ public void manageTable(Table table,int take) { if(this.table!=null) { // remove from old table if any this.table.removeControlListener(this); for(int i=0,size=this.table.getColumnCount();i<size;i++) { this.table.getColumn(i).removeControlListener(this); } } this.table=table; this.table.addControlListener(this); for(int i=0,size=this.table.getColumnCount();i<size;i++) { this.table.getColumn(i).addControlListener(this); } recalcLayoutInfoFromTable(take); }
public void setColumn(int column) { Table table = tableTree.getTable(); int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; layout(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); layout(); } public void setItem (TableTreeItem item) {
public void setColumn(int column) { Table table = tableTree.getTable(); int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; layout(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); layout(); } public void setItem (TableTreeItem item) {
/** * Attaches the TableLayoutManager to an SWT-Table. From this time on, the column widths are controled by * the TableLayoutManager. * @param table to manage * @param take defines which layout information should be calculated from the current width of the columns. * possible values: {@link #PERCENT}, {@link #SCALEDPERCENT}, {@link #MIN}, {@link #MAX}, {@link #ABSOLUT}. These value may be ored * together to take more information. */ public void manageTable(Table table,int take) { if(this.table!=null) { // remove from old table if any this.table.removeControlListener(this); for(int i=0,size=this.table.getColumnCount();i<size;i++) { this.table.getColumn(i).removeControlListener(this); } } this.table=table; this.table.addControlListener(this); for(int i=0,size=this.table.getColumnCount();i<size;i++) { this.table.getColumn(i).addControlListener(this); } recalcLayoutInfoFromTable(take); }
public void setColumn(int column) { Table table = tableTree.getTable(); int columnCount = table.getColumnCount(); // Separately handle the case where the table has no TableColumns. // In this situation, there is a single default column. if (columnCount == 0) { this.column = (column == 0) ? 0 : -1; layout(); return; } if (this.column > -1 && this.column < columnCount){ TableColumn tableColumn = table.getColumn(this.column); tableColumn.removeControlListener(columnListener); this.column = -1; } if (column < 0 || column >= table.getColumnCount()) return; this.column = column; TableColumn tableColumn = table.getColumn(this.column); tableColumn.addControlListener(columnListener); layout(); } public void setItem (TableTreeItem item) {
column.addControlListener(columnResizeListener);