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/11/02 19:25:36 UTC

svn commit: r832001 - in /incubator/pivot/trunk: demos/src/org/apache/pivot/demos/decorator/ demos/www/ tutorials/src/org/apache/pivot/tutorials/menus/ tutorials/src/org/apache/pivot/tutorials/windows/ wtk/src/org/apache/pivot/wtk/skin/terra/

Author: gbrown
Date: Mon Nov  2 18:25:35 2009
New Revision: 832001

URL: http://svn.apache.org/viewvc?rev=832001&view=rev
Log:
Eliminate padding style from TerraFrameSkin and TerraSheetSkin (in most cases, a padding style will be supported by the window's content, so this style is somewhat redundant in TerraFrameSkin; in TerraSheetSkin, setting padding to a non-zero value actually produces the wrong UE, as the content appears to slide out from the padding rather than the top of the window).

Modified:
    incubator/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/translucent.wtkx
    incubator/pivot/trunk/demos/www/component_explorer.html
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.wtkx
    incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.wtkx
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx

Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/translucent.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/translucent.wtkx?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/pivot/trunk/demos/www/component_explorer.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/www/component_explorer.html?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/www/component_explorer.html (original)
+++ incubator/pivot/trunk/demos/www/component_explorer.html Mon Nov  2 18:25:35 2009
@@ -21,8 +21,8 @@
 <link rel="stylesheet" href="demo.css">
 <style type="text/css">
     * {
-       	padding: 0;
-       	margin:	0;
+           padding: 0;
+           margin:    0;
     }
 
     html, body {

Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.wtkx?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.wtkx?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java Mon Nov  2 18:25:35 2009
@@ -75,8 +75,6 @@
     public void install(Component component) {
         super.install(component);
 
-        setPadding(0);
-
         final FileBrowserSheet fileBrowserSheet = (FileBrowserSheet)component;
         final FileBrowserSheet.Mode mode = fileBrowserSheet.getMode();
 

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=832001&r1=832000&r2=832001&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 Mon Nov  2 18:25:35 2009
@@ -24,7 +24,6 @@
 import java.awt.RenderingHints;
 import java.awt.geom.Line2D;
 
-import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.wtk.Bounds;
 import org.apache.pivot.wtk.Button;
 import org.apache.pivot.wtk.ButtonPressListener;
@@ -227,7 +226,6 @@
     private Color inactiveTitleBarBackgroundColor;
     private Color inactiveTitleBarBorderColor;
     private Color contentBorderColor;
-    private Insets padding;
     private boolean resizable;
 
     // Derived colors
@@ -248,7 +246,6 @@
         inactiveTitleBarBackgroundColor = theme.getColor(9);
         inactiveTitleBarBorderColor = theme.getColor(7);
         contentBorderColor = theme.getColor(7);
-        padding = new Insets(8);
         resizable = true;
 
         // Set the derived colors
@@ -370,7 +367,7 @@
             if (height != -1) {
                 // Subtract padding, top/bottom content borders, and content bevel
                 // from height constraint
-                height -= (padding.top + padding.bottom) + 3;
+                height -= 3;
 
                 height = Math.max(height, 0);
             }
@@ -379,7 +376,7 @@
         }
 
         // Add padding and left/right content borders
-        preferredWidth += (padding.left + padding.right) + 2;
+        preferredWidth += 2;
 
         return preferredWidth;
     }
@@ -402,17 +399,14 @@
         Component content = frame.getContent();
         if (content != null) {
             if (width != -1) {
-                // Subtract padding and left/right content borders from constraint
-                width -= (padding.left + padding.right) + 2;
-
-                width = Math.max(width, 0);
+                width = Math.max(width - 2, 0);
             }
 
             preferredHeight += content.getPreferredHeight(width);
         }
 
-        // Add padding, top/bottom content borders, and content bevel
-        preferredHeight += (padding.top + padding.bottom) + 3;
+        // Add top/bottom content borders and content bevel
+        preferredHeight += 3;
 
         return preferredHeight;
     }
