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

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

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

Table.toDisplay介绍

暂无

代码示例

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

/**
 * Bug with table widget,BUG 113015, the widget is not able to return the correct
 * table item if SWT.FULL_SELECTION is not on when the table is created.
 * Created the following function to work around the problem.
 * We can remove this method when the bug is fixed.
 * @param point the {@link Point} to get the {@link TableItem} from
 * @return the table item where the point is located, return null if the item cannot be located.
 */
private TableItem getItem(Point point)
{
  TableItem[] items = fTableViewer.getTable().getItems();
  for (int i=0; i<items.length; i++)
  {
    Point start = new Point(items[i].getBounds(0).x, items[i].getBounds(0).y);
    start = fTableViewer.getTable().toDisplay(start);
    Point end = new Point(start.x + items[i].getBounds(0).width, start.y + items[i].getBounds(0).height);
    if (start.y < point.y && point.y < end.y) {
      return items[i];
    }
  }
  return null;
}

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

/**
 * Bug with table widget,BUG 113015, the widget is not able to return the
 * correct table item if SWT.FULL_SELECTION is not on when the table is
 * created. Created the following function to work around the problem. We
 * can remove this method when the bug is fixed.
 *
 * @param point the given {@link Point} to find the {@link TableItem} for
 * @return the table item where the point is located, return null if the
 *         item cannot be located.
 */
private TableItem getItem(Point point) {
  TableItem[] items = fTableViewer.getTable().getItems();
  for (int i = 0; i < items.length; i++) {
    TableItem item = items[i];
    if (item.getData() != null) {
      Point start = new Point(item.getBounds(0).x, item.getBounds(0).y);
      start = fTableViewer.getTable().toDisplay(start);
      Point end = new Point(start.x + item.getBounds(0).width, start.y + item.getBounds(0).height);
      if (start.y < point.y && point.y < end.y) {
        return item;
      }
    }
  }
  return null;
}

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

/**
 * Method for figuring out which column the point is located.
 * @param point the {@link Point} to et the column number for
 * @return the column index where the point is located, return -1 if column is not found.
 */
private int getColumn(Point point) {
  int colCnt = fTableViewer.getTable().getColumnCount();
  if(fTableViewer.getTable().getItemCount() > 0) {
    TableItem item = fTableViewer.getTable().getItem(0);
    Point start, end;
    for (int i=0; i<colCnt; i++) {
      start = new Point(item.getBounds(i).x, item.getBounds(i).y);
      start = fTableViewer.getTable().toDisplay(start);
      end = new Point(start.x + item.getBounds(i).width, start.y + item.getBounds(i).height);
      if (start.x < point.x && end.x > point.x) {
        return i;
      }
    }
  }
  return -1;
}

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

/**
 * Method for figuring out which column the point is located.
 *
 * @param point the {@link Point} the get the column number for
 * @return the column index where the point is located, return -1 if column
 *         is not found.
 */
private int getColumn(Point point) {
  int colCnt = fTableViewer.getTable().getColumnCount();
  TableItem item = null;
  for (int i = 0; i < fTableViewer.getTable().getItemCount(); i++) {
    item = fTableViewer.getTable().getItem(i);
    if (item.getData() != null) {
      break;
    }
  }
  if (item != null) {
    for (int i = 0; i < colCnt; i++) {
      Point start = new Point(item.getBounds(i).x, item.getBounds(i).y);
      start = fTableViewer.getTable().toDisplay(start);
      Point end = new Point(start.x + item.getBounds(i).width, start.y + item.getBounds(i).height);
      if (start.x < point.x && end.x > point.x) {
        return i;
      }
    }
  }
  return -1;
}

代码示例来源:origin: openaudible/openaudible

Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle rect = item.getBounds(0);
Point pt = table.toDisplay(rect.x, rect.y);
tip.setBounds(pt.x, pt.y, size.x, size.y);
tip.setVisible(true);

代码示例来源:origin: BiglySoftware/BiglyBT

Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle rect = item.getBounds(item_index);
Point pt = buddy_table.toDisplay(rect.x, rect.y);
tip.setBounds(pt.x, pt.y, size.x, size.y);
tip.setVisible(true);

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

int itemHeightdiv4 = table.getItemHeight() / 4;
int tableHeight = table.getBounds().height;
Point tableLoc = table.toDisplay(0, 0);
int divCount = 0;

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt

int itemHeightdiv4 = table.getItemHeight() / 4;
int tableHeight = table.getBounds().height;
Point tableLoc = table.toDisplay(0, 0);
int divCount = 0;

相关文章

Table类方法