harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aiva...@apache.org
Subject svn commit: r568550 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/text/html/ImageView.java test/api/java.injected/javax/swing/text/html/ImageViewTest.java
Date Wed, 22 Aug 2007 10:44:27 GMT
Author: aivanov
Date: Wed Aug 22 03:44:26 2007
New Revision: 568550

URL: http://svn.apache.org/viewvc?rev=568550&view=rev
Log:
Patch for HARMONY-4645: [classlib][swing][html] Implementation of asynchronously image loading
for HTML Documents.
Rolling back changes to ImageViewTest applied with HARMONY-4573.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java?rev=568550&r1=568549&r2=568550&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/html/ImageView.java
Wed Aug 22 03:44:26 2007
@@ -21,7 +21,7 @@
 package javax.swing.text.html;
 
 import java.awt.Color;
-import java.awt.Component;
+import java.awt.Container;
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
@@ -54,8 +54,7 @@
     private BackgroundImageLoader loader;
     private String src;
 
-    //TODO We can load images only synchronously yet
-    private boolean synchronous = true;
+    private boolean synchronous = false;
 
     private Color color;
     
@@ -131,7 +130,7 @@
                        .getAttribute(HTML.Attribute.ALT);
     }
 
-public void paint(final Graphics g, final Shape shape) {
+    public void paint(final Graphics g, final Shape shape) {
         
         Rectangle rc = shape.getBounds();
         rc.setSize(rc.width - 2*(hSpace + border), rc.height - 2*(vSpace + border));
@@ -281,12 +280,20 @@
                                            desiredWidth, desiredHeight) {
             protected void onReady() {
                 super.onReady();
-                preferenceChanged(ImageView.this, true, true);
+                update();
             }
 
             protected void onError() {
                 super.onError();
+                update();
+            }
+
+            private void update() {
                 preferenceChanged(ImageView.this, true, true);
+                final Container component = getContainer();
+                if (component != null) {
+                    component.repaint();
+                }
             }
         };
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java?rev=568550&r1=568549&r2=568550&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/ImageViewTest.java
Wed Aug 22 03:44:26 2007
@@ -263,11 +263,17 @@
         assertEquals(isHarmony() ? 18 : 38, icon.getIconHeight());
     }
 
-    public void testSetGetLoadsSynchronously() {
+    public void testSetLoadsSynchronously() {
+        assertFalse(view.getLoadsSynchronously());
+
         view.setLoadsSynchronously(true);
         assertTrue(view.getLoadsSynchronously());
 
         view.setLoadsSynchronously(false);
+        assertFalse(view.getLoadsSynchronously());
+    }
+
+    public void testGetLoadsSynchronously() {
         assertFalse(view.getLoadsSynchronously());
     }
 



Mime
View raw message