Hi, doesn't anybody encounter the same problem ? I don't know if I misuse the framework or if there's a bug in the CellTree composite.
Thank you for all help you can give me. On 11 mar, 11:41, rujan <rudy.jan...@gmail.com> wrote: > I found another problem which finally seems to have the same cause : > in another tree, I have a AsyncDataProvider which updates the tree > when I select a value in a selectBox. > But when I select (in the selectBox) an item for which the tree to > display is empty, I have the same problem as explained before. > > It seems that it is possible to have an empty tree when creating it, > but if you update it so that it becomes empty, it generates some weird > behaviour. > > If someone has an idea of why this his happening, it will be very > helpful. > > On 10 mar, 15:37, rujan <rudy.jan...@gmail.com> wrote: > > > Hi all, > > > I am using the CellTree to add and remove nodes (on the same level, > > only a list of nodes). > > But I've encountered an exception when attempting to remove the last > > node of the CellTree : > > > Uncaught JavaScript exception [uncaught exception: > > java.lang.AssertionError: Child index out of bounds] in , line 0 > > > Here is my code ; > > > public class Test extends Composite { > > private static TestUiBinder uiBinder = > > GWT.create(TestUiBinder.class); > > > interface TestUiBinder extends UiBinder<Widget, Test> { > > } > > > @UiField(provided = true) > > CellTree rightTree; > > > @UiField > > PushButton removeEntity; > > > private SingleSelectionModel<EntiteDTO> rightTreeSelectionModel; > > private TreeViewModel rightTreeModel; > > private ListDataProvider<EntiteDTO> rightTreeProvider; > > > public Test() { > > init(); > > } > > > public void init() { > > createRightTree(); > > initWidget(uiBinder.createAndBindUi(this)); > > } > > > @UiHandler("removeEntity") > > public void onRemoveEntityClick(ClickEvent event) { > > EntiteDTO entSelected = > > rightTreeSelectionModel.getSelectedObject(); > > > Iterator<EntiteDTO> ite = > > rightTreeProvider.getList().iterator(); > > while (ite.hasNext()) { > > EntiteDTO ent = ite.next(); > > if (ent.getId().equals(entSelected.getId())) { > > ite.remove(); > > } > > } > > rightTreeProvider.refresh(); > > } > > > private void createRightTree() { > > CellTree.Resources res = > > GWT.create(CellTree.BasicResources.class); > > > rightTreeSelectionModel = new > > SingleSelectionModel<EntiteDTO>(); > > > rightTreeProvider = new ListDataProvider<EntiteDTO>(); > > rightTreeModel = new TreeViewModel() { > > > @Override > > public boolean isLeaf(Object value) { > > if (value == null) { > > return false; > > } > > return true; > > } > > > @Override > > public <T> NodeInfo<?> getNodeInfo(T value) { > > return new > > DefaultNodeInfo<EntiteDTO>(rightTreeProvider, new FolderEntityCell(), > > rightTreeSelectionModel, null); > > } > > }; > > > rightTree = new CellTree(rightTreeModel, null, res); > > rightTree.setAnimationEnabled(true); > > } > > > } > > > The FolderEntityCell is a cell with icon, and EntiteDTO just some > > POJO. > > > So I added some nodes to the rightTree with > > rightTreeProvider.getList().add(...) on the first level. > > > I can remove these nodes by clicking on the removeEntity PushButton, > > but when I want to remove the last one, it is removed on the browser, > > but a java.lang.AssertionError occur : > > > Uncaught JavaScript exception [uncaught exception: > > java.lang.AssertionError: Child index out of bounds] in , line 0 > > > So I'm wondering if I do something wrong in my removal process. > > > I hope you can help me on this point, and thank you in advance. > > > Cheers. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.