本文整理匯總了Java中org.eclipse.swt.widgets.TreeItem.getGrayed方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeItem.getGrayed方法的具體用法?Java TreeItem.getGrayed怎麽用?Java TreeItem.getGrayed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getGrayed方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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);
}
}