本文整理了Java中com.google.gwt.user.client.ui.Tree.getItem()
方法的一些代码示例,展示了Tree.getItem()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getItem()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Tree
类名称:Tree
方法名:getItem
[英]Gets the top-level tree item at the specified index.
[中]获取指定索引处的顶级树项。
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Removes all items from the root level of this tree.
*/
@Override
public void removeItems() {
while (getItemCount() > 0) {
removeItem(getItem(0));
}
}
代码示例来源:origin: stackoverflow.com
Tree tree = (Tree) event.getSource();
if (tree.getItem(new Point(event.x, event.y)) != null)
// an item was clicked.
else
// no item was clicked.
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Removes all items from the root level of this tree.
*/
@Override
public void removeItems() {
while (getItemCount() > 0) {
removeItem(getItem(0));
}
}
代码示例来源:origin: stackoverflow.com
Tree tree1 = ...;
Tree tree2 = ...;
int topIndex = tree1.indexOf(tree1.getTopItem());
tree2.setTopItem(tree2.getItem(topIndex));
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Removes all items from the root level of this tree.
*/
@Override
public void removeItems() {
while (getItemCount() > 0) {
removeItem(getItem(0));
}
}
代码示例来源:origin: stackoverflow.com
TreeItem item = tree2.getTopItem();
int i = tree2.indexOf(item);
item = tree1.getItem(i);
tree1.setTopItem(item);
代码示例来源:origin: org.eagle-i/eagle-i-search-gwt
TreeItem findGroupItem( String groupName ) {
for (int i = 0; i < groupTree.getItemCount(); i++) {
TreeItem groupItem = groupTree.getItem( i );
if (((GroupWidget) groupItem.getWidget()).name.equals( groupName )) {
return groupItem;
}
}
return null;
}
代码示例来源:origin: stackoverflow.com
TreeItem item = tree.getItem(pt);
int index = tree.indexOf(item);
System.out.println("Item Index-" + index);
代码示例来源:origin: oVirt/ovirt-engine
private void updateTreeState() {
newSelectedItems.clear();
for (int i = 0; i < tree.getItemCount(); i++) {
updateItemSelection(tree.getItem(i));
}
selectedItems.clear();
selectedItems.addAll(newSelectedItems);
onItemsSelection();
}
代码示例来源:origin: kiegroup/drools-wb
public void setDSLSentences( final List<DSLSentence> dslSentences ) {
if ( tree.getItem( 0 ) != null ) {
tree.clear();
}
if ( dslSentences != null ) {
for ( DSLSentence dslSentence : dslSentences ) {
final TreeItem it = new TreeItem();
it.setHTML( "<small>" + dslSentence.toString() + "</small>" );
it.setUserObject( dslSentence );
tree.addItem( it );
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
private void saveTreeState() {
oldItemStatesMap.clear();
for (int i = 0; i < tree.getItemCount(); i++) {
TreeItem rootItem = tree.getItem(i);
oldRootItemsMap.put(rootItem.getUserObject(), rootItem);
saveTreeItemState(rootItem);
}
}
代码示例来源:origin: org.kie.guvnor/guvnor-categories-editor-client
public void addChildren( final CategoryItem parent,
final String name,
final String description ) {
final CategoryItem child = parent.addChildren( name, description );
final TreeItem parentTree;
if ( getSelectedCategory() == null ) {
parentTree = navTreeWidget.getItem( 0 );
} else {
parentTree = navTreeWidget.getSelectedItem();
}
final TreeItem ct = buildTreeItem( child );
parentTree.addItem( ct );
parentTree.setState( true );
}
代码示例来源:origin: oVirt/ovirt-engine
TreeItem findSelectedTreeItemRecursive(TreeItem item, int x, int y) {
if (null == item) {
int count = tree.getItemCount();
for (int i = 0; i < count; i++) {
TreeItem selected = findSelectedTreeItemRecursive(tree.getItem(i), x, y);
if (selected != null) {
return selected;
}
}
return null;
}
int count = item.getChildCount();
for (int i = 0; i < count; i++) {
TreeItem selected = findSelectedTreeItemRecursive(item.getChild(i), x, y);
if (selected != null) {
return selected;
}
}
if (x >= item.getAbsoluteLeft()
&& x <= item.getAbsoluteLeft() + item.getOffsetWidth()
&& y >= item.getAbsoluteTop()
&& y <= item.getAbsoluteTop() + item.getOffsetHeight()) {
return item;
}
return null;
}
}
代码示例来源:origin: kiegroup/drools-wb
public void setFullyQualifiedClassNames( final List<String> fullyQualifiedClassNames ) {
if ( tree.getItem( 0 ) != null ) {
tree.clear();
}
if ( fullyQualifiedClassNames != null ) {
for ( String type : fullyQualifiedClassNames ) {
final TreeItem it = new TreeItem();
it.setHTML( AbstractImagePrototype.create( DRLTextEditorResources.INSTANCE.images().classImage() ).getHTML()
+ "<small style=\"cursor: pointer\">"
+ type + "</small>" );
it.setUserObject( new ClassUserObject( type + "( )",
type ) );
tree.addItem( it );
it.addItem( Util.toSafeHtml( LAZY_LOAD ) );
}
}
}
代码示例来源:origin: org.kie.guvnor/guvnor-drl-text-editor-client
public void setDataModel( final DataModelOracle dataModel ) {
if ( tree.getItem( 0 ) != null ) {
tree.clear();
}
if ( dataModel.getFactTypes() != null ) {
for ( String type : dataModel.getFactTypes() ) {
TreeItem it = new TreeItem();
it.setHTML( AbstractImagePrototype.create( ImageResources.INSTANCE.classImage() ).getHTML()
+ "<small>"
+ type + "</small>" );
it.setUserObject( type + "( )" );
tree.addItem( it );
String[] fields = dataModel.getFieldCompletions( type );
if ( fields != null ) {
for ( String field : fields ) {
TreeItem fi = new TreeItem();
fi.setHTML( AbstractImagePrototype.create( ImageResources.INSTANCE.field() ).getHTML()
+ "<small>"
+ field + "</small>" );
fi.setUserObject( field );
it.addItem( fi );
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!