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

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

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

  1. TableItem _getItem (int index) {
  2. return _getItem (index, true);
  3. }

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

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

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

  1. private void checkData() {
  2. int visibleItemCount = getVisibleItemCount( true );
  3. int startIndex = Math.max( 0, topIndex - preloadedItems );
  4. int endIndex = Math.min( itemCount, topIndex + visibleItemCount + preloadedItems );
  5. for( int index = startIndex; index < endIndex; index++ ) {
  6. checkData( _getItem( index ), index );
  7. }
  8. }

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

  1. /**
  2. * Returns the item at the given, zero-relative index in the
  3. * receiver. Throws an exception if the index is out of range.
  4. *
  5. * @param index the index of the item to return
  6. * @return the item at the given index
  7. *
  8. * @exception IllegalArgumentException <ul>
  9. * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
  10. * </ul>
  11. * @exception SWTException <ul>
  12. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  13. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  14. * </ul>
  15. */
  16. public TableItem getItem (int index) {
  17. checkWidget ();
  18. if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
  19. return _getItem (index);
  20. }

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

  1. /**
  2. * Returns the item at the given, zero-relative index in the
  3. * receiver. Throws an exception if the index is out of range.
  4. *
  5. * @param index the index of the item to return
  6. * @return the item at the given index
  7. *
  8. * @exception IllegalArgumentException <ul>
  9. * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
  10. * </ul>
  11. * @exception SWTException <ul>
  12. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  13. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  14. * </ul>
  15. */
  16. public TableItem getItem (int index) {
  17. checkWidget();
  18. if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
  19. return _getItem (index);
  20. }

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

  1. /**
  2. * Shows the selection. If the selection is already showing in the receiver,
  3. * this method simply returns. Otherwise, the items are scrolled until
  4. * the selection is visible.
  5. *
  6. * @exception SWTException <ul>
  7. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  8. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  9. * </ul>
  10. *
  11. * @see Table#showItem(TableItem)
  12. */
  13. public void showSelection() {
  14. checkWidget();
  15. int index = getSelectionIndex();
  16. if( index != -1 ) {
  17. showItem( _getItem( index ) );
  18. }
  19. }

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

  1. void sendSelection () {
  2. if (ignoreSelect) return;
  3. NSTableView widget = (NSTableView) view;
  4. int row = (int)/*64*/widget.selectedRow ();
  5. if(row == -1)
  6. sendSelectionEvent (SWT.Selection);
  7. else {
  8. TableItem item = _getItem (row);
  9. Event event = new Event ();
  10. event.item = item;
  11. event.index = row;
  12. sendSelectionEvent (SWT.Selection, event, false);
  13. }
  14. }

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

  1. TableItem getFocusItem () {
  2. long /*int*/ [] path = new long /*int*/ [1];
  3. OS.gtk_tree_view_get_cursor (handle, path, null);
  4. if (path [0] == 0) return null;
  5. TableItem item = null;
  6. long /*int*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  7. if (indices != 0) {
  8. int [] index = new int []{-1};
  9. OS.memmove (index, indices, 4);
  10. item = _getItem (index [0]);
  11. }
  12. OS.gtk_tree_path_free (path [0]);
  13. return item;
  14. }

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

  1. TableItem getFocusItem () {
  2. int /*long*/ [] path = new int /*long*/ [1];
  3. OS.gtk_tree_view_get_cursor (handle, path, null);
  4. if (path [0] == 0) return null;
  5. TableItem item = null;
  6. int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  7. if (indices != 0) {
  8. int [] index = new int []{-1};
  9. OS.memmove (index, indices, 4);
  10. item = _getItem (index [0]);
  11. }
  12. OS.gtk_tree_path_free (path [0]);
  13. return item;
  14. }

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

  1. TableItem getFocusItem () {
  2. int /*long*/ [] path = new int /*long*/ [1];
  3. OS.gtk_tree_view_get_cursor (handle, path, null);
  4. if (path [0] == 0) return null;
  5. TableItem item = null;
  6. int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  7. if (indices != 0) {
  8. int [] index = new int []{-1};
  9. OS.memmove (index, indices, 4);
  10. item = _getItem (index [0]);
  11. }
  12. OS.gtk_tree_path_free (path [0]);
  13. return item;
  14. }

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

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

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

  1. /**
  2. * Shows the selection. If the selection is already showing in the receiver,
  3. * this method simply returns. Otherwise, the items are scrolled until
  4. * the selection is visible.
  5. *
  6. * @exception SWTException <ul>
  7. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  8. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  9. * </ul>
  10. *
  11. * @see Table#showItem(TableItem)
  12. */
  13. public void showSelection () {
  14. checkWidget ();
  15. int index = getSelectionIndex ();
  16. if (index >= 0) {
  17. checkData(_getItem(index));
  18. showIndex (index);
  19. }
  20. }

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

  1. @Override
  2. void reskinChildren (int flags) {
  3. if (_hasItems ()) {
  4. int itemCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
  5. for (int i=0; i<itemCount; i++) {
  6. TableItem item = _getItem (i, false);
  7. if (item != null) item.reskin (flags);
  8. }
  9. }
  10. if (columns != null) {
  11. for (int i=0; i<columnCount; i++) {
  12. TableColumn column = columns [i];
  13. if (!column.isDisposed ()) column.reskin (flags);
  14. }
  15. }
  16. super.reskinChildren (flags);
  17. }

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

  1. void sendDoubleSelection() {
  2. NSTableView tableView = (NSTableView)view;
  3. int rowIndex = (int)/*64*/tableView.clickedRow ();
  4. if (rowIndex == -1) rowIndex = (int)/*64*/tableView.selectedRow();
  5. if (rowIndex != -1) {
  6. if ((style & SWT.CHECK) != 0) {
  7. NSArray columns = tableView.tableColumns ();
  8. int columnIndex = (int)/*64*/tableView.clickedColumn ();
  9. if (columnIndex != -1) {
  10. id column = columns.objectAtIndex (columnIndex);
  11. if (column.id == checkColumn.id) return;
  12. }
  13. }
  14. Event event = new Event ();
  15. event.item = _getItem (rowIndex);
  16. sendSelectionEvent (SWT.DefaultSelection, event, false);
  17. }
  18. }

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

  1. void destroyItem (TableItem item) {
  2. int count = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
  3. int index = 0;
  4. while (index < count) {
  5. if (_getItem (index, false) == item) break;
  6. index++;
  7. }
  8. if (index == count) return;
  9. setDeferResize (true);
  10. ignoreSelect = ignoreShrink = true;
  11. int /*long*/ code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
  12. ignoreSelect = ignoreShrink = false;
  13. if (code == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
  14. _removeItem (index, count);
  15. --count;
  16. if (count == 0) setTableEmpty ();
  17. setDeferResize (false);
  18. }

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

  1. @Override
  2. int /*long*/ gtk_toggled (int /*long*/ renderer, int /*long*/ pathStr) {
  3. int /*long*/ path = OS.gtk_tree_path_new_from_string (pathStr);
  4. if (path == 0) return 0;
  5. int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
  6. if (indices != 0) {
  7. int [] index = new int [1];
  8. OS.memmove (index, indices, 4);
  9. TableItem item = _getItem (index [0]);
  10. item.setChecked (!item.getChecked ());
  11. Event event = new Event ();
  12. event.detail = SWT.CHECK;
  13. event.item = item;
  14. sendSelectionEvent (SWT.Selection, event, false);
  15. }
  16. OS.gtk_tree_path_free (path);
  17. return 0;
  18. }

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

  1. @Override
  2. long /*int*/ gtk_toggled (long /*int*/ renderer, long /*int*/ pathStr) {
  3. long /*int*/ path = OS.gtk_tree_path_new_from_string (pathStr);
  4. if (path == 0) return 0;
  5. long /*int*/ indices = OS.gtk_tree_path_get_indices (path);
  6. if (indices != 0) {
  7. int [] index = new int [1];
  8. OS.memmove (index, indices, 4);
  9. TableItem item = _getItem (index [0]);
  10. item.setChecked (!item.getChecked ());
  11. Event event = new Event ();
  12. event.detail = SWT.CHECK;
  13. event.item = item;
  14. sendSelectionEvent (SWT.Selection, event, false);
  15. }
  16. OS.gtk_tree_path_free (path);
  17. return 0;
  18. }

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

  1. @Override
  2. int /*long*/ gtk_toggled (int /*long*/ renderer, int /*long*/ pathStr) {
  3. int /*long*/ path = OS.gtk_tree_path_new_from_string (pathStr);
  4. if (path == 0) return 0;
  5. int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
  6. if (indices != 0) {
  7. int [] index = new int [1];
  8. OS.memmove (index, indices, 4);
  9. TableItem item = _getItem (index [0]);
  10. item.setChecked (!item.getChecked ());
  11. Event event = new Event ();
  12. event.detail = SWT.CHECK;
  13. event.item = item;
  14. sendSelectionEvent (SWT.Selection, event, false);
  15. }
  16. OS.gtk_tree_path_free (path);
  17. return 0;
  18. }

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

  1. TableItem getItemInPixels (Point point) {
  2. checkWidget();
  3. if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
  4. int /*long*/ [] path = new int /*long*/ [1];
  5. OS.gtk_widget_realize (handle);
  6. int y = point.y;
  7. if (getHeaderVisible() && OS.GTK_VERSION > OS.VERSION(3, 9, 0)) {
  8. y -= getHeaderHeightInPixels();
  9. }
  10. if (!OS.gtk_tree_view_get_path_at_pos (handle, point.x, y, path, null, null, null)) return null;
  11. if (path [0] == 0) return null;
  12. int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
  13. TableItem item = null;
  14. if (indices != 0) {
  15. int [] index = new int [1];
  16. OS.memmove (index, indices, 4);
  17. item = _getItem (index [0]);
  18. }
  19. OS.gtk_tree_path_free (path [0]);
  20. return item;
  21. }

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

  1. boolean hitTestSelection (int index, int x, int y) {
  2. int count = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
  3. if (count == 0) return false;
  4. if (!hooks (SWT.MeasureItem)) return false;
  5. boolean result = false;
  6. if (0 <= index && index < count) {
  7. TableItem item = _getItem (index);
  8. int /*long*/ hDC = OS.GetDC (handle);
  9. int /*long*/ oldFont = 0, newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
  10. if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
  11. int /*long*/ hFont = item.fontHandle (0);
  12. if (hFont != -1) hFont = OS.SelectObject (hDC, hFont);
  13. Event event = sendMeasureItemEvent (item, index, 0, hDC);
  14. if (event.getBoundsInPixels ().contains (x, y)) result = true;
  15. if (hFont != -1) hFont = OS.SelectObject (hDC, hFont);
  16. if (newFont != 0) OS.SelectObject (hDC, oldFont);
  17. OS.ReleaseDC (handle, hDC);
  18. // if (isDisposed () || item.isDisposed ()) return false;
  19. }
  20. return result;
  21. }

相关文章

Table类方法