org.eclipse.swt.widgets.Table.getItemCount()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(257)

本文整理了Java中org.eclipse.swt.widgets.Table.getItemCount()方法的一些代码示例,展示了Table.getItemCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getItemCount()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Table
类名称:Table
方法名:getItemCount

Table.getItemCount介绍

[英]Returns the number of items contained in the receiver.
[中]返回接收器中包含的项目数。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public int getItemCount() {
 return table.getItemCount();
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void modifyText( ModifyEvent e ) {
  for ( int i = 0; i < tableViewFields.table.getItemCount(); i++ ) {
   tableViewFields.setText( String.valueOf( i ), 1, i );
  }
 }
};

代码示例来源:origin: pentaho/pentaho-kettle

private int getCurrentRownr() {
 if ( table.getItemCount() <= 1 ) {
  return 0;
 }
 TableItem row = activeTableItem;
 if ( row == null ) {
  return 0;
 }
 int rownr = table.indexOf( row );
 if ( rownr < 0 ) {
  rownr = 0;
 }
 return rownr;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Count non-empty rows in the table... IMPORTANT: always call this method before calling getNonEmpty(int selnr): for
 * performance reasons we cache the row indexes.
 *
 * @return the number of rows/table-items that are not empty
 */
public int nrNonEmpty() {
 nonEmptyIndexes = new ArrayList<Integer>();
 // Count only non-empty rows
 for ( int i = 0; i < table.getItemCount(); i++ ) {
  if ( !isEmpty( i, -1 ) ) {
   nonEmptyIndexes.add( i );
  }
 }
 return nonEmptyIndexes.size();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void removeEmptyRows( int column ) {
 // Remove "empty" table items, where item.getText(1) is empty, length==0
 for ( int i = table.getItemCount() - 1; i >= 0; i-- ) {
  if ( isEmpty( i, column ) ) {
   table.remove( i );
  }
 }
 if ( table.getItemCount() == 0 ) { // At least one empty row!
  new TableItem( table, SWT.NONE );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

default List<String> getNewFieldNames( final String[] incomingFieldNames ) {
 // get names of all the fields within the fields table, in lower case for a case-insensitive comparison
 final Set<String> fieldNamesInTableLowerCase = new HashSet();
 for ( int i = 0; i < getFieldsTable().table.getItemCount(); i++ ) {
  final TableItem item = getFieldsTable().table.getItem( i );
  int fieldNameIndex = getFieldsTable().hasIndexColumn() ? 1 : 0;
  fieldNamesInTableLowerCase.add( item.getText( fieldNameIndex ).toLowerCase() );
 }
 final List<String> newFieldNames = Arrays.asList( incomingFieldNames ).stream().filter(
  fieldName -> !fieldNamesInTableLowerCase.contains( fieldName.toLowerCase() ) ).collect( Collectors.toList() );
 return newFieldNames;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void remove( int[] index ) {
 table.remove( index );
 if ( table.getItemCount() == 0 ) {
  new TableItem( table, SWT.NONE );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void remove( int index ) {
 table.remove( index );
 if ( table.getItemCount() == 0 ) {
  new TableItem( table, SWT.NONE );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void removeAll() {
 table.removeAll();
 if ( table.getItemCount() == 0 ) {
  new TableItem( table, SWT.NONE );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Get all the strings from a certain column as an array
 *
 * @param colnr The column to return
 * @return the column values as a string array.
 */
public String[] getItems( int colnr ) {
 String[] retval = new String[table.getItemCount()];
 for ( int i = 0; i < retval.length; i++ ) {
  TableItem item = table.getItem( i );
  retval[i] = item.getText( colnr + 1 );
 }
 return retval;
}

代码示例来源:origin: pentaho/pentaho-kettle

private void getDataInfo( DataGridMeta meta ) {
 List<List<String>> data = new ArrayList<List<String>>();
 int nrLines = wData.table.getItemCount();
 int nrFields = meta.getFieldName().length;
 for ( int i = 0; i < nrLines; i++ ) {
  List<String> line = new ArrayList<String>();
  TableItem item = wData.table.getItem( i );
  for ( int f = 0; f < nrFields; f++ ) {
   line.add( item.getText( f + 1 ) );
  }
  data.add( line );
 }
 meta.setDataLines( data );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setRowNums() {
 for ( int i = 0; i < table.getItemCount(); i++ ) {
  TableItem item = table.getItem( i );
  if ( item != null ) {
   String num = "" + ( i + 1 );
   // for(int j=num.length();j<3;j++) num="0"+num;
   if ( !item.getText( 0 ).equals( num ) ) {
    item.setText( 0, num );
   }
  }
 }
}

代码示例来源:origin: caoxinyu/RedisClient

@Override
  public void widgetSelected(SelectionEvent e) {
    service.removeLast(id, db, key);
    pageListener.setCount();
    table.getItem(table.getItemCount()-1);
    table.setSelection(table.getItemCount()-1);
    table.setSelection(-1);
    currentData.setItem(null);
    status = Status.Normal;
    statusChanged();
  }
});

代码示例来源:origin: pentaho/pentaho-kettle

private void ok() {
 tableViewFields.removeEmptyRows();
 List<String> dimensionNames = new ArrayList<String>();
 for ( int i = 0; i < tableViewFields.table.getItemCount(); i++ ) {
  dimensionNames.add( tableViewFields.table.getItem( i ).getText( 1 ) );
 }
 jobEntry.setName( textStepName.getText() );
 jobEntry.setDatabaseMeta( DatabaseMeta.findDatabase( jobMeta.getDatabases(), addConnectionLine.getText() ) );
 jobEntry.setCubeName( textCubeName.getText() );
 jobEntry.setDimensionNames( dimensionNames );
 dispose();
}

代码示例来源:origin: pentaho/pentaho-kettle

default TableItem findTableItem( final String fieldName ) {
 for ( int i = 0; i < getFieldsTable().table.getItemCount(); i++ ) {
  final TableItem item = getFieldsTable().table.getItem( i );
  int fieldNameIndex = getFieldsTable().hasIndexColumn() ? 1 : 0;
  final String itemFieldName = item.getText( fieldNameIndex );
  if ( itemFieldName != null && itemFieldName.equalsIgnoreCase( fieldName ) ) {
   return item;
  }
 }
 return null;
}

代码示例来源:origin: pentaho/pentaho-kettle

default Map<String, List<String>> getFieldValues() {
 getFieldsTable().nrNonEmpty();
 final Map<String, List<String>> rowValues = new HashMap<>();
 for ( int i = 0; i < getFieldsTable().table.getItemCount(); i++ ) {
  final TableItem item = getFieldsTable().table.getItem( i );
  int startIndex = getFieldsTable().hasIndexColumn() ? 1 : 0;
  final String fieldName = item.getText( startIndex );
  if ( StringUtils.isBlank( fieldName ) ) {
   continue;
  }
  final List<String> values = new ArrayList();
  for ( int j = startIndex; j < getFieldsTable().getColumns().length; j++ ) {
   values.add( item.getText( j ) );
  }
  rowValues.put( fieldName, values );
 }
 return rowValues;
}

代码示例来源:origin: pentaho/pentaho-kettle

private void getInfo( PaloDimInputMeta myMeta ) throws KettleException {
 stepname = textStepName.getText();
 List<PaloDimensionLevel> levels = new ArrayList<PaloDimensionLevel>();
 for ( int i = 0; i < tableViewFields.table.getItemCount(); i++ ) {
  PaloDimensionLevel level =
   new PaloDimensionLevel( tableViewFields.table.getItem( i ).getText( 1 ), Integer
    .parseInt( tableViewFields.table.getItem( i ).getText( 2 ) ), tableViewFields.table.getItem( i ).getText(
    3 ), tableViewFields.table.getItem( i ).getText( 4 ) );
  levels.add( level );
 }
 myMeta.setDatabaseMeta( transMeta.findDatabase( addConnectionLine.getText() ) );
 myMeta.setLevels( levels );
 myMeta.setDimension( comboDimension.getText() );
 myMeta.setBaseElementsOnly( buttonBaseElementsOnly.getSelection() );
 myMeta.setChanged( true );
}

代码示例来源:origin: pentaho/pentaho-kettle

private void getInfo( PaloCellInputMeta myMeta ) throws KettleException {
 stepname = textStepName.getText();
 List<DimensionField> fields = new ArrayList<DimensionField>();
 for ( int i = 0; i < tableViewFields.table.getItemCount(); i++ ) {
  DimensionField field =
   new DimensionField( tableViewFields.table.getItem( i ).getText( 1 ), tableViewFields.table.getItem( i )
    .getText( 2 ), tableViewFields.table.getItem( i ).getText( 3 ) );
  fields.add( field );
 }
 myMeta.setDatabaseMeta( transMeta.findDatabase( addConnectionLine.getText() ) );
 myMeta.setCubeMeasureName( new DimensionField( "Measure", textMeasureName.getText(), comboMeasureType.getText() ) );
 myMeta.setLevels( fields );
 myMeta.setCube( comboCube.getText() );
 myMeta.setChanged( true );
}

代码示例来源:origin: caoxinyu/RedisClient

@Override
  public void widgetSelected(SelectionEvent e) {
    InputDialog dialog = new InputDialog(shell.getParent().getShell(), RedisClient.i18nFile.getText(I18nFile.APPENDTAIL), RedisClient.i18nFile.getText(I18nFile.INPUTVALUES), "", null);
    if(dialog.open() == InputDialog.OK){
      String value = dialog.getValue();
      service.addTail(id, db, key, value);
      pageListener.setCount();
      table.clear(table.getItemCount()-1);
      table.setSelection(table.getItemCount()-1);
      table.setSelection(-1);
      currentData.setItem(null);
      status = Status.Normal;
      statusChanged();
    }
  }
});

代码示例来源:origin: caoxinyu/RedisClient

@Override
  public void widgetSelected(SelectionEvent e) {
    TableItem[] items = table.getItems();
    TableItem[] selectedItems = table.getSelection();
    String selectedText = selectedItems[0].getText();
    int selected = table.getSelectionIndex();
    String downText = items[selected + 1].getText();
    items[selected].setText(downText);
    items[selected + 1].setText(selectedText);
    table.setSelection(selected + 1);
    if (selected == table.getItemCount() - 2)
      tableItemSelected();
  }
});

相关文章

Table类方法