There are 9 code examples for org.eclipse.swt.widgets.TableColumn.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: OpenII Package: org.mitre.openii.editors.unity
Source Code: TableView.java (Click to view .java file)
Method Code:
public void clickSort(int columnID){
int column=-1;
TableColumn[] cols=tableview.getColumns();
for (int i=0; i < cols.length; i++) {
if (cols[i].getData("uid").equals(columnID)) {
column=i;
}
}
if (column == -1) return;
if (column == sortColumn) {
sortState++;
if (sortState > 2) sortState=0;
if (sortState > 1 && column == 1) sortState=0;
}
else {
sortState=0;
}
sortColumn=column;
if (sortState == 0) alphebetize(column,false);
else if (sortState == 1) alphebetize(column,true);
else if (sortState == 2) structureSort(column);
sortReverse=(sortState == 1);
}
Project Name: OpenII Package: org.mitre.openii.editors.unity
Source Code: CloseMatchPane.java (Click to view .java file)
Method Code:
public void updateCloseMatch(Integer synsetID,Integer schemaID,Integer elementID){
closeMatchView.dispose();
closeMatchView=new Composite(synsetLabel2.getParent().getParent(),SWT.NONE);
closeMatchView.setLayoutData(closeMatchViewGridData);
closeMatchView.setLayout(closeMatchViewLayout);
Label TBD=new Label(closeMatchView,SWT.NONE);
TBD.setText("TBD");
Term term=unityCanvas.getVocabulary().getTerm(synsetID);
synsetLabel2.setText(term.getName());
closeMatchSID=synsetID;
AssociatedElement[][] allElements=new AssociatedElement[unityCanvas.getSchemaIDs().length][];
ArrayList<AssociatedElement> assElements=new ArrayList<AssociatedElement>();
int elementCount=0;
TableItem showMeR=null;
TableColumn showMeC=null;
for (int j=0; j < unityCanvas.getSchemaIDs().length; j++) {
allElements[j]=term.getAssociatedElements(unityCanvas.getSchemas()[j].getId());
for (int i=0; i < allElements[j].length; i++) {
assElements.add(allElements[j][i]);
}
elementCount+=allElements[j].length;
}
synsetLabel2.getParent().getParent().layout(true);
}
Project Name: OpenII Package: org.mitre.openii.widgets
Source Code: TableWidget.java (Click to view .java file)
Method Code:
/**
* Function to create a table
*/
static public Table createTable(Composite parent,String fields[],ArrayList<Object[]> rows){
Table table=new Table(parent,SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
table.setLinesVisible(true);
table.setHeaderVisible(true);
GridData data=new GridData(SWT.FILL,SWT.FILL,true,true);
table.setLayoutData(data);
for ( String field : fields) {
TableColumn column=new TableColumn(table,SWT.NONE);
column.setText(field);
column.addListener(SWT.Selection,new ColumnListener());
}
for ( Object[] row : rows) {
TableItem item=new TableItem(table,SWT.NONE);
for (int i=0; i < row.length; i++) item.setText(i,row[i] == null ? "" : row[i].toString());
}
for (int i=0; i < table.getColumnCount(); i++) table.getColumn(i).pack();
new KeyMonitor(table);
return table;
}
Project Name: codecover Package: org.codecover.eclipse.views
Source Code: BooleanAnalyzer.java (Click to view .java file)
Method Code:
public Color getForeground(Object element,int columnIndex){
TableColumn column=BooleanAnalyzer.this.tableViewer.getTable().getColumn(columnIndex);
int columnCount=BooleanAnalyzer.this.tableViewer.getTable().getColumnCount();
BooleanTerm booleanTerm=(BooleanTerm)column.getData(COLUMN_STORE_KEY);
if (columnIndex == columnCount - 2) {
return ((RowObject)element).resultCell.foregroundColor;
}
if (columnIndex == columnCount - 1) {
return ((RowObject)element).testCaseCell.foregroundColor;
}
if (booleanTerm == null) {
return null;
}
return ((RowObject)element).cells.get(booleanTerm).foregroundColor;
}
Project Name: codecover Package: org.codecover.eclipse.views
Source Code: PickTestCaseView.java (Click to view .java file)
Method Code:
/**
* Refreshes the {@link TableViewer} with the given input and packs the
* columns.
* @param inputthe new input for the viewer.
*/
private final void refreshAndPackTable(Object input){
this.tableViewer.setInput(input);
this.tableViewer.refresh();
for ( TableColumn column : this.tableViewer.getTable().getColumns()) {
column.pack();
}
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs
Source Code: SearchNewsDialog.java (Click to view .java file)
Method Code:
@SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e){
NewsColumn oldSortBy=fNewsSorter.getSortBy();
NewsColumn newSortBy=(NewsColumn)column.getData(NewsColumnViewModel.COL_ID);
boolean defaultAscending=newSortBy.prefersAscending();
boolean ascending=(oldSortBy != newSortBy) ? defaultAscending : !fNewsSorter.isAscending();
fNewsSorter.setSortBy(newSortBy);
fNewsSorter.setAscending(ascending);
fColumnModel.setSortColumn(newSortBy);
fColumnModel.setAscending(ascending);
if (newSortBy.showSortIndicator()) {
fResultViewer.getTable().setSortColumn(column);
fResultViewer.getTable().setSortDirection(ascending ? SWT.UP : SWT.DOWN);
}
else {
fResultViewer.getTable().setSortColumn(null);
}
if (fResultViewer.getInput() != null) {
Collections.sort(((List<ScoredNews>)fResultViewer.getInput()),fNewsSorter);
fResultViewer.refresh(false);
}
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs
Source Code: SearchNewsDialog.java (Click to view .java file)
Method Code:
private int indexOf(NewsColumn column){
Table table=fCustomTable.getControl();
if (table.isDisposed()) return -1;
TableColumn[] columns=table.getColumns();
for (int i=0; i < columns.length; i++) {
if (column == columns[i].getData(NewsColumnViewModel.COL_ID)) return i;
}
return -1;
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal.editors.feed
Source Code: NewsColumnViewModel.java (Click to view .java file)
Method Code:
/**
* @param table the table to initialize the model from.
* @return the {@link NewsColumnViewModel} from the provided table.
*/
public static NewsColumnViewModel initializeFrom(Table table){
NewsColumnViewModel model=new NewsColumnViewModel();
TableColumn[] columns=table.getColumns();
int[] columnOrder=table.getColumnOrder();
for ( int order : columnOrder) {
Object data=columns[order].getData(COL_ID);
if (data != null) model.addColumn((NewsColumn)data);
}
return model;
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal.util
Source Code: CTable.java (Click to view .java file)
Method Code:
private void onTableResize(){
int totalWidth=fTable.getParent().getClientArea().width;
totalWidth-=fTable.getBorderWidth() * 2;
ScrollBar verticalBar=fTable.getVerticalBar();
if (verticalBar != null) {
int barWidth=verticalBar.getSize().x;
if (Application.IS_MAC && barWidth == 0) barWidth=16;
totalWidth-=barWidth;
}
if (Application.IS_MAC) {
totalWidth-=3;
if ((fTable.getStyle() & SWT.CHECK) != 0) totalWidth-=24;
}
else if (Application.IS_LINUX) totalWidth-=3;
int freeWidth=totalWidth;
int occupiedWidth=0;
int totalFillSum=0;
for ( TableColumn column : fCols) {
CColumnLayoutData data=(CColumnLayoutData)column.getData(LAYOUT_DATA);
if (data.getSize() == CColumnLayoutData.Size.FIXED && data.getWidthHint() == CColumnLayoutData.DEFAULT) {
column.pack();
int width=column.getWidth();
freeWidth-=width;
occupiedWidth+=width;
}
else if (data.getSize() == CColumnLayoutData.Size.FIXED) {
freeWidth-=data.getWidthHint();
occupiedWidth+=data.getWidthHint();
if (column.getWidth() != data.getWidthHint()) column.setWidth(data.getWidthHint());
}
else if (data.getSize() == CColumnLayoutData.Size.FILL) {
totalFillSum+=data.getWidthHint();
}
}
for ( TableColumn column : fCols) {
CColumnLayoutData data=(CColumnLayoutData)column.getData(LAYOUT_DATA);
if (data.getSize() == CColumnLayoutData.Size.FILL) {
int colWidth=(freeWidth * data.getWidthHint()) / totalFillSum;
if (occupiedWidth + colWidth >= totalWidth) colWidth=totalWidth - occupiedWidth;
occupiedWidth+=colWidth;
if (column.getWidth() != colWidth) column.setWidth(colWidth);
}
}
}