Re: [cp-patches] FYI: Fix for PR34991

2009-01-06 Thread David Gilbert

Robert Schuster wrote:

-draw(new Polygon(xPoints, yPoints, nPoints));
+for (int i = 1; i  nPoints; i++)
+  draw(new Line2D.Double(xPoints[i - 1], yPoints[i - 1],
+ xPoints[i], yPoints[i]));

Hi Robert,

Line2D instances are mutable (via setLine() methods) so you could save some 
garbage here by creating one Line2D instance and reusing it within the loop...

Regards,

Dave Gilbert
http://www.jfree.org/




Re: Updated CVS Stats

2007-07-10 Thread David Gilbert

Mario Torre wrote:

Hello!

I've seen that David has not updated the cvs stats for quite a while,
and being such a curious guy, I've managed to build up new stats by
myself. I guess some other are happy to watch stats so I've uploaded the
whole thing here:

http://www.limasoftware.net/neugens/downloads/classpath/stats/developers.html

Of course, it is not intended to replace David's stats, and there is no
guarantee that I will update them, but if David feels he is not
interested anymore in keeping Classpath's stats, I will be happy to
setup a better link for you and try to maintain it.

Mario
  


Hi Mario,

Thanks!  You are most welcome to take this over...

Regards,

Dave





Re: David Gilbert's Software will be part of OpenOffice.org

2007-04-23 Thread David Gilbert

Hi theUser BL,

Thanks for the post.

theUser BL wrote:

Do you know who David Gilbert is?

I do, it's me.

Right, he have created a lot og classes for GNU Classpath like 
something for Free Swing and so on.


Also he is part of the people at planet.classpath.org
and writes also in his blog a lot of its program JFreeChart
http://jroller.com/page/dgilbert

But he have not only written JFreeChart.
http://www.jfree.org/jfreechart/

I can claim some credit for *those* things, thanks for mentioning them!

He have also written libformula, flute, jcommon, libfonts, libloader, 
liblayout, libxml, libworkbook ...

http://www.jfree.org/download/
JCommon is a joint effort between myself and Thomas Morgner, but the 
other libraries you mention are written by Thomas alone (as far as I 
know).  He's quite prolific!




... and JFreeReport
http://www.jfree.org/jfreereport/index.php
I did *start* the JFreeReport project, back in 2000, and worked on it on 
and off for a couple of years.  Thomas Morgner took over the project 
(some time in 2002 I think), and I'm really not sure how much of my code 
remains in there (I haven't had time to check, but I know Thomas has 
rewritten a lot of the core, so I wouldn't expect a lot of my code to 
remain).  Thomas now works for Pentaho as their Chief Architect for 
Reporting i.e. he's paid to work on Free Software, which is very cool.  
He's a very talented developer.  JFreeReport also leverages other great 
open source libraries like iText, so the credit goes all around.



JFreeReport was bought by pentaho and is now part of them
http://reporting.pentaho.org/
It's commonly misreported that Pentaho bought JFreeReport.  They 
certainly hired Thomas, the JFreeReport project leader, at the end of 
2005, and moved the administration of the project from JFree.org to 
Pentaho.org.  I don't know if Thomas assigned his copyright in the 
sources to Pentaho (it's quite likely he did, but I don't know one way 
or the other).  I do know I didn't assign my copyrights in the 
JFreeReport/JCommon sources, nor the JFreeReport name.  In general, the 
project transfer went smoothly, although there were a couple of little 
problems (that have mostly been worked out). 


Pentaho creates also only free software and only in Java.
They have also extended JFreeReport and working now together with Sun 
to integrate it in OpenOffice.org 2.3 !
http://www.pentaho.org/news/releases/20070419_pentaho_adds_reporting_solution_to_openoffice.php 

Pentaho are investing heavily in free / open source software, which is 
really great.  They have a FAQ that hints that they may offer 
proprietary licences for some things, but they seem knowledgeable about, 
and respectful of, the terms of the GNU Lesser General Public Licence 
which apply to JCommon and JFreeReport.




Congratulations Dave, that your software find its way in OpenOffice.org!
I do think this is cool, but as I wrote on my blog, Thomas deserves the 
credit for this:


http://jroller.com/page/dgilbert?entry=whither_jfreereport

And Pentaho too, to the extent that they probably negotiated this deal 
with Sun, and I'm sure their backing/funding gives the project more 
credibility than it had when it was just a JFree project.


Regards,

Dave Gilbert
http://www.jfree.org/




Re: [cp-patches] FYI: CompoundBorder fix

2006-12-06 Thread David Gilbert

Tania Bento wrote:

Hey,

This patch fixes a bug in javax.swing.border.CompoundBorder's
isBorderOpaque() method.  The reference implementation specifications
states that this method only returns true if both the inside and outside
borders have a non-null value and both are opaque; false, otherwise.
However, the mauve test I just committed
(gnu.testlet.javax.swing.border.CompoundBorder.isBorderOpaque) shows
that if both the inside and outside borders are null, then true is
returned.  This patch fixes a failing Harmony test.

  

Hi Tania,

It is a good idea to report such problems (in the specification) to 
Sun.  Although, this one has already been reported:


http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4778988

Looks like an easy bug to fix once the class library code is available 
in OpenJDK.


Regards,

Dave



Re: 0.93 branch created

2006-12-04 Thread David Gilbert

Mark Wielaard wrote:

- Run some larger applications as smoke tests
  eclipse, jfreecharts, jedit, megamek, hsql-frontends, some applets,
  etc. to make sure they still run as well as they did with 0.92.
  Reports welcome! I tried things like our examples, SwingSet2, Java2D
  and RSSOwl already and things look pretty good.
  

Hi Mark,

I've run:

(1)  The JFreeChart 1.0.3 demo.  This is working pretty well.  There are 
a couple of graphical glitches, which I'll report as bugs, but I don't 
think these are regressions and certainly they're not release blockers;


(2)  StatCVS 0.2.3.  This is working well, I ran it on the Mauve CVS log 
file.  I'll post the report shortly.


(3)  JEdit 4.2.  Roman's HTML work has certainly improved the first 
impressions in JEdit, it looks really good - I was able to read through 
the help files, clicking hyperlinks etc.  Very nice!


I am able to generate the following exception fairly easily, by loading 
a large-ish Java source file and scrolling through it page by page.  I 
don't know if this is a regression, because I only briefly tried JEdit 
on Classpath 0.92, but it means that JEdit isn't entirely usable for me 
just yet.  Maybe the exception means something to someone more familiar 
with this part of GNU Classpath:


[error] AWT-EventQueue-2: Exception during event dispatch:
[error] AWT-EventQueue-2: java.lang.AbstractMethodError: setAnchor
[error] AWT-EventQueue-2:at gnu.regexp.RE.makeCharIndexed(RE.java:2086)
[error] AWT-EventQueue-2:at gnu.regexp.RE.isMatch(RE.java:1500)
[error] AWT-EventQueue-2:at gnu.regexp.RE.isMatch(RE.java:1476)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.syntax.TokenMarker.markKeyword(TokenMarker.java:700)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.syntax.TokenMarker.markTokens(TokenMarker.java:210)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.Buffer.markTokens(Buffer.java:2115)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.textarea.ChunkCache.lineToChunkList(ChunkCache.java:752)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.textarea.ChunkCache.updateChunksUpTo(ChunkCache.java:627)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.textarea.ChunkCache.getLineInfo(ChunkCache.java:244)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.textarea.ExtensionManager.paintScreenLineRange(ExtensionManager.java:93)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.textarea.TextAreaPainter.paintComponent(TextAreaPainter.java:722)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1839)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintChildren(JComponent.java:1974)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1842)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintChildren(JComponent.java:1974)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1842)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintChildren(JComponent.java:1974)
[error] AWT-EventQueue-2:at 
org.gjt.sp.jedit.gui.DockableWindowManager.paintChildren(DockableWindowManager.java:1113)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1842)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintChildren(JComponent.java:1974)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1842)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintChildren(JComponent.java:1974)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1842)
[error] AWT-EventQueue-2:at 
javax.swing.JLayeredPane.paint(JLayeredPane.java:713)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintChildren(JComponent.java:1974)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paint(JComponent.java:1842)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintDoubleBuffered(JComponent.java:2354)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintImmediately2(JComponent.java:2271)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintImmediately(JComponent.java:2110)
[error] AWT-EventQueue-2:at 
javax.swing.JComponent.paintImmediately(JComponent.java:2136)
[error] AWT-EventQueue-2:at 
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:598)
[error] AWT-EventQueue-2:at 
javax.swing.RepaintManager$RepaintWorker.run(RepaintManager.java:173)
[error] AWT-EventQueue-2:at 
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:200)
[error] AWT-EventQueue-2:at 
javax.swing.RepaintManager$RepaintWorkerEvent.dispatch(RepaintManager.java:117)
[error] AWT-EventQueue-2:at 
java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
[error] AWT-EventQueue-2:at 
java.awt.EventDispatchThread.run(EventDispatchThread.java:85)


Anyway, looking forward to the new release...

Regards,

Dave




Re: 0.93 branch created

2006-12-04 Thread David Gilbert

Roman Kennke wrote:

Am Montag, den 04.12.2006, 11:57 +0100 schrieb Dalibor Topic:
  

David Gilbert wrote:


Maybe the exception means something to someone more familiar with this 
part of GNU Classpath:


[error] AWT-EventQueue-2: Exception during event dispatch:
[error] AWT-EventQueue-2: java.lang.AbstractMethodError: setAnchor
[error] AWT-EventQueue-2:at 
gnu.regexp.RE.makeCharIndexed(RE.java:2086) 
  
Looks weird to me, I thought the regexp package moved to 
gnu.java.util.regexp ?



oh yeah. This was indeed _why_ I moved it to gnu.java.util.regexp. JEdit
ships with its own (older) version of it which interfered with our
regexp packages. I was getting AbstractMethodErrors back then because
some old class in JEdit wasn't implementing a newer interface method or
similar. David, can you check if you have for some odd reason the old
regexp classes in you classpath build/install dir?

/Roman
  


Hi,

Thanks for the fast responses...I do seem to have both the old and new 
class files.  I'll fix that, try JEdit again, and report back.


Regards,

Dave



Re: 0.93 branch created

2006-12-04 Thread David Gilbert

David Gilbert wrote:

Roman Kennke wrote:

Am Montag, den 04.12.2006, 11:57 +0100 schrieb Dalibor Topic:
 

David Gilbert wrote:

   
Maybe the exception means something to someone more familiar with 
this part of GNU Classpath:


[error] AWT-EventQueue-2: Exception during event dispatch:
[error] AWT-EventQueue-2: java.lang.AbstractMethodError: setAnchor
[error] AWT-EventQueue-2:at 
gnu.regexp.RE.makeCharIndexed(RE.java:2086)   
Looks weird to me, I thought the regexp package moved to 
gnu.java.util.regexp ?



oh yeah. This was indeed _why_ I moved it to gnu.java.util.regexp. JEdit
ships with its own (older) version of it which interfered with our
regexp packages. I was getting AbstractMethodErrors back then because
some old class in JEdit wasn't implementing a newer interface method or
similar. David, can you check if you have for some odd reason the old
regexp classes in you classpath build/install dir?

/Roman
  


Hi,

Thanks for the fast responses...I do seem to have both the old and new 
class files.  I'll fix that, try JEdit again, and report back.


Regards,

Dave

OK, it is working much better now...sorry for the noise.

Regards,

Dave




[cp-patches] FYI: JSlider thumb icons

2006-11-29 Thread David Gilbert
The thumb icons for JSliders are drawing badly at present because of a 
FIXME in the gradient painting code.  Until we can come up with a 
solution, I think it is tidier to draw the icons without the gradient paint:


2006-11-29  David Gilbert  [EMAIL PROTECTED]

   * javax/swing/plaf/metal/MetalIconFactory.java
   (HorizontalSliderThumbIcon.paintIcon()): Commented out gradient paint,
   (VerticalSliderThumbIcon.paintIcon()): Likewise.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalIconFactory.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v
retrieving revision 1.31
diff -u -r1.31 MetalIconFactory.java
--- javax/swing/plaf/metal/MetalIconFactory.java26 Sep 2006 13:33:29 
-  1.31
+++ javax/swing/plaf/metal/MetalIconFactory.java29 Nov 2006 18:03:30 
-
@@ -1039,20 +1039,22 @@
   g.drawLine(x + 6, y + 14, x, y + 8);
   g.drawLine(x, y + 7, x, y + 1);
   
