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

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

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

Table.isSelected介绍

[英]Returns true if the item is selected, and false otherwise. Indices out of range are ignored.
[中]如果选择了项目,则返回true,否则返回false。超出范围的索引将被忽略。

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static boolean isSelected( final Table table, final int itemIndex ) {
 return itemIndex != -1 && table.isSelected( itemIndex );
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

int calculateWidth (TableItem[] items, int index, GC gc) {
  int width = 0;
  for (int i=0; i < itemCount; i++) {
    TableItem item = items [i];
    if (item != null && item.cached) {
      width = Math.max (width, item.calculateWidth (index, gc, isSelected(index)));
    }
  }
  return width;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

/**
 * Selects the item at the given zero-relative index in the receiver.
 * If the item at the index was already selected, it remains
 * selected. Indices that are out of range are ignored.
 *
 * @param index the index of the item to select
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public void select( int index ) {
 checkWidget();
 if( index >= 0 && index < itemCount ) {
  if( ( style & SWT.SINGLE ) != 0 ) {
   selection = new int[] { index };
  } else {
   if( !isSelected( index ) ) {
    int length = selection.length;
    int[] newSelection = new int[ length + 1 ];
    System.arraycopy( selection, 0, newSelection, 0, length );
    newSelection[ length ] = index;
    selection = newSelection;
   }
  }
 }
}

代码示例来源:origin: org.apache.uima/uimaj-ep-configurator

@Override
public void copyValuesFromGUI() {
 selectedSofaNames = new String[table.getSelectionCount()];
 for (int i = 0, j = 0; i < table.getItemCount(); i++) {
  if (table.isSelected(i)) {
   selectedSofaNames[j++] = table.getItem(i).getText();
  }
 }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

boolean setScrollWidth (TableItem [] items, boolean set) {
  if (items == null) return false;
  if (columnCount != 0) return false;
  if (!getDrawing()) return false;
  if (currentItem != null) {
    fixScrollWidth = true;
    return false;
  }
  GC gc = new GC (this);
  int newWidth = 0;
  for (int i = 0; i < items.length; i++) {
    TableItem item = items [i];
    if (item != null) {
      newWidth = Math.max (newWidth, item.calculateWidth (0, gc, isSelected(indexOf(item))));
    }
  }
  gc.dispose ();
  if (!set) {
    int oldWidth = (int)firstColumn.width ();
    if (oldWidth >= newWidth) return false;
  }
  firstColumn.setWidth (newWidth);
  if (horizontalBar != null && horizontalBar.view != null) redrawWidget (horizontalBar.view, false);
  return true;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

boolean setScrollWidth (TableItem item) {
  if (columnCount != 0) return false;
  if (!getDrawing()) return false;
  if (currentItem != null) {
    if (currentItem != item) fixScrollWidth = true;
    return false;
  }
  GC gc = new GC (this);
  int newWidth = item.calculateWidth (0, gc, isSelected(indexOf(item)));
  gc.dispose ();
  int oldWidth = (int)firstColumn.width ();
  if (oldWidth < newWidth) {
    firstColumn.setWidth (newWidth);
    if (horizontalBar != null && horizontalBar.view != null) redrawWidget (horizontalBar.view, false);
    return true;
  }
  return false;
}

相关文章

Table类方法