[cp-patches] FYI:JTable.selectAll bug fix, reported by Antony Balkisson

2006-05-23 Thread Audrius Meskauskas
On the empty table, the attempt to select any rows or columns always 
throws IllegalArgumentException. Selecting nothing makes no sense and I 
think that the call should return without action.


2006-05-24  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * javax/swing/JTable.java (selectAll): Return without action
   if the table is empty.

Index: JTable.java
===
RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.109
diff -u -r1.109 JTable.java
--- JTable.java	23 May 2006 18:10:32 -	1.109
+++ JTable.java	24 May 2006 05:55:13 -
@@ -3719,6 +3719,10 @@
*/
   public void selectAll()
   {
+// The table is empty - nothing to do!
+if (getRowCount() == 0 || getColumnCount() == 0)
+  return;
+
 // rowLead and colLead store the current lead selection indices
 int rowLead = selectionModel.getLeadSelectionIndex();
 int colLead = getColumnModel().getSelectionModel().getLeadSelectionIndex();


[cp-patches] FYI:Documenting of javax.naming

2006-05-23 Thread Audrius Meskauskas

2006-05-23  Audrius Meskauskas  <[EMAIL PROTECTED]>

  * javax/swing/naming/CompositeName.java,
  javax/swing/naming/CompoundName.java:
  Documented.
Index: CompositeName.java
===
RCS file: /sources/classpath/classpath/javax/naming/CompositeName.java,v
retrieving revision 1.5
diff -u -r1.5 CompositeName.java
--- CompositeName.java	6 Apr 2006 18:04:13 -	1.5
+++ CompositeName.java	23 May 2006 17:59:08 -
@@ -47,11 +47,18 @@
 import java.util.Vector;
 
 /**
+ * Represents names that may span over several namespaces. For instance,
+ * the composite name http://www.gnu.org/software/classpath/index.html spans
+ * over three namespaces (the protocol http, the web server location
+ * (www.gnu.org) and the index.html location on the server).
+ * 
  * @author Tom Tromey ([EMAIL PROTECTED])
  */
 public class CompositeName implements Name, Cloneable, Serializable
 {
   private static final long serialVersionUID = 1667768148915813118L;
+  
+  private transient Vector elts;  
 
   public CompositeName ()
   {
@@ -331,6 +338,4 @@
 for (int i = 0; i < elts.size(); i++)
   s.writeObject(elts.get(i));
   }
-
-  private transient Vector elts;
 }
Index: CompoundName.java
===
RCS file: /sources/classpath/classpath/javax/naming/CompoundName.java,v
retrieving revision 1.10
diff -u -r1.10 CompoundName.java
--- CompoundName.java	8 Sep 2005 08:32:35 -	1.10
+++ CompoundName.java	23 May 2006 17:59:09 -
@@ -48,6 +48,10 @@
 import java.util.Vector;
 
 /**
+ * Represents hierarchical names from the single namespace. For instance,
+ * the path /home/audriusa/classpath/file.txt is the compound name, using
+ * the filesystem namespace. 
+ * 
  * @author Tom Tromey ([EMAIL PROTECTED])
  * @date May 16, 2001
  *


[cp-patches] FYI: More complex JTable demo and noticed fixes

2006-05-23 Thread Audrius Meskauskas
This patch adds more controls (two types of combo boxes and slider) to 
our JTable demo and fixes the noticed deviations of they behavior from 
the Sun's GUI. There are still some differences remaining when trying to 
manipulate controls with the keyboard.


2006-05-23  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * examples/gnu/classpath/examples/swing/TableDemo.java:
   (SliderCell): New inner class. (setCustomEditors,
   setInformativeHeaders): New fields. (createContent):
   Rewritten.
   * javax/swing/DefaultCellEditor.java
   (JComboBoxDelegate.shouldSelectCell): New method.
   * javax/swing/JTable.java (editCellAt): Call shouldSelectCell.
   * javax/swing/plaf/basic/BasicTableUI.java
   (MouseInputHandler.mouseClicked): Start editing on a single
   click if the cell editor is not a default cell editor.
Index: examples/gnu/classpath/examples/swing/TableDemo.java
===
RCS file: /sources/classpath/classpath/examples/gnu/classpath/examples/swing/TableDemo.java,v
retrieving revision 1.6
diff -u -r1.6 TableDemo.java
--- examples/gnu/classpath/examples/swing/TableDemo.java	18 Mar 2006 16:24:16 -	1.6
+++ examples/gnu/classpath/examples/swing/TableDemo.java	23 May 2006 18:02:18 -
@@ -39,19 +39,34 @@
 package gnu.classpath.examples.swing;
 
 import java.awt.BorderLayout;
+import java.awt.Component;
 import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.text.DateFormat;
+import java.util.Date;
 
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.DefaultCellEditor;
 import javax.swing.Icon;
+import javax.swing.JComboBox;
 import javax.swing.JComponent;
 import javax.swing.JFrame;
 import javax.swing.JPanel;
+import javax.swing.JScrollBar;
 import javax.swing.JScrollPane;
+import javax.swing.JSlider;
 import javax.swing.JTable;
+import javax.swing.JTextField;
 import javax.swing.SwingUtilities;
+import javax.swing.border.Border;
 import javax.swing.plaf.metal.MetalIconFactory;
 import javax.swing.table.DefaultTableColumnModel;
 import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
 
 /**
  * Displays the editable table. The first column consists of check boxes.
@@ -144,6 +159,77 @@
   }
 
   /**
+   * The scroll bar renderer.
+   */
+  class SliderCell
+  extends AbstractCellEditor
+  implements TableCellEditor, TableCellRenderer
+  {
+/**
+ * The editor bar.
+ */
+JSlider bar;
+
+/**
+ * The renderer bar.
+ */
+JSlider rendererBar;
+
+/**
+ * The border around the bar, if required.
+ */
+Border border = BorderFactory.createLineBorder(table.getGridColor());
+
+SliderCell()
+{
+  bar = new JSlider();
+  bar.setOrientation(JScrollBar.HORIZONTAL);
+  bar.setMinimum(0);
+  bar.setMaximum(rows);  
+  bar.setBorder(border);
+  
+  rendererBar = new JSlider();
+  rendererBar.setMinimum(0);
+  rendererBar.setMaximum(rows);
+  rendererBar.setEnabled(false);
+}
+
+/**
+ * Get the editor.
+ */
+public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected, int row,
+ int column)
+{
+  if (value instanceof Integer)
+bar.setValue(((Integer) value).intValue());
+  return bar;
+}
+
+/**
+ * Get the renderer.
+ */
+public Component getTableCellRendererComponent(JTable table, Object value,
+   boolean isSelected,
+   boolean hasFocus, int row,
+   int column)
+{
+  rendererBar.setValue(((Integer) value).intValue());
+  if (hasFocus)
+rendererBar.setBorder(border);
+  else
+rendererBar.setBorder(null);
+  return rendererBar;
+}
+
+public Object getCellEditorValue()
+{
+  return new Integer(bar.getValue());
+}
+
+  }  
+  
+  /**
* The table being displayed.
*/
   JTable table = new JTable();
