本文整理了Java中org.eclipse.swt.widgets.Tree.getColumn()
方法的一些代码示例,展示了Tree.getColumn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getColumn()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getColumn
[英]Returns the column at the given, zero-relative index in the receiver. Throws an exception if the index is out of range. Columns are returned in the order that they were created. If no TreeColumn
s were created by the programmer, this method will throw ERROR_INVALID_RANGE
despite the fact that a single column of data may be visible in the tree. This occurs when the programmer uses the tree like a list, adding items but never creating a column.
[中]返回接收器中给定的零相对索引处的列。如果索引超出范围,则引发异常。列将按创建顺序返回。如果程序员没有创建TreeColumn
,尽管树中可能有一列数据可见,此方法仍将抛出ERROR_INVALID_RANGE
。当程序员像列表一样使用树,添加项目,但从不创建列时,就会发生这种情况。
代码示例来源:origin: pentaho/pentaho-kettle
protected void setSort( int i ) {
if ( sortColumn == i ) {
ascending = !ascending;
} else {
sortColumn = i;
ascending = true;
}
if ( sortColumn >= 0 && sortColumn < 5 ) {
TreeColumn column = wTree.getColumn( sortColumn );
wTree.setSortColumn( column );
wTree.setSortDirection( ascending ? SWT.UP : SWT.DOWN );
}
refreshTree();
}
代码示例来源:origin: pentaho/pentaho-kettle
public static final void setOptimalWidthOnColumns( Tree tree ) {
int nrCols = tree.getColumnCount();
int[] max = new int[nrCols];
Image image = new Image( tree.getDisplay(), 10, 10 );
GC gc = new GC( image );
for ( int i = 0; i < max.length; i++ ) {
TreeColumn treeColumn = tree.getColumn( i );
Point point = gc.textExtent( treeColumn.getText() );
max[i] = point.x;
}
getMaxWidths( tree.getItems(), max, gc );
gc.dispose();
image.dispose();
for ( int i = 0; i < max.length; i++ ) {
TreeColumn treeColumn = tree.getColumn( i );
treeColumn.setWidth( max[i] + 30 );
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private static String[] getColumnOrder( Tree tree ) {
int[] order = tree.getColumnOrder();
String[] result = new String[ order.length ];
for( int i = 0; i < result.length; i++ ) {
result[ i ] = getId( tree.getColumn( order[ i ] ) );
}
return result;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private int getCellWidth( int index ) {
return getColumnCount() == 0 && index == 0
? getMaxInnerWidth( items, 0, 1, false )
: getColumn( index ).getWidth();
}
代码示例来源:origin: pentaho/pentaho-kettle
protected void setSort( int i ) {
if ( sortColumn == i ) {
ascending = !ascending;
} else {
sortColumn = i;
ascending = true;
}
if ( sortColumn >= 0 && sortColumn < 5 ) {
TreeColumn column = wTree.getColumn( sortColumn );
wTree.setSortColumn( column );
wTree.setSortDirection( ascending ? SWT.UP : SWT.DOWN );
}
refreshTree();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void setRowColumn(int row, int column, boolean notify) {
TreeItem item = row == -1 ? null : tree.getItem(row);
TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column);
setRowColumn(item, col, notify);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* {@inheritDoc}
*
* @since 1.3
*/
protected ColumnLayoutData getLayoutData(Scrollable tableTree, int columnIndex) {
TreeColumn column = ((Tree) tableTree).getColumn(columnIndex);
return (ColumnLayoutData) column.getData(LAYOUT_DATA);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void setRowColumn(int row, int column, boolean notify) {
TreeItem item = row == -1 ? null : tree.getItem(row);
TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column);
setRowColumn(item, col, notify);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* {@inheritDoc}
*
* @since 3.5
*/
@Override
protected ColumnLayoutData getLayoutData(Scrollable tableTree, int columnIndex) {
TreeColumn column = ((Tree) tableTree).getColumn(columnIndex);
return (ColumnLayoutData) column.getData(LAYOUT_DATA);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void setRowColumn(int row, int column, boolean notify) {
TreeItem item = row == -1 ? null : tree.getItem(row);
TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column);
setRowColumn(item, col, notify);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
@Override
public int getColumnLeft( TreeColumn column ) {
int index = Tree.this.indexOf( column );
return getColumn( index ).getLeft();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void setRowColumn(int row, int column, boolean notify) {
TreeItem item = row == -1 ? null : tree.getItem(row);
TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column);
setRowColumn(item, col, notify);
}
代码示例来源:origin: org.eclipse/org.eclipse.emf.exporter
public void setColumn(int index)
{
TreeColumn treeColumn = ((Tree)composite).getColumn(index);
TreeEditor treeEditor = (TreeEditor)compositeEditor;
treeEditor.minimumWidth = treeColumn.getWidth();
treeEditor.setColumn(index);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void setRowColumn(int row, int column, boolean notify) {
TreeItem item = row == -1 ? null : tree.getItem(row);
TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column);
setRowColumn(item, col, notify);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
int getWidth(int columnIndex) {
return item.getParent().getColumn(columnIndex).getWidth();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
protected Widget getColumnViewerOwner(int columnIndex) {
if (columnIndex < 0 || ( columnIndex > 0 && columnIndex >= getTree().getColumnCount() ) ) {
return null;
}
if (getTree().getColumnCount() == 0)// Hang it off the table if it
return getTree();
return getTree().getColumn(columnIndex);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
protected boolean scrollCellIntoView(int columnIndex) {
item.getParent().showItem(item);
if (hasColumns()) {
item.getParent()
.showColumn(item.getParent().getColumn(columnIndex));
}
return true;
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
protected Widget getColumnViewerOwner(int columnIndex) {
if (columnIndex < 0 || ( columnIndex > 0 && columnIndex >= getTree().getColumnCount() ) ) {
return null;
}
if (getTree().getColumnCount() == 0)// Hang it off the table if it
return getTree();
return getTree().getColumn(columnIndex);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
protected boolean scrollCellIntoView(int columnIndex) {
item.getParent().showItem(item);
if (hasColumns()) {
item.getParent()
.showColumn(item.getParent().getColumn(columnIndex));
}
return true;
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
protected Widget getColumnViewerOwner(int columnIndex) {
if (columnIndex < 0 || ( columnIndex > 0 && columnIndex >= getTree().getColumnCount() ) ) {
return null;
}
if (getTree().getColumnCount() == 0)// Hang it off the table if it
return getTree();
return getTree().getColumn(columnIndex);
}
内容来源于网络,如有侵权,请联系作者删除!