Author: tchemit
Date: 2008-04-18 20:04:23 +0000 (Fri, 18 Apr 2008)
New Revision: 573
Added:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBox.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBoxLayout.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBox.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBoxLayout.java
Removed:
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBox.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBox.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java
Log:
this is formea mystery how it could works before...
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBox.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBox.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBox.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBox.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime.swing;
+
+import javax.swing.JPanel;
+import java.awt.Insets;
+
+/**
+ * Panel which uses an {@link HBoxLayout} by default.
+ *
+ * @author Ethan Nicholas
+ */
+public class HBox extends JPanel {
+ public static final String SPACING_PROPERTY = "spacing";
+ public static final String MARGIN_PROPERTY = "margin";
+ public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment";
+ public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment";
+
+ private Insets margin;
+
+ public HBox() {
+ super(new HBoxLayout());
+ }
+
+
+ /**
+ * Returns the spacing between components, in pixels. Spacing is applied between components only,
+ * not to the top or bottom of the container.
+ *
+ * @return spacing between components
+ */
+ public int getSpacing() {
+ return ((HBoxLayout) getLayout()).getSpacing();
+ }
+
+
+ /**
+ * Sets the spacing between components. Spacing is applied between components only,
+ * not to the top or bottom of the container.
+ *
+ * @param spacing new spacing value
+ */
+ public void setSpacing(int spacing) {
+ int oldValue = getSpacing();
+ ((HBoxLayout) getLayout()).setSpacing(spacing);
+ firePropertyChange(SPACING_PROPERTY, oldValue, spacing);
+ revalidate();
+ }
+
+
+ public int getHorizontalAlignment() {
+ return ((HBoxLayout) getLayout()).getHorizontalAlignment();
+ }
+
+
+ public void setHorizontalAlignment(int horizontalAlignment) {
+ int oldValue = getHorizontalAlignment();
+ ((HBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment);
+ firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment);
+ revalidate();
+ }
+
+
+ public int getVerticalAlignment() {
+ return ((HBoxLayout) getLayout()).getVerticalAlignment();
+ }
+
+
+ public void setVerticalAlignment(int verticalAlignment) {
+ int oldValue = getVerticalAlignment();
+ ((HBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment);
+ firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment);
+ revalidate();
+ }
+
+
+ public Insets getMargin() {
+ return margin;
+ }
+
+
+ public void setMargin(Insets margin) {
+ Insets oldValue = this.margin;
+ this.margin = (Insets) margin.clone();
+ firePropertyChange(MARGIN_PROPERTY, oldValue, margin);
+ }
+
+
+ @Override
+ public Insets getInsets() {
+ Insets result = super.getInsets();
+ if (margin != null) {
+ result.top += margin.top;
+ result.left += margin.left;
+ result.right += margin.right;
+ result.bottom += margin.bottom;
+ }
+ return result;
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBoxLayout.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBoxLayout.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/HBoxLayout.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime.swing;
+
+import javax.swing.SwingConstants;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+
+/**
+ * Horizontal box layout. The layout rules followed by this class are quite different than the core BoxLayout class,
+ * and in general represent a more useful algorithm.
+ *
+ * @author Ethan Nicholas
+ */
+public class HBoxLayout implements LayoutManager {
+ private int spacing = 6;
+ private int horizontalAlignment = SwingConstants.LEFT;
+ private int verticalAlignment = SwingConstants.TOP;
+
+
+ public int getSpacing() {
+ return spacing;
+ }
+
+
+ public void setSpacing(int spacing) {
+ this.spacing = spacing;
+ }
+
+
+ public int getHorizontalAlignment() {
+ return horizontalAlignment;
+ }
+
+
+ public void setHorizontalAlignment(int horizontalAlignment) {
+ this.horizontalAlignment = horizontalAlignment;
+ }
+
+
+ public int getVerticalAlignment() {
+ return verticalAlignment;
+ }
+
+
+ public void setVerticalAlignment(int verticalAlignment) {
+ this.verticalAlignment = verticalAlignment;
+ }
+
+
+ public void addLayoutComponent(String name, Component comp) {
+ }
+
+
+ public void layoutContainer(Container parent) {
+ Insets insets = parent.getInsets();
+ int parentHeight = parent.getSize().height - insets.top - insets.bottom;
+ int count = parent.getComponentCount();
+ Dimension preferredSize = parent.getPreferredSize();
+ int x;
+ switch (horizontalAlignment) {
+ case SwingConstants.LEFT:
+ x = insets.left;
+ break;
+ case SwingConstants.CENTER:
+ x = insets.left + (parent.getWidth() - preferredSize.width) / 2;
+ break;
+ case SwingConstants.RIGHT:
+ x = insets.left + (parent.getWidth() - preferredSize.width);
+ break;
+ default:
+ throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment);
+ }
+
+ for (int i = 0; i < count; i++) {
+ Component component = parent.getComponent(i);
+ Dimension childPreferredSize = component.getPreferredSize();
+ int height = Math.min(childPreferredSize.height, parentHeight);
+ int y;
+ switch (verticalAlignment) {
+ case SwingConstants.TOP:
+ y = insets.top;
+ break;
+ case SwingConstants.CENTER:
+ y = insets.top + (parentHeight - childPreferredSize.height) / 2;
+ break;
+ case SwingConstants.BOTTOM:
+ y = insets.top + (parentHeight - childPreferredSize.height);
+ break;
+ default:
+ throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment);
+ }
+ component.setBounds(x, y, childPreferredSize.width, height);
+ x += childPreferredSize.width + spacing;
+ }
+ }
+
+
+ public Dimension minimumLayoutSize(Container parent) {
+ int width = (parent.getComponentCount() - 1) * spacing;
+ int height = 0;
+ for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
+ Dimension minimumSize = parent.getComponent(i).getMinimumSize();
+ width += minimumSize.width;
+ height = Math.max(height, minimumSize.height);
+ }
+ Insets insets = parent.getInsets();
+ return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
+ }
+
+
+ public Dimension preferredLayoutSize(Container parent) {
+ int width = (parent.getComponentCount() - 1) * spacing;
+ int height = 0;
+ for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
+ Dimension preferredSize = parent.getComponent(i).getPreferredSize();
+ width += preferredSize.width;
+ height = Math.max(height, preferredSize.height);
+ }
+ Insets insets = parent.getInsets();
+ return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
+ }
+
+
+ public void removeLayoutComponent(Component comp) {
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBox.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBox.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBox.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBox.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime.swing;
+
+import javax.swing.JPanel;
+import java.awt.Insets;
+
+/**
+ * Panel which uses a {@link VBoxLayout} by default.
+ *
+ * @author Ethan Nicholas
+ */
+public class VBox extends JPanel {
+ public static final String SPACING_PROPERTY = "spacing";
+ public static final String MARGIN_PROPERTY = "margin";
+ public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment";
+ public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment";
+
+ private Insets margin;
+
+ public VBox() {
+ super(new VBoxLayout());
+ }
+
+
+ /**
+ * Returns the spacing between components, in pixels. Spacing is applied between components only,
+ * not to the top or bottom of the container.
+ *
+ * @return spacing between components
+ */
+ public int getSpacing() {
+ return ((VBoxLayout) getLayout()).getSpacing();
+ }
+
+
+ /**
+ * Sets the spacing between components. Spacing is applied between components only,
+ * not to the top or bottom of the container.
+ *
+ * @param spacing new spacing value
+ */
+ public void setSpacing(int spacing) {
+ int oldValue = getSpacing();
+ ((VBoxLayout) getLayout()).setSpacing(spacing);
+ firePropertyChange(SPACING_PROPERTY, oldValue, spacing);
+ revalidate();
+ }
+
+
+ public int getHorizontalAlignment() {
+ return ((VBoxLayout) getLayout()).getHorizontalAlignment();
+ }
+
+
+ public void setHorizontalAlignment(int horizontalAlignment) {
+ int oldValue = getHorizontalAlignment();
+ ((VBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment);
+ firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment);
+ revalidate();
+ }
+
+
+ public int getVerticalAlignment() {
+ return ((VBoxLayout) getLayout()).getVerticalAlignment();
+ }
+
+
+ public void setVerticalAlignment(int verticalAlignment) {
+ int oldValue = getVerticalAlignment();
+ ((VBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment);
+ firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment);
+ revalidate();
+ }
+
+
+ public Insets getMargin() {
+ return margin;
+ }
+
+
+ public void setMargin(Insets margin) {
+ Insets oldValue = this.margin;
+ this.margin = (Insets) margin.clone();
+ firePropertyChange(MARGIN_PROPERTY, oldValue, margin);
+ }
+
+
+ public Insets getInsets() {
+ Insets result = super.getInsets();
+ if (margin != null) {
+ result.top += margin.top;
+ result.left += margin.left;
+ result.right += margin.right;
+ result.bottom += margin.bottom;
+ }
+ return result;
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBoxLayout.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBoxLayout.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/VBoxLayout.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime.swing;
+
+import javax.swing.SwingConstants;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+
+/**
+ * Vertical box layout. The layout rules followed by this class are quite different than the core BoxLayout class,
+ * and in general represent a more useful algorithm.
+ *
+ * @author Ethan Nicholas
+ */
+public class VBoxLayout implements LayoutManager {
+ private int spacing = 6;
+ private int horizontalAlignment = SwingConstants.LEFT;
+ private int verticalAlignment = SwingConstants.TOP;
+
+
+ public int getSpacing() {
+ return spacing;
+ }
+
+
+ public void setSpacing(int spacing) {
+ this.spacing = spacing;
+ }
+
+
+ public int getHorizontalAlignment() {
+ return horizontalAlignment;
+ }
+
+
+ public void setHorizontalAlignment(int horizontalAlignment) {
+ this.horizontalAlignment = horizontalAlignment;
+ }
+
+
+ public int getVerticalAlignment() {
+ return verticalAlignment;
+ }
+
+
+ public void setVerticalAlignment(int verticalAlignment) {
+ this.verticalAlignment = verticalAlignment;
+ }
+
+
+ public void addLayoutComponent(String name, Component comp) {
+ }
+
+
+ public void layoutContainer(Container parent) {
+ Insets insets = parent.getInsets();
+ int parentWidth = parent.getSize().width - insets.left - insets.right;
+ int count = parent.getComponentCount();
+ Dimension preferredSize = parent.getPreferredSize();
+ int y;
+ switch (verticalAlignment) {
+ case SwingConstants.TOP:
+ y = insets.top;
+ break;
+ case SwingConstants.CENTER:
+ y = insets.top + (parent.getHeight() - preferredSize.height) / 2;
+ break;
+ case SwingConstants.BOTTOM:
+ y = insets.top + (parent.getHeight() - preferredSize.height);
+ break;
+ default:
+ throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment);
+ }
+
+ for (int i = 0; i < count; i++) {
+ Component component = parent.getComponent(i);
+ Dimension childPreferredSize = component.getPreferredSize();
+ int width = Math.min(childPreferredSize.width, parentWidth);
+ int x;
+ switch (horizontalAlignment) {
+ case SwingConstants.LEFT:
+ x = insets.left;
+ break;
+ case SwingConstants.CENTER:
+ x = insets.left + (parentWidth - childPreferredSize.width) / 2;
+ break;
+ case SwingConstants.RIGHT:
+ x = insets.left + (parentWidth - childPreferredSize.width);
+ break;
+ default:
+ throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment);
+ }
+ component.setBounds(x, y, width, childPreferredSize.height);
+ y += childPreferredSize.height + spacing;
+ }
+ }
+
+
+ public Dimension minimumLayoutSize(Container parent) {
+ int width = 0;
+ int height = (parent.getComponentCount() - 1) * spacing;
+ for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
+ Dimension minimumSize = parent.getComponent(i).getMinimumSize();
+ width = Math.max(width, minimumSize.width);
+ height += minimumSize.height;
+ }
+ Insets insets = parent.getInsets();
+ return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
+ }
+
+
+ public Dimension preferredLayoutSize(Container parent) {
+ int width = 0;
+ int height = (parent.getComponentCount() - 1) * spacing;
+ for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
+ Dimension preferredSize = parent.getComponent(i).getPreferredSize();
+ width = Math.max(width, preferredSize.width);
+ height += preferredSize.height;
+ }
+ Insets insets = parent.getInsets();
+ return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
+ }
+
+
+ public void removeLayoutComponent(Component comp) {
+ }
+}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBox.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBox.java 2008-04-18 20:00:44 UTC (rev 572)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBox.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -1,102 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime.swing;
-
-import javax.swing.JPanel;
-import java.awt.Insets;
-
-/**
- * Panel which uses an {@link HBoxLayout} by default.
- *
- * @author Ethan Nicholas
- */
-public class HBox extends JPanel {
- public static final String SPACING_PROPERTY = "spacing";
- public static final String MARGIN_PROPERTY = "margin";
- public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment";
- public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment";
-
- private Insets margin;
-
- public HBox() {
- super(new HBoxLayout());
- }
-
-
- /**
- * Returns the spacing between components, in pixels. Spacing is applied between components only,
- * not to the top or bottom of the container.
- *
- * @return spacing between components
- */
- public int getSpacing() {
- return ((HBoxLayout) getLayout()).getSpacing();
- }
-
-
- /**
- * Sets the spacing between components. Spacing is applied between components only,
- * not to the top or bottom of the container.
- *
- * @param spacing new spacing value
- */
- public void setSpacing(int spacing) {
- int oldValue = getSpacing();
- ((HBoxLayout) getLayout()).setSpacing(spacing);
- firePropertyChange(SPACING_PROPERTY, oldValue, spacing);
- revalidate();
- }
-
-
- public int getHorizontalAlignment() {
- return ((HBoxLayout) getLayout()).getHorizontalAlignment();
- }
-
-
- public void setHorizontalAlignment(int horizontalAlignment) {
- int oldValue = getHorizontalAlignment();
- ((HBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment);
- firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment);
- revalidate();
- }
-
-
- public int getVerticalAlignment() {
- return ((HBoxLayout) getLayout()).getVerticalAlignment();
- }
-
-
- public void setVerticalAlignment(int verticalAlignment) {
- int oldValue = getVerticalAlignment();
- ((HBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment);
- firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment);
- revalidate();
- }
-
-
- public Insets getMargin() {
- return margin;
- }
-
-
- public void setMargin(Insets margin) {
- Insets oldValue = this.margin;
- this.margin = (Insets) margin.clone();
- firePropertyChange(MARGIN_PROPERTY, oldValue, margin);
- }
-
-
- @Override
- public Insets getInsets() {
- Insets result = super.getInsets();
- if (margin != null) {
- result.top += margin.top;
- result.left += margin.left;
- result.right += margin.right;
- result.bottom += margin.bottom;
- }
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java 2008-04-18 20:00:44 UTC (rev 572)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -1,132 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime.swing;
-
-import javax.swing.SwingConstants;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.LayoutManager;
-
-/**
- * Horizontal box layout. The layout rules followed by this class are quite different than the core BoxLayout class,
- * and in general represent a more useful algorithm.
- *
- * @author Ethan Nicholas
- */
-public class HBoxLayout implements LayoutManager {
- private int spacing = 6;
- private int horizontalAlignment = SwingConstants.LEFT;
- private int verticalAlignment = SwingConstants.TOP;
-
-
- public int getSpacing() {
- return spacing;
- }
-
-
- public void setSpacing(int spacing) {
- this.spacing = spacing;
- }
-
-
- public int getHorizontalAlignment() {
- return horizontalAlignment;
- }
-
-
- public void setHorizontalAlignment(int horizontalAlignment) {
- this.horizontalAlignment = horizontalAlignment;
- }
-
-
- public int getVerticalAlignment() {
- return verticalAlignment;
- }
-
-
- public void setVerticalAlignment(int verticalAlignment) {
- this.verticalAlignment = verticalAlignment;
- }
-
-
- public void addLayoutComponent(String name, Component comp) {
- }
-
-
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
- int parentHeight = parent.getSize().height - insets.top - insets.bottom;
- int count = parent.getComponentCount();
- Dimension preferredSize = parent.getPreferredSize();
- int x;
- switch (horizontalAlignment) {
- case SwingConstants.LEFT:
- x = insets.left;
- break;
- case SwingConstants.CENTER:
- x = insets.left + (parent.getWidth() - preferredSize.width) / 2;
- break;
- case SwingConstants.RIGHT:
- x = insets.left + (parent.getWidth() - preferredSize.width);
- break;
- default:
- throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment);
- }
-
- for (int i = 0; i < count; i++) {
- Component component = parent.getComponent(i);
- Dimension childPreferredSize = component.getPreferredSize();
- int height = Math.min(childPreferredSize.height, parentHeight);
- int y;
- switch (verticalAlignment) {
- case SwingConstants.TOP:
- y = insets.top;
- break;
- case SwingConstants.CENTER:
- y = insets.top + (parentHeight - childPreferredSize.height) / 2;
- break;
- case SwingConstants.BOTTOM:
- y = insets.top + (parentHeight - childPreferredSize.height);
- break;
- default:
- throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment);
- }
- component.setBounds(x, y, childPreferredSize.width, height);
- x += childPreferredSize.width + spacing;
- }
- }
-
-
- public Dimension minimumLayoutSize(Container parent) {
- int width = (parent.getComponentCount() - 1) * spacing;
- int height = 0;
- for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
- Dimension minimumSize = parent.getComponent(i).getMinimumSize();
- width += minimumSize.width;
- height = Math.max(height, minimumSize.height);
- }
- Insets insets = parent.getInsets();
- return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
- }
-
-
- public Dimension preferredLayoutSize(Container parent) {
- int width = (parent.getComponentCount() - 1) * spacing;
- int height = 0;
- for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
- Dimension preferredSize = parent.getComponent(i).getPreferredSize();
- width += preferredSize.width;
- height = Math.max(height, preferredSize.height);
- }
- Insets insets = parent.getInsets();
- return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
- }
-
-
- public void removeLayoutComponent(Component comp) {
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBox.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBox.java 2008-04-18 20:00:44 UTC (rev 572)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBox.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -1,101 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime.swing;
-
-import javax.swing.JPanel;
-import java.awt.Insets;
-
-/**
- * Panel which uses a {@link VBoxLayout} by default.
- *
- * @author Ethan Nicholas
- */
-public class VBox extends JPanel {
- public static final String SPACING_PROPERTY = "spacing";
- public static final String MARGIN_PROPERTY = "margin";
- public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment";
- public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment";
-
- private Insets margin;
-
- public VBox() {
- super(new VBoxLayout());
- }
-
-
- /**
- * Returns the spacing between components, in pixels. Spacing is applied between components only,
- * not to the top or bottom of the container.
- *
- * @return spacing between components
- */
- public int getSpacing() {
- return ((VBoxLayout) getLayout()).getSpacing();
- }
-
-
- /**
- * Sets the spacing between components. Spacing is applied between components only,
- * not to the top or bottom of the container.
- *
- * @param spacing new spacing value
- */
- public void setSpacing(int spacing) {
- int oldValue = getSpacing();
- ((VBoxLayout) getLayout()).setSpacing(spacing);
- firePropertyChange(SPACING_PROPERTY, oldValue, spacing);
- revalidate();
- }
-
-
- public int getHorizontalAlignment() {
- return ((VBoxLayout) getLayout()).getHorizontalAlignment();
- }
-
-
- public void setHorizontalAlignment(int horizontalAlignment) {
- int oldValue = getHorizontalAlignment();
- ((VBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment);
- firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment);
- revalidate();
- }
-
-
- public int getVerticalAlignment() {
- return ((VBoxLayout) getLayout()).getVerticalAlignment();
- }
-
-
- public void setVerticalAlignment(int verticalAlignment) {
- int oldValue = getVerticalAlignment();
- ((VBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment);
- firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment);
- revalidate();
- }
-
-
- public Insets getMargin() {
- return margin;
- }
-
-
- public void setMargin(Insets margin) {
- Insets oldValue = this.margin;
- this.margin = (Insets) margin.clone();
- firePropertyChange(MARGIN_PROPERTY, oldValue, margin);
- }
-
-
- public Insets getInsets() {
- Insets result = super.getInsets();
- if (margin != null) {
- result.top += margin.top;
- result.left += margin.left;
- result.right += margin.right;
- result.bottom += margin.bottom;
- }
- return result;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java 2008-04-18 20:00:44 UTC (rev 572)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java 2008-04-18 20:04:23 UTC (rev 573)
@@ -1,132 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime.swing;
-
-import javax.swing.SwingConstants;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.LayoutManager;
-
-/**
- * Vertical box layout. The layout rules followed by this class are quite different than the core BoxLayout class,
- * and in general represent a more useful algorithm.
- *
- * @author Ethan Nicholas
- */
-public class VBoxLayout implements LayoutManager {
- private int spacing = 6;
- private int horizontalAlignment = SwingConstants.LEFT;
- private int verticalAlignment = SwingConstants.TOP;
-
-
- public int getSpacing() {
- return spacing;
- }
-
-
- public void setSpacing(int spacing) {
- this.spacing = spacing;
- }
-
-
- public int getHorizontalAlignment() {
- return horizontalAlignment;
- }
-
-
- public void setHorizontalAlignment(int horizontalAlignment) {
- this.horizontalAlignment = horizontalAlignment;
- }
-
-
- public int getVerticalAlignment() {
- return verticalAlignment;
- }
-
-
- public void setVerticalAlignment(int verticalAlignment) {
- this.verticalAlignment = verticalAlignment;
- }
-
-
- public void addLayoutComponent(String name, Component comp) {
- }
-
-
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
- int parentWidth = parent.getSize().width - insets.left - insets.right;
- int count = parent.getComponentCount();
- Dimension preferredSize = parent.getPreferredSize();
- int y;
- switch (verticalAlignment) {
- case SwingConstants.TOP:
- y = insets.top;
- break;
- case SwingConstants.CENTER:
- y = insets.top + (parent.getHeight() - preferredSize.height) / 2;
- break;
- case SwingConstants.BOTTOM:
- y = insets.top + (parent.getHeight() - preferredSize.height);
- break;
- default:
- throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment);
- }
-
- for (int i = 0; i < count; i++) {
- Component component = parent.getComponent(i);
- Dimension childPreferredSize = component.getPreferredSize();
- int width = Math.min(childPreferredSize.width, parentWidth);
- int x;
- switch (horizontalAlignment) {
- case SwingConstants.LEFT:
- x = insets.left;
- break;
- case SwingConstants.CENTER:
- x = insets.left + (parentWidth - childPreferredSize.width) / 2;
- break;
- case SwingConstants.RIGHT:
- x = insets.left + (parentWidth - childPreferredSize.width);
- break;
- default:
- throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment);
- }
- component.setBounds(x, y, width, childPreferredSize.height);
- y += childPreferredSize.height + spacing;
- }
- }
-
-
- public Dimension minimumLayoutSize(Container parent) {
- int width = 0;
- int height = (parent.getComponentCount() - 1) * spacing;
- for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
- Dimension minimumSize = parent.getComponent(i).getMinimumSize();
- width = Math.max(width, minimumSize.width);
- height += minimumSize.height;
- }
- Insets insets = parent.getInsets();
- return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
- }
-
-
- public Dimension preferredLayoutSize(Container parent) {
- int width = 0;
- int height = (parent.getComponentCount() - 1) * spacing;
- for (int i = parent.getComponentCount() - 1; i >= 0; i--) {
- Dimension preferredSize = parent.getComponent(i).getPreferredSize();
- width = Math.max(width, preferredSize.width);
- height += preferredSize.height;
- }
- Insets insets = parent.getInsets();
- return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom);
- }
-
-
- public void removeLayoutComponent(Component comp) {
- }
-}
\ No newline at end of file