Re: [cp-patches] FYI: Implement java.awt.print

2006-05-17 Thread David Gilbert

Hi Sven,

Sven de Marothy wrote:


So, here's a first implementation, thanks to Wolfgang's work. ATM it's
fairly stupid, printing to an image and printing that (have patience if
you think it's slow). But it's a big step up from nothing!

2006-05-13  Sven de Marothy  [EMAIL PROTECTED]

* gnu/javax/print/ipp/IppRequest.java (send): Set a timeout.
	* java/awt/print/PrinterJob.java 
	(getPrinterJob): Return a JavaPrinterJob

(setPrintService,getPrintService): Implement.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c:
(getPixels): Gtk_threads_enter required.
* gnu/java/awt/print/JavaPrinterGraphics.java
* gnu/java/awt/print/JavaPrinterJob.java
	* gnu/java/awt/print/SpooledDocumet.java: 
	New files.


 

 



FindBugs points out that the following methods call themselves in an
infinite loop:

 public boolean drawImage(Image img, int x, int y, Color bgcolor, 
			   ImageObserver observer)

 {
   return drawImage(img, x, y, bgcolor, observer);
 }

 public boolean drawImage(Image img, int x, int y, ImageObserver observer)
 {
   return drawImage(img, x, y, observer);
 }

 public boolean drawImage(Image img, int x, int y, int width, int height, 
			   Color bgcolor, ImageObserver observer)

 {
   return drawImage(img, x, y, width, height, bgcolor, observer);
 }

 public boolean drawImage(Image img, int x, int y, int width, int height, 
			   ImageObserver observer)

 {
   return drawImage(img, x, y, width, height, observer);
 }

 public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, 
			   int sx1, int sy1, int sx2, int sy2, Color bgcolor, 
			   ImageObserver observer)

 {
   return drawImage(img, dx1,  dy1,  dx2,  dy2,  
		 sx1,  sy1,  sx2,  sy2, bgcolor, observer);

 }

 public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, 
			   int sx1, int sy1, int sx2, int sy2, ImageObserver observer)

 {
   return drawImage(img, dx1,  dy1,  dx2,  dy2,  
		 sx1,  sy1,  sx2,  sy2, observer);

 }


 



Regards,

Dave




[cp-patches] Initial implementation of java.net.URLConnection.guessContentTypeFromStream()

2006-05-17 Thread Petter Reinholdtsen

Here is a patch to implement some magic numbers in
java.net.URLConnection.guessContentTypeFromStream().  I picked a few
mime types which seemed relevant from /etc/mime-magic and implemented
tests for them.  Is this approach good enough?

Index: java/net/URLConnection.java
===
RCS file: /sources/classpath/classpath/java/net/URLConnection.java,v
retrieving revision 1.42
diff -u -3 -p -u -r1.42 URLConnection.java
--- java/net/URLConnection.java 12 May 2006 20:59:30 -  1.42
+++ java/net/URLConnection.java 16 May 2006 22:08:55 -
@@ -971,10 +971,30 @@ public abstract class URLConnection
* @exception IOException If an error occurs
*/
   public static String guessContentTypeFromStream(InputStream is)
-throws IOException, NotImplementedException
+throws IOException
   {
 // See /etc/gnome-vfs-mime-magic or /etc/mime-magic for a reasonable
 // idea of how to handle this.
+
+is.mark(5);
+int c0 = is.read();
+int c1 = is.read();
+int c2 = is.read();
+int c3 = is.read();
+is.reset();
+
+if (c0 == 0xFF  c1 == 0xD8)
+   return image/jpeg;
+
+if (c0 == 'G'  c1 == 'I'  c2 == 'F'  c3 == '8')
+   return image/gif;
+
+if (c1 == 'P'  c2 == 'N'  c3 == 'G')
+   return image/png;
+
+if (c0 == 'P'  c1 == 'K'  c2 == 3  c3 == 4)
+   return application/zip;
+
 return application/octet-stream;
   }




Re: [cp-patches] Enable appletviewer security manager, and make it easier to debug

2006-05-17 Thread Petter Reinholdtsen
[Thomas Fitzsimmons]
 Yes, this looks fine as a temporary testing measure.  Could you also
 provide a README for gnu/classpath/tools/appletviewer that documents
 the new environment variables?

Sure.

 Do you have paperwork on file?  If not, we should get that process
 started.

Nope.  But I do already have patches in Classpath, from the time when
the project started and I was active developing Japhar and
Classpath. :)

