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

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

本文整理了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

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

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

  1. int calculateWidth (TableItem[] items, int index, GC gc) {
  2. int width = 0;
  3. for (int i=0; i < itemCount; i++) {
  4. TableItem item = items [i];
  5. if (item != null && item.cached) {
  6. width = Math.max (width, item.calculateWidth (index, gc, isSelected(index)));
  7. }
  8. }
  9. return width;
  10. }

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

  1. /**
  2. * Selects the item at the given zero-relative index in the receiver.
  3. * If the item at the index was already selected, it remains
  4. * selected. Indices that are out of range are ignored.
  5. *
  6. * @param index the index of the item to select
  7. *
  8. * @exception SWTException <ul>
  9. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  10. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  11. * </ul>
  12. */
  13. public void select( int index ) {
  14. checkWidget();
  15. if( index >= 0 && index < itemCount ) {
  16. if( ( style & SWT.SINGLE ) != 0 ) {
  17. selection = new int[] { index };
  18. } else {
  19. if( !isSelected( index ) ) {
  20. int length = selection.length;
  21. int[] newSelection = new int[ length + 1 ];
  22. System.arraycopy( selection, 0, newSelection, 0, length );
  23. newSelection[ length ] = index;
  24. selection = newSelection;
  25. }
  26. }
  27. }
  28. }

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

  1. @Override
  2. public void copyValuesFromGUI() {
  3. selectedSofaNames = new String[table.getSelectionCount()];
  4. for (int i = 0, j = 0; i < table.getItemCount(); i++) {
  5. if (table.isSelected(i)) {
  6. selectedSofaNames[j++] = table.getItem(i).getText();
  7. }
  8. }
  9. }

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

  1. boolean setScrollWidth (TableItem [] items, boolean set) {
  2. if (items == null) return false;
  3. if (columnCount != 0) return false;
  4. if (!getDrawing()) return false;
  5. if (currentItem != null) {
  6. fixScrollWidth = true;
  7. return false;
  8. }
  9. GC gc = new GC (this);
  10. int newWidth = 0;
  11. for (int i = 0; i < items.length; i++) {
  12. TableItem item = items [i];
  13. if (item != null) {
  14. newWidth = Math.max (newWidth, item.calculateWidth (0, gc, isSelected(indexOf(item))));
  15. }
  16. }
  17. gc.dispose ();
  18. if (!set) {
  19. int oldWidth = (int)firstColumn.width ();
  20. if (oldWidth >= newWidth) return false;
  21. }
  22. firstColumn.setWidth (newWidth);
  23. if (horizontalBar != null && horizontalBar.view != null) redrawWidget (horizontalBar.view, false);
  24. return true;
  25. }

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

  1. boolean setScrollWidth (TableItem item) {
  2. if (columnCount != 0) return false;
  3. if (!getDrawing()) return false;
  4. if (currentItem != null) {
  5. if (currentItem != item) fixScrollWidth = true;
  6. return false;
  7. }
  8. GC gc = new GC (this);
  9. int newWidth = item.calculateWidth (0, gc, isSelected(indexOf(item)));
  10. gc.dispose ();
  11. int oldWidth = (int)firstColumn.width ();
  12. if (oldWidth < newWidth) {
  13. firstColumn.setWidth (newWidth);
  14. if (horizontalBar != null && horizontalBar.view != null) redrawWidget (horizontalBar.view, false);
  15. return true;
  16. }
  17. return false;
  18. }

相关文章

Table类方法