-  // Fill the icon.
-  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
-   enabled)
-{
-  String gradient;
-  if (focus)
-gradient = Slider.focusGradient;
-  else
-gradient = Slider.gradient;
-  MetalUtils.paintGradient(g, x + 1, y + 2, 12, 13,
-   SwingConstants.VERTICAL, gradient,
-   gradientMask);
-}
-  else
+// The following is commented out until the masking for the gradient painting 
+// is working correctly
+//  // Fill the icon.
+//  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
+//   enabled)
+//{
+//  String gradient;
+//  if (focus)
+//gradient = Slider.focusGradient;
+//  else
+//gradient = Slider.gradient;
+//  MetalUtils.paintGradient(g, x + 1, y + 2, 12, 13,
+//   SwingConstants.VERTICAL, gradient,
+//   gradientMask);
+//}
+//  else
 {
   if (focus)
 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
@@ -1700,20 +1702,22 @@
   g.drawLine(x + 8, y + 14, x + 1, y + 14);
   g.drawLine(x, y + 13, x, y + 1);
   
-  // Fill the icon.
-  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
-   enabled)
-{
-  String gradient;
-  if (focus)
-gradient = Slider.focusGradient;
-  else
-gradient = Slider.gradient;
-  MetalUtils.paintGradient(g, x + 2, y + 1, 13, 12,
-   SwingConstants.HORIZONTAL, gradient,
-   gradientMask);
-}
-  else
+//The following is commented out until the masking for the gradient 
painting 
+//is working correctly
+//  // Fill the icon.
+//  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
+//   enabled)
+//{
+//  String gradient;
+//  if (focus)
+//gradient = Slider.focusGradient;
+//  else
+//gradient = Slider.gradient;
+//  MetalUtils.paintGradient(g, x + 2, y + 1, 13, 12,
+//   SwingConstants.HORIZONTAL, gradient,
+//   gradientMask);
+//}
+//  else
 {
   if (focus)
 g.setColor(MetalLookAndFeel.getPrimaryControlShadow());


Regression in Swing Demo

2006-11-29 Thread David Gilbert
I just checked out the latest code from CVS and ran the Swing demo...and 
there seems to be a problem with drawing some icons.  At first glance, 
it looks like some operations (e.g. fillRect()) may be off by one 
pixel.  Is anyone else seeing this?  (For example, look at the close 
icon for an internal frame, it is garbled).


I haven't run the Swing demo for a few weeks, so I can't (yet) pinpoint 
when the regression occurred (assuming it isn't just a local problem).


Regards,

Dave



[commit-cp] classpath ChangeLog javax/swing/plaf/metal/Meta...

2006-11-29 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/29 18:07:10

Modified files:
.  : ChangeLog 
javax/swing/plaf/metal: MetalIconFactory.java 

Log message:
2006-11-29  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalIconFactory.java
(HorizontalSliderThumbIcon.paintIcon()): Commented out gradient 
paint,
(VerticalSliderThumbIcon.paintIcon()): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8881r2=1.8882
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/metal/MetalIconFactory.java?cvsroot=classpathr1=1.31r2=1.32




[cp-patches] FYI: BeanContextSupport.serialize() and deserialize() implemented

2006-11-24 Thread David Gilbert
This patch (committed) implements a couple of utility methods in the 
BeanContextSupport class:


2006-11-23  David Gilbert  [EMAIL PROTECTED]

   * java/beans/beancontext/BeanContextSupport.java
   (deserialize): Implemented,
   (serialize): Implemented.

I'll commit the corresponding Mauve tests shortly.

Regards,

Dave
Index: java/beans/beancontext/BeanContextSupport.java
===
RCS file: 
/sources/classpath/classpath/java/beans/beancontext/BeanContextSupport.java,v
retrieving revision 1.20
diff -u -r1.20 BeanContextSupport.java
--- java/beans/beancontext/BeanContextSupport.java  22 Nov 2006 22:45:11 
-  1.20
+++ java/beans/beancontext/BeanContextSupport.java  23 Nov 2006 09:23:11 
-
@@ -422,10 +422,25 @@
 return new BCSChild(targetChild, peer);
   }
 
+  /**
+   * Deserializes objects (written by [EMAIL PROTECTED] 
#serialize(ObjectOutputStream, 
+   * Collection)}) and adds them to the specified collection.
+   * 
+   * @param ois  the input stream (codenull/code not permitted).
+   * @param coll  the collection to add the objects to (codenull/code not
+   * permitted).
+   * 
+   * @throws ClassNotFoundException
+   * @throws IOException
+   * 
+   * @see #serialize(ObjectOutputStream, Collection)
+   */
   protected final void deserialize (ObjectInputStream ois, Collection coll)
-throws ClassNotFoundException, IOException, NotImplementedException
+throws ClassNotFoundException, IOException
   {
-throw new Error (Not implemented);
+int itemCount = ois.readInt();
+for (int i = 0; i  itemCount; i++)
+  coll.add(ois.readObject());
   }
 
   /**
@@ -829,10 +844,34 @@
 throw new UnsupportedOperationException();
   }
 
-  protected final void serialize (ObjectOutputStream oos, Collection coll)
-throws IOException, NotImplementedException
+  /**
+   * Writes the items in the collection to the specified output stream.  Items
+   * in the collection that are not instances of [EMAIL PROTECTED] 
Serializable} 
+   * (this includes codenull/code) are simply ignored.
+   * 
+   * @param oos  the output stream (codenull/code not permitted).
+   * @param coll  the collection (codenull/code not permitted).
+   * 
+   * @throws IOException
+   * 
+   * @see #deserialize(ObjectInputStream, Collection)
+   */
+  protected final void serialize(ObjectOutputStream oos, Collection coll)
+throws IOException
   {
-throw new Error (Not implemented);
+Object[] items = coll.toArray();
+int itemCount = 0;
+for (int i = 0; i  items.length; i++)
+  {
+if (items[i] instanceof Serializable)
+  itemCount++;
+  }
+oos.writeInt(itemCount);
+for (int i = 0; i  items.length; i++)
+  {
+if (items[i] instanceof Serializable)
+  oos.writeObject(items[i]);
+  }
   }
 
   /**


Re: [cp-patches] Paint context fixes

2006-11-24 Thread David Gilbert

Hi Roman,

Roman Kennke wrote:

Hi David, hi Francis,

I checked in the attached patch to HeadlessGraphicsEnvironment. It now
tries to get hold of a CairoGraphics2D if available. It falls back to
the (Java-only) RasterGraphics only when nothing else works. David, can
you please test if this works?

2006-11-23  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java
(createGraphics): Try to use Cairo graphics if available.

/Roman



  



Index: gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java
===
RCS file: 
/cvsroot/classpath/classpath/gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java,v
retrieving revision 1.1
diff -u -1 -5 -r1.1 HeadlessGraphicsEnvironment.java
--- gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java 9 Nov 2006 
21:03:33 -   1.1
+++ gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java 23 Nov 2006 
08:44:12 -
@@ -34,39 +34,68 @@
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 
 package gnu.java.awt.peer.headless;
 
 import gnu.java.awt.java2d.RasterGraphics;
 
 import java.awt.Font;

 import java.awt.Graphics2D;
 import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
 import java.awt.HeadlessException;
 import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
 import java.util.Locale;
 
 public class HeadlessGraphicsEnvironment

 extends GraphicsEnvironment
 {
 
   public Graphics2D createGraphics(BufferedImage image)

   {
-return new RasterGraphics(image.getRaster(), image.getColorModel());
+Graphics2D g2d;
+try
+  {
+// Try to get a CairoGraphics (accellerated) when available. Do this
+// via reflection to avoid having a hard compile time dependency.
+Class cairoSurfaceCl = 
Class.forName(gnu.java.awt.peer.gtk.CairoSurface);
+Raster raster = image.getRaster();
+if (cairoSurfaceCl.isInstance(raster))
+  {
+Method getGraphicsM = cairoSurfaceCl.getMethod(getGraphics,
+   new Class[0]);
+g2d = (Graphics2D) getGraphicsM.invoke(raster, new Object[0]);
+  }
+else
+  {
+Class bigCl =
+  Class.forName(gnu.java.awt.peer.gtk.BufferedImageGraphics);
+Constructor bigC =
+  bigCl.getConstructor(new Class[]{BufferedImage.class });
+g2d = (Graphics2D) bigCl.newInstance();
  
Should you be using the Constructor 'bigC' here to create the 'g2d' 
(passing the BufferedImage as an argument), and not the Class 'bigCl'?


Regards,

Dave


+  }
+  }
+catch (Exception ex)
+  {
+g2d = new RasterGraphics(image.getRaster(), image.getColorModel());
+  }
+return g2d;
   }
 
  




Re: [cp-patches] Paint context fixes

2006-11-24 Thread David Gilbert

Roman Kennke wrote:

Hi David,

  

I checked in the attached patch to HeadlessGraphicsEnvironment. It now
tries to get hold of a CairoGraphics2D if available. It falls back to
the (Java-only) RasterGraphics only when nothing else works. David, can
you please test if this works?

  
  

Unfortunately your patch didn't change the outcome...



Strange. I suppose something goes wrong in the magic reflection code
that I added. Could you please add ex.printStackTrace() in the catch
block in HeadlessGraphicsEnvironment.createGraphics() to see what
exactly goes wrong and post this trace?

/Roman
  

Hi Roman,

The mailing list seems slow, so hopefully this gets through...

I did that, then fixed the reflection code as attached.  That results in 
a NullPointerException fetching the name for a font (see below), I think 
because the HeadlessToolkit is mostly stubs:


[EMAIL PROTECTED]:~/mauve-cvs$ ~/jamvm-1.4.4/src/jamvm -Xmx300m -jar 
~/statcvs-0.2.3/statcvs.jar -output-dir output/ logfile.log mauve

StatCVS - CVS statistics generation

Revision of install-sh does not match expected revision
Revision of mkinstalldirs does not match expected revision
java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Constructor.constructNative(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
  at 
gnu.java.awt.peer.headless.HeadlessGraphicsEnvironment.createGraphics(HeadlessGraphicsEnvironment.java:79)

  at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:397)
  at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1212)
  at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
  at 
org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:174)

  at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:329)
  at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:300)
  at net.sf.statcvs.renderer.Chart.saveChart(Chart.java:93)
  at net.sf.statcvs.renderer.LOCChart.init(LOCChart.java:78)
  at net.sf.statcvs.output.HTMLOutput.createLOCChart(HTMLOutput.java:298)
  at net.sf.statcvs.output.HTMLOutput.createHTMLSuite(HTMLOutput.java:180)
  at net.sf.statcvs.Main.generateDefaultHTMLSuite(Main.java:193)
  at net.sf.statcvs.Main.main(Main.java:75)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at jamvm.java.lang.JarLauncher.main(JarLauncher.java:49)
Caused by: java.lang.NullPointerException
  at java.awt.Font.getName(Font.java:391)
  at 
gnu.java.awt.peer.gtk.CairoGraphics2D.setFont(CairoGraphics2D.java:1732)

  at gnu.java.awt.peer.gtk.CairoGraphics2D.setup(CairoGraphics2D.java:225)
  at 
gnu.java.awt.peer.gtk.BufferedImageGraphics.init(BufferedImageGraphics.java:160)

  at java.lang.reflect.Constructor.constructNative(Native Method)
  ...17 more
java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at jamvm.java.lang.JarLauncher.main(JarLauncher.java:49)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 307200
  at java.awt.image.DataBufferInt.getElem(DataBufferInt.java:200)
  at gnu.java.awt.Buffers.getData(Buffers.java:184)
  at 
java.awt.image.SinglePixelPackedSampleModel.getDataElements(SinglePixelPackedSampleModel.java:258)

  at java.awt.image.Raster.getDataElements(Raster.java:651)
  at 
gnu.java.awt.java2d.AlphaCompositeContext.compose(AlphaCompositeContext.java:217)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fillScanlineAA(AbstractGraphics2D.java:2109)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fillShapeAntialias(AbstractGraphics2D.java:2049)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fillShape(AbstractGraphics2D.java:1570)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fill(AbstractGraphics2D.java:545)

  at org.jfree.chart.JFreeChart.draw(JFreeChart.java:974)
  at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1213)
  at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
  at 
org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:174)

  at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:329)
  at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:300)
  at net.sf.statcvs.renderer.Chart.saveChart(Chart.java:93)
  at net.sf.statcvs.renderer.LOCChart.init(LOCChart.java:78)
  at net.sf.statcvs.output.HTMLOutput.createLOCChart(HTMLOutput.java:298)
  at net.sf.statcvs.output.HTMLOutput.createHTMLSuite(HTMLOutput.java:180)
  at net.sf.statcvs.Main.generateDefaultHTMLSuite(Main.java:193)
  at net.sf.statcvs.Main.main(Main.java:75)
  at java.lang.reflect.Method.invokeNative(Native Method)
  ...2 more


Regards,

Dave
Index: gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java
===
RCS file: 

Re: [cp-patches] Paint context fixes

2006-11-24 Thread David Gilbert

Hi Roman,

Roman Kennke wrote:

Hi David, hi Francis,

I checked in the attached patch to HeadlessGraphicsEnvironment. It now
tries to get hold of a CairoGraphics2D if available. It falls back to
the (Java-only) RasterGraphics only when nothing else works. David, can
you please test if this works?

  


Unfortunately your patch didn't change the outcome...

Regards,

Dave



2006-11-23  Roman Kennke  [EMAIL PROTECTED]

* gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java
(createGraphics): Try to use Cairo graphics if available.

/Roman
  




[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-24 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/24 04:38:19

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextServicesSupport.java 

Log message:
2006-11-24  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextServicesSupport.java
(getChildBeanContextServicesListener): Implemented.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8844r2=1.8845
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextServicesSupport.java?cvsroot=classpathr1=1.11r2=1.12




[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-24 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/23 09:56:43

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextSupport.java 

Log message:
2006-11-23  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java
(deserialize): Implemented,
(serialize): Implemented.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8842r2=1.8843
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?cvsroot=classpathr1=1.20r2=1.21




Re: [cp-patches] Paint context fixes

2006-11-22 Thread David Gilbert

Hi Francis,

I'm seeing this exception now when trying to run StatCVS:

[EMAIL PROTECTED]:~/mauve-cvs$ jamvm -Xmx300m -jar 
~/statcvs-0.2.3/statcvs.jar logfile.log mauve

StatCVS - CVS statistics generation

Revision of install-sh does not match expected revision
Revision of mkinstalldirs does not match expected revision
java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at jamvm.java.lang.JarLauncher.main(JarLauncher.java:49)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 307200
  at java.awt.image.DataBufferInt.getElem(DataBufferInt.java:200)
  at gnu.java.awt.Buffers.getData(Buffers.java:184)
  at 
java.awt.image.SinglePixelPackedSampleModel.getDataElements(SinglePixelPackedSampleModel.java:258)

  at java.awt.image.Raster.getDataElements(Raster.java:651)
  at 
gnu.java.awt.java2d.AlphaCompositeContext.compose(AlphaCompositeContext.java:217)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fillScanlineAA(AbstractGraphics2D.java:2109)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fillShapeAntialias(AbstractGraphics2D.java:2049)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fillShape(AbstractGraphics2D.java:1570)
  at 
gnu.java.awt.java2d.AbstractGraphics2D.fill(AbstractGraphics2D.java:545)

  at org.jfree.chart.JFreeChart.draw(JFreeChart.java:974)
  at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1213)
  at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
  at 
org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:174)

  at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:329)
  at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:300)
  at net.sf.statcvs.renderer.Chart.saveChart(Chart.java:93)
  at net.sf.statcvs.renderer.LOCChart.init(LOCChart.java:78)
  at net.sf.statcvs.output.HTMLOutput.createLOCChart(HTMLOutput.java:298)
  at net.sf.statcvs.output.HTMLOutput.createHTMLSuite(HTMLOutput.java:180)
  at net.sf.statcvs.Main.generateDefaultHTMLSuite(Main.java:193)
  at net.sf.statcvs.Main.main(Main.java:75)
  at java.lang.reflect.Method.invokeNative(Native Method)
  ...2 more

I haven't tried to reduce this to a simple test case yet...but I will if 
you need me to.


Regards,

Dave


Francis Kung wrote:

Hi,

The attached patch, committed, includes a number of fixes to our
handling of custom paint contexts.

This significantly improves our compliance to the Batik test-suite.

I've also included some drastic performance enhancements when doing
java2d operations with a custom paint context; our performance on some
Batik tests is now comparable to Sun's.

Cheers,
Francis


2006-11-21  Francis Kung  [EMAIL PROTECTED]

* gnu/java/awt/java2d/TexturePaintContext.java
(getRaster): Handle negative coordinate values.
* gnu/java/awt/peer/gtk/CairoGraphics2D.java
(setPaint): Moved custom paint processing to a new method.
(setPaintPixels): Added x, y parameters.
(getRealBounds): Added documentation.
(copy): Copy clipping information.
(drawLine): Process custom paints.
(setCustomPaint): New method.
(fill): Process custom paints.
(drawGlyphVector): Process custom paints.
(drawRect): Process custom paints.
(draw): Process custom paints.
* gnu/java/awt/peer/gtk/CairoSurface.java
(cairoCM_opaque): New constant.
* gnu/java/awt/peer/gtk/BufferedImageGraphics.java
(argb32): Removed constant.
(rgb32): Removed constant.
(BufferedImageGraphics(BufferedImage)): Updated constant names.
(BufferedImageGraphics(BufferedImageGraphics)): Copy color model flags.
(updateBufferedImage): Transform to device-space before updating.
* include/gnu_java_awt_peer_gtk_CairoGraphics2D.h
(Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setPaintPixels): Added x, y
parameters.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c
(Java_gnu_java_awt_peer_gtk_CairoGraphics2D_setPaintPixels): Set
pattern
source at designated x, y origin.

  



Index: gnu/java/awt/peer/gtk/BufferedImageGraphics.java
===
RCS file: 
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/BufferedImageGraphics.java,v
retrieving revision 1.15
diff -u -r1.15 BufferedImageGraphics.java
--- gnu/java/awt/peer/gtk/BufferedImageGraphics.java19 Oct 2006 20:50:52 
-  1.15
+++ gnu/java/awt/peer/gtk/BufferedImageGraphics.java21 Nov 2006 16:21:15 
-
@@ -54,7 +54,6 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.image.DataBufferInt;
-import java.awt.image.DirectColorModel;
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
 import java.awt.image.Raster;
@@ 

[cp-patches] FYI: BeanContextSupport.avoidingGui() is already implemented

2006-11-22 Thread David Gilbert
This patch (committed) removes the NotImplementedException tag from one 
method that is already implemented:


2006-11-22  David Gilbert  [EMAIL PROTECTED]

   * java/beans/beancontext/BeanContextSupport.java
   (avoidingGui): Removed NotImplementedException.

The implementation (from earlier in the year) is shown here:

http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?r1=1.10r2=1.11root=classpath

Regards,

Dave
Index: java/beans/beancontext/BeanContextSupport.java
===
RCS file: 
/sources/classpath/classpath/java/beans/beancontext/BeanContextSupport.java,v
retrieving revision 1.18
diff -u -r1.18 BeanContextSupport.java
--- java/beans/beancontext/BeanContextSupport.java  20 Nov 2006 01:30:24 
-  1.18
+++ java/beans/beancontext/BeanContextSupport.java  22 Nov 2006 17:56:58 
-
@@ -328,7 +328,6 @@
*  told not to use it.
*/
   public boolean avoidingGui()
-throws NotImplementedException
   {
 return needsGui()  (!okToUseGui);
   }


[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-22 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/22 17:59:26

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextSupport.java 

Log message:
2006-11-22  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java
(avoidingGui): Removed NotImplementedException.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8838r2=1.8839
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?cvsroot=classpathr1=1.18r2=1.19




Re: [cp-patches] BeanContextSupport - implemented some missing methods

2006-11-16 Thread David Gilbert

Roman Kennke wrote:

This patch (committed) implements some missing methods:



Yay! Some more japi points :-)

/Roman
Yep.  I have an interest in learning more about JavaBeans, so I decided 
to poke around in the code, and improve our japi scores a bit while I'm 
at it.  I have no idea if I'll learn enough to implement all the missing 
methods, but I'll try - for the fun of it.  Harmony has a reasonably 
solid test suite for java.beans and java.beans.beancontext, so I'm going 
to run that as well (and, unlike the Swing/AWT tests, they're in their 
own package space, so they don't need modifying to run against Classpath).


By the way, your HTML work is making FindBugs (0.9.5) look a lot better 
now...impressive!  There is a newer version of FindBugs with a 
completely new GUI, but I haven't tried that on Classpath yet.


Regards,

Dave



[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-16 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/16 09:43:23

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextSupport.java 

Log message:
2006-11-16  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java
(getChildBeanContextMembershipListener): Implemented,
(getChildPropertyChangeListener): Implemented,
(getChildSerializable): Implemented,
(getChildVetoableChangeListener): Implemented,
(getChildVisibility): Implemented,
(setDesignTime): Use same property name as Sun's implementation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8806r2=1.8807
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?cvsroot=classpathr1=1.16r2=1.17




[commit-cp] classpath ChangeLog java/beans/DesignMode.java ...

2006-11-15 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/16 05:29:54

Modified files:
.  : ChangeLog 
java/beans : DesignMode.java Statement.java 

Log message:
2006-11-16  David Gilbert  [EMAIL PROTECTED]

* java/beans/DesignMode.java: Reformatted and removed a FIXME,
* java/beans/Statement.java
(toString): Updated to match reference implementation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8805r2=1.8806
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/DesignMode.java?cvsroot=classpathr1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/Statement.java?cvsroot=classpathr1=1.4r2=1.5




[cp-patches] FYI: Collections.java - minor API doc addition

2006-11-10 Thread David Gilbert
This patch (committed) adds info about null arguments to the API docs 
for the Collections.sort() methods:


2006-11-10  David Gilbert  [EMAIL PROTECTED]

   * java/util/Collections.java
   (sort(List)): Minor API doc addition,
   (sort(List, Comparator)): Likewise.

Regards,

Dave



Re: [cp-patches] FYI: Collections.java - minor API doc addition

2006-11-10 Thread David Gilbert

David Gilbert wrote:
This patch (committed) adds info about null arguments to the API docs 
for the Collections.sort() methods:


2006-11-10  David Gilbert  [EMAIL PROTECTED]

   * java/util/Collections.java
   (sort(List)): Minor API doc addition,
   (sort(List, Comparator)): Likewise.

Regards,

Dave



THIS patch. 


Regards,

Dave
Index: java/util/Collections.java
===
RCS file: /sources/classpath/classpath/java/util/Collections.java,v
retrieving revision 1.42
diff -u -r1.42 Collections.java
--- java/util/Collections.java  9 Jun 2006 17:02:32 -   1.42
+++ java/util/Collections.java  10 Nov 2006 16:35:21 -
@@ -1903,10 +1903,11 @@
* sorts the array, and then iterates over the list setting each element from
* the array.
*
-   * @param l the List to sort
+   * @param l the List to sort (codenull/code not permitted)
* @throws ClassCastException if some items are not mutually comparable
* @throws UnsupportedOperationException if the List is not modifiable
-   * @throws NullPointerException if some element is null
+   * @throws NullPointerException if the list is codenull/code, or contains
+   * some element that is codenull/code.
* @see Arrays#sort(Object[])
*/
   public static void sort(List l)
@@ -1922,13 +1923,15 @@
* sorts the array, and then iterates over the list setting each element from
* the array.
*
-   * @param l the List to sort
+   * @param l the List to sort (codenull/code not permitted)
* @param c the Comparator specifying the ordering for the elements, or
-   *null for natural ordering
+   *codenull/code for natural ordering
* @throws ClassCastException if c will not compare some pair of items
* @throws UnsupportedOperationException if the List is not modifiable
-   * @throws NullPointerException if null is compared by natural ordering
-   *(only possible when c is null)
+   * @throws NullPointerException if the List is codenull/code or 
+   * codenull/code is compared by natural ordering (only possible 
+   * when c is codenull/code)
+   * 
* @see Arrays#sort(Object[], Comparator)
*/
   public static void sort(List l, Comparator c)


[commit-cp] classpath ChangeLog java/util/Collections.java

2006-11-10 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/10 16:37:19

Modified files:
.  : ChangeLog 
java/util  : Collections.java 

Log message:
2006-11-10  David Gilbert  [EMAIL PROTECTED]

* java/util/Collections.java
(sort(List)): Minor API doc addition,
(sort(List, Comparator)): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8787r2=1.8788
http://cvs.savannah.gnu.org/viewcvs/classpath/java/util/Collections.java?cvsroot=classpathr1=1.42r2=1.43




[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-10 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/11 06:14:19

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextSupport.java 

Log message:
2006-11-11  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java
(getChildBeanContextChild): Implemented.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8789r2=1.8790
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?cvsroot=classpathr1=1.15r2=1.16




[cp-patches] FYI: SimpleBeanInfo - fix for 29770

2006-11-09 Thread David Gilbert

This patch (committed) fixes a bug in the loadImage() method:

2006-11-09  David Gilbert  [EMAIL PROTECTED]

   Fixes bug #29770
   * java/beans/SimpleBeanInfo.java
   (loadImage): Check for nulls.

I've already committed Mauve tests for this.

Regards,

Dave
Index: java/beans/SimpleBeanInfo.java
===
RCS file: /sources/classpath/classpath/java/beans/SimpleBeanInfo.java,v
retrieving revision 1.8
diff -u -r1.8 SimpleBeanInfo.java
--- java/beans/SimpleBeanInfo.java  2 Jul 2005 20:32:37 -   1.8
+++ java/beans/SimpleBeanInfo.java  9 Nov 2006 12:37:12 -
@@ -1,5 +1,5 @@
 /* java.beans.SimpleBeanInfo
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,6 +40,7 @@
 
 import java.awt.Image;
 import java.awt.Toolkit;
+import java.net.URL;
 
 /**
  ** SimpleBeanInfo is a class you may extend to more easily
@@ -130,10 +131,16 @@
 ** and its BeanInfo are both loaded by the same
 ** ClassLoader, generally a reasonable assumption.
 ** @param location the URL relative
-** @return the Image in question.
+** @return the Image in question (possibly codenull/code).
 **/
-   public Image loadImage(String location) {
-   return 
Toolkit.getDefaultToolkit().getImage(getClass().getResource(location));
+   public Image loadImage(String location) 
+{
+  if (location == null)
+return null;
+  URL url = getClass().getResource(location);
+  if (url == null)
+return null;
+  return Toolkit.getDefaultToolkit().getImage(url);
}
 }
 


[cp-patches] FYI: BeanContextSupport - constructor fixes

2006-11-09 Thread David Gilbert

This patch (committed) fixes a few failing Mauve tests:

2006-11-09  David Gilbert  [EMAIL PROTECTED]

   * java/beans/beancontext/BeanContextSupport.java
   (BeanContextSupport): Use correct dtime default,
   (BeanContextSupport(BeanContext)): Likewise,
   (BeanContextSupport(BeanContext, Locale)): Likewise, plus renamed
   locale argument,
   (BeanContextSupport(BeanContext, Locale, boolean)): Likewise,
   (BeanContextSupport(BeanContext, Locale, boolean, boolean)): Likewise.

Regards,

Dave
Index: java/beans/beancontext/BeanContextSupport.java
===
RCS file: 
/sources/classpath/classpath/java/beans/beancontext/BeanContextSupport.java,v
retrieving revision 1.14
diff -u -r1.14 BeanContextSupport.java
--- java/beans/beancontext/BeanContextSupport.java  9 Nov 2006 17:01:49 
-   1.14
+++ java/beans/beancontext/BeanContextSupport.java  9 Nov 2006 17:31:41 
-
@@ -144,42 +144,61 @@
*/
   public BeanContextSupport ()
   {
-this (null, null, true, true);
+this (null, null, false, true);
   }
 
   /**
* Construct a BeanContextSupport instance.
+   * 
+   * @param peer  the bean context peer (codenull/code permitted).
*/
-  public BeanContextSupport (BeanContext peer)
+  public BeanContextSupport(BeanContext peer)
   {
-this (peer, null, true, true);
+this (peer, null, false, true);
   }
 
   /**
* Construct a BeanContextSupport instance.
+   * 
+   * @param peer  the bean context peer (codenull/code permitted).
+   * @param locale  the locale (codenull/code permitted, equivalent to 
+   * the default locale).
*/
-  public BeanContextSupport (BeanContext peer, Locale lcle)
+  public BeanContextSupport (BeanContext peer, Locale locale)
   {
-this (peer, lcle, true, true);
+this (peer, locale, false, true);
   }
 
   /**
* Construct a BeanContextSupport instance.
+   * 
+   * @param peer  the bean context peer (codenull/code permitted).
+   * @param locale  the locale (codenull/code permitted, equivalent to 
+   * the default locale).
+   * @param dtime  a flag indicating whether or not the bean context is in
+   * design time mode.
*/
-  public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime)
+  public BeanContextSupport (BeanContext peer, Locale locale, boolean dtime)
   {
-this (peer, lcle, dtime, true);
+this (peer, locale, dtime, true);
   }
 
   /**
* Construct a BeanContextSupport instance.
+   * 
+   * @param peer  the bean context peer (codenull/code permitted).
+   * @param locale  the locale (codenull/code permitted, equivalent to 
+   * the default locale).
+   * @param dtime  a flag indicating whether or not the bean context is in
+   * design time mode.
+   * @param visible  initial value of the codeokToUseGui/code flag.
*/
-  public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime,
+  public BeanContextSupport (BeanContext peer, Locale locale, boolean dtime,
  boolean visible)
   {
 super(peer);
 
-locale = lcle == null ? Locale.getDefault() : lcle;
+this.locale = locale == null ? Locale.getDefault() : locale;
 designTime = dtime;
 okToUseGui = visible;
 


[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-09 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/09 17:01:49

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextSupport.java 

Log message:
2006-11-09  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java
(getBeanContextPeer): Implemented.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8780r2=1.8781
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?cvsroot=classpathr1=1.13r2=1.14




[commit-cp] classpath ChangeLog java/beans/beancontext/Bean...

2006-11-09 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/11/09 17:35:55

Modified files:
.  : ChangeLog 
java/beans/beancontext: BeanContextSupport.java 

Log message:
2006-11-09  David Gilbert  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java
(BeanContextSupport): Use correct dtime default,
(BeanContextSupport(BeanContext)): Likewise,
(BeanContextSupport(BeanContext, Locale)): Likewise, plus 
renamed
locale argument,
(BeanContextSupport(BeanContext, Locale, boolean)): Likewise,
(BeanContextSupport(BeanContext, Locale, boolean, boolean)): 
Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8781r2=1.8782
http://cvs.savannah.gnu.org/viewcvs/classpath/java/beans/beancontext/BeanContextSupport.java?cvsroot=classpathr1=1.14r2=1.15




Re: [cp-patches] FYI: Font fixes

2006-11-02 Thread David Gilbert

Hi Roman,

I wanted to try this out, but if I do a clean check out of the latest 
CVS, I get the following compile error when I compile with Jikes:


Found 1 semantic error compiling 
../gnu/java/awt/peer/gtk/GdkFontPeer.java:


   59. public class GdkFontPeer extends ClasspathFontPeer
^-^
*** Semantic Error: The abstract method java.awt.geom.Rectangle2D 
getStringBounds(java.awt.Font font, java.text.CharacterIterator ci, int 
begin, int limit, java.awt.font.FontRenderContext frc);, inherited from 
type gnu.java.awt.peer.ClasspathFontPeer, is not implemented in the 
non-abstract class gnu.java.awt.peer.gtk.GdkFontPeer.


Found 1 semantic error compiling ../gnu/java/awt/peer/qt/QtFontPeer.java:

   52. public class QtFontPeer extends ClasspathFontPeer
^^
*** Semantic Error: The abstract method java.awt.geom.Rectangle2D 
getStringBounds(java.awt.Font font, java.text.CharacterIterator ci, int 
begin, int limit, java.awt.font.FontRenderContext frc);, inherited from 
type gnu.java.awt.peer.ClasspathFontPeer, is not implemented in the 
non-abstract class gnu.java.awt.peer.qt.QtFontPeer.

make[1]: *** [compile-classes] Error 1
make[1]: Leaving directory 
`/home/dgilbert/classpath-cvs-clean/classpath/lib'

make: *** [all-recursive] Error 1



If I compile instead with ecj, there is no error, but when I try to run 
the JFreeChart demo I get:


Found 1 semantic error compiling 
../gnu/java/awt/peer/gtk/GdkFontPeer.java:


   59. public class GdkFontPeer extends ClasspathFontPeer
^-^
*** Semantic Error: The abstract method java.awt.geom.Rectangle2D 
getStringBounds(java.awt.Font font, java.text.CharacterIterator ci, int 
begin, int limit, java.awt.font.FontRenderContext frc);, inherited from 
type gnu.java.awt.peer.ClasspathFontPeer, is not implemented in the 
non-abstract class gnu.java.awt.peer.gtk.GdkFontPeer.


Found 1 semantic error compiling ../gnu/java/awt/peer/qt/QtFontPeer.java:

   52. public class QtFontPeer extends ClasspathFontPeer
^^
*** Semantic Error: The abstract method java.awt.geom.Rectangle2D 
getStringBounds(java.awt.Font font, java.text.CharacterIterator ci, int 
begin, int limit, java.awt.font.FontRenderContext frc);, inherited from 
type gnu.java.awt.peer.ClasspathFontPeer, is not implemented in the 
non-abstract class gnu.java.awt.peer.qt.QtFontPeer.

make[1]: *** [compile-classes] Error 1
make[1]: Leaving directory 
`/home/dgilbert/classpath-cvs-clean/classpath/lib'

make: *** [all-recursive] Error 1

Regards,

Dave


Roman Kennke wrote:

It seems like jIRCii makes use of some more sophisticated font methods,
that didn't work quite right and lead to overlapping chars in jIRCii's
text components:

- Control characters (like \n) need to be filtered in the TextLayout and
GdkFontPeer so that the aren't rendered and also not measured in the
glyph metrics. Otherwise we get strange boxes when accidentally
rendering \n and other chars.
- Font.getStringBounds() can be implemented without a peer interface by
using TextLayout. We should maybe throw out some more ClasspathFontPeer
stuff and maybe provide a generic FontMetrics/LineMetrics implementation
based on TextLayout too.
- Fresh Window objects need to have a font set.
- In FreetypeGlyphVector.getLogicalBounds() we don't need to translate
the glyph bounds. They already are translated.

2006-11-02  Roman Kennke  [EMAIL PROTECTED]

PR 29644
* gnu/java/awt/peer/ClasspathFontPeer.java
(getStringBounds): Removed abstract method. This is replaced
in java.awt.Font to use a TextLayout.
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(GtkWindowPeer): Set a font on the window object.
* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
(FreetypeGlyphVector(Font,String,FontRenderContext,int)):
Changed to take char,int,int instead of String. Filter
control characters.
(FreetypeGlyphVector(Font,String,FontRenderContext)):
Create char array out of string.
(getLogicalBounds): Don't translate bounds. They already are
translated.
* gnu/java/awt/peer/gtk/GdkFontMetrics.java
(stringWidth): Filter out control characters.
* gnu/java/awt/peer/gtk/GdkFontPeer.java
(getStringBounds): Removed unneeded method.
(layoutGlyphVector): Pass char array directly to FreetypeGlyphVector
constructor.
* gnu/java/awt/peer/qt/QtFontPeer.java
(getStringBounds): Removed unneeded method.
* gnu/java/awt/peer/x/XFontPeer.java
(getStringBounds): Removed unneeded method.
* gnu/java/awt/peer/x/XFontPeer2.java
(getStringBounds): Removed unneeded method.
* java/awt/Font.java
(getStringBounds(char[],int,int,FontRenderContext)):
Use TextLayout to determine the bounds.
(getStringBounds(CharacterIterator,int,int,FontRenderContext)):
Delegate to the 

Re: [cp-patches] FYI: Font fixes

2006-11-02 Thread David Gilbert

Thanks, that fixed it!

Roman Kennke wrote:

Am Donnerstag, den 02.11.2006, 17:04 + schrieb David Gilbert:
  

Hi Roman,

I wanted to try this out, but if I do a clean check out of the latest 
CVS, I get the following compile error when I compile with Jikes:


Found 1 semantic error compiling 
../gnu/java/awt/peer/gtk/GdkFontPeer.java:


59. public class GdkFontPeer extends ClasspathFontPeer
 ^-^
*** Semantic Error: The abstract method java.awt.geom.Rectangle2D 
getStringBounds(java.awt.Font font, java.text.CharacterIterator ci, int 
begin, int limit, java.awt.font.FontRenderContext frc);, inherited from 
type gnu.java.awt.peer.ClasspathFontPeer, is not implemented in the 
non-abstract class gnu.java.awt.peer.gtk.GdkFontPeer.



Whoopsie. I forgot to check in the changed ClasspathFontPeer class.
Attached you find the patch that I checked in right now.

/Roman

  



Index: gnu/java/awt/peer/ClasspathFontPeer.java
===
RCS file: 
/cvsroot/classpath/classpath/gnu/java/awt/peer/ClasspathFontPeer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -1 -5 -r1.9 -r1.10
--- gnu/java/awt/peer/ClasspathFontPeer.java13 Jul 2006 17:30:24 -  
1.9
+++ gnu/java/awt/peer/ClasspathFontPeer.java2 Nov 2006 17:13:51 -   
1.10
@@ -820,30 +820,16 @@
   CharacterIterator ci, 
   int begin, int limit, 
   FontRenderContext rc);
 
   /** 
* Implementation of [EMAIL PROTECTED] Font#getMaxCharBounds(FontRenderContext)}

*
* @param font the font this peer is being called from. This may be
* useful if you are sharing peers between Font objects. Otherwise it may
* be ignored.
*/
 
   public abstract Rectangle2D getMaxCharBounds (Font font, 
 FontRenderContext rc);
 
-  /** 
-   * Implementation of [EMAIL PROTECTED] Font#getStringBounds(CharacterIterator, int,

-   * int, FontRenderContext)}
-   *
-   * @param font the font this peer is being called from. This may be
-   * useful if you are sharing peers between Font objects. Otherwise it may
-   * be ignored.
-   */
-
-  public abstract Rectangle2D getStringBounds (Font font, 
-   CharacterIterator ci, 
-   int begin, int limit, 
-   FontRenderContext frc);

-
 }
  





[cp-patches] FYI: GeneralPath - API doc fixes

2006-11-02 Thread David Gilbert
This patch (committed) fixes a couple of Eclipse warnings concerning the 
API docs for GeneralPath:


2006-11-02  David Gilbert  [EMAIL PROTECTED]

   * java/awt/geom/GeneralPath.java: API doc fixes.

Regards,

Dave
Index: java/awt/geom/GeneralPath.java
===
RCS file: /sources/classpath/classpath/java/awt/geom/GeneralPath.java,v
retrieving revision 1.17
diff -u -r1.17 GeneralPath.java
--- java/awt/geom/GeneralPath.java  26 Jul 2006 20:32:06 -  1.17
+++ java/awt/geom/GeneralPath.java  2 Nov 2006 17:29:05 -
@@ -86,7 +86,7 @@
   public static final int WIND_EVEN_ODD
 = java.awt.geom.PathIterator.WIND_EVEN_ODD;
 
-  /** Same constant as [EMAIL PROTECTED] PathIterator.WIND_NON_ZERO}. */
+  /** Same constant as [EMAIL PROTECTED] PathIterator#WIND_NON_ZERO}. */
   public static final int WIND_NON_ZERO
 = java.awt.geom.PathIterator.WIND_NON_ZERO;
 
@@ -140,7 +140,11 @@
   /**
* Constructs a GeneralPath with a specific winding rule
* and the default initial capacity (20).
-   * @param rule the winding rule (WIND_NON_ZERO or WIND_EVEN_ODD)
+   * @param rule the winding rule ([EMAIL PROTECTED] #WIND_NON_ZERO} or 
+   * [EMAIL PROTECTED] #WIND_EVEN_ODD})
+   * 
+   * @throws IllegalArgumentException if coderule/code is not one of the
+   * listed values.
*/
   public GeneralPath(int rule)
   {
@@ -151,8 +155,12 @@
* Constructs a GeneralPath with a specific winding rule
* and the initial capacity. The initial capacity should be
* the approximate number of path segments to be used.
-   * @param rule the winding rule (WIND_NON_ZERO or WIND_EVEN_ODD)
+   * @param rule the winding rule ([EMAIL PROTECTED] #WIND_NON_ZERO} or 
+   * [EMAIL PROTECTED] #WIND_EVEN_ODD})
* @param capacity the inital capacity, in path segments
+   * 
+   * @throws IllegalArgumentException if coderule/code is not one of the
+   * listed values.
*/
   public GeneralPath(int rule, int capacity)
   {
@@ -169,7 +177,10 @@
   /**
* Constructs a GeneralPath from an arbitrary shape object.
* The Shapes PathIterator path and winding rule will be used.
-   * @param s the shape
+   * 
+   * @param s the shape (codenull/code not permitted).
+   * 
+   * @throws NullPointerException if codeshape/code is codenull/code.
*/
   public GeneralPath(Shape s)
   {
@@ -183,6 +194,9 @@
 
   /**
* Adds a new point to a path.
+   * 
+   * @param x  the x-coordinate.
+   * @param y  the y-coordinate.
*/
   public void moveTo(float x, float y)
   {
@@ -263,6 +277,11 @@
* Appends the segments of a Shape to the path. If codeconnect/code is 
* true, the new path segments are connected to the existing one with a line.
* The winding rule of the Shape is ignored.
+   * 
+   * @param s  the shape (codenull/code not permitted).
+   * @param connect  whether to connect the new shape to the existing path.
+   * 
+   * @throws NullPointerException if codes/code is codenull/code.
*/
   public void append(Shape s, boolean connect)
   {
@@ -276,7 +295,7 @@
* PathIterator#SEG_LINETO} segment.
*
* @param iter the PathIterator specifying which segments shall be
-   * appended.
+   * appended (codenull/code not permitted).
*
* @param connect codetrue/code for substituting the initial
* [EMAIL PROTECTED] PathIterator#SEG_MOVETO} segment by a [EMAIL PROTECTED]
@@ -327,6 +346,8 @@
 
   /**
* Returns the path#x2019;s current winding rule.
+   * 
+   * @return [EMAIL PROTECTED] #WIND_EVEN_ODD} or [EMAIL PROTECTED] 
#WIND_NON_ZERO}.
*/
   public int getWindingRule()
   {
@@ -338,6 +359,8 @@
* considered #x2019;inside#x2019; or #x2019;outside#x2019; the path 
* on drawing. Valid rules are WIND_EVEN_ODD for an even-odd winding rule, 
* or WIND_NON_ZERO for a non-zero winding rule.
+   * 
+   * @param rule  the rule ([EMAIL PROTECTED] #WIND_EVEN_ODD} or [EMAIL 
PROTECTED] #WIND_NON_ZERO}).
*/
   public void setWindingRule(int rule)
   {
@@ -348,6 +371,8 @@
 
   /**
* Returns the current appending point of the path.
+   * 
+   * @return The point.
*/
   public Point2D getCurrentPoint()
   {
@@ -367,6 +392,8 @@
 
   /**
* Applies a transform to the path.
+   * 
+   * @param xform  the transform (codenull/code not permitted).
*/
   public void transform(AffineTransform xform)
   {
@@ -706,6 +733,8 @@
   /**
* Helper method - ensure the size of the data arrays,
* otherwise, reallocate new ones twice the size
+   * 
+   * @param size  the minimum array size.
*/
   private void ensureSize(int size)
   {


Re: [cp-patches] FYI: JEditorPane fix

2006-10-18 Thread David Gilbert

Hi Roman,

I was hopeful that this might improve the JFreeChart demo a little, 
because it displays an HTML description of the selected chart.  With GNU 
Classpath, the description is currently displayed as plain text with 
visible HTML tags.


It turns out that with your patch, the chart description disappears 
entirely.  It might be because the demo uses a JTextPane to display the 
description (JTextPane is a subclass of JEditorPane).  I don't know how 
to fix this in GNU Classpath.  Do you have time to look at the JTextPane 
class?  If not, I'll file a bug so it isn't forgotten in the long run...


Regards,

Dave

Roman Kennke wrote:

This is an old patch that enables basic HTML loading from URLs in
JEditorPanes via setPage(URL).

2006-10-18  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JEditorPane.java
(page): Removed field. The page is now stored in the correct
document property.
(getPage): Fetch page URL from document property.
(read): Set the document for this JEditorPane. Use a Reader
for reading in the document.
(setPage): Call getStream() to get the stream from which we read.
Fire property change. Store page in document property.

/Roman

  




Re: [cp-patches] FYI: JEditorPane fix

2006-10-18 Thread David Gilbert
I've attached a minimal test case that shows the problem.  Run the test 
code with the test.html file in the same directory as the 
JTextPaneTest.class file.  I tried changing the JTextPane to a 
JEditorPane, but that fails also.


Regards,

Dave

David Gilbert wrote:

Hi Roman,

I was hopeful that this might improve the JFreeChart demo a little, 
because it displays an HTML description of the selected chart.  With 
GNU Classpath, the description is currently displayed as plain text 
with visible HTML tags.


It turns out that with your patch, the chart description disappears 
entirely.  It might be because the demo uses a JTextPane to display 
the description (JTextPane is a subclass of JEditorPane).  I don't 
know how to fix this in GNU Classpath.  Do you have time to look at 
the JTextPane class?  If not, I'll file a bug so it isn't forgotten in 
the long run...


Regards,

Dave

Roman Kennke wrote:

This is an old patch that enables basic HTML loading from URLs in
JEditorPanes via setPage(URL).

2006-10-18  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JEditorPane.java
(page): Removed field. The page is now stored in the correct
document property.
(getPage): Fetch page URL from document property.
(read): Set the document for this JEditorPane. Use a Reader
for reading in the document.
(setPage): Call getStream() to get the stream from which we read.
Fire property change. Store page in document property.

/Roman

  






import java.awt.Dimension;
import java.io.IOException;
import java.net.URL;

import javax.swing.JFrame;
import javax.swing.JTextPane;

public class JTextPaneTest extends JFrame {

public JTextPaneTest(String title) {
super(title);
JTextPane tp = new JTextPane();
tp.setEditable(false);
URL url = JTextPaneTest.class.getResource(test.html);
try {
tp.setPage(url);
} 
catch (IOException e) {
e.printStackTrace();
}
setContentPane(tp);
}
public static void main(String[] args) {
JTextPaneTest app = new JTextPaneTest(JTextPaneTest);
app.setPreferredSize(new Dimension(600, 400));
app.pack();
app.setVisible(true);
}
}
Hello World!

This is a JTextPane.

[cp-patches] FYI: DefaultTreeSelectionModel.clone() - fix compile error with Jikes

2006-10-13 Thread David Gilbert

This patch (committed) fixes a compile error I get from jikes:

2006-10-13  David Gilbert  [EMAIL PROTECTED]

* javax/swing/tree/DefaultTreeSelectionModel.java
(clone): Added cast to TreePath[].

Regards,

Dave
Index: javax/swing/tree/DefaultTreeSelectionModel.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultTreeSelectionModel.java,v
retrieving revision 1.33
diff -u -r1.33 DefaultTreeSelectionModel.java
--- javax/swing/tree/DefaultTreeSelectionModel.java 12 Oct 2006 09:22:02 
-  1.33
+++ javax/swing/tree/DefaultTreeSelectionModel.java 13 Oct 2006 08:49:32 
-
@@ -202,7 +202,7 @@
 DefaultTreeSelectionModel cloned = 
   (DefaultTreeSelectionModel) super.clone();
 cloned.changeSupport = null;
-cloned.selection = selection.clone();
+cloned.selection = (TreePath[]) selection.clone();
 cloned.listenerList = new EventListenerList();
 cloned.listSelectionModel =
   (DefaultListSelectionModel) listSelectionModel.clone();


Re: [cp-patches] FYI: JSlider fixes

2006-10-13 Thread David Gilbert
Does this work for you?  After this change, in our Swing demo I just see 
... instead of text for all of the labels.


Regards,

Dave

Roman Kennke wrote:

This fixes various issues with the JSlider (and its UIs):
- There were several repaint() and revalidate() calls missing. This
caused the JSlider to behave sluggish, like changing the layout after
being made visible, sometimes rendering labels as '...' asf.
- Some rectangle calculations were a little off in the UIs, this caused
the labels to be too close to their ticks.
- The preferred and minimum sizes should be based on UI properties, plus
some insets.
- The maximum size should be the preferred size with height or width
(depending on the orientation) set to Short.MAX_VALUE.
- Painting was not optimal, I added checks if certain rectangles hit the
clip before painting anything.

2006-10-12  Roman Kennke  [EMAIL PROTECTED]

PR 27956
* javax/swing/JSlider.java
(LabelUIResource): New inner class. A JLabel as UIResource.
(createStandardLabels): Don't set label bounds here.
Create LabelUIResource instances.
(setInverted): Repaint.
(setLabelTable): Update the label UIs. Revalidate and repaint.
(setMajorTickSpacing): Update the label table. Repaint if
necessary.
(setMinorTickSpacing): Repaint if necessary.
(setOrientation): Revalidate.
(setPaintLabels): Revalidate and repaint.
(setPaintTicks): Revalidate and repaint.
(setPaintTrack): Repaint.
(updateLabelUIs): Set the label sizes here.
(updateUI): Also update the label UIs.
* javax/swing/plaf/basic/BasicSliderUI.java
(ComponentHandler.componentResized): Don't revalidate.
(FocusHandler.focusGained): Don't set field.
(FocusHandler.focusLost): Don't set field.
(PropertyChangeHandler.propertyChange): Calculate geometry
and repaint for a couple more properties.
(TrackListener.mouseReleased): Repaint.
(hasFocus): Removed unneeded field.
(calculateContentRect): No need to check for content size  0.
(calculateFocusRect): Use insets from insetCache.
(calculateLabelRect): Fixed calculation of label rectangle.
It is relative to the tick rectangle, rather than the content
rectangle.
(calculateTickRect): Small restructuring to avoid unnecessary
comparisons.
(calculateTrackRect): Fixed calculation of track rectangle.
(getMaximumSize): Fixed. Fetch preferred size and set
the height of width to Short.MAX_VALUE.
(getMinimumHorizontalSize): Fixed to return UIManager value.
(getMinimumVerticalSize): Fixed to return UIManager value.
(getPreferredHorizontalSize): Fixed to return UIManager value.
(getPreferredVerticalSize): Fixed to return UIManager value.
(getMinimumSize): Fixed to return the UIManager value plus
insets added.
(getPreferredSize): Fixed to return the UIManager value plus
insets added.
(getWidthOfWidestLabel): Restructured for more cleanness and
efficiency.
(hitClip): New helper method.
(paintHorizontalLabel): Replaced by more efficient and clean
implementation.
(paintVerticalLabel): Replaced by more efficient and clean
implementation.
(paintLabels): Replaced by more efficient and clean
implementation.
(paint): Check if rectangles intersect with clip for maximum
efficiency.
(recalculateIfInsetsChanged): Fixed. This method should
recalculate only when the insets changed.
(setThumbLocation): Repaint with a reasonable clip.
(xPositionForValue): Made more clean and efficient.
(yPositionForValue): Made more clean and efficient.
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponenDefaults): Added Slider.horizontalSize,
Slider.verticalSize, Slider.minimumHorizontalSize and
Slider.minimumVerticalSize properties.
* javax/swing/plaf/metal/MetalSliderUI.java
(getTickLength): Add 1 for horizontal sliders and 3 for
vertical sliders.
(paintMajorTickForHorizSlider): Fix colors. Fix line locations.
(paintMinorTickForHorizSlider): Fix colors. Fix line locations.
(paintMajorTickForVertSlider): Fix colors. Fix line locations.
(paintMinorTickForVertSlider): Fix colors. Fix line locations.

/Roman
  




[commit-cp] classpath ChangeLog javax/swing/tree/DefaultTre...

2006-10-13 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/10/13 08:56:29

Modified files:
.  : ChangeLog 
javax/swing/tree: DefaultTreeSelectionModel.java 

Log message:
2006-10-13  David Gilbert  [EMAIL PROTECTED]

* javax/swing/tree/DefaultTreeSelectionModel.java
(clone): Added cast to TreePath[].

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8674r2=1.8675
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/tree/DefaultTreeSelectionModel.java?cvsroot=classpathr1=1.33r2=1.34




[cp-patches] FYI: MetalIconFactory - icon updates

2006-09-26 Thread David Gilbert

This patch (committed) fixes a couple of file chooser icons to pick up the 
theme colors:

2006-09-26  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalIconFactory.java
(FileIcon16.paintIcon): Fetch colors from look and feel,
(FolderIcon16.paintIcon): Likewise.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalIconFactory.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v
retrieving revision 1.29
diff -u -r1.29 MetalIconFactory.java
--- javax/swing/plaf/metal/MetalIconFactory.java12 Sep 2006 09:48:43 
-  1.29
+++ javax/swing/plaf/metal/MetalIconFactory.java26 Sep 2006 10:37:31 
-
@@ -54,7 +54,6 @@
 import javax.swing.JSlider;
 import javax.swing.SwingConstants;
 import javax.swing.UIManager;
-import javax.swing.plaf.IconUIResource;
 import javax.swing.plaf.UIResource;
 
 
@@ -569,8 +568,7 @@
  */
 public void paintIcon(Component c, Graphics g, int x, int y) 
 {
-  // TODO: pick up appropriate UI colors
-  g.setColor(Color.black);
+  g.setColor(MetalLookAndFeel.getBlack());
   g.drawLine(x, y, x + 9, y);
   g.drawLine(x, y + 1, x, y + 15);
   g.drawLine(x, y + 15, x + 12, y + 15);
@@ -580,7 +578,7 @@
   g.drawLine(x + 7, y + 2, x + 11, y + 6);
   g.drawLine(x + 8, y + 1, x + 9, y + 1);
 
-  g.setColor(new Color(204, 204, 255));
+  g.setColor(MetalLookAndFeel.getPrimaryControl());
   g.drawLine(x + 1, y + 1, x + 7, y + 1);
   g.drawLine(x + 1, y + 1, x + 1, y + 14);
   g.drawLine(x + 1, y + 14, x + 11, y + 14);
@@ -649,19 +647,18 @@
  */
 public void paintIcon(Component c, Graphics g, int x, int y) 
 {
-  // TODO: pick up appropriate UI colors
-  g.setColor(Color.black);
+  g.setColor(MetalLookAndFeel.getBlack());
   g.drawLine(x, y + 3, x, y + 12);
   g.drawLine(x, y + 12, x + 15, y + 12);
   g.drawLine(x + 15, y + 12, x + 15, y + 2);
   g.drawLine(x + 14, y + 3, x + 9, y + 3);
   g.drawLine(x + 8, y + 2, x + 1, y + 2);
-  g.setColor(new Color(204, 204, 255));
+  g.setColor(MetalLookAndFeel.getPrimaryControl());
   g.fillRect(x + 2, y + 4, 7, 8);
   g.fillRect(x + 9, y + 5, 6, 7);
-  g.setColor(new Color(102, 102, 153));
+  g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
   g.drawLine(x + 9, y + 2, x + 14, y + 2);
-  g.setColor(new Color(50, 50, 120));
+  g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
   g.drawLine(x + 9, y + 1, x + 15, y + 1);
   g.drawLine(x + 10, y, x + 15, y);
 }


[cp-patches] FYI: MetalIconFactory - getShift() methods

2006-09-26 Thread David Gilbert
This patch (committed) fixes the painting of icons to respect the (possibly 
overridden) getShift() method.  It improves the appearance of our file chooser and 
JTree components, a little bit anyway:


2006-09-26  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalIconFactory.java
(FileIcon16.paintIcon): Apply vertical shift by the number of pixels
returned by getShift(),
(FileIcon16.getShift): Updated API docs,
(FolderIcon16.paintIcon): Apply vertical shift by the number of pixels
returned by getShift(),
(FolderIcon16.getShift): Updated API docs,
(TreeFolderIcon.getShift): Likewise,
(TreeLeafIcon.getShift): Likewise.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalIconFactory.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v
retrieving revision 1.30
diff -u -r1.30 MetalIconFactory.java
--- javax/swing/plaf/metal/MetalIconFactory.java26 Sep 2006 10:49:51 
-  1.30
+++ javax/swing/plaf/metal/MetalIconFactory.java26 Sep 2006 13:23:59 
-
@@ -568,6 +568,7 @@
  */
 public void paintIcon(Component c, Graphics g, int x, int y) 
 {
+  y = y + getShift();
   g.setColor(MetalLookAndFeel.getBlack());
   g.drawLine(x, y, x + 9, y);
   g.drawLine(x, y + 1, x, y + 15);
@@ -599,7 +600,9 @@
 }
 
 /**
- * Returns the shift (???).
+ * Returns the vertical shift, in pixels, applied when painting the icon.  
+ * The default value is zero, but subclasses may override this (for 
+ * example, see [EMAIL PROTECTED] TreeLeafIcon}).
  * 
  * @return The shift.
  */
@@ -647,20 +650,21 @@
  */
 public void paintIcon(Component c, Graphics g, int x, int y) 
 {
+  y = y + getShift();
   g.setColor(MetalLookAndFeel.getBlack());
-  g.drawLine(x, y + 3, x, y + 12);
-  g.drawLine(x, y + 12, x + 15, y + 12);
-  g.drawLine(x + 15, y + 12, x + 15, y + 2);
-  g.drawLine(x + 14, y + 3, x + 9, y + 3);
-  g.drawLine(x + 8, y + 2, x + 1, y + 2);
+  g.drawLine(x, y + 6, x, y + 15);
+  g.drawLine(x, y + 15, x + 15, y + 15);
+  g.drawLine(x + 15, y + 15, x + 15, y + 5);
+  g.drawLine(x + 14, y + 6, x + 9, y + 6);
+  g.drawLine(x + 8, y + 5, x + 1, y + 5);
   g.setColor(MetalLookAndFeel.getPrimaryControl());
-  g.fillRect(x + 2, y + 4, 7, 8);
-  g.fillRect(x + 9, y + 5, 6, 7);
+  g.fillRect(x + 2, y + 7, 7, 8);
+  g.fillRect(x + 9, y + 8, 6, 7);
   g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
-  g.drawLine(x + 9, y + 2, x + 14, y + 2);
+  g.drawLine(x + 9, y + 5, x + 14, y + 5);
   g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
-  g.drawLine(x + 9, y + 1, x + 15, y + 1);
-  g.drawLine(x + 10, y, x + 15, y);
+  g.drawLine(x + 9, y + 4, x + 15, y + 4);
+  g.drawLine(x + 10, y + 3, x + 15, y + 3);
 }
 
 /**
@@ -676,7 +680,9 @@
 }
 
 /**
- * Returns the shift (???).
+ * Returns the vertical shift, in pixels, applied when painting the icon.  
+ * The default value is zero, but subclasses may override this (for 
+ * example, see [EMAIL PROTECTED] TreeFolderIcon}).
  * 
  * @return The shift.
  */
@@ -1880,7 +1886,8 @@
 }
 
 /**
- * Returns the shift (???).
+ * Returns the vertical shift, in pixels, applied when painting the icon.  
+ * This overridden method returns code-1/code.
  * 
  * @return The shift.
  */
@@ -1915,7 +1922,8 @@
 }
 
 /**
- * Returns the shift (???).
+ * Returns the vertical shift, in pixels, applied when painting the icon.  
+ * This overridden method returns code2/code.
  * 
  * @return The shift.
  */


[cp-patches] FYI: SizeSequence.getSize() fix

2006-09-22 Thread David Gilbert
This patch (committed) fixes an ArrayIndexOutOfBoundsException in the 
JTable.getRowHeight(int) method:


2006-09-22  David Gilbert  [EMAIL PROTECTED]

* javax/swing/SizeSequence.java
(getSize): Return 0 if index is out of bounds.

Mauve tests already committed.

Regards,

Dave
Index: javax/swing/SizeSequence.java
===
RCS file: /sources/classpath/classpath/javax/swing/SizeSequence.java,v
retrieving revision 1.5
diff -u -r1.5 SizeSequence.java
--- javax/swing/SizeSequence.java   21 Jun 2006 12:42:51 -  1.5
+++ javax/swing/SizeSequence.java   22 Sep 2006 11:17:21 -
@@ -129,14 +129,18 @@
   }
 
   /**
-   * Returns the size of the specified element.
+   * Returns the size of the specified element, or 0 if the element index is
+   * outside the defined range.
* 
* @param index  the element index.
* 
-   * @return The size of the specified element.
+   * @return The size of the specified element, or 0 if the element index is
+   * outside the defined range.
*/
   public int getSize(int index)
   {
+if (index  0 || index = sizes.length)
+  return 0;
 return sizes[index];
   }
 


[commit-cp] classpath ChangeLog javax/swing/SizeSequence.java

2006-09-22 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/22 11:20:36

Modified files:
.  : ChangeLog 
javax/swing: SizeSequence.java 

Log message:
2006-09-22  David Gilbert  [EMAIL PROTECTED]

* javax/swing/SizeSequence.java
(getSize): Return 0 if index is out of bounds.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8592r2=1.8593
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/SizeSequence.java?cvsroot=classpathr1=1.5r2=1.6




[cp-patches] FYI: BasicInternalFrameTitlePane.java - flip icon when maximising

2006-09-21 Thread David Gilbert
This patch (committed) flips the icon on the maximise/minimise button for internal 
frames:


2006-09-21  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
(MaximizeAction.actionPerformed): Change icon on maxButton.

Regards,

Dave
Index: javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java,v
retrieving revision 1.22
diff -u -r1.22 BasicInternalFrameTitlePane.java
--- javax/swing/plaf/basic/BasicInternalFrameTitlePane.java 8 Apr 2006 
13:43:19 -   1.22
+++ javax/swing/plaf/basic/BasicInternalFrameTitlePane.java 21 Sep 2006 
10:25:16 -
@@ -177,9 +177,15 @@
   try
 {
   if (frame.isMaximizable()  ! frame.isMaximum())
-frame.setMaximum(true);
+{
+  frame.setMaximum(true);
+  maxButton.setIcon(minIcon);
+}
   else if (frame.isMaximum())
-frame.setMaximum(false);
+{
+  frame.setMaximum(false);
+  maxButton.setIcon(maxIcon);
+}
 }
   catch (PropertyVetoException pve)
 {


[cp-patches] FYI: RoundRectangle2D.java - fix for bug 27929

2006-09-20 Thread David Gilbert

This patch (committed) fixes bug 27929 by reimplementing the getPathIterator() 
method:

2006-09-20  David Gilbert  [EMAIL PROTECTED]

* java/awt/geom/RoundRectangle2D.java:
(getPathIterator): Reimplemented,
and updated various API doc comments.

Regards,

Dave
Index: java/awt/geom/RoundRectangle2D.java
===
RCS file: /sources/classpath/classpath/java/awt/geom/RoundRectangle2D.java,v
retrieving revision 1.7
diff -u -r1.7 RoundRectangle2D.java
--- java/awt/geom/RoundRectangle2D.java 2 Jul 2005 20:32:29 -   1.7
+++ java/awt/geom/RoundRectangle2D.java 20 Sep 2006 13:26:03 -
@@ -1,5 +1,5 @@
 /* RoundRectangle2D.java -- represents a rectangle with rounded corners
-   Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
+   Copyright (C) 2000, 2002, 2003, 2004, 2006, Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -37,7 +37,6 @@
 
 package java.awt.geom;
 
-import java.util.NoSuchElementException;
 
 
 /** This class implements a rectangle with rounded corners.
@@ -46,13 +45,29 @@
  */
 public abstract class RoundRectangle2D extends RectangularShape
 {
-  /** Return the arc height of this round rectangle.  */
+  /** 
+   * Return the arc height of this round rectangle.  The arc height and width
+   * control the roundness of the corners of the rectangle.
+   * 
+   * @return The arc height.
+   * 
+   * @see #getArcWidth()
+   */
   public abstract double getArcHeight();
 
-  /** Return the arc width of this round rectangle.  */
+  /** 
+   * Return the arc width of this round rectangle.  The arc width and height
+   * control the roundness of the corners of the rectangle.
+   * 
+   * @return The arc width.
+   * 
+   * @see #getArcHeight()
+   */
   public abstract double getArcWidth();
 
-  /** Set the values of this round rectangle
+  /** 
+   * Set the values of this round rectangle.
+   * 
* @param x The x coordinate
* @param y The y coordinate
* @param w The width
@@ -63,14 +78,16 @@
   public abstract void setRoundRect(double x, double y, double w, double h,
 double arcWidth, double arcHeight);
 
-  /** Create a RoundRectangle2D.  This is protected because this class
+  /** 
+   * Create a RoundRectangle2D.  This is protected because this class
* is abstract and cannot be instantiated.
*/
   protected RoundRectangle2D()
   {
   }
 
-  /** Return true if this object contains the specified point.
+  /** 
+   * Return true if this object contains the specified point.
* @param x The x coordinate
* @param y The y coordinate
*/
@@ -106,7 +123,8 @@
 return dx * dx + dy * dy = 1.0;
   }
 
-  /** Return true if this object contains the specified rectangle
+  /** 
+   * Return true if this object contains the specified rectangle
* @param x The x coordinate
* @param y The y coordinate
* @param w The width
@@ -120,176 +138,185 @@
 contains(x + w, y));
   }
 
-  /** Return a new path iterator which iterates over this rectangle.
+  /** 
+   * Return a new path iterator which iterates over this rectangle.
+   * 
* @param at An affine transform to apply to the object
*/
-  public PathIterator getPathIterator(final AffineTransform at)
+  public PathIterator getPathIterator(final AffineTransform at) 
   {
-final double minx = getX();
-final double miny = getY();
-final double maxx = minx + getWidth();
-final double maxy = miny + getHeight();
-final double arcwidth = getArcWidth();
-final double archeight = getArcHeight();
-return new PathIterator()
+double arcW = Math.min(getArcWidth(), getWidth());
+double arcH = Math.min(getArcHeight(), getHeight());
+
+// check for special cases...
+if (arcW = 0 || arcH = 0)
+  {
+Rectangle2D r = new Rectangle2D.Double(getX(), getY(), getWidth(), 
+getHeight());
+return r.getPathIterator(at);
+  }
+else if (arcW = getWidth()  arcH = getHeight()) 
+  {
+Ellipse2D e = new Ellipse2D.Double(getX(), getY(), getWidth(), 
+getHeight());
+return e.getPathIterator(at);
+  }
+
+// otherwise return the standard case...
+return new PathIterator() 
+  {
+double x = getX();
+double y = getY();
+double w = getWidth();
+double h = getHeight();
+double arcW = Math.min(getArcWidth(), w);
+double arcH = Math.min(getArcHeight(), h);
+Arc2D.Double arc = new Arc2D.Double();
+PathIterator corner;
+int step = -1;
+
+public int currentSegment(double[] coords) 
+{
+  if (corner != null) // steps 1, 3, 5 and 7
+  {
+int r = corner.currentSegment(coords);
+if (r == SEG_MOVETO)
+  r = SEG_LINETO;
+return r;
+  }
+  if (step == -1) 
+  {
+// move

[cp-patches] FYI: BasicRadioButtonUI.java - fix initialisation of icon field

2006-09-20 Thread David Gilbert
This patch (committed) tweaks the icon initialisation to fix a problem that shows up 
when using the LiquidLookAndFeel:


2006-09-20  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicRadioButtonUI.java
(BasicRadioButtonUI): Don't fetch icon here,
(installDefaults): Initialise icon here,
(getDefaultIcon): Just return icon.

Regards,

Dave
Index: javax/swing/plaf/basic/BasicRadioButtonUI.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java,v
retrieving revision 1.20
diff -u -r1.20 BasicRadioButtonUI.java
--- javax/swing/plaf/basic/BasicRadioButtonUI.java  17 Aug 2006 14:45:46 
-  1.20
+++ javax/swing/plaf/basic/BasicRadioButtonUI.java  20 Sep 2006 15:14:43 
-
@@ -81,7 +81,7 @@
*/
   public BasicRadioButtonUI()
   {
-icon = getDefaultIcon();
+// nothing to do
   }
 
   /**
@@ -93,6 +93,7 @@
   protected void installDefaults(AbstractButton b)
   {
 super.installDefaults(b);
+icon = UIManager.getIcon(getPropertyPrefix() + icon);
   }
 
   /**
@@ -116,7 +117,7 @@
*/
   public Icon getDefaultIcon()
   {
-return UIManager.getIcon(getPropertyPrefix() + icon);
+return icon;
   }
 
   /**


[commit-cp] classpath ChangeLog java/awt/geom/RoundRectangl...

2006-09-20 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/20 13:27:50

Modified files:
.  : ChangeLog 
java/awt/geom  : RoundRectangle2D.java 

Log message:
2006-09-20  David Gilbert  [EMAIL PROTECTED]

* java/awt/geom/RoundRectangle2D.java:
(getPathIterator): Reimplemented,
and updated various API doc comments.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8572r2=1.8573
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/geom/RoundRectangle2D.java?cvsroot=classpathr1=1.7r2=1.8




[commit-cp] classpath ChangeLog javax/swing/plaf/basic/Basi...

2006-09-20 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/20 15:21:00

Modified files:
.  : ChangeLog 
javax/swing/plaf/basic: BasicRadioButtonUI.java 

Log message:
2006-09-20  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicRadioButtonUI.java
(BasicRadioButtonUI): Don't fetch icon here,
(installDefaults): Initialise icon here,
(getDefaultIcon): Just return icon.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8574r2=1.8575
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java?cvsroot=classpathr1=1.20r2=1.21




[cp-patches] FYI: AbstractButton and subclasses - initialisation fixes

2006-09-19 Thread David Gilbert
This patch (committed) fixes a problem that shows up when trying to run the 
LiquidLookAndFeel [1] on GNU Classpath where an exception is thrown because the 
JMenuItem button model hasn't been initialised at the point that the UI delegate is set:


2006-09-19  David Gilbert  [EMAIL PROTECTED]

* javax/swing/AbstractButton.java
(AbstractButton): Don't call updateUI(),
* javax/swing/JButton.java
(JButton(String, Icon)): Call setModel() before init(),
* javax/swing/JMenuItem.java
(JMenuItem()): Delegate to another constructor,
(JMenuItem(Icon)): Likewise,
(JMenuItem(Action)): Set model,
(JMenuItem(String, Icon)): Likewise,
* javax/swing/JToggleButton.java
(init): Call setModel() before init().

I have some Mauve tests to cover these changes.

Regards,

Dave

[1] https://liquidlnf.dev.java.net/
Index: javax/swing/AbstractButton.java
===
RCS file: /sources/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.67
diff -u -r1.67 AbstractButton.java
--- javax/swing/AbstractButton.java 12 Sep 2006 09:02:05 -  1.67
+++ javax/swing/AbstractButton.java 19 Sep 2006 14:07:06 -
@@ -908,7 +908,6 @@
 // hard-coded here and the 'Button.iconTextGap' setting in the 
 // UI defaults is ignored, at least by the MetalLookAndFeel
 iconTextGap = 4;
-updateUI();
   }
 
   /**
@@ -969,6 +968,8 @@
 
 if (icon != null)
   default_icon = icon;
+
+updateUI();
  }
  
   /**
Index: javax/swing/JButton.java
===
RCS file: /sources/classpath/classpath/javax/swing/JButton.java,v
retrieving revision 1.26
diff -u -r1.26 JButton.java
--- javax/swing/JButton.java19 Apr 2006 21:00:17 -  1.26
+++ javax/swing/JButton.java19 Sep 2006 14:07:06 -
@@ -132,8 +132,8 @@
   public JButton(String text, Icon icon)
   {
 super();
-init(text, icon);
 setModel(new DefaultButtonModel());
+init(text, icon);
 defaultCapable = true;
   }
 
Index: javax/swing/JMenuItem.java
===
RCS file: /sources/classpath/classpath/javax/swing/JMenuItem.java,v
retrieving revision 1.33
diff -u -r1.33 JMenuItem.java
--- javax/swing/JMenuItem.java  23 Aug 2006 22:03:23 -  1.33
+++ javax/swing/JMenuItem.java  19 Sep 2006 14:07:08 -
@@ -81,8 +81,7 @@
*/
   public JMenuItem()
   {
-super();
-init(null, null);
+this(null, null);
   }
 
   /**
@@ -94,8 +93,7 @@
   {
 // FIXME: The requestedFocusEnabled property should
 // be set to false, when only icon is set for menu item.
-super();
-init(null, icon);
+this(null, icon);
   }
 
   /**
@@ -117,6 +115,7 @@
   {
 super();
 super.setAction(action);
+setModel(new DefaultButtonModel());
 init(null, null);
 if (action != null)
   {
@@ -148,6 +147,7 @@
   public JMenuItem(String text, Icon icon)
   {
 super();
+setModel(new DefaultButtonModel());
 init(text, icon);
   }
 
@@ -174,7 +174,6 @@
   protected void init(String text, Icon icon)
   {
 super.init(text, icon);
-setModel(new DefaultButtonModel());
 
 // Initializes properties for this menu item, that are different
 // from Abstract button properties. 
Index: javax/swing/JToggleButton.java
===
RCS file: /sources/classpath/classpath/javax/swing/JToggleButton.java,v
retrieving revision 1.28
diff -u -r1.28 JToggleButton.java
--- javax/swing/JToggleButton.java  10 Mar 2006 16:50:49 -  1.28
+++ javax/swing/JToggleButton.java  19 Sep 2006 14:07:08 -
@@ -1,5 +1,5 @@
 /* JToggleButton.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.
 
@@ -291,9 +291,8 @@
   public JToggleButton (String text, Icon icon, boolean selected) 
   {
 super();
+setModel(new ToggleButtonModel());  
 init(text, icon);
-
-setModel(new ToggleButtonModel()); 
 model.setSelected(selected);
 setAlignmentX(LEFT_ALIGNMENT);
   }


[cp-patches] FYI: JMenuBar.getHelpMenu()

2006-09-19 Thread David Gilbert
This patch (committed) makes the getHelpMenu() method in the JMenuBar class throw an 
error to match the reference implementation, and updates some API docs in a couple 
of other methods:


2006-09-19  David Gilbert  [EMAIL PROTECTED]

* javax/swing/JMenuBar.java
(getHelpMenu): Implemented to throw an Error, and added API docs,
(getMargin): Added API docs,
(setMargin): Likewise.

Regards,

Dave
Index: javax/swing/JMenuBar.java
===
RCS file: /sources/classpath/classpath/javax/swing/JMenuBar.java,v
retrieving revision 1.25
diff -u -r1.25 JMenuBar.java
--- javax/swing/JMenuBar.java   7 Jun 2006 20:29:41 -   1.25
+++ javax/swing/JMenuBar.java   19 Sep 2006 14:38:16 -
@@ -298,19 +298,25 @@
   }
 
   /**
-   * DOCUMENT ME!
+   * This method is not implemented and will throw an [EMAIL PROTECTED] Error} 
if called.
*
-   * @return DOCUMENT ME!
+   * @return This method never returns anything, it throws an exception.
*/
   public JMenu getHelpMenu()
   {
-return null;
+// the following error matches the behaviour of the reference 
+// implementation...
+throw new Error(getHelpMenu() is not implemented);
   }
 
   /**
-   * Returns margin betweeen menu bar's border and its menues
+   * Returns the margin between the menu bar's border and its menus.  If the
+   * margin is codenull/code, this method returns 
+   * codenew Insets(0, 0, 0, 0)/code.
*
-   * @return margin between menu bar's border and its menues
+   * @return The margin (never codenull/code).
+   * 
+   * @see #setMargin(Insets)
*/
   public Insets getMargin()
   {
@@ -617,21 +623,20 @@
   }
 
   /**
-   * Sets the menu bar's margin bound property,  which represents
-   * distance between the menubar's border and its menus.
-   * icon. When marging property is modified, PropertyChangeEvent will
-   * be fired to menuBar's PropertyChangeListener's.
-   *
-   * @param m distance between the menubar's border and its menus.
+   * Sets the margin between the menu bar's border and its menus (this is a
+   * bound property with the name 'margin').
*
+   * @param m  the margin (codenull/code permitted).
+   * 
+   * @see #getMargin()
*/
   public void setMargin(Insets m)
   {
 if (m != margin)
   {
-   Insets oldMargin = margin;
-   margin = m;
-   firePropertyChange(margin, oldMargin, margin);
+Insets oldMargin = margin;
+margin = m;
+firePropertyChange(margin, oldMargin, margin);
   }
   }
 


[commit-cp] classpath ChangeLog javax/swing/AbstractButton....

2006-09-19 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/19 14:26:43

Modified files:
.  : ChangeLog 
javax/swing: AbstractButton.java JButton.java JMenuItem.java 
 JToggleButton.java 

Log message:
2006-09-19  David Gilbert  [EMAIL PROTECTED]

* javax/swing/AbstractButton.java
(AbstractButton): Don't call updateUI(),
* javax/swing/JButton.java
(JButton(String, Icon)): Call setModel() before init(),
* javax/swing/JMenuItem.java
(JMenuItem()): Delegate to another constructor,
(JMenuItem(Icon)): Likewise,
(JMenuItem(Action)): Set model,
(JMenuItem(String, Icon)): Likewise,
* javax/swing/JToggleButton.java
(init): Call setModel() before init().

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8567r2=1.8568
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/AbstractButton.java?cvsroot=classpathr1=1.67r2=1.68
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/JButton.java?cvsroot=classpathr1=1.26r2=1.27
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/JMenuItem.java?cvsroot=classpathr1=1.33r2=1.34
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/JToggleButton.java?cvsroot=classpathr1=1.28r2=1.29




[commit-cp] classpath ChangeLog javax/swing/JMenuBar.java

2006-09-19 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/19 14:41:53

Modified files:
.  : ChangeLog 
javax/swing: JMenuBar.java 

Log message:
2006-09-19  David Gilbert  [EMAIL PROTECTED]

* javax/swing/JMenuBar.java
(getHelpMenu): Implemented to throw an Error, and added API 
docs,
(getMargin): Added API docs,
(setMargin): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8568r2=1.8569
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/JMenuBar.java?cvsroot=classpathr1=1.25r2=1.26




Re: [cp-patches] FYI: AttributedString constructor fix (for PR29010)

2006-09-14 Thread David Gilbert

Mark Wielaard wrote:

Hi David,

On Mon, 2006-09-11 at 11:57 +0100, David Gilbert wrote:
  
Mauve tests will be committed shortly.  I've assumed that the fix is small enough 
not to require FSF paperwork.



Yes, you are right. In general things smaller than 10/15 lines, or
obvious fixes (as in small or repetitive automatic changes) are just
OK. Cameron also already contacted me for paperwork so expect some more
things from him soon :)
  


Excellent!


I saw you couldn't close the bug on your own. Fixed that also in
bugzilla. Please try out your new powers by closing this bug. 
  

Done.  Thanks!

Regards,

Dave



[cp-patches] FYI: java.awt.Menu.java - source reformatted

2006-09-14 Thread David Gilbert

This patch (committed) reformats the source file to match our coding style more 
closely:

2006-09-14  David Gilbert  [EMAIL PROTECTED]

* java/awt/Menu.java: Reformatted source file.

Regards,

Dave
Index: java/awt/Menu.java
===
RCS file: /sources/classpath/classpath/java/awt/Menu.java,v
retrieving revision 1.24
diff -u -r1.24 Menu.java
--- java/awt/Menu.java  13 Jul 2006 17:30:24 -  1.24
+++ java/awt/Menu.java  14 Sep 2006 09:56:41 -
@@ -54,38 +54,28 @@
 public class Menu extends MenuItem implements MenuContainer, Serializable
 {
 
-/*
- * Static Variables
- */
-
-/**
- * The number used to generate the name returned by getName.
- */
-private static transient long next_menu_number;
-
-// Serialization Constant
-private static final long serialVersionUID = -8809584163345499784L;
-
-/*/
-
-/*
- * Instance Variables
- */
-
-/**
-  * @serial The actual items in the menu
-  */
-private Vector items = new Vector();
-
-/**
-  * @serial Flag indicating whether or not this menu is a tear off
-  */
-private boolean tearOff;
-
-/**
-  * @serial Indicates whether or not this is a help menu.
-  */
-private boolean isHelpMenu;
+  /**
+   * The number used to generate the name returned by getName.
+   */
+  private static transient long next_menu_number;
+
+  // Serialization Constant
+  private static final long serialVersionUID = -8809584163345499784L;
+
+  /**
+* @serial The actual items in the menu
+*/
+  private Vector items = new Vector();
+
+  /**
+   * @serial Flag indicating whether or not this menu is a tear off
+   */
+  private boolean tearOff;
+
+  /**
+   * @serial Indicates whether or not this is a help menu.
+   */
+  private boolean isHelpMenu;
 
   /*
* @serial Unused in this implementation, but present in Sun's
@@ -93,371 +83,311 @@
*/
   private int menuSerializedDataVersion = 1;
 
-static final transient String separatorLabel = -;
+  static final transient String separatorLabel = -;
+
+  /**
+   * Initializes a new instance of codeMenu/code with no label and that
+   * is not a tearoff;
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+   */
+  public Menu()
+  {
+  }
+
+  /**
+   * Initializes a new instance of codeMenu/code that is not a tearoff and
+   * that has the specified label.
+   *
+   * @param label The menu label.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+   */
+  public Menu(String label)
+  {
+this(label, false);
+  }
+
+  /**
+   * Initializes a new instance of codeMenu/code with the specified
+   * label and tearoff status.
+   *
+   * @param label The label for this menu
+   * @param isTearOff codetrue/code if this menu is a tear off menu,
+   * codefalse/code otherwise.
+   *
+   * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
+   */
+  public Menu(String label, boolean isTearOff)
+  {
+super(label);
+
+tearOff = isTearOff;
 
-/*/
+if (label.equals(Help))
+  isHelpMenu = true;
 
-/*
- * Constructors
- */
-
-/**
-  * Initializes a new instance of codeMenu/code with no label and that
-  * is not a tearoff;
-  *
-  * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
-  */
-public
-Menu()
-{
-}
-
-/*/
-
-/**
-  * Initializes a new instance of codeMenu/code that is not a tearoff and
-  * that has the specified label.
-  *
-  * @param label The menu label.
-  *
-  * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
-  */
-public
-Menu(String label)
-{
-  this(label, false);
-}
-
-/*/
-
-/**
-  * Initializes a new instance of codeMenu/code with the specified
-  * label and tearoff status.
-  *
-  * @param label The label for this menu
-  * @param isTearOff codetrue/code if this menu is a tear off menu,
-  * codefalse/code otherwise.
-  *
-  * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
-  */
-public
-Menu(String label, boolean isTearOff)
-{
-  super(label);
-
-  tearOff = isTearOff;
-
-  if (label.equals(Help))
-isHelpMenu = true;
-
-  if (GraphicsEnvironment.isHeadless())
-throw new HeadlessException ();
-}
-
-/*/
-
-/*
- * Instance Methods
- */
-
-/**
-  * Tests whether or not this menu is a tearoff.
-  *
-  * @return codetrue/code if this menu is a tearoff, codefalse/code
-  * otherwise.
-  */
-public boolean
-isTearOff()
-{
-  return(tearOff);
-}
-
-/*/
-
-/**
-  * Returns the number of items in this menu.
-  *
-  * @return The number of items

[cp-patches] FYI: java.awt.Menu - fix for PR28699

2006-09-14 Thread David Gilbert
This patch (committed) fixes a bug (PR28699) in the insert() method of the 
java.awt.Menu class:


2006-09-14  David Gilbert  [EMAIL PROTECTED]

Fixes PR28699
* java/awt/Menu.java
(insert(MenuItem, int)): Fixed loop range,
(insert(String, int)): Updated API docs.

Regards,

Dave
Index: java/awt/Menu.java
===
RCS file: /sources/classpath/classpath/java/awt/Menu.java,v
retrieving revision 1.25
diff -u -r1.25 Menu.java
--- java/awt/Menu.java  14 Sep 2006 10:02:11 -  1.25
+++ java/awt/Menu.java  14 Sep 2006 10:25:13 -
@@ -216,13 +216,15 @@
   }
 
   /**
-   * Inserts the specified menu item into this menu at the specified index.
+   * Inserts the specified menu item into this menu at the specified index.  If
+   * the index is greater than or equal to the number of items already in the
+   * menu, the new item is added as the last item in the menu.
*
-   * @param item The menu item to add.
-   * @param index The index of the menu item.
+   * @param item The menu item to add (codenull/code not permitted).
+   * @param index The index of the menu item (= 0).
*
-   * @exception IllegalArgumentException If the index is less than zero.
-   * @exception ArrayIndexOutOfBoundsException If the index is otherwise 
invalid.
+   * @throws IllegalArgumentException if the index is less than zero.
+   * @throws NullPointerException if codeitem/code is codenull/code.
*/
   public void insert(MenuItem item, int index)
   {
@@ -252,20 +254,23 @@
 item.addNotify();
 peer.addItem(item);
 
-for (int i = index; i  count; i++)
+// bear in mind that count is the number of items *before* the new
+// item was added
+for (int i = index + 1; i = count; i++)
   peer.addItem((MenuItem) items.elementAt(i));
   }
 
   }
 
   /**
-   * Inserts an item with the specified label into this menu at the specified 
index.
+   * Inserts an item with the specified label into this menu at the specified 
+   * index.  If the index is greater than or equal to the number of items 
+   * already in the menu, the new item is added as the last item in the menu.
*
* @param label The label of the item to add.
-   * @param index The index of the menu item.
+   * @param index The index of the menu item (= 0).
*
-   * @exception IllegalArgumentException If the index is less than zero.
-   * @exception ArrayIndexOutOfBoundsException If the index is otherwise 
invalid.
+   * @throws IllegalArgumentException If the index is less than zero.
*/
   public void insert(String label, int index)
   {


[commit-cp] classpath ChangeLog java/awt/Menu.java

2006-09-14 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/14 10:35:49

Modified files:
.  : ChangeLog 
java/awt   : Menu.java 

Log message:
2006-09-14  David Gilbert  [EMAIL PROTECTED]

Fixes PR28699
* java/awt/Menu.java
(insert(MenuItem, int)): Fixed loop range,
(insert(String, int)): Updated API docs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8542r2=1.8543
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Menu.java?cvsroot=classpathr1=1.25r2=1.26




[cp-patches] FYI: AbstractButton fix

2006-09-12 Thread David Gilbert
This patch (committed) sets the default value for the textIconGap field, which makes 
things look better:


2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/AbstractButton.java
(AbstractButton): Initialise textIconGap field.

I have some Mauve tests to cover this.

Regards,

Dave
Index: javax/swing/AbstractButton.java
===
RCS file: /sources/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.66
diff -u -r1.66 AbstractButton.java
--- javax/swing/AbstractButton.java 22 Aug 2006 11:23:56 -  1.66
+++ javax/swing/AbstractButton.java 12 Sep 2006 08:43:20 -
@@ -904,6 +904,10 @@
 setDisplayedMnemonicIndex(-1);
 setOpaque(true);
 text = ;
+// testing on JRE1.5 shows that the iconTextGap default value is 
+// hard-coded here and the 'Button.iconTextGap' setting in the 
+// UI defaults is ignored, at least by the MetalLookAndFeel
+iconTextGap = 4;
 updateUI();
   }
 


[cp-patches] FYI: AbstractSpinnerModel - minor API doc updates

2006-09-12 Thread David Gilbert

This patch (committed) updates some of the API docs in the AbstractSpinnerModel 
class:

2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/AbstractSpinnerModel.java: API doc updates.

Regards,

Dave
Index: javax/swing/AbstractSpinnerModel.java
===
RCS file: /sources/classpath/classpath/javax/swing/AbstractSpinnerModel.java,v
retrieving revision 1.6
diff -u -r1.6 AbstractSpinnerModel.java
--- javax/swing/AbstractSpinnerModel.java   1 Jul 2006 21:33:16 -   
1.6
+++ javax/swing/AbstractSpinnerModel.java   12 Sep 2006 09:13:11 -
@@ -1,5 +1,5 @@
 /* AbstractSpinnerModel.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -47,6 +47,8 @@
 /**
  * Provides standard implementations for some of the methods in
  * [EMAIL PROTECTED] SpinnerModel}.
+ * 
+ * @since 1.4
  *
  * @author Ka-Hing Cheung
  */
@@ -54,6 +56,7 @@
 {
   private ChangeEvent changeEvent = new ChangeEvent(this);
   
+  /** Stores the listeners registered with the model. */
   protected EventListenerList listenerList = new EventListenerList();
 
   /**
@@ -65,9 +68,10 @@
   }
 
   /**
-   * Adds a codeChangeListener/code.
+   * Registers a codeChangeListener/code with the model so that it will
+   * receive [EMAIL PROTECTED] ChangeEvent} notifications when the model 
changes.
*
-   * @param listener the listener to add
+   * @param listener the listener to add (codenull/code is ignored).
*/
   public void addChangeListener(ChangeListener listener)
   {


[cp-patches] FYI: MetalIconFactory.java - fix icon colors

2006-09-12 Thread David Gilbert

This patch (committed) makes the InternalFrameDefaultMenuIcon use the theme 
colors:

2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalIconFactory.java
(InternalFrameDefaultMenuIcon.paintIcon): Use theme colors.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalIconFactory.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalIconFactory.java,v
retrieving revision 1.28
diff -u -r1.28 MetalIconFactory.java
--- javax/swing/plaf/metal/MetalIconFactory.java7 Jul 2006 11:29:56 
-   1.28
+++ javax/swing/plaf/metal/MetalIconFactory.java12 Sep 2006 09:45:41 
-
@@ -1268,23 +1268,23 @@
  */
 public void paintIcon(Component c, Graphics g, int x, int y) 
 {
-  g.setColor(new Color(102, 102, 153));
+  g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
   g.fillRect(x + 1, y, 14, 2);
   g.fillRect(x, y + 1, 2, 14);
   g.fillRect(x + 1, y + 14, 14, 2);
   g.fillRect(x + 14, y + 1, 2, 14);
   g.drawLine(x + 2, y + 5, x + 14, y + 5);
   
-  g.setColor(new Color(204, 204, 255));
+  g.setColor(MetalLookAndFeel.getPrimaryControl());
   g.fillRect(x + 2, y + 2, 12, 3);
   
-  g.setColor(new Color(102, 102, 153));
+  g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
   g.drawLine(x + 3, y + 3, x + 3, y + 3);
   g.drawLine(x + 6, y + 3, x + 6, y + 3);
   g.drawLine(x + 9, y + 3, x + 9, y + 3);
   g.drawLine(x + 12, y + 3, x + 12, y + 3);
 
-  g.setColor(Color.white);
+  g.setColor(MetalLookAndFeel.getWhite());
   g.fillRect(x + 2, y + 6, 12, 8);
   g.drawLine(x + 2, y + 2, x + 2, y + 2);
   g.drawLine(x + 5, y + 2, x + 5, y + 2);


[cp-patches] FYI: OceanTheme.addCustomEntriesToTable() - added entry

2006-09-12 Thread David Gilbert

This patch (committed) adds a new entry to the defaults table:

2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/OceanTheme.java
(addCustomEntriesToTable): Added 'List.focusCellHighlightBorder' entry.

I'll commit a Mauve test for this shortly.

Regards,

Dave
Index: javax/swing/plaf/metal/OceanTheme.java
===
RCS file: /sources/classpath/classpath/javax/swing/plaf/metal/OceanTheme.java,v
retrieving revision 1.9
diff -u -r1.9 OceanTheme.java
--- javax/swing/plaf/metal/OceanTheme.java  4 May 2006 12:11:50 -   
1.9
+++ javax/swing/plaf/metal/OceanTheme.java  12 Sep 2006 10:51:46 -
@@ -266,6 +266,8 @@
 defaults.put(Tree.selectionBorderColor, PRIMARY1);
 
 // Borders.
+defaults.put(List.focusCellHighlightBorder,
+ new LineBorderUIResource(getPrimary1()));
 defaults.put(Table.focusCellHighlightBorder,
  new LineBorderUIResource(getPrimary1()));
 


[cp-patches] FYI: DefaultMetalTheme.getControl/MenuTextFont() update

2006-09-12 Thread David Gilbert
This patch (committed) updates two font methods to observe the setting of the 
'swing.boldMetal' UI default value:


2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/DefaultMetalTheme.java
(CONTROL_TEXT_FONT): Renamed 'controlTextFont',
(MENU_TEXT_FONT): Renamed 'menuTextFont',
(getControlTextFont): Check 'swing.boldMetal' setting before
initialising font,
(getMenuTextFont): Likewise.

Mauve tests covering this have already been committed.

Regards,

Dave
Index: javax/swing/plaf/metal/DefaultMetalTheme.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/DefaultMetalTheme.java,v
retrieving revision 1.4
diff -u -r1.4 DefaultMetalTheme.java
--- javax/swing/plaf/metal/DefaultMetalTheme.java   13 Jul 2005 11:56:02 
-  1.4
+++ javax/swing/plaf/metal/DefaultMetalTheme.java   12 Sep 2006 14:24:12 
-
@@ -40,6 +40,7 @@
 
 import java.awt.Font;
 
+import javax.swing.UIManager;
 import javax.swing.plaf.ColorUIResource;
 import javax.swing.plaf.FontUIResource;
 
@@ -63,10 +64,6 @@
   private static final ColorUIResource SECONDARY3 = 
 new ColorUIResource(204, 204, 204);
   
-  private static final FontUIResource CONTROL_TEXT_FONT =
-new FontUIResource(Dialog, Font.BOLD, 12);
-  private static final FontUIResource MENU_TEXT_FONT =
-new FontUIResource(Dialog, Font.BOLD, 12);
   private static final FontUIResource SUB_TEXT_FONT =
 new FontUIResource(Dialog, Font.PLAIN, 10);
   private static final FontUIResource SYSTEM_TEXT_FONT =
@@ -76,6 +73,12 @@
   private static final FontUIResource WINDOW_TITLE_FONT =
 new FontUIResource(Dialog, Font.BOLD, 12);
   
+  /** The control text font. */
+  private FontUIResource controlTextFont;
+
+  /** The menu text font. */
+  private FontUIResource menuTextFont;
+  
   /**
* Creates a new instance of this theme.
*/
@@ -156,23 +159,42 @@
 
   /**
* Returns the font used for text on controls.  In this case, the font is
-   * codeFontUIResource(Dialog, Font.BOLD, 12)/code.
+   * codeFontUIResource(Dialog, Font.BOLD, 12)/code, unless the
+   * codeswing.boldMetal/code UI default is set to [EMAIL PROTECTED] 
Boolean#FALSE} 
+   * in which case it is codeFontUIResource(Dialog, Font.PLAIN, 12)/code.
* 
* @return The font.
*/
   public FontUIResource getControlTextFont()
   {
-return CONTROL_TEXT_FONT;
+if (controlTextFont == null)
+  {
+if (Boolean.FALSE.equals(UIManager.get(swing.boldMetal)))
+  controlTextFont = new FontUIResource(Dialog, Font.PLAIN, 12);
+else
+  controlTextFont = new FontUIResource(Dialog, Font.BOLD, 12);
+  }
+return controlTextFont;
   }
+  
   /**
* Returns the font used for text in menus.  In this case, the font is
-   * codeFontUIResource(Dialog, Font.BOLD, 12)/code.
+   * codeFontUIResource(Dialog, Font.BOLD, 12)/code, unless the
+   * codeswing.boldMetal/code UI default is set to [EMAIL PROTECTED] 
Boolean#FALSE} 
+   * in which case it is codeFontUIResource(Dialog, Font.PLAIN, 12)/code.
* 
* @return The font used for text in menus.
*/
   public FontUIResource getMenuTextFont()
   {
-return MENU_TEXT_FONT;
+if (menuTextFont == null)
+  {
+if (Boolean.FALSE.equals(UIManager.get(swing.boldMetal)))
+  menuTextFont = new FontUIResource(Dialog, Font.PLAIN, 12);
+else
+  menuTextFont = new FontUIResource(Dialog, Font.BOLD, 12);
+  }
+return menuTextFont;
   }
   
   /**


[commit-cp] classpath ChangeLog javax/swing/AbstractButton....

2006-09-12 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/12 09:02:05

Modified files:
.  : ChangeLog 
javax/swing: AbstractButton.java 

Log message:
2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/AbstractButton.java
(AbstractButton): Initialise textIconGap field.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8527r2=1.8528
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/AbstractButton.java?cvsroot=classpathr1=1.66r2=1.67




[commit-cp] classpath ChangeLog javax/swing/AbstractSpinner...

2006-09-12 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/12 09:15:48

Modified files:
.  : ChangeLog 
javax/swing: AbstractSpinnerModel.java 

Log message:
2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/AbstractSpinnerModel.java: API doc updates.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8528r2=1.8529
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/AbstractSpinnerModel.java?cvsroot=classpathr1=1.6r2=1.7




[commit-cp] classpath ChangeLog javax/swing/plaf/metal/Meta...

2006-09-12 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/12 09:48:43

Modified files:
.  : ChangeLog 
javax/swing/plaf/metal: MetalIconFactory.java 

Log message:
2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalIconFactory.java
(InternalFrameDefaultMenuIcon.paintIcon): Use theme colors.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8529r2=1.8530
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/metal/MetalIconFactory.java?cvsroot=classpathr1=1.28r2=1.29




[commit-cp] classpath ChangeLog javax/swing/plaf/metal/Ocea...

2006-09-12 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/12 10:54:47

Modified files:
.  : ChangeLog 
javax/swing/plaf/metal: OceanTheme.java 

Log message:
2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/OceanTheme.java
(addCustomEntriesToTable): Added 
'List.focusCellHighlightBorder' entry.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8530r2=1.8531
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/metal/OceanTheme.java?cvsroot=classpathr1=1.9r2=1.10




[commit-cp] classpath ChangeLog javax/swing/plaf/metal/Defa...

2006-09-12 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/12 14:30:53

Modified files:
.  : ChangeLog 
javax/swing/plaf/metal: DefaultMetalTheme.java 

Log message:
2006-09-12  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/DefaultMetalTheme.java
(CONTROL_TEXT_FONT): Renamed 'controlTextFont',
(MENU_TEXT_FONT): Renamed 'menuTextFont',
(getControlTextFont): Check 'swing.boldMetal' setting before 
initialising font,
(getMenuTextFont): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8531r2=1.8532
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/metal/DefaultMetalTheme.java?cvsroot=classpathr1=1.4r2=1.5




[commit-cp] classpath ChangeLog gnu/java/awt/peer/gtk/Cairo...

2006-09-12 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/12 22:08:12

Modified files:
.  : ChangeLog 
gnu/java/awt/peer/gtk: CairoGraphics2D.java 

Log message:
2006-09-12  David Gilbert  [EMAIL PROTECTED]

* gnu/java/awt/peer/gtk/CairoGraphics2D.java
(setPaint): Check null argument ('p').

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8534r2=1.8535
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java?cvsroot=classpathr1=1.38r2=1.39




[cp-patches] FYI: AttributedString constructor fix (for PR29010)

2006-09-11 Thread David Gilbert

I committed this patch attached to PR29010, after testing it:

2006-09-11  Cameron McCormack  [EMAIL PROTECTED]

Fixes PR29010
* java/text/AttributedString.java
(AttributedString(AttributedCharacterIterator, int, int,
AttributedCharacterIterator.Attribute[])): Fixed check for defined
attribute.

Mauve tests will be committed shortly.  I've assumed that the fix is small enough 
not to require FSF paperwork.


Regards,

Dave
Index: source/org/jfree/data/statistics/HistogramDataset.java
===
RCS file: 
/cvsroot/jfreechart/jfreechart/source/org/jfree/data/statistics/HistogramDataset.java,v
retrieving revision 1.9.2.6
diff -u -r1.9.2.6 HistogramDataset.java
--- source/org/jfree/data/statistics/HistogramDataset.java  3 Aug 2006 
10:37:53 -   1.9.2.6
+++ source/org/jfree/data/statistics/HistogramDataset.java  7 Sep 2006 
15:23:55 -
@@ -53,6 +53,7 @@
  * 22-Nov-2005 : Fixed cast in getSeriesKey() method - see patch 1329287 (DG);
  * - JFREECHART 1.0.0 -
  * 03-Aug-2006 : Improved precision of bin boundary calculation (DG);
+ * 07-Sep-2006 : Fixed bug 1553088 (DG);
  * 
  */
 
@@ -192,6 +193,12 @@
 fraction = 0.0;
 }
 binIndex = (int) (fraction * bins);
+// rounding could result in binIndex being equal to bins
+// which will cause an IndexOutOfBoundsException - see bug
+// report 1553088
+if (binIndex = bins) {
+binIndex = bins - 1;
+}
 }
 HistogramBin bin = (HistogramBin) binList.get(binIndex);
 bin.incrementCount();
Index: source/org/jfree/data/statistics/junit/HistogramDatasetTests.java
===
RCS file: 
/cvsroot/jfreechart/jfreechart/source/org/jfree/data/statistics/junit/HistogramDatasetTests.java,v
retrieving revision 1.4.2.3
diff -u -r1.4.2.3 HistogramDatasetTests.java
--- source/org/jfree/data/statistics/junit/HistogramDatasetTests.java   3 Aug 
2006 10:37:54 -   1.4.2.3
+++ source/org/jfree/data/statistics/junit/HistogramDatasetTests.java   7 Sep 
2006 15:23:55 -
@@ -202,4 +202,21 @@
 assertTrue(values[0]  d.getEndXValue(0, 630));
 }
 
+/**
+ * Some checks for bug 1553088.  An IndexOutOfBoundsException is thrown 
+ * when a data value is *very* close to the upper limit of the last bin.
+ */
+public void test1553088() {
+double[] values = {-1.0, 0.0, -Double.MIN_VALUE, 3.0};
+HistogramDataset d = new HistogramDataset();
+d.addSeries(S1, values, 2, -1.0, 0.0);
+assertEquals(-1.0, d.getStartXValue(0, 0), EPSILON);
+assertEquals(-0.5, d.getEndXValue(0, 0), EPSILON);
+assertEquals(1.0, d.getYValue(0, 0), EPSILON);
+
+assertEquals(-0.5, d.getStartXValue(0, 1), EPSILON);
+assertEquals(0.0, d.getEndXValue(0, 1), EPSILON);
+assertEquals(3.0, d.getYValue(0, 1), EPSILON);
+}
+
 }
\ No newline at end of file


Re: [cp-patches] FYI: AttributedString constructor fix (for PR29010)

2006-09-11 Thread David Gilbert

David Gilbert wrote:

I committed this patch attached to PR29010, after testing it:

2006-09-11  Cameron McCormack  [EMAIL PROTECTED]

Fixes PR29010
* java/text/AttributedString.java
(AttributedString(AttributedCharacterIterator, int, int,
AttributedCharacterIterator.Attribute[])): Fixed check for defined
attribute.

Mauve tests will be committed shortly.  I've assumed that the fix is 
small enough not to require FSF paperwork.


Regards,

Dave


Sorry, I attached the wrong patch file!

Regards,

Dave

Index: java/text/AttributedString.java
===
RCS file: /sources/classpath/classpath/java/text/AttributedString.java,v
retrieving revision 1.16
diff -u -r1.16 AttributedString.java
--- java/text/AttributedString.java 18 Jun 2006 00:54:47 -  1.16
+++ java/text/AttributedString.java 11 Sep 2006 10:25:51 -
@@ -1,5 +1,5 @@
 /* AttributedString.java -- Models text with attributes
-   Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2004, 2005, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -206,9 +206,10 @@
   (AttributedCharacterIterator.Attribute)obj;
 
 // Make sure the attribute is defined.
-int rl = aci.getRunLimit(attrib);
-if (rl == -1)
+Object attrib_obj = aci.getAttribute(attrib);
+if (attrib_obj == null)
   continue;
+int rl = aci.getRunLimit(attrib);
 if (rl  end)
   rl = end;
 rl -= begin;
@@ -220,8 +221,7 @@
 
 // If the attribute run starts before the beginning index, we
 // need to junk it if it is an Annotation.
-Object attrib_obj = aci.getAttribute(attrib);
-   rs -= begin;
+rs -= begin;
 if (rs  0)
   {
 if (attrib_obj instanceof Annotation)


[cp-patches] FYI: AttributedCharacterIterator/AttributedString - style updates

2006-09-11 Thread David Gilbert
This patch (committed) adds @since tags and reformats the source files to match our 
coding style a little better:


2006-09-11  David Gilbert  [EMAIL PROTECTED]

* java/text/AttributedCharacterIterator.java: Added @since tag,
renamed some variables (no underscores) and removed some spaces to
match the common style,
* java/text/AttributedString.java: Likewise,
* java/text/AttributedStringIterator.java: Likewise.

Regards,

Dave
Index: java/text/AttributedCharacterIterator.java
===
RCS file: 
/sources/classpath/classpath/java/text/AttributedCharacterIterator.java,v
retrieving revision 1.14
diff -u -r1.14 AttributedCharacterIterator.java
--- java/text/AttributedCharacterIterator.java  11 Mar 2006 12:32:02 -  
1.14
+++ java/text/AttributedCharacterIterator.java  11 Sep 2006 13:04:06 -
@@ -1,5 +1,5 @@
 /* AttributedCharacterIterator.java -- Iterate over attributes
-   Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2004, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -53,6 +53,8 @@
  * that is defined for a particular value across an entire range of
  * characters or which is undefined over a range of characters.
  *
+ * @since 1.2
+ * 
  * @author Aaron M. Renn ([EMAIL PROTECTED])
  */
 public interface AttributedCharacterIterator extends CharacterIterator
@@ -68,7 +70,7 @@
  * This is the attribute for the language of the text.  The value of
  * attributes of this key type are instances of codeLocale/code.
  */
-public static final Attribute LANGUAGE = new Attribute (LANGUAGE);
+public static final Attribute LANGUAGE = new Attribute(LANGUAGE);
 
 /**
  * This is the attribute for the reading form of text.  This is used
@@ -77,7 +79,7 @@
  * instances of codeAnnotation/code which wrappers a 
  * codeString/code.
  */
-public static final Attribute READING = new Attribute (READING);
+public static final Attribute READING = new Attribute(READING);
 
 /**
  * This is the attribute for input method segments.  The value of 
attributes
@@ -85,7 +87,7 @@
  * a codeString/code.
  */
 public static final Attribute INPUT_METHOD_SEGMENT =
-  new Attribute (INPUT_METHOD_SEGMENT);
+  new Attribute(INPUT_METHOD_SEGMENT);
 
 /**
  * The name of the attribute key
@@ -98,7 +100,7 @@
  *
  * @param name The name of this attribute key.
  */
-protected Attribute (String name)
+protected Attribute(String name)
 {
   this.name = name;
 }
@@ -156,7 +158,7 @@
  * @return codetrue/code if the specified object is equal to this one, 
  * codefalse/code otherwise.
  */
-public final boolean equals (Object obj)
+public final boolean equals(Object obj)
 {
   if (obj == this)
 return true;
@@ -211,7 +213,7 @@
*
* @return The value of the specified attribute
*/
-  Object getAttribute (AttributedCharacterIterator.Attribute attrib);
+  Object getAttribute(AttributedCharacterIterator.Attribute attrib);
 
   /**
* Returns the index of the first character in the run that
@@ -230,7 +232,7 @@
*
* @return The start index of the run.
*/
-  int getRunStart (Set attribs);
+  int getRunStart(Set attribs);
   
   /**
* Returns the index of the first character in the run that
@@ -240,7 +242,7 @@
*
* @return The start index of the run.
*/
-  int getRunStart (AttributedCharacterIterator.Attribute attrib);
+  int getRunStart(AttributedCharacterIterator.Attribute attrib);
   
   /**
* Returns the index of the character after the end of the run
@@ -259,7 +261,7 @@
*
* @return The end index of the run.
*/
-  int getRunLimit (Set attribs);
+  int getRunLimit(Set attribs);
   
   /**
* Returns the index of the character after the end of the run
@@ -269,6 +271,6 @@
* 
* @return The end index of the run.
*/
-  int getRunLimit (AttributedCharacterIterator.Attribute attrib);
+  int getRunLimit(AttributedCharacterIterator.Attribute attrib);
 
 } // interface AttributedCharacterIterator
Index: java/text/AttributedString.java
===
RCS file: /sources/classpath/classpath/java/text/AttributedString.java,v
retrieving revision 1.17
diff -u -r1.17 AttributedString.java
--- java/text/AttributedString.java 11 Sep 2006 10:45:02 -  1.17
+++ java/text/AttributedString.java 11 Sep 2006 13:04:07 -
@@ -50,6 +50,8 @@
  * This class models a codeString/code with attributes over various
  * subranges of the string.  It allows applications to access this 
  * information via the codeAttributedCharacterIterator/code interface.
+ * 
+ * @since 1.2
  *
  * @author Aaron M. Renn ([EMAIL PROTECTED])
  */
@@ -66,23 +68,23 @@
 Map attribs;
 
 /** The beginning index

[cp-patches] FYI: AttributedCharacterIterator/AttributedStringIterator fixes

2006-09-11 Thread David Gilbert

This patch (committed) fixes a couple more problems in attributed text classes:

2006-09-11  David Gilbert  [EMAIL PROTECTED]

* java/text/AttributedCharacterIterator.java
(LANGUAGE): Initialise with lower case string,
(INPUT_METHOD_SEGMENT): Likewise,
(READING): Likewise,
* java/text/AttributedStringIterator.java
(getRunLimit): Check all attributes for changes.

I'll commit the relevant Mauve tests shortly.

Regards,

Dave
Index: java/text/AttributedCharacterIterator.java
===
RCS file: 
/sources/classpath/classpath/java/text/AttributedCharacterIterator.java,v
retrieving revision 1.15
diff -u -r1.15 AttributedCharacterIterator.java
--- java/text/AttributedCharacterIterator.java  11 Sep 2006 13:08:03 -  
1.15
+++ java/text/AttributedCharacterIterator.java  11 Sep 2006 13:54:19 -
@@ -70,7 +70,7 @@
  * This is the attribute for the language of the text.  The value of
  * attributes of this key type are instances of codeLocale/code.
  */
-public static final Attribute LANGUAGE = new Attribute(LANGUAGE);
+public static final Attribute LANGUAGE = new Attribute(language);
 
 /**
  * This is the attribute for the reading form of text.  This is used
@@ -79,7 +79,7 @@
  * instances of codeAnnotation/code which wrappers a 
  * codeString/code.
  */
-public static final Attribute READING = new Attribute(READING);
+public static final Attribute READING = new Attribute(reading);
 
 /**
  * This is the attribute for input method segments.  The value of 
attributes
@@ -87,7 +87,7 @@
  * a codeString/code.
  */
 public static final Attribute INPUT_METHOD_SEGMENT =
-  new Attribute(INPUT_METHOD_SEGMENT);
+  new Attribute(input_method_segment);
 
 /**
  * The name of the attribute key
Index: java/text/AttributedStringIterator.java
===
RCS file: /sources/classpath/classpath/java/text/AttributedStringIterator.java,v
retrieving revision 1.13
diff -u -r1.13 AttributedStringIterator.java
--- java/text/AttributedStringIterator.java 11 Sep 2006 13:08:03 -  
1.13
+++ java/text/AttributedStringIterator.java 11 Sep 2006 13:54:20 -
@@ -187,7 +187,7 @@
 
   public int getRunLimit()
   {
-return(getRunLimit(getAttributes().keySet()));
+return getRunLimit(getAllAttributeKeys());
   }
 
   public int getRunLimit(AttributedCharacterIterator.Attribute attrib)


[commit-cp] classpath ChangeLog java/text/AttributedCharact...

2006-09-11 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/11 13:56:09

Modified files:
.  : ChangeLog 
java/text  : AttributedCharacterIterator.java 
 AttributedStringIterator.java 

Log message:
2006-09-11  David Gilbert  [EMAIL PROTECTED]

* java/text/AttributedCharacterIterator.java
(LANGUAGE): Initialise with lower case string,
(INPUT_METHOD_SEGMENT): Likewise,
(READING): Likewise,
* java/text/AttributedStringIterator.java
(getRunLimit): Check all attributes for changes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8525r2=1.8526
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/AttributedCharacterIterator.java?cvsroot=classpathr1=1.15r2=1.16
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/AttributedStringIterator.java?cvsroot=classpathr1=1.13r2=1.14




[commit-cp] classpath ChangeLog java/text/AttributedString....

2006-09-11 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/11 10:45:02

Modified files:
.  : ChangeLog 
java/text  : AttributedString.java 

Log message:
2006-09-11  Cameron McCormack  [EMAIL PROTECTED]

Fixes PR29010
* java/text/AttributedString.java
(AttributedString(AttributedCharacterIterator, int, int, 
AttributedCharacterIterator.Attribute[])): Fixed check for 
defined 
attribute.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8522r2=1.8523
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/AttributedString.java?cvsroot=classpathr1=1.16r2=1.17




[commit-cp] classpath ChangeLog java/text/AttributedCharact...

2006-09-11 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/11 13:08:04

Modified files:
.  : ChangeLog 
java/text  : AttributedCharacterIterator.java 
 AttributedString.java 
 AttributedStringIterator.java 

Log message:
2006-09-11  David Gilbert  [EMAIL PROTECTED]

* java/text/AttributedCharacterIterator.java: Added @since tag, 
renamed some variables (no underscores) and removed some spaces 
to
match the common style,
* java/text/AttributedString.java: Likewise,
* java/text/AttributedStringIterator.java: Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8524r2=1.8525
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/AttributedCharacterIterator.java?cvsroot=classpathr1=1.14r2=1.15
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/AttributedString.java?cvsroot=classpathr1=1.17r2=1.18
http://cvs.savannah.gnu.org/viewcvs/classpath/java/text/AttributedStringIterator.java?cvsroot=classpathr1=1.12r2=1.13




[cp-patches] FYI: MemoryImageSource.java - API docs

2006-09-07 Thread David Gilbert

I added some API docs to MemoryImageSource.java some time ago - now committed 
to CVS:

2006-09-07  David Gilbert  [EMAIL PROTECTED]

* java/awt/image/MemoryImageSource.java: Added API docs.

Regards,

Dave
Index: java/awt/image/MemoryImageSource.java
===
RCS file: /sources/classpath/classpath/java/awt/image/MemoryImageSource.java,v
retrieving revision 1.14
diff -u -r1.14 MemoryImageSource.java
--- java/awt/image/MemoryImageSource.java   16 Nov 2005 18:46:05 -  
1.14
+++ java/awt/image/MemoryImageSource.java   7 Sep 2006 08:18:48 -
@@ -1,5 +1,5 @@
 /* MemoryImageSource.java -- Java class for providing image data
-   Copyright (C) 1999, 2004  Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +41,9 @@
 import java.util.Hashtable;
 import java.util.Vector;
 
+/**
+ * An image producer that delivers image data from an array.
+ */
 public class MemoryImageSource implements ImageProducer
 {
   private boolean animated = false;
@@ -73,7 +76,16 @@
   }
 
   /**
-   * Constructs an ImageProducer from memory
+   * Constructs an ImageProducer from memory.
+   * 
+   * @param w  the image width.
+   * @param h  the image height.
+   * @param cm  the color model.
+   * @param pix  the image data.
+   * @param off  the offset to the first pixel in the array.
+   * @param scan  the number of array elements from a pixel on one row to the
+   * corresponding pixel on the next row.
+   * @param props  image properties (codenull/code permitted). 
*/
   public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
int scan, Hashtable props)
@@ -106,8 +118,17 @@
   }
 
   /**
- Constructs an ImageProducer from memory
-  */
+   * Constructs an ImageProducer from memory
+   * 
+   * @param w  the image width.
+   * @param h  the image height.
+   * @param cm  the color model.
+   * @param pix  the image data.
+   * @param off  the offset to the first pixel in the array.
+   * @param scan  the number of array elements from a pixel on one row to the
+   * corresponding pixel on the next row.
+   * @param props  image properties (codenull/code permitted). 
+   */
   public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
int scan, Hashtable props)
   {
@@ -122,7 +143,16 @@
   }
 
   /**
-   * Constructs an ImageProducer from memory using the default RGB ColorModel
+   * Constructs an ImageProducer from memory using the default RGB ColorModel.
+   * 
+   * @param w  the image width.
+   * @param h  the image height.
+   * @param pix  the image data.
+   * @param off  the offset to the first pixel in the array.
+   * @param scan  the number of array elements from a pixel on one row to the
+   * corresponding pixel on the next row.
+   * @param props  image properties (codenull/code permitted). 
+
*/
   public MemoryImageSource(int w, int h, int[] pix, int off, int scan,
Hashtable props)
@@ -131,7 +161,14 @@
   }
 
   /**
-   * Constructs an ImageProducer from memory using the default RGB ColorModel
+   * Constructs an ImageProducer from memory using the default RGB ColorModel.
+   * 
+   * @param w  the image width.
+   * @param h  the image height.
+   * @param pix  the image data.
+   * @param off  the offset to the first pixel in the array.
+   * @param scan  the number of array elements from a pixel on one row to the
+   * corresponding pixel on the next row. 
*/
   public MemoryImageSource(int w, int h, int[] pix, int off, int scan)
   {
@@ -141,6 +178,8 @@
   /**
* Used to register an codeImageConsumer/code with this
* codeImageProducer/code.
+   * 
+   * @param ic  the image consumer.
*/
   public synchronized void addConsumer(ImageConsumer ic)
   {
@@ -153,6 +192,8 @@
   /**
* Used to determine if the given codeImageConsumer/code is
* already registered with this codeImageProducer/code.
+   * 
+   * @param ic  the image consumer.
*/
   public synchronized boolean isConsumer(ImageConsumer ic)
   {
@@ -164,6 +205,8 @@
   /**
* Used to remove an codeImageConsumer/code from the list of
* registered consumers for this codeImageProducer/code.
+   * 
+   * @param ic  the image consumer.
*/
   public synchronized void removeConsumer(ImageConsumer ic)
   {
@@ -197,6 +240,8 @@
* Used to register an codeImageConsumer/code with this
* codeImageProducer/code and then request that this producer
* resend the image data in the order top-down, left-right.
+   * 
+   * @param ic  the image consumer.
*/
   public void requestTopDownLeftRightResend(ImageConsumer ic)
   {
@@ -219,7 +264,7 @@
* sending animation. If this flag is set then full buffers are sent
* in the newPixels methods instead of just regions.
*
-   * @param fullbuffers - a flag

[cp-patches] FYI: MetalScrollBarUI.java - small fix

2006-09-07 Thread David Gilbert
This patch (committed) moves the initialisation of the scrollBarWidth field into the 
installDefaults() method - the JGoodies PlasticLookAndFeel class requires this, and 
it seems more sensible than the code that we have now in any case:


2006-09-07  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalScrollBarUI.java
(installDefaults): Initialise scrollBarWidth from UI defaults here,
(createDecreaseButton): Don't fetch scrollBarWidth here,
(createIncreaseButton): Likewise.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalScrollBarUI.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java,v
retrieving revision 1.15
diff -u -r1.15 MetalScrollBarUI.java
--- javax/swing/plaf/metal/MetalScrollBarUI.java11 May 2006 17:05:55 
-  1.15
+++ javax/swing/plaf/metal/MetalScrollBarUI.java7 Sep 2006 09:33:16 
-
@@ -1,5 +1,5 @@
 /* MetalScrollBarUI.java
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -169,6 +169,7 @@
 Boolean prop = (Boolean) scrollbar.getClientProperty(FREE_STANDING_PROP);
 isFreeStanding = prop == null ? true : prop.booleanValue();
 scrollBarShadowColor = UIManager.getColor(ScrollBar.shadow);
+scrollBarWidth = UIManager.getInt(ScrollBar.width);
 super.installDefaults();
   }
 
@@ -187,7 +188,10 @@
   
   /**
* Creates a new button to use as the control at the lower end of the
-   * [EMAIL PROTECTED] JScrollBar}.
+   * [EMAIL PROTECTED] JScrollBar}.  This method assigns the new button (an 
instance of
+   * [EMAIL PROTECTED] MetalScrollButton} to the [EMAIL PROTECTED] 
#decreaseButton} field, and also 
+   * returns the button.  The button width is determined by the 
+   * codeScrollBar.width/code setting in the UI defaults.
* 
* @param orientation  the orientation of the button ([EMAIL PROTECTED] 
#NORTH},
* [EMAIL PROTECTED] #SOUTH}, [EMAIL PROTECTED] #EAST} 
or [EMAIL PROTECTED] #WEST}).
@@ -196,7 +200,6 @@
*/
   protected JButton createDecreaseButton(int orientation)
   {
-scrollBarWidth = UIManager.getInt(ScrollBar.width);
 decreaseButton = new MetalScrollButton(orientation, scrollBarWidth, 
 isFreeStanding);
 return decreaseButton;
@@ -204,7 +207,10 @@
 
   /**
* Creates a new button to use as the control at the upper end of the
-   * [EMAIL PROTECTED] JScrollBar}.
+   * [EMAIL PROTECTED] JScrollBar}.  This method assigns the new button (an 
instance of
+   * [EMAIL PROTECTED] MetalScrollButton} to the [EMAIL PROTECTED] 
#increaseButton} field, and also 
+   * returns the button.  The button width is determined by the 
+   * codeScrollBar.width/code setting in the UI defaults.
* 
* @param orientation  the orientation of the button ([EMAIL PROTECTED] 
#NORTH},
* [EMAIL PROTECTED] #SOUTH}, [EMAIL PROTECTED] #EAST} 
or [EMAIL PROTECTED] #WEST}).
@@ -213,7 +219,6 @@
*/
   protected JButton createIncreaseButton(int orientation)
   {
-scrollBarWidth = UIManager.getInt(ScrollBar.width);
 increaseButton = new MetalScrollButton(orientation, scrollBarWidth, 
 isFreeStanding);
 return increaseButton;


[cp-patches] FYI: BasicInternalFrameUI.java - minor fix

2006-09-07 Thread David Gilbert
This patch (committed) fixes dragging of internal frames under the 
PlasticLookAndFeel from JGoodies:


2006-09-07  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicInternalFrameUI.java
(setNorthPane): Assign component to titlePane.

Here are a couple of screenshots showing the PlasticXPLookAndFeel running on GNU 
Classpath:


http://www.object-refinery.com/classpath/plastic-demo.png

http://www.object-refinery.com/classpath/plastic-junit.png

Regards,

Dave
Index: javax/swing/plaf/basic/BasicInternalFrameUI.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,v
retrieving revision 1.41
diff -u -r1.41 BasicInternalFrameUI.java
--- javax/swing/plaf/basic/BasicInternalFrameUI.java3 Aug 2006 20:26:05 
-   1.41
+++ javax/swing/plaf/basic/BasicInternalFrameUI.java7 Sep 2006 11:38:43 
-
@@ -1594,6 +1594,13 @@
   {
 replacePane(northPane, c);
 northPane = c;
+// the following is needed to make internal frames draggable when using
+// the JGoodies PlasticLookAndFeel, because it overrides the 
+// createNorthPane() method and doesn't assign anything to the titlePane
+// field.  It is possible there is another way to make this work, but
+// I didn't find it...
+if (c instanceof BasicInternalFrameTitlePane)
+  titlePane = (BasicInternalFrameTitlePane) c;
   }
 
   /**


[commit-cp] classpath ChangeLog java/awt/image/MemoryImageS...

2006-09-07 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/07 08:22:12

Modified files:
.  : ChangeLog 
java/awt/image : MemoryImageSource.java 

Log message:
2006-09-07  David Gilbert  [EMAIL PROTECTED]

* java/awt/image/MemoryImageSource.java: Added API docs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8509r2=1.8510
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/image/MemoryImageSource.java?cvsroot=classpathr1=1.14r2=1.15




[commit-cp] classpath ChangeLog javax/swing/plaf/metal/Meta...

2006-09-07 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/07 09:38:13

Modified files:
.  : ChangeLog 
javax/swing/plaf/metal: MetalScrollBarUI.java 

Log message:
2006-09-07  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalScrollBarUI.java
(installDefaults): Initialise scrollBarWidth from UI defaults 
here,
(createDecreaseButton): Don't fetch scrollBarWidth here, 
(createIncreaseButton): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8510r2=1.8511
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java?cvsroot=classpathr1=1.15r2=1.16




[commit-cp] classpath ChangeLog javax/swing/plaf/basic/Basi...

2006-09-07 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/07 11:42:15

Modified files:
.  : ChangeLog 
javax/swing/plaf/basic: BasicInternalFrameUI.java 

Log message:
2006-09-07  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicInternalFrameUI.java
(setNorthPane): Assign component to titlePane.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8512r2=1.8513
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java?cvsroot=classpathr1=1.41r2=1.42




[cp-patches] FYI: MetalLookAndFeel.initComponentDefaults() - font fixes

2006-09-06 Thread David Gilbert
This patch (committed) fixes some of the default font settings in the Metal look and 
feel:


2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalLookAndFeel.java
(initComponentDefaults): Corrected various font defaults.

Mauve checks already committed.

Regards,

Dave
Index: javax/swing/plaf/metal/MetalLookAndFeel.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java,v
retrieving revision 1.86
diff -u -r1.86 MetalLookAndFeel.java
--- javax/swing/plaf/metal/MetalLookAndFeel.java14 Aug 2006 15:13:54 
-  1.86
+++ javax/swing/plaf/metal/MetalLookAndFeel.java6 Sep 2006 11:36:44 
-
@@ -889,7 +889,7 @@
   CheckBox.border, MetalBorders.getButtonBorder(),
   CheckBox.disabledText, getInactiveControlTextColor(),
   CheckBox.focus, getFocusColor(),
-  CheckBox.font, new FontUIResource(Dialog, Font.BOLD, 12),
+  CheckBox.font, getControlTextFont(),
   CheckBox.foreground, getControlTextColor(),
   CheckBox.icon,
   new 
UIDefaults.ProxyLazyValue(javax.swing.plaf.metal.MetalCheckBoxIcon),
@@ -905,7 +905,7 @@
   CheckBoxMenuItem.commandSound, sounds/MenuItemCommand.wav,
   CheckBoxMenuItem.checkIcon, MetalIconFactory.getCheckBoxMenuItemIcon(),
   CheckBoxMenuItem.disabledForeground, getMenuDisabledForeground(),
-  CheckBoxMenuItem.font, new FontUIResource(Dialog, Font.BOLD, 12),
+  CheckBoxMenuItem.font, getMenuTextFont(),
   CheckBoxMenuItem.foreground, getMenuForeground(),
   CheckBoxMenuItem.selectionBackground, getMenuSelectedBackground(),
   CheckBoxMenuItem.selectionForeground, getMenuSelectedForeground(),
@@ -924,7 +924,7 @@
   ComboBox.buttonShadow, getControlShadow(),
   ComboBox.disabledBackground, getControl(),
   ComboBox.disabledForeground, getInactiveSystemTextColor(),
-  ComboBox.font, new FontUIResource(Dialog, Font.BOLD, 12),
+  ComboBox.font, getControlTextFont(),
   ComboBox.foreground, getControlTextColor(),
   ComboBox.selectionBackground, getPrimaryControlShadow(),
   ComboBox.selectionForeground, getControlTextColor(),
@@ -935,10 +935,11 @@
   DesktopIcon.foreground, getControlTextColor(),
   DesktopIcon.width, new Integer(160),
   DesktopIcon.border, MetalBorders.getDesktopIconBorder(),
+  DesktopIcon.font, getControlTextFont(),
 
   EditorPane.background, getWindowBackground(),
   EditorPane.caretForeground, getUserTextColor(),
-  EditorPane.font, new FontUIResource(Dialog, Font.BOLD, 12),
+  EditorPane.font, getControlTextFont(),
   EditorPane.foreground,  getUserTextColor(),
   EditorPane.inactiveForeground,  getInactiveSystemTextColor(),
   EditorPane.selectionBackground, getTextHighlightColor(),
@@ -1023,7 +1024,7 @@
   Menu.borderPainted, Boolean.TRUE,
   MenuItem.commandSound, sounds/MenuItemCommand.wav,
   Menu.disabledForeground, getMenuDisabledForeground(),
-  Menu.font, getControlTextFont(),
+  Menu.font, getMenuTextFont(),
   Menu.foreground, getMenuForeground(),
   Menu.selectionBackground, getMenuSelectedBackground(),
   Menu.selectionForeground, getMenuSelectedForeground(),
@@ -1032,7 +1033,7 @@
 
   MenuBar.background, getMenuBackground(),
   MenuBar.border, new MetalBorders.MenuBarBorder(),
-  MenuBar.font, getControlTextFont(),
+  MenuBar.font, getMenuTextFont(),
   MenuBar.foreground, getMenuForeground(),
   MenuBar.highlight, getControlHighlight(),
   MenuBar.shadow, getControlShadow(),
@@ -1046,7 +1047,7 @@
   MenuItem.border, new MetalBorders.MenuItemBorder(),
   MenuItem.borderPainted, Boolean.TRUE,
   MenuItem.disabledForeground, getMenuDisabledForeground(),
-  MenuItem.font, getControlTextFont(),
+  MenuItem.font, getMenuTextFont(),
   MenuItem.foreground, getMenuForeground(),
   MenuItem.selectionBackground, getMenuSelectedBackground(),
   MenuItem.selectionForeground, getMenuSelectedForeground(),
@@ -1087,13 +1088,13 @@
 
   PopupMenu.background, getMenuBackground(),
   PopupMenu.border, new MetalBorders.PopupMenuBorder(),
-  PopupMenu.font, new FontUIResource(Dialog, Font.BOLD, 12),
+  PopupMenu.font, getMenuTextFont(),
   PopupMenu.foreground, getMenuForeground(),
   PopupMenu.popupSound, sounds/PopupMenuPopup.wav,
 
   ProgressBar.background, getControl(),
   ProgressBar.border, new 
BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
-  ProgressBar.font, new FontUIResource(Dialog, Font.BOLD, 12),
+  ProgressBar.font, getControlTextFont(),
   ProgressBar.foreground, getPrimaryControlShadow(),
   ProgressBar.selectionBackground, getPrimaryControlDarkShadow(),
   ProgressBar.selectionForeground, getControl(),
@@ -1127,7 +1128,7 @@
 MetalIconFactory.getRadioButtonMenuItemIcon

[cp-patches] FYI: javax.swing.UIManager fix

2006-09-06 Thread David Gilbert
This patch (committed) allows the Swing demo to start up with the PlasticLookAndFeel 
from JGoodies specified as the current look and feel:


2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/UIManager.java
(MultiplexUIDefaults.MultiplexUIDefaults()): Don't allow null fallback,
(getDefaults): Initialise MultiplexUIDefaults with empty fallback.

Note that the PlasticLookAndFeel is not in a working state yet because of 
incompatibilities between our implementation and Sun's.


To try this out, download JGoodies Looks and use the following to launch the Swing 
demo (obviously you'll need to modify the classpath to match your system):


jamvm -Dswing.defaultlaf=com.jgoodies.looks.plastic.PlasticLookAndFeel -classpath 
examples.zip:/home/dgilbert/looks-2.0.4/looks-2.0.4.jar 
gnu.classpath.examples.swing.Demo


Regards,

Dave






Index: javax/swing/UIManager.java
===
RCS file: /sources/classpath/classpath/javax/swing/UIManager.java,v
retrieving revision 1.38
diff -u -r1.38 UIManager.java
--- javax/swing/UIManager.java  26 Jul 2006 07:45:41 -  1.38
+++ javax/swing/UIManager.java  6 Sep 2006 13:33:02 -
@@ -154,8 +154,16 @@
 
 UIDefaults fallback;
 
+/**
+ * Creates a new codeMultiplexUIDefaults/code instance with 
+ * coded/code as the fallback defaults.
+ * 
+ * @param d  the fallback defaults (codenull/code not permitted).
+ */
 MultiplexUIDefaults(UIDefaults d)
 {
+  if (d == null) 
+throw new NullPointerException();
   fallback = d;
 }
 
@@ -483,7 +491,7 @@
   public static UIDefaults getDefaults()
   {
 if (currentUIDefaults == null)
-  currentUIDefaults = new MultiplexUIDefaults(null);
+  currentUIDefaults = new MultiplexUIDefaults(new UIDefaults());
 return currentUIDefaults;
   }
 


[cp-patches] FYI: javax.swing.UIManager fixes

2006-09-06 Thread David Gilbert

This patch (committed) fixes some errors in the UIManager class:

2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/UIManager.java
(getBoolean(Object)): Reimplemented,
(getBoolean(Object, Locale)): Likewise,
(getBorder(Object)): Likewise,
(getBorder(Object, Locale)): Likewise,
(getColor(Object)): Likewise,
(getColor(Object, Locale)): Likewise,
(getDimension(Object)): Likewise,
(getDimension(Object, Locale)): Likewise,
(getFont(Object)): Likewise,
(getFont(Object, Locale)): Likewise,
(getIcon(Object)): Likewise,
(getIcon(Object, Locale)): Likewise,
(getInsets(Object)): Updated API docs,
(getInsets(Object, Locale)): Likewise,
(getInt(Object)): Reimplemented,
(getInt(Object, Locale)): Likewise,
(getString(Object)): Likewise,
(getString(Object, Locale)): Likewise.

Mauve tests are already committed.

Regards,

Dave
Index: javax/swing/UIManager.java
===
RCS file: /sources/classpath/classpath/javax/swing/UIManager.java,v
retrieving revision 1.39
diff -u -r1.39 UIManager.java
--- javax/swing/UIManager.java  6 Sep 2006 13:37:34 -   1.39
+++ javax/swing/UIManager.java  6 Sep 2006 15:39:54 -
@@ -408,6 +408,8 @@
* @param key  the key.
* 
* @return The object.
+   * 
+   * @since 1.4
*/
   public static Object get(Object key, Locale locale)
   {
@@ -415,61 +417,120 @@
   }
 
   /**
-   * Returns a boolean value from the defaults table,
-   * codefalse/code if key is not present.
+   * Returns a boolean value from the defaults table.  If there is no value
+   * for the specified key, or the value is not an instance of [EMAIL 
PROTECTED] Boolean},
+   * this method returns codefalse/code.
+   * 
+   * @param key  the key (codenull/code not permitted).
*
+   * @return The boolean value associated with the specified key.
+   * 
+   * @throws NullPointerException if codekey/code is codenull/code.
+   * 
* @since 1.4
*/
   public static boolean getBoolean(Object key)
   {
-Boolean value = (Boolean) get(key);
-return value != null ? value.booleanValue() : false;
+Object value = get(key);
+if (value instanceof Boolean) 
+  return ((Boolean) value).booleanValue();
+return false;
   }
   
   /**
-   * Returns a boolean value from the defaults table,
-   * codefalse/code if key is not present.
+   * Returns a boolean value from the defaults table.  If there is no value
+   * for the specified key, or the value is not an instance of [EMAIL 
PROTECTED] Boolean},
+   * this method returns codefalse/code.
+   * 
+   * @param key  the key (codenull/code not permitted).
+   * @param locale  the locale.
*
+   * @return The boolean value associated with the specified key.
+   * 
+   * @throws NullPointerException if codekey/code is codenull/code.
+   * 
* @since 1.4
*/
   public static boolean getBoolean(Object key, Locale locale)
   {
-Boolean value = (Boolean) get(key, locale);
-return value != null ? value.booleanValue() : false;
+Object value = get(key, locale);
+if (value instanceof Boolean) 
+  return ((Boolean) value).booleanValue();
+return false;
   }
 
   /**
* Returns a border from the defaults table. 
+   * 
+   * @param key  the key (codenull/code not permitted).
+   * 
+   * @return The border associated with the given key, or codenull/code.
+   * 
+   * @throws NullPointerException if codekey/code is codenull/code.
*/
   public static Border getBorder(Object key)
   {
-return (Border) get(key);
+Object value = get(key);
+if (value instanceof Border) 
+  return (Border) value;
+return null;
   }
 
   /**
-   * Returns a border from the defaults table.
+   * Returns a border from the defaults table. 
+   * 
+   * @param key  the key (codenull/code not permitted).
+   * @param locale  the locale.
+   * 
+   * @return The border associated with the given key, or codenull/code.
+   * 
+   * @throws NullPointerException if codekey/code is codenull/code.
*
* @since 1.4
*/
   public static Border getBorder(Object key, Locale locale)
   {
-return (Border) get(key, locale);
+Object value = get(key, locale);
+if (value instanceof Border) 
+  return (Border) value;
+return null;
   }
 
   /**
* Returns a drawing color from the defaults table. 
+   * 
+   * @param key  the key (codenull/code not permitted).
+   * 
+   * @return The color associated with the given key, or codenull/code.
+   * 
+   * @throws NullPointerException if codekey/code is codenull/code.
*/
   public static Color getColor(Object key)
   {
-return (Color) get(key);
+Object value = get(key);
+if (value instanceof Color) 
+  return (Color) value;
+return null;
   }
 
   /**
* Returns a drawing color from the defaults table

[cp-patches] FYI: BasicScrollBarUI.java - fix

2006-09-06 Thread David Gilbert
This patch (committed) fixes a NullPointerException in the PlasticLookAndFeel from 
JGoodies when running on GNU Classpath:


2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicScrollBarUI.java
(installDefaults): Call configureScrollBarColors().

Regards,

Dave
Index: javax/swing/plaf/basic/BasicScrollBarUI.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v
retrieving revision 1.38
diff -u -r1.38 BasicScrollBarUI.java
--- javax/swing/plaf/basic/BasicScrollBarUI.java13 Aug 2006 15:32:52 
-  1.38
+++ javax/swing/plaf/basic/BasicScrollBarUI.java6 Sep 2006 16:30:48 
-
@@ -760,10 +760,7 @@
 scrollbar.setOpaque(true);
 scrollbar.setLayout(this);
 
-thumbColor = UIManager.getColor(ScrollBar.thumb);
-thumbDarkShadowColor = UIManager.getColor(ScrollBar.thumbDarkShadow);
-thumbHighlightColor = UIManager.getColor(ScrollBar.thumbHighlight);
-thumbLightShadowColor = UIManager.getColor(ScrollBar.thumbShadow);
+configureScrollBarColors();
 
 maximumThumbSize = UIManager.getDimension(ScrollBar.maximumThumbSize);
 minimumThumbSize = UIManager.getDimension(ScrollBar.minimumThumbSize);


[commit-cp] classpath ChangeLog javax/swing/plaf/metal/Meta...

2006-09-06 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/06 11:39:43

Modified files:
.  : ChangeLog 
javax/swing/plaf/metal: MetalLookAndFeel.java 

Log message:
2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/metal/MetalLookAndFeel.java
(initComponentDefaults): Corrected various font defaults.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8504r2=1.8505
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java?cvsroot=classpathr1=1.86r2=1.87




[commit-cp] classpath ChangeLog javax/swing/UIManager.java

2006-09-06 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/06 15:47:30

Modified files:
.  : ChangeLog 
javax/swing: UIManager.java 

Log message:
2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/UIManager.java
(getBoolean(Object)): Reimplemented,
(getBoolean(Object, Locale)): Likewise,
(getBorder(Object)): Likewise,
(getBorder(Object, Locale)): Likewise,
(getColor(Object)): Likewise,
(getColor(Object, Locale)): Likewise,
(getDimension(Object)): Likewise,
(getDimension(Object, Locale)): Likewise,
(getFont(Object)): Likewise,
(getFont(Object, Locale)): Likewise,
(getIcon(Object)): Likewise,
(getIcon(Object, Locale)): Likewise,
(getInsets(Object)): Updated API docs,
(getInsets(Object, Locale)): Likewise,
(getInt(Object)): Reimplemented,
(getInt(Object, Locale)): Likewise,
(getString(Object)): Likewise,
(getString(Object, Locale)): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8506r2=1.8507
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/UIManager.java?cvsroot=classpathr1=1.39r2=1.40




[commit-cp] classpath ChangeLog javax/swing/plaf/basic/Basi...

2006-09-06 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/06 16:37:30

Modified files:
.  : ChangeLog 
javax/swing/plaf/basic: BasicScrollBarUI.java 

Log message:
2006-09-06  David Gilbert  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicScrollBarUI.java
(installDefaults): Call configureScrollBarColors().

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8508r2=1.8509
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java?cvsroot=classpathr1=1.38r2=1.39




[commit-cp] classpath ChangeLog java/awt/List.java

2006-09-05 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/05 21:24:21

Modified files:
.  : ChangeLog 
java/awt   : List.java 

Log message:
2006-09-05  David Gilbert  [EMAIL PROTECTED]

* java/awt/List.java: Source code reformatted.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8500r2=1.8501
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/List.java?cvsroot=classpathr1=1.30r2=1.31




[commit-cp] classpath ChangeLog java/awt/List.java

2006-09-05 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/05 21:47:08

Modified files:
.  : ChangeLog 
java/awt   : List.java 

Log message:
2006-09-05  David Gilbert  [EMAIL PROTECTED]

* java/awt/List.java: Added @since to various methods.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8503r2=1.8504
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/List.java?cvsroot=classpathr1=1.31r2=1.32




[cp-patches] FYI: Rectangle.setRect() - modified rounding

2006-09-04 Thread David Gilbert

This patch (committed) changes the rounding used in the setRect() method:

2006-09-04  David Gilbert  [EMAIL PROTECTED]

* java/awt/Rectangle.java
(setRect(double, double, double, double)): Modified rounding of input
values.

I have Mauve tests for this and will commit them in a moment...

Regards,

Dave
Index: java/awt/Rectangle.java
===
RCS file: /sources/classpath/classpath/java/awt/Rectangle.java,v
retrieving revision 1.16
diff -u -r1.16 Rectangle.java
--- java/awt/Rectangle.java 16 Sep 2005 01:11:39 -  1.16
+++ java/awt/Rectangle.java 4 Sep 2006 08:49:49 -
@@ -1,5 +1,5 @@
 /* Rectangle.java -- represents a graphics rectangle
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+   Copyright (C) 1999, 2000, 2001, 2002, 2006, Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -299,8 +299,10 @@
   }
 
   /**
-   * Updates this rectangle to have the specified dimensions, as rounded to
-   * integers.
+   * Updates this rectangle to have the specified dimensions, rounded to the
+   * integer precision used by this class (the values are rounded outwards so
+   * that the stored rectangle completely encloses the specified double 
+   * precision rectangle).
*
* @param x the new X coordinate of the upper left hand corner
* @param y the new Y coordinate of the upper left hand corner
@@ -310,10 +312,10 @@
*/
   public void setRect(double x, double y, double width, double height)
   {
-this.x = (int) x;
-this.y = (int) y;
-this.width = (int) width;
-this.height = (int) height;
+this.x = (int) Math.floor(x);
+this.y = (int) Math.floor(y);
+this.width = (int) Math.ceil(x + width) - this.x;
+this.height = (int) Math.ceil(y + height) - this.y;
   }
 
   /**


[commit-cp] classpath ChangeLog java/awt/Rectangle.java

2006-09-04 Thread David Gilbert
CVSROOT:/sources/classpath
Module name:classpath
Changes by: David Gilbert trebligd06/09/04 08:52:33

Modified files:
.  : ChangeLog 
java/awt   : Rectangle.java 

Log message:
2006-09-04  David Gilbert  [EMAIL PROTECTED]

* java/awt/Rectangle.java
(setRect(double, double, double, double)): Modified rounding of 
input
values.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpathr1=1.8494r2=1.8495
http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/Rectangle.java?cvsroot=classpathr1=1.16r2=1.17




[cp-patches] FYI: java.util.Calendar - some API doc additions

2006-08-17 Thread David Gilbert
This patch (committed) adds some details to the API docs regarding null arguments 
for a few methods that I happened to be looking at today:


2006-08-17  David Gilbert  [EMAIL PROTECTED]

* java/util/Calendar.java: API doc additions.

Regards,

Dave
Index: java/util/Calendar.java
===
RCS file: /sources/classpath/classpath/java/util/Calendar.java,v
retrieving revision 1.49
diff -u -r1.49 Calendar.java
--- java/util/Calendar.java 7 May 2006 22:49:49 -   1.49
+++ java/util/Calendar.java 17 Aug 2006 12:22:29 -
@@ -1,5 +1,6 @@
 /* Calendar.java --
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005  Free Software 
Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,  
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -483,6 +484,8 @@
   /**
* Creates a calendar representing the actual time, using the default
* time zone and locale.
+   * 
+   * @return The new calendar.
*/
   public static synchronized Calendar getInstance()
   {
@@ -492,7 +495,12 @@
   /**
* Creates a calendar representing the actual time, using the given
* time zone and the default locale.
-   * @param zone a time zone.
+   * 
+   * @param zone a time zone (codenull/code not permitted).
+   * 
+   * @return The new calendar.
+   * 
+   * @throws NullPointerException if codezone/code is codenull/code.
*/
   public static synchronized Calendar getInstance(TimeZone zone)
   {
@@ -502,7 +510,12 @@
   /**
* Creates a calendar representing the actual time, using the default
* time zone and the given locale.
-   * @param locale a locale.
+   * 
+   * @param locale a locale (codenull/code not permitted).
+   * 
+   * @return The new calendar.
+   * 
+   * @throws NullPointerException if codelocale/code is codenull/code.
*/
   public static synchronized Calendar getInstance(Locale locale)
   {
@@ -524,8 +537,14 @@
   /**
* Creates a calendar representing the actual time, using the given
* time zone and locale.
-   * @param zone a time zone.
-   * @param locale a locale.
+   * 
+   * @param zone a time zone (codenull/code not permitted).
+   * @param locale a locale (codenull/code not permitted).
+   * 
+   * @return The new calendar.
+   * 
+   * @throws NullPointerException if codezone/code or codelocale/code
+   * is codenull/code.
*/
   public static synchronized Calendar getInstance(TimeZone zone, Locale locale)
   {
@@ -617,6 +636,10 @@
   /**
* Sets this Calendar's time to the given Date.  All time fields
* are invalidated by this method.
+   * 
+   * @param date  the date (codenull/code not permitted).
+   * 
+   * @throws NullPointerException if codedate/code is codenull/code.
*/
   public final void setTime(Date date)
   {


Re: GNU Classpath Talk This Thursday

2006-08-16 Thread David Gilbert

Hi Andrew,

Andrew John Hughes wrote:


Also, if there's a more
up-to-date version of the lines of code graph, that'd be great too :)

 



I ran it yesterday and uploaded it today - see Planet Classpath for the 
link.  Good luck with your presentation!


Regards,

Dave



Re: Torturing image ops and Swing

2006-08-03 Thread David Gilbert

Hi Norman,

Thanks for the detailed report!  I don't have time to try this out right 
now, but I have a couple of comments:


[EMAIL PROTECTED] wrote:



1. Select menu  File  Open image directory...  and select a 
directory with
   some images. This is the first challenge, because JFileChooser is 
still
   about as user-unfriendly as possible. (I somewhat fear that many 
first-time
   classpath users might give up after trying to use JFileChooser. 
This is

   unfortunate, because the rest of Swing works pretty well these days.)


Is this before or after Roman's JFileChooser patch (last night)?



5. Select Tools  Sharpen  Laplace 3x3. Simple convolution filter 
implemented

with ConvolveOp and applied to a BufferedImage TYPE_INT_RGB.

   java.lang.ArrayIndexOutOfBoundsException: 3
   at java.awt.image.ColorModel.getComponentSize(ColorModel.java:200)
   at java.awt.image.ColorModel.coerceData(ColorModel.java:641)
   at 
java.awt.image.DirectColorModel.coerceData(DirectColorModel.java:405)

   at java.awt.image.BufferedImage.coerceData(BufferedImage.java:288)
   at java.awt.image.ConvolveOp.filter(ConvolveOp.java:126)

   This worked a week ago, but very slowly. Try the Tools  Edges  
Mexican
   Hat 13x13 filter, if you don't believe me. The JDK seems to include 
some

   optimizations for such (separable?) kernels.

   OK, lets try something else:


I did some cleanup work on ConvolveOp not too long ago because it was 
broken.  It works now, but slowly.  There is a FIXME in the source code 
at the point where we need a different approach to get a speedup.  If I 
recall correctly, for each pixel in the output raster, we do N x N 
lookups in the input raster where N x N is the size of the convolution 
filter.  For 3 x 3, that will be slow (effectively reading the raster 
pixel by pixel 9 times).  For 13 x 13, that will be unusable.





6. Select Tools  Negative Image. Obvious implementation based on
LookupOp. Works. Performance is ok (1 sec for 800x600). The result is
a BufferedImage.TYPE_INT_RGB.

BUT repainting suddenly takes 3 seconds for each paintComponent,
and the application is pretty much dead. For comparison, a repaint 
of the

BufferedImage before the filtering took about 10 msec.

For 3000x2000 images, each repaint takes 40 seconds on my system.
Any ideas about what I am doing wrong here are HIGHLY appreciated.

Load a new image. Repainting time is back to the millisecond range.


Sven will probably know the answer to this.  I'm sure it has something 
to do with the DataBuffer implementations.  The source image most likely 
uses some private class that implements a managed data buffer, whereas 
the destination image will be using the array-based DataBuffers in 
java.awt.image.* (which are sure to be slower).


Anyway, thanks again for the detail...I'd love to spend some time on 
this right now, but alas I don't have any...


Regards,

Dave



Re: Torturing image ops and Swing

2006-08-03 Thread David Gilbert

Roman Kennke wrote:


Hi Norman,


anyone interested in torturing our Swing, awt.image and javax.image 
operations

a bit?



Sure. These are packages that require lots of work still. David 
started to write Mauve tests and fix awt.image I think.



I did.  I will come back to it when I can - in particular, I didn't get 
to the ColorModel classes yet.  Also, some of the classes I fixed still 
need to be worked on further for performance reasons (ConvolveOp in 
particular, but other things too).


Regards,

Dave




Re: Testing JDK bugs?

2006-07-27 Thread David Gilbert

Roman Kennke wrote:


Hi lists, hi David (you wrote most of the tests I'm gonna talk about..)

While trying to clean up some Mauve failures I came upon a couple of 
tests that fail on JDK because they test strictly against the spec 
where the JDK isn't as strict. This is mostly bounds checking, where 
the spec says throws BadLocationException if invalid or similar. I 
think the JDK simply doesn't perform explicit checks in the Content 
implementations. See for example the tests for GapContent and 
StringContent.


Now I am not sure how to handle this. I've commented these tests out 
locally, simply to avoid clutter in the Mauve output. The question is 
how to interpret the spec. Adding the throws BadLocationException does 
mean (to me) that the impl may or may not throw a 
BadLocationException, but the application should be prepared to deal 
with it anyways. Moreover, the throws BadLocationException is 
specified in the interface. The implementations are not required to 
throw the BadLocationException if they decide to deal with wrong input 
themselves. For instance, the GapContent implementation (ours as well 
as JDK) can very well handle Position outside the range, because it 
only calculates offsets.


The situation gets worse. There are a number of tests both in Mauve 
and in the Intel testsuite that actually test the JDK behaviour of 
_not_ throwing the BLE, sometimes indirectly (via a Document impl or 
so). So we can't get to fully PASS with Mauve.
We should decide if we want to test strict spec compliance or 
reference impl compatibility. So far the decisions in GNU Classpath 
have been made in favour of (bug-) compatibility over strict spec 
compliance, so I think we should do the same for Mauve.


Anyway, I think we should either disable the spec-compliance checks or 
the RI-compatibility checks or both in Mauve so that we have at least 
a chance to reach 100%.


Any opinions on that?

/Roman


Hi Roman,

The theory is easy:  Mauve should test AN implementation against THE 
spec.  The reality is...well, you know already what the reality is.   
Send me the names of the tests that are causing problems, and I'll try 
to recode them to pass on Sun's JRE 1.5.0, otherwise I'll file a bug 
report with Sun.  I may recode some tests with two paths, so I can set a 
system property (say) and check for strict spec compliance if I want or 
need to.


I never heard back from Sun about the GapContent bug I filed in 
January.  I filed a few other bug reports since then, with little to 
show for it:


http://www.object-refinery.com/jre/bugs/

...but with 100,000 bug reports in the first half of 2006, I guess 
they're busy!


Regards,

Dave



Re: Testing JDK bugs?

2006-07-27 Thread David Gilbert

Jeroen Frijters wrote:


David Gilbert wrote:
 

The theory is easy:  Mauve should test AN implementation against THE 
spec.
   



Pardon me for beating my favorite horse again, but this assumes that the
spec is somehow more valuable than code and/or that the spec doesn't
contain bugs. In the real world both are buggy and users rarely care
about the spec, especially when their app works on the RI, but not on
our implementation.

Allow me to rebut another issue that often comes up: We'll make it spec
compliant and when someone finds an application that depends on the RI
behavior then we'll copy that behavior.

IMNSHO, this is actually a very dumb approach. It makes our
implementation worse than the RI in two ways:

1) Apps coded against the RI (possibly) don't work out of the box.
2) Apps coded against our implementation (and spec) run the risk of
breaking in the future when we randomly decide to start emulating the RI
instead of the spec.

Of course, things aren't black and white and issues should be decided on
a case by case basis, but considering the spec holy is not doing anybody
any service.
 



I'm sorry to have set you off.  Bear in mind that there is a difference 
between the theory and the practice here...I'm not too hung up on the 
theory, and I think the remainder of my original post made that clear.


Regards,

Dave



[cp-patches] FYI: BandedSampleModel.createCompatibleSampleModel() fixes

2006-07-26 Thread David Gilbert
This patch (committed) fixes a couple of bugs in the createCompatibleSampleModel() 
method:


- due to a typo, we were incrementing 'i' rather than 'j' in one of the loops 
(thanks to Paul Jenner for noticing this), which was resulting in an 
IllegalArgumentException;
- the scanlineStride should be equal to the new sample model width, not the old 
scanlineStride.


Here is the ChangeLog entry:

2006-07-26  David Gilbert  [EMAIL PROTECTED]

* java/awt/image/BandedSampleModel.java
(createCompatibleSampleModel): Fixed typo in loop increment, set
correct scanlineStride, and updated API docs.

Regards,

Dave
Index: java/awt/image/BandedSampleModel.java
===
RCS file: /sources/classpath/classpath/java/awt/image/BandedSampleModel.java,v
retrieving revision 1.8
diff -u -r1.8 BandedSampleModel.java
--- java/awt/image/BandedSampleModel.java   18 Jul 2006 16:36:29 -  
1.8
+++ java/awt/image/BandedSampleModel.java   26 Jul 2006 06:19:15 -
@@ -107,10 +107,15 @@
* Creates a new codeSampleModel/code that is compatible with this
* model and has the specified width and height.
* 
-   * @param w  the width (in pixels).
-   * @param h  the height (in pixels).
+   * @param w  the width (in pixels, must be greater than zero).
+   * @param h  the height (in pixels, must be greater than zero).
* 
* @return The new sample model.
+   * 
+   * @throws IllegalArgumentException if codew/code or codeh/code is
+   * not greater than zero.
+   * @throws IllegalArgumentException if codew * h/code exceeds 
+   * codeInteger.MAX_VALUE/code.
*/
   public SampleModel createCompatibleSampleModel(int w, int h)
   {
@@ -125,28 +130,27 @@
 // FIXME: This is N^2, but not a big issue, unless there's a lot of
 // bands...
 for (int i = 0; i  bandOffsets.length; i++)
-  for (int j = i + 1; j  bandOffsets.length; i++)
-   if (bankIndices[order[i]]  bankIndices[order[j]]
-   || (bankIndices[order[i]] == bankIndices[order[j]]
-bandOffsets[order[i]]  bandOffsets[order[j]]))
- {
-   int t = order[i]; order[i] = order[j]; order[j] = t;
- }
+  for (int j = i + 1; j  bandOffsets.length; j++)
+if (bankIndices[order[i]]  bankIndices[order[j]]
+|| (bankIndices[order[i]] == bankIndices[order[j]]
+ bandOffsets[order[i]]  bandOffsets[order[j]]))
+  {
+int t = order[i]; order[i] = order[j]; order[j] = t;
+  }
 int bank = 0;
 int offset = 0;
 for (int i = 0; i  bandOffsets.length; i++)
   {
-   if (bankIndices[order[i]] != bank)
- {
-   bank = bankIndices[order[i]];
-   offset = 0;
- }
-   newoffsets[order[i]] = offset;
-   offset += w * scanlineStride;
+if (bankIndices[order[i]] != bank)
+  {
+bank = bankIndices[order[i]];
+offset = 0;
+  }
+newoffsets[order[i]] = offset;
+offset += w * scanlineStride;
   }
 
-return new BandedSampleModel(dataType, w, h, scanlineStride, bankIndices, 
- newoffsets);
+return new BandedSampleModel(dataType, w, h, w, bankIndices, newoffsets);
   }
 
 


[cp-patches] FYI: java.util.Vector - API doc typo fixed

2006-07-26 Thread David Gilbert

This patch (committed) fixes a typo in the API docs:

2006-07-26  David Gilbert  [EMAIL PROTECTED]

* java/util/Vector.java: Fixed API doc typo.

Regards,

Dave
Index: java/util/Vector.java
===
RCS file: /sources/classpath/classpath/java/util/Vector.java,v
retrieving revision 1.26
diff -u -r1.26 Vector.java
--- java/util/Vector.java   18 Aug 2005 10:32:56 -  1.26
+++ java/util/Vector.java   26 Jul 2006 06:46:43 -
@@ -1,5 +1,6 @@
 /* Vector.java -- Class that provides growable arrays.
-   Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005  Free Software Foundation, 
Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005, 2006,  
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,6 +38,7 @@
 
 
 package java.util;
+
 import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
@@ -479,7 +481,7 @@
   }
 
   /**
-   * Removes the first (the lowestindex) occurance of the given object from
+   * Removes the first (the lowest index) occurrence of the given object from
* the Vector. If such a remove was performed (the object was found), true
* is returned. If there was no such object, false is returned.
*


[cp-patches] FYI: StringContent - minor fix

2006-07-26 Thread David Gilbert

This patch (committed) makes a small fix to the default constructor:

2006-07-26  David Gilbert  [EMAIL PROTECTED]

* javax/swing/text/StringContent.java
(StringContent): Changed initialLength to 10.

Regards,

Dave
Index: javax/swing/text/StringContent.java
===
RCS file: /sources/classpath/classpath/javax/swing/text/StringContent.java,v
retrieving revision 1.8
diff -u -r1.8 StringContent.java
--- javax/swing/text/StringContent.java 10 Feb 2006 14:24:03 -  1.8
+++ javax/swing/text/StringContent.java 26 Jul 2006 07:22:36 -
@@ -178,11 +178,13 @@
   }
 
   /**
-   * Creates a new instance containing the string \n.
+   * Creates a new instance containing the string \n.  This is equivalent
+   * to calling [EMAIL PROTECTED] #StringContent(int)} with an 
codeinitialLength/code
+   * of 10.
*/
   public StringContent()
   {
-this(1);
+this(10);
   }
 
   /**


[cp-patches] FYI: BandedSampleModel fixes

2006-07-26 Thread David Gilbert

This patch (committed) fixes the remaining failing Mauve test cases for this 
class:

2006-07-26  David Gilbert  [EMAIL PROTECTED]

* java/awt/image/BandedSampleModel.java
(getDataElements): Check for negative x or y,
(getPixels): Likewise,
(getSamples): Likewise,
(setSamples): Likewise.

Regards,

Dave
Index: java/awt/image/BandedSampleModel.java
===
RCS file: /sources/classpath/classpath/java/awt/image/BandedSampleModel.java,v
retrieving revision 1.9
diff -u -r1.9 BandedSampleModel.java
--- java/awt/image/BandedSampleModel.java   26 Jul 2006 06:27:28 -  
1.9
+++ java/awt/image/BandedSampleModel.java   26 Jul 2006 13:02:19 -
@@ -192,6 +192,9 @@
*/
   public Object getDataElements(int x, int y, Object obj, DataBuffer data)
   {
+if (x  0 || y  0)
+  throw new ArrayIndexOutOfBoundsException(
+  x and y must not be less than 0.);
 int pixel = getSample(x, y, 0, data);
 switch (getTransferType())
 {
@@ -294,6 +297,9 @@
   public int[] getPixels(int x, int y, int w, int h, int[] iArray,
 DataBuffer data)
   {
+if (x  0 || y  0)
+  throw new ArrayIndexOutOfBoundsException(
+  x and y must not be less than 0.);
 if (iArray == null) 
   iArray = new int[w * h * numBands];
 int outOffset = 0;
@@ -401,6 +407,9 @@
   public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray,
  DataBuffer data)
   {
+if (x  0 || y  0)
+  throw new ArrayIndexOutOfBoundsException(
+  x and y must not be less than 0.);
 if (iArray == null) 
   iArray = new int[w * h];
 int outOffset = 0;
@@ -640,6 +649,9 @@
   public void setSamples(int x, int y, int w, int h, int b, int[] iArray,
 DataBuffer data)
   {
+if (x  0 || y  0)
+  throw new ArrayIndexOutOfBoundsException(
+  x and y must not be less than 0.);
 int inOffset = 0;
 
 switch (getTransferType())


  1   2   3   4   5   6   7   8   9   10   >