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

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

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

Table._getItem介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

TableItem _getItem (int index) {
  return _getItem (index, true);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

TableItem _getItem (int index, boolean create) {
  return _getItem (index, create, -1);
}

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

private void checkData() {
 int visibleItemCount = getVisibleItemCount( true );
 int startIndex = Math.max( 0, topIndex - preloadedItems );
 int endIndex = Math.min( itemCount, topIndex + visibleItemCount + preloadedItems );
 for( int index = startIndex; index < endIndex; index++ ) {
  checkData( _getItem( index ), index );
 }
}

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

/**
 * Returns the item at the given, zero-relative index in the
 * receiver. Throws an exception if the index is out of range.
 *
 * @param index the index of the item to return
 * @return the item at the given index
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 * </ul>
 * @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 TableItem getItem (int index) {
  checkWidget ();
  if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
  return _getItem (index);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

/**
 * Returns the item at the given, zero-relative index in the
 * receiver. Throws an exception if the index is out of range.
 *
 * @param index the index of the item to return
 * @return the item at the given index
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
 * </ul>
 * @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 TableItem getItem (int index) {
  checkWidget();
  if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
  return _getItem (index);
}

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

/**
 * Shows the selection.  If the selection is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled until
 * the selection is visible.
 *
 * @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>
 *
 * @see Table#showItem(TableItem)
 */
public void showSelection() {
 checkWidget();
 int index = getSelectionIndex();
 if( index != -1 ) {
  showItem( _getItem( index ) );
 }
}

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

void sendSelection () {
  if (ignoreSelect) return;
  NSTableView widget = (NSTableView) view;
  int row = (int)/*64*/widget.selectedRow ();
  if(row == -1)
    sendSelectionEvent (SWT.Selection);
  else {
    TableItem item = _getItem (row);
    Event event = new Event ();
    event.item = item;
    event.index = row;
    sendSelectionEvent (SWT.Selection, event, false);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

TableItem getFocusItem () {
  long /*int*/ [] path = new long /*int*/ [1];
  OS.gtk_tree_view_get_cursor (handle, path, null);
  if (path [0] == 0) return null;
  TableItem item = null;
  long /*int*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  if (indices != 0) {
    int [] index = new int []{-1};
    OS.memmove (index, indices, 4);
    item = _getItem (index [0]);
  }
  OS.gtk_tree_path_free (path [0]);
  return item;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

TableItem getFocusItem () {
  int /*long*/ [] path = new int /*long*/ [1];
  OS.gtk_tree_view_get_cursor (handle, path, null);
  if (path [0] == 0) return null;
  TableItem item = null;
  int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  if (indices != 0) {
    int [] index = new int []{-1};
    OS.memmove (index, indices, 4);
    item = _getItem (index [0]);
  }
  OS.gtk_tree_path_free (path [0]);
  return item;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

TableItem getFocusItem () {
  int /*long*/ [] path = new int /*long*/ [1];
  OS.gtk_tree_view_get_cursor (handle, path, null);
  if (path [0] == 0) return null;
  TableItem item = null;
  int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  if (indices != 0) {
    int [] index = new int []{-1};
    OS.memmove (index, indices, 4);
    item = _getItem (index [0]);
  }
  OS.gtk_tree_path_free (path [0]);
  return item;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

/**
 * Sets the zero-relative index of the item which is currently
 * at the top of the receiver. This index can change when items
 * are scrolled or new items are added and removed.
 *
 * @param index the index of the top item
 *
 * @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 setTopIndex (int index) {
  checkWidget();
  if (!(0 <= index && index < itemCount)) return;
  int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, _getItem (index).handle);
  OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0f, 0f);
  OS.gtk_tree_path_free (path);
}

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

/**
 * Shows the selection.  If the selection is already showing in the receiver,
 * this method simply returns.  Otherwise, the items are scrolled until
 * the selection is visible.
 *
 * @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>
 *
 * @see Table#showItem(TableItem)
 */
public void showSelection () {
  checkWidget ();
  int index = getSelectionIndex ();
  if (index >= 0) {
    checkData(_getItem(index));
    showIndex (index);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
void reskinChildren (int flags) {
  if (_hasItems ()) {
    int itemCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
    for (int i=0; i<itemCount; i++) {
      TableItem item = _getItem (i, false);
      if (item != null) item.reskin (flags);
    }
  }
  if (columns != null) {
    for (int i=0; i<columnCount; i++) {
      TableColumn column = columns [i];
      if (!column.isDisposed ()) column.reskin (flags);
    }
  }
  super.reskinChildren (flags);
}

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

void sendDoubleSelection() {
  NSTableView tableView = (NSTableView)view;
  int rowIndex = (int)/*64*/tableView.clickedRow (); 
  if (rowIndex == -1) rowIndex = (int)/*64*/tableView.selectedRow(); 
  if (rowIndex != -1) {
    if ((style & SWT.CHECK) != 0) {
      NSArray columns = tableView.tableColumns ();
      int columnIndex = (int)/*64*/tableView.clickedColumn ();
      if (columnIndex != -1) {
        id column = columns.objectAtIndex (columnIndex);
        if (column.id == checkColumn.id) return;
      }
    }
    Event event = new Event ();
    event.item = _getItem (rowIndex);
    sendSelectionEvent (SWT.DefaultSelection, event, false);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void destroyItem (TableItem item) {
  int count = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
  int index = 0;
  while (index < count) {
    if (_getItem (index, false) == item) break;
    index++;
  }
  if (index == count) return;
  setDeferResize (true);
  ignoreSelect = ignoreShrink = true;
  int /*long*/ code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
  ignoreSelect = ignoreShrink = false;
  if (code == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
  _removeItem (index, count);
  --count;
  if (count == 0) setTableEmpty ();
  setDeferResize (false);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
int /*long*/ gtk_toggled (int /*long*/ renderer, int /*long*/ pathStr) {
  int /*long*/ path = OS.gtk_tree_path_new_from_string (pathStr);
  if (path == 0) return 0;
  int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
  if (indices != 0) {
    int [] index = new int [1];
    OS.memmove (index, indices, 4);
    TableItem item = _getItem (index [0]);
    item.setChecked (!item.getChecked ());
    Event event = new Event ();
    event.detail = SWT.CHECK;
    event.item = item;
    sendSelectionEvent (SWT.Selection, event, false);
  }
  OS.gtk_tree_path_free (path);
  return 0;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
long /*int*/ gtk_toggled (long /*int*/ renderer, long /*int*/ pathStr) {
  long /*int*/ path = OS.gtk_tree_path_new_from_string (pathStr);
  if (path == 0) return 0;
  long /*int*/ indices = OS.gtk_tree_path_get_indices (path);
  if (indices != 0) {
    int [] index = new int [1];
    OS.memmove (index, indices, 4);
    TableItem item = _getItem (index [0]);
    item.setChecked (!item.getChecked ());
    Event event = new Event ();
    event.detail = SWT.CHECK;
    event.item = item;
    sendSelectionEvent (SWT.Selection, event, false);
  }
  OS.gtk_tree_path_free (path);
  return 0;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
int /*long*/ gtk_toggled (int /*long*/ renderer, int /*long*/ pathStr) {
  int /*long*/ path = OS.gtk_tree_path_new_from_string (pathStr);
  if (path == 0) return 0;
  int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
  if (indices != 0) {
    int [] index = new int [1];
    OS.memmove (index, indices, 4);
    TableItem item = _getItem (index [0]);
    item.setChecked (!item.getChecked ());
    Event event = new Event ();
    event.detail = SWT.CHECK;
    event.item = item;
    sendSelectionEvent (SWT.Selection, event, false);
  }
  OS.gtk_tree_path_free (path);
  return 0;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

TableItem getItemInPixels (Point point) {
  checkWidget();
  if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
  int /*long*/ [] path = new int /*long*/ [1];
  OS.gtk_widget_realize (handle);
  int y = point.y;
  if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
    y -= getHeaderHeightInPixels();
  }
  if (!OS.gtk_tree_view_get_path_at_pos (handle, point.x, y, path, null, null, null)) return null;
  if (path [0] == 0) return null;
  int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  TableItem item = null;
  if (indices != 0) {
    int [] index = new int [1];
    OS.memmove (index, indices, 4);
    item = _getItem (index [0]);
  }
  OS.gtk_tree_path_free (path [0]);
  return item;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

boolean hitTestSelection (int index, int x, int y) {
  int count = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
  if (count == 0) return false;
  if (!hooks (SWT.MeasureItem)) return false;
  boolean result = false;
  if (0 <= index && index < count) {
    TableItem item = _getItem (index);
    int /*long*/ hDC = OS.GetDC (handle);
    int /*long*/ oldFont = 0, newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
    if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
    int /*long*/ hFont = item.fontHandle (0);
    if (hFont != -1) hFont = OS.SelectObject (hDC, hFont);
    Event event = sendMeasureItemEvent (item, index, 0, hDC);
    if (event.getBoundsInPixels ().contains (x, y)) result = true;
    if (hFont != -1) hFont = OS.SelectObject (hDC, hFont);
    if (newFont != 0) OS.SelectObject (hDC, oldFont);
    OS.ReleaseDC (handle, hDC);
//        if (isDisposed () || item.isDisposed ()) return false;
  }
  return result;
}

相关文章

微信公众号

最新文章

更多

Table类方法