本文整理汇总了Java中org.eclipse.swt.widgets.TreeItem.getChecked方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getChecked方法的具体用法?Java TreeItem.getChecked怎么用?Java TreeItem.getChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getChecked方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateChildrenItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Updates the check state of all created children
*/
private void updateChildrenItems(TreeItem parent) {
boolean state = parent.getChecked();
// do not implicitly check children, only uncheck
if(state) {
return;
}
Item[] children = getChildren(parent);
for (int i = 0; i < children.length; i++) {
TreeItem curr = (TreeItem) children[i];
if (curr.getData() != null
&& ((curr.getChecked() != state) || curr.getGrayed())) {
curr.setChecked(state);
curr.setGrayed(false);
updateChildrenItems(curr);
}
}
}
示例2: updateParentItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Updates the check / gray state of all parent items
*/
private void updateParentItems(TreeItem item) {
if (item != null) {
Item[] children = getChildren(item);
boolean containsChecked = false;
boolean containsUnchecked = false;
for (int i = 0; i < children.length; i++) {
TreeItem curr = (TreeItem) children[i];
containsChecked |= curr.getChecked();
containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
}
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
updateParentItems(item.getParentItem());
}
}
示例3: getSelectedItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void getSelectedItems(TreeItem[] items, List<Node> selectedItems) {
if (items == null) {
return;
}
for (TreeItem item : items) {
Node parent = new Node(item.getText(), true);
TreeItem[] children = item.getItems();
if (children != null) {
boolean selected = false;
for (TreeItem child : children) {
if (child.getChecked()) {
parent.addChild(new Node(child.getText(), false));
selected = true;
}
}
if (selected) {
nodeListManager.addSelectedNode(parent);
}
}
}
}
示例4: initializeItem
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* The item has expanded. Updates the checked state of its children.
*/
private void initializeItem(TreeItem item) {
if (item.getChecked() && !item.getGrayed()) {
updateChildrenItems(item);
}
}