I assume you are talking about the copyright transfer to FSF.  I
started that process for glibc a few years ago, but it stopped when my
lawyer here in Norway recommended I did not sign the proposed
agreement.  I never was able to give priority to follow up on the
issues, so the process stopped.  The FSF copyright transfer agreement
was very USA-centric, and clash slightly with the Norwegian authors
right system.  I'm not sure I will be able to spend the required time
with the lawyers to work this out anytime soon. :(



Re: [cp-patches] Initial implementation of java.net.URLConnection.guessContentTypeFromStream()

2006-05-17 Thread Chris Burdess

Petter Reinholdtsen wrote:

Here is a patch to implement some magic numbers in
java.net.URLConnection.guessContentTypeFromStream().  I picked a few
mime types which seemed relevant from /etc/mime-magic and implemented
tests for them.  Is this approach good enough?

Index: java/net/URLConnection.java
===
RCS file: /sources/classpath/classpath/java/net/URLConnection.java,v
retrieving revision 1.42
diff -u -3 -p -u -r1.42 URLConnection.java
--- java/net/URLConnection.java 12 May 2006 20:59:30 -  1.42
+++ java/net/URLConnection.java 16 May 2006 22:08:55 -
@@ -971,10 +971,30 @@ public abstract class URLConnection
* @exception IOException If an error occurs
*/
   public static String guessContentTypeFromStream(InputStream is)
-throws IOException, NotImplementedException
+throws IOException
   {
 // See /etc/gnome-vfs-mime-magic or /etc/mime-magic for a  
reasonable

 // idea of how to handle this.
+
+is.mark(5);
+int c0 = is.read();
+int c1 = is.read();
+int c2 = is.read();
+int c3 = is.read();
+is.reset();
+
+if (c0 == 0xFF  c1 == 0xD8)
+   return image/jpeg;
+
+if (c0 == 'G'  c1 == 'I'  c2 == 'F'  c3 == '8')
+   return image/gif;
+
+if (c1 == 'P'  c2 == 'N'  c3 == 'G')
+   return image/png;
+
+if (c0 == 'P'  c1 == 'K'  c2 == 3  c3 == 4)
+   return application/zip;
+
 return application/octet-stream;
   }


Not if is.isMarkSupported() returns false...
--
犬 Chris Burdess
  They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety. - Benjamin Franklin






PGP.sig
Description: This is a digitally signed message part


Re: [cp-patches] FYI: ImageIO JPEG decoder

2006-05-17 Thread Mark Wielaard
Hi Tom,

On Thu, 2006-05-04 at 18:02 -0400, Thomas Fitzsimmons wrote:
 I committed this patch that adapts Trevor Linton's Symphony JPEG decoder 
 to be an ImageIO reader.

Thanks for working on this. Trevor should also be added to THANKYOU.

There were two files (CDT.java and ZigZag.java) which had the following
comment:
 +// TODO: Clear copyright of this file.

Please do check things like that before checking anything into CVS!

It was already cleared, both these files are part of the contribution.
There was only an issue with the PackedBits.java file for PDS files that
wasn't part of the original contribution of the code but was
accidentally in the original symphony zip file. The complete list of
contributed files is now also updated in the copyright.list.

This patch adds Trevor and cleans up the TODO items.

2006-05-17  Mark Wielaard  [EMAIL PROTECTED]

* THANKYOU: Add Trevor Linton [EMAIL PROTECTED].
* gnu/javax/imageio/jpeg/DCT.java: Cleanup Todo copyright.
* gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java: Likewise.
* gnu/javax/imageio/jpeg/ZigZag.java: Likewise.

Cheers,

Mark
[?1049h[?1h=[?12;25h[?12l[?25h[?25l/tmp/cvsaaqHlI 11L, 430CCVS: --
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS:ChangeLog THANKYOU gnu/javax/imageio/jpeg/DCT.java
CVS:gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java
CVS:gnu/javax/imageio/jpeg/ZigZag.java
CVS: --
~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~   ~ 

Re: [cp-patches] FYI: ImageIO JPEG decoder

2006-05-17 Thread Mark Wielaard
On Wed, 2006-05-17 at 11:06 +0200, Mark Wielaard wrote:
 This patch adds Trevor and cleans up the TODO items.
 
 2006-05-17  Mark Wielaard  [EMAIL PROTECTED]
 
 * THANKYOU: Add Trevor Linton [EMAIL PROTECTED].
 * gnu/javax/imageio/jpeg/DCT.java: Cleanup Todo copyright.
 * gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java: Likewise.
 * gnu/javax/imageio/jpeg/ZigZag.java: Likewise.

And now the correct patch attached.

Index: THANKYOU
===
RCS file: /cvsroot/classpath/classpath/THANKYOU,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- THANKYOU	5 Jan 2004 00:27:39 -	1.36
+++ THANKYOU	17 May 2006 09:06:09 -	1.37
@@ -27,6 +27,7 @@
 [EMAIL PROTECTED]
 Isaac Jones ([EMAIL PROTECTED])
 Oskar Liljeblad ([EMAIL PROTECTED])
+Trevor Linton ([EMAIL PROTECTED])
 Casey Marshall ([EMAIL PROTECTED])
 Steve Mayer ([EMAIL PROTECTED])
 Matt Mucklo ([EMAIL PROTECTED])
Index: gnu/javax/imageio/jpeg/DCT.java
===
RCS file: /cvsroot/classpath/classpath/gnu/javax/imageio/jpeg/DCT.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gnu/javax/imageio/jpeg/DCT.java	4 May 2006 21:49:57 -	1.1
+++ gnu/javax/imageio/jpeg/DCT.java	17 May 2006 09:06:09 -	1.2
@@ -37,7 +37,6 @@
 
 package gnu.javax.imageio.jpeg;
 
-// TODO: Clear copyright of this file.
 /**
  * Discrete Cosine Transformations.
  */
Index: gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java
===
RCS file: /cvsroot/classpath/classpath/gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java	4 May 2006 21:49:57 -	1.1
+++ gnu/javax/imageio/jpeg/YCbCr_ColorSpace.java	17 May 2006 09:06:09 -	1.2
@@ -39,15 +39,6 @@
 
 import java.awt.color.ColorSpace;
 
-/**
- * pTitle: Symphony Image Object/p
- * pDescription: Creates and manages image formats/p
- * pCopyright: Copyright (c) 2003/p
- * pCompany: Symphony/p
- * @author not attributable
- * @version 1.0
- */
-
 public class YCbCr_ColorSpace extends ColorSpace {
   public YCbCr_ColorSpace() {
 super(ColorSpace.TYPE_YCbCr, 3);
Index: gnu/javax/imageio/jpeg/ZigZag.java
===
RCS file: /cvsroot/classpath/classpath/gnu/javax/imageio/jpeg/ZigZag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gnu/javax/imageio/jpeg/ZigZag.java	4 May 2006 21:49:57 -	1.1
+++ gnu/javax/imageio/jpeg/ZigZag.java	17 May 2006 09:06:09 -	1.2
@@ -37,7 +37,6 @@
 
 package gnu.javax.imageio.jpeg;
 
-// TODO: Clear copyright of this file.
 /**
  * This class implements the Zig Zag Algorithm on any array with
  * the same amount of rows and columns. It takes a matrix and in turn builds an


signature.asc
Description: This is a digitally signed message part


[cp-patches] FYI: Documenting the naming manager

2006-05-17 Thread Audrius Meskauskas

2006-05-17  Audrius Meskauskas  [EMAIL PROTECTED]

   * javax/naming/spi/NamingManager.java: Documented.
Index: NamingManager.java
===
RCS file: /sources/classpath/classpath/javax/naming/spi/NamingManager.java,v
retrieving revision 1.9
diff -u -r1.9 NamingManager.java
--- NamingManager.java	2 Jul 2005 20:32:45 -	1.9
+++ NamingManager.java	17 May 2006 09:42:50 -
@@ -52,8 +52,18 @@
 import javax.naming.Referenceable;
 import javax.naming.StringRefAddr;
 
+/**
+ * Contains methods for creating context objects and objects referred to by
+ * location information. The location is specified in the scope of the
+ * certain naming or directory service.
+ */
 public class NamingManager
 {
+  /**
+   * The environment property into which getContinuationContext() stores the
+   * value of the CannotProceedException parameter. The value of this field
+   * is ijava.naming.spi.CannotProceedExceptioni.
+   */
   public static final String CPE = java.naming.spi.CannotProceedException;
 
   private static InitialContextFactoryBuilder icfb;
@@ -65,12 +75,37 @@
   NamingManager ()
   {
   }
-
+  
+  /**
+   * Checks if the initial context factory builder has been set.
+   * 
+   * @return true if the builder has been set
+   * 
+   * @see #setInitialContextFactoryBuilder(InitialContextFactoryBuilder)
+   */
   public static boolean hasInitialContextFactoryBuilder ()
   {
 return icfb != null;
   }
   
+  /**
+   * Creates the initial context. If the initial object factory builder has
+   * been set with [EMAIL PROTECTED] #setObjectFactoryBuilder(ObjectFactoryBuilder)},
+   * the work is delegated to this builder. Otherwise, the method searches
+   * for the property Context.INITIAL_CONTEXT_FACTORY first in the passed
+   * table and then in the system properties. The value of this property is
+   * uses as a class name to install the context factory. The corresponding
+   * class must exist, be public and have the public parameterless constructor. 
+   * 
+   * @param environment the properties, used to create the context.
+   * 
+   * @return the created context
+   * 
+   * @throws NoInitialContextException if the initial builder is not set,
+   *   the property Context.INITIAL_CONTEXT_FACTORY is missing of the
+   *   class, named by this property, cannot be instantiated. 
+   * @throws NamingException if throws by the context factory
+   */
   public static Context getInitialContext (Hashtable environment)
 throws NamingException
   {
@@ -112,7 +147,35 @@
 
 return icf.getInitialContext (environment);
   }
-
+  
+  /**
+   * pCreates the URL context for the given URL scheme id./p
+   * 
+   * pThe class name of the factory that creates the context has the naming 
+   * pattern scheme-idURLContextFactory. For instance, the factory for the
+   * ftp sheme should be named ftpURLContextFactory. The 
+   * Context.URL_PKG_PREFIXES environment property contains the
+   * colon-separated list of the possible package prefixes. The package name
+   * is constructed concatenating the package prefix with the scheme id./p 
+   * 
+   * pIf the factory class cannot be found in the specified packages, system
+   * will try to use the default internal factory for the given scheme./p
+   * 
+   * pAfter the factory is instantiated, its method 
+   * [EMAIL PROTECTED] ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
+   * is called to create and return the object instance.
+   * 
+   * @param refInfo passed to the factory
+   * @param name passed to the factory
+   * @param nameCtx passed to the factory
+   * @param scheme the url scheme that must be supported by the given context 
+   * @param environment the properties for creating the factory and context
+   *  (may be null)
+   *  
+   * @return the created context
+   * 
+   * @throws NamingException if thrown by the factory when creating the context.
+   */
   static Context getURLContext (Object refInfo,
 Name name,
 Context nameCtx,
@@ -182,7 +245,32 @@
 
 return null;
   }
-
+  
+  /**
+   * pCreates the URL context for the given URL scheme id./p
+   * 
+   * pThe class name of the factory that creates the context has the naming 
+   * pattern scheme-idURLContextFactory. For instance, the factory for the
+   * ftp sheme should be named ftpURLContextFactory. The 
+   * Context.URL_PKG_PREFIXES environment property contains the
+   * colon-separated list of the possible package prefixes. The package name
+   * is constructed concatenating the package prefix with the scheme id./p 
+   * 
+   * pIf the factory class cannot be found in the specified packages, system
+   * will try to use the default internal factory for the given scheme./p
+   * 
+   * pAfter the factory is instantiated, its method 
+   * [EMAIL PROTECTED] ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
+   * is called to create and return the object 

[cp-patches] RFC: Making java.lang.Thread.getContextClassLoader() lazy for threads created outside of Java

2006-05-17 Thread Jeroen Frijters
Hi,

I would like to apply the attached patch. It fixes a potential
initialization order issue for VMs that support running Java code
without first initializing the VM explicitly (like IKVM does).

The current code calls ClassLoader.getSystemClassLoader() in the Thread
constructor that the VM uses to create thread objects for threads that
are started outside of Java (for example, through JNI code that attaches
a thread), this can cause problems if this is the first time that
ClassLoader.getSystemClassLoader() is being called and the system class
loader construction code path happens to call Thread.currentThread().

I can also fix this in IKVM specific code, but that would be uglier and
I believe that other VMs will also benefit from this change (at the
small cost of an extra boolean in each Thread instance).

Any comments?

Regards,
Jeroen

2006-05-17  Jeroen Frijters  [EMAIL PROTECTED]

* java/lang/Thread.java (contextClassLoaderIsSystemClassLoader):
New field.
(Thread(VMThread,String,int,boolean)): Set
contextClassLoaderIsSystemClassLoader to true.
(getContextClassLoader): Check
contextClassLoaderIsSystemClassLoader.
(setContextClassLoader): Clear
contextClassLoaderIsSystemClassLoader.
Index: java/lang/Thread.java
===
RCS file: /cvsroot/classpath/classpath/java/lang/Thread.java,v
retrieving revision 1.22
diff -u -r1.22 Thread.java
--- java/lang/Thread.java   9 May 2006 14:42:13 -   1.22
+++ java/lang/Thread.java   17 May 2006 09:41:02 -
@@ -131,7 +131,8 @@
 
   /** The context classloader for this Thread. */
   private ClassLoader contextClassLoader;
-  
+  private boolean contextClassLoaderIsSystemClassLoader;
+
   /** This thread's ID.  */
   private final long threadId;
 
@@ -388,12 +389,11 @@
 this.name = name;
 this.priority = priority;
 this.daemon = daemon;
-this.contextClassLoader = ClassLoader.getSystemClassLoader();
+contextClassLoaderIsSystemClassLoader = true;
 synchronized (Thread.class)
   {
this.threadId = nextThreadId++;
   }
-
   }
 
   /**
@@ -751,7 +751,8 @@
 if (sm != null)
   // XXX Don't check this if the caller's class loader is an ancestor.
   sm.checkPermission(new RuntimePermission(getClassLoader));
-return contextClassLoader;
+return contextClassLoaderIsSystemClassLoader ?
+ClassLoader.getSystemClassLoader() : contextClassLoader;
   }
 
   /**
@@ -772,6 +773,7 @@
 if (sm != null)
   sm.checkPermission(new RuntimePermission(setContextClassLoader));
 this.contextClassLoader = classloader;
+contextClassLoaderIsSystemClassLoader = false;
   }
 
   /**


[cp-patches] FYI: LightweightDispatcher fix

2006-05-17 Thread Roman Kennke
I noticed that the LightweightDispatcher was not correct in all cases. A
testprogram that I made showed that the mouse event must be dispatched
to the component, that can be found by the following algorithm:

1. seach the deepest component at the mouse event location
(Container.findComponentAt)
2. search the children of that component and find the topmost component
that is showing, is at that location AND has either a MouseListener or
MouseMotionListener installed (this is the important part)
3. if no component is found in 2. walk up the component hierarchy and
dispatch the event to the first parent that has either a MouseListener
or MouseMotionListener installed (the other two conditions, showing and
containing the location are fullfilled implicitly).

AFAICT, this should be ok now. I checked with the Swing demo, and
everything seems to work still (even the
dragging-internal-frames-on-the-title-label, which depends on the
correct behaviour of the LightweightDispatcher, step2 above).

2006-05-17  Roman Kennke [EMAIL PROTECTED]

* java/awt/LightweightDispatcher.java
(handleMouseEvent): Fixed search algorithm for finding the
mouse event target.
(findTarget): Fixed search algorithm for finding the
mouse event target.

/roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: java/awt/LightweightDispatcher.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/LightweightDispatcher.java,v
retrieving revision 1.5
diff -u -1 -0 -r1.5 LightweightDispatcher.java
--- java/awt/LightweightDispatcher.java	16 May 2006 22:57:25 -	1.5
+++ java/awt/LightweightDispatcher.java	17 May 2006 10:36:36 -
@@ -121,22 +121,49 @@
   /**
* Handles all mouse events that are targetted at toplevel containers
* (Window instances) and dispatches them to the correct lightweight child.
* 
* @param ev the mouse event
* @return whether or not we found a lightweight that handled the event.
*/
   private boolean handleMouseEvent(MouseEvent ev)
   {
 Window window = (Window) ev.getSource();
-Component target = window.findComponentAt(ev.getX(), ev.getY());
-target = findTarget(target);
+// Find the target for the mouse event. We first seach the deepest
+// component at the specified location. The we go up to its parent and
+// try to find a neighbor of the deepest component that is suitable as
+// mouse event target (it must be showing, at that location and have either
+// a MouseListener or MouseMotionListener installed). If no such component
+// is found, then we walk up the container hierarchy and find the next
+// container that has a MouseListener or MouseMotionListener installed.
+Component deepest = window.findComponentAt(ev.getX(), ev.getY());
+if (deepest == null)
+  return false;
+Container parent = deepest.getParent();
+Point loc = ev.getPoint();
+loc = AWTUtilities.convertPoint(window, loc.x, loc.y, parent);
+Component target = null;
+if (parent != null)
+  {
+target = findTarget(deepest.getParent(), loc);
+while (target == null  parent != null)
+  {
+if (parent.getMouseListeners().length  0
+|| parent.getMouseMotionListeners().length  0)
+  {
+target = parent;
+  }
+else
+  parent = parent.getParent();
+  }
+  }
+
 if (target == null || target.isLightweight())
   {
 // Dispatch additional MOUSE_EXITED and MOUSE_ENTERED if event target
 // is different from the last event target.
 if (target != lastTarget)
   {
 if (lastTarget != null)
   {
 Point p1 = AWTUtilities.convertPoint(window, ev.getX(),
  ev.getY(), lastTarget);
@@ -214,27 +241,42 @@
   }
 
 	return true;
   }
 else
   return false;
   }
 
   /**
* Finds the actual target for a mouseevent, starting at codec/code.
-   * This searches upwards the component hierarchy until it finds a component
-   * that has a mouselistener attached.
+   * This searches through the children of the container and finds the first
+   * one which is showing, at the location from the mouse event and has
+   * a MouseListener or MouseMotionListener attached. If no such child component
+   * is found, null is returned.
*
-   * @param c the component to start searching from
+   * @param c the container to search through
+   * @param loc the mouse event point
*
-   * @return the actual receiver of the mouse event
+   * @return the actual receiver of the mouse event, or null, if no such
+   * component has been found
*/
-  private Component findTarget(Component c)
+  private Component findTarget(Container c, Point loc)

[cp-patches] FYI:Partial fix of 27383

2006-05-17 Thread Audrius Meskauskas
The patch should solve the context factory class loading problems by 
checking for the possible loaders in the stack trace with VMStackWalker. 
The problems may be similar as they once were in CORBA ObjectCreator.


This patch also makes sure that the context factory is always searched 
in com.sun.jndi.url as the last place, despite in the Free world there 
is no chance to find it there. Probably we need our default 
implementation of these factories.


2006-05-17  Audrius Meskauskas  [EMAIL PROTECTED]

  PR 27383
   * javax/naming/spi/NamingManager.java (getURLContext):
   Always search for the factory class in all possible places
   and use VMStackWalker.
   (forName): New clas
Index: NamingManager.java
===
RCS file: /sources/classpath/classpath/javax/naming/spi/NamingManager.java,v
retrieving revision 1.10
diff -u -r1.10 NamingManager.java
--- NamingManager.java	17 May 2006 09:47:42 -	1.10
+++ NamingManager.java	17 May 2006 10:48:41 -
@@ -38,6 +38,8 @@
 
 package javax.naming.spi;
 
+import gnu.classpath.VMStackWalker;
+
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.StringTokenizer;
@@ -149,126 +151,187 @@
   }
   
   /**
-   * pCreates the URL context for the given URL scheme id./p
-   * 
-   * pThe class name of the factory that creates the context has the naming 
-   * pattern scheme-idURLContextFactory. For instance, the factory for the
-   * ftp sheme should be named ftpURLContextFactory. The 
-   * Context.URL_PKG_PREFIXES environment property contains the
-   * colon-separated list of the possible package prefixes. The package name
-   * is constructed concatenating the package prefix with the scheme id./p 
-   * 
-   * pIf the factory class cannot be found in the specified packages, system
-   * will try to use the default internal factory for the given scheme./p
-   * 
-   * pAfter the factory is instantiated, its method 
+   * p
+   * Creates the URL context for the given URL scheme id.
+   * /p
+   * p
+   * The class name of the factory that creates the context has the naming
+   * pattern scheme-idURLContextFactory. For instance, the factory for the ftp
+   * sheme should be named ftpURLContextFactory.
+   * /p
+   * p
+   * The Context.URL_PKG_PREFIXES environment property contains the
+   * colon-separated list of the possible package prefixes. The package name is
+   * constructed concatenating the package prefix with the scheme id. This
+   * property is searched in the passed ienvironment/i parameter and later
+   * in the system properties.
+   * /p
+   * p
+   * If the factory class cannot be found in the specified packages, system will
+   * try to use the default internal factory for the given scheme.
+   * /p
+   * p
+   * After the factory is instantiated, its method
* [EMAIL PROTECTED] ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
* is called to create and return the object instance.
* 
* @param refInfo passed to the factory
* @param name passed to the factory
* @param nameCtx passed to the factory
-   * @param scheme the url scheme that must be supported by the given context 
-   * @param environment the properties for creating the factory and context
-   *  (may be null)
-   *  
+   * @param scheme the url scheme that must be supported by the given context
+   * @param environment the properties for creating the factory and context (may
+   *  be null)
* @return the created context
-   * 
* @throws NamingException if thrown by the factory when creating the context.
*/
-  static Context getURLContext (Object refInfo,
-Name name,
-Context nameCtx,
-String scheme,
-Hashtable environment) 
-throws NamingException
+  static Context getURLContext(Object refInfo, Name name, Context nameCtx,
+   String scheme, Hashtable environment)
+  throws NamingException
   {
-String prefixes = null;
+// Specified as the default in the docs. Unclear if this is
+// right for us.
+String defaultPrefix = com.sun.jndi.url;
+
+StringBuffer allPrefixes = new StringBuffer();
+
+String prefixes;
 if (environment != null)
-  prefixes = (String) environment.get (Context.URL_PKG_PREFIXES);
-if (prefixes == null)
-  prefixes = System.getProperty (Context.URL_PKG_PREFIXES);
-if (prefixes == null)
   {
-	// Specified as the default in the docs.  Unclear if this is
-	// right for us.
-	prefixes = com.sun.jndi.url;
+prefixes = (String) environment.get(Context.URL_PKG_PREFIXES);
+if (prefixes != null)
+  allPrefixes.append(prefixes);
+  }
+
+prefixes = System.getProperty(Context.URL_PKG_PREFIXES);
+if (prefixes != null)
+  {
+if (allPrefixes.length()  0)
+  allPrefixes.append(':');
+allPrefixes.append(prefixes);
   }
 
+if (allPrefixes.length()  0)
+  

Re: [cp-patches] FYI: LightweightDispatcher fix

2006-05-17 Thread Audrius Meskauskas
For me, after this patch only the top left button (Buttons) on the 
Swing demo is responding to the mouse clicks - others do not. The 
functionality comes back if I return to the previous version of this file.


Regards
Audrius

Roman Kennke wrote:


I noticed that the LightweightDispatcher was not correct in all cases. A
testprogram that I made showed that the mouse event must be dispatched
to the component, that can be found by the following algorithm:

1. seach the deepest component at the mouse event location
(Container.findComponentAt)
2. search the children of that component and find the topmost component
that is showing, is at that location AND has either a MouseListener or
MouseMotionListener installed (this is the important part)
3. if no component is found in 2. walk up the component hierarchy and
dispatch the event to the first parent that has either a MouseListener
or MouseMotionListener installed (the other two conditions, showing and
containing the location are fullfilled implicitly).

AFAICT, this should be ok now. I checked with the Swing demo, and
everything seems to work still (even the
dragging-internal-frames-on-the-title-label, which depends on the
correct behaviour of the LightweightDispatcher, step2 above).

2006-05-17  Roman Kennke [EMAIL PROTECTED]

   * java/awt/LightweightDispatcher.java
   (handleMouseEvent): Fixed search algorithm for finding the
   mouse event target.
   (findTarget): Fixed search algorithm for finding the
   mouse event target.

/roman

 




Index: java/awt/LightweightDispatcher.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/LightweightDispatcher.java,v
retrieving revision 1.5
diff -u -1 -0 -r1.5 LightweightDispatcher.java
--- java/awt/LightweightDispatcher.java 16 May 2006 22:57:25 -  1.5
+++ java/awt/LightweightDispatcher.java 17 May 2006 10:36:36 -
@@ -121,22 +121,49 @@
  /**
   * Handles all mouse events that are targetted at toplevel containers
   * (Window instances) and dispatches them to the correct lightweight child.
   * 
   * @param ev the mouse event

   * @return whether or not we found a lightweight that handled the event.
   */
  private boolean handleMouseEvent(MouseEvent ev)
  {
Window window = (Window) ev.getSource();
-Component target = window.findComponentAt(ev.getX(), ev.getY());
-target = findTarget(target);
+// Find the target for the mouse event. We first seach the deepest
+// component at the specified location. The we go up to its parent and
+// try to find a neighbor of the deepest component that is suitable as
+// mouse event target (it must be showing, at that location and have either
+// a MouseListener or MouseMotionListener installed). If no such component
+// is found, then we walk up the container hierarchy and find the next
+// container that has a MouseListener or MouseMotionListener installed.
+Component deepest = window.findComponentAt(ev.getX(), ev.getY());
+if (deepest == null)
+  return false;
+Container parent = deepest.getParent();
+Point loc = ev.getPoint();
+loc = AWTUtilities.convertPoint(window, loc.x, loc.y, parent);
+Component target = null;
+if (parent != null)
+  {
+target = findTarget(deepest.getParent(), loc);
+while (target == null  parent != null)
+  {
+if (parent.getMouseListeners().length  0
+|| parent.getMouseMotionListeners().length  0)
+  {
+target = parent;
+  }
+else
+  parent = parent.getParent();
+  }
+  }
+
if (target == null || target.isLightweight())
  {
// Dispatch additional MOUSE_EXITED and MOUSE_ENTERED if event target
// is different from the last event target.
if (target != lastTarget)
  {
if (lastTarget != null)
  {
Point p1 = AWTUtilities.convertPoint(window, ev.getX(),
 ev.getY(), lastTarget);
@@ -214,27 +241,42 @@
  }

return true;
  }
else
  return false;
  }

  /**
   * Finds the actual target for a mouseevent, starting at codec/code.
-   * This searches upwards the component hierarchy until it finds a component
-   * that has a mouselistener attached.
+   * This searches through the children of the container and finds the first
+   * one which is showing, at the location from the mouse event and has
+   * a MouseListener or MouseMotionListener attached. If no such child 
component
+   * is found, null is returned.
   *
-   * @param c the component to start searching from
+   * @param c the container to search through
+   * @param loc the mouse event point
   *
-   * @return the actual receiver of the mouse event
+   * @return the actual receiver 

Re: [cp-patches] FYI: Implement java.awt.print

2006-05-17 Thread Audrius Meskauskas
Probably some forgotten autogenerated code. I think, these should be 
marked as not implemented again.


Audrius.




Re: [cp-patches] RFC: Making java.lang.Thread.getContextClassLoader() lazy for threads created outside of Java

2006-05-17 Thread Archie Cobbs

Jeroen Frijters wrote:

I would like to apply the attached patch. It fixes a potential
initialization order issue for VMs that support running Java code
without first initializing the VM explicitly (like IKVM does).


Dumb questions: why don't you initialize the VM in JNI_CreateJavaVM()?
What is gained by deferring initialization?

Curiously,
-Archie

__
Archie Cobbs  *CTO, Awarix*  http://www.awarix.com



[cp-patches] Patch: JSlider focus fix

2006-05-17 Thread Lillian Angel
Added code to paint the focus for the slider.

2006-05-17  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicSliderUI.java
(focusGained): Implemented.
(focusLost): Implemented.
(paint): Added code to paint the focus.
* javax/swing/plaf/metal/MetalSliderUI.java
(paintThumb): Added code to set the thumbColor.
(paintFocus): Implemented properly.

Index: javax/swing/plaf/basic/BasicSliderUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v
retrieving revision 1.29
diff -u -r1.29 BasicSliderUI.java
--- javax/swing/plaf/basic/BasicSliderUI.java	18 Apr 2006 08:40:10 -	1.29
+++ javax/swing/plaf/basic/BasicSliderUI.java	17 May 2006 15:29:03 -
@@ -38,8 +38,6 @@
 
 package javax.swing.plaf.basic;
 
-import gnu.classpath.NotImplementedException;
-
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.ComponentOrientation;
@@ -70,6 +68,7 @@
 import javax.swing.JLabel;
 import javax.swing.JSlider;
 import javax.swing.LookAndFeel;
+import javax.swing.RepaintManager;
 import javax.swing.SwingUtilities;
 import javax.swing.Timer;
 import javax.swing.UIManager;
@@ -209,9 +208,9 @@
  * @param e A [EMAIL PROTECTED] FocusEvent}.
  */
 public void focusGained(FocusEvent e)
-  throws NotImplementedException
 {
-  // FIXME: implement.
+  slider.repaint();
+  hasFocus = true;
 }
 
 /**
@@ -221,9 +220,9 @@
  * @param e A [EMAIL PROTECTED] FocusEvent}.
  */
 public void focusLost(FocusEvent e)
-  throws NotImplementedException
 {
-  // FIXME: implement.
+  slider.repaint();
+  hasFocus = false;
 }
   }
 
@@ -592,6 +591,9 @@
 
   /** The focus color. */
   private transient Color focusColor;
+  
+  /** True if the slider has focus. */
+  private transient boolean hasFocus;
 
   /**
* Creates a new Basic look and feel Slider UI.
@@ -1548,9 +1550,11 @@
   paintTicks(g);
 if (slider.getPaintLabels())
   paintLabels(g);
-
-//FIXME: Paint focus.
+
 paintThumb(g);
+
+if (hasFocus)
+  paintFocus(g);
   }
 
   /**
@@ -1602,7 +1606,7 @@
 Color saved_color = g.getColor();
 
 g.setColor(getFocusColor());
-
+
 g.drawRect(focusRect.x, focusRect.y, focusRect.width, focusRect.height);
 
 g.setColor(saved_color);
@@ -1989,7 +1993,7 @@
   public void paintThumb(Graphics g)
   {
 Color saved_color = g.getColor();
-
+
 Point a = new Point(thumbRect.x, thumbRect.y);
 Point b = new Point(a);
 Point c = new Point(a);
@@ -1997,11 +2001,11 @@
 Point e = new Point(a);
 
 Polygon bright;
-Polygon light;  // light shadow
-Polygon dark;   // dark shadow
+Polygon light; // light shadow
+Polygon dark; // dark shadow
 Polygon all;
 
-// This will be in X-dimension if the slider is inverted and y if it isn't.   
+// This will be in X-dimension if the slider is inverted and y if it isn't.
 int turnPoint;
 
 if (slider.getOrientation() == JSlider.HORIZONTAL)
@@ -2016,13 +2020,15 @@
 bright = new Polygon(new int[] { b.x - 1, a.x, e.x, d.x },
  new int[] { b.y, a.y, e.y, d.y }, 4);
 
-dark = new Polygon(new int[] { b.x, c.x, d.x + 1 },
-   new int[] { b.y, c.y - 1, d.y }, 3);
-
-light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 },
-new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3);
-
-all = new Polygon(new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 },
+dark = new Polygon(new int[] { b.x, c.x, d.x + 1 }, new int[] { b.y,
+   c.y - 1,
+   d.y }, 3);
+
+light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 },
+new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3);
+
+all = new Polygon(
+  new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 },
   new int[] { a.y + 1, b.y + 1, c.y - 1, d.y - 1, e.y },
   5);
   }
@@ -2038,15 +2044,16 @@
 bright = new Polygon(new int[] { c.x - 1, b.x, a.x, e.x },
  new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 4);
 
-dark = new Polygon(new int[] { c.x, d.x, e.x },
-   new int[] { c.y, d.y, e.y }, 3);
+dark = new Polygon(new int[] { c.x, d.x, e.x }, new int[] { c.y, d.y,
+   e.y }, 3);
 
-light = new Polygon(new int[] { c.x - 1, d.x, e.x + 1},
-   new int[] { c.y, d.y - 1, e.y - 1}, 3);
-all = new Polygon(new int[] { a.x + 1, b.x, c.x - 2, c.x - 2, d.x, 
-  e.x + 1 },
-

RE: [cp-patches] RFC: Making java.lang.Thread.getContextClassLoader() lazy for threads created outside of Java

2006-05-17 Thread Jeroen Frijters
Archie Cobbs wrote:
 Jeroen Frijters wrote:
  I would like to apply the attached patch. It fixes a potential
  initialization order issue for VMs that support running Java code
  without first initializing the VM explicitly (like IKVM does).
 
 Dumb questions: why don't you initialize the VM in JNI_CreateJavaVM()?
 What is gained by deferring initialization?

In IKVM you can use statically compiled Java code from any another .NET
language without ever knowing or caring that it was Java code, so there
is no obvious place to call any initialize method.

Regards,
Jeroen



[cp-patches] Patch: GraphicsConfiguration

2006-05-17 Thread Lillian Angel
Implemented missing functions.

2006-05-17  Lillian Angel  [EMAIL PROTECTED]

* java/awt/GraphicsConfiguration.java
(getImageCapabilities): Implemented.
(getBufferCapabilities): Implemented.

Index: java/awt/GraphicsConfiguration.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/GraphicsConfiguration.java,v
retrieving revision 1.9
diff -u -r1.9 GraphicsConfiguration.java
--- java/awt/GraphicsConfiguration.java	22 Mar 2006 19:15:24 -	1.9
+++ java/awt/GraphicsConfiguration.java	17 May 2006 16:05:30 -
@@ -65,6 +65,13 @@
  */
 public abstract class GraphicsConfiguration
 {
+  
+  /** The cached image capabilities. */
+  private ImageCapabilities imageCapabilities;
+  
+  /** The cached buffer capabilities. */
+  private BufferCapabilities bufferCapabilities;
+  
   /**
* The default constructor.
*
@@ -218,9 +225,14 @@
* @since 1.4
*/
   public BufferCapabilities getBufferCapabilities()
-throws NotImplementedException
   {
-throw new Error(not implemented);
+if (imageCapabilities == null)
+  getImageCapabilities();
+
+if (bufferCapabilities == null)
+  bufferCapabilities = new BufferCapabilities(imageCapabilities,
+  imageCapabilities, null);
+return bufferCapabilities;
   }
 
   /**
@@ -230,8 +242,9 @@
* @since 1.4
*/
   public ImageCapabilities getImageCapabilities()
-throws NotImplementedException
   {
-throw new Error(not implemented);
+if (imageCapabilities == null)
+  imageCapabilities = new ImageCapabilities(false);
+return imageCapabilities;
   }
 } // class GraphicsConfiguration


Re: [cp-patches] FYI: LightweightDispatcher fix

2006-05-17 Thread Roman Kennke
Hi,


Am Mittwoch, den 17.05.2006, 13:25 +0200 schrieb Audrius Meskauskas:
 For me, after this patch only the top left button (Buttons) on the 
 Swing demo is responding to the mouse clicks - others do not. The 
 functionality comes back if I return to the previous version of this file.

Fixed. I need to tranlate the point to the child component in question
of course. Stupid me ;-)

2006-05-17  Roman Kennke [EMAIL PROTECTED]

* java/awt/LightweightDispatcher.java
(findTarget): Translate point to child components.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: java/awt/LightweightDispatcher.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/LightweightDispatcher.java,v
retrieving revision 1.6
diff -u -1 -0 -r1.6 LightweightDispatcher.java
--- java/awt/LightweightDispatcher.java	17 May 2006 10:45:42 -	1.6
+++ java/awt/LightweightDispatcher.java	17 May 2006 16:50:32 -
@@ -149,21 +149,20 @@
   {
 if (parent.getMouseListeners().length  0
 || parent.getMouseMotionListeners().length  0)
   {
 target = parent;
   }
 else
   parent = parent.getParent();
   }
   }
-
 if (target == null || target.isLightweight())
   {
 // Dispatch additional MOUSE_EXITED and MOUSE_ENTERED if event target
 // is different from the last event target.
 if (target != lastTarget)
   {
 if (lastTarget != null)
   {
 Point p1 = AWTUtilities.convertPoint(window, ev.getX(),
  ev.getY(), lastTarget);
@@ -258,24 +257,26 @@
*
* @return the actual receiver of the mouse event, or null, if no such
* component has been found
*/
   private Component findTarget(Container c, Point loc)
   {
 Component[] children = c.getComponents();
 Component target = null;
 if (c != null)
   {
+Point childLoc;
 for (int i = 0; i  children.length; i++)
   {
 Component child = children[i];
-if (child.isShowing()  child.contains(loc)
+childLoc = AWTUtilities.convertPoint(c, loc.x, loc.y, child);
+if (child.isShowing()  child.contains(childLoc)
  (child.getMouseListeners().length  0 
 || child.getMouseMotionListeners().length  0))
   {
 target = child;
 break;
   }
   }
   }
 return target;
   }


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] Patch: TexturePaint

2006-05-17 Thread Lillian Angel
Implemented a missing function from TexturePaint and documented entire
class.

2006-05-17  Lillian Angel  [EMAIL PROTECTED]

* java/awt/TexturePaint.java:
Added documentation for class and all functions.
(getTransparency): Implemented.

Index: java/awt/TexturePaint.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/TexturePaint.java,v
retrieving revision 1.3
diff -u -r1.3 TexturePaint.java
--- java/awt/TexturePaint.java	22 Mar 2006 19:15:21 -	1.3
+++ java/awt/TexturePaint.java	17 May 2006 17:34:56 -
@@ -45,35 +45,74 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 
-/** STUB CLASS ONLY */
+/**
+ * This class provides a way to fill a Shape with a texture that is
+ * specified by a BufferedImage.
+ */
 public class TexturePaint implements Paint
 {
   private final BufferedImage texture;
   private final Rectangle2D anchor;
+  
+  /**
+   * Constructor.
+   * 
+   * @param texture - the texture
+   * @param anchor - the shape
+   */
   public TexturePaint(BufferedImage texture, Rectangle2D anchor)
   {
 this.texture = texture;
 this.anchor = anchor;
   }
+
+  /**
+   * Gets the texture image.
+   * 
+   * @return the texture
+   */
   public BufferedImage getImage()
   {
 return texture;
   }
+
+  /**
+   * Gets the shape anchor.
+   * 
+   * @return the shape anchor
+   */
   public Rectangle2D getAnchorRect()
   {
 return anchor;
   }
+
+  /**
+   * Creates the context used to paint the texture.
+   * 
+   * @param cm - the ColorModel that receives the Paint data. Used only as a hint.
+   * @param deviceBounds - the device space being rendered.
+   * @param userBounds - the user space being rendered
+   * @param xform - the AffineTransform from user space into device space
+   * @param hints - a RenderingHints object that is used to specify how the 
+   * pattern is rendered
+   * @return the paint context used to paint the texture
+   */
   public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
 Rectangle2D userBounds,
-AffineTransform xform,
-RenderingHints hints)
-throws NotImplementedException
+AffineTransform xform, RenderingHints hints)
+  throws NotImplementedException
   {
-throw new Error(not implemented);
+// FIXME: Not implemented.
+return null;
   }
+
+  /**
+   * Returns the transparency mode.
+   * 
+   * @return the transparency mode.
+   */
   public int getTransparency()
-throws NotImplementedException
   {
-throw new Error(not implemented);
+return texture.getTransparency();
   }
 } // class TexturePaint


[cp-patches] FYI: javax.swing.table.* formatting fixes

2006-05-17 Thread David Gilbert

This patch (committed) fixes some formatting issues in javax.swing.table.*:

2006-05-17  David Gilbert  [EMAIL PROTECTED]

* javax/swing/table/AbstractTableModel.java: Formatting fixes,
* javax/swing/table/DefaultTableModel.java: Likewise,
* javax/swing/table/TableCellEditor.java: Likewise,
* javax/swing/table/TableCellRenderer.java: Likewise.

Regards,

Dave
Index: javax/swing/table/AbstractTableModel.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/table/AbstractTableModel.java,v
retrieving revision 1.14
diff -u -r1.14 AbstractTableModel.java
--- javax/swing/table/AbstractTableModel.java   2 Jul 2005 20:32:51 -   
1.14
+++ javax/swing/table/AbstractTableModel.java   17 May 2006 20:48:33 -
@@ -1,5 +1,5 @@
 /* AbstractTableModel.java --
-   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -83,7 +83,7 @@
 StringBuffer buffer = new StringBuffer();
 while (columnIndex = 0)
   {
-buffer.insert (0, (char) ('A' + columnIndex % 26));
+buffer.insert(0, (char) ('A' + columnIndex % 26));
 columnIndex = columnIndex / 26 - 1;
   }
 return buffer.toString();
@@ -221,7 +221,7 @@
* @param firstRow  the index of the first row.
* @param lastRow  the index of the last row.
*/
-  public void fireTableRowsInserted (int firstRow, int lastRow)
+  public void fireTableRowsInserted(int firstRow, int lastRow)
   {
 fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
  TableModelEvent.ALL_COLUMNS,
@@ -235,7 +235,7 @@
* @param firstRow  the index of the first row.
* @param lastRow  the index of the last row.
*/
-  public void fireTableRowsUpdated (int firstRow, int lastRow)
+  public void fireTableRowsUpdated(int firstRow, int lastRow)
   {
 fireTableChanged(new TableModelEvent(this, firstRow, lastRow,
  TableModelEvent.ALL_COLUMNS,
@@ -263,7 +263,7 @@
* @param row  the row index.
* @param column  the column index.
*/
-  public void fireTableCellUpdated (int row, int column)
+  public void fireTableCellUpdated(int row, int column)
   {
 fireTableChanged(new TableModelEvent(this, row, row, column));
   }
@@ -282,7 +282,7 @@
 for (index = 0; index  list.length; index += 2)
   {
 listener = (TableModelListener) list [index + 1];
-listener.tableChanged (event);
+listener.tableChanged(event);
   }
   }
 
Index: javax/swing/table/DefaultTableModel.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/table/DefaultTableModel.java,v
retrieving revision 1.15
diff -u -r1.15 DefaultTableModel.java
--- javax/swing/table/DefaultTableModel.java8 May 2006 13:37:49 -   
1.15
+++ javax/swing/table/DefaultTableModel.java17 May 2006 20:48:34 -
@@ -1,5 +1,5 @@
 /* DefaultTableModel.java --
-   Copyright (C) 2002, 2004, 2005,  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -249,7 +249,7 @@
   public void setColumnIdentifiers(Vector columnIdentifiers) 
   {
 this.columnIdentifiers = columnIdentifiers;
-setColumnCount((columnIdentifiers == null ? 0 : columnIdentifiers.size()));
+setColumnCount(columnIdentifiers == null ? 0 : columnIdentifiers.size());
   }
   
   /**
@@ -289,13 +289,13 @@
 if (rowCount  existingRowCount) 
 {
   dataVector.setSize(rowCount);
-  fireTableRowsDeleted(rowCount,existingRowCount-1);  
+  fireTableRowsDeleted(rowCount, existingRowCount - 1);  
 }
 else 
 {
   int rowsToAdd = rowCount - existingRowCount;
   addExtraRows(rowsToAdd, columnIdentifiers.size());
-  fireTableRowsInserted(existingRowCount,rowCount-1);
+  fireTableRowsInserted(existingRowCount, rowCount - 1);
 }
   }
 
@@ -353,7 +353,8 @@
* @param columnName the column name (codenull/code permitted).
* @param columnData the column data.
*/
-  public void addColumn(Object columnName, Object[] columnData) {
+  public void addColumn(Object columnName, Object[] columnData) 
+  {
 if (columnData != null)
 {
   // check columnData array for cases where the number of items
@@ -384,7 +385,8 @@
* 
* @param rowData the row data (codenull/code permitted).
*/
-  public void addRow(Vector rowData) {
+  public void addRow(Vector rowData) 
+  {
 int rowIndex = dataVector.size();
 dataVector.add(rowData);
 newRowsAdded(new TableModelEvent(
@@ -398,7 +400,8 @@
* 
* @param rowData the row data (codenull/code permitted).
*/
-  public void addRow(Object[] rowData) {
+  public void addRow(Object[] rowData) 
+  

[cp-patches] FYI: javax.swing.border.* - source code formatting fixes

2006-05-17 Thread David Gilbert

This patch (committed) fixes some more source code formatting issues in 
javax.swing:

2006-05-17  David Gilbert  [EMAIL PROTECTED]

* javax/swing/border/AbstractBorder.java: Source code formatting fixes,
* javax/swing/border/BevelBorder.java: Likewise,
* javax/swing/border/CompoundBorder.java: Likewise,
* javax/swing/border/TitledBorder.java: Likewise.

Regards,

Dave
Index: javax/swing/border/AbstractBorder.java
===
RCS file: /sources/classpath/classpath/javax/swing/border/AbstractBorder.java,v
retrieving revision 1.11
diff -u -r1.11 AbstractBorder.java
--- javax/swing/border/AbstractBorder.java  21 Apr 2006 11:26:33 -  
1.11
+++ javax/swing/border/AbstractBorder.java  17 May 2006 21:03:03 -
@@ -194,6 +194,6 @@
   height -= borderInsets.top + borderInsets.bottom;
 }
 
-return new Rectangle (x, y, width, height);
+return new Rectangle(x, y, width, height);
   }
 }
Index: javax/swing/border/BevelBorder.java
===
RCS file: /sources/classpath/classpath/javax/swing/border/BevelBorder.java,v
retrieving revision 1.10
diff -u -r1.10 BevelBorder.java
--- javax/swing/border/BevelBorder.java 21 Apr 2006 11:26:33 -  1.10
+++ javax/swing/border/BevelBorder.java 17 May 2006 21:03:03 -
@@ -479,7 +479,7 @@
   ((highlightOuter == null) || (highlightOuter.getAlpha() == 255))
((highlightInner == null) || (highlightInner.getAlpha() == 255))
((shadowInner == null) || (shadowInner.getAlpha() == 255))
-   ((shadowOuter == null) ||(shadowOuter.getAlpha() == 255));
+   ((shadowOuter == null) || (shadowOuter.getAlpha() == 255));
   }
 
 
Index: javax/swing/border/CompoundBorder.java
===
RCS file: /sources/classpath/classpath/javax/swing/border/CompoundBorder.java,v
retrieving revision 1.11
diff -u -r1.11 CompoundBorder.java
--- javax/swing/border/CompoundBorder.java  21 Apr 2006 11:26:33 -  
1.11
+++ javax/swing/border/CompoundBorder.java  17 May 2006 21:03:04 -
@@ -178,7 +178,7 @@
 Insets borderInsets;
 
 if (insets == null)
-  insets = new Insets (0,0,0,0);
+  insets = new Insets(0, 0, 0, 0);
 else
   insets.left = insets.right = insets.top = insets.bottom = 0;
 
@@ -217,7 +217,7 @@
 // the implementation from AbstractBorder. However, we want
 // to be compatible with the API specification, which overrides
 // the getBorderInsets(Component) method.
-return getBorderInsets (c, null);
+return getBorderInsets(c, null);
   }
 
   /**
@@ -239,7 +239,7 @@
* 
* @return The inside border (possibly codenull/code).
*/
-  public Border getInsideBorder ()
+  public Border getInsideBorder()
   {
 return insideBorder;
   }
Index: javax/swing/border/TitledBorder.java
===
RCS file: /sources/classpath/classpath/javax/swing/border/TitledBorder.java,v
retrieving revision 1.16
diff -u -r1.16 TitledBorder.java
--- javax/swing/border/TitledBorder.java15 May 2006 19:17:05 -  
1.16
+++ javax/swing/border/TitledBorder.java17 May 2006 21:03:05 -
@@ -641,8 +641,7 @@
 // Paint border right from the text.
 clip.setBounds(saved);
 SwingUtilities.computeIntersection(textLoc.x + titleWidth + 1, y,
-   x + width - (textLoc.x + 
titleWidth +1),
-   height, clip);
+x + width - (textLoc.x + titleWidth + 1), height, clip);
 if (! clip.isEmpty())
   {
 g.setClip(clip);
@@ -675,7 +674,7 @@
 clip.setBounds(saved);
 SwingUtilities.computeIntersection(textLoc.x - 1, y,
titleWidth + 2,
-   textLoc.y - fontDescent -y,
+   textLoc.y - fontDescent - y,
clip);
 if (! clip.isEmpty())
   {


[cp-patches] Patch: FYI: jar fixlet

2006-05-17 Thread Tom Tromey
I'm checking this in.

This makes the index file created by jar -i look a little nicer.

Tom

2006-05-17  Tom Tromey  [EMAIL PROTECTED]

* tools/gnu/classpath/tools/jar/Indexer.java (indexJarFile): Use a
LinkedHashSet.

Index: tools/gnu/classpath/tools/jar/Indexer.java
===
RCS file: 
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Indexer.java,v
retrieving revision 1.4
diff -u -r1.4 Indexer.java
--- tools/gnu/classpath/tools/jar/Indexer.java  15 May 2006 16:23:47 -  
1.4
+++ tools/gnu/classpath/tools/jar/Indexer.java  17 May 2006 22:44:47 -
@@ -46,8 +46,8 @@
 import java.io.OutputStream;
 import java.text.MessageFormat;
 import java.util.Enumeration;
-import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.StringTokenizer;
 import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
@@ -70,7 +70,9 @@
 JarFile jf = new JarFile(fileName);
 
 // Index the files in this jar.
-HashSet entries = new HashSet();
+// The results look a little better if we keep them
+// in insertion order.
+LinkedHashSet entries = new LinkedHashSet();
 Enumeration e = jf.entries();
 while (e.hasMoreElements())
   {