I wouldn't put it in the constructor anyway but create it all lazily. I use a SimpleComposite class that extends from Composite and will automatically call the abstract create() method when the creation of the actual widget is required. - Ed
On Wed, Dec 14, 2011 at 5:01 PM, Antoxa.c <[email protected]> wrote: > It does not generate any error. addCell(String text) just do nothing. > Problem appears when extending SimpleTable class. If call addCell > method in SimpleTable constructor all works fine: > > public class SimpleTable extends Widget { > private Element tr; > public SimpleTable() { > Element tableElem = DOM.createTable(); > Element bodyElem = DOM.createTBody(); > DOM.appendChild(tableElem, bodyElem); > setElement(tableElem); > tr = DOM.createTR(); > DOM.appendChild(bodyElem, tr); > > addCell("text 1"); // difference from previous code! Works! > } > > public void addCell(String text) { > Element td = DOM.createTD(); > td.setInnerText(text); > DOM.appendChild(tr, td); > } > } > > But why it does not work in extended class I do not understand... > > On Dec 14, 5:13 pm, Ed <[email protected]> wrote: > > Hard to tell as you code seems ok but you don't give any error details. > > Try to debug it and have a look at HorizontalPanel and VerticalPanel as > > they perform the same kind of actions and that works... > > I also do some table building myself like you are doing and 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
