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/08/31 17:45:14 UTC

svn commit: r991222 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/

Author: gbrown
Date: Tue Aug 31 15:45:13 2010
New Revision: 991222

URL: http://svn.apache.org/viewvc?rev=991222&view=rev
Log:
Resolve PIVOT-619; optimize repaints in TerraDialogSkin and TerraSheetSkin by only calling moveToFront() on owner when the dialog or sheet is not already top-most.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraDialogSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraDialogSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraDialogSkin.java?rev=991222&r1=991221&r2=991222&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraDialogSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraDialogSkin.java Tue Aug 31 15:45:13 2010
@@ -105,8 +105,10 @@ public class TerraDialogSkin extends Ter
     @Override
     public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
         Dialog dialog = (Dialog)container;
-        Window rootOwner = dialog.getRootOwner();
-        rootOwner.moveToFront();
+        if (!dialog.isTopMost()) {
+            Window rootOwner = dialog.getRootOwner();
+            rootOwner.moveToFront();
+        }
 
         return super.mouseDown(container, button, x, y);
     }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java?rev=991222&r1=991221&r2=991222&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java Tue Aug 31 15:45:13 2010
@@ -424,8 +424,10 @@ public class TerraSheetSkin extends Wind
     @Override
     public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
         Sheet sheet = (Sheet)container;
-        Window owner = sheet.getOwner();
-        owner.moveToFront();
+        if (!sheet.isTopMost()) {
+            Window owner = sheet.getOwner();
+            owner.moveToFront();
+        }
 
         boolean consumed = super.mouseDown(container, button, x, y);
 

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java?rev=991222&r1=991221&r2=991222&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java Tue Aug 31 15:45:13 2010
@@ -23,6 +23,7 @@ import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
 
 import org.apache.pivot.collections.ArrayList;
 import org.apache.pivot.collections.Dictionary;
@@ -35,7 +36,6 @@ import org.apache.pivot.wtk.Dimensions;
 import org.apache.pivot.wtk.GraphicsUtilities;
 import org.apache.pivot.wtk.Keyboard;
 import org.apache.pivot.wtk.Mouse;
-import org.apache.pivot.wtk.Orientation;
 import org.apache.pivot.wtk.SortDirection;
 import org.apache.pivot.wtk.TableView;
 import org.apache.pivot.wtk.TableViewColumnListener;
@@ -265,13 +265,15 @@ public class TerraTableViewHeaderSkin ex
             borderColor = disabledBorderColor;
         }
 
+        // Paint the background
         graphics.setPaint(new GradientPaint(width / 2f, 0, bevelColor,
             width / 2f, height, backgroundColor));
         graphics.fillRect(0, 0, width, height);
 
         // Paint the border
         graphics.setPaint(borderColor);
-        GraphicsUtilities.drawLine(graphics, 0, height - 1, width, Orientation.HORIZONTAL);
+        graphics.setStroke(new BasicStroke(1));
+        graphics.draw(new Line2D.Double(0.5, height - 0.5, width - 0.5, height - 0.5));
 
         // Paint the content
         TableView tableView = tableViewHeader.getTableView();
@@ -289,7 +291,7 @@ public class TerraTableViewHeaderSkin ex
                 if (columnIndex == pressedHeaderIndex) {
                     graphics.setPaint(new GradientPaint(width / 2f, 0, pressedBevelColor,
                         width / 2f, height, backgroundColor));
-                    graphics.fillRect(0, 0, width, height);
+                    graphics.fillRect(headerX, 0, headerWidth, height - 1);
                 }
 
                 // Paint the header data
@@ -340,7 +342,7 @@ public class TerraTableViewHeaderSkin ex
                 if (columnIndex < columnCount - 1
                     || includeTrailingVerticalGridLine) {
                     graphics.setPaint(borderColor);
-                    GraphicsUtilities.drawLine(graphics, headerX, 0, height, Orientation.VERTICAL);
+                    graphics.draw(new Line2D.Double(headerX + 0.5, 0.5, headerX + 0.5, height - 0.5));
                 }
 
                 headerX++;
@@ -705,7 +707,7 @@ public class TerraTableViewHeaderSkin ex
                         resizeHeaderIndex = headerIndex;
                     } else if (headersPressable) {
                         pressedHeaderIndex = headerIndex;
-                        repaintComponent(getHeaderBounds(pressedHeaderIndex));
+                        repaintComponent(headerBounds);
                     }
                 }
             }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java?rev=991222&r1=991221&r2=991222&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java Tue Aug 31 15:45:13 2010
@@ -154,16 +154,17 @@ public final class DesktopApplicationCon
                         } else {
                             ((TitledWindow)hostWindow).setTitle(DesktopDisplayHost.this.rootOwner.getTitle());
 
-                            java.util.ArrayList<BufferedImage> pictures = new java.util.ArrayList<BufferedImage>();
+                            java.util.ArrayList<BufferedImage> iconImages = new java.util.ArrayList<BufferedImage>();
                             for (Image icon : DesktopDisplayHost.this.rootOwner.getIcons()) {
                                 if (icon instanceof Picture) {
-                                    pictures.add(((Picture) icon).getBufferedImage());
+                                    iconImages.add(((Picture) icon).getBufferedImage());
                                 }
                             }
-                            if (pictures.size() == 1) {
-                                hostWindow.setIconImage(pictures.get(0));
-                            } else if (pictures.size() > 1) {
-                                hostWindow.setIconImages(pictures);
+
+                            if (iconImages.size() == 1) {
+                                hostWindow.setIconImage(iconImages.get(0));
+                            } else if (iconImages.size() > 1) {
+                                hostWindow.setIconImages(iconImages);
                             }
                         }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java?rev=991222&r1=991221&r2=991222&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java Tue Aug 31 15:45:13 2010
@@ -945,6 +945,22 @@ public class Window extends Container {
     }
 
     /**
+     * Determines if this is the top-most window.
+     */
+    public boolean isTopMost() {
+        Display display = getDisplay();
+        return display.get(display.getLength() - 1) == this;
+    }
+
+    /**
+     * Determines if this is the bottom-most window.
+     */
+    public boolean isBottomMost() {
+        Display display = getDisplay();
+        return display.get(0) == this;
+    }
+
+    /**
      * Moves the window to the top of the window stack. All owned windows are
      * subsequently moved to the front, ensuring that this window's owned windows
      * remain on top of it. If the window does not have any owned windows,