本文整理了Java中org.eclipse.swt.widgets.Tree.setItemCount()
方法的一些代码示例,展示了Tree.setItemCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.setItemCount()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:setItemCount
[英]Sets the number of root-level items contained in the receiver.
[中]设置接收器中包含的根级别项目数。
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Removes all of the items from the receiver.
* <p>
* @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>
*
* @since 3.1
*/
public void removeAll () {
checkWidget ();
parent.setItemCount (this, 0);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Sets the number of root-level items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
setItemCount (0, count);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Sets the number of child items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
parent.setItemCount (this, count);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Sets the number of child items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
parent.setItemCount (handle, count);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Sets the number of root-level items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
setItemCount (0, count);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Sets the number of child items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
parent.setItemCount (handle, count);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Sets the number of child items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
parent.setItemCount (handle, count);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Sets the number of root-level items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
setItemCount (0, count);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Sets the number of child items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
int /*long*/ hwnd = parent.handle;
int /*long*/ hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle);
parent.setItemCount (count, handle, hItem);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Sets the number of root-level items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
int /*long*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
setItemCount (count, OS.TVGN_ROOT, hItem);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Sets the number of root-level items contained in the receiver.
*
* @param count the number of items
*
* @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>
*
* @since 3.2
*/
public void setItemCount (int count) {
checkWidget ();
checkItems ();
count = Math.max (0, count);
setItemCount (null, count);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public void run() {
if (internalIsInputOrEmptyPath(elementOrTreePath)) {
getTree().setItemCount(count);
return;
}
Widget[] items = internalFindItems(elementOrTreePath);
for (int i = 0; i < items.length; i++) {
TreeItem treeItem = (TreeItem) items[i];
treeItem.setItemCount(count);
}
}
});
代码示例来源:origin: ifedorenko/p2-browser
@Override
public void run()
{
treeViewer.getTree().setRedraw( false );
treeViewer.getTree().setItemCount( repositories.size() );
treeViewer.refresh();
if ( unitMatcher != null )
{
treeViewer.expandAll();
}
treeViewer.getTree().setRedraw( true );
}
} );
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
protected void internalAdd(Widget widget, Object parentElement,
Object[] childElements) {
if (contentProviderIsLazy) {
if (widget instanceof TreeItem) {
TreeItem ti = (TreeItem) widget;
int count = ti.getItemCount() + childElements.length;
ti.setItemCount(count);
ti.clearAll(false);
} else {
Tree t = (Tree) widget;
t.setItemCount(t.getItemCount() + childElements.length);
t.clearAll(false);
}
return;
}
super.internalAdd(widget, parentElement, childElements);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
protected void internalAdd(Widget widget, Object parentElement,
Object[] childElements) {
if (contentProviderIsLazy) {
if (widget instanceof TreeItem) {
TreeItem ti = (TreeItem) widget;
int count = ti.getItemCount() + childElements.length;
ti.setItemCount(count);
ti.clearAll(false);
} else {
Tree t = (Tree) widget;
t.setItemCount(t.getItemCount() + childElements.length);
t.clearAll(false);
}
return;
}
super.internalAdd(widget, parentElement, childElements);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
protected void internalAdd(Widget widget, Object parentElement,
Object[] childElements) {
if (contentProviderIsLazy) {
if (widget instanceof TreeItem) {
TreeItem ti = (TreeItem) widget;
int count = ti.getItemCount() + childElements.length;
ti.setItemCount(count);
ti.clearAll(false);
} else {
Tree t = (Tree) widget;
t.setItemCount(t.getItemCount() + childElements.length);
t.clearAll(false);
}
return;
}
super.internalAdd(widget, parentElement, childElements);
}
代码示例来源:origin: ifedorenko/p2-browser
void setDependencyTree( InstallableUnitDependencyTree dependencyTree )
{
hierarchyTreeViewer.getTree().setRedraw( false );
hierarchyTreeViewer.setInput( dependencyTree );
hierarchyTreeViewer.getTree().setItemCount( dependencyTree.getRootIncludedInstallableUnits().size() );
hierarchyTreeViewer.refresh();
if ( dependencyTree.size() < 100 )
{
hierarchyTreeViewer.expandAll();
}
else
{
hierarchyTreeViewer.expandToLevel( 2 );
}
hierarchyTreeViewer.getTree().setRedraw( true );
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* For a TreeViewer with a tree with the VIRTUAL style bit set, set the
* number of children of the given element or tree path. To set the number
* of children of the invisible root of the tree, you can pass the input
* object or an empty tree path.
*
* @param elementOrTreePath
* the element, or tree path
* @param count
*
* @since 3.2
*/
public void setChildCount(final Object elementOrTreePath, final int count) {
if (checkBusy())
return;
preservingSelection(() -> {
if (internalIsInputOrEmptyPath(elementOrTreePath)) {
getTree().setItemCount(count);
return;
}
Widget[] items = internalFindItems(elementOrTreePath);
for (Widget item : items) {
TreeItem treeItem = (TreeItem) item;
treeItem.setItemCount(count);
}
});
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* For a TreeViewer with a tree with the VIRTUAL style bit set, set the
* number of children of the given element or tree path. To set the number
* of children of the invisible root of the tree, you can pass the input
* object or an empty tree path.
*
* @param elementOrTreePath
* the element, or tree path
* @param count
*
* @since 3.2
*/
public void setChildCount(final Object elementOrTreePath, final int count) {
if (checkBusy())
return;
preservingSelection(() -> {
if (internalIsInputOrEmptyPath(elementOrTreePath)) {
getTree().setItemCount(count);
return;
}
Widget[] items = internalFindItems(elementOrTreePath);
for (Widget item : items) {
TreeItem treeItem = (TreeItem) item;
treeItem.setItemCount(count);
}
});
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Traverses the visible (expanded) part of the tree and updates child
* counts.
*
* @param parent the parent of the widget, or <code>null</code> if the widget is the tree
* @param widget
* @param element
* @param index the index of the widget in the children array of its parent, or 0 if the widget is the tree
*/
private void virtualRefreshExpandedItems(Widget parent, Widget widget, Object element, int index) {
if (widget instanceof Tree) {
if (element == null) {
((Tree) widget).setItemCount(0);
return;
}
virtualLazyUpdateChildCount(widget, getChildren(widget).length);
} else if (((TreeItem) widget).getExpanded()) {
// prevent SetData callback
((TreeItem)widget).setText(" "); //$NON-NLS-1$
virtualLazyUpdateWidget(parent, index);
} else {
return;
}
Item[] items = getChildren(widget);
for (int i = 0; i < items.length; i++) {
Item item = items[i];
Object data = item.getData();
virtualRefreshExpandedItems(widget, item, data, i);
}
}
内容来源于网络,如有侵权,请联系作者删除!