本文整理了Java中org.eclipse.jface.viewers.ViewerDropAdapter.getBounds()
方法的一些代码示例,展示了ViewerDropAdapter.getBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewerDropAdapter.getBounds()
方法的具体详情如下:
包路径:org.eclipse.jface.viewers.ViewerDropAdapter
类名称:ViewerDropAdapter
方法名:getBounds
[英]Returns the bounds of the given SWT tree or table item.
[中]返回给定SWT树或表项的边界。
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Returns the position of the given event's coordinates relative to its target.
* The position is determined to be before, after, or on the item, based on
* some threshold value.
*
* @param event the event
* @return one of the <code>LOCATION_* </code>constants defined in this class
*/
protected int determineLocation(DropTargetEvent event) {
if (!(event.item instanceof Item)) {
return LOCATION_NONE;
}
Item item = (Item) event.item;
Point coordinates = new Point(event.x, event.y);
coordinates = viewer.getControl().toControl(coordinates);
Rectangle bounds = getBounds(item);
if (bounds == null) {
return LOCATION_NONE;
}
if ((coordinates.y - bounds.y) < 5) {
return LOCATION_BEFORE;
}
if ((bounds.y + bounds.height - coordinates.y) < 5) {
return LOCATION_AFTER;
}
return LOCATION_ON;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Returns the position of the given event's coordinates relative to its target.
* The position is determined to be before, after, or on the item, based on
* some threshold value.
*
* @param event the event
* @return one of the <code>LOCATION_* </code>constants defined in this class
*/
protected int determineLocation(DropTargetEvent event) {
if (!(event.item instanceof Item)) {
return LOCATION_NONE;
}
Item item = (Item) event.item;
Point coordinates = new Point(event.x, event.y);
coordinates = viewer.getControl().toControl(coordinates);
if (item != null) {
Rectangle bounds = getBounds(item);
if (bounds == null) {
return LOCATION_NONE;
}
if ((coordinates.y - bounds.y) < 5) {
return LOCATION_BEFORE;
}
if ((bounds.y + bounds.height - coordinates.y) < 5) {
return LOCATION_AFTER;
}
}
return LOCATION_ON;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Returns the position of the given event's coordinates relative to its target.
* The position is determined to be before, after, or on the item, based on
* some threshold value.
*
* @param event the event
* @return one of the <code>LOCATION_* </code>constants defined in this class
*/
protected int determineLocation(DropTargetEvent event) {
if (!(event.item instanceof Item)) {
return LOCATION_NONE;
}
Item item = (Item) event.item;
Point coordinates = new Point(event.x, event.y);
coordinates = viewer.getControl().toControl(coordinates);
if (item != null) {
Rectangle bounds = getBounds(item);
if (bounds == null) {
return LOCATION_NONE;
}
if ((coordinates.y - bounds.y) < 5) {
return LOCATION_BEFORE;
}
if ((bounds.y + bounds.height - coordinates.y) < 5) {
return LOCATION_AFTER;
}
}
return LOCATION_ON;
}
内容来源于网络,如有侵权,请联系作者删除!