@@ -184,23 +270,32 @@
 MetalIconFactory.getTreeComputerIcon(),
 MetalIconFactory.getTreeHardDriveIcon(),
 MetalIconFactory.getTreeFolderIcon(),
-  }; 
+  };
+
+String [] sides = new String[]
+  {
+"north", "south", "east", "west"   
+  };
 
 for (int i = 0; i < values.length; i++)
   {
 values[i] = new Object[cols];
-for (int j = 2; j < cols; j++)
+for (int j = 3; j < cols; j++)
   {
 values[i][j] = "" + ((char) ('a' + j)) + i;
   }
 values [i][0] = i % 2 == 0? Boolean.TRUE : Boolean.FALSE;
-valu

[cp-patches] FYI:Documenting javax.naming

2006-05-23 Thread Audrius Meskauskas

2006-05-23  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * javax/swing/naming/CompositeName.java,
   javax/swing/naming/CompoundName.java:
   Documented.



[cp-patches] FYI: javax.swing.tree.* source formatting fixlets

2006-05-23 Thread David Gilbert
This patch (committed) fixes a few deviations from our coding style (pointed out by 
Checkstyle) in the javax.swing.tree.* package:


2006-05-23  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/tree/AbstractLayoutCache.java: Coding style fixes,
* javax/swing/tree/DefaultMutableTreeNode.java: Likewise,
* javax/swing/tree/DefaultTreeCellRenderer.java: Likewise,
* javax/swing/tree/DefaultTreeModel.java: Likewise,
* javax/swing/tree/DefaultTreeSelectionModel.java: Likewise,
* javax/swing/tree/ExpandVetoException.java: Likewise,
* javax/swing/tree/FixedHeightLayoutCache.java: Likewise,
* javax/swing/tree/RowMapper.java: Likewise,
* javax/swing/tree/TreeNode.java: Likewise,
* javax/swing/tree/TreeSelectionModel.java: Likewise,
* javax/swing/tree/VariableHeightLayoutCache.java: Likewise.

Regards,

Dave
Index: javax/swing/tree/AbstractLayoutCache.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/tree/AbstractLayoutCache.java,v
retrieving revision 1.11
diff -u -r1.11 AbstractLayoutCache.java
--- javax/swing/tree/AbstractLayoutCache.java   21 Apr 2006 10:13:12 -  
1.11
+++ javax/swing/tree/AbstractLayoutCache.java   23 May 2006 15:53:44 -
@@ -1,5 +1,5 @@
 /* AbstractLayoutCache.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006,  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,13 +38,10 @@
 
 package javax.swing.tree;
 
-import gnu.classpath.NotImplementedException;
-
 import java.awt.Rectangle;
 import java.util.Enumeration;
 
 import javax.swing.event.TreeModelEvent;
-import javax.swing.tree.VariableHeightLayoutCache.NodeRecord;
 
 /**
  * class AbstractLayoutCache
@@ -275,7 +272,7 @@
 for (int i = 0; i < n; i++)
   {
 TreePath path = getPathForRow(i);
-r.setBounds(0,0,0,0);
+r.setBounds(0, 0, 0, 0);
 r = getBounds(path, r);
 if (r.x + r.width > maximalWidth)
   maximalWidth = r.x + r.width;
Index: javax/swing/tree/DefaultMutableTreeNode.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultMutableTreeNode.java,v
retrieving revision 1.16
diff -u -r1.16 DefaultMutableTreeNode.java
--- javax/swing/tree/DefaultMutableTreeNode.java26 Apr 2006 09:03:10 
-  1.16
+++ javax/swing/tree/DefaultMutableTreeNode.java23 May 2006 15:53:45 
-
@@ -887,8 +887,7 @@
   return false;
 if (node == this)
   return true;
-return (node.getParent() == getParent()
-&& getParent() != null);
+return node.getParent() == getParent() && getParent() != null;
   }
 
   /**
@@ -1070,7 +1069,7 @@
 
   public Object nextElement()
   {
-  if(queue.isEmpty())
+  if (queue.isEmpty())
   throw new NoSuchElementException("No more elements left.");
 
   TreeNode node = (TreeNode) queue.removeFirst();
@@ -1105,7 +1104,7 @@
 
   public Object nextElement()
   {
-  if( next == null )
+  if (next == null)
   throw new NoSuchElementException("No more elements left.");
 
   Object current = next;
@@ -1121,7 +1120,7 @@
   private TreeNode traverse(Enumeration children)
   {
   // If more children are available step down.
-  if( children.hasMoreElements() )
+  if (children.hasMoreElements())
   {
   TreeNode child = (TreeNode) children.nextElement();
   childrenEnums.push(child.children());
@@ -1134,7 +1133,7 @@
 
   // If there are no more levels left, there is no next
   // element to return.
-  if ( childrenEnums.isEmpty() )
+  if (childrenEnums.isEmpty())
   return null;
   else
   {
@@ -1165,7 +1164,7 @@
 
public Object nextElement()
{
-   if( nodes.isEmpty() )
+   if (nodes.isEmpty())
throw new NoSuchElementException("No more elements left!");
 
Enumeration children = (Enumeration) childrenEnums.peek();
@@ -1175,7 +1174,7 @@
 
private Object traverse(Enumeration children)
{
-   if ( children.hasMoreElements() )
+   if (children.hasMoreElements())
{
TreeNode node = (TreeNode) children.nextElement();
nodes.push(node);
Index: javax/swing/tree/DefaultTreeCellRenderer.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultTreeCellRenderer.java,v
retrieving revision 1.25
diff -u -r1.25 DefaultTreeCellRenderer.java
--- javax/swing/tree/DefaultTreeCellRenderer.java   23 May 2006 15:27:19 
-  1.25
+++ javax/swing/tree/DefaultTreeCellRenderer.java   23 May 2006 1

Re: [cp-patches] RFC: GdkScreenGraphicsDevice et all implementation - preview patch

2006-05-23 Thread Thomas Fitzsimmons

Sven de Marothy wrote:

On Mon, 2006-05-22 at 22:53 +0200, Robert Schuster wrote:


The way its done now is pretty simple and there is much room for enhancement.
However I want to have some feedback on the current state because I am new to
Gdk/Gtk+ and Xlib/XRandR programming and had to work myself into the goodness of
Classpath' "Magical NSA API" ... ;)


I'm not sure we should use the NSA stuff for new code. I personally
don't think it's a very good solution. It obfuscates where the actual
data is at behind an undocumented and unintuitive set of macros. It also
makes it harder to see what native data structures the java classes map
to. It's one of the things that makes understanding and working on the
Gtk peers more difficult. The Pointer/Pointer32/Pointer64 classes also
do their job in contributing. 


Storing the native pointer as a simple long field works just fine on any
platform. I don't see the point of not Keeping It Simple.


Agreed, and I think we should replace existing NSA code with the simpler long 
field approach.  Ideally we could remove the NSA implementation altogether.  I'd 
also like to see Pointer/Pointer32/Pointer64 gone but they seem to be used in 
places other than the peers.


Tom




[cp-patches] FYI: DefaultTreeCellRenderer.java - small fix + API docs

2006-05-23 Thread David Gilbert
This patch (committed) makes a minor change in the constructor (the look-up key for 
a UI default) and adds API docs all over:


2006-05-23  David Gilbert  <[EMAIL PROTECTED]>

* javax/swing/tree/DefaultTreeCellRenderer.java
(DefaultTreeCellRenderer): Changed key for
setBackgroundNonSelectionColor(),
plus API docs all over.

Regards,

Dave
Index: javax/swing/tree/DefaultTreeCellRenderer.java
===
RCS file: 
/sources/classpath/classpath/javax/swing/tree/DefaultTreeCellRenderer.java,v
retrieving revision 1.24
diff -u -r1.24 DefaultTreeCellRenderer.java
--- javax/swing/tree/DefaultTreeCellRenderer.java   26 Apr 2006 12:31:08 
-  1.24
+++ javax/swing/tree/DefaultTreeCellRenderer.java   23 May 2006 15:17:19 
-
@@ -1,5 +1,5 @@
 /* DefaultTreeCellRenderer.java 
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
  
  This file is part of GNU Classpath.
 
@@ -47,16 +47,17 @@
 import java.awt.Insets;
 import java.awt.Rectangle;
 
-import javax.swing.border.Border;
 import javax.swing.Icon;
 import javax.swing.JLabel;
 import javax.swing.JTree;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
 import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
 import javax.swing.plaf.UIResource;
 
 /**
- * DefaultTreeCellRenderer
+ * A default implementation of the [EMAIL PROTECTED] TreeCellRenderer} 
interface.
  * 
  * @author Andrew Selkirk
  */
@@ -64,71 +65,81 @@
   extends JLabel
   implements TreeCellRenderer
 {
-  // -
-  // Variables --
-  // -
 
   /**
-   * selected
+   * A flag indicating the current selection status.
*/
   protected boolean selected;
 
   /**
-   * hasFocus
+   * A flag indicating the current focus status.
*/
   protected boolean hasFocus;
 
   /**
-   * drawsFocusBorderAroundIcon
+   * drawsFocusBorderAroundIcon  // FIXME: is this used?
*/
   private boolean drawsFocusBorderAroundIcon;
 
   /**
-   * closedIcon
+   * The icon used to represent non-leaf nodes that are closed.
+   * 
+   * @see #setClosedIcon(Icon)
*/
   protected transient Icon closedIcon;
 
   /**
-   * leafIcon
+   * The icon used to represent leaf nodes.
+   * 
+   * @see #setLeafIcon(Icon)
*/
   protected transient Icon leafIcon;
 
   /**
-   * openIcon
+   * The icon used to represent non-leaf nodes that are open.
+   * 
+   * @see #setOpenIcon(Icon)
*/
   protected transient Icon openIcon;
 
   /**
-   * textSelectionColor
+   * The color used for text in selected cells.
+   * 
+   * @see #setTextSelectionColor(Color)
*/
   protected Color textSelectionColor;
 
   /**
-   * textNonSelectionColor
+   * The color used for text in non-selected cells.
+   * 
+   * @see #setTextNonSelectionColor(Color)
*/
   protected Color textNonSelectionColor;
 
   /**
-   * backgroundSelectionColor
+   * The background color for selected cells.
+   * 
+   * @see #setBackgroundSelectionColor(Color)
*/
   protected Color backgroundSelectionColor;
 
   /**
-   * backgroundNonSelectionColor
+   * The background color for non-selected cells.
+   * 
+   * @see #setBackgroundNonSelectionColor(Color)
*/
   protected Color backgroundNonSelectionColor;
 
   /**
-   * borderSelectionColor
+   * The border color for selected tree cells.
+   * 
+   * @see #setBorderSelectionColor(Color)
*/
   protected Color borderSelectionColor;
 
-  // -
-  // Initialization -
-  // -
-
   /**
-   * Constructor DefaultTreeCellRenderer
+   * Creates a new tree cell renderer with defaults appropriate for the 
+   * current [EMAIL PROTECTED] LookAndFeel}.
*/
   public DefaultTreeCellRenderer()
   {
@@ -138,19 +149,17 @@
 
 setTextNonSelectionColor(UIManager.getColor("Tree.textForeground"));
 setTextSelectionColor(UIManager.getColor("Tree.selectionForeground"));
-
setBackgroundNonSelectionColor(UIManager.getColor("Tree.nonSelectionBackground"));
+setBackgroundNonSelectionColor(UIManager.getColor("Tree.textBackground"));
 
setBackgroundSelectionColor(UIManager.getColor("Tree.selectionBackground"));
 setBorderSelectionColor(UIManager.getColor("Tree.selectionBorderColor"));
   }
 
-  // -
-  // Methods 
-  // -
-
   /**
-   * getDefaultOpenIcon
+   * Returns the default icon for non-leaf tree cells that are open (expanded).
+   * The icon is fetched from the defaults tab

[cp-patches] Classpath 0.91 startup exception

2006-05-23 Thread Archie Cobbs

After upgradeing JCVM to 0.91, I'm seeing an exception due to broken
static initializer ordering in java.lang.VMClassLoader. The "bootjars"
static field is initialized on line 173, but this is after its use
(indirectly) in the static initializer that starts on line 83.

Here's a stack trace:

 java.lang.NullPointerException
   at java.lang.VMThrowable.fillInStackTrace(Native Method)
   at java.lang.Throwable.fillInStackTrace(Throwable.java:498)
   at java.lang.Throwable.(Throwable.java:159)
   at java.lang.Exception.(Exception.java:78)
   at java.lang.RuntimeException.(RuntimeException.java:76)
   at java.lang.NullPointerException.(NullPointerException.java:80)
   at java.lang.VMClassLoader.getResources(VMClassLoader.java:206)
   at java.lang.VMClassLoader.getResource(VMClassLoader.java:166)
   at java.lang.VMClassLoader.getBootPackages(VMClassLoader.java:252)
   at java.lang.VMClassLoader.(VMClassLoader.java:76)
   at java.lang.Integer.(Integer.java:81)
   at java.lang.String.valueOf(String.java:1756)
   at java.lang.StringBuffer.append(StringBuffer.java:530)
   at gnu.java.nio.channels.FileChannelImpl.(FileChannelImpl.java:157)
   at gnu.java.nio.channels.FileChannelImpl.(FileChannelImpl.java:91)
   at java.io.FileDescriptor.(FileDescriptor.java:63)
   at java.lang.VMSystem.makeStandardInputStream(VMSystem.java:186)
   at java.lang.System.(System.java)
   at java.lang.Math.(Math.java:71)
   at java.util.WeakHashMap.hash(WeakHashMap.java:575)
   at java.util.WeakHashMap.internalGet(WeakHashMap.java:652)
   at java.util.WeakHashMap.get(WeakHashMap.java:760)
   at java.lang.VMString.intern(VMString.java:77)
   at java.lang.String.intern(String.java:1806)
   at java.lang.String.(String.java)

Note the call to String.intern() (second line from the bottom in the
stack trace) is generated by the VM to handle creation of a String
constant. Although VM-specific, this is unrelated to the initialization
ordering problem in VMClassLoader.

This is fixed by the attached patch, which I'll commit if there are
no objections... but with that fix, I don't get much further:

Caused by java.lang.NullPointerException
   at java.lang.VMThrowable.fillInStackTrace(Native Method)
   at java.lang.Throwable.fillInStackTrace(Throwable.java:498)
   at java.lang.Throwable.(Throwable.java:159)
   at java.lang.Exception.(Exception.java:78)
   at java.lang.RuntimeException.(RuntimeException.java:76)
   at java.lang.NullPointerException.(NullPointerException.java:80)
   at java.lang.Thread.getThreadLocals(Thread.java:1032)
   at java.lang.ThreadLocal.get(ThreadLocal.java)
   at java.security.VMAccessController.pushContext(VMAccessController.java:108)
   at java.security.AccessController.doPrivileged(AccessController.java:93)
   at gnu.java.nio.charset.Provider.provider(Provider.java:237)
   at java.nio.charset.Charset.provider(Charset.java:250)
   at java.nio.charset.Charset.charsetForName(Charset.java:204)
   at java.nio.charset.Charset.forName(Charset.java:188)
   at java.lang.String.(String.java:348)
   at java.util.zip.ZipFile$PartialInputStream.readString(ZipFile.java:668)
   at java.util.zip.ZipFile.readEntries(ZipFile.java:272)
   at java.util.zip.ZipFile.getEntries(ZipFile.java:357)
   at java.util.zip.ZipFile.getEntry(ZipFile.java:378)
   at java.lang.VMClassLoader.getResources(VMClassLoader.java:226)
   at java.lang.VMClassLoader.getResource(VMClassLoader.java:170)
   at java.lang.VMClassLoader.getBootPackages(VMClassLoader.java:252)
   at java.lang.VMClassLoader.(VMClassLoader.java:79)
   at java.lang.Integer.(Integer.java:81)
   at java.lang.String.valueOf(String.java:1756)
   at java.lang.StringBuffer.append(StringBuffer.java:530)
   at gnu.java.nio.channels.FileChannelImpl.(FileChannelImpl.java:157)
   at gnu.java.nio.channels.FileChannelImpl.(FileChannelImpl.java:91)
   at java.io.FileDescriptor.(FileDescriptor.java:63)
   at java.lang.VMSystem.makeStandardInputStream(VMSystem.java:186)
   at java.lang.System.(System.java)
   at java.lang.Math.(Math.java:71)
   at java.util.WeakHashMap.hash(WeakHashMap.java:575)
   at java.util.WeakHashMap.internalGet(WeakHashMap.java:652)
   at java.util.WeakHashMap.get(WeakHashMap.java:760)
   at java.lang.VMString.intern(VMString.java:77)
   at java.lang.String.intern(String.java:1806)
   at java.lang.String.(String.java)

I haven't investigated the second problem  yet...

I'm very curious though.. why is nobody else seeing these problems??
It doesn't seem VM-specific but maybe I'm missing something.

Thanks,
-Archie

__
Archie Cobbs  *CTO, Awarix*  http://www.awarix.com
Index: ChangeLog
===
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7530
diff -u -r1.7530 ChangeLog
--- ChangeLog   23 May 2006 12:53:20 -  1.7530
+++ ChangeLog   23 May 2006 14:53:19 -
@@ -1,3 +1,8 @@
+2006-05-23  Archie Co

[cp-patches] FYI: The first part of the 27680 fix

2006-05-23 Thread Audrius Meskauskas

2006-05-23  Audrius Meskauskas  <[EMAIL PROTECTED]>
   
   PR 27680

   * javax/swing/JTable.java (BooleanCellRenderer, IconCellRenderer):
   Set horizontal alignment to centered.
Index: JTable.java
===
RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.106
diff -u -r1.106 JTable.java
--- JTable.java	22 May 2006 10:18:05 -	1.106
+++ JTable.java	23 May 2006 10:27:05 -
@@ -1045,7 +1045,17 @@
 /**
  * The CheckBox that is used for rendering.
  */
-private final JCheckBox checkBox = new JCheckBox();
+private final JCheckBox checkBox;
+
+/**
+ * Creates a new checkbox based boolean cell renderer. The checkbox is
+ * centered by default.
+ */
+BooleanCellRenderer()
+{
+   checkBox = new JCheckBox();
+   checkBox.setHorizontalAlignment(SwingConstants.CENTER);
+}

 /**
  * Get the check box.
@@ -1251,6 +1261,12 @@
   private class IconCellRenderer
 extends DefaultTableCellRenderer
   {
+IconCellRenderer()
+{
+  setHorizontalAlignment(SwingConstants.CENTER);
+}
+
+
 /**
  * Returns the component that is used for rendering the value.
  *


[cp-patches] FYI:The remaining part of the 27680 fix.

2006-05-23 Thread Audrius Meskauskas

2006-05-23  Audrius Meskauskas  <[EMAIL PROTECTED]>
   
   PR 27680

   * javax/swing/JTable.java (booleanInvertingEditor): New field.
   (defaultEditorsByColumnClass, defaultRenderersByColumnClass):
   Initialise in constructor. (columnMoved): Cancel editing.
   (createDefaultEditors): Rewritten. (editCellAt):
   Just invert the value if this is a boolean cell.
   (initialiseLocalVars): Do not initialise renderer and editor tables.
   (setUI): Create editors and renderers here.
Index: JTable.java
===
RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.107
diff -u -r1.107 JTable.java
--- JTable.java	23 May 2006 10:34:02 -	1.107
+++ JTable.java	23 May 2006 12:47:21 -
@@ -1368,14 +1368,14 @@
* [EMAIL PROTECTED] TableCellEditor} objects. This table is consulted by the 
* FIXME
*/
-  protected Hashtable defaultEditorsByColumnClass;
+  protected Hashtable defaultEditorsByColumnClass = new Hashtable();
 
   /**
* A table mapping [EMAIL PROTECTED] java.lang.Class} objects to 
* [EMAIL PROTECTED] TableCellEditor} objects. This table is consulted by the 
* FIXME
*/
-  protected Hashtable defaultRenderersByColumnClass;
+  protected Hashtable defaultRenderersByColumnClass = new Hashtable();
 
   /**
* The column that is edited, -1 if the table is not edited currently.
@@ -1634,7 +1634,13 @@
* @see #setRowHeight(int, int)
*/
   private SizeSequence rowHeights;
-
+  
+  /**
+   * This editor serves just a marker that the value must be simply changed to
+   * the opposite one instead of starting the editing session.
+   */
+  private transient TableCellEditor booleanInvertingEditor; 
+  
   /**
* Creates a new JTable instance.
*/
@@ -1767,12 +1773,6 @@
 if (autoCreateColumnsFromModel)
   createDefaultColumnsFromModel();
 this.columnModel.addColumnModelListener(this);
-
-this.defaultRenderersByColumnClass = new Hashtable();
-createDefaultRenderers();
-
-this.defaultEditorsByColumnClass = new Hashtable();
-createDefaultEditors();
 
 this.autoResizeMode = AUTO_RESIZE_SUBSEQUENT_COLUMNS;
 setRowHeight(16);
@@ -1821,7 +1821,10 @@
   protected void createDefaultEditors()
   {
 JCheckBox box = new BooleanCellRenderer().getCheckBox();
-setDefaultEditor(Boolean.class, new DefaultCellEditor(box));
+box.setBorder(BorderFactory.createLineBorder(getGridColor(), 2));
+box.setBorderPainted(true);
+booleanInvertingEditor = new DefaultCellEditor(box);
+setDefaultEditor(Boolean.class, booleanInvertingEditor);
   }
   
   /**
@@ -1919,6 +1922,8 @@
*/
   public void columnMoved (TableColumnModelEvent event)
   {
+if (isEditing())
+  editingCanceled(null);
 revalidate();
 repaint();
   }
@@ -3494,6 +3499,10 @@
   public void setUI(TableUI ui)
   {
 super.setUI(ui);
+// The editors and renderers must be recreated because they constructors
+// may use the look and feel properties.
+createDefaultEditors();
+createDefaultRenderers();
   }
 
   public void updateUI()
@@ -3859,30 +3868,45 @@
 
   /**
* Programmatically starts editing the specified cell.
-   *
+   * 
* @param row the row of the cell to edit.
* @param column the column of the cell to edit.
*/
-  public boolean editCellAt (int row, int column)
+  public boolean editCellAt(int row, int column)
   {
 // Complete the previous editing session, if still active.
 if (isEditing())
   editingStopped(new ChangeEvent("editingStopped"));
-
-editingRow = row;
-editingColumn = column;
 
-setCellEditor(getCellEditor(row, column));
-editorComp = prepareEditor(cellEditor, row, column);
+TableCellEditor editor = getCellEditor(row, column);
 
-// Remove the previous editor components, if present. Only one
-// editor component at time is allowed in the table.
-removeAll();
-add(editorComp);
-moveToCellBeingEdited(editorComp);
-scrollRectToVisible(editorComp.getBounds());
-editorComp.requestFocusInWindow();
-return true;
+// The boolean values are inverted by the single click without the
+// real editing session.
+if (editor == booleanInvertingEditor && isCellEditable(row, column))
+  {
+if (Boolean.TRUE.equals(getValueAt(row, column)))
+  setValueAt(Boolean.FALSE, row, column);
+else
+  setValueAt(Boolean.TRUE, row, column);
+return false;
+  }
+else
+  {
+editingRow = row;
+editingColumn = column;
+
+setCellEditor(editor);
+editorComp = prepareEditor(cellEditor, row, column);
+
+// Remove the previous editor components, if present. Only one
+// editor component at time is allowed in the table.
+removeAll();
+add(editorComp);
+moveToCellBeingEdited(editorComp);
+scrollRectToVisible(editorComp.getBounds());

Re: [cp-patches] RFC: GdkScreenGraphicsDevice et all implementation - preview patch

2006-05-23 Thread Thomas Fitzsimmons

Thomas Fitzsimmons wrote:

Sven de Marothy wrote:

On Mon, 2006-05-22 at 22:53 +0200, Robert Schuster wrote:

The way its done now is pretty simple and there is much room for 
enhancement.
However I want to have some feedback on the current state because I 
am new to
Gdk/Gtk+ and Xlib/XRandR programming and had to work myself into the 
goodness of

Classpath' "Magical NSA API" ... ;)


I'm not sure we should use the NSA stuff for new code. I personally
don't think it's a very good solution. It obfuscates where the actual
data is at behind an undocumented and unintuitive set of macros. It also
makes it harder to see what native data structures the java classes map
to. It's one of the things that makes understanding and working on the
Gtk peers more difficult. The Pointer/Pointer32/Pointer64 classes also
do their job in contributing.
Storing the native pointer as a simple long field works just fine on any
platform. I don't see the point of not Keeping It Simple.


Agreed, and I think we should replace existing NSA code with the simpler 
long field approach.  Ideally we could remove the NSA implementation 
altogether.  I'd also like to see Pointer/Pointer32/Pointer64 gone but 
they seem to be used in places other than the peers.


I should have said: Robert: go ahead and commit your NSA-using patch when it's 
ready -- I don't want to delay it.  After it's committed we can look at 
replacing all NSA code in one big patch.


Tom




Re: [cp-patches] RFC: GdkScreenGraphicsDevice et all implementation - preview patch

2006-05-23 Thread Robert Schuster
I have no problem with that.

How is that Pointer API supposed to be used?

cya
Robert

Sven de Marothy wrote:
> On Mon, 2006-05-22 at 22:53 +0200, Robert Schuster wrote:
> 
> 
>>The way its done now is pretty simple and there is much room for enhancement.
>>However I want to have some feedback on the current state because I am new to
>>Gdk/Gtk+ and Xlib/XRandR programming and had to work myself into the goodness 
>>of
>>Classpath' "Magical NSA API" ... ;)
> 
> 
> I'm not sure we should use the NSA stuff for new code. I personally
> don't think it's a very good solution. It obfuscates where the actual
> data is at behind an undocumented and unintuitive set of macros. It also
> makes it harder to see what native data structures the java classes map
> to. It's one of the things that makes understanding and working on the
> Gtk peers more difficult. The Pointer/Pointer32/Pointer64 classes also
> do their job in contributing. 
> 
> Storing the native pointer as a simple long field works just fine on any
> platform. I don't see the point of not Keeping It Simple.
> 
> /Sven
> 
> 
> 


signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] FYI: Switching resolutions demo

2006-05-23 Thread Robert Schuster
Hi,
this patch was discarded. I committed a different one.

cya
Robert

Robert Schuster wrote:
> Hi,
> this patch adds a subdemo to the AWT Demo application which shows how nice we
> can switch the screen resolution (soon :) ).
> 
> ChangeLog:
> 
> 2006-05-23  Robert Schuster  <[EMAIL PROTECTED]>
> 
> * examples/gnu/classpath/examples/awt/Demo.java:
> (MainWindow.MainWindow): Added ResolutionWindow instance as subframe.
> (ResolutionWindow): New inner class.
> 
> cya
> Robert
> 
> 
> 
> 
> Index: examples/gnu/classpath/examples/awt/Demo.java
> ===
> RCS file: 
> /cvsroot/classpath/classpath/examples/gnu/classpath/examples/awt/Demo.java,v
> retrieving revision 1.5
> diff -u -r1.5 Demo.java
> --- examples/gnu/classpath/examples/awt/Demo.java 16 Mar 2006 03:28:12 
> -  1.5
> +++ examples/gnu/classpath/examples/awt/Demo.java 23 May 2006 10:33:13 
> -
> @@ -154,6 +154,7 @@
>addSubWindow ("RandomTests", new TestWindow (this));
>addSubWindow ("RoundRect", new RoundRectWindow ());
>addSubWindow ("Animation", new AnimationWindow ());
> +  addSubWindow ("Resolution", new ResolutionWindow ());
>  
>Panel sp = new Panel();
>PrettyPanel p = new PrettyPanel();
> @@ -744,6 +745,56 @@
>t.beep();
>  }
>}
> +  
> +  static class ResolutionWindow extends SubFrame
> +  {
> +GraphicsDevice gd = 
> GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
> +
> +public void init ()
> +{
> +  setTitle("Change Screen Resolution");
> +  final List list = new List();
> +  DisplayMode[] modes = gd.getDisplayModes();
> +  
> +  for (int i=0;i +list.add(modes[i].getWidth()  + "x"
> + + modes[i].getHeight()
> + + ((modes[i].getBitDepth() != DisplayMode.BIT_DEPTH_MULTI)
> +   ? "x" + modes[i].getBitDepth() + "bpp"
> +   : "")
> + + ((modes[i].getRefreshRate() != 
> DisplayMode.REFRESH_RATE_UNKNOWN)
> +   ? "@" + modes[i].getRefreshRate() + "Hz"
> +   : ""));
> +  
> +  ActionListener al = new ActionListener()
> +  {
> +public void actionPerformed(ActionEvent ae)
> +{
> +  int i = list.getSelectedIndex();
> +  gd.setDisplayMode(gd.getDisplayModes()[i]);
> +}
> +  };
> +  
> +  Button b = new Button("Switch");
> +  Button c = new Button("Close");
> +  
> +  list.addActionListener(al);
> +  b.addActionListener(al);
> +  
> +  c.addActionListener(new ActionListener () {
> +public void actionPerformed (ActionEvent e) {
> +  dispose();
> +}
> +  });
> +  
> +  setLayout(new GridLayout(3, 1, 5, 5));
> +  add(list);
> +  add(b);
> +  add(c);
> +  
> +  pack();
> +}
> +  }
>  
>static class RoundRectWindow extends SubFrame
>{


signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Switching resolutions (& fullscreen exclusive mode) demo

2006-05-23 Thread Robert Schuster
Hi,
this patch adds a subdemo to the AWT Demo application which shows how nice we
can switch the screen resolution and use the Full Screen Exclusive Mode API
(soon :) )

ChangeLog:

2006-05-23  Robert Schuster  <[EMAIL PROTECTED]>

* examples/gnu/classpath/examples/awt/Demo.java:
(MainWindow.MainWindow): Added ResolutionWindow and FullscreenWindow
instance as subframe.
(ResolutionWindow): New inner class.
(FullscreenWindow): New inner class.

cya
Robert

Index: examples/gnu/classpath/examples/awt/Demo.java
===
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/awt/Demo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- examples/gnu/classpath/examples/awt/Demo.java	16 Mar 2006 03:28:12 -	1.5
+++ examples/gnu/classpath/examples/awt/Demo.java	23 May 2006 10:45:33 -	1.6
@@ -154,6 +154,8 @@
   addSubWindow ("RandomTests", new TestWindow (this));
   addSubWindow ("RoundRect", new RoundRectWindow ());
   addSubWindow ("Animation", new AnimationWindow ());
+  addSubWindow ("Resolution", new ResolutionWindow ());
+  addSubWindow ("Fullscreen", new FullscreenWindow ());
 
   Panel sp = new Panel();
   PrettyPanel p = new PrettyPanel();
@@ -744,6 +746,99 @@
   t.beep();
 }
   }
