[cp-patches] Patch: FYI: KeyPairGenerator problems

2005-08-09 Thread Casey Marshall
This fixes some problems with Classpath's DSA key pair generator, and  
removes a useless self-recursive call from KeyPairGenerator.


This patch should fix classpath bugs 22990 and 23120, and has the  
benefit of actually producing good key pairs.


Note that the DSAKeyPairGenerator class should be reformatted, but  
isn't here; I'll follow up sometime with a patch to fix this, and  
some of the rest of the fugly code in gnu.java.security.


2005-08-08  Casey Marshall  [EMAIL PROTECTED]

PR classpath/23120
* gnu/java/security/provider/DSAKeyPairGenerator.java
(init): made public; set default values.
(initialize): just call 'initialize(int,boolean,SecureRandom).'
(initialize): just call 'initialize(DSAParams,SecureRandom).'
(initialize): check all values for 'null' before overwriting.
(initialize): fill in defaults or generate new parameters here.
(generateKeyPair): don't create parameters; fill in 'random' if
'null;' use 'random,' not a new Random object, when generating
random numbers.
(getDefaults): fix keysize check.

PR classpath/22990
* java/security/KeyPairGenerator.java (initialize): do nothing.

Committed,

Index: gnu/java/security/provider/DSAKeyPairGenerator.java
===
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/provider/DSAKeyPairGenerator.java,v
retrieving revision 1.5
diff -u -b -B -r1.5 DSAKeyPairGenerator.java
--- gnu/java/security/provider/DSAKeyPairGenerator.java 2 Jul 2005 20:32:14 
-   1.5
+++ gnu/java/security/provider/DSAKeyPairGenerator.java 9 Aug 2005 05:48:00 
-
@@ -1,5 +1,5 @@
 /* GnuDSAKeyPairGenerator.java --- Gnu DSA Key Pair Generator
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -45,10 +45,12 @@
 import java.security.InvalidParameterException;
 import java.security.KeyPair;
 import java.security.KeyPairGeneratorSpi;
+import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
 import java.security.interfaces.DSAParams;
 import java.security.spec.AlgorithmParameterSpec;
 import java.security.spec.DSAParameterSpec;
+import java.security.spec.InvalidParameterSpecException;
 import java.util.Random;
 
 public class DSAKeyPairGenerator extends KeyPairGeneratorSpi 
@@ -60,18 +62,15 @@
 private BigInteger p = null; // the big prime
 private BigInteger g = null;
 
-DSAKeyPairGenerator()
+public DSAKeyPairGenerator()
 {
keysize = 1024;
+getDefaults ();
 }
 
 public void initialize(int keysize, SecureRandom random)
 {
-   //if( ((keysize % 64) != 0) || (keysize  512) || (keysize  1024) )
-//throw new InvalidAlgorithmParameterException(Invalid key 
size);
-
-   this.keysize = keysize;
-   this.random = random;
+initialize (keysize, false, random);
 }
 
 public void initialize(AlgorithmParameterSpec params,
@@ -81,65 +80,87 @@
if( !( params instanceof DSAParameterSpec ) )
throw new InvalidAlgorithmParameterException(Must be 
DSAParameterSpec);
 
+try
+{
+initialize ((DSAParams) params, random);
+}
+catch (InvalidParameterException ipe)
+{
+InvalidAlgorithmParameterException iape =
+new InvalidAlgorithmParameterException();
+iape.initCause (ipe);
+throw iape;
+}
+}
+
+public void initialize (DSAParams params, SecureRandom random)
+{
DSAParameterSpec dsaparameterspec = (DSAParameterSpec)params;
+if (dsaparameterspec.getP() == null
+|| dsaparameterspec.getQ() == null
+|| dsaparameterspec.getG() == null)
+{
+throw new InvalidParameterException (none of p, q, or g may 
be null);
+}
p = dsaparameterspec.getP();
q = dsaparameterspec.getQ();
g = dsaparameterspec.getG();
this.random = random;
 }
 
-public void initialize(DSAParams params, SecureRandom random) 
-   throws InvalidParameterException
-{
-   if(params.getP() != null) 
-   p = params.getP();
-   else
-   throw new InvalidParameterException();
-
-   if(params.getQ() != null) 
-   q = params.getQ();
-   else
-   throw new InvalidParameterException();
-   
-   if(params.getG() != null) 
-   g = params.getG();
-   else
-   throw new InvalidParameterException();
-   
-   this.random = random;
-}
-
 public void initialize(int modlen, boolean genParams, SecureRandom random) 
throws InvalidParameterException
 {
if( ((modlen % 64) != 0) || (modlen  512) || (modlen  1024) )
 throw new InvalidParameterException();
 
-   if( (genParams == false)  (modlen != 512)  (modlen != 768)  
(modlen != 1024)  )
-   

RE: [cp-patches] [RFC/JDWP] ClassLoaderReferenceCommandSet

2005-08-09 Thread Jeroen Frijters
Archie Cobbs wrote:
 Aaron Luchko wrote:
  There's only a single command which asks for a list of 
 every class the
  ClassLoader has been requested to load. The first way to do 
 this is just
  use a hook in the vm. I don't know enough with how ClassLoaders are
  handled within the vm to know how easy this would be to implement.
  
  The second method involves a patch to ClassLoader which 
 adds a single
  variable loadRequests which will store every Class that is 
 requested to
  be loaded.
 
 I'd strongly vote for option #1, i.e., just ask the VM directly.
 VMs that want to support this stuff are going to have to implement
 a lot of other native methods too, and this one should be fairly easy.

I strongly agree with Archie. Also, approach #2 is incorrect, because
the classes that should be returned are the classes for which this
class loader has been recorded as the initiating loader. The class
loader doesn't know whether it is the initiating loader or not, only the
VM knows this.

Regards,
Jeroen


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: CORBA doc update.

2005-08-09 Thread Meskauskas Audrius

2005-08-09  Audrius Meskauskas  [EMAIL PROTECTED]

* org/omg/CORBA/package.html: Documentation update.
* org/omg/DynamicAny/package.html: New file.

Title: GNU Classpath - org.omg.DynamicAny







DynAny's allow to work with data structures, exact content of those is not
known at the time of compilation. In this way, the conception of DynAny 
remebers the java reflection mechanism. DynAny usually obtain the value from
the [EMAIL PROTECTED] org.omg.CORBA.Any} that, if needed, can carry highly nested data
structures (like array of sequences of unions). DynAny's allow to see/modify
all parts of such structures. This is especially helpful for writing generic
servers (bridges, event channels supporting, filtering and so on). Similarly,
DynAny's can create an Any at runtime, without having static knowledge of its
type. This is helpful for writing generic clients like browsers, debuggers or
 user interface tools.

The API clearly states that DynAny and DynAnyFactory objects are local and
cannot be transferred to remote server or client. While such methods are
formally defined in the corresponding helpers, they simply always throw MARSHAL.

DynAny's are created by [EMAIL PROTECTED] DynAnyFactory}. The factory is obtaines by 
[EMAIL PROTECTED] org.omg.CORBA.ORB#resolve_initial_references): 

ORB orb = ORB.init(new String[0], null);
DynAnyFactory f = DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory"));

DynAny's are also returned by some methods, invoked on another DynAny.

The primitive types like string or char are wrapped into an ordinary DynAny. It
has multiple methods for setting/getting the content like 
[EMAIL PROTECTED] DynAnyOperations#get_string()} or 
[EMAIL PROTECTED] DynAnyOperations#insert_string(String)}. The more complex types like
sequences or structures are wrapped into specialised DynAny's, providing means
to access the enclosed members. In this case, the DynAny has the 
"internal cursor", normally pointing at one of the members in the data 
structure. The "internal cursor" can be set to the needed position 
[EMAIL PROTECTED] DynAnyOperations#seek(int)} or advanced forward 
([EMAIL PROTECTED] DynAnyOperations#next()}. The member under cursor is returned by
[EMAIL PROTECTED] DynAnyOperations#current_component()}. For composite DynAnys the 
methods like [EMAIL PROTECTED] DynAnyOperations#get_string()} or 
[EMAIL PROTECTED] DynAnyOperations#insert_string(String)} apply to the selected member,
not to the complex DynAny in general.

DynAnys are created and optimized for traversing values extracted from anys
or constructing values of anys at runtime. OMG does not recommend to use them
for other purposes.

@author Audrius Meskauskas, Lithuania ([EMAIL PROTECTED])

Index: org/omg/CORBA/package.html
===
RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/package.html,v
retrieving revision 1.5
diff -u -r1.5 package.html
--- org/omg/CORBA/package.html  2 Jul 2005 20:32:58 -   1.5
+++ org/omg/CORBA/package.html  9 Aug 2005 10:50:22 -
@@ -40,41 +40,59 @@
 headtitleGNU Classpath - org.omg.CORBA/title/head
 
 body
-This package provides the support of a href=www.omg.orgOMG/a 
-a href=www.CORBA.orgCORBA/a; see a href=#overviewoverview/a 
-of the implemented functionality. CORBA is an open, vendor independent 
-system that applications use to work together over networks.  Thie purpose 
-of this package is to provide CORBA APIs to java programming language, 
-including the fully functional Object Request Broker ([EMAIL PROTECTED] 
org.omg.CORBA.ORB}). 
-
+This package provides the support of a href=http://www.CORBA.org;CORBA/a;
+see a href=#overviewoverview/a of the implemented functionality. 
+CORBA a system that applications use to work over networks. CORBA messages 
+are binary, not text oriented. They practically cary no data wrapping 
+information like XML lt;openinggt; lt;/closinggt; tags. Hence CORBA 
+objects much easier exchange large amounts of binary data. CORBA can work
+in such data-intensive application areas as telecommunications or radio
+broadcasting.
 a name=overview
 h4Overview of the currently implemented CORBA functionality/h4
-pThe CORBA implementation in the Classpath project is now a working 
prototype.
- This prototype is interoperable with Sun's implementation v 1.4, transferring 
- object references, primitive types, narrow and wide strings, arrays, 
structures 
- and trees between these two platforms. The thrown exceptions are also 
transferred 
- and handled. The support for stringified object references (IORs) is 
implemented.
- The redirection commands works, LOCATION_FORWARD_PERM changing the target 
address
- until the application is restarted and LOCATION_FORWARD redirecting for the
- current session only. Both Little and Big Endian encoded messages
- are accepted. The encoding of the sent messages is the same as used in the 
- stringified IOR reference of that object or Big 

[cp-patches] Patch: fix for bug #23255

2005-08-09 Thread Lillian Angel
2005-08-09  Lillian Angel  [EMAIL PROTECTED]

Fixes Bug #23255
* javax/swing/plaf/basic/BasicTreeUI.java:
Fixed entire class to use Objects as opposed to TreeNodes.
(getPathBounds): Changed root to Object
(getPathForRow): Likewise.
(getRowCount): Likewise.
(getPreferredSize): Changed root and nextNode to be of type
Object.
(isLeaf): Took out unnecessary code.
(keyPressed): Changed all TreeNodes to be of type Object.
(getCellLocation): Likewise.
(paintNode): Likewise.
(paintRecursive): Likewise.
(getParent): Implemented.
(findNode): Helper Implemented.
(getNextVisibleNode): Changed return and parameter type to 
Object.
(getPreviousVisibleNode): Likewise.
(getNextNode): Likewise.
(getPreviousNode): Likewise.
(getNextSibling): Likewise.
(getPreviousSibling): Likewise.
(getPathToRoot): Likewise.
(getLevel): Likewise.
* javax/swing/tree/DefaultTreeModel.java
(getIndexOfChild): Implemented.

Index: javax/swing/plaf/basic/BasicTreeUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.54
diff -u -r1.54 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java	8 Aug 2005 14:05:35 -	1.54
+++ javax/swing/plaf/basic/BasicTreeUI.java	9 Aug 2005 13:02:40 -
@@ -585,7 +585,7 @@
 TreeModel mod = tree.getModel();
 if (mod != null)
 {
-  TreeNode root = (TreeNode) mod.getRoot();
+  Object root = mod.getRoot();
   if (!tree.isRootVisible()
tree.isExpanded(new TreePath(root)))
 root = getNextNode(root);
@@ -611,7 +611,7 @@
 TreeModel mod = tree.getModel();
 if (mod != null)
 {
-  TreeNode node = ((TreeNode) mod.getRoot());
+  Object node = mod.getRoot();
   if (!tree.isRootVisible()
tree.isExpanded(new TreePath(getPathToRoot(node, 0
 node = getNextNode(node);
@@ -657,7 +657,7 @@
 int count = 0;
 if (mod != null)
 {
-  TreeNode node = ((TreeNode) mod.getRoot());
+  Object node = mod.getRoot();
   if (!tree.isRootVisible()
tree.isExpanded(new TreePath((getPathToRoot(node, 0)
 node = getNextNode(node);
@@ -1313,14 +1313,14 @@
 int count = 0;
 if (model != null)
 {
-  TreeNode node = (TreeNode) model.getRoot();
+  Object node = model.getRoot();
   if (node != null)
   {
 maxWidth = (int) (getCellBounds(0, 0, node).getWidth());
 while (node != null)
 {
   count++;
-  TreeNode nextNode = getNextVisibleNode(node);
+  Object nextNode = getNextVisibleNode(node);
   if (nextNode != null)
 maxWidth = Math.max(maxWidth, (int) (getCellBounds(0, 0, nextNode)
 .getWidth()));
@@ -1530,11 +1530,7 @@
   return true;
 
 Object node = pathForRow.getLastPathComponent();
-
-if (node instanceof TreeNode)
-  return ((TreeNode) node).isLeaf();
-else
-  return true;
+return tree.getModel().isLeaf(node);
   }
   
   /**
@@ -1705,10 +1701,11 @@
  */
 public void keyPressed(KeyEvent e)
 {
+  TreeModel mod = BasicTreeUI.this.tree.getModel();
   TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath();
-  TreeNode last = null;
+  Object last = null;
   if (start != null)
-last = (TreeNode) start.getLastPathComponent();
+last = start.getLastPathComponent();
   
   if (last != null)
 {
@@ -1716,15 +1713,15 @@
   if (e.getKeyCode() == KeyEvent.VK_DOWN
   || e.getKeyCode() == KeyEvent.VK_KP_DOWN)
 {
-  TreeNode next = (TreeNode) BasicTreeUI.this.
-  getNextVisibleNode(last);
+  Object next = BasicTreeUI.this.
+getNextVisibleNode(last);
   if (next != null)
 {
   TreePath newPath = new TreePath(getPathToRoot(next, 0));
   BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath);
   if (e.isControlDown())
 tree.setLeadSelectionPath(newPath);
-  else if (!next.isLeaf()  e.isShiftDown())
+  else if (!mod.isLeaf(next)  e.isShiftDown())
 {
   BasicTreeUI.this.tree.expandPath(newPath);
   BasicTreeUI.this.tree.fireTreeExpanded(newPath);
@@ -1735,7 +1732,7 @@
   else if (e.getKeyCode() == KeyEvent.VK_UP
   || e.getKeyCode() == KeyEvent.VK_KP_UP)
 {
-  TreeNode prev = (TreeNode) BasicTreeUI.this.
+  Object prev = BasicTreeUI.this.
   getPreviousVisibleNode(last);
   
   if (prev != null)
@@ 

[cp-patches]: Patch: Formatting for DefaultTreeModel.

2005-08-09 Thread Lillian Angel
2005-08-09  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/tree/DefaultTreeModel.java:
Fixed formatting of class.




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


RE: [cp-patches] [RFC/JDWP] ClassLoaderReferenceCommandSet

2005-08-09 Thread Jeroen Frijters
Archie Cobbs wrote:
 Jeroen Frijters wrote:
  I strongly agree with Archie. Also, approach #2 is 
 incorrect, because
  the classes that should be returned are the classes for which this
  class loader has been recorded as the initiating loader. The class
  loader doesn't know whether it is the initiating loader or 
 not, only the
  VM knows this.
 
 Tiny clarification.. that should be an initiating loader rather
 than the initiating loader... there can be more than one for
 a given class, right?

Yeah, you're absolutely right. I copied the quoted text from the Sun
docs, but it's definitely misleading to talk about the.

Regards,
Jeroen


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [RFC/JDWP] ClassLoaderReferenceCommandSet

2005-08-09 Thread Archie Cobbs

Jeroen Frijters wrote:

I strongly agree with Archie. Also, approach #2 is incorrect, because
the classes that should be returned are the classes for which this
class loader has been recorded as the initiating loader. The class
loader doesn't know whether it is the initiating loader or not, only the
VM knows this.


Tiny clarification.. that should be an initiating loader rather
than the initiating loader... there can be more than one for
a given class, right?

-Archie

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


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches]: Patch: Formatting for DefaultTreeModel.

2005-08-09 Thread Mark Wielaard
Hi Lilian,

On Tue, 2005-08-09 at 09:55 -0400, Lillian Angel wrote:
 2005-08-09  Lillian Angel  [EMAIL PROTECTED]
 
 * javax/swing/tree/DefaultTreeModel.java:
 Fixed formatting of class.

The actual patch was missing. But in CVS I spotted that the copyright
header was garbled. And you cannot remove any old copyright years, so I
added 2002 and 2004 back.

2005-08-09  Mark Wielaard  [EMAIL PROTECTED]

* javax/swing/tree/DefaultTreeModel.java: Fix copyright
boilerplate formatting.

Committed,

Mark
Index: javax/swing/tree/DefaultTreeModel.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/tree/DefaultTreeModel.java,v
retrieving revision 1.12
diff -u -r1.12 DefaultTreeModel.java
--- javax/swing/tree/DefaultTreeModel.java	9 Aug 2005 13:55:32 -	1.12
+++ javax/swing/tree/DefaultTreeModel.java	9 Aug 2005 14:55:25 -
@@ -1,37 +1,39 @@
-/*
- * DefaultTreeModel.java -- Copyright (C) 2005 Free Software Foundation,
- * Inc.
- * 
- * This file is part of GNU Classpath.
- * 
- * GNU Classpath is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2, or (at your option) any later version.
- * 
- * GNU Classpath is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * GNU Classpath; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- * 
- * Linking this library statically or dynamically with other modules is making a
- * combined work based on this library. Thus, the terms and conditions of the
- * GNU General Public License cover the whole combination.
- * 
- * As a special exception, the copyright holders of this library give you
- * permission to link this library with independent modules to produce an
- * executable, regardless of the license terms of these independent modules, and
- * to copy and distribute the resulting executable under terms of your choice,
- * provided that you also meet, for each linked independent module, the terms
- * and conditions of the license of that module. An independent module is a
- * module which is not derived from or based on this library. If you modify this
- * library, you may extend 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.
- */
+/* DefaultTreeModel.java -- 
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ 
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+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 javax.swing.tree;
 
@@ -179,7 +181,7 @@
 for (int i = 0; i  getChildCount(parent); i++)
 {
   if (getChild(parent, i).equals(child))
-return i;
+	return i;
 }
 return -1;
   }


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org

[cp-patches] Patch: Icon fixes

2005-08-09 Thread Lillian Angel
2005-08-09  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicLabelUI.java
(paint): Added in code to paint background rect according to
API. Also, formatting changes.
* javax/swing/plaf/basic/BasicTreeUI.java
(setCellRenderer): Fixed to changed renderer in JTree.
(uninstallDefaults): Line taken out because not needed.
(paintNode): Took out unneeded code because BasicLabelUI was 
fixed.
(paintRecursive): Fixed so lines are only drawn when parents 
have children.

Index: javax/swing/plaf/basic/BasicLabelUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLabelUI.java,v
retrieving revision 1.14
diff -u -r1.14 BasicLabelUI.java
--- javax/swing/plaf/basic/BasicLabelUI.java	8 Jul 2005 15:24:08 -	1.14
+++ javax/swing/plaf/basic/BasicLabelUI.java	9 Aug 2005 16:05:42 -
@@ -169,26 +170,33 @@
   vr.width = 0;
 if (vr.height  0)
   vr.height = 0;
-  
+
 Icon icon = (b.isEnabled()) ? b.getIcon() : b.getDisabledIcon();
 
 String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr);
-
+
 if (icon != null)
   icon.paintIcon(b, g, ir.x, ir.y);
-if (text != null  ! text.equals())
-  {
-	if (b.isEnabled())
-	  paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
-	else
-	  paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
-  }
+if (text != null  !text.equals())
+{
+
+  g.setColor(b.getBackground());
+  if (b.isOpaque())
+g.fillRect(vr.x, vr.y, vr.width, vr.height);
+  else
+g.fillRect(tr.x, tr.y, tr.width, tr.height);
+
+  if (b.isEnabled())
+paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+  else
+paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+}
 g.setFont(saved_font);
   }
 
   /**
* This method is simply calls SwingUtilities's layoutCompoundLabel.
-   *
+   * 
* @param label The label to lay out.
* @param fontMetrics The FontMetrics for the font used.
* @param text The text to paint.
Index: javax/swing/plaf/basic/BasicTreeUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.55
diff -u -r1.55 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java	9 Aug 2005 13:27:17 -	1.55
+++ javax/swing/plaf/basic/BasicTreeUI.java	9 Aug 2005 16:05:43 -
@@ -424,6 +424,7 @@
   protected void setCellRenderer(TreeCellRenderer tcr)
   {
 currentCellRenderer = tcr;
+tree.setCellRenderer(tcr);
 updateRenderer();
   }
   
@@ -1201,11 +1202,9 @@
*/
   protected void uninstallDefaults(JTree tree)
   {
-UIDefaults defaults = UIManager.getLookAndFeelDefaults();
 tree.setFont(null);
 tree.setForeground(null);
 tree.setBackground(null);
-tree.setCellRenderer(null);
   }
   
   /**
@@ -2571,61 +2570,27 @@
* @param node the object to draw
*/
   void paintNode(Graphics g, int x, int y, JTree tree, Object node,
- boolean isLeaf)
+  boolean isLeaf)
   {
 TreePath curr = new TreePath(getPathToRoot(node, 0));
 boolean selected = tree.isPathSelected(curr);
 boolean expanded = false;
 boolean hasIcons = false;
-
+
 if (tree.isVisible(curr))
-  {
-DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) 
-createDefaultCellRenderer();
-
-if (!isLeaf)
-  expanded = tree.isExpanded(curr);
-
-Icon icon = null;
-if (!isLeaf  expanded)
-  icon = dtcr.getOpenIcon();
-else if (!isLeaf  !expanded)
-  icon = dtcr.getClosedIcon();
-else
-  icon = dtcr.getLeafIcon();
-
-if (icon.getIconHeight()  -1  icon.getIconWidth()  -1)
-  hasIcons = true;
-
-Component c = dtcr.getTreeCellRendererComponent(tree, node, selected,
-expanded, isLeaf, 0, false);
-
-if (hasIcons)
-  {
-if (selected)
-  {
-Rectangle cell = getPathBounds(tree, curr);
-g.setColor(dtcr.getBackgroundSelectionColor());
-g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width,
-   cell.height);
-
-if (curr.equals(tree.getLeadSelectionPath()))
-  {
-g.setColor(UIManager.getLookAndFeelDefaults().getColor(
-Tree.selectionBorderColor));
-g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, 
-   cell.width, cell.height);
-  }
-  }
-
-g.translate(x, y);
-c.paint(g);
-g.translate(-x, -y);
-  

[cp-patches] FYI: JTable cell editing implemented and committed

2005-08-09 Thread Anthony Balkissoon
This patch implements DefaultCellEditor and some methods in JTable in
order to make editing JTable cells possible.

A demo will be added shortly, for now I am attaching a small test app
that you can use to test the editing functionality.  With a table cell
selected, pressing F2 starts editing and then pressing ENTER stops
editing.

2 notes:
- the test app appears to draw incorrectly at the top, this is due to
some trouble in BasicViewportUI
- if you edit more than one cell, you will notice that text from
previously edited cells appears in the cell you are currently editing,
this is due to bugs in JTextField/JTextComponent

Patch is attached.

2005-08-09  Anthony Balkissoon  [EMAIL PROTECTED]

* javax/swing/DefaultCellEditor.java:
(EditorDelegate.setValue): Implemented.
(EditorDelegate.getCellEditorValue): Implemented.
(EditorDelegate.isCellEditable): Implemented.
(EditorDelegate.shouldSelectCell): Implemented.
(EditorDelegate.stopCellEditing): Implemented.
(EditorDelegate.cancelCellEditing): Implemented.
(EditorDelegate.startCellEditing): Implemented.
(EditorDelegate.actionPerformed): Implemented.
(EditorDelegate.itemStateChanged): Implemented.
(EditorDelegate.fireEditingStopped): New implementation method.
(EditorDelegate.fireEditingCancelled): New implementation method.
(DefaultCellEditor): Implemented 3 constructors.
(getComponent): Implemented.
(getClickCountToStart): Implemented.
(setClickCountToStart): Implemented.
(getCellEditorValue): Implemented.
(isCellEditable): Implemented.
(shouldSelectCell): Implemented.
(cancelCellEditing): Implemented.
(getTableCellEditorComponent): Implemented.
* javax/swing/JTable.java:
(EditorUpdateTimer): New private class.
(editingStopped): Implemented.
(setValueAt): If the Object value is a Component, add it to the JTable
so it can obtain focus.
(editCellAt): Implemented.
(removeEditor): Implemented.
(prepareEditor): Implemented.
* javax/swing/plaf/basic/BasicTableUI.java:
(KeyHandler.keyPressed): Added F2 start editing key action.
(MouseHandler.mousePressed): Added check to see if a new cell was
selected and we need to stop editing.
(paint): If the cell is a JTextField, paint its Caret as well.
* javax/swing/table/DefaultTableCellRenderer.java:
(getTableCellRendererComponent): If a JTextField is passed in, return
one.  This is used for editing JTable cells.
Index: javax/swing/DefaultCellEditor.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/DefaultCellEditor.java,v
retrieving revision 1.10
diff -u -r1.10 DefaultCellEditor.java
--- javax/swing/DefaultCellEditor.java	27 Jul 2005 12:41:33 -	1.10
+++ javax/swing/DefaultCellEditor.java	9 Aug 2005 15:52:59 -
@@ -43,9 +43,13 @@
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
 import java.io.Serializable;
 import java.util.EventObject;
 
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.CellEditorListener;
 import javax.swing.table.TableCellEditor;
 import javax.swing.tree.TreeCellEditor;
 
@@ -91,8 +95,10 @@
  *
  * @param event TODO
  */
-public void setValue(Object event)
+public void setValue(Object value)
 {
+  // TODO: should be setting the value in the editorComp
+  this.value = value;
 }
 
/**
@@ -102,7 +108,8 @@
  */
 public Object getCellEditorValue()
 {
-  return null; // TODO
+  // TODO: should be getting the updated value from the editorComp
+  return value;
 } // getCellEditorValue()
 
 /**
@@ -114,7 +121,11 @@
  */
 public boolean isCellEditable(EventObject event)
 {
-  return false; // TODO
+  if (!(event instanceof MouseEvent))
+return true;
+
+  //Todo: if the right number of clicks has occured, return true;
+  return false;
 } // isCellEditable()
 
 /**
@@ -126,7 +137,8 @@
  */
 public boolean shouldSelectCell(EventObject event)
 {
-  return false; // TODO
+  // return true to indicate that the editing cell may be selected
+  return true;
 } // shouldSelectCell()
 
 /**
@@ -136,7 +148,8 @@
  */
 public boolean stopCellEditing()
 {
-  return false; // TODO
+  fireEditingStopped();
+  return true;
 } // stopCellEditing()
 
 /**
@@ -144,7 +157,7 @@
  */
 public void cancelCellEditing()
 {
-  // TODO
+  fireEditingCanceled();
 } // cancelCellEditing()
 
 /**
@@ -156,7 +169,8 @@
  */
 public boolean startCellEditing(EventObject event)
 {
-  return false; // TODO
+  // return true to 

[cp-patches] Patch: Label and icon fixes for tree nodes.

2005-08-09 Thread Lillian Angel
2005-08-09  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicLabelUI.java
(paint): Added in painting code for label border.
* javax/swing/plaf/basic/BasicTreeUI.java
(paintControlIcons): Fixed location for control icons.
* javax/swing/plaf/metal/MetalLookAndFeel.java:
Added defaults for selection and non-selection border for
tree cells.
* javax/swing/tree/DefaultTreeCellRenderer.java
(getTreeCellRendererComponent): Set borders for node. Also,
made node transparent (not opaque), So JLabel draws icon,
text and border appropriately.

Index: javax/swing/plaf/basic/BasicLabelUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicLabelUI.java,v
retrieving revision 1.15
diff -u -r1.15 BasicLabelUI.java
--- javax/swing/plaf/basic/BasicLabelUI.java	9 Aug 2005 16:11:55 -	1.15
+++ javax/swing/plaf/basic/BasicLabelUI.java	9 Aug 2005 18:14:39 -
@@ -176,21 +176,27 @@
 String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr);
 
 if (icon != null)
-  icon.paintIcon(b, g, ir.x, ir.y);
+  icon.paintIcon(b, g, ir.x, ir.y);
 if (text != null  !text.equals())
 {
-
   g.setColor(b.getBackground());
+
   if (b.isOpaque())
 g.fillRect(vr.x, vr.y, vr.width, vr.height);
   else
+  {
 g.fillRect(tr.x, tr.y, tr.width, tr.height);
+if (b.getBorder() != null)
+  b.getBorder().paintBorder(b, g, tr.x, tr.y, tr.width, tr.height);
+b.setBorder(null);
+  }
 
   if (b.isEnabled())
 paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
   else
 paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
 }
+
 g.setFont(saved_font);
   }
 
Index: javax/swing/plaf/basic/BasicTreeUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.56
diff -u -r1.56 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java	9 Aug 2005 16:11:55 -	1.56
+++ javax/swing/plaf/basic/BasicTreeUI.java	9 Aug 2005 18:14:40 -
@@ -2711,7 +2711,7 @@
 if (tree.isExpanded(new TreePath(getPathToRoot(node, 0
   {
 if (!node.equals(mod.getRoot()))
-  drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h);
+  ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h);
 
 for (int i = 0; i  max; ++i)
   {
@@ -2725,7 +2725,7 @@
   }
   }
 else if (!node.equals(mod.getRoot()))
-  drawCentered(tree, g, ei, indentation - rightChildIndent - 3, 
+  ci.paintIcon(tree, g, indentation - rightChildIndent - 3, 
descent - getRowHeight());
   }
 
Index: javax/swing/plaf/metal/MetalLookAndFeel.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java,v
retrieving revision 1.38
diff -u -r1.38 MetalLookAndFeel.java
--- javax/swing/plaf/metal/MetalLookAndFeel.java	4 Aug 2005 18:16:17 -	1.38
+++ javax/swing/plaf/metal/MetalLookAndFeel.java	9 Aug 2005 18:14:40 -
@@ -44,6 +44,8 @@
 
 import javax.swing.ImageIcon;
 import javax.swing.UIDefaults;
+import javax.swing.border.Border;
+import javax.swing.plaf.BorderUIResource;
 import javax.swing.plaf.ColorUIResource;
 import javax.swing.plaf.FontUIResource;
 import javax.swing.plaf.IconUIResource;
@@ -864,6 +866,8 @@
   Tree.selectionBackground, new ColorUIResource(new Color(204, 204, 255)),
   Tree.nonSelectionBackground, new ColorUIResource(Color.white),
   Tree.selectionBorderColor, new ColorUIResource(new Color(102, 102, 153)),
+  Tree.selectionBorder, new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
+  Tree.nonSelectionBorder, new BorderUIResource.LineBorderUIResource(Color.white),
   Tree.selectionForeground, new ColorUIResource(Color.black),
   Tree.textBackground, new ColorUIResource(new Color(204, 204, 255)),
   Tree.textForeground, new ColorUIResource(Color.black),
Index: javax/swing/tree/DefaultTreeCellRenderer.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/tree/DefaultTreeCellRenderer.java,v
retrieving revision 1.15
diff -u -r1.15 DefaultTreeCellRenderer.java
--- javax/swing/tree/DefaultTreeCellRenderer.java	22 Jul 2005 08:11:12 -	1.15
+++ javax/swing/tree/DefaultTreeCellRenderer.java	9 Aug 2005 18:14:40 -
@@ -44,6 +44,7 @@
 import java.awt.Graphics;
 import java.awt.Rectangle;
 
+import javax.swing.border.Border;
 import javax.swing.Icon;
 import javax.swing.JLabel;
 import javax.swing.JTree;
@@ -390,7 +391,7 @@
   this.selected = selected;
   this.hasFocus = 

[cp-patches]: JTable setRowHeight

2005-08-09 Thread Lillian Angel
2005-08-09  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/JTable.java
(setRowHeight): Fixed condition on when to throw exception.
(setRowHeight): Parameters were mixed up.

? .ChangeLog.swp
? examples/gnu/classpath/examples/swing/Demo$1.class
? examples/gnu/classpath/examples/swing/Demo$10.class
? examples/gnu/classpath/examples/swing/Demo$11.class
? examples/gnu/classpath/examples/swing/Demo$12.class
? examples/gnu/classpath/examples/swing/Demo$2.class
? examples/gnu/classpath/examples/swing/Demo$3.class
? examples/gnu/classpath/examples/swing/Demo$4.class
? examples/gnu/classpath/examples/swing/Demo$5.class
? examples/gnu/classpath/examples/swing/Demo$6.class
? examples/gnu/classpath/examples/swing/Demo$7.class
? examples/gnu/classpath/examples/swing/Demo$8.class
? examples/gnu/classpath/examples/swing/Demo$9.class
? examples/gnu/classpath/examples/swing/Demo$CheckCellRenderer.class
? examples/gnu/classpath/examples/swing/Demo$LabelCellRenderer.class
? examples/gnu/classpath/examples/swing/Demo$LaterMain.class
? examples/gnu/classpath/examples/swing/Demo$PopUpAction.class
? examples/gnu/classpath/examples/swing/Demo.class
? examples/gnu/classpath/examples/swing/GNULookAndFeel.class
Index: javax/swing/JTable.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.39
diff -u -r1.39 JTable.java
--- javax/swing/JTable.java	9 Aug 2005 15:56:40 -	1.39
+++ javax/swing/JTable.java	9 Aug 2005 19:06:18 -
@@ -1554,7 +1554,7 @@
*/ 
   public void setRowHeight(int r)
   {
-if (rowHeight  1)
+if (r  1)
   throw new IllegalArgumentException();
 
 rowHeight = r;
@@ -1569,7 +1569,7 @@
* @param rh is the new rowHeight
* @param row is the row to change the rowHeight of
*/
-  public void setRowHeight(int rh, int row)
+  public void setRowHeight(int row, int rh)
   {
  setRowHeight(rh);
  // FIXME: not implemented
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [RFC/JDWP] ID management

2005-08-09 Thread Bryce McKinlay

Keith Seitz wrote:


I'll post a ChangeLog, but this is really more an RFC than an RFA
(request for comment/request for approval). But who knows, even a blind
man occasionally hits the target! ;-)

ChangeLog
2005-08-04  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/vm/IdManager.java: New file describing
the interface used by the JDWP back-end for object and type
ID management.
 



Keith, this looks reasonable to me, although see comments below. Note 
that using an abstract class is a little different to how most of the 
VM* classes are implemented in classpath. Typically, classpath provides 
a reference implementation which can then be replaced (not overridden) 
by VMs. Perhaps use that model here?



 /**
  * Reads a numerical ID from the stream, returning
  * the actual ID associated with it.
  * 
  * IDs are assumed to be eight bytes.

  *
  * @param bb  the buffer from which to read the ID 
  * @returns the object id

  * @throws IOException for any errors reading from the stream
  * @throws InvaildObjectException if ID is not found
  */
 public ObjectId readId (ByteBuffer bb)
   throws IOException, InvalidObjectException
 {
   long id = bb.getLong ();
   return get (id);
 }

 /**
  * Reads a numerical ID from the stream, returning
  * the actual reference type ID associated with it.
  *
  * IDs are assumed to be eight bytes.
  *
  * @param bb  the buffer from which to read the ID 
  * @returns the JdwpId

  * @throws IOException for any errors reading from the stream
  * @throws InvaildObjectException if ID is not found
  */
 public ReferenceTypeId readReferenceTypeId (ByteBuffer bb)
   throws IOException, InvalidClassException
 {
   long id = bb.getLong ();
   return getReferenceType (id);
 }
}
 


In the comments: s/stream/buffer/

These methods seem a little weird to me - they are pushing management of 
the buffer into the ID management class, where I don't think it belongs. 
Perhaps it would be cleaner just to have the client code read from the 
buffer, then call getReferenceType() etc directly?


Bryce



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [RFA/JDWP] StackFrameCommandSet

2005-08-09 Thread Aaron Luchko
On Tue, 2005-08-09 at 15:54 -0400, Bryce McKinlay wrote:
 Aaron Luchko wrote:

 ChangeLog
 2005-08-04  Aaron Luchko  [EMAIL PROTECTED]
 *gnu/classpath/jdwp/processor/StackFrameCommandSet.java:
 Implemented the StackFrame CommandSet.
   
 
 OK.

Thanks, committed.



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [RFA/JDWP] StackFrameCommandSet

2005-08-09 Thread Bryce McKinlay

Aaron Luchko wrote:


This is the StackFrame command set
http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#JDWP_StackFrame

I'm not entirely sure what our classpath level Frame object will look
like in the end. For this I just have class with a bunch of getters and
setters now which may turn out to be all we need in classpath.

Another thing is although Frames look like other ids they are not. First
they are not ObjectIds since they don't exist in the users code. Storing
them as an ObjectId would mean they could be garbage collected since no
one else has a reference to them. Furthermore they are not
ReferenceTypeIds since these are held permanently and we want these to
be held only as long as the Thread is suspended. For now we will query
the VM for them directly although in the future it may make sense to
store them in some classpath level Object which represents a suspended
thread.
 



Yeah, it probably makes sense to cache the stack in a 
Thread/SuspendedThread object while the thread is suspended.


Note that it should be quite easy for the VM (or JDWP code) to generate 
FrameIDs without needing a mapping of any kind. Since they only need to 
remain valid while the thread is suspended, something like threadID  
4  frameNum would work just fine (if threadID is 4 bytes).



ChangeLog
2005-08-04  Aaron Luchko  [EMAIL PROTECTED]
   *gnu/classpath/jdwp/processor/StackFrameCommandSet.java:
   Implemented the StackFrame CommandSet.
 


OK.

Bryce



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [RFC/JDWP] ID management

2005-08-09 Thread Keith Seitz
On Tue, 2005-08-09 at 15:30 -0400, Bryce McKinlay wrote:

 Keith, this looks reasonable to me, although see comments below. Note 
 that using an abstract class is a little different to how most of the 
 VM* classes are implemented in classpath. Typically, classpath provides 
 a reference implementation which can then be replaced (not overridden) 
 by VMs. Perhaps use that model here?

I think I understand what you mean -- classpath uses a very unusual (at
least to me) method for dealing with this. So let me see if I
understnad...

If I have code in some package that requires use of the id manager, it
does not ask for a class which provides this functionality (via a
defined interface). Instead, it just _assumes_ that some interface with
a given name (e.g., gnu.classpath.jdwp.id.IdManager or something) exists
and imports that directly. It is up to the VM supplier to write this
file, with this given package and class name. Essentially, there *is* an
interface, but it's defined by an implementation in vm/reference. It's
not a real java interface. Am I close?

 These methods seem a little weird to me - they are pushing management of 
 the buffer into the ID management class, where I don't think it belongs. 
 Perhaps it would be cleaner just to have the client code read from the 
 buffer, then call getReferenceType() etc directly?

These were simply provided as a convenience to the back-end. If you take
a peek at Aaron's command set patches, it's often reading IDs from a
buffer.

My only hesitation with moving it out of IdManager is that IdManager is
the one place where sizes for IDs are (or at least should/could be)
known. The rest of the code (IDSizes excepted right now) knows nothing
about this.

Of course, it's not that big a deal to me, and I can certainly change
(or get Aaron to change ;-) every place this is currently done.

Keith



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: JTable editing ESCAPE key implemented

2005-08-09 Thread Anthony Balkissoon
This patch introduces ESCAPE key functionality to JTable editing - if
you are editing a cell and press escape editing is canceled (your
changes are discarded and focus goes back to the JTable).

Patch is attached.

Note: the JTable in the Swing Demo can show the new editing behavior.

2005-08-09  Anthony Balkissoon  [EMAIL PROTECTED]
* javax/swing/JTable.java:
(editingCancelled): Implemented.
(editCellAt): Added a KeyListener to our editor to listen for
the ESCAPE key and cancel editing upon receiving it.

-Tony
Index: javax/swing/JTable.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.40
diff -u -r1.40 JTable.java
--- javax/swing/JTable.java	9 Aug 2005 19:07:50 -	1.40
+++ javax/swing/JTable.java	9 Aug 2005 19:45:53 -
@@ -45,6 +45,8 @@
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.util.Date;
@@ -576,6 +578,12 @@
   Timer editorTimer = new EditorUpdateTimer();
 
   /**
+   * Stores the old value of a cell before it was edited, in case
+   * editing is cancelled
+   */
+  Object oldCellValue;
+
+  /**
* Creates a new codeJTable/code instance.
*/
   public JTable ()
@@ -838,6 +846,20 @@
 
   public void editingCanceled (ChangeEvent event)
   {
+if (rowBeingEdited  -1  columnBeingEdited  -1)
+  {
+if (getValueAt(rowBeingEdited, columnBeingEdited) instanceof JTextField)
+  {
+remove ((Component)getValueAt(rowBeingEdited, columnBeingEdited));
+setValueAt(oldCellValue, rowBeingEdited, columnBeingEdited);
+  }
+rowBeingEdited = -1;
+columnBeingEdited = -1;
+  }
+editorTimer.stop();
+editorComp = null;
+cellEditor = null;
+requestFocusInWindow(false);
 repaint();
   }
 
@@ -2297,8 +2319,17 @@
*/
   public boolean editCellAt (int row, int column)
   {
+oldCellValue = getValueAt(row, column);
 setCellEditor(getCellEditor(row, column));
 editorComp = prepareEditor(cellEditor, row, column);
+editorComp.addKeyListener(new KeyAdapter() {
+public void keyPressed(KeyEvent e) {
+  if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+if (JTable.this.cellEditor != null)
+  JTable.this.cellEditor.cancelCellEditing();
+  }
+}
+  });
 cellEditor.addCellEditorListener(this);
 rowBeingEdited = row;
 columnBeingEdited = column;
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] [RFC/JDWP] ID management

2005-08-09 Thread Bryce McKinlay

Keith Seitz wrote:


On Tue, 2005-08-09 at 15:30 -0400, Bryce McKinlay wrote:

 

Keith, this looks reasonable to me, although see comments below. Note 
that using an abstract class is a little different to how most of the 
VM* classes are implemented in classpath. Typically, classpath provides 
a reference implementation which can then be replaced (not overridden) 
by VMs. Perhaps use that model here?
   



I think I understand what you mean -- classpath uses a very unusual (at
least to me) method for dealing with this. So let me see if I
understnad...

If I have code in some package that requires use of the id manager, it
does not ask for a class which provides this functionality (via a
defined interface). Instead, it just _assumes_ that some interface with
a given name (e.g., gnu.classpath.jdwp.id.IdManager or something) exists
and imports that directly. It is up to the VM supplier to write this
file, with this given package and class name. Essentially, there *is* an
interface, but it's defined by an implementation in vm/reference. It's
not a real java interface. Am I close?
 



Right. These special classes are all clearly identified by having VM 
prefixed to their name. They're also found in a separate location in the 
classpath build tree (vm/reference). It's done this way mostly for 
efficiency - using an service-provider approach would force everything 
to aquire the implementation object and make a virtual call, which is 
clearly much too heavy in some cases.


For JDWP, you don't have to use this model, of course. If you think it 
makes development/maintainance easier then you could use an SPI. For one 
thing, you'd be able to build both, say, the reference and gcj-specific 
implementations at the same time. I just wanted to make sure you were 
aware of the alternative :)


These methods seem a little weird to me - they are pushing management of 
the buffer into the ID management class, where I don't think it belongs. 
Perhaps it would be cleaner just to have the client code read from the 
buffer, then call getReferenceType() etc directly?
   



These were simply provided as a convenience to the back-end. If you take
a peek at Aaron's command set patches, it's often reading IDs from a
buffer.

My only hesitation with moving it out of IdManager is that IdManager is
the one place where sizes for IDs are (or at least should/could be)
known. The rest of the code (IDSizes excepted right now) knows nothing
about this.
 


Ah, yes. And the sizes are VM-specific. Good point!

Bryce



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Introspector.getBeanInfo(class, int)

2005-08-09 Thread Aaron Luchko
We don't have Introspector.getBeanInfo(class, int) implemented. I've
been experimenting with it to try and figure out how it works,
unfortunately anything I try it seems to return exactly the same as
Introspector.getBeanInfo(class). I was wondering if someone knew exactly
how it was supposed to work and how I could test it. Otherwise I was
wondering if I should commit something like the following patch.

thanks, 
Aaron

Index: Introspector.java
===
RCS file: /cvsroot/classpath/classpath/java/beans/Introspector.java,v
retrieving revision 1.20
diff -u -r1.20 Introspector.java
--- Introspector.java   2 Jul 2005 20:32:37 -   1.20
+++ Introspector.java   9 Aug 2005 21:51:46 -
@@ -245,11 +245,30 @@
   }
 
   /** 
+   * FIXME: I haven't actually been able to figure out what the flags
control.
* Get the BeanInfo for class CODEbeanClass/CODE,
* first by looking for explicit information, next by
* using standard design patterns to determine
* information about the class.  It crawls up the
* inheritance tree until it hits CODEtopClass/CODE.
+   *
+   * @param beanClass the Bean class.
+   * @param flags controls the information returned, not currently used
+   * @return the BeanInfo object representing the class.
+   */
+  public static BeanInfo getBeanInfo(Class beanClass, int flags) 
+throws IntrospectionException 
+  {
+// FIXME: We really need to do something with the flags.
+return getBeanInfo(beanClass);
+  }
+
+  /** 
+   * Get the BeanInfo for class CODEbeanClass/CODE,
+   * first by looking for explicit information, next by
+   * using standard design patterns to determine
+   * information about the class.  It crawls up the
+   * inheritance tree until it hits CODEstopClass/CODE.
*
* @param beanClass the Bean class.
* @param stopClass the class to stop at.




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] [RFA/JDWP] ThreadReferenceCommandSet

2005-08-09 Thread Aaron Luchko
This is the ThreadReferenceCommandSet
http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#JDWP_ThreadReference

thanks, Aaron

ChangeLog
2005-08-09  Aaron Luchko [EMAIL PROTECTED]

* gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java:  
Implemented the ThreadReference CommandSet.

--- /dev/null	2005-06-09 16:29:11.371620296 -0400
+++ gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java	2005-08-09 19:20:51.0 -0400
@@ -0,0 +1,251 @@
+/* ThreadReferenceCommandSet.java -- class to implement the ThreadReference
+   Command Set Copyright (C) 2005 Free Software Foundation
+ 
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+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.classpath.jdwp.processor;
+
+import gnu.classpath.jdwp.IVirtualMachine;
+import gnu.classpath.jdwp.Jdwp;
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.exception.InvalidObjectException;
+import gnu.classpath.jdwp.exception.JdwpException;
+import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
+import gnu.classpath.jdwp.exception.NotImplementedException;
+import gnu.classpath.jdwp.id.IdManager;
+import gnu.classpath.jdwp.id.ObjectId;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Frame;
+import gnu.classpath.jdwp.util.JdwpString;
+import gnu.classpath.jdwp.util.Location;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
+/**
+ * A class representing the ThreadReference Command Set.
+ * 
+ * @author Aaron Luchko [EMAIL PROTECTED]
+ */
+public class ThreadReferenceCommandSet implements CommandSet
+{
+  // Our hook into the jvm
+  private final IVirtualMachine vm = Jdwp.getIVirtualMachine();
+
+  // Manages all the different ids that are assigned by jdwp
+  private final IdManager idMan = Jdwp.getIdManager();
+
+  public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
+  throws JdwpException
+  {
+try
+  {
+switch (command)
+  {
+  case JdwpConstants.CommandSet.ThreadReference.NAME:
+executeName(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.SUSPEND:
+executeSuspend(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.RESUME:
+executeResume(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.STATUS:
+executeStatus(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.THREAD_GROUP:
+executeThreadGroup(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.FRAMES:
+executeFrames(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.FRAME_COUNT:
+executeFrameCount(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.OWNED_MONITORS:
+executeOwnedMonitors(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.CURRENT_CONTENDED_MONITOR:
+executeCurrentContendedMonitor(bb, os);
+break;
+  case JdwpConstants.CommandSet.ThreadReference.STOP:
+executeStop(bb, os);
+break;
+  

Re: [cp-patches] Introspector.getBeanInfo(class, int)

2005-08-09 Thread Tom Tromey
 Aaron == Aaron Luchko [EMAIL PROTECTED] writes:

Aaron We don't have Introspector.getBeanInfo(class, int) implemented. I've
Aaron been experimenting with it to try and figure out how it works,
Aaron unfortunately anything I try it seems to return exactly the same as
Aaron Introspector.getBeanInfo(class). I was wondering if someone knew exactly
Aaron how it was supposed to work and how I could test it.

There is some info in the javadoc from Sun.

http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Introspector.html#getBeanInfo(java.lang.Class,%20int)

Tom


___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] Introspector.getBeanInfo(class, int)

2005-08-09 Thread Aaron Luchko
On Tue, 2005-08-09 at 17:34 -0600, Tom Tromey wrote: 
  Aaron == Aaron Luchko [EMAIL PROTECTED] writes:
 
 Aaron We don't have Introspector.getBeanInfo(class, int) implemented. I've
 Aaron been experimenting with it to try and figure out how it works,
 Aaron unfortunately anything I try it seems to return exactly the same as
 Aaron Introspector.getBeanInfo(class). I was wondering if someone knew 
 exactly
 Aaron how it was supposed to work and how I could test it.
 
 There is some info in the javadoc from Sun.
 
 http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Introspector.html#getBeanInfo(java.lang.Class,%20int)

I've been looking at that but have still been unsuccessful in getting
(class, int) to act differently than (class).

Introspect on a Java bean and learn about all its properties, exposed
methods, and events, subject to some control flags. 

ok

beanClass - The bean class to be analyzed.
flags - Flags to control the introspection. If flags == USE_ALL_BEANINFO
then we use all of the BeanInfo classes we can discover. If flags ==
IGNORE_IMMEDIATE_BEANINFO then we ignore any BeanInfo associated with
the specified beanClass. If flags == IGNORE_ALL_BEANINFO then we ignore
all BeanInfo associated with the specified beanClass or any of its
parent classes.

My understanding from that is USE_ALL_BEANINFO is equivalent to just
getBeanInfo(class). IGNORE_IMMEDIATE_BEANINFO would I guess be BeanInfo
on all the superclasses but not the class itself. IGNORE_ALL_BEANINFO...
BeanInfo with nothing???

Either way whatever combination of beans and flags I try I'm getting
exactly the same results and I can't tell what, if anything, these flags
are doing.

Aaron



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches