Author: gbrown
Date: Sun May 16 03:13:26 2010
New Revision: 944759

URL: http://svn.apache.org/viewvc?rev=944759&view=rev
Log:
Minor L&F tweaks: give all push button-like components very slightly rounded 
corners, including tab buttons; improve overall tab button appearance; remove 
divider line from all popup buttons except ListButton (it is the only popup 
button that will ultimately support split behavior, and also sizes its content 
to match the maximum size of the list view's content such that a divider is 
necessary); revert TerraRadioButtonSkin to draw a simple gradient rather than a 
radial gradient to support possible Java 5 backport.

Modified:
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
 Sun May 16 03:13:26 2010
@@ -23,7 +23,7 @@ import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
-import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
 import java.util.Locale;
 
 import org.apache.pivot.collections.Dictionary;
@@ -102,7 +102,6 @@ public class TerraCalendarButtonSkin ext
     private Color disabledBorderColor;
     private Insets padding;
 
-    // Derived colors
     private Color bevelColor;
     private Color pressedBevelColor;
     private Color disabledBevelColor;
@@ -110,7 +109,8 @@ public class TerraCalendarButtonSkin ext
     private Transition closeTransition = null;
     private DropShadowDecorator dropShadowDecorator = null;
 
-    private static final int TRIGGER_WIDTH = 14;
+    private static final int CORNER_RADIUS = 4;
+    private static final int TRIGGER_WIDTH = 10;
 
     private static final int CLOSE_TRANSITION_DURATION = 150;
     private static final int CLOSE_TRANSITION_RATE = 30;
@@ -233,27 +233,15 @@ public class TerraCalendarButtonSkin ext
             borderColor = disabledBorderColor;
         }
 
-        graphics.setStroke(new BasicStroke());
-
         // Paint the background
         graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
             width / 2f, height / 2f, backgroundColor));
-        graphics.fillRect(0, 0, width, height);
-
-        // Paint the border
-        graphics.setPaint(borderColor);
+        graphics.fill(new RoundRectangle2D.Double(0, 0, width, height,
+            CORNER_RADIUS, CORNER_RADIUS));
 
+        // Paint the content
         Bounds contentBounds = new Bounds(0, 0,
             Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(height - 1, 0));
-        GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
-            contentBounds.width + 1, contentBounds.height + 1);
-
-        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 
0), 0, TRIGGER_WIDTH,
-            Math.max(height - 1, 0));
-        GraphicsUtilities.drawRect(graphics, triggerBounds.x, triggerBounds.y,
-            triggerBounds.width + 1, triggerBounds.height + 1);
-
-        // Paint the content
         Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();
         dataRenderer.render(calendarButton.getButtonData(), calendarButton, 
false);
         dataRenderer.setSize(Math.max(contentBounds.width - (padding.left + 
padding.right + 2) + 1, 0),
@@ -265,21 +253,30 @@ public class TerraCalendarButtonSkin ext
         dataRenderer.paint(contentGraphics);
         contentGraphics.dispose();
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
+
+        // Paint the border
+        if (borderColor != null) {
+            graphics.setPaint(borderColor);
+            graphics.setStroke(new BasicStroke(1));
+            graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, 
height - 1,
+                CORNER_RADIUS, CORNER_RADIUS));
+        }
+
         // Paint the focus state
         if (calendarButton.isFocused()) {
             BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] { 0.0f, 2.0f }, 
0.0f);
-
+                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
             graphics.setStroke(dashStroke);
-            graphics.setColor(borderColor);
-
-            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
-
-            graphics.draw(new Rectangle2D.Double(2.5, 2.5, 
Math.max(contentBounds.width - 4, 0),
-                Math.max(contentBounds.height - 4, 0)));
+            graphics.setColor(this.borderColor);
+            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width 
- 5, 0),
+                Math.max(height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 
2));
         }
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_OFF);
+
         // Paint the trigger
         GeneralPath triggerIconShape = new 
GeneralPath(GeneralPath.WIND_EVEN_ODD);
         triggerIconShape.moveTo(0, 0);
@@ -291,10 +288,10 @@ public class TerraCalendarButtonSkin ext
         triggerGraphics.setStroke(new BasicStroke(0));
         triggerGraphics.setPaint(color);
 
-        int tx = triggerBounds.x + Math.round((triggerBounds.width
-            - triggerIconShape.getBounds().width) / 2f);
-        int ty = triggerBounds.y + Math.round((triggerBounds.height
-            - triggerIconShape.getBounds().height) / 2f);
+        Bounds triggerBounds = new Bounds(Math.max(width - (padding.right + 
TRIGGER_WIDTH), 0),
+            0, TRIGGER_WIDTH, Math.max(height - (padding.top - 
padding.bottom), 0));
+        int tx = triggerBounds.x + (triggerBounds.width - 
triggerIconShape.getBounds().width) / 2;
+        int ty = triggerBounds.y + (triggerBounds.height - 
triggerIconShape.getBounds().height) / 2;
         triggerGraphics.translate(tx, ty);
 
         triggerGraphics.draw(triggerIconShape);

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
 Sun May 16 03:13:26 2010
@@ -34,7 +34,6 @@ import org.apache.pivot.wtk.Orientation;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.skin.CheckboxSkin;
 
-
 /**
  * Terra checkbox skin.
  * <p>

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java
 Sun May 16 03:13:26 2010
@@ -23,7 +23,7 @@ import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
-import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.wtk.Border;
@@ -54,14 +54,14 @@ public class TerraColorChooserButtonSkin
     private Color disabledBorderColor;
     private Insets padding;
 
-    // Derived colors
     private Color bevelColor;
     private Color pressedBevelColor;
     private Color disabledBevelColor;
 
     private DropShadowDecorator dropShadowDecorator = null;
 
-    private static final int TRIGGER_WIDTH = 14;
+    private static final int CORNER_RADIUS = 4;
+    private static final int TRIGGER_WIDTH = 10;
 
     public TerraColorChooserButtonSkin() {
         TerraTheme theme = (TerraTheme)Theme.getTheme();
@@ -179,27 +179,15 @@ public class TerraColorChooserButtonSkin
             borderColor = disabledBorderColor;
         }
 
-        graphics.setStroke(new BasicStroke());
-
         // Paint the background
         graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
             width / 2f, height / 2f, backgroundColor));
-        graphics.fillRect(0, 0, width, height);
-
-        // Paint the border
-        graphics.setPaint(borderColor);
+        graphics.fill(new RoundRectangle2D.Double(0, 0, width, height,
+            CORNER_RADIUS, CORNER_RADIUS));
 
+        // Paint the content
         Bounds contentBounds = new Bounds(0, 0,
             Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(height - 1, 0));
-        GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
-            contentBounds.width + 1, contentBounds.height + 1);
-
-        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 
0), 0,
-            TRIGGER_WIDTH, Math.max(height - 1, 0));
-        GraphicsUtilities.drawRect(graphics, triggerBounds.x, triggerBounds.y,
-            triggerBounds.width + 1, triggerBounds.height + 1);
-
-        // Paint the content
         Button.DataRenderer dataRenderer = 
colorChooserButton.getDataRenderer();
         dataRenderer.render(colorChooserButton.getButtonData(), 
colorChooserButton, false);
         dataRenderer.setSize(Math.max(contentBounds.width - (padding.left + 
padding.right + 2) + 1, 0),
@@ -211,21 +199,40 @@ public class TerraColorChooserButtonSkin
         dataRenderer.paint(contentGraphics);
         contentGraphics.dispose();
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
+
+        // Paint the border
+        if (borderColor != null) {
+            graphics.setPaint(borderColor);
+            graphics.setStroke(new BasicStroke(1));
+            graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, 
height - 1,
+                CORNER_RADIUS, CORNER_RADIUS));
+        }
+
         // Paint the focus state
         if (colorChooserButton.isFocused()) {
             BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
                 BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
             graphics.setStroke(dashStroke);
-            graphics.setColor(borderColor);
-
-            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
+            graphics.setColor(this.borderColor);
+            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width 
- 5, 0),
+                Math.max(height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 
2));
+        }
 
-            graphics.draw(new Rectangle2D.Double(2.5, 2.5, 
Math.max(contentBounds.width - 4, 0),
-                Math.max(contentBounds.height - 4, 0)));
+        // Paint the focus state
+        if (colorChooserButton.isFocused()) {
+            BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
+                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
+            graphics.setStroke(dashStroke);
+            graphics.setColor(this.borderColor);
+            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width 
- 5, 0),
+                Math.max(height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 
2));
         }
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_OFF);
+
         // Paint the trigger
         GeneralPath triggerIconShape = new 
GeneralPath(GeneralPath.WIND_EVEN_ODD);
         triggerIconShape.moveTo(0, 0);
@@ -237,10 +244,10 @@ public class TerraColorChooserButtonSkin
         triggerGraphics.setStroke(new BasicStroke(0));
         triggerGraphics.setPaint(color);
 
-        int tx = triggerBounds.x + Math.round((triggerBounds.width
-            - triggerIconShape.getBounds().width) / 2f);
-        int ty = triggerBounds.y + Math.round((triggerBounds.height
-            - triggerIconShape.getBounds().height) / 2f);
+        Bounds triggerBounds = new Bounds(Math.max(width - (padding.right + 
TRIGGER_WIDTH), 0),
+            0, TRIGGER_WIDTH, Math.max(height - (padding.top - 
padding.bottom), 0));
+        int tx = triggerBounds.x + (triggerBounds.width - 
triggerIconShape.getBounds().width) / 2;
+        int ty = triggerBounds.y + (triggerBounds.height - 
triggerIconShape.getBounds().height) / 2;
         triggerGraphics.translate(tx, ty);
 
         triggerGraphics.draw(triggerIconShape);

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
 Sun May 16 03:13:26 2010
@@ -23,7 +23,8 @@ import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
-import java.awt.geom.Rectangle2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.RoundRectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.List;
@@ -104,7 +105,6 @@ public class TerraListButtonSkin extends
     private Color disabledBorderColor;
     private Insets padding;
 
-    // Derived colors
     private Color bevelColor;
     private Color pressedBevelColor;
     private Color disabledBevelColor;
@@ -112,6 +112,7 @@ public class TerraListButtonSkin extends
     private Transition closeTransition = null;
     private DropShadowDecorator dropShadowDecorator = null;
 
+    private static final int CORNER_RADIUS = 4;
     private static final int TRIGGER_WIDTH = 14;
 
     private static final int CLOSE_TRANSITION_DURATION = 250;
@@ -267,22 +268,12 @@ public class TerraListButtonSkin extends
         // Paint the background
         graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
             width / 2f, height / 2f, backgroundColor));
-        graphics.fillRect(0, 0, width, height);
-
-        // Paint the border
-        graphics.setPaint(borderColor);
+        graphics.fill(new RoundRectangle2D.Double(0, 0, width, height,
+            CORNER_RADIUS, CORNER_RADIUS));
 
+        // Paint the content
         Bounds contentBounds = new Bounds(0, 0,
             Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(height - 1, 0));
-        GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
-            contentBounds.width + 1, contentBounds.height + 1);
-
-        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 
0), 0,
-            TRIGGER_WIDTH, Math.max(height - 1, 0));
-        GraphicsUtilities.drawRect(graphics, triggerBounds.x, triggerBounds.y,
-            triggerBounds.width + 1, triggerBounds.height + 1);
-
-        // Paint the content
         Button.DataRenderer dataRenderer = listButton.getDataRenderer();
         dataRenderer.render(listButton.getButtonData(), listButton, false);
         dataRenderer.setSize(Math.max(contentBounds.width - (padding.left + 
padding.right + 2) + 1, 0),
@@ -294,6 +285,17 @@ public class TerraListButtonSkin extends
         dataRenderer.paint(contentGraphics);
         contentGraphics.dispose();
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
+
+        // Paint the border
+        graphics.setPaint(borderColor);
+        graphics.setStroke(new BasicStroke(1));
+        graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height 
- 1,
+            CORNER_RADIUS, CORNER_RADIUS));
+        graphics.draw(new Line2D.Double(contentBounds.x + contentBounds.width, 
0.5,
+            contentBounds.x + contentBounds.width, contentBounds.height));
+
         // Paint the focus state
         if (listButton.isFocused()) {
             BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
@@ -302,13 +304,13 @@ public class TerraListButtonSkin extends
             graphics.setStroke(dashStroke);
             graphics.setColor(borderColor);
 
-            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
-
-            graphics.draw(new Rectangle2D.Double(2.5, 2.5, 
Math.max(contentBounds.width - 4, 0),
-                Math.max(contentBounds.height - 4, 0)));
+            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, 
Math.max(contentBounds.width - 4, 0),
+                Math.max(contentBounds.height - 4, 0), CORNER_RADIUS / 2, 
CORNER_RADIUS / 2));
         }
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_OFF);
+
         // Paint the trigger
         GeneralPath triggerIconShape = new 
GeneralPath(GeneralPath.WIND_EVEN_ODD);
         triggerIconShape.moveTo(0, 0);
@@ -320,6 +322,8 @@ public class TerraListButtonSkin extends
         triggerGraphics.setStroke(new BasicStroke(0));
         triggerGraphics.setPaint(color);
 
+        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 
0), 0,
+            TRIGGER_WIDTH, Math.max(height - 1, 0));
         int tx = triggerBounds.x + Math.round((triggerBounds.width
             - triggerIconShape.getBounds().width) / 2f);
         int ty = triggerBounds.y + Math.round((triggerBounds.height

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
 Sun May 16 03:13:26 2010
@@ -23,7 +23,7 @@ import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
-import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.wtk.Bounds;
@@ -58,11 +58,12 @@ public class TerraMenuButtonSkin extends
     private float maximumAspectRatio;
     private boolean toolbar;
 
-    // Derived colors
     private Color bevelColor;
     private Color pressedBevelColor;
     private Color disabledBevelColor;
 
+    private static final int CORNER_RADIUS = 4;
+
     private WindowStateListener menuPopupWindowStateListener = new 
WindowStateListener.Adapter() {
         @Override
         public void windowClosed(Window window, Display display, Window owner) 
{
@@ -230,20 +231,14 @@ public class TerraMenuButtonSkin extends
             && bevelColor != null) {
             graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
                 width / 2f, height / 2f, backgroundColor));
-            graphics.fillRect(0, 0, width, height);
-        }
-
-        // Paint the border
-        if (borderColor != null) {
-            graphics.setPaint(borderColor);
-            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
+            graphics.fill(new RoundRectangle2D.Double(0, 0, width, height,
+                CORNER_RADIUS, CORNER_RADIUS));
         }
 
+        // Paint the content
         Bounds contentBounds = new Bounds(padding.left + 1, padding.top + 1,
             Math.max(width - (padding.left + padding.right + spacing + 
TRIGGER_WIDTH + 2), 0),
             Math.max(height - (padding.top + padding.bottom + 2), 0));
-
-        // Paint the content
         Button.DataRenderer dataRenderer = menuButton.getDataRenderer();
         dataRenderer.render(menuButton.getButtonData(), menuButton, 
highlighted);
         dataRenderer.setSize(contentBounds.width, contentBounds.height);
@@ -254,10 +249,32 @@ public class TerraMenuButtonSkin extends
         dataRenderer.paint(contentGraphics);
         contentGraphics.dispose();
 
-        // Paint the trigger
-        Bounds triggerBounds = new Bounds(Math.max(width - (padding.right + 
TRIGGER_WIDTH), 0),
-            0, TRIGGER_WIDTH, Math.max(height - (padding.top - 
padding.bottom), 0));
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
+
+        // Paint the border
+        if (borderColor != null) {
+            graphics.setPaint(borderColor);
+            graphics.setStroke(new BasicStroke(1));
+            graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, 
height - 1,
+                CORNER_RADIUS, CORNER_RADIUS));
+        }
+
+        // Paint the focus state
+        if (menuButton.isFocused()
+            && !toolbar) {
+            BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
+                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
+            graphics.setStroke(dashStroke);
+            graphics.setColor(this.borderColor);
+            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width 
- 5, 0),
+                Math.max(height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 
2));
+        }
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_OFF);
+
+        // Paint the trigger
         GeneralPath triggerIconShape = new 
GeneralPath(GeneralPath.WIND_EVEN_ODD);
         triggerIconShape.moveTo(0, 0);
         triggerIconShape.lineTo(3, 3);
@@ -268,6 +285,8 @@ public class TerraMenuButtonSkin extends
         triggerGraphics.setStroke(new BasicStroke(0));
         triggerGraphics.setPaint(color);
 
+        Bounds triggerBounds = new Bounds(Math.max(width - (padding.right + 
TRIGGER_WIDTH), 0),
+            0, TRIGGER_WIDTH, Math.max(height - (padding.top - 
padding.bottom), 0));
         int tx = triggerBounds.x + (triggerBounds.width - 
triggerIconShape.getBounds().width) / 2;
         int ty = triggerBounds.y + (triggerBounds.height - 
triggerIconShape.getBounds().height) / 2;
         triggerGraphics.translate(tx, ty);
@@ -276,22 +295,6 @@ public class TerraMenuButtonSkin extends
         triggerGraphics.fill(triggerIconShape);
 
         triggerGraphics.dispose();
-
-        // Paint the focus state
-        if (menuButton.isFocused()
-            && !toolbar) {
-            BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
-            graphics.setStroke(dashStroke);
-            graphics.setColor(borderColor);
-
-            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
-
-            graphics.draw(new Rectangle2D.Double(2.5, 2.5, Math.max(width - 5, 
0),
-                Math.max(height - 5, 0)));
-        }
     }
 
     @Override

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
 Sun May 16 03:13:26 2010
@@ -22,7 +22,7 @@ import java.awt.Font;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.wtk.Button;
@@ -51,11 +51,12 @@ public class TerraPushButtonSkin extends
     private float maximumAspectRatio;
     private boolean toolbar;
 
-    // Derived colors
     private Color bevelColor;
     private Color pressedBevelColor;
     private Color disabledBevelColor;
 
+    private static final int CORNER_RADIUS = 4;
+
     public TerraPushButtonSkin() {
         TerraTheme theme = (TerraTheme)Theme.getTheme();
 
@@ -220,13 +221,8 @@ public class TerraPushButtonSkin extends
             && bevelColor != null) {
             graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
                 width / 2f, height / 2f, backgroundColor));
-            graphics.fillRect(0, 0, width, height);
-        }
-
-        // Paint the border
-        if (borderColor != null) {
-            graphics.setPaint(borderColor);
-            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
+            graphics.fill(new RoundRectangle2D.Double(0, 0, width, height,
+                CORNER_RADIUS, CORNER_RADIUS));
         }
 
         // Paint the content
@@ -241,20 +237,26 @@ public class TerraPushButtonSkin extends
         dataRenderer.paint(contentGraphics);
         contentGraphics.dispose();
 
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
+
+        // Paint the border
+        if (borderColor != null) {
+            graphics.setPaint(borderColor);
+            graphics.setStroke(new BasicStroke(1));
+            graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, 
height - 1,
+                CORNER_RADIUS, CORNER_RADIUS));
+        }
+
         // Paint the focus state
         if (pushButton.isFocused()
             && !toolbar) {
             BasicStroke dashStroke = new BasicStroke(1.0f, 
BasicStroke.CAP_ROUND,
                 BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
             graphics.setStroke(dashStroke);
             graphics.setColor(this.borderColor);
-
-            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                RenderingHints.VALUE_ANTIALIAS_ON);
-
-            graphics.draw(new Rectangle2D.Double(2.5, 2.5, Math.max(width - 5, 
0),
-                Math.max(height - 5, 0)));
+            graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width 
- 5, 0),
+                Math.max(height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 
2));
         }
     }
 

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
 Sun May 16 03:13:26 2010
@@ -19,9 +19,9 @@ package org.apache.pivot.wtk.skin.terra;
 import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
+import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.Paint;
-import java.awt.RadialGradientPaint;
 import java.awt.RenderingHints;
 import java.awt.geom.Ellipse2D;
 import java.awt.geom.Rectangle2D;
@@ -34,7 +34,6 @@ import org.apache.pivot.wtk.RadioButton;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.skin.RadioButtonSkin;
 
-
 /**
  * Terra radio button skin.
  * <p>
@@ -183,10 +182,15 @@ public class TerraRadioButtonSkin extend
             BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);
 
         if (enabled) {
+            /*
             buttonPaint = new 
RadialGradientPaint((float)buttonBackgroundCircle.getCenterX(),
                 (float)buttonBackgroundCircle.getCenterY(),
                 (float)buttonBackgroundCircle.getWidth() * 2 / 3,
                 new float[] {0f, 1f}, new Color[] 
{TerraTheme.darken(buttonColor), buttonColor});
+            */
+
+            buttonPaint = new GradientPaint(BUTTON_DIAMETER / 2, 0, 
TerraTheme.darken(buttonColor),
+                BUTTON_DIAMETER / 2, BUTTON_DIAMETER / 2, buttonColor);
             buttonBorderColor = this.buttonBorderColor;
             buttonSelectionColor = this.buttonSelectionColor;
         }

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java?rev=944759&r1=944758&r2=944759&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java 
(original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java 
Sun May 16 03:13:26 2010
@@ -16,10 +16,14 @@
  */
 package org.apache.pivot.wtk.skin.terra;
 
+import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Line2D;
+import java.awt.geom.RoundRectangle2D;
 
 import org.apache.pivot.collections.Dictionary;
 import org.apache.pivot.collections.Sequence;
@@ -178,55 +182,76 @@ public class TerraTabPaneSkin extends Co
             boolean active = (selectionChangeTransition != null
                 && selectionChangeTransition.tab == tab);
 
-            Color backgroundColor = (tabButton.isSelected()
-                || active) ?
-                activeTabColor : inactiveTabColor;
+            Color backgroundColor, buttonBevelColor;
+            if (tabButton.isSelected()
+                || active) {
+                backgroundColor = activeTabColor;
+                buttonBevelColor = activeButtonBevelColor;
+            } else {
+                backgroundColor = inactiveTabColor;
+                buttonBevelColor = inactiveButtonBevelColor;
+            }
 
             int width = getWidth();
             int height = getHeight();
 
             // Draw the background
-            graphics.setPaint(backgroundColor);
-            graphics.fillRect(0, 0, width, height);
-
-            // Draw the bevel
-            graphics.setPaint(new GradientPaint(width / 2f, 1, 
buttonBevelColor,
-                width / 2f, GRADIENT_BEVEL_THICKNESS, backgroundColor));
-
             switch(tabOrientation) {
                 case HORIZONTAL: {
-                    graphics.fillRect(1, 1, width - 2, 
GRADIENT_BEVEL_THICKNESS);
+                    graphics.setPaint(new GradientPaint(width / 2f, 0, 
buttonBevelColor,
+                        width / 2f, height / 2f, backgroundColor));
+                    graphics.fill(new RoundRectangle2D.Double(0, 0, width, 
height + CORNER_RADIUS,
+                        CORNER_RADIUS, CORNER_RADIUS));
                     break;
                 }
 
                 case VERTICAL: {
-                    graphics.fillRect(1, 1, width - 1, 
GRADIENT_BEVEL_THICKNESS);
+                    graphics.setPaint(new GradientPaint(0, width / 2f, 
buttonBevelColor,
+                        height / 2f, width / 2f, backgroundColor));
+                    graphics.fill(new RoundRectangle2D.Double(0, 0, width + 
CORNER_RADIUS, height,
+                        CORNER_RADIUS, CORNER_RADIUS));
                     break;
                 }
             }
 
             // Draw the border
             graphics.setPaint(borderColor);
+            graphics.setStroke(new BasicStroke(1));
 
-            if (tabButton.isSelected()
-                || active) {
+            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_ON);
+
+            switch(tabOrientation) {
+                case HORIZONTAL: {
+                    graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width 
- 1, height + CORNER_RADIUS - 1,
+                        CORNER_RADIUS, CORNER_RADIUS));
+                    break;
+                }
+
+                case VERTICAL: {
+                    graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width 
+ CORNER_RADIUS - 1, height - 1,
+                        CORNER_RADIUS, CORNER_RADIUS));
+                    break;
+                }
+            }
+
+            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_OFF);
+
+            if (!(tabButton.isSelected()
+                || active)) {
+                // Draw divider
                 switch(tabOrientation) {
                     case HORIZONTAL: {
-                        GraphicsUtilities.drawLine(graphics, 0, 0, height, 
Orientation.VERTICAL);
-                        GraphicsUtilities.drawLine(graphics, 0, 0, width, 
Orientation.HORIZONTAL);
-                        GraphicsUtilities.drawLine(graphics, width - 1, 0, 
height, Orientation.VERTICAL);
+                        graphics.draw(new Line2D.Double(0.5, height - 0.5, 
width - 0.5, height - 0.5));
                         break;
                     }
 
                     case VERTICAL: {
-                        GraphicsUtilities.drawLine(graphics, 0, 0, width, 
Orientation.HORIZONTAL);
-                        GraphicsUtilities.drawLine(graphics, 0, 0, height, 
Orientation.VERTICAL);
-                        GraphicsUtilities.drawLine(graphics, 0, height - 1, 
width, Orientation.HORIZONTAL);
+                        graphics.draw(new Line2D.Double(width - 0.5, 0.5, 
width - 0.5, height - 0.5));
                         break;
                     }
                 }
-            } else {
-                GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
             }
 
             // Paint the content
