You're trading off compile time simplicity at the expense of runtime efficiency, and it's a bad trade.
Rather than emitting java lines as you walk the XML, you can build a model of what you want to write. Once you're done with your traversal, you can write out a single call to resize(int, int), and then write the rest. On Fri, Jul 2, 2010 at 12:20 PM, <markovuksano...@gmail.com> wrote: > Ok, I had a look and just remembered why I used more calls to resize > methods. > > The GridParser walks through the Grid and on the fly calculates the > size. So if it comes to an element that doesn't fit into the current > grid element it expands it (either by number of columns, or rows - > depends which one is necessary). > > I thought it would be better to calculate the grid size as I walk > through the grid compared to walking it first time to get the size and > then once more to populate the elements. > > So if we had a grid like this > 1, 2, 4 > 5, 6 > 7, 8, 9, 10 > > The method would make three calls to resize columns when walking the > first row. Then expand to fit the next row and then add elements as > along as their number is less then 3. (as the current size of the grid > is 2, 3). The there would be one more resize rows call to expand for the > next row and one more resize columns call to resize columns to fit in > number 10. So in the end you would end up with grid size 3, 4. Does that > make sense? > > > http://gwt-code-reviews.appspot.com/154810/show > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors