[Patch][gui] paramString fixing

Michael Koch konqueror@gmx.de
Fri Jan 28 12:15:00 GMT 2005


Hi list,


While debugging JUMP I implemented some paramString() methods in Swing
and one in AWT. Here is the patch for it.


Michael


2005-01-28  Michael Koch  <konqueror@gmx.de>

	* java/awt/Container.java
	(paramString): Implemented.
	* javax/swing/AbstractButton.java
	(paramString): Implemented.
	* javax/swing/JComponent.java
	(paramString): Implemented.
	* javax/swing/JMenu.java
	(paramString): Implemented.
	* javax/swing/JMenuBar.java
	(paramString): Implemented.
	* javax/swing/JMenuItem.java
	(paramString): Implemented.
	* javax/swing/JPopupMenu.java
	(paramString): Implemented.

-------------- next part --------------
Index: java/awt/Container.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Container.java,v
retrieving revision 1.34.2.25
diff -u -r1.34.2.25 Container.java
--- java/awt/Container.java	9 Dec 2004 21:36:46 -0000	1.34.2.25
+++ java/awt/Container.java	28 Jan 2005 12:12:10 -0000
@@ -1,5 +1,5 @@
 /* Container.java -- parent container class in AWT
-   Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -1052,11 +1052,14 @@
    */
   protected String paramString()
   {
-    String param = super.paramString();
     if (layoutMgr != null)
-      param = param + ",layout=" + layoutMgr.getClass().getName();
+      return super.paramString();
 
-    return param;
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",layout=");
+    sb.append(layoutMgr.getClass().getName());
+    return sb.toString();
   }
 
   /**
Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/AbstractButton.java,v
retrieving revision 1.5.2.21
diff -u -r1.5.2.21 AbstractButton.java
--- javax/swing/AbstractButton.java	26 Jan 2005 23:33:30 -0000	1.5.2.21
+++ javax/swing/AbstractButton.java	28 Jan 2005 12:12:11 -0000
@@ -1847,7 +1847,39 @@
    */
   protected String paramString()
   {
-    return "AbstractButton";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",defaultIcon=");
+    if (getIcon() != null)
+      sb.append(getIcon());
+    sb.append(",disabledIcon=");
+    if (getDisabledIcon() != null)
+      sb.append(getDisabledIcon());
+    sb.append(",disabledSelectedIcon=");
+    if (getDisabledSelectedIcon() != null)
+      sb.append(getDisabledSelectedIcon());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(getMargin());
+    sb.append(",paintBorder=").append(isBorderPainted());
+    sb.append(",paintFocus=").append(isFocusPainted());
+    sb.append(",pressedIcon=");
+    if (getPressedIcon() != null)
+      sb.append(getPressedIcon());
+    sb.append(",rolloverEnabled=").append(isRolloverEnabled());
+    sb.append(",rolloverIcon=");
+    if (getRolloverIcon() != null)
+      sb.append(getRolloverIcon());
+    sb.append(",rolloverSelected=");
+    if (getRolloverSelectedIcon() != null)
+      sb.append(getRolloverSelectedIcon());
+    sb.append(",selectedIcon=");
+    if (getSelectedIcon() != null)
+      sb.append(getSelectedIcon());
+    sb.append(",text=");
+    if (getText() != null)
+      sb.append(getText());
+    return sb.toString();
   }
 
   /**
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JComponent.java,v
retrieving revision 1.7.2.29
diff -u -r1.7.2.29 JComponent.java
--- javax/swing/JComponent.java	27 Jan 2005 21:06:39 -0000	1.7.2.29
+++ javax/swing/JComponent.java	28 Jan 2005 12:12:12 -0000
@@ -1541,7 +1541,23 @@
    */
   protected String paramString()
   {
-    return "JComponent";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",alignmentX=").append(getAlignmentX());
+    sb.append(",alignmentY=").append(getAlignmentY());
+    sb.append(",border=");
+    if (getBorder() != null)
+      sb.append(getBorder());
+    sb.append(",maximumSize=");
+    if (getMaximumSize() != null)
+      sb.append(getMaximumSize());
+    sb.append(",minimumSize=");
+    if (getMinimumSize() != null)
+      sb.append(getMinimumSize());
+    sb.append(",preferredSize=");
+    if (getPreferredSize() != null)
+      sb.append(getPreferredSize());
+    return sb.toString();
   }
 
   /**
Index: javax/swing/JMenu.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JMenu.java,v
retrieving revision 1.3.8.16
diff -u -r1.3.8.16 JMenu.java
--- javax/swing/JMenu.java	28 Jan 2005 10:46:12 -0000	1.3.8.16
+++ javax/swing/JMenu.java	28 Jan 2005 12:12:12 -0000
@@ -59,11 +59,9 @@
 import javax.swing.plaf.MenuItemUI;
 
 /**
- * <p>
  * This class represents a menu that can be added to a menu bar or
  * can be a submenu in some other menu. When JMenu is selected it
  * displays JPopupMenu containing its menu items.
- * </p>
  *
  * <p>
  * JMenu's fires MenuEvents when this menu's selection changes. If this menu
@@ -71,7 +69,6 @@
  * deselected or cancelled, then fireMenuDeselectedEvent() or 
  * fireMenuCancelledEvent() is invoked, respectivelly.
  * </p>
- *
  */
 public class JMenu extends JMenuItem implements Accessible, MenuElement
 {
@@ -272,7 +269,6 @@
       throw new IllegalArgumentException("index less than zero");
 
     popupMenu.insert(item, index);
-
     return item;
   }
 
@@ -786,7 +782,7 @@
    */
   protected String paramString()
   {
-    return "JMenu";
+    return super.paramString();
   }
 
   public AccessibleContext getAccessibleContext()
Index: javax/swing/JMenuBar.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JMenuBar.java,v
retrieving revision 1.2.18.9
diff -u -r1.2.18.9 JMenuBar.java
--- javax/swing/JMenuBar.java	26 Jan 2005 23:33:32 -0000	1.2.18.9
+++ javax/swing/JMenuBar.java	28 Jan 2005 12:12:12 -0000
@@ -313,7 +313,13 @@
    */
   protected String paramString()
   {
-    return "JMenuBar";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(getMargin());
+    sb.append(",paintBorder=").append(isBorderPainted());
+    return sb.toString();
   }
 
   /**
Index: javax/swing/JMenuItem.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JMenuItem.java,v
retrieving revision 1.2.18.18
diff -u -r1.2.18.18 JMenuItem.java
--- javax/swing/JMenuItem.java	28 Jan 2005 10:46:13 -0000	1.2.18.18
+++ javax/swing/JMenuItem.java	28 Jan 2005 12:12:12 -0000
@@ -638,7 +638,7 @@
    */
   protected String paramString()
   {
-    return "JMenuItem";
+    return super.paramString();
   }
 
   public AccessibleContext getAccessibleContext()
Index: javax/swing/JPopupMenu.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JPopupMenu.java,v
retrieving revision 1.3.8.18
diff -u -r1.3.8.18 JPopupMenu.java
--- javax/swing/JPopupMenu.java	28 Jan 2005 10:46:13 -0000	1.3.8.18
+++ javax/swing/JPopupMenu.java	28 Jan 2005 12:12:12 -0000
@@ -771,7 +771,17 @@
    */
   protected String paramString()
   {
-    return "JPopupMenu";
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",label=");
+    if (getLabel() != null)
+      sb.append(getLabel());
+    sb.append(",lightWeightPopupEnabled=").append(isLightWeightPopupEnabled());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(margin);
+    sb.append(",paintBorder=").append(isBorderPainted());
+    return sb.toString();
   }
 
   /**


More information about the Java-patches mailing list