Saturday, April 2, 2011

CellTree question about varying cell composition

Hi All:

I have a CellTree and I want to use two different cells for the leaf
and branch nodes. The leaf nodes are all to have a checkbox and the
brances are not. Leaves and branches appear on the same levels.

I constructed a CompositeCell out of a CheckboxCell and a homegrown
cell (based on AbstractCell<T>), and I put a test in the
CompositeCell.render() method, that looked something like this:

if (cell instanceof CheckboxCell) {
if (value.isLeaf()) {
cell.render(context, hasCell.getValue(value), sb);
}
}

With this code, the checkbox cell wasn't rendered at all for the
branch nodes. This appeared to work at first, but selecting a branch
node would give me an error that seemed to be at the Javascript
level. It read: "(Typeerror) elem is null". None of my code was
identified in the stack trace, so I don't get what was wrong.

Can someone suggest what that error might have meant, or better,
suggest the right way to go about designing a cell that's different
for leaf and branch nodes that might be siblings in the CellTree.

Another question: when designing a cell to use, what is the right way
to test the values that will be displayed in that cell? Besides
including the checkbox or not, I'd like to vary the look based on
other parameters.

Many thanks,

-Tom

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate