gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.52k stars 374 forks source link

CellTreeNodeView doesn't consult isLeaf for open nodes #5813

Closed dankurka closed 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 5814

Found in GWT Release 2.1.1

Encountered on WinXP / Fire Fox 3.6.9

Detailed description:

When using a CellTree and modifying an expanded/open node's children with a call to
updateRowCount(0, true), the + icon doesn't disappear and a "no data" label is shown.
 Even if the node itself is updated in the parent, because it's open, isLeaf is never
consulted.

          // Add the open/close icon.
          SafeHtml image;
          if (isOpen) {
            image = openImage;
          } else if (model.isLeaf(value)) {
            image = LEAF_IMAGE;
          } else {
            image = closedImage;
          }

Worse still, with 2.1.1, once a node is in this state ("no data"), the whole tree stops
working.  I.e., no other node can be expanded, only collapsed.  This makes the generated
EMF editor (http://wiki.eclipse.org/EMF/GWT) essentially useless. 

Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):

It's not so easy to build a test case to show this problem, but I'm sure any existing
tree example will have this problem if you add a bit of logic to call updateRowSize(0,
true) on an open node...

Workaround if you have one:

In the past I copied a whole whack of GWT classes to fix the bugs, but that's not practical
for a project hosted at Eclipse.  My forum posting about this issue suggested a fix,
but the thread just went silent.

Links to relevant GWT Developer Forum posts:

http://groups.google.com/group/google-web-toolkit/browse_thread/thread/ae45fc97b0d61473/646ace6ce5edd22e?lnk=gst&q=merks#646ace6ce5edd22e

Reported by Ed.Merks on 2010-12-24 02:41:03

dankurka commented 9 years ago
From JohnL: I don't think its really a bug, although we can probably improve the behavior.
 He's basically saying that he can't convert a node from a non-leaf to a leaf node,
which is true.  He would have to close and reopen the parent node to get it to reconsult
isLeaf.  We can add options to the API to recheck isLeaf, or even just do it automatically.

Reported by rjrjr@google.com on 2011-01-19 19:26:39

dankurka commented 9 years ago
Any user who sees "no data" displayed, unindented, as the children of the node will
most certainly consider that a bug.  After all, imagine the common case we have in
our generated EMF editor: the user selects a node, creates a new child, the node is
expanded to show the new child, and then he invokes undo.  He expects the old state
to be back.  In actual fact, what happens is he ends up with "no data" being displayed,
which looks totally wrong.  Not only that, with 2.1.1, the whole tree is broken at
this point; it's no longer possible to expand any nodes anywhere in the tree.  So the
problem is beyond cosmetics.

If there's anything I can do to help fix this problem, I'm more than happy to help
out.  I have a demo for this at EclipseCon and this problem makes for a very bad demo:

  https://www.eclipsecon.org/submissions/2011/view_talk.php?id=2245

I'd really like to show off how awesome the EMF/GWT combination is for building a fully
functional web application in just a few minutes...

Reported by Ed.Merks on 2011-01-19 21:37:05

dankurka commented 9 years ago
There is a difference between an empty node and a leaf node.  Empty nodes can have items
added at some point, whereas leaf nodes cannot.  However, your point is taken that
you may want to convert a node to a leaf node if its children are removed.

Are you also saying that CellTree doesn't work at all with 2.1.1?  It worked fine in
the GWT Showcase.  Are any of the nodes ever expandable?

Reported by jlabanca@google.com on 2011-01-20 03:19:56

dankurka commented 9 years ago
In my application I'm definitely able to update a node that starts out as a leaf or
is empty (no + sign---I'm not sure what the distinction between empty and leaf is)
to have children (not empty and not a leaf) and then to expand to those children. But
I'm not able to do the reverse.  When I try to do the reverse "no data" is displayed
and once that appears somewhere in the tree, the whole tree stops working (expanded
nodes can be collapse, but once collapsed they can't be expanded nor can any nodes
be expanded). That behavior is unique to 2.1.1; in 2.1.0 the tree didn't stop working
entirely, it just looked ugly.

Reported by Ed.Merks on 2011-01-20 17:19:09

dankurka commented 9 years ago

Reported by jlabanca@google.com on 2011-04-13 21:02:32

dankurka commented 9 years ago

Reported by dankurka@google.com on 2013-06-02 18:45:30