本文整理了Java中org.eclipse.swt.widgets.Table.getColumnCount()
方法的一些代码示例,展示了Table.getColumnCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getColumnCount()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Table
类名称:Table
方法名:getColumnCount
[英]Returns the number of columns contained in the receiver. If no TableColumn
s were created by the programmer, this value is zero, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the table like a list, adding items but never creating a column.
[中]返回接收器中包含的列数。如果程序员没有创建TableColumn
s,则该值为零,尽管在视觉上,一列项目可能是可见的。当程序员像列表一样使用表,添加项但从不创建列时,就会发生这种情况。
代码示例来源:origin: pentaho/pentaho-kettle
private String[] getItemText( TableItem row ) {
if ( row.isDisposed() ) {
return null;
}
String[] retval = new String[table.getColumnCount() - 1];
for ( int i = 0; i < retval.length; i++ ) {
retval[i] = row.getText( i + 1 );
}
return retval;
}
代码示例来源:origin: pentaho/pentaho-kettle
public void add( String... string ) {
TableItem item = new TableItem( table, SWT.NONE );
for ( int i = 0; i < string.length && i + 1 < table.getColumnCount(); i++ ) {
if ( string[i] != null ) {
item.setText( i + 1, string[i] );
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private boolean isEmpty( int rownr, int colnr ) {
boolean empty = false;
TableItem item = table.getItem( rownr );
if ( item != null ) {
if ( colnr >= 0 ) {
String str = item.getText( colnr );
if ( str == null || str.length() == 0 ) {
empty = true;
}
} else {
empty = true;
for ( int j = 1; j < table.getColumnCount(); j++ ) {
String str = item.getText( j );
if ( str != null && str.length() > 0 ) {
empty = false;
}
}
}
}
return empty;
}
代码示例来源:origin: pentaho/pentaho-kettle
private String getSelectedText() {
String selection = "";
for ( int c = 1; c < table.getColumnCount(); c++ ) {
TableColumn tc = table.getColumn( c );
if ( c > 1 ) {
selection += CLIPBOARD_DELIMITER;
}
selection += tc.getText();
}
selection += Const.CR;
TableItem[] items = table.getSelection();
if ( items.length == 0 ) {
return null;
}
for ( int r = 0; r < items.length; r++ ) {
TableItem ti = items[r];
for ( int c = 1; c < table.getColumnCount(); c++ ) {
if ( c > 1 ) {
selection += CLIPBOARD_DELIMITER;
}
selection += ti.getText( c );
}
selection += Const.CR;
}
return selection;
}
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void handleEvent(Event event) {
Rectangle clientArea = table.getClientArea();
Point pt = new Point(event.x, event.y);
int index = table.getTopIndex();
int count = table.getItemCount();
while (index < count) {
boolean visible = false;
TableItem item = table.getItem(index);
for (int i = 0; i < table.getColumnCount(); i++) {
Rectangle rect = item.getBounds(i);
if (rect.contains(pt)) {
beforeEdit();
clickRow(item, i);
return;
}
if (!visible && rect.intersects(clientArea)) {
visible = true;
}
}
if (!visible)
return;
index++;
}
}
protected void beforeEdit() {
代码示例来源:origin: pentaho/pentaho-kettle
boolean visible = false;
final TableItem item = table.getItem( index );
for ( int i = 0; i < table.getColumnCount(); i++ ) {
Rectangle rect = item.getBounds( i );
if ( rect.contains( pt ) ) {
if ( i == table.getColumnCount() - 1 && // last column
代码示例来源:origin: pentaho/pentaho-kettle
int maxcols = table.getColumnCount();
int maxrows = table.getItemCount();
代码示例来源:origin: pentaho/pentaho-kettle
for ( int j = 0; j < table.getColumnCount(); j++ ) {
ColumnInfo colInfo;
if ( j > 0 ) {
Object[] r = new Object[table.getColumnCount() + 2];
for ( int j = 0; j < table.getColumnCount(); j++ ) {
String data = item.getText( j );
if ( GUIResource.getInstance().getColorBlue().equals( item.getForeground( j ) ) ) {
代码示例来源:origin: pentaho/pentaho-kettle
public void optWidth( boolean header, int nrLines ) {
for ( int c = 0; c < table.getColumnCount(); c++ ) {
TableColumn tc = table.getColumn( c );
int max = 0;
代码示例来源:origin: pentaho/pentaho-kettle
for ( int t = 0; t < wFields.table.getColumnCount(); t++ ) {
wFields.table.getColumn( t ).setWidth( 20 );
代码示例来源:origin: pentaho/pentaho-kettle
new String[][]{ beforeEdit }, new String[][]{ afterEdit }, new int[]{ activeTableRow } );
int maxcols = table.getColumnCount();
int maxrows = table.getItemCount();
代码示例来源:origin: pentaho/pentaho-kettle
int maxcols = table.getColumnCount();
int maxrows = table.getItemCount();
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
final void removeData( int index ) {
if( data != null && data.length > index && parent.getColumnCount() > 1 ) {
Data[] newData = new Data[ data.length - 1 ];
System.arraycopy( data, 0, newData, 0, index );
int offSet = data.length - index - 1;
System.arraycopy( data, index + 1, newData, index, offSet );
data = newData;
}
}
代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16
private void removeTableColumns() {
while (table.getColumnCount() > 0) {
table.getColumns()[0].dispose();
}
}
/**
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public void layout () {
if (table == null || table.isDisposed()) return;
if (item == null || item.isDisposed()) return;
int columnCount = table.getColumnCount();
if (columnCount == 0 && column != 0) return;
if (columnCount > 0 && (column < 0 || column >= columnCount)) return;
super.layout();
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
@Override
public void layout () {
if (table == null || table.isDisposed()) return;
if (item == null || item.isDisposed()) return;
int columnCount = table.getColumnCount();
if (columnCount == 0 && column != 0) return;
if (columnCount > 0 && (column < 0 || column >= columnCount)) return;
super.layout();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void setRowColumn(int row, int column, boolean notify) {
TableItem item = row == -1 ? null : table.getItem(row);
TableColumn col = column == -1 || table.getColumnCount() == 0 ? null : table.getColumn(column);
setRowColumn(item, col, notify);
}
void setRowColumn(TableItem row, TableColumn column, boolean notify) {
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
protected Item getItemAt(Point p) {
TableItem[] selection = table.getSelection();
if( selection.length == 1 ) {
int columnCount = table.getColumnCount();
for( int i = 0; i < columnCount; i++ ) {
if( selection[0].getBounds(i).contains(p) ) {
return selection[0];
}
}
}
return table.getItem(p);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private int getLeft( int index ) {
int result = 0;
int columnCount = parent.getColumnCount();
if( index == 0 && columnCount == 0 ) {
result = getCheckWidth( index ) - parent.leftOffset;
} else if( index >= 0 && index < columnCount ) {
// TODO [rh] consider applying the leftOffset already in Column#getLeft()
int columnLeft = parent.getColumn( index ).getLeft();
result = getCheckWidth( index ) + columnLeft - parent.getColumnLeftOffset( index );
}
return result;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public void handleCallRenderToolTipText( Table table, JsonObject properties ) {
ICellToolTipAdapter adapter = CellToolTipUtil.getAdapter( table );
ICellToolTipProvider provider = adapter.getCellToolTipProvider();
if( provider != null ) {
TableItem item = getItem( table, properties.get( "item" ).asString() );
int columnIndex = properties.get( "column" ).asInt();
if( item != null && ( columnIndex == 0 || columnIndex < table.getColumnCount() ) ) {
provider.getToolTipText( item, columnIndex );
}
}
}
内容来源于网络,如有侵权,请联系作者删除!