List of usage examples for com.google.gwt.user.cellview.client TreeNode setChildOpen
TreeNode setChildOpen(int index, boolean open);
From source file:cimav.visorglass.client.widgets.model.ArbolModel.java
License:Apache License
public void expandTreeNode(TreeNode node) { for (int i = 0; i < node.getChildCount(); i++) { if (!node.isChildLeaf(i)) { expandTreeNode(node.setChildOpen(i, true)); }/*from w w w . jav a2 s.c o m*/ } }
From source file:com.eucalyptus.webui.client.view.DirectoryViewImpl.java
License:Open Source License
private void openAllNode(TreeNode root) { for (int i = 0; i < root.getChildCount(); i++) { root.setChildOpen(i, true); }/*from w ww . j a v a 2 s. c o m*/ }
From source file:com.github.gwt.sample.showcase.client.Showcase.java
License:Apache License
private void showInitialExample(final SingleSelectionModel<Widget> selectionModel) { final CellTree mainMenu = showCase.getMainMenu(); // Show the initial example. if (History.getToken().length() > 0) { History.fireCurrentHistoryState(); } else {/*from ww w . j av a 2 s . c o m*/ // Use the first token available. TreeNode root = mainMenu.getRootTreeNode(); TreeNode category = root.setChildOpen(0, true); Widget content = (Widget) category.getChildValue(0); selectionModel.setSelected(content, true); } }
From source file:com.google.gwt.examples.cellview.CellTreeExample2.java
License:Apache License
public void onModuleLoad() { // Create a model for the tree. TreeViewModel model = new CustomTreeModel(); /*/*from w ww . java2 s . c o m*/ * Create the tree using the model. We use <code>null</code> as the default * value of the root node. The default value will be passed to * CustomTreeModel#getNodeInfo(); */ CellTree tree = new CellTree(model, null); tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // Open the first playlist by default. TreeNode rootNode = tree.getRootTreeNode(); TreeNode firstPlaylist = rootNode.setChildOpen(0, true); firstPlaylist.setChildOpen(0, true); // Add the tree to the root layout panel. RootLayoutPanel.get().add(tree); }
From source file:com.gwt2go.dev.client.ui.LeftSide.java
License:Apache License
public LeftSide(final ClientFactory clientFactory) { TreeViewModel treeRooterModel = new CellTreeRooterModel(selectionModelPlaces); selectionModelPlaces.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override/* w w w .j a v a 2 s . com*/ public void onSelectionChange(SelectionChangeEvent event) { GotoPlacesModel selected = selectionModelPlaces.getSelectedObject(); if (selected != null) { // Window.alert("You selected to go: " // + selected.getGotoPlace()); clientFactory.getPlaceController().goTo(new RootPlace(selected.getGotoPlace())); } } }); // TODO: add selection with Enter keyboard cellTree3 = new CellTree(treeRooterModel, null); cellTree3.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // TreeNode rootNode = cellTree3.getRootTreeNode(); TreeNode firstPlaylist = rootNode.setChildOpen(0, true); firstPlaylist.setChildOpen(0, true); initWidget(uiBinder.createAndBindUi(this)); this.clientFactory = clientFactory; }
From source file:com.gwt2go.dev.client.ui.view.CellTreeExpl1ViewImpl.java
License:Apache License
public CellTreeExpl1ViewImpl(final ClientFactory clientFactory) { TreeViewModel model = new CustomTreeModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { String selected = selectionModel.getSelectedObject(); if (selected != null) { Window.alert("You selected: " + selected); }/*from ww w .j a v a2 s. c om*/ } }); // add the new tree cellTree2 = new CellTree(model, null); cellTree2.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // TreeNode rootNode = cellTree2.getRootTreeNode(); TreeNode firstPlaylist = rootNode.setChildOpen(0, true); firstPlaylist.setChildOpen(0, true); initWidget(uiBinder.createAndBindUi(this)); }
From source file:org.eclipse.emf.eef.runtime.ui.gwt.editor.widget.EEFTreeViewer.java
License:Open Source License
public void expand(List<?> path) { TreeNode node = getRootTreeNode(); if (node != null) { LOOP: for (int i = 0, size = path.size(); i < size; ++i) { Object segment = path.get(i); for (int j = 0, count = node.getChildCount(); j < count; ++j) { Object childValue = node.getChildValue(j); if (childValue.equals(segment)) { node = node.setChildOpen(j, true); continue LOOP; }//from w w w . j a v a2s . c om } break; } } }
From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java
License:Open Source License
public boolean doesNodeContainsResource(TreeNode node, RestResource resource) { int count = node.getChildCount(); for (int i = 0; i < count; i++) { if (node.isChildOpen(i)) { if (node.getChildValue(i) instanceof RestResource && ((RestResource) node.getChildValue(i)).equals(resource)) { return true; } else if (node.isChildOpen(i)) { TreeNode n = node.setChildOpen(i, true); if (n != null) return doesNodeContainsResource(n, resource); }//from w w w. j a v a 2 s.c o m } } return false; }
From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java
License:Open Source License
public boolean doesNodeContainsResource(TreeNode node, String resource) { int count = node.getChildCount(); for (int i = 0; i < count; i++) { if (node.getChildValue(i) instanceof RestResource && ((RestResource) node.getChildValue(i)).getUri().equals(resource)) { return true; } else if (node.isChildOpen(i)) { TreeNode n = node.setChildOpen(i, true); if (n != null) return doesNodeContainsResource(n, resource); }//from w w w .ja v a 2 s. c o m } return false; }
From source file:org.gss_project.gss.web.client.CellTreeViewUtils.java
License:Open Source License
public TreeNode getNodeContainingResource(TreeNode node, RestResource resource) { int count = node.getChildCount(); for (int i = 0; i < count; i++) { if (node.getChildValue(i) instanceof RestResource && ((RestResource) node.getChildValue(i)).getUri().equals(resource.getUri())) { return node; } else if (node.isChildOpen(i)) { TreeNode n = node.setChildOpen(i, true); if (n != null) return getNodeContainingResource(n, resource); }// www . j a v a2 s . co m } return null; }