2002/08/16 23:36:14
[org.ibex.core.git] / src / org / xwt / Box.java
index c60552c..86eb459 100644 (file)
@@ -438,9 +438,10 @@ public final class Box extends JSObject {
                 if (str.endsWith(".jpeg") || str.endsWith(".jpg"))
                     str = "http://xmlrpc.xwt.org/jpeg2png/" + str.substring(str.indexOf("//") + 2);
 
-                final HTTP http = new HTTP(str);
-                final int contentLength = http.getContentLength();
-                InputStream is = new FilterInputStream(http.getInputStream()) {
+                HTTP http = new HTTP(str);
+                final HTTP.HTTPInputStream in = http.GET();
+                final int contentLength = in.getContentLength();
+                InputStream is = new FilterInputStream(in) {
                         int bytesDownloaded = 0;
                         boolean clear = true;
                         public int read() throws IOException {
@@ -467,10 +468,9 @@ public final class Box extends JSObject {
                             return ret;
                         }
                     };
-
-                if (str.endsWith(".gif")) ret = GIF.decode(is, str);
-                else ret = PNG.decode(is, str);
-                return ret;
+                
+                if (str.endsWith(".gif")) return GIF.decode(is, str);
+                else return PNG.decode(is, str);
 
             } catch (IOException e) {
                 if (Log.on) Log.log(Box.class, "error while trying to load an image from " + str);
@@ -881,7 +881,6 @@ public final class Box extends JSObject {
             int y1 = max(y, pos(1) + bh);
             int x2 = min(x + w, pos(0) + size(0) - bw);
             int y2 = min(y + h, pos(1) + size(1) - bh);
-            buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
             if (y2 - y1 > 0 && x2 - x1 > 0)
                 buf.fillRect(x1,y1,x2,y2,(color & 0xFF000000) != 0 ? color : SpecialBoxProperty.lightGray);
         }
@@ -1201,6 +1200,12 @@ public final class Box extends JSObject {
         return super.has(name, start);
     }
 
+    public Object[] getIds() {
+        Object[] ret = new Object[numChildren()];
+        for(int i=0; i<ret.length; i++) ret[i] = get(i, null);
+        return ret;
+    }
+
     public void put(String name, Scriptable start, Object value) { put(name, start, value, false, null); }
     public void put(String name, Scriptable start, Object value, boolean ignoretraps) { put(name, start, value, ignoretraps, null); }