Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
April 2008
- 1 participants
- 373 discussions
[Buix-commits] r573 - in trunk/lutinjaxx: core/src/main/java/jaxx/runtime core/src/main/java/jaxx/runtime/swing runtime/src/main/java/jaxx/runtime/swing
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
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
1
0
[Buix-commits] r572 - in trunk/lutinjaxx: core/src/main/java/jaxx/runtime runtime/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 20:00:44 +0000 (Fri, 18 Apr 2008)
New Revision: 572
Added:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java
Removed:
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java
Log:
this is formea mystery how it could works before...
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java 2008-04-18 20:00:44 UTC (rev 572)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+/** The <code>JAXXObject</code> interface is implemented by all classes produced by the JAXX compiler. */
+public interface JAXXObject {
+ /**
+ * Retrieves an object defined in an XML tag by its ID.
+ *
+ * @param id the id of the component to retrieve
+ * @return the object
+ */
+ public Object getObjectById(String id);
+
+
+ public void applyDataBinding(String id);
+
+
+ public void removeDataBinding(String id);
+
+
+ /**
+ * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
+ * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
+ * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
+ * case <code>foo.getText()</code>.
+ *
+ * @param dest the name of the data binding to run
+ */
+ public void processDataBinding(String dest);
+
+
+ /**
+ * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and
+ * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime,
+ * to trigger these events.
+ *
+ * @param name the name of the property which changed
+ * @param oldValue the old value of the property
+ * @param newValue the new value of the property
+ */
+ public void firePropertyChange(String name, Object oldValue, Object newValue);
+}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java 2008-04-18 19:59:37 UTC (rev 571)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java 2008-04-18 20:00:44 UTC (rev 572)
@@ -1,45 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-/** The <code>JAXXObject</code> interface is implemented by all classes produced by the JAXX compiler. */
-public interface JAXXObject {
- /**
- * Retrieves an object defined in an XML tag by its ID.
- *
- * @param id the id of the component to retrieve
- * @return the object
- */
- public Object getObjectById(String id);
-
-
- public void applyDataBinding(String id);
-
-
- public void removeDataBinding(String id);
-
-
- /**
- * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
- * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
- * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
- * case <code>foo.getText()</code>.
- *
- * @param dest the name of the data binding to run
- */
- public void processDataBinding(String dest);
-
-
- /**
- * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and
- * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime,
- * to trigger these events.
- *
- * @param name the name of the property which changed
- * @param oldValue the old value of the property
- * @param newValue the new value of the property
- */
- public void firePropertyChange(String name, Object oldValue, Object newValue);
-}
\ No newline at end of file
1
0
[Buix-commits] r571 - in trunk/lutinjaxx: core/src/main/java/jaxx core/src/main/java/jaxx/runtime runtime/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:59:37 +0000 (Fri, 18 Apr 2008)
New Revision: 571
Added:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java
Removed:
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java
Log:
this is formea mystery how it could works before...
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java 2008-04-18 19:59:37 UTC (rev 571)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+import java.io.Serializable;
+
+public class ComponentDescriptor implements Serializable {
+ String id;
+ String javaClassName;
+ String styleClass;
+ ComponentDescriptor parent;
+ private static final long serialVersionUID = 3001121176691770788L;
+
+
+ public ComponentDescriptor(String id, String javaClassName, String styleClass, ComponentDescriptor parent) {
+ this.id = id;
+ this.javaClassName = javaClassName;
+ this.styleClass = styleClass;
+ this.parent = parent;
+ }
+
+
+ public String getId() {
+ return id;
+ }
+
+
+ public String getJavaClassName() {
+ return javaClassName;
+ }
+
+
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+
+ public ComponentDescriptor getParent() {
+ return parent;
+ }
+
+
+ @Override
+ public String toString() {
+ return "ComponentDescriptor[" + id + ", " + javaClassName + ", " + styleClass + "]";
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java (from rev 565, trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java)
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java (rev 0)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java 2008-04-18 19:59:37 UTC (rev 571)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+import jaxx.css.Stylesheet;
+
+import java.io.Serializable;
+
+public class JAXXObjectDescriptor implements Serializable {
+ private ComponentDescriptor[] descriptors;
+ private Stylesheet stylesheet;
+ private static final long serialVersionUID = -1706159556633801154L;
+
+
+ public JAXXObjectDescriptor(ComponentDescriptor[] descriptors,
+ Stylesheet stylesheet) {
+ this.descriptors = descriptors;
+ this.stylesheet = stylesheet;
+ }
+
+
+ public ComponentDescriptor[] getComponentDescriptors() {
+ return descriptors;
+ }
+
+
+ public Stylesheet getStylesheet() {
+ return stylesheet;
+ }
+}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java 2008-04-18 19:53:01 UTC (rev 570)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java 2008-04-18 19:59:37 UTC (rev 571)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-import java.io.Serializable;
-
-public class ComponentDescriptor implements Serializable {
- String id;
- String javaClassName;
- String styleClass;
- ComponentDescriptor parent;
- private static final long serialVersionUID = 3001121176691770788L;
-
-
- public ComponentDescriptor(String id, String javaClassName, String styleClass, ComponentDescriptor parent) {
- this.id = id;
- this.javaClassName = javaClassName;
- this.styleClass = styleClass;
- this.parent = parent;
- }
-
-
- public String getId() {
- return id;
- }
-
-
- public String getJavaClassName() {
- return javaClassName;
- }
-
-
- public String getStyleClass() {
- return styleClass;
- }
-
-
- public ComponentDescriptor getParent() {
- return parent;
- }
-
-
- @Override
- public String toString() {
- return "ComponentDescriptor[" + id + ", " + javaClassName + ", " + styleClass + "]";
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java 2008-04-18 19:53:01 UTC (rev 570)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java 2008-04-18 19:59:37 UTC (rev 571)
@@ -1,32 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-import jaxx.css.Stylesheet;
-
-import java.io.Serializable;
-
-public class JAXXObjectDescriptor implements Serializable {
- private ComponentDescriptor[] descriptors;
- private Stylesheet stylesheet;
- private static final long serialVersionUID = -1706159556633801154L;
-
-
- public JAXXObjectDescriptor(ComponentDescriptor[] descriptors,
- Stylesheet stylesheet) {
- this.descriptors = descriptors;
- this.stylesheet = stylesheet;
- }
-
-
- public ComponentDescriptor[] getComponentDescriptors() {
- return descriptors;
- }
-
-
- public Stylesheet getStylesheet() {
- return stylesheet;
- }
-}
\ No newline at end of file
1
0
[Buix-commits] r570 - in trunk/lutinjaxx: core/src/main/java/jaxx/tags provider/swing/src/main/java/jaxx/tags
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:53:01 +0000 (Fri, 18 Apr 2008)
New Revision: 570
Added:
trunk/lutinjaxx/provider/swing/src/main/java/jaxx/tags/swing/
Removed:
trunk/lutinjaxx/core/src/main/java/jaxx/tags/swing/
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
Copied: trunk/lutinjaxx/provider/swing/src/main/java/jaxx/tags/swing (from rev 565, trunk/lutinjaxx/core/src/main/java/jaxx/tags/swing)
1
0
[Buix-commits] r569 - trunk/lutinjaxx/provider/swing/src/main/java/jaxx
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:52:14 +0000 (Fri, 18 Apr 2008)
New Revision: 569
Added:
trunk/lutinjaxx/provider/swing/src/main/java/jaxx/tags/
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
1
0
[Buix-commits] r568 - trunk/lutinjaxx/provider/swing/src/main/java/jaxx
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:51:40 +0000 (Fri, 18 Apr 2008)
New Revision: 568
Removed:
trunk/lutinjaxx/provider/swing/src/main/java/jaxx/runtime/
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
1
0
[Buix-commits] r567 - trunk/lutinjaxx/core/src/main/java/jaxx
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:49:05 +0000 (Fri, 18 Apr 2008)
New Revision: 567
Removed:
trunk/lutinjaxx/core/src/main/java/jaxx/util/
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
1
0
[Buix-commits] r566 - trunk/lutinjaxx/core/src/main/java/jaxx
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:48:29 +0000 (Fri, 18 Apr 2008)
New Revision: 566
Removed:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
1
0
[Buix-commits] r565 - in trunk/lutinjaxx: core/src/main/java/jaxx/runtime runtime/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:47:39 +0000 (Fri, 18 Apr 2008)
New Revision: 565
Added:
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingListener.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/Util.java
Removed:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingListener.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingUpdateListener.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/Util.java
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
Deleted: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java 2008-04-18 19:47:05 UTC (rev 564)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -1,49 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-import java.io.Serializable;
-
-public class ComponentDescriptor implements Serializable {
- String id;
- String javaClassName;
- String styleClass;
- ComponentDescriptor parent;
- private static final long serialVersionUID = 3001121176691770788L;
-
-
- public ComponentDescriptor(String id, String javaClassName, String styleClass, ComponentDescriptor parent) {
- this.id = id;
- this.javaClassName = javaClassName;
- this.styleClass = styleClass;
- this.parent = parent;
- }
-
-
- public String getId() {
- return id;
- }
-
-
- public String getJavaClassName() {
- return javaClassName;
- }
-
-
- public String getStyleClass() {
- return styleClass;
- }
-
-
- public ComponentDescriptor getParent() {
- return parent;
- }
-
-
- @Override
- public String toString() {
- return "ComponentDescriptor[" + id + ", " + javaClassName + ", " + styleClass + "]";
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingListener.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingListener.java 2008-04-18 19:47:05 UTC (rev 564)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingListener.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-
-/**
- * A <code>PropertyChangeListener</code> which processes a data binding when it receives a
- * <code>PropertyChangeEvent</code>.
- */
-public class DataBindingListener implements PropertyChangeListener {
- private JAXXObject object;
- private String dest;
-
- /**
- * Creates a new <code>DataBindingListener</code> which will run the given data binding
- * when it receives a <code>PropertyChangeEvent</code>.
- *
- * @param object the object in which the data binding exists
- * @param dest the name of the data binding to run
- */
- public DataBindingListener(JAXXObject object, String dest) {
- this.object = object;
- this.dest = dest;
- }
-
-
- /**
- * Processes the data binding in response to a <code>PropertyChangeEvent</code>.
- *
- * @param e the event which triggered the binding
- */
- public void propertyChange(PropertyChangeEvent e) {
- object.processDataBinding(dest);
-
- // for now, handle dependency changes by always removing & reapplying
- // the binding. We should be more efficient and only do this when it's
- // actually necessary
- object.removeDataBinding(dest);
- object.applyDataBinding(dest);
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingUpdateListener.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingUpdateListener.java 2008-04-18 19:47:05 UTC (rev 564)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingUpdateListener.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-
-/**
- * A <code>PropertyChangeListener</code> which removes and re-applies a data binding
- * when it receives a <code>PropertyChangeEvent</code>.
- */
-public class DataBindingUpdateListener implements PropertyChangeListener {
- private JAXXObject object;
- private String dest;
-
- /**
- * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a
- * data binding when it receives a <code>PropertyChangeEvent</code>.
- *
- * @param object the object in which the data binding exists
- * @param dest the name of the data binding to reapply
- */
- public DataBindingUpdateListener(JAXXObject object, String dest) {
- this.object = object;
- this.dest = dest;
- }
-
-
- public String getBindingName() {
- return dest;
- }
-
-
- /**
- * Updates the data binding in response to a <code>PropertyChangeEvent</code>.
- *
- * @param e the event which triggered the binding
- */
- public void propertyChange(PropertyChangeEvent e) {
- object.removeDataBinding(dest);
- object.applyDataBinding(dest);
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java 2008-04-18 19:47:05 UTC (rev 564)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -1,45 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-/** The <code>JAXXObject</code> interface is implemented by all classes produced by the JAXX compiler. */
-public interface JAXXObject {
- /**
- * Retrieves an object defined in an XML tag by its ID.
- *
- * @param id the id of the component to retrieve
- * @return the object
- */
- public Object getObjectById(String id);
-
-
- public void applyDataBinding(String id);
-
-
- public void removeDataBinding(String id);
-
-
- /**
- * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
- * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
- * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
- * case <code>foo.getText()</code>.
- *
- * @param dest the name of the data binding to run
- */
- public void processDataBinding(String dest);
-
-
- /**
- * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and
- * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime,
- * to trigger these events.
- *
- * @param name the name of the property which changed
- * @param oldValue the old value of the property
- * @param newValue the new value of the property
- */
- public void firePropertyChange(String name, Object oldValue, Object newValue);
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java 2008-04-18 19:47:05 UTC (rev 564)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -1,32 +0,0 @@
-/*
- * Copyright 2006 Ethan Nicholas. All rights reserved.
- * Use is subject to license terms.
- */
-package jaxx.runtime;
-
-import jaxx.css.Stylesheet;
-
-import java.io.Serializable;
-
-public class JAXXObjectDescriptor implements Serializable {
- private ComponentDescriptor[] descriptors;
- private Stylesheet stylesheet;
- private static final long serialVersionUID = -1706159556633801154L;
-
-
- public JAXXObjectDescriptor(ComponentDescriptor[] descriptors,
- Stylesheet stylesheet) {
- this.descriptors = descriptors;
- this.stylesheet = stylesheet;
- }
-
-
- public ComponentDescriptor[] getComponentDescriptors() {
- return descriptors;
- }
-
-
- public Stylesheet getStylesheet() {
- return stylesheet;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinjaxx/core/src/main/java/jaxx/runtime/Util.java
===================================================================
--- trunk/lutinjaxx/core/src/main/java/jaxx/runtime/Util.java 2008-04-18 19:47:05 UTC (rev 564)
+++ trunk/lutinjaxx/core/src/main/java/jaxx/runtime/Util.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -1,253 +0,0 @@
-package jaxx.runtime;
-
-import javax.swing.JComponent;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.EventListener;
-import java.util.zip.GZIPInputStream;
-
-public class Util {
- // Maps root objects to lists of event listeners
- private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
- private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
-
-
- private static class EventListenerDescriptor {
- Class listenerClass;
- String listenerMethodName;
- String methodName;
- Object eventListener;
- }
-
-
- /**
- * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
- * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
- * for the rationale behind this (admittedly ugly) approach.
- *
- * @param descriptor descriptor to decode
- * @return the dedoced descriptor
- */
- public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
- try {
- byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(),0,data,0,data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
- return (JAXXObjectDescriptor) in.readObject();
- }
- catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
-
- public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
- try {
- byte[] data = new byte[descriptor.length()];
- // copy low-order bytes into the array. The high-order bytes should all be zero.
- System.arraycopy(descriptor.getBytes(),0,data,0,data.length);
- //descriptor.getBytes(0, descriptor.length(), data, 0);
- ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
- return (JAXXObjectDescriptor) in.readObject();
- }
- catch (IOException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- catch (ClassNotFoundException e) {
- throw new RuntimeException("Internal error: can't-happen error", e);
- }
- }
-
-
- public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
- WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
- List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
- if (descriptors == null) {
- descriptors = new ArrayList<EventListenerDescriptor>();
- eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
- } else {
- for (EventListenerDescriptor descriptor : descriptors) {
- if (listenerClass == descriptor.listenerClass &&
- (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
- methodName.equals(descriptor.methodName)) {
- return descriptor.eventListener;
- }
- }
- }
-
- // else we need to create a new listener
- final EventListenerDescriptor descriptor = new EventListenerDescriptor();
- descriptor.listenerClass = listenerClass;
- descriptor.listenerMethodName = listenerMethodName;
- descriptor.methodName = methodName;
- try {
- final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
- Method listenerMethod = null;
- if (listenerMethodName != null) {
- for (Method listenerMethod1 : listenerMethods) {
- if ((listenerMethod1).getName().equals(listenerMethodName)) {
- listenerMethod = listenerMethod1;
- break;
- }
- }
- }
- if (listenerMethodName != null && listenerMethod == null)
- throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
- Class[] parameterTypes = listenerMethods.get(0).getParameterTypes();
- Class<?> methodContainerClass = methodContainer.getClass();
- final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
- descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class[]{listenerClass},
- new InvocationHandler() {
- public Object invoke(Object proxy, Method method, Object[] args) {
- String methodName = method.getName();
- if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
- try {
- return targetMethod.invoke(methodContainer, args);
- }
- catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
- if (methodName.equals("toString")) {
- return toString();
- }
- if (methodName.equals("equals")) {
- return descriptor.eventListener == args[0];
- }
- if (methodName.equals("hashCode")) {
- return hashCode();
- }
- return null;
- }
- });
- descriptors.add(descriptor);
- return descriptor.eventListener;
- }
- catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
-
- public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) {
- return getEventListener(listenerClass, null, methodContainer, methodName);
- }
-
-
- public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
- WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
- List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
- if (listeners == null) {
- listeners = new ArrayList<DataBindingUpdateListener>();
- dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
- } else {
- for (DataBindingUpdateListener listener : listeners) {
- if (bindingName.equals(listener.getBindingName()))
- return listener;
- }
- }
- DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
- listeners.add(listener);
- return listener;
- }
-
-
- public static void setComponentWidth(Component component, int width) {
- component.setSize(width, component.getHeight());
- if (component instanceof JComponent) {
- JComponent jcomponent = (JComponent) component;
- jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
- jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
- if (jcomponent.isDisplayable())
- jcomponent.revalidate();
- }
- }
-
-
- public static void setComponentHeight(Component component, int height) {
- component.setSize(component.getWidth(), height);
- if (component instanceof JComponent) {
- JComponent jcomponent = (JComponent) component;
- jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
- jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
- if (jcomponent.isDisplayable())
- jcomponent.revalidate();
- }
- }
-
-
- public static boolean assignment(boolean value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static byte assignment(byte value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static short assignment(short value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static int assignment(int value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static long assignment(long value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static float assignment(float value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static double assignment(double value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static char assignment(char value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-
-
- public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
- src.firePropertyChange(name.trim(), null, "dummy value");
- return value;
- }
-}
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/ComponentDescriptor.java)
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java (rev 0)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+import java.io.Serializable;
+
+public class ComponentDescriptor implements Serializable {
+ String id;
+ String javaClassName;
+ String styleClass;
+ ComponentDescriptor parent;
+ private static final long serialVersionUID = 3001121176691770788L;
+
+
+ public ComponentDescriptor(String id, String javaClassName, String styleClass, ComponentDescriptor parent) {
+ this.id = id;
+ this.javaClassName = javaClassName;
+ this.styleClass = styleClass;
+ this.parent = parent;
+ }
+
+
+ public String getId() {
+ return id;
+ }
+
+
+ public String getJavaClassName() {
+ return javaClassName;
+ }
+
+
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+
+ public ComponentDescriptor getParent() {
+ return parent;
+ }
+
+
+ @Override
+ public String toString() {
+ return "ComponentDescriptor[" + id + ", " + javaClassName + ", " + styleClass + "]";
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingListener.java (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingListener.java)
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingListener.java (rev 0)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingListener.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which processes a data binding when it receives a
+ * <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingListener implements PropertyChangeListener {
+ private JAXXObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingListener</code> which will run the given data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to run
+ */
+ public DataBindingListener(JAXXObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ /**
+ * Processes the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.processDataBinding(dest);
+
+ // for now, handle dependency changes by always removing & reapplying
+ // the binding. We should be more efficient and only do this when it's
+ // actually necessary
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/DataBindingUpdateListener.java)
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java (rev 0)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <code>PropertyChangeListener</code> which removes and re-applies a data binding
+ * when it receives a <code>PropertyChangeEvent</code>.
+ */
+public class DataBindingUpdateListener implements PropertyChangeListener {
+ private JAXXObject object;
+ private String dest;
+
+ /**
+ * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a
+ * data binding when it receives a <code>PropertyChangeEvent</code>.
+ *
+ * @param object the object in which the data binding exists
+ * @param dest the name of the data binding to reapply
+ */
+ public DataBindingUpdateListener(JAXXObject object, String dest) {
+ this.object = object;
+ this.dest = dest;
+ }
+
+
+ public String getBindingName() {
+ return dest;
+ }
+
+
+ /**
+ * Updates the data binding in response to a <code>PropertyChangeEvent</code>.
+ *
+ * @param e the event which triggered the binding
+ */
+ public void propertyChange(PropertyChangeEvent e) {
+ object.removeDataBinding(dest);
+ object.applyDataBinding(dest);
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObject.java)
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java (rev 0)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObject.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+/** The <code>JAXXObject</code> interface is implemented by all classes produced by the JAXX compiler. */
+public interface JAXXObject {
+ /**
+ * Retrieves an object defined in an XML tag by its ID.
+ *
+ * @param id the id of the component to retrieve
+ * @return the object
+ */
+ public Object getObjectById(String id);
+
+
+ public void applyDataBinding(String id);
+
+
+ public void removeDataBinding(String id);
+
+
+ /**
+ * Processes a data binding by name. Data binding names are comprised of an object ID and a property name:
+ * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is
+ * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this
+ * case <code>foo.getText()</code>.
+ *
+ * @param dest the name of the data binding to run
+ */
+ public void processDataBinding(String dest);
+
+
+ /**
+ * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and
+ * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime,
+ * to trigger these events.
+ *
+ * @param name the name of the property which changed
+ * @param oldValue the old value of the property
+ * @param newValue the new value of the property
+ */
+ public void firePropertyChange(String name, Object oldValue, Object newValue);
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java)
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java (rev 0)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.runtime;
+
+import jaxx.css.Stylesheet;
+
+import java.io.Serializable;
+
+public class JAXXObjectDescriptor implements Serializable {
+ private ComponentDescriptor[] descriptors;
+ private Stylesheet stylesheet;
+ private static final long serialVersionUID = -1706159556633801154L;
+
+
+ public JAXXObjectDescriptor(ComponentDescriptor[] descriptors,
+ Stylesheet stylesheet) {
+ this.descriptors = descriptors;
+ this.stylesheet = stylesheet;
+ }
+
+
+ public ComponentDescriptor[] getComponentDescriptors() {
+ return descriptors;
+ }
+
+
+ public Stylesheet getStylesheet() {
+ return stylesheet;
+ }
+}
\ No newline at end of file
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/Util.java (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/Util.java)
===================================================================
--- trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/Util.java (rev 0)
+++ trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/Util.java 2008-04-18 19:47:39 UTC (rev 565)
@@ -0,0 +1,253 @@
+package jaxx.runtime;
+
+import javax.swing.JComponent;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.EventListener;
+import java.util.zip.GZIPInputStream;
+
+public class Util {
+ // Maps root objects to lists of event listeners
+ private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>();
+ private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>();
+
+
+ private static class EventListenerDescriptor {
+ Class listenerClass;
+ String listenerMethodName;
+ String methodName;
+ Object eventListener;
+ }
+
+
+ /**
+ * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping
+ * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField
+ * for the rationale behind this (admittedly ugly) approach.
+ *
+ * @param descriptor descriptor to decode
+ * @return the dedoced descriptor
+ */
+ public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor) {
+ try {
+ byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(),0,data,0,data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data));
+ return (JAXXObjectDescriptor) in.readObject();
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+
+ public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) {
+ try {
+ byte[] data = new byte[descriptor.length()];
+ // copy low-order bytes into the array. The high-order bytes should all be zero.
+ System.arraycopy(descriptor.getBytes(),0,data,0,data.length);
+ //descriptor.getBytes(0, descriptor.length(), data, 0);
+ ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data)));
+ return (JAXXObjectDescriptor) in.readObject();
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ catch (ClassNotFoundException e) {
+ throw new RuntimeException("Internal error: can't-happen error", e);
+ }
+ }
+
+
+ public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) {
+ WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer);
+ List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null;
+ if (descriptors == null) {
+ descriptors = new ArrayList<EventListenerDescriptor>();
+ eventListeners.put(methodContainer, new WeakReference<List<EventListenerDescriptor>>(descriptors));
+ } else {
+ for (EventListenerDescriptor descriptor : descriptors) {
+ if (listenerClass == descriptor.listenerClass &&
+ (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) &&
+ methodName.equals(descriptor.methodName)) {
+ return descriptor.eventListener;
+ }
+ }
+ }
+
+ // else we need to create a new listener
+ final EventListenerDescriptor descriptor = new EventListenerDescriptor();
+ descriptor.listenerClass = listenerClass;
+ descriptor.listenerMethodName = listenerMethodName;
+ descriptor.methodName = methodName;
+ try {
+ final List<Method> listenerMethods = Arrays.asList(listenerClass.getMethods());
+ Method listenerMethod = null;
+ if (listenerMethodName != null) {
+ for (Method listenerMethod1 : listenerMethods) {
+ if ((listenerMethod1).getName().equals(listenerMethodName)) {
+ listenerMethod = listenerMethod1;
+ break;
+ }
+ }
+ }
+ if (listenerMethodName != null && listenerMethod == null)
+ throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName());
+ Class[] parameterTypes = listenerMethods.get(0).getParameterTypes();
+ Class<?> methodContainerClass = methodContainer.getClass();
+ final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes);
+ descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(),
+ new Class[]{listenerClass},
+ new InvocationHandler() {
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ String methodName = method.getName();
+ if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) {
+ try {
+ return targetMethod.invoke(methodContainer, args);
+ }
+ catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (methodName.equals("toString")) {
+ return toString();
+ }
+ if (methodName.equals("equals")) {
+ return descriptor.eventListener == args[0];
+ }
+ if (methodName.equals("hashCode")) {
+ return hashCode();
+ }
+ return null;
+ }
+ });
+ descriptors.add(descriptor);
+ return descriptor.eventListener;
+ }
+ catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) {
+ return getEventListener(listenerClass, null, methodContainer, methodName);
+ }
+
+
+ public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) {
+ WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object);
+ List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get();
+ if (listeners == null) {
+ listeners = new ArrayList<DataBindingUpdateListener>();
+ dataBindingUpdateListeners.put(object, new WeakReference<List<DataBindingUpdateListener>>(listeners));
+ } else {
+ for (DataBindingUpdateListener listener : listeners) {
+ if (bindingName.equals(listener.getBindingName()))
+ return listener;
+ }
+ }
+ DataBindingUpdateListener listener = new DataBindingUpdateListener(object, bindingName);
+ listeners.add(listener);
+ return listener;
+ }
+
+
+ public static void setComponentWidth(Component component, int width) {
+ component.setSize(width, component.getHeight());
+ if (component instanceof JComponent) {
+ JComponent jcomponent = (JComponent) component;
+ jcomponent.setPreferredSize(new Dimension(width, jcomponent.getPreferredSize().height));
+ jcomponent.setMinimumSize(new Dimension(width, jcomponent.getPreferredSize().height));
+ if (jcomponent.isDisplayable())
+ jcomponent.revalidate();
+ }
+ }
+
+
+ public static void setComponentHeight(Component component, int height) {
+ component.setSize(component.getWidth(), height);
+ if (component instanceof JComponent) {
+ JComponent jcomponent = (JComponent) component;
+ jcomponent.setPreferredSize(new Dimension(jcomponent.getPreferredSize().width, height));
+ jcomponent.setMinimumSize(new Dimension(jcomponent.getPreferredSize().width, height));
+ if (jcomponent.isDisplayable())
+ jcomponent.revalidate();
+ }
+ }
+
+
+ public static boolean assignment(boolean value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static byte assignment(byte value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static short assignment(short value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static int assignment(int value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static long assignment(long value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static float assignment(float value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static double assignment(double value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static char assignment(char value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+
+
+ public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) {
+ src.firePropertyChange(name.trim(), null, "dummy value");
+ return value;
+ }
+}
1
0
[Buix-commits] r564 - in trunk/lutinjaxx: core/src/main/java/jaxx/runtime runtime/src/main/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
by tchemit@users.labs.libre-entreprise.org 18 Apr '08
18 Apr '08
Author: tchemit
Date: 2008-04-18 19:47:05 +0000 (Fri, 18 Apr 2008)
New Revision: 564
Added:
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/builder/
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/css/
trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing/
Removed:
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/builder/
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/css/
trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing/
Log:
no default provider default module runtime instead with nothing to provide :) )
core module provides default handler for Object.class
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/builder (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/builder)
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/css (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/css)
Copied: trunk/lutinjaxx/runtime/src/main/java/jaxx/runtime/swing (from rev 560, trunk/lutinjaxx/core/src/main/java/jaxx/runtime/swing)
1
0