John, thanks for the idea, but the goal is to identify a particular
cell to permit the change of a whole set of parameters when a
particular cell is selected, not just the text in the cell.  I don't
want to show all the parameters in the tree, just the label for them.
The goal would be to pop a dialog box once the cell is selected to
allow the user to enter all the additional information.  The tree
construct is useful because it shows the relationships between the
various nodes.

On Nov 20, 6:03 pm, John LaBanca <jlaba...@google.com> wrote:
> Have you tried EditTextCell?  It shows readonly text, but turns into a Text
> Box when you click on it.  Sounds like what you want.
>
> Thanks,
> John LaBanca
> jlaba...@google.com
>
>
>
>
>
>
>
> On Sat, Nov 20, 2010 at 11:45 AM, dleins <dle...@gmail.com> wrote:
> > I've succeeded in displaying a dynamic Celltree from my database of
> > nodes, but cannot figure out how to make the displayed TextCells
> > clickable so that I may edit them, add additional children, etc.  I
> > admit I am rather a novice using the new Cell Widgets.
>
> > Here is the stripped down code. I have left out the code that
> > generates my arraylist of tree node (alNodes).  Any help, thoughts or
> > suggestions would be greatly appreciated.  A simple example that
> > popped a Window.alert when a TextCell was clicked would be more than
> > sufficient!  Perhaps a ClickableTextCell would work?
>
> >        private class CustomTreeModel implements TreeViewModel {
>
> >                public <T> NodeInfo<?> getNodeInfo(T value) {
> >                        ListDataProvider<String> dataProvider = new
> > ListDataProvider<String>();
>
> >                        String type = "";
> >                        Integer parent = 0;
> >                        Integer child = 0;
>
> >                        // for the root of the tree
> >                        if (value == null) {
> >                                for (int i = 0; i < alNodes.size(); i++) {
> >                                        if (alNodes.get(i).ruid == startnode
> >  && alNodes.get(i).type ==
> > "S") {
>
> >  dataProvider.getList().add(alNodes.get(i).title);
> >                                                break;
> >                                        }
> >                                }
> >                        } else {
> >                                // get the current node info from
> > alNodes ArrayList
> >                                for (int i = 0; i < alNodes.size(); i++) {
> >                                        if
> > (alNodes.get(i).title.equals(value)) {
> >                                                type = alNodes.get(i).type;
> >                                                parent =
> > alNodes.get(i).ruid;
> >                                                child =
> > alNodes.get(i).destSituation;
> >                                        }
> >                                }
> >                                // Depending on the type of the
> > current node, find the child or children for the dataprovider for the
> > next level
> >                                if (type.equals("A")) {
> >                                    for (int j = 0; j < alNodes.size(); j++)
> > {
> >                                                if (alNodes.get(j).ruid ==
> > child) {
>
> >  dataProvider.getList().add(alNodes.get(j).title);
> >                                                        break;  //  Note
> > that "A" type nodes will only have a single
> > child
> >                                                }
> >                                    }
> >                                } else {
> >                                        for (int j = 0; j < alNodes.size();
> > j++) {
> >                                                if
> > (alNodes.get(j).parentSituation == parent) {
>
> >  dataProvider.getList().add(alNodes.get(j).title);
> >                                                }
> >                                        }
> >                                }
> >                        }
>
> >                        return new DefaultNodeInfo<String>(dataProvider, new
> > TextCell());
> >                }
>
> >                public boolean isLeaf(Object value) {
> >                        String type = "";
> >                        Integer parent = 0;
> >                        Integer child = 0;
> >                        for (int i = 0; i < alNodes.size(); i++) {
> >                                if (alNodes.get(i).title.equals(value)) {
> >                                        type = alNodes.get(i).type;
> >                                        parent = alNodes.get(i).ruid;
> >                                        child =
> > alNodes.get(i).destSituation;
> >                                }
> >                        }
> >                        if (type.equals("A")) {
> >                            for (int j = 0; j < alNodes.size(); j++) {
> >                                        if (alNodes.get(j).ruid == child) {
> >                                                return false;
> >                                        }
> >                            }
> >                        } else {
> >                                for (int j = 0; j < alNodes.size(); j++) {
> >                                        if (alNodes.get(j).parentSituation
> > == parent) {
> >                                                return false;
> >                                        }
> >                                }
> >                        }
> >                        return true;
> >                }
> >        }
>
> >        public void onModuleLoad() {
>
> >            Button button = new Button("Start Simulation Editor");
> >            button.addClickHandler(new ClickHandler() {
> >                public void onClick(ClickEvent event) {
> >                    TreeViewModel model = new CustomTreeModel();
> >                    CellTree tree = new CellTree(model, null);
> >                    RootPanel.get().add(tree);
> >                }
> >            });
> >            RootPanel.get().add(button);
> > //  There is code here that populates the alNodes ArrayList.  It works
> > fine.
> >        }
>
> > --
> > 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-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2Bunsubs 
> > cr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-tool...@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.

Reply via email to