@@ -366,7 +391,8 @@ public class TerraTabPaneSkin extends Co
     private Color disabledButtonColor;
     private Insets buttonPadding;
 
-    private Color buttonBevelColor;
+    private Color activeButtonBevelColor;
+    private Color inactiveButtonBevelColor;
 
     private boolean collapsible = false;
     private Orientation tabOrientation = Orientation.HORIZONTAL;
@@ -386,13 +412,12 @@ public class TerraTabPaneSkin extends Co
     private static final int SELECTION_CHANGE_DURATION = 250;
     private static final int SELECTION_CHANGE_RATE = 30;
 
-    public static final int GRADIENT_BEVEL_THICKNESS = 4;
+    public static final int CORNER_RADIUS = 4;
+    public static final int GRADIENT_BEVEL_THICKNESS = 8;
+
     private static final Button.DataRenderer DEFAULT_DATA_RENDERER = new 
ButtonDataRenderer() {
         @Override
         public void render(Object data, Button button, boolean highlighted) {
-            // TODO Create a custom inner renderer class that can display
-            // the close button (and also avoid the heap allocation every
-            // time we're called to render())
             Component tab = (Component)data;
             super.render(new ButtonData(TabPane.getIcon(tab), 
TabPane.getLabel(tab)),
                 button, highlighted);
@@ -410,7 +435,8 @@ public class TerraTabPaneSkin extends Co
         disabledButtonColor = theme.getColor(7);
         buttonPadding = new Insets(3, 4, 3, 4);
 
-        buttonBevelColor = TerraTheme.brighten(inactiveTabColor);
+        activeButtonBevelColor = TerraTheme.brighten(activeTabColor);
+        inactiveButtonBevelColor = TerraTheme.brighten(inactiveTabColor);
 
         buttonBoxPane.getStyles().put("fill", true);
 
@@ -884,16 +910,10 @@ public class TerraTabPaneSkin extends Co
 
             // Draw the border
             graphics.setPaint(borderColor);
+
+            // TODO Don't use drawRect() here; use Rectangle2D
             GraphicsUtilities.drawRect(graphics, contentBounds.x, 
contentBounds.y,
                 contentBounds.width, contentBounds.height);
-
-            // Draw the bevel for vertical tabs
-            if (tabOrientation == Orientation.VERTICAL) {
-                graphics.setPaint(new GradientPaint(width / 2f, 
contentBounds.y + 1, buttonBevelColor,
-                    width / 2f, contentBounds.y + 1 + 
GRADIENT_BEVEL_THICKNESS, activeTabColor));
-                graphics.fillRect(contentBounds.x + 1, contentBounds.y + 1,
-                    contentBounds.width - 2, GRADIENT_BEVEL_THICKNESS);
-            }
         }
     }
 
@@ -907,6 +927,7 @@ public class TerraTabPaneSkin extends Co
         }
 
         this.activeTabColor = activeTabColor;
+        activeButtonBevelColor = TerraTheme.brighten(activeTabColor);
         repaintComponent();
     }
 
@@ -933,7 +954,7 @@ public class TerraTabPaneSkin extends Co
         }
 
         this.inactiveTabColor = inactiveTabColor;
-        buttonBevelColor = TerraTheme.brighten(inactiveTabColor);
+        inactiveButtonBevelColor = TerraTheme.brighten(inactiveTabColor);
         repaintComponent();
     }
 


Reply via email to