+  
+  static class ResolutionWindow extends SubFrame
+  {
+GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+
+public void init ()
+{
+  initted = true;
+  
+  setTitle("Change Screen Resolution");
+  final List list = new List();
+  DisplayMode[] modes = gd.getDisplayModes();
+  
+  for (int i=0;i

signature.asc
Description: OpenPGP digital signature


[cp-patches] FYI: Switching resolutions demo

2006-05-23 Thread Robert Schuster
Hi,
this patch adds a subdemo to the AWT Demo application which shows how nice we
can switch the screen resolution (soon :) ).

ChangeLog:

2006-05-23  Robert Schuster  <[EMAIL PROTECTED]>

* examples/gnu/classpath/examples/awt/Demo.java:
(MainWindow.MainWindow): Added ResolutionWindow instance as subframe.
(ResolutionWindow): New inner class.

cya
Robert
Index: examples/gnu/classpath/examples/awt/Demo.java
===
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/awt/Demo.java,v
retrieving revision 1.5
diff -u -r1.5 Demo.java
--- examples/gnu/classpath/examples/awt/Demo.java	16 Mar 2006 03:28:12 -	1.5
+++ examples/gnu/classpath/examples/awt/Demo.java	23 May 2006 10:33:13 -
@@ -154,6 +154,7 @@
   addSubWindow ("RandomTests", new TestWindow (this));
   addSubWindow ("RoundRect", new RoundRectWindow ());
   addSubWindow ("Animation", new AnimationWindow ());
+  addSubWindow ("Resolution", new ResolutionWindow ());
 
   Panel sp = new Panel();
   PrettyPanel p = new PrettyPanel();
@@ -744,6 +745,56 @@
   t.beep();
 }
   }
