You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/07/14 18:06:43 UTC
svn commit: r793956 - in /incubator/pivot/trunk/wtk:
src/org/apache/pivot/wtk/ src/org/apache/pivot/wtk/skin/
test/org/apache/pivot/wtk/test/
Author: gbrown
Date: Tue Jul 14 16:06:42 2009
New Revision: 793956
URL: http://svn.apache.org/viewvc?rev=793956&view=rev
Log:
Resolve PIVOT-164 ("Create new FlowPane that adheres to AWT FlowLayout behavior"); minor fixes/updates to BoxPaneSkin.
Added:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/FlowPane.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/flow_pane_test.wtkx
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/image_view_test.wtkx
Added: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/FlowPane.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/FlowPane.java?rev=793956&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/FlowPane.java (added)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/FlowPane.java Tue Jul 14 16:06:42 2009
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.wtk;
+
+/**
+ * Container that arranges components in a horizontal line, wrapping when
+ * contents don't fit on a single line.
+ *
+ * @author gbrown
+ */
+public class FlowPane extends Container {
+ public FlowPane() {
+ installSkin(FlowPane.class);
+ }
+}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=793956&r1=793955&r2=793956&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Tue Jul 14 16:06:42 2009
@@ -26,6 +26,7 @@
import org.apache.pivot.wtk.skin.BorderSkin;
import org.apache.pivot.wtk.skin.CardPaneSkin;
import org.apache.pivot.wtk.skin.BoxPaneSkin;
+import org.apache.pivot.wtk.skin.FlowPaneSkin;
import org.apache.pivot.wtk.skin.ImageViewSkin;
import org.apache.pivot.wtk.skin.LabelSkin;
import org.apache.pivot.wtk.skin.MovieViewSkin;
@@ -70,8 +71,9 @@
public Theme() {
componentSkinMap.put(Border.class, BorderSkin.class);
- componentSkinMap.put(CardPane.class, CardPaneSkin.class);
componentSkinMap.put(BoxPane.class, BoxPaneSkin.class);
+ componentSkinMap.put(CardPane.class, CardPaneSkin.class);
+ componentSkinMap.put(FlowPane.class, FlowPaneSkin.class);
componentSkinMap.put(ImageView.class, ImageViewSkin.class);
componentSkinMap.put(Label.class, LabelSkin.class);
componentSkinMap.put(MovieView.class, MovieViewSkin.class);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java?rev=793956&r1=793955&r2=793956&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java Tue Jul 14 16:06:42 2009
@@ -59,10 +59,10 @@
}
public int getPreferredWidth(int height) {
- int preferredWidth = 0;
-
BoxPane boxPane = (BoxPane)getComponent();
+ int preferredWidth = 0;
+
Orientation orientation = boxPane.getOrientation();
if (orientation == Orientation.HORIZONTAL) {
// Include padding in constraint
@@ -71,19 +71,19 @@
}
// Preferred width is the sum of the preferred widths of all components
- int i = 0;
- for (int j = 0, n = boxPane.getLength(); j < n; j++) {
- Component component = boxPane.get(j);
+ int j = 0;
+ for (int i = 0, n = boxPane.getLength(); i < n; i++) {
+ Component component = boxPane.get(i);
if (component.isDisplayable()) {
preferredWidth += component.getPreferredWidth(height);
- i++;
+ j++;
}
}
// Include spacing
- if (i > 1) {
- preferredWidth += spacing * (i - 1);
+ if (j > 1) {
+ preferredWidth += spacing * (j - 1);
}
} else {
// Preferred width is the maximum preferred width of all components
@@ -92,7 +92,7 @@
if (component.isDisplayable()) {
preferredWidth = Math.max(preferredWidth,
- component.getPreferredWidth(-1));
+ component.getPreferredWidth());
}
}
}
@@ -104,10 +104,10 @@
}
public int getPreferredHeight(int width) {
- int preferredHeight = 0;
-
BoxPane boxPane = (BoxPane)getComponent();
+ int preferredHeight = 0;
+
Orientation orientation = boxPane.getOrientation();
if (orientation == Orientation.VERTICAL) {
// Include padding in constraint
@@ -116,19 +116,19 @@
}
// Preferred height is the sum of the preferred heights of all components
- int i = 0;
- for (int j = 0, n = boxPane.getLength(); j < n; j++) {
+ int j = 0;
+ for (int i = 0, n = boxPane.getLength(); i < n; i++) {
Component component = boxPane.get(i);
if (component.isDisplayable()) {
preferredHeight += component.getPreferredHeight(width);
- i++;
+ j++;
}
}
// Include spacing
- if (i > 1) {
- preferredHeight += spacing * (i - 1);
+ if (j > 1) {
+ preferredHeight += spacing * (j - 1);
}
} else {
// Preferred height is the maximum preferred height of all components
@@ -137,7 +137,7 @@
if (component.isDisplayable()) {
preferredHeight = Math.max(preferredHeight,
- component.getPreferredHeight(-1));
+ component.getPreferredHeight());
}
}
}
@@ -149,29 +149,29 @@
}
public Dimensions getPreferredSize() {
+ BoxPane boxPane = (BoxPane)getComponent();
+
int preferredWidth = 0;
int preferredHeight = 0;
- BoxPane boxPane = (BoxPane)getComponent();
-
switch (boxPane.getOrientation()) {
case HORIZONTAL: {
// Preferred width is the sum of the preferred widths of all components
- int i = 0;
- for (int j = 0, n = boxPane.getLength(); j < n; j++) {
- Component component = boxPane.get(j);
+ int j = 0;
+ for (int i = 0, n = boxPane.getLength(); i < n; i++) {
+ Component component = boxPane.get(i);
if (component.isDisplayable()) {
Dimensions preferredSize = component.getPreferredSize();
preferredWidth += preferredSize.width;
preferredHeight = Math.max(preferredSize.height, preferredHeight);
- i++;
+ j++;
}
}
// Include spacing
- if (i > 1) {
- preferredWidth += spacing * (i - 1);
+ if (j > 1) {
+ preferredWidth += spacing * (j - 1);
}
break;
@@ -179,21 +179,21 @@
case VERTICAL: {
// Preferred height is the sum of the preferred heights of all components
- int i = 0;
- for (int j = 0, n = boxPane.getLength(); j < n; j++) {
- Component component = boxPane.get(j);
+ int j = 0;
+ for (int i = 0, n = boxPane.getLength(); i < n; i++) {
+ Component component = boxPane.get(i);
if (component.isDisplayable()) {
Dimensions preferredSize = component.getPreferredSize();
preferredWidth = Math.max(preferredSize.width, preferredWidth);
preferredHeight += preferredSize.height;
- i++;
+ j++;
}
}
// Include spacing
- if (i > 1) {
- preferredHeight += spacing * (i - 1);
+ if (j > 1) {
+ preferredHeight += spacing * (j - 1);
}
break;
@@ -219,21 +219,21 @@
int preferredWidth = (fill) ? getPreferredWidth(height) : getPreferredWidth(-1);
// Determine the starting x-coordinate
- int componentX = 0;
+ int x = 0;
switch (horizontalAlignment) {
case CENTER: {
- componentX = (int)Math.round((double)(width - preferredWidth) / 2);
+ x = (width - preferredWidth) / 2;
break;
}
case RIGHT: {
- componentX = width - preferredWidth;
+ x = width - preferredWidth;
break;
}
}
- componentX += padding.left;
+ x += padding.left;
// Lay out the components
for (int i = 0; i < n; i++) {
@@ -242,10 +242,9 @@
if (component.isDisplayable()) {
int componentWidth = 0;
int componentHeight = 0;
- int componentY = 0;
+ int y = 0;
if (fill) {
- componentY = padding.top;
componentHeight = Math.max(height - (padding.top
+ padding.bottom), 0);
componentWidth = component.getPreferredWidth(componentHeight);
@@ -257,31 +256,30 @@
switch (verticalAlignment) {
case TOP: {
- componentY = padding.top;
+ y = padding.top;
break;
}
case CENTER: {
- componentY = (int)Math.round((double)(height - componentHeight) / 2);
+ y = (height - componentHeight) / 2;
break;
}
case BOTTOM: {
- componentY = height - padding.bottom
- - componentHeight;
+ y = height - padding.bottom - componentHeight;
break;
}
}
// Set the component's size and position
component.setSize(componentWidth, componentHeight);
- component.setLocation(componentX, componentY);
+ component.setLocation(x, y);
// Ensure that the component is visible
component.setVisible(true);
// Increment the x-coordinate
- componentX += componentWidth + spacing;
+ x += componentWidth + spacing;
} else {
// Hide the component
component.setVisible(false);
@@ -291,21 +289,21 @@
int preferredHeight = (fill) ? getPreferredHeight(width) : getPreferredHeight(-1);
// Determine the starting y-coordinate
- int componentY = 0;
+ int y = 0;
switch (verticalAlignment) {
case CENTER: {
- componentY = (int)Math.round((double)(height - preferredHeight) / 2);
+ y = (height - preferredHeight) / 2;
break;
}
case BOTTOM: {
- componentY = height - preferredHeight;
+ y = height - preferredHeight;
break;
}
}
- componentY += padding.top;
+ y += padding.top;
// Lay out the components
for (int i = 0; i < n; i++) {
@@ -314,10 +312,9 @@
if (component.isDisplayable()) {
int componentWidth = 0;
int componentHeight = 0;
- int componentX = 0;
+ int x = 0;
if (fill) {
- componentX = padding.left;
componentWidth = Math.max(width - (padding.left
+ padding.right), 0);
componentHeight = component.getPreferredHeight(componentWidth);
@@ -329,31 +326,30 @@
switch (horizontalAlignment) {
case LEFT: {
- componentX = padding.left;
+ x = padding.left;
break;
}
case CENTER: {
- componentX = (int)Math.round((double)(width - componentWidth) / 2);
+ x = (width - componentWidth) / 2;
break;
}
case RIGHT: {
- componentX = width - padding.right
- - componentWidth;
+ x = width - padding.right - componentWidth;
break;
}
}
// Set the component's size and position
component.setSize(componentWidth, componentHeight);
- component.setLocation(componentX, componentY);
+ component.setLocation(x, y);
// Ensure that the component is visible
component.setVisible(true);
// Increment the y-coordinate
- componentY += componentHeight + spacing;
+ y += componentHeight + spacing;
} else {
// Hide the component
component.setVisible(false);
Added: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java?rev=793956&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java (added)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java Tue Jul 14 16:06:42 2009
@@ -0,0 +1,370 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.wtk.skin;
+
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.Dimensions;
+import org.apache.pivot.wtk.FlowPane;
+import org.apache.pivot.wtk.HorizontalAlignment;
+import org.apache.pivot.wtk.Insets;
+
+public class FlowPaneSkin extends ContainerSkin {
+ private HorizontalAlignment alignment = HorizontalAlignment.LEFT;
+ private Insets padding = new Insets(2);
+ private int horizontalSpacing = 2;
+ private int verticalSpacing = 2;
+ private boolean alignToBaseline = false;
+
+ @Override
+ public void install(Component component) {
+ super.install(component);
+ }
+
+ @Override
+ public void uninstall() {
+ super.uninstall();
+ }
+
+ @Override
+ public int getPreferredWidth(int height) {
+ FlowPane flowPane = (FlowPane)getComponent();
+
+ int preferredWidth = 0;
+
+ // Preferred width is the sum of the preferred widths of all components
+ // (height constraint is ignored)
+ int j = 0;
+ for (int i = 0, n = flowPane.getLength(); i < n; i++) {
+ Component component = flowPane.get(i);
+
+ if (component.isDisplayable()) {
+ preferredWidth += component.getPreferredWidth();
+ j++;
+ }
+ }
+
+ // Include spacing
+ if (j > 1) {
+ preferredWidth += horizontalSpacing * (j - 1);
+ }
+
+ // Include left and right padding values
+ preferredWidth += padding.left + padding.right;
+
+ return preferredWidth;
+ }
+
+ @Override
+ public int getPreferredHeight(int width) {
+ FlowPane flowPane = (FlowPane)getComponent();
+
+ int preferredHeight = 0;
+
+ if (width == -1) {
+ // Preferred height is the maximum preferred height of all components
+ for (int i = 0, n = flowPane.getLength(); i < n; i++) {
+ Component component = flowPane.get(i);
+
+ if (component.isDisplayable()) {
+ preferredHeight = Math.max(preferredHeight,
+ component.getPreferredHeight());
+ }
+ }
+ } else {
+ // Include padding in width constraint
+ width = Math.max(width - (padding.left + padding.right), 0);
+
+ // Break the components into multiple rows
+ int rowCount = 0;
+ int rowHeight = 0;
+
+ int fieldCount = 0;
+ int rowWidth = 0;
+
+ for (int i = 0, n = flowPane.getLength(); i < n; i++) {
+ Component component = flowPane.get(i);
+
+ if (component.isDisplayable()) {
+ Dimensions componentSize = component.getPreferredSize();
+
+ if (rowWidth + componentSize.width > width
+ && rowWidth > 0) {
+ // The component is too big to fit in the remaining space,
+ // and it is not the only component in this row; wrap
+ preferredHeight += rowHeight;
+
+ rowCount++;
+ rowHeight = 0;
+
+ fieldCount = 0;
+ rowWidth = 0;
+ }
+
+ rowHeight = Math.max(rowHeight, componentSize.height);
+ rowWidth += componentSize.width;
+
+ if (fieldCount > 0) {
+ rowWidth += horizontalSpacing;
+ }
+
+ fieldCount++;
+ }
+ }
+
+ // Add the last row
+ preferredHeight += rowHeight;
+
+ // Include spacing
+ if (rowCount > 0) {
+ preferredHeight += verticalSpacing * rowCount;
+ }
+ }
+
+ // Include top and bottom padding values
+ preferredHeight += padding.top + padding.bottom;
+
+ return preferredHeight;
+ }
+
+ @Override
+ public Dimensions getPreferredSize() {
+ FlowPane flowPane = (FlowPane)getComponent();
+
+ int preferredWidth = 0;
+ int preferredHeight = 0;
+
+ int j = 0;
+ for (int i = 0, n = flowPane.getLength(); i < n; i++) {
+ Component component = flowPane.get(i);
+
+ if (component.isDisplayable()) {
+ Dimensions componentSize = component.getPreferredSize();
+ preferredWidth += componentSize.width;
+ preferredHeight = Math.max(preferredHeight, componentSize.height);
+ j++;
+ }
+ }
+
+ // Include horizontal spacing
+ if (j > 1) {
+ preferredWidth += horizontalSpacing * (j - 1);
+ }
+
+ // Include padding
+ preferredWidth += padding.left + padding.right;
+ preferredHeight += padding.top + padding.bottom;
+
+ return new Dimensions(preferredWidth, preferredHeight);
+ }
+
+ @Override
+ public void layout() {
+ FlowPane flowPane = (FlowPane)getComponent();
+ int width = getWidth();
+
+ // Break the components into multiple rows
+ ArrayList<ArrayList<Component>> rows = new ArrayList<ArrayList<Component>>();
+
+ ArrayList<Component> row = new ArrayList<Component>();
+ int rowWidth = 0;
+
+ for (int i = 0, n = flowPane.getLength(); i < n; i++) {
+ Component component = flowPane.get(i);
+
+ if (component.isDisplayable()) {
+ Dimensions componentSize = component.getPreferredSize();
+ component.setSize(componentSize);
+
+ if (rowWidth + componentSize.width > width
+ && rowWidth > 0) {
+ // The component is too big to fit in the remaining space,
+ // and it is not the only component in this row
+ rows.add(row);
+ row = new ArrayList<Component>();
+ rowWidth = 0;
+ }
+
+ // Add the component to the row
+ row.add(component);
+ rowWidth += componentSize.width;
+
+ if (row.getLength() > 0) {
+ rowWidth += horizontalSpacing;
+ }
+ }
+ }
+
+ // Add the last row
+ if (row.getLength() > 0) {
+ rows.add(row);
+ }
+
+ // Lay out the rows
+ int rowY = padding.top;
+
+ for (int i = 0, n = rows.getLength(); i < n; i++) {
+ row = rows.get(i);
+
+ // Determine the row dimensions
+ rowWidth = 0;
+ int rowHeight = 0;
+ for (Component component : row) {
+ rowWidth += component.getWidth();
+ rowHeight = Math.max(rowHeight, component.getHeight());
+ }
+
+ rowWidth += horizontalSpacing * (row.getLength() - 1);
+
+ int x = 0;
+ switch (alignment) {
+ case LEFT: {
+ x = padding.left;
+ break;
+ }
+
+ case CENTER: {
+ x = (width - rowWidth) / 2;
+ break;
+ }
+
+ case RIGHT: {
+ x = width - rowWidth - padding.right;
+ break;
+ }
+ }
+
+ for (Component component : row) {
+ int y;
+ if (alignToBaseline) {
+ // TODO Align to baseline
+ y = 0;
+ } else {
+ // Align to bottom
+ y = rowHeight - component.getHeight();
+ }
+
+ component.setLocation(x, y + rowY);
+ x += (component.getWidth() + horizontalSpacing);
+ }
+
+ rowY += (rowHeight + verticalSpacing);
+ }
+ }
+
+ public HorizontalAlignment getAlignment() {
+ return alignment;
+ }
+
+ public void setAlignment(HorizontalAlignment alignment) {
+ if (alignment == null) {
+ throw new IllegalArgumentException("alignment is null.");
+ }
+
+ this.alignment = alignment;
+ invalidateComponent();
+ }
+
+ public final void setAlignment(String alignment) {
+ if (alignment == null) {
+ throw new IllegalArgumentException("alignment is null.");
+ }
+
+ setAlignment(HorizontalAlignment.valueOf(alignment.toUpperCase()));
+ }
+
+ public Insets getPadding() {
+ return padding;
+ }
+
+ public void setPadding(Insets padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ this.padding = padding;
+ invalidateComponent();
+ }
+
+ public final void setPadding(Dictionary<String, ?> padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(new Insets(padding));
+ }
+
+ public final void setPadding(int padding) {
+ setPadding(new Insets(padding));
+ }
+
+ public final void setPadding(Number padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(padding.intValue());
+ }
+
+ public int getHorizontalSpacing() {
+ return horizontalSpacing;
+ }
+
+ public void setHorizontalSpacing(int horizontalSpacing) {
+ this.horizontalSpacing = horizontalSpacing;
+ invalidateComponent();
+ }
+
+ public final void setHorizontalSpacing(Number horizontalSpacing) {
+ if (horizontalSpacing == null) {
+ throw new IllegalArgumentException("horizontalSpacing is null.");
+ }
+
+ setHorizontalSpacing(horizontalSpacing.intValue());
+ }
+
+ public int getVerticalSpacing() {
+ return verticalSpacing;
+ }
+
+ public void setVerticalSpacing(int verticalSpacing) {
+ this.verticalSpacing = verticalSpacing;
+ invalidateComponent();
+ }
+
+ public final void setVerticalSpacing(Number verticalSpacing) {
+ if (verticalSpacing == null) {
+ throw new IllegalArgumentException("verticalSpacing is null.");
+ }
+
+ setVerticalSpacing(verticalSpacing.intValue());
+ }
+
+ public boolean getAlignToBaseline() {
+ return alignToBaseline;
+ }
+
+ public void setAlignToBaseline(boolean alignToBaseline) {
+ if (alignToBaseline) {
+ throw new UnsupportedOperationException("alignToBaseline style is not yet supported.");
+ }
+
+ this.alignToBaseline = alignToBaseline;
+ invalidateComponent();
+ }
+}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=793956&r1=793955&r2=793956&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Tue Jul 14 16:06:42 2009
@@ -781,8 +781,7 @@
int x = 0;
for (NodeView nodeView : row) {
- // TODO Use node's vertical alignment properties to
- // determine y-value
+ // TODO Align to baseline
int y = rowHeight - nodeView.getHeight();
nodeView.setLocation(x, y + height);
Added: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/flow_pane_test.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/flow_pane_test.wtkx?rev=793956&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/flow_pane_test.wtkx (added)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/flow_pane_test.wtkx Tue Jul 14 16:06:42 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Frame title="FlowPane Test" preferredWidth="320"
+ styles="{padding:0}"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <FlowPane styles="{alignment:'center', backgroundColor:'#ffffff'}">
+ <PushButton buttonData="0" styles="{preferredAspectRatio:15}"/>
+ <PushButton buttonData="1" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="2" displayable="false" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="3" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="4" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="5" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="6" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="7" preferredHeight="40" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="8" preferredHeight="50" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="9" preferredHeight="60" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="0" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="A" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="B" displayable="false" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="C" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="D" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="E" styles="{preferredAspectRatio:1.5}"/>
+ <PushButton buttonData="F" styles="{preferredAspectRatio:1.5}"/>
+ </FlowPane>
+ </content>
+</Frame>
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/image_view_test.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/image_view_test.wtkx?rev=793956&r1=793955&r2=793956&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/image_view_test.wtkx (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/image_view_test.wtkx Tue Jul 14 16:06:42 2009
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<Window title="Image View Test" maximized="true"
+<Window title="ImageView Test" maximized="true"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk">
<content>