You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/08/12 23:31:00 UTC
svn commit: r803717 - in /incubator/pivot/trunk/wtk:
src/org/apache/pivot/wtk/ src/org/apache/pivot/wtk/skin/terra/
src/org/apache/pivot/wtkx/ test/org/apache/pivot/wtk/test/
Author: gbrown
Date: Wed Aug 12 21:31:00 2009
New Revision: 803717
URL: http://svn.apache.org/viewvc?rev=803717&view=rev
Log:
Resolve issue PIVOT-214; fix bug in initializing/validating min. pref. width and height; fix Javadoc issues in Compiler and Translator.
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Compiler.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/WindowTest.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=803717&r1=803716&r2=803717&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Aug 12 21:31:00 2009
@@ -570,9 +570,9 @@
private int preferredHeight = -1;
// Bounds on preferred size
- private int minPreferredWidth = Integer.MIN_VALUE;
+ private int minPreferredWidth = 0;
private int maxPreferredWidth = Integer.MAX_VALUE;
- private int minPreferredHeight = Integer.MIN_VALUE;
+ private int minPreferredHeight = 0;
private int maxPreferredHeight = Integer.MAX_VALUE;
// Calculated preferred size value
@@ -1168,6 +1168,10 @@
if (previousMinPreferredWidth != minPreferredWidth
|| previousMaxPreferredWidth != maxPreferredWidth) {
+ if (minPreferredWidth < 0) {
+ throw new IllegalArgumentException("minPreferredWidth is negative.");
+ }
+
if (minPreferredWidth > maxPreferredWidth) {
throw new IllegalArgumentException("minPreferredWidth > maxPreferredWidth");
}
@@ -1278,6 +1282,10 @@
if (previousMinPreferredHeight != minPreferredHeight
|| previousMaxPreferredHeight != maxPreferredHeight) {
+ if (minPreferredHeight < 0) {
+ throw new IllegalArgumentException("minPreferredHeight is negative.");
+ }
+
if (minPreferredHeight > maxPreferredHeight) {
throw new IllegalArgumentException("minPreferredHeight > maxPreferredHeight");
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java?rev=803717&r1=803716&r2=803717&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java Wed Aug 12 21:31:00 2009
@@ -678,11 +678,15 @@
if (frame.isPreferredWidthSet()) {
preferredWidth = Math.max(location.x - frame.getX() + resizeOffset.x,
titleBarTablePane.getPreferredWidth(-1) + 2);
+ preferredWidth = Math.min(preferredWidth, frame.getMaxPreferredWidth());
+ preferredWidth = Math.max(preferredWidth, frame.getMinPreferredWidth());
}
if (frame.isPreferredHeightSet()) {
preferredHeight = Math.max(location.y - frame.getY() + resizeOffset.y,
titleBarTablePane.getHeight() + resizeHandle.getHeight() + 7);
+ preferredHeight = Math.min(preferredHeight, frame.getMaxPreferredHeight());
+ preferredHeight = Math.max(preferredHeight, frame.getMinPreferredHeight());
}
frame.setPreferredSize(preferredWidth, preferredHeight);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Compiler.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Compiler.java?rev=803717&r1=803716&r2=803717&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Compiler.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Compiler.java Wed Aug 12 21:31:00 2009
@@ -50,8 +50,7 @@
* @param resourceName
* A path name that identifies the WTKX resource. The path name should be
* of the form defined by {@link Class#getResource(String)} and is relative
- * to the base package. Note that this is the same form as is defined in
- * {@link Bindable.Load#resourceName()}.
+ * to the base package.
*
* @param options
* Compiler options, or <tt>null</tt> for no options.
@@ -93,8 +92,7 @@
* @param resourceName
* A path name that identifies the WTKX resource. The path name should be
* of the form defined by {@link Class#getResource(String)} and is relative
- * to the reference class. Note that this is the same form as is defined in
- * {@link Bindable.Load#resourceName()}.
+ * to the reference class.
*
* @return
* The preferred class name for a compiled version of the specified WTKX
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java?rev=803717&r1=803716&r2=803717&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java Wed Aug 12 21:31:00 2009
@@ -199,8 +199,7 @@
}
/**
- * Translates a WTKX resource into a Java source file. The translated class
- * will implement the {@link Bindable.ObjectHierarchy} interface.
+ * Translates a WTKX resource into a Java source file.
*
* @param referenceClass
* The class relative to which the WTKX resource can be found.
@@ -208,8 +207,7 @@
* @param resourceName
* A path name that identifies the WTKX resource. The path name should be
* of the form defined by {@link Class#getResource(String)} and is relative
- * to the base package. Note that this is the same form as is defined in
- * {@link Bindable.Load#resourceName()}.
+ * to the base package.
*
* @return
* The Java source file representation of the WTKX resource.
@@ -230,8 +228,7 @@
}
/**
- * Translates a WTKX input stream into a Java source file. The translated class
- * will implement the {@link Bindable.ObjectHierarchy} interface.
+ * Translates a WTKX input stream into a Java source file.
*
* @param inputStream
* The data stream from which the WTKX will be read.
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/WindowTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/WindowTest.java?rev=803717&r1=803716&r2=803717&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/WindowTest.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/WindowTest.java Wed Aug 12 21:31:00 2009
@@ -39,6 +39,10 @@
public void startup(Display display, Map<String, String> properties) {
window1.setTitle("Window 1");
window1.setPreferredSize(320, 240);
+ window1.setMinPreferredWidth(220);
+ window1.setMaxPreferredWidth(420);
+ window1.setMinPreferredHeight(140);
+ window1.setMaxPreferredHeight(340);
window1.getComponentListeners().add(new ComponentListener.Adapter() {
public void sizeChanged(Component component, int previousWidth, int previousHeight) {