+  
+  static class ResolutionWindow extends SubFrame
+  {
+GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+
+public void init ()
+{
+  setTitle("Change Screen Resolution");
+  final List list = new List();
+  DisplayMode[] modes = gd.getDisplayModes();
+  
+  for (int i=0;i

signature.asc
Description: OpenPGP digital signature


Re: [cp-patches] RFC: GdkScreenGraphicsDevice et all implementation - preview patch

2006-05-23 Thread Sven de Marothy
On Mon, 2006-05-22 at 22:53 +0200, Robert Schuster wrote:

> The way its done now is pretty simple and there is much room for enhancement.
> However I want to have some feedback on the current state because I am new to
> Gdk/Gtk+ and Xlib/XRandR programming and had to work myself into the goodness 
> of
> Classpath' "Magical NSA API" ... ;)

I'm not sure we should use the NSA stuff for new code. I personally
don't think it's a very good solution. It obfuscates where the actual
data is at behind an undocumented and unintuitive set of macros. It also
makes it harder to see what native data structures the java classes map
to. It's one of the things that makes understanding and working on the
Gtk peers more difficult. The Pointer/Pointer32/Pointer64 classes also
do their job in contributing. 

Storing the native pointer as a simple long field works just fine on any
platform. I don't see the point of not Keeping It Simple.

/Sven