@@ -449,8 +443,8 @@
         }
 
         // Add padding, borders, and content bevel
-        preferredWidth += (padding.left + padding.right) + 2;
-        preferredHeight += (padding.top + padding.bottom) + 3;
+        preferredWidth += 2;
+        preferredHeight += 3;
 
         return new Dimensions(preferredWidth, preferredHeight);
     }
@@ -501,13 +495,8 @@
             // Size/position content
             Component content = frame.getContent();
             if (content != null) {
-                int contentX = clientX + padding.left;
-                int contentY = clientY + padding.top;
-                int contentWidth = Math.max(clientWidth - (padding.left + padding.right), 0);
-                int contentHeight = Math.max(clientHeight - (clientY + padding.top + padding.bottom) + 1, 0);
-
-                content.setLocation(contentX, contentY);
-                content.setSize(contentWidth, contentHeight);
+                content.setLocation(clientX, clientY);
+                content.setSize(clientWidth, Math.max(clientHeight - clientY + 1, 0));
             }
         } else {
             titleBarTablePane.setVisible(false);
@@ -526,9 +515,8 @@
 
             Component content = frame.getContent();
             if (content != null) {
-                content.setLocation(padding.left, clientY + padding.top);
-                content.setSize(Math.max(width - (padding.left + padding.right), 0),
-                    Math.max(height - (clientY + padding.top + padding.bottom), 0));
+                content.setLocation(0, clientY);
+                content.setSize(width, Math.max(height - clientY, 0));
             }
         }
     }
@@ -645,47 +633,6 @@
         setShowCloseButton(showWindowControls);
     }
 
-    public Insets getPadding() {
-        return padding;
-    }
-
-    public void setPadding(Insets padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        this.padding = padding;
-        invalidateComponent();
-    }
-
-    public final void setPadding(Dictionary<String, ?> padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        setPadding(new Insets(padding));
-    }
-
-    public final void setPadding(int padding) {
-        setPadding(new Insets(padding));
-    }
-
-    public final void setPadding(Number padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        setPadding(padding.intValue());
-    }
-
-    public final void setPadding(String padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        setPadding(Insets.decode(padding));
-    }
-
     public boolean isResizable() {
         return resizable;
     }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java Mon Nov  2 18:25:35 2009
@@ -66,11 +66,6 @@
         }
     }
 
-    public TerraPromptSkin() {
-        setResizable(false);
-        setPadding(0);
-    }
-
     @Override
     public void install(Component component) {
         super.install(component);

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java Mon Nov  2 18:25:35 2009
@@ -20,7 +20,6 @@
 import java.awt.Graphics2D;
 import java.awt.Toolkit;
 
-import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.util.Vote;
 import org.apache.pivot.wtk.Bounds;
 import org.apache.pivot.wtk.Component;
@@ -32,7 +31,6 @@
 import org.apache.pivot.wtk.Display;
 import org.apache.pivot.wtk.GraphicsUtilities;
 import org.apache.pivot.wtk.ImageView;
-import org.apache.pivot.wtk.Insets;
 import org.apache.pivot.wtk.Keyboard;
 import org.apache.pivot.wtk.Mouse;
 import org.apache.pivot.wtk.Orientation;
@@ -99,8 +97,8 @@
     private Image resizeImage = new ResizeImage();
     private ImageView resizeHandle = new ImageView(resizeImage);
     private Point resizeOffset = null;
+
     private Color borderColor;
-    private Insets padding;
     private boolean resizable;
 
     // Derived colors
@@ -189,7 +187,6 @@
         setBackgroundColor(backgroundColor);
 
         borderColor = theme.getColor(7);
-        padding = new Insets(8);
         resizable = false;
 
         // Set the derived colors
@@ -219,13 +216,13 @@
 
         if (content != null) {
             if (height != -1) {
-                height = Math.max(height - (padding.top + padding.bottom + 2), 0);
+                height = Math.max(height - 2, 0);
             }
 
             preferredWidth = content.getPreferredWidth(height);
         }
 
-        preferredWidth += (padding.left + padding.right + 2);
+        preferredWidth += 2;
 
         return preferredWidth;
     }
