本文整理汇总了Java中com.google.gwt.user.cellview.client.TreeNode类的典型用法代码示例。如果您正苦于以下问题:Java TreeNode类的具体用法?Java TreeNode怎么用?Java TreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeNode类属于com.google.gwt.user.cellview.client包,在下文中一共展示了TreeNode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openNode
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
private boolean openNode(TreeNode node, TreePlace place) {
int childCount = node.getChildCount();
for (int i = 0; i < childCount; i++) {
if (node.getChildValue(i).equals(place)) {
//node.setChildOpen(i, true, true);
return true;
} else if (!node.isChildLeaf(i)) {
boolean wasOpen = node.isChildOpen(i);
TreeNode child = node.setChildOpen(i, true);
if (child != null && openNode(child, place)) {
return true;
} else if (!wasOpen) {
node.setChildOpen(i, false);
}
}
}
return false;
}
示例2: findNode
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
@Nullable
private TreeNode findNode(TreeNode node, String nodeId) {
int childCount = node.getChildCount();
for (int i = 0; i < childCount; i++) {
TreeNode child = node.getChild(i);
TreeState.TreeNodeState nodeState = (TreeState.TreeNodeState)child.getValue();
if (Objects.equals(nodeState.myId, nodeId)) {
return child;
}
TreeNode in = findNode(child, nodeId);
if (in != null) {
return in;
}
}
return null;
}
示例3: init
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
@Override
protected void init() {
super.init();
getTree().setChildrenOpenHandler(state -> getRpcProxy(TreeServerRpc.class).onOpen(state.myId));
getTree().setDoubleClickHandler((state) -> getRpcProxy(TreeServerRpc.class).onDoubleClick(state.myId));
getTree().getTreeViewModel().getSelectionModel().addSelectionChangeHandler(event -> {
TreeNode value = getTree().getKeyboardSelectedTreeNode();
TreeState.TreeNodeState childValue = (TreeState.TreeNodeState)value.getValue();
getRpcProxy(TreeServerRpc.class).onSelected(childValue.myId);
});
registerRpc(TreeClientRpc.class, new TreeClientRpc() {
@Override
public void expand(String nodeId) {
getTree().expand(nodeId);
}
});
}
示例4: setOpen
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
private void setOpen(TreeNode node, boolean open) {
if (node != null) {
for (int i = 0; i < node.getChildCount(); i++) {
if (!node.isChildLeaf(i)) {
setOpen(node.setChildOpen(i, open), open);
}
}
}
}
示例5: selectPlace
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
private void selectPlace(TreePlace place) {
TreeNode node = navigationView.getMenuTree().getRootTreeNode();
if (openNode(node, place)) {
navigationView.getSelectionModel().setSelected(place, true);
pendingPlace = null;
} else {
navigationView.getSelectionModel().clear();
}
}
示例6: refreshTree
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
private void refreshTree(TreeNode node) {
int childCount = node.getChildCount();
for (int i = 0; i < childCount; i++) {
if (!node.isChildLeaf(i) && node.isChildOpen(i)) {
node.setChildOpen(i, false);
TreeNode child = node.setChildOpen(i, true);
if (child != null) {
refreshTree(child);
}
}
}
}
示例7: ReportSelectListCellTree
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
public ReportSelectListCellTree(List<ResourceListItem> resourceList, MultiSelectionModel<ResourceListItem> selectionModel) {
super(new CustomTreeModel(resourceList, selectionModel), null, (CellTree.Resources)GWT.create(CustomCellTreeResource.class));
setDefaultNodeSize(10000);
TreeNode treeNode = getRootTreeNode();
for(int i = 0; i < treeNode.getChildCount(); i++) {
treeNode.setChildOpen(i, true);
}
}
示例8: expand
import com.google.gwt.user.cellview.client.TreeNode; //导入依赖的package包/类
public void expand(String nodeId) {
TreeNode node = findNode(getRootTreeNode(), nodeId);
if (node == null) {
return;
}
int index = node.getIndex();
node.getParent().setChildOpen(index, !node.getParent().isChildOpen(index));
}