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 2010/11/19 03:01:45 UTC
svn commit: r1036710 - in /pivot/trunk/wtk/src/org/apache/pivot/wtk:
Component.java Skin.java skin/ComponentSkin.java skin/FlowPaneSkin.java
skin/LabelSkin.java skin/TextPaneSkin.java
Author: gbrown
Date: Fri Nov 19 02:01:44 2010
New Revision: 1036710
URL: http://svn.apache.org/viewvc?rev=1036710&view=rev
Log:
Eliminate layout disposition from Component and Skin and apply width constraint, then height constraint when preferred dimensions exceed maximum values.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Skin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1036710&r1=1036709&r2=1036710&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Fri Nov 19 02:01:44 2010
@@ -1099,25 +1099,12 @@ public abstract class Component implemen
int preferredWidth = widthLimits.constrain(preferredSize.width);
int preferredHeight = heightLimits.constrain(preferredSize.height);
- Orientation layoutDisposition = getDisposition();
- if (layoutDisposition != null) {
- switch (layoutDisposition) {
- case HORIZONTAL: {
- if (preferredSize.width > preferredWidth) {
- preferredHeight = heightLimits.constrain(skin.getPreferredHeight(preferredWidth));
- }
-
- break;
- }
-
- case VERTICAL: {
- if (preferredSize.height > preferredHeight) {
- preferredWidth = widthLimits.constrain(skin.getPreferredWidth(preferredHeight));
- }
+ if (preferredSize.width > preferredWidth) {
+ preferredHeight = heightLimits.constrain(skin.getPreferredHeight(preferredWidth));
+ }
- break;
- }
- }
+ if (preferredSize.height > preferredHeight) {
+ preferredWidth = widthLimits.constrain(skin.getPreferredWidth(preferredHeight));
}
this.preferredSize = new Dimensions(preferredWidth, preferredHeight);
@@ -1958,17 +1945,6 @@ public abstract class Component implemen
}
/**
- * Returns the component's layout disposition.
- *
- * @return
- * The component's layout disposition, as determined by
- * {@link Skin#getDisposition()}.
- */
- public Orientation getDisposition() {
- return skin.getDisposition();
- }
-
- /**
* Called to lay out the component.
*/
protected void layout() {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Skin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Skin.java?rev=1036710&r1=1036709&r2=1036710&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Skin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Skin.java Fri Nov 19 02:01:44 2010
@@ -64,16 +64,6 @@ public interface Skin extends Constraine
public Component getComponent();
/**
- * Returns the skin's layout disposition. The layout disposition defines the
- * direction in which the skin lays out content before wrapping.
- *
- * @return
- * The skin's layout disposition, or <tt>null</tt> if the skin does not
- * have a layout disposition.
- */
- public Orientation getDisposition();
-
- /**
* If the component on which the skin is installed is a container, lays
* out the container's children.
*/
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java?rev=1036710&r1=1036709&r2=1036710&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java Fri Nov 19 02:01:44 2010
@@ -40,7 +40,6 @@ import org.apache.pivot.wtk.Keyboard;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.MenuHandler;
import org.apache.pivot.wtk.Mouse;
-import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.Point;
import org.apache.pivot.wtk.Skin;
import org.apache.pivot.wtk.Theme;
@@ -111,14 +110,6 @@ public abstract class ComponentSkin impl
}
/**
- * By default, skins do not have a layout disposition.
- */
- @Override
- public Orientation getDisposition() {
- return null;
- }
-
- /**
* By default, skins are focusable.
*/
@Override
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java?rev=1036710&r1=1036709&r2=1036710&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java Fri Nov 19 02:01:44 2010
@@ -23,7 +23,6 @@ import org.apache.pivot.wtk.Dimensions;
import org.apache.pivot.wtk.FlowPane;
import org.apache.pivot.wtk.HorizontalAlignment;
import org.apache.pivot.wtk.Insets;
-import org.apache.pivot.wtk.Orientation;
/**
* Flow pane skin.
@@ -235,11 +234,6 @@ public class FlowPaneSkin extends Contai
}
@Override
- public Orientation getDisposition() {
- return Orientation.HORIZONTAL;
- }
-
- @Override
public void layout() {
FlowPane flowPane = (FlowPane)getComponent();
int width = getWidth();
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java?rev=1036710&r1=1036709&r2=1036710&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java Fri Nov 19 02:01:44 2010
@@ -37,7 +37,6 @@ import org.apache.pivot.wtk.HorizontalAl
import org.apache.pivot.wtk.Insets;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.LabelListener;
-import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.Platform;
import org.apache.pivot.wtk.TextDecoration;
import org.apache.pivot.wtk.Theme;
@@ -216,11 +215,6 @@ public class LabelSkin extends Component
}
@Override
- public Orientation getDisposition() {
- return Orientation.HORIZONTAL;
- }
-
- @Override
public void layout() {
Label label = (Label)getComponent();
String text = label.getText();
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java?rev=1036710&r1=1036709&r2=1036710&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java Fri Nov 19 02:01:44 2010
@@ -34,7 +34,6 @@ import org.apache.pivot.wtk.GraphicsUtil
import org.apache.pivot.wtk.Insets;
import org.apache.pivot.wtk.Keyboard;
import org.apache.pivot.wtk.Mouse;
-import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.Platform;
import org.apache.pivot.wtk.TextPane;
import org.apache.pivot.wtk.TextPaneListener;
@@ -249,11 +248,6 @@ public class TextPaneSkin extends Contai
}
@Override
- public Orientation getDisposition() {
- return Orientation.HORIZONTAL;
- }
-
- @Override
public void layout() {
if (documentView != null) {
TextPane textPane = (TextPane)getComponent();