@@ -239,13 +236,13 @@
 
         if (content != null) {
             if (width != -1) {
-                width = Math.max(width - (padding.left + padding.right + 2), 0);
+                width = Math.max(width - 2, 0);
             }
 
             preferredHeight = content.getPreferredHeight(width);
         }
 
-        preferredHeight += (padding.top + padding.bottom + 2);
+        preferredHeight += 2;
         preferredHeight = getEasedPreferredHeight(preferredHeight);
 
         return preferredHeight;
@@ -265,8 +262,8 @@
             preferredHeight = preferredContentSize.height;
         }
 
-        preferredWidth += (padding.left + padding.right + 2);
-        preferredHeight += (padding.top + padding.bottom + 2);
+        preferredWidth += 2;
+        preferredHeight += 2;
         preferredHeight = getEasedPreferredHeight(preferredHeight);
 
         Dimensions preferredSize = new Dimensions(preferredWidth, preferredHeight);
@@ -274,29 +271,6 @@
         return preferredSize;
     }
 
-    @Override
-    public int getBaseline(int width) {
-        int baseline = -1;
-
-        Sheet sheet = (Sheet)getComponent();
-        Component content = sheet.getContent();
-
-        if (content != null
-            && content.isVisible()) {
-            if (width != -1) {
-                width = Math.max(width - (padding.left + padding.right + 2), 0);
-            }
-
-            baseline = content.getPreferredHeight(width);
-        }
-
-        if (baseline != -1) {
-            baseline += padding.top + 1;
-        }
-
-        return baseline;
-    }
-
     public int getEasedPreferredHeight(int preferredHeight) {
         if (openTransition != null
             && openTransition.isRunning()) {
@@ -331,10 +305,10 @@
         Component content = sheet.getContent();
 
         if (content != null) {
-            content.setLocation(padding.left + 1, padding.top + 1);
+            content.setLocation(1, 1);
 
-            int contentWidth = Math.max(width - (padding.left + padding.right + 2), 0);
-            int contentHeight = Math.max(height - (padding.top + padding.bottom + 2), 0);
+            int contentWidth = Math.max(width - 2, 0);
+            int contentHeight = Math.max(height - 2, 0);
 
             content.setSize(contentWidth, contentHeight);
         }
@@ -502,47 +476,6 @@
         setBorderColor(GraphicsUtilities.decodeColor(borderColor));
     }
 
-    public Insets getPadding() {
-        return padding;
-    }
-
-    public void setPadding(Insets padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        this.padding = padding;
-        invalidateComponent();
-    }
-
-    public final void setPadding(Dictionary<String, ?> padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        setPadding(new Insets(padding));
-    }
-
-    public final void setPadding(int padding) {
-        setPadding(new Insets(padding));
-    }
-
-    public final void setPadding(Number padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        setPadding(padding.intValue());
-    }
-
-    public final void setPadding(String padding) {
-        if (padding == null) {
-            throw new IllegalArgumentException("padding is null.");
-        }
-
-        setPadding(Insets.decode(padding));
-    }
-
     public boolean isResizable() {
         return resizable;
     }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx?rev=832001&r1=832000&r2=832001&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx Mon Nov  2 18:25:35 2009
@@ -16,7 +16,7 @@
 limitations under the License.
 -->
 
-<BoxPane orientation="vertical" styles="{spacing:8, fill:true}"
+<BoxPane orientation="vertical" styles="{padding:8, spacing:8, fill:true}"
     xmlns:wtkx="http://pivot.apache.org/wtkx"
     xmlns:collections="org.apache.pivot.collections"
     xmlns="org.apache.pivot.wtk">