]> source.dussan.org Git - vaadin-framework.git/commitdiff
avoiding ArrayOutOfBounds exception in some situations
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 17 Jun 2008 07:07:55 +0000 (07:07 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 17 Jun 2008 07:07:55 +0000 (07:07 +0000)
svn changeset:4903/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IGridLayout.java

index 4e6a55541cda50d8ae18cbe50a1f6e111acb0b3f..ac3a88883165ea6ac755859b654130f390ef6811 100644 (file)
@@ -137,32 +137,9 @@ public class IGridLayout extends SimplePanel implements Paintable, Container,
                             } else {
                                 w = 1;
                             }
-                            AlignmentInfo alignmentInfo = new AlignmentInfo(
-                                    alignments[alignmentIndex++]);
-
-                            VerticalAlignmentConstant va;
-                            if (alignmentInfo.isBottom()) {
-                                va = HasVerticalAlignment.ALIGN_BOTTOM;
-                            } else if (alignmentInfo.isTop()) {
-                                va = HasVerticalAlignment.ALIGN_TOP;
-                            } else {
-                                va = HasVerticalAlignment.ALIGN_MIDDLE;
-                            }
-
-                            HorizontalAlignmentConstant ha;
-
-                            if (alignmentInfo.isLeft()) {
-                                ha = HasHorizontalAlignment.ALIGN_LEFT;
-                            } else if (alignmentInfo.isHorizontalCenter()) {
-                                ha = HasHorizontalAlignment.ALIGN_CENTER;
-                            } else {
-                                ha = HasHorizontalAlignment.ALIGN_RIGHT;
-                            }
 
                             FlexCellFormatter formatter = (FlexCellFormatter) getCellFormatter();
 
-                            formatter.setAlignment(row, column, ha, va);
-
                             // set col span
                             formatter.setColSpan(row, column, w);
 
@@ -187,6 +164,31 @@ public class IGridLayout extends SimplePanel implements Paintable, Container,
 
                             final UIDL u = c.getChildUIDL(0);
                             if (u != null) {
+
+                                AlignmentInfo alignmentInfo = new AlignmentInfo(
+                                        alignments[alignmentIndex++]);
+
+                                VerticalAlignmentConstant va;
+                                if (alignmentInfo.isBottom()) {
+                                    va = HasVerticalAlignment.ALIGN_BOTTOM;
+                                } else if (alignmentInfo.isTop()) {
+                                    va = HasVerticalAlignment.ALIGN_TOP;
+                                } else {
+                                    va = HasVerticalAlignment.ALIGN_MIDDLE;
+                                }
+
+                                HorizontalAlignmentConstant ha;
+
+                                if (alignmentInfo.isLeft()) {
+                                    ha = HasHorizontalAlignment.ALIGN_LEFT;
+                                } else if (alignmentInfo.isHorizontalCenter()) {
+                                    ha = HasHorizontalAlignment.ALIGN_CENTER;
+                                } else {
+                                    ha = HasHorizontalAlignment.ALIGN_RIGHT;
+                                }
+
+                                formatter.setAlignment(row, column, ha, va);
+
                                 final Paintable child = client.getPaintable(u);
                                 CaptionWrapper wr;
                                 if (widgetToCaptionWrapper.containsKey(child)) {