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

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

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

Table.getTopIndex介绍

[英]Returns 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 or removed.
[中]返回当前位于接收器顶部的项的零相对索引。滚动项目或添加或删除新项目时,此索引可能会更改。

代码示例

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

@Override
public void handleEvent(Event event) {
    Rectangle clientArea = table.getClientArea();
    Point pt = new Point(event.x, event.y);
    int index = table.getTopIndex();
    int count = table.getItemCount();
    while (index < count) {
      boolean visible = false;
      TableItem item = table.getItem(index);
      
      for (int i = 0; i < table.getColumnCount(); i++) {
        Rectangle rect = item.getBounds(i);
        if (rect.contains(pt)) {
          beforeEdit();
          clickRow(item, i);
          return;
        }
        if (!visible && rect.intersects(clientArea)) {
          visible = true;
        }
      }
      if (!visible)
        return;
      index++;
    }
}
protected void beforeEdit() {

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

Rectangle clientArea = table.getClientArea();
Point pt = new Point( event.x, event.y );
int index = table.getTopIndex();
while ( index < table.getItemCount() ) {
 boolean visible = false;

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

int topIdx = transGridView.getTable().getTopIndex();
 if ( transGridView.getTable().getTopIndex() != topIdx ) {
  transGridView.getTable().setTopIndex( topIdx );

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
public int getTopIndex() {
  return Math.max(viewer.getTable().getTopIndex() - 1, 0);
}

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

public int getTopIndex() {
  return Math.max(viewer.getTable().getTopIndex() - 1, 0);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@Override
public int getTopIndex() {
  return Math.max(viewer.getTable().getTopIndex() - 1, 0);
}

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

private static void writeTopIndex( final Table table ) throws IOException {
 // TODO [rh] investigate if we can optimize item updates by rendering
 //      item.update()-JS-code from the server-side. e.g. compare
 //      item.preservedIsVisible != item.currentIsVisible
 JSWriter writer = JSWriter.getWriterFor( table );
 Integer newValue = new Integer( table.getTopIndex() );
 writer.set( PROP_TOP_INDEX, "topIndex", newValue, DEFAULT_TOP_INDEX );
}

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

private int getTop( int itemIndex ) {
 int relativeItemIndex = itemIndex - parent.getTopIndex();
 int headerHeight = parent.getHeaderHeight();
 int itemHeight = parent.getItemHeight();
 return headerHeight + relativeItemIndex * itemHeight;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

protected void notifyListenersAtBufferStart() {
  int topIdx = getTable().getTopIndex();
  for (IVirtualContentListener iVirtualContentListener : fVirtualContentListeners) {
    final IVirtualContentListener listener = iVirtualContentListener;
    if (topIdx < listener.getThreshold(IVirtualContentListener.BUFFER_START)) {
      SafeRunner.run(new ISafeRunnable() {
        @Override
        public void run() throws Exception {
          listener.handledAtBufferStart();
        }
        @Override
        public void handleException(Throwable exception) {
          DebugUIPlugin.log(exception);
        }
      });
    }
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

public void topIndexChanged() {
  if (DebugUIPlugin.DEBUG_DYNAMIC_LOADING) {
    MemorySegment a = (MemorySegment) getTable().getItem(getTable().getTopIndex()).getData();
    DebugUIPlugin.trace(Thread.currentThread().getName() + " " + this + " handle scroll bar moved:  top index: " + a.getAddress().toString(16)); //$NON-NLS-1$ //$NON-NLS-2$
  }
  setTopIndexKey(getVirtualContentModel().getKey(getTable().getTopIndex()));
  notifyListenersAtBufferStart();
  notifyListenersAtBufferEnd();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

private BigInteger getTopVisibleAddress() {
  if (fTableViewer == null) {
    return BigInteger.valueOf(0);
  }
  Table table = fTableViewer.getTable();
  int topIndex = table.getTopIndex();
  if (topIndex < 0) {
    return null;
  }
  if (table.getItemCount() > topIndex) {
    MemorySegment topItem = (MemorySegment) table.getItem(topIndex).getData();
    if (topItem != null) {
      return topItem.getAddress();
    }
  }
  return null;
}

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

Widget getItem(Table table, int x, int y) {
  Point coordinates = new Point(x, y);
  coordinates = table.toControl(coordinates);
  TableItem item = table.getItem(coordinates);
  if (item != null) return item;
  Rectangle area = table.getClientArea();
  int tableBottom = area.y + area.height;
  int itemCount = table.getItemCount();
  for (int i=table.getTopIndex(); i<itemCount; i++) {
    item = table.getItem(i);
    Rectangle rect = item.getBounds();
    rect.x = area.x;
    rect.width = area.width;
    if (rect.contains(coordinates)) return item;
    if (rect.y > tableBottom) break;
  }
  return null;
}

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

@Override
 public void run() {
  renderProperty( table, PROP_TOP_ITEM_INDEX, table.getTopIndex(), ZERO );
  renderProperty( table, PROP_SCROLL_LEFT, getScrollLeft( table ), ZERO );
  renderProperty( table, PROP_FOCUS_ITEM, getFocusItem( table ), null );
  renderProperty( table, PROP_SELECTION, getSelection( table ), DEFAULT_SELECTION );
  renderProperty( table, PROP_SORT_COLUMN, table.getSortColumn(), null );
 }
} );

代码示例来源:origin: org.codehaus.openxma/xmartclient

/**
 * Resets the order to the natural order of the rows. I.e., to the state after
 * construction and before any <tt>sort</tt>-calls.
 */
protected void sortNatural () {
  if (!isUIAttached()) return;
  int topIndex = table_.getTopIndex();
  if (sortingCol_ != -1) {
    sortingCol_ = -1;
    ascending = true;
    rows2UI();
    selection2UI();
    table_.setTopIndex(topIndex);   // restore top index
    //erease the old sort indicator
    actualizeSortIndicator2UI();
  }
}

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

Widget getItem(Table table, int x, int y) {
  Point coordinates = new Point(x, y);
  coordinates = table.toControl(coordinates);
  TableItem item = table.getItem(coordinates);
  if (item != null) return item;
  Rectangle area = table.getClientArea();
  int tableBottom = area.y + area.height;
  int itemCount = table.getItemCount();
  for (int i=table.getTopIndex(); i<itemCount; i++) {
    item = table.getItem(i);
    Rectangle rect = item.getBounds();
    rect.x = area.x;
    rect.width = area.width;
    if (rect.contains(coordinates)) return item;
    if (rect.y > tableBottom) break;
  }
  return null;
}

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

Widget getItem(Table table, int x, int y) {
  Point coordinates = new Point(x, y);
  coordinates = table.toControl(coordinates);
  TableItem item = table.getItem(coordinates);
  if (item != null) return item;
  Rectangle area = table.getClientArea();
  int tableBottom = area.y + area.height;
  int itemCount = table.getItemCount();
  for (int i=table.getTopIndex(); i<itemCount; i++) {
    item = table.getItem(i);
    Rectangle rect = item.getBounds();
    rect.x = area.x;
    rect.width = area.width;
    if (rect.contains(coordinates)) return item;
    if (rect.y > tableBottom) break;
  }
  return null;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  public void refresh() {
    int topIndex = getTable().getTopIndex();
    super.refresh();
    // XXX workaround for http://bugs.eclipse.org/bugs/show_bug.cgi?id=9390
    setCheckState((IMemberActionInfo[])getInput());
    if (topIndex < getTable().getItemCount())
      getTable().setTopIndex(topIndex); //see bug 31645
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  public void refresh() {
    int topIndex = getTable().getTopIndex();
    super.refresh();
    // XXX workaround for http://bugs.eclipse.org/bugs/show_bug.cgi?id=9390
    setCheckState((IMemberActionInfo[])getInput());
    if (topIndex < getTable().getItemCount())
      getTable().setTopIndex(topIndex); //see bug 31645
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

public void refresh() {
    int topIndex = getTable().getTopIndex();
    super.refresh();
    // XXX workaround for http://bugs.eclipse.org/bugs/show_bug.cgi?id=9390
    setCheckState((IMemberActionInfo[])getInput());
    if (topIndex < getTable().getItemCount())
      getTable().setTopIndex(topIndex); //see bug 31645
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@Override
ViewerCell getInitialFocusCell() {
  Table table = (Table) getViewer().getControl();
  if (!table.isDisposed() && table.getItemCount() > 0
      && !table.getItem(table.getTopIndex()).isDisposed()) {
    final ViewerRow aViewerRow = getViewer().getViewerRowFromItem(
        table.getItem(table.getTopIndex()));
    if (table.getColumnCount() == 0) {
      return aViewerRow.getCell(0);
    }
    Rectangle clientArea = table.getClientArea();
    for (int i = 0; i < table.getColumnCount(); i++) {
      if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i))
        return aViewerRow.getCell(i);
      }
    }
  return null;
}

相关文章

Table类方法