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

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

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

Tree.getItems介绍

[英]Returns a (possibly empty) array of items contained in the receiver that are direct item children of the receiver. These are the roots of the tree.

Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.
[中]返回接收器中包含的项的数组(可能为空),这些项是接收器的直接项子项。这些是树的根。
注意:这不是接收方维护其项目列表所使用的实际结构,因此修改数组不会影响接收方。

代码示例

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

@Override
 public void widgetSelected( SelectionEvent selectionEvent ) {
  tidyBranches( selectionTree.getItems(), false );
 }
} );

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

@Override
 public void widgetSelected( SelectionEvent event ) {
  expandAllItems( wTree.getItems(), true );
 }
} );

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

@Override
 public void widgetSelected( SelectionEvent selectionEvent ) {
  tidyBranches( coreObjectsTree.getItems(), true );
 }
} );

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

@Override
 public void widgetSelected( SelectionEvent selectionEvent ) {
  tidyBranches( coreObjectsTree.getItems(), false );
 }
} );

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

@Override
 public void widgetSelected( SelectionEvent event ) {
  expandAllItems( wTree.getItems(), false );
 }
} );

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

@Override
 public void widgetSelected( SelectionEvent selectionEvent ) {
  tidyBranches( selectionTree.getItems(), true );
 }
} );

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

public void widgetSelected( SelectionEvent event ) {
  expandAllItems( wTree.getItems(), false );
 }
} );

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

public void widgetSelected( SelectionEvent event ) {
  expandAllItems( wTree.getItems(), true );
 }
} );

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

public static final TreeItem findTreeItem( Tree tree, String[] path ) {
 TreeItem[] items = tree.getItems();
 for ( int i = 0; i < items.length; i++ ) {
  TreeItem treeItem = findTreeItem( items[i], path, 0 );
  if ( treeItem != null ) {
   return treeItem;
  }
 }
 return null;
}

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

/**
 * Expand of collapse all TreeItems in the complete tree based on the values stored in memory.
 *
 * @param tree
 *          The tree to format.
 */
public static void setExpandedFromMemory( Tree tree, String treeName ) {
 TreeItem[] items = tree.getItems();
 for ( int i = 0; i < items.length; i++ ) {
  setExpandedFromMemory( tree, treeName, items[i] );
 }
}

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

public TreeItem getTreeItem( Tree tree ) {
 TreeItem[] items = tree.getItems();
 for ( TreeItem item : items ) {
  TreeItem treeItem = findTreeItem( item, 0 );
  if ( treeItem != null ) {
   return treeItem;
  }
 }
 return null;
}

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

protected void updateFilter() {
 pattern = null;
 filterString = null;
 if ( searchText != null && !searchText.isDisposed() && !Utils.isEmpty( searchText.getText() ) ) {
  if ( wbRegex.getSelection() ) {
   pattern = Pattern.compile( searchText.getText() );
  } else {
   filterString = searchText.getText().toUpperCase();
  }
 }
 refreshTree();
 if ( ( wbRegex.getSelection() && pattern != null ) || ( !wbRegex.getSelection() && filterString != null ) ) {
  while ( getNrEmptyFolders( wTree.getItems() ) > 0 ) {
   removeEmptyFolders( wTree.getItems() );
   try {
    Thread.sleep( 0, 1 );
   } catch ( InterruptedException e ) {
    // Ignore errors
   }
  }
  expandAllItems( wTree.getItems(), true );
 }
}

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

@Override
 public void treeExpanded( TreeEvent treeEvent ) {
  if ( props.getAutoCollapseCoreObjectsTree() ) {
   TreeItem treeItem = (TreeItem) treeEvent.item;
   /*
    * Trick for WSWT on Windows systems: a SelectionEvent is called after the TreeEvent if setSelection() is not
    * used here. Otherwise the first item in the list is selected as default and collapsed again but wrong, see
    * PDI-1480
    */
   coreObjectsTree.setSelection( treeItem );
   // expand the selected tree item, collapse the rest
   //
   for ( TreeItem item : coreObjectsTree.getItems() ) {
    if ( item != treeItem ) {
     item.setExpanded( false );
    } else {
     treeItem.setExpanded( true );
    }
   }
  }
 }
} );

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

@Override
 public void widgetSelected( SelectionEvent event ) {
  // expand the selected tree item, collapse the rest
  //
  if ( props.getAutoCollapseCoreObjectsTree() ) {
   TreeItem[] selection = coreObjectsTree.getSelection();
   if ( selection.length == 1 ) {
    // expand if clicked on the the top level entry only...
    //
    TreeItem top = selection[0];
    while ( top.getParentItem() != null ) {
     top = top.getParentItem();
    }
    if ( top == selection[0] ) {
     boolean expanded = top.getExpanded();
     for ( TreeItem item : coreObjectsTree.getItems() ) {
      item.setExpanded( false );
     }
     top.setExpanded( !expanded );
    }
   }
  }
 }
} );

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

for ( TreeItem item : wTree.getItems() ) {
 expandItemAndChildren( item );

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

public static final void setOptimalWidthOnColumns( Tree tree ) {
 int nrCols = tree.getColumnCount();
 int[] max = new int[nrCols];
 Image image = new Image( tree.getDisplay(), 10, 10 );
 GC gc = new GC( image );
 for ( int i = 0; i < max.length; i++ ) {
  TreeColumn treeColumn = tree.getColumn( i );
  Point point = gc.textExtent( treeColumn.getText() );
  max[i] = point.x;
 }
 getMaxWidths( tree.getItems(), max, gc );
 gc.dispose();
 image.dispose();
 for ( int i = 0; i < max.length; i++ ) {
  TreeColumn treeColumn = tree.getColumn( i );
  treeColumn.setWidth( max[i] + 30 );
 }
}

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

refreshCoreObjects();
if ( !Utils.isEmpty( designTreeToolbar.getSearchText() ) ) {
 tidyBranches( coreObjectsTree.getItems(), true ); // expand all
} else { // no filter: collapse all
 tidyBranches( coreObjectsTree.getItems(), false );

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

TreeItem[] expandItems = coreObjectsTree.getItems();
for ( TreeItem item : expandItems ) {
 item.dispose();

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

TreeItem item = searchMouseOverTreeItem( coreObjectsTree.getItems(), move.x, move.y );
if ( item != null ) {
 String name = item.getText();

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

viewTreeToolbar.setFocus();
if ( Utils.isEmpty( viewTreeToolbar.getSearchText() ) ) {
 tidyBranches( selectionTree.getItems(), false );

相关文章

Tree类方法