List of usage examples for com.google.gwt.user.client.ui LayoutPanel iterator
public Iterator<Widget> iterator()
From source file:org.gwt.mosaic.ui.client.layout.CustomGridLayout.java
License:Apache License
protected void buildWidgetMatrix(LayoutPanel layoutPanel) { int cursorX = 0; int cursorY = 0; widgetMatrix = new Widget[cols][rows]; for (Iterator<Widget> iter = layoutPanel.iterator(); iter.hasNext();) { Widget widget = iter.next();/*from w w w . j a v a2 s. c om*/ syncDecoratorVisibility(widget); if (!DOM.isVisible(widget.getElement())) { continue; } visibleChildList.add(widget); GridLayoutData layoutData = getLayoutData(widget); while (widgetMatrix[cursorX][cursorY] != null) { if (++cursorX >= cols) { cursorX = 0; if (++cursorY >= rows) { break; } } } for (int r = cursorY; r < (cursorY + layoutData.rowspan); r++) { if (r >= rows) { break; } for (int c = cursorX; c < (cursorX + layoutData.colspan); c++) { if (c >= cols) { break; } widgetMatrix[c][r] = SPAN; } } widgetMatrix[cursorX][cursorY] = widget; cursorX += layoutData.colspan; if (cursorX >= cols) { cursorX = 0; if (++cursorY >= rows) { break; } } } }