Re: [cp-patches] FYI: fix for AbstractDocument
Hi Andrew. I'll commit this to the release branch (0.91). Do you know if this also fixes the regressions? Or anything about these whatsever? :) Yes the GapContent fix I committed on 2006-05-02 fixed these. Sorry, I though I mentioned that somewhere. Regressions: FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure4: ElementBuffer insertUpdate: third insertion (number 3) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure4: final structure (number 2) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure4: final structure (number 3) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure4: final structure (number 4) Passes. FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure5: ElementBuffer insertUpdate: second insertion (number 19) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure5: ElementBuffer insertUpdate: second insertion (number 22) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure5: ElementBuffer insertUpdate: second insertion (number 29) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure5: ElementBuffer insertUpdate: second insertion (number 30) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure5: ElementBuffer insertUpdate: second insertion (number 31) Passes. FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 19) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 23) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 26) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 29) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 33) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 34) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: fourth insertion (number 35) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 31) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 34) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 41) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 42) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 43) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 44) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.ElementStructure8: ElementBuffer insertUpdate: second insertion (number 45) [19], [23] and [26] still fail. The other pass. FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument1: second doc event (number 8) Passes. FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument2: second doc event (number 4) Passes. FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create fifth leaf element (number 1) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create fifth leaf element (number 2) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create fifth leaf element (number 5) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create fourth leaf element (number 1) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create fourth leaf element (number 2) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create fourth leaf element (number 4) FAIL: gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer.StyledDocument3: create sixth leaf element (number 1) FAIL:
[cp-patches] FYI: Qualify Map.Entry in Collections
Hi, Some versions of gcj seem to have trouble resolving the unqualified Entry class so this patch qualifies them as Map.Entry. 2006-05-11 Mark Wielaard [EMAIL PROTECTED] * java/util/Collections.java (UnmodifiableMapEntry): Qualify Map.Entry. Committed, Mark Index: java/util/Collections.java === RCS file: /cvsroot/classpath/classpath/java/util/Collections.java,v retrieving revision 1.40 diff -u -r1.40 Collections.java --- java/util/Collections.java 6 May 2006 17:05:54 - 1.40 +++ java/util/Collections.java 11 May 2006 07:54:24 - @@ -4822,9 +4822,9 @@ private static final class UnmodifiableMapEntry implements Map.Entry { -private final Entry e; +private final Map.Entry e; -private UnmodifiableMapEntry(Entry e) +private UnmodifiableMapEntry(Map.Entry e) { super(); this.e = e; @@ -4944,7 +4944,8 @@ result = new UnmodifiableMapEntry[mapEntryResult.length]; for (int i = 0; i mapEntryResult.length; i++) { -result[i] = new UnmodifiableMapEntry((Entry) mapEntryResult[i]); +Map.Entry r = (Map.Entry) mapEntryResult[i]; +result[i] = new UnmodifiableMapEntry(r); } } return result; @@ -4960,7 +4961,7 @@ { for (int i = 0; i array.length; i++) { -array[i] = new UnmodifiableMapEntry((Entry) array[i]); +array[i] = new UnmodifiableMapEntry((Map.Entry) array[i]); } } return array; signature.asc Description: This is a digitally signed message part
[cp-patches] FYI: GeneralPath/PathIterator constants fix for gcj 4.0.x
Hi, gcj 4.0.x (where x 3) seems to be unable to resolve the PathIterator used in GeneralPath. So this patch helps out that compiler. 2006-05-11 Mark Wielaard [EMAIL PROTECTED] * java/awt/geom/GeneralPath.java (WIND_EVEN_ODD, WIND_NON_ZERO): Fully qualify PathIterator constants Committed, Mark Index: java/awt/geom/GeneralPath.java === RCS file: /cvsroot/classpath/classpath/java/awt/geom/GeneralPath.java,v retrieving revision 1.14 diff -u -r1.14 GeneralPath.java --- java/awt/geom/GeneralPath.java 3 Oct 2005 17:21:09 - 1.14 +++ java/awt/geom/GeneralPath.java 11 May 2006 08:24:21 - @@ -1,5 +1,5 @@ /* GeneralPath.java -- represents a shape built from subpaths - Copyright (C) 2002, 2003, 2004 Free Software Foundation + Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -79,8 +79,16 @@ */ public final class GeneralPath implements Shape, Cloneable { - public static final int WIND_EVEN_ODD = PathIterator.WIND_EVEN_ODD; - public static final int WIND_NON_ZERO = PathIterator.WIND_NON_ZERO; + // WORKAROUND for gcj 4.0.x (x 3) + // fully qualify PathIterator constants. + + /** Same constant as [EMAIL PROTECTED] PathIterator#WIND_EVEN_ODD}. */ + public static final int WIND_EVEN_ODD += java.awt.geom.PathIterator.WIND_EVEN_ODD; + + /** Same constant as [EMAIL PROTECTED] PathIterator.WIND_NON_ZERO}. */ + public static final int WIND_NON_ZERO += java.awt.geom.PathIterator.WIND_NON_ZERO; /** Initial size if not specified. */ private static final int INIT_SIZE = 10; signature.asc Description: This is a digitally signed message part
[cp-patches] FYI: Cast null argument to String in appletviewer main
Hi, This is hopefully the last patch needed to get builder happy again (I also installed the mozilla-dev package on it). 2006-05-11 Mark Wielaard [EMAIL PROTECTED] * tools/gnu/classpath/tools/appletviewer/Main.java (main): Cast Option constructor null argument to String. Committed, Mark Index: tools/gnu/classpath/tools/appletviewer/Main.java === RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/appletviewer/Main.java,v retrieving revision 1.3 diff -u -r1.3 Main.java --- tools/gnu/classpath/tools/appletviewer/Main.java 9 May 2006 23:55:59 - 1.3 +++ tools/gnu/classpath/tools/appletviewer/Main.java 11 May 2006 08:29:53 - @@ -199,7 +199,7 @@ OptionGroup debuggingGroup = new OptionGroup(Debugging option); debuggingGroup.add(new Option(verbose, Main.messages.getString (gcjwebplugin.verbose_description), - null) + (String) null) { public void parsed(String argument) throws OptionException { @@ -209,7 +209,7 @@ OptionGroup compatibilityGroup = new OptionGroup(Compatibility options); compatibilityGroup.add(new Option(debug, Main.messages.getString (gcjwebplugin.debug_description), - null) + (String) null) { public void parsed(String argument) throws OptionException { signature.asc Description: This is a digitally signed message part
[cp-patches] FYI: BasicRadioButtonUI.paint() - minor fix
This patch (committed) fixes an argument passed to the paintFocus() method, and removes the related TODO notes from the source code: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicRadioButtonUI.java (paint): Pass component size to paintFocus(). Regards, Dave Index: javax/swing/plaf/basic/BasicRadioButtonUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java,v retrieving revision 1.16 diff -u -r1.16 BasicRadioButtonUI.java --- javax/swing/plaf/basic/BasicRadioButtonUI.java 5 May 2006 11:56:21 - 1.16 +++ javax/swing/plaf/basic/BasicRadioButtonUI.java 11 May 2006 08:31:52 - @@ -1,5 +1,5 @@ /* BasicRadioButtonUI.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. @@ -167,9 +167,8 @@ } if (text != null) paintText(g, b, tr, text); -// TODO: Figure out what is the size parameter? if (b.hasFocus() b.isFocusPainted() m.isEnabled()) - paintFocus(g, tr, null); + paintFocus(g, tr, c.getSize()); } /** @@ -177,9 +176,8 @@ * * @param g the graphics context * @param tr the rectangle for the text label - * @param size the size (??) + * @param size the size of the codeJRadioButton/code component. */ - // TODO: Figure out what for is the size parameter. protected void paintFocus(Graphics g, Rectangle tr, Dimension size) { Color focusColor = UIManager.getColor(getPropertyPrefix() + .focus);
[cp-patches] FYI: BasicCheckBoxUI.getDefaultIcon() removed
This patch (committed) removes the redundant getDefaultIcon() method in BasicCheckBoxUI. Looking at Sun's API docs, the method isn't overridden in their implementation either. 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicCheckBoxUI.java (getDefaultIcon): Removed this redundant method. Regards, Dave Index: javax/swing/plaf/basic/BasicCheckBoxUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java,v retrieving revision 1.12 diff -u -r1.12 BasicCheckBoxUI.java --- javax/swing/plaf/basic/BasicCheckBoxUI.java 15 Nov 2005 20:32:46 - 1.12 +++ javax/swing/plaf/basic/BasicCheckBoxUI.java 11 May 2006 09:02:15 - @@ -1,5 +1,5 @@ /* BasicCheckBoxUI.java - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,7 +38,6 @@ package javax.swing.plaf.basic; -import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; @@ -50,11 +49,6 @@ return new BasicCheckBoxUI(); } - public Icon getDefaultIcon() - { -return UIManager.getIcon(CheckBox.icon); - } - /** * Returns the prefix for entries in the [EMAIL PROTECTED] UIManager} defaults table. *
Re: [cp-patches] RFC: allow short keys in HMac
hello Casey, On Thursday 11 May 2006 09:51, Casey Marshall wrote: This patch allows short keys by default in the HMac class... looks fine. plsease go ahead. cheers; rsn pgpJQE84KQJ6B.pgp Description: PGP signature
[cp-patches] FYI: BasicCheckBoxUI.createUI - removed final qualifier
This patch (committed) adds some API docs and removes the final qualifier from the JComponent parameter in the createUI() method (it's not there in the specification): 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicCheckBoxUI: Added API docs plus, (createUI): Removed 'final' qualifier on method argument. Regards, Dave Index: javax/swing/plaf/basic/BasicCheckBoxUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java,v retrieving revision 1.13 diff -u -r1.13 BasicCheckBoxUI.java --- javax/swing/plaf/basic/BasicCheckBoxUI.java 11 May 2006 09:04:49 - 1.13 +++ javax/swing/plaf/basic/BasicCheckBoxUI.java 11 May 2006 09:22:08 - @@ -38,19 +38,32 @@ package javax.swing.plaf.basic; +import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; +/** + * A UI delegate for the [EMAIL PROTECTED] JCheckBox} component. + */ public class BasicCheckBoxUI extends BasicRadioButtonUI { - public static ComponentUI createUI(final JComponent c) { + /** + * Returns a UI delegate (that is, an instance of this class) for the + * specified component. + * + * @param c the component (this should be a [EMAIL PROTECTED] JCheckBox}). + * + * @return A new instance of codeBasicCheckBoxUI/code. + */ + public static ComponentUI createUI(JComponent c) { return new BasicCheckBoxUI(); } /** - * Returns the prefix for entries in the [EMAIL PROTECTED] UIManager} defaults table. + * Returns the prefix for entries in the [EMAIL PROTECTED] UIManager} defaults table + * (codeCheckBox./code in this case). * * @return CheckBox. */
Re: [cp-patches] FYI: GeneralPath/PathIterator constants fix for gcj 4.0.x
On Thu, 11 May 2006 10:24:39 +0200 Mark Wielaard [EMAIL PROTECTED] wrote: Hi, gcj 4.0.x (where x 3) seems to be unable to resolve the PathIterator used in GeneralPath. So this patch helps out that compiler. 2006-05-11 Mark Wielaard [EMAIL PROTECTED] * java/awt/geom/GeneralPath.java (WIND_EVEN_ODD, WIND_NON_ZERO): Fully qualify PathIterator constants Committed, Mark Mark, Have you committed this to the release branch as well? Cheers, -- Andrew :-) Department of Computer Science University of Sheffield http://www.dcs.shef.ac.uk/~andrew Say No2ID - Renew your UK passport in May 2006 http://www.renewforfreedom.org pgp3MPdEobrxZ.pgp Description: PGP signature
[cp-patches] FYI: BasicToggleButtonUI.java - tidy up
This patch (committed) tidies up the BasicToggleButtonUI class a little: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/basic/BasicToggleButtonUI.java: Updated API docs, (createUI): Removed 'final' qualifier for parameter, (paint): Reformatted. Regards, Dave Index: javax/swing/plaf/basic/BasicToggleButtonUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java,v retrieving revision 1.13 diff -u -r1.13 BasicToggleButtonUI.java --- javax/swing/plaf/basic/BasicToggleButtonUI.java 7 Oct 2005 11:29:24 - 1.13 +++ javax/swing/plaf/basic/BasicToggleButtonUI.java 11 May 2006 09:50:12 - @@ -1,5 +1,5 @@ /* BasicToggleButtonUI.java - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,21 +44,35 @@ import javax.swing.AbstractButton; import javax.swing.JComponent; +import javax.swing.JToggleButton; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; +/** + * A UI delegate for the [EMAIL PROTECTED] JToggleButton} component. + */ public class BasicToggleButtonUI extends BasicButtonUI { - public static ComponentUI createUI(final JComponent component) + + /** + * Returns a UI delegate for the specified component. + * + * @param component the component (should be an instance of + * [EMAIL PROTECTED] JToggleButton}). + * + * @return An instance of codeBasicToggleButtonUI/code. + */ + public static ComponentUI createUI(JComponent component) { return new BasicToggleButtonUI(); } /** - * Returns the prefix for the UI defaults property for this UI class. - * This is apos;ToggleButtonapos; for this class. + * Returns the prefix for entries in the [EMAIL PROTECTED] UIManager} defaults table + * (codeToggleButton./code in this case). * - * @return the prefix for the UI defaults property + * @return codeToggleButton./code */ protected String getPropertyPrefix() { @@ -89,15 +103,10 @@ else vr = SwingUtilities.getLocalBounds(b); String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f), - b.getText(), - currentIcon(b), - b.getVerticalAlignment(), - b.getHorizontalAlignment(), - b.getVerticalTextPosition(), - b.getHorizontalTextPosition(), - vr, ir, tr, - b.getIconTextGap() - + defaultTextShiftOffset); +b.getText(), currentIcon(b), b.getVerticalAlignment(), +b.getHorizontalAlignment(), b.getVerticalTextPosition(), +b.getHorizontalTextPosition(), vr, ir, tr, b.getIconTextGap() ++ defaultTextShiftOffset); if ((b.getModel().isArmed() b.getModel().isPressed()) || b.isSelected())
[cp-patches] FYI: WindowConstants.java - updated API docs
This patch (committed) updates the API docs for WindowConstants.java: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/WindowConstants.java: Updated API docs. Regards, Dave Index: javax/swing/WindowConstants.java === RCS file: /sources/classpath/classpath/javax/swing/WindowConstants.java,v retrieving revision 1.6 diff -u -r1.6 WindowConstants.java --- javax/swing/WindowConstants.java13 Sep 2005 09:17:21 - 1.6 +++ javax/swing/WindowConstants.java11 May 2006 10:12:19 - @@ -1,5 +1,5 @@ /* WindowConstants.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,31 +38,42 @@ package javax.swing; /** - * Defines some constants that are used in Swing's top-level - * containers. - * + * Defines some constants that are used in Swing's top-level containers. See + * the following methods: + * ul + * li[EMAIL PROTECTED] JFrame#setDefaultCloseOperation(int)};/li + * li[EMAIL PROTECTED] JInternalFrame#setDefaultCloseOperation(int)};/li + * li[EMAIL PROTECTED] JDialog#setDefaultCloseOperation(int)};/li + * /ul + * * @author Andrew Selkirk */ public interface WindowConstants { /** - * DO_NOTHING_ON_CLOSE + * Do nothing when the container is closed. */ int DO_NOTHING_ON_CLOSE = 0; /** - * HIDE_ON_CLOSE + * Hide the container when it is closed. */ int HIDE_ON_CLOSE = 1; /** - * DISPOSE_ON_CLOSE + * Dispose the container when it is closed. + * + * @see Window#dispose() */ int DISPOSE_ON_CLOSE = 2; /** - * EXIT_ON_CLOSE + * Exit the application when the container is closed. + * + * @see System#exit(int) + * + * @since 1.4 */ - int EXIT_ON_CLOSE =3; + int EXIT_ON_CLOSE = 3; }
[cp-patches] FYI: add Component.dispatchEventImpl comment
Hi, I decided to add a comment to my last change to make the intention more clear. The ChangeLog: 2006-05-11 Robert Schuster [EMAIL PROTECTED] * java/awt/Component.java: (dispatchEventImpl): Added comment. cya Robert Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.117 diff -u -r1.117 Component.java --- java/awt/Component.java 11 May 2006 08:24:35 - 1.117 +++ java/awt/Component.java 11 May 2006 08:33:05 - @@ -5052,6 +5052,10 @@ .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: +// A mouse click on an enabled lightweight component +// which has not yet been marked as consumed by any +// other mouse listener results in a focus traversal +// to that component. if (isLightweight() isEnabled() !e.isConsumed()) requestFocus(); signature.asc Description: OpenPGP digital signature
[cp-patches] FYI: Component.dispatchEventImpl fix
Hi, the attached patch corrects the behavior when processing mouse clicks on lightweight components: Normally a mouse-click into a Swing component is results in a focus traversal to that component. However this should be suppressed when the component is not enabled. This fixes that the cursor is illegally displayed when someone clicks on a disabled text component. The ChangeLog: 2006-05-11 Robert Schuster [EMAIL PROTECTED] * java/awt/Component.java: (dispatchEventImpl): Added subexpression to if-clause. cya Robert Index: java/awt/Component.java === RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.116 diff -u -r1.116 Component.java --- java/awt/Component.java 7 May 2006 00:13:45 - 1.116 +++ java/awt/Component.java 11 May 2006 08:21:07 - @@ -5052,7 +5052,8 @@ .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: -if (isLightweight() !e.isConsumed()) +if (isLightweight() + isEnabled() !e.isConsumed()) requestFocus(); break; } signature.asc Description: OpenPGP digital signature
[cp-patches] FYI: JFrame.paramString() reimplemented
This patch (committed) reimplements the paramString() method in JFrame to provide better debug info. I also added a utility method to SwingUtilities to help with this: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/JFrame.java (paramString): Reimplemented, * javax/swing/SwingUtilities.java (convertWindowConstantToString): New method. Regards, Dave Index: javax/swing/JFrame.java === RCS file: /sources/classpath/classpath/javax/swing/JFrame.java,v retrieving revision 1.33 diff -u -r1.33 JFrame.java --- javax/swing/JFrame.java 30 Jan 2006 15:32:21 - 1.33 +++ javax/swing/JFrame.java 11 May 2006 10:43:14 - @@ -301,9 +301,24 @@ return close_action; } + /** + * Returns a string describing the attributes for the codeJFrame/code, + * for use in debugging. The return value is guaranteed to be + * non-codenull/code, but the format may vary between implementations. + * + * @return A string describing the attributes of the codeJFrame/code. + */ protected String paramString() { -return JFrame; +StringBuffer sb = new StringBuffer(super.paramString()); +sb.append(,defaultCloseOperation=); +sb.append(SwingUtilities.convertWindowConstantToString( +getDefaultCloseOperation())); +sb.append(,rootPane=); +if (rootPane != null) + sb.append(rootPane); +sb.append(,rootPaneCheckingEnabled=).append(rootPaneCheckingEnabled); +return sb.toString(); } protected void processWindowEvent(WindowEvent e) Index: javax/swing/SwingUtilities.java === RCS file: /sources/classpath/classpath/javax/swing/SwingUtilities.java,v retrieving revision 1.52 diff -u -r1.52 SwingUtilities.java --- javax/swing/SwingUtilities.java 9 May 2006 07:17:25 - 1.52 +++ javax/swing/SwingUtilities.java 11 May 2006 10:43:16 - @@ -1548,4 +1548,55 @@ throw new IllegalArgumentException(Unrecognised code: + code); } } + + /** + * Returns a string representing one of the default operation codes + * defined in the [EMAIL PROTECTED] WindowConstants} interface. The following table + * lists the constants and return values: + * p + * table border=0 + * tr + * thCode:/ththReturned String:/th + * /tr + * tr + * td[EMAIL PROTECTED] WindowConstants#DO_NOTHING_ON_CLOSE}/td + * tdcodeDO_NOTHING_ON_CLOSE/code/td + * /tr + * tr + * td[EMAIL PROTECTED] WindowConstants#HIDE_ON_CLOSE}/td + * tdcodeHIDE_ON_CLOSE/code/td + * /tr + * tr + * td[EMAIL PROTECTED] WindowConstants#DISPOSE_ON_CLOSE}/td + * tdcodeDISPOSE_ON_CLOSE/code/td + * /tr + * tr + * td[EMAIL PROTECTED] WindowConstants#EXIT_ON_CLOSE}/td + * tdcodeEXIT_ON_CLOSE/code/td + * /tr + * /table + * /p + * If the supplied code is not one of those listed, this method will throw + * an [EMAIL PROTECTED] IllegalArgumentException}. + * + * @param code the code. + * + * @return A string representing the given code. + */ + static String convertWindowConstantToString(int code) + { +switch (code) +{ + case WindowConstants.DO_NOTHING_ON_CLOSE: +return DO_NOTHING_ON_CLOSE; + case WindowConstants.HIDE_ON_CLOSE: +return HIDE_ON_CLOSE; + case WindowConstants.DISPOSE_ON_CLOSE: +return DISPOSE_ON_CLOSE; + case WindowConstants.EXIT_ON_CLOSE: +return EXIT_ON_CLOSE; + default: +throw new IllegalArgumentException(Unrecognised code: + code); +} + } }
[cp-patches] FYI: JFrame.java - misc small updates
This patch (committed) contains miscellaneous updates (mostly API docs) as listed: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/JFrame.java (EXIT_ON_CLOSE): Added note to API docs, (close_action): Renamed closeAction, (JFrame()): Change title to , (JFrame(String)): Added API docs, (getAccessibleContext): Likewise, (getDefaultCloseOperation): Updated for renamed field, added API docs, (processWindowEvent): Updated for renamed field, (setDefaultCloseOperation): Likewise, and updated API docs. Regards, Dave Index: javax/swing/JFrame.java === RCS file: /sources/classpath/classpath/javax/swing/JFrame.java,v retrieving revision 1.34 diff -u -r1.34 JFrame.java --- javax/swing/JFrame.java 11 May 2006 10:51:03 - 1.34 +++ javax/swing/JFrame.java 11 May 2006 11:10:58 - @@ -1,5 +1,5 @@ /* JFrame.java -- - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -86,6 +86,8 @@ /** * A flag for [EMAIL PROTECTED] #setDefaultCloseOperation(int)}, indicating that the * application should be exited, when this codeJFrame/code is closed. + * Note that in version 1.4, the equivalent constant has been added to + * [EMAIL PROTECTED] WindowConstants}. * * @since 1.3 */ @@ -93,7 +95,7 @@ private static final long serialVersionUID = -3362141868504252139L; private static boolean defaultLookAndFeelDecorated; - private int close_action = HIDE_ON_CLOSE; + private int closeAction = HIDE_ON_CLOSE; protected AccessibleContext accessibleContext; protected JRootPane rootPane; @@ -102,12 +104,20 @@ */ protected boolean rootPaneCheckingEnabled = false; + /** + * Creates a new frame with an empty string for the title. + */ public JFrame() { -super(JFrame); +super(); frameInit(); } + /** + * Creates a new codeJFrame/code with the specified title. + * + * @param title the frame title (codenull/code permitted). + */ public JFrame(String title) { super(title); @@ -289,6 +299,12 @@ return defaultLookAndFeelDecorated; } + /** + * Returns the object that provides accessibility features for this + * codeJFrame/code. + * + * @return The accessible context (an instance of [EMAIL PROTECTED] AccessibleJFrame}). + */ public AccessibleContext getAccessibleContext() { if (accessibleContext == null) @@ -296,9 +312,19 @@ return accessibleContext; } + /** + * Returns a code for the default operation when the frame is closed. The + * default value is [EMAIL PROTECTED] WindowConstants#HIDE_ON_CLOSE}. + * + * @return One of: [EMAIL PROTECTED] WindowConstants#DO_NOTHING_ON_CLOSE}, + * [EMAIL PROTECTED] WindowConstants#HIDE_ON_CLOSE}, + * [EMAIL PROTECTED] WindowConstants#DISPOSE_ON_CLOSE}, [EMAIL PROTECTED] #EXIT_ON_CLOSE}. + * + * @see #setDefaultCloseOperation(int) + */ public int getDefaultCloseOperation() { -return close_action; +return closeAction; } /** @@ -328,7 +354,7 @@ { case WindowEvent.WINDOW_CLOSING: { - switch (close_action) + switch (closeAction) { case EXIT_ON_CLOSE: { @@ -361,17 +387,22 @@ } /** - * Defines what happens when this frame is closed. Can be one off - * codeEXIT_ON_CLOSE/code, - * codeDISPOSE_ON_CLOSE/code, - * codeHIDE_ON_CLOSE/code or - * codeDO_NOTHING_ON_CLOSE/code. - * The default is codeHIDE_ON_CLOSE/code. - * When codeEXIT_ON_CLOSE/code is specified this method calls + * Sets the default operation that is performed when this frame is closed. + * The default is codeHIDE_ON_CLOSE/code. When + * codeEXIT_ON_CLOSE/code is specified this method calls * codeSecurityManager.checkExit(0)/code which might throw a - * codeSecurityException/code. When the specified operation is - * not one of the above a codeIllegalArgumentException/code is - * thrown. + * codeSecurityException/code. + * + * @param operation a code for the operation (one of: + * [EMAIL PROTECTED] WindowConstants#DO_NOTHING_ON_CLOSE}, + * [EMAIL PROTECTED] WindowConstants#HIDE_ON_CLOSE}, + * [EMAIL PROTECTED] WindowConstants#DISPOSE_ON_CLOSE} and + * [EMAIL PROTECTED] WindowConstants#EXIT_ON_CLOSE}). + * + * @throws IllegalArgumentException if codeoperation/code is not one of + * the specified codes. + * + * @see #getDefaultCloseOperation() */ public void setDefaultCloseOperation(int operation) { @@ -381,8 +412,9 @@ if (operation != EXIT_ON_CLOSE operation != DISPOSE_ON_CLOSE operation != HIDE_ON_CLOSE operation != DO_NOTHING_ON_CLOSE) - throw new
[cp-patches] Fw: [cp-testresults] FAIL: classpath [0.91-pre] (future release) build with gcj (4.0) on Thu May 11 10:51:34 UTC 2006
Begin forwarded message: Date: Thu, 11 May 2006 10:51:34 + From: [EMAIL PROTECTED] To: classpath-testresults@gnu.org Subject: [cp-testresults] FAIL: classpath [0.91-pre] (future release) build with gcj (4.0) on Thu May 11 10:51:34 UTC 2006 /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-CORBA-Interceptor.deps -MT lists/gnu-CORBA-Interceptor.stamp -MP @lists/gnu-CORBA-Interceptor.list echo timestamp lists/gnu-CORBA-Interceptor.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-CORBA-NamingService.deps -MT lists/gnu-CORBA-NamingService.stamp -MP @lists/gnu-CORBA-NamingService.list echo timestamp lists/gnu-CORBA-NamingService.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-CORBA-Poa.deps -MT lists/gnu-CORBA-Poa.stamp -MP @lists/gnu-CORBA-Poa.list echo timestamp lists/gnu-CORBA-Poa.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-CORBA-interfaces.deps -MT lists/gnu-CORBA-interfaces.stamp -MP @lists/gnu-CORBA-interfaces.list echo timestamp lists/gnu-CORBA-interfaces.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-CORBA-typecodes.deps -MT lists/gnu-CORBA-typecodes.stamp -MP @lists/gnu-CORBA-typecodes.list echo timestamp lists/gnu-CORBA-typecodes.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-CORBA.deps -MT lists/gnu-CORBA.stamp -MP @lists/gnu-CORBA.list echo timestamp lists/gnu-CORBA.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-classpath-debug.deps -MT lists/gnu-classpath-debug.stamp -MP @lists/gnu-classpath-debug.list echo timestamp lists/gnu-classpath-debug.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-classpath-jdwp.deps -MT lists/gnu-classpath-jdwp.stamp -MP @lists/gnu-classpath-jdwp.list echo timestamp lists/gnu-classpath-jdwp.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-classpath.deps -MT lists/gnu-classpath.stamp -MP @lists/gnu-classpath.list echo timestamp lists/gnu-classpath.stamp /usr/local/bin/gcj -Wno-deprecated --encoding=UTF-8 --bootclasspath '' --classpath ..:../../classpath/vm/reference:../../classpath:../../classpath/external/w3c_dom:../../classpath/external/sax:../../classpath/external/relaxngDatatype:.: -C -d . -MD -MF lists/gnu-java-awt.deps -MT lists/gnu-java-awt.stamp -MP @lists/gnu-java-awt.list ../../classpath/java/awt/geom/GeneralPath.java: In class 'gnu.java.awt.font.opentype.truetype.Zone': ../../classpath/java/awt/geom/GeneralPath.java: In method 'gnu.java.awt.font.opentype.truetype.Zone.getPath()': ../../classpath/java/awt/geom/GeneralPath.java:83: error: Undefined variable or class name: 'PathIterator.WIND_NON_ZERO'. public static final int WIND_NON_ZERO = PathIterator.WIND_NON_ZERO; ^ 1 error make[2]: *** [lists/gnu-java-awt.stamp] Error 1 make[2]: Leaving directory `/home/cpdev/Nightly/classpath-future-release/build/lib' make[1]: *** [compile-classes] Error 2 make[1]: Leaving directory `/home/cpdev/Nightly/classpath-future-release/build/lib' make: *** [all-recursive] Error 1
[cp-patches] Logger initialization regression fix and a little story on security contexts during class initialization
Hi, We had an interesting regression with the logging code in GNU Classpath. It wasn't immediately apparent because it was only caused with certain compilers. The class initialization order was subtly different between byte code compiled with gcj -C and jikes. So it didn't show up with gcj -C which I used when committing this code. The mauve test pointed out that an unexpected SecurityManager check was made in some cases. Those cases were when the Logger class was initialized for the first time. This is an interesting case since depending on how/where a class is first initialized its static constructor will be run in different security context. So the fix is to initialize the global Logger in a PrivilegedAction to make sure that even if the first class initialization is done through a untrusted context the static fields can be initialized. What makes this really awkward is that if a class is initialized from a untrusted context for the first time and throws a SecurityException from its static constructor that class can then NEVER be initialized again, even if it is loaded through a privileged context. 2006-05-11 Mark Wielaard [EMAIL PROTECTED] * java/util/logging/Logger.java (global): Initialize inside static PrivilegedAction. Unfortunately this patch only solves the real world scenario. It doesn't solve the mauve failure since the security manager used in the test doesn't actually use the security context to see whether the calls are made with the right privileges. It is actually hard to figure out how to test for this situation correctly. Because depends on when exactly the class is first initialized. So for now I just make sure that the logging framework is completely initialized before installing the test security manager. 2006-05-11 Mark Wielaard [EMAIL PROTECTED] * gnu/testlet/java/util/logging/Handler/TestSecurityManager.java (install): Initialize LogManager first. * gnu/testlet/java/util/logging/Logger/TestSecurityManager.java (install): Likewise. What we really need is a test that is run with minimal privileges and install a real security manager that respect the whole security context (through AccessController) which then tries to load every class to see whether or not they can at least be initialized properly from such a minimal security context. The problem with that is that while setting up such a test part of the core classes are already initialized of course. So it is hard to get anything that really tests it all. Both patches have been committed to classpath and mauve. The classpath patch will also go onto the release branch. Cheers, Mark Index: java/util/logging/Logger.java === RCS file: /cvsroot/classpath/classpath/java/util/logging/Logger.java,v retrieving revision 1.13 diff -u -r1.13 Logger.java --- java/util/logging/Logger.java 3 Apr 2006 08:59:53 - 1.13 +++ java/util/logging/Logger.java 11 May 2006 12:10:58 - @@ -41,6 +41,8 @@ import java.util.List; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.security.AccessController; +import java.security.PrivilegedAction; /** * A Logger is used for logging information about events. Usually, there @@ -76,7 +78,20 @@ * products are supposed to create and use their own Loggers, so * they can be controlled individually. */ - public static final Logger global = getLogger(global); + public static final Logger global; + + static +{ + // Our class might be initialized from an unprivileged context + global = (Logger) AccessController.doPrivileged + (new PrivilegedAction() + { + public Object run() + { + return getLogger(global); + } + }); +} /** Index: gnu/testlet/java/util/logging/Handler/TestSecurityManager.java === RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/logging/Handler/TestSecurityManager.java,v retrieving revision 1.1 diff -u -r1.1 TestSecurityManager.java --- gnu/testlet/java/util/logging/Handler/TestSecurityManager.java 10 Mar 2004 23:20:42 - 1.1 +++ gnu/testlet/java/util/logging/Handler/TestSecurityManager.java 11 May 2006 12:25:48 - @@ -24,7 +24,7 @@ import java.security.Permission; import java.security.AccessControlException; import java.util.logging.LoggingPermission; - +import java.util.logging.LogManager; /** * A SecurityManager that can be told whether or not to grant @@ -57,6 +57,9 @@ public void install() { +// Make sure the LogManager is fully installed first. +LogManager lm = LogManager.getLogManager(); + SecurityManager oldsm = System.getSecurityManager(); if (oldsm == this) Index: gnu/testlet/java/util/logging/Logger/TestSecurityManager.java === RCS file:
Re: [cp-patches] RFC: ClassLoader reference implementation using getResources
Lillian Angel wrote: Not sure if it helps, but there is an IndexListParser in gnu/java/net Right, it can be useful. Not in its current state as far as I understand the code because it focus on retrieving the list of dependant jar urls from one .jar while I need to get the list of the packages referenced in all dependant (or own) .jar from many resource. Anyway, I think it's better to add some code in the Parser rather than the reference layer. I'll handle this (when I'll have time). Thx +Olivier 2006-05-11 Olivier Jolly [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getBootPackages): Use getResources to allow retrieving the glizj.zip META-INF/INDEX.LIST entry even if some endorsed jar file embed one.
Re: [cp-patches] Logger initialization regression fix and a little story on security contexts during class initialization
Mark Wielaard wrote: We had an interesting regression with the logging code in GNU Classpath. It wasn't immediately apparent because it was only caused with certain compilers. The class initialization order was subtly different between byte code compiled with gcj -C and jikes. So it didn't show up with gcj -C which I used when committing this code. Since class initialization is strictly defined by the JVM spec, doesn't this necessarily imply a bug in either gcj or jikes? The only other alternative is that they both compile the same code correctly, but do so differenly enough to change the class initialization order, which to me seems even more surprising (but possible I guess.. ?) -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com
[cp-patches] FYI: GNUGlyphVector fixlet
In GNUGlyphVector we were applying the FontRenderedContext's transform to the resulting shape, which is wrong. The transformation is only a hint to the font shaper how the rasterizer will finally render the glyph, so that it can fit the font perfectly into the destination grid. 2006-05-11 Roman Kennke [EMAIL PROTECTED] * gnu/java/awt/font/GNUGlyphVector.java (GNUGlyphVector): Don't apply the font renderer context's transform. /Roman Index: gnu/java/awt/font/GNUGlyphVector.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/font/GNUGlyphVector.java,v retrieving revision 1.1 diff -u -1 -0 -r1.1 GNUGlyphVector.java --- gnu/java/awt/font/GNUGlyphVector.java 30 Apr 2006 09:45:11 - 1.1 +++ gnu/java/awt/font/GNUGlyphVector.java 11 May 2006 14:14:01 - @@ -103,21 +103,21 @@ FontRenderContext renderContext, int[] glyphs) { this.fontDelegate = fontDelegate; this.font = font; this.renderContext = renderContext; this.glyphs = glyphs; fontSize = font.getSize2D(); transform = font.getTransform(); // returns a modifiable copy -transform.concatenate(renderContext.getTransform()); +//transform.concatenate(renderContext.getTransform()); } /** * Returns the font of the glyphs in this GlyphVector. */ public Font getFont() { return font;
Re: [cp-patches] RFC: ClassLoader reference implementation using getResources
On Thu, 2006-05-11 at 15:43 +0200, Olivier Jolly wrote: Lillian Angel wrote: Not sure if it helps, but there is an IndexListParser in gnu/java/net Right, it can be useful. Not in its current state as far as I understand the code because it focus on retrieving the list of dependant jar urls from one .jar while I need to get the list of the packages referenced in all dependant (or own) .jar from many resource. Anyway, I think it's better to add some code in the Parser rather than the reference layer. I'll handle this (when I'll have time). Yep, no problem. Feel free to add all the code you want to that parser... I only implemented what I needed. Thx +Olivier 2006-05-11 Olivier Jolly [EMAIL PROTECTED] * vm/reference/java/lang/VMClassLoader.java (getBootPackages): Use getResources to allow retrieving the glizj.zip META-INF/INDEX.LIST entry even if some endorsed jar file embed one.
[cp-patches] FYI: Formatting in javax.swing.plaf.multi
This patch (committed) fixes a couple of deviations from our code formatting rules: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/multi/MultiComboBoxUI.java: Minor formatting change, * javax/swing/plaf/multi/MultiFileChooserUI.java: Likewise, * javax/swing/plaf/multi/MultiListUI.java: Likewise, * javax/swing/plaf/multi/MultiLookAndFeel.java: Likewise, * javax/swing/plaf/multi/MultiOptionPaneUI.java: Likewise, * javax/swing/plaf/multi/MultiSplitPaneUI.java: Likewise, * javax/swing/plaf/multi/MultiTabbedPaneUI.java: Likewise. Regards, Dave Index: javax/swing/plaf/multi/MultiComboBoxUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/multi/MultiComboBoxUI.java,v retrieving revision 1.1 diff -u -r1.1 MultiComboBoxUI.java --- javax/swing/plaf/multi/MultiComboBoxUI.java 18 Aug 2005 11:18:01 - 1.1 +++ javax/swing/plaf/multi/MultiComboBoxUI.java 11 May 2006 16:20:03 - @@ -357,7 +357,8 @@ * @param c the component. * @param visible the visible state. */ - public void setPopupVisible(JComboBox c, boolean visible) { + public void setPopupVisible(JComboBox c, boolean visible) + { Iterator iterator = uis.iterator(); while (iterator.hasNext()) { @@ -376,7 +377,8 @@ * * @return The result for the UI delegate from the primary look and feel. */ - public boolean isPopupVisible(JComboBox c) { + public boolean isPopupVisible(JComboBox c) + { boolean result = false; Iterator iterator = uis.iterator(); // first UI delegate provides the return value @@ -406,7 +408,8 @@ * UI delegate in the primary look and feel, and codefalse/code * otherwise. */ - public boolean isFocusTraversable(JComboBox c) { + public boolean isFocusTraversable(JComboBox c) + { boolean result = false; Iterator iterator = uis.iterator(); // first UI delegate provides the return value Index: javax/swing/plaf/multi/MultiFileChooserUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/multi/MultiFileChooserUI.java,v retrieving revision 1.1 diff -u -r1.1 MultiFileChooserUI.java --- javax/swing/plaf/multi/MultiFileChooserUI.java 18 Aug 2005 11:18:01 - 1.1 +++ javax/swing/plaf/multi/MultiFileChooserUI.java 11 May 2006 16:20:04 - @@ -364,7 +364,8 @@ * @return The filter returned by the UI delegate from the primary * look and feel. */ - public FileFilter getAcceptAllFileFilter(JFileChooser chooser) { + public FileFilter getAcceptAllFileFilter(JFileChooser chooser) + { FileFilter result = null; Iterator iterator = uis.iterator(); // first UI delegate provides the return value @@ -393,7 +394,8 @@ * @return The view returned by the UI delegate from the primary * look and feel. */ - public FileView getFileView(JFileChooser chooser) { + public FileView getFileView(JFileChooser chooser) + { FileView result = null; Iterator iterator = uis.iterator(); // first UI delegate provides the return value @@ -422,7 +424,8 @@ * @return The text returned by the UI delegate from the primary * look and feel. */ - public String getApproveButtonText(JFileChooser chooser) { + public String getApproveButtonText(JFileChooser chooser) + { String result = null; Iterator iterator = uis.iterator(); // first UI delegate provides the return value @@ -451,7 +454,8 @@ * @return The title returned by the UI delegate from the primary * look and feel. */ - public String getDialogTitle(JFileChooser chooser) { + public String getDialogTitle(JFileChooser chooser) + { String result = null; Iterator iterator = uis.iterator(); // first UI delegate provides the return value @@ -476,7 +480,8 @@ * * @param chooser the file chooser. */ - public void rescanCurrentDirectory(JFileChooser chooser) { + public void rescanCurrentDirectory(JFileChooser chooser) + { Iterator iterator = uis.iterator(); while (iterator.hasNext()) { @@ -493,7 +498,8 @@ * @param chooser the file chooser. * @param file the file. */ - public void ensureFileIsVisible(JFileChooser chooser, File file) { + public void ensureFileIsVisible(JFileChooser chooser, File file) + { Iterator iterator = uis.iterator(); while (iterator.hasNext()) { Index: javax/swing/plaf/multi/MultiListUI.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/multi/MultiListUI.java,v retrieving revision 1.1 diff -u -r1.1 MultiListUI.java --- javax/swing/plaf/multi/MultiListUI.java 18 Aug 2005 11:18:01 - 1.1 +++ javax/swing/plaf/multi/MultiListUI.java 11 May 2006
[cp-patches] FYI: DefaultCaret and JTextComponent fixes
Hi, before applying this patch we had a couple of issues with the DefaultCaret and JTextComponent: - cut(), copy() and paste() worked even if the component is disabled or in a non-editable state (observed how RI works and mimiced their behavior) - caret was drawn even if the component is disabled and/or non-editable As kind of addition: If you put the following ActionListener on a JTextField tf: new ActionListener(){ public void actionPerformed(ae){ tf.setEditable(!tf.isEditable()); } }; And invoke it the RI will always paint the Caret (until it loses its focus and regains it later). We do not - which is a bit more correct. :) The ChangeLog: 2006-05-11 Robert Schuster [EMAIL PROTECTED] * javax/swing/text/DefaultCaret.java: Made field 'textComponent' package-private, added field 'active'. (PropertyChangeHandler.propertyChange): Added variable 'name', added cases to update field 'active'. (mouseDragged): Added documentation, added if-clause to update selection or caret position. (mouseClicked): Added early return when text component is disabled. (focusGained): Moved statements into an if-clause. (focusLost): Added subexpression to if-clause. (install): Preset value of 'active'. (paint): Added subexpression to if-clause. (isVisible): Extended return expression. * javax/swing/text/JTextComponent.java: (copy): Copy only if component is enabled. (cut): Cut only if component is enabled and editable. (paste): Dito. cya Robert Index: javax/swing/text/DefaultCaret.java === RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v retrieving revision 1.40 diff -u -r1.40 DefaultCaret.java --- javax/swing/text/DefaultCaret.java 3 May 2006 18:11:05 - 1.40 +++ javax/swing/text/DefaultCaret.java 11 May 2006 16:07:10 - @@ -216,13 +216,26 @@ */ public void propertyChange(PropertyChangeEvent e) { - if (e.getPropertyName().equals(document)) + String name = e.getPropertyName(); + + if (name.equals(document)) { Document oldDoc = (Document) e.getOldValue(); oldDoc.removeDocumentListener(documentListener); Document newDoc = (Document) e.getNewValue(); newDoc.addDocumentListener(documentListener); } + else if (name.equals(editable)) +{ + active = (((Boolean) e.getNewValue()).booleanValue() +textComponent.isEnabled()); +} + else if (name.equals(enabled)) +{ + active = (((Boolean) e.getNewValue()).booleanValue() +textComponent.isEditable()); +} + } } @@ -281,8 +294,10 @@ /** * The text component in which this caret is installed. + * + * (Package private to avoid synthetic accessor method.) */ - private JTextComponent textComponent; + JTextComponent textComponent; /** * Indicates if the selection should be visible or not. @@ -314,6 +329,12 @@ * package private to avoid an accessor method. */ boolean visible = false; + + /** Indicates whether the text component where the caret is installed is + * editable and enabled. If either of these properties is codefalse/code + * the caret is not drawn. + */ + boolean active = true; /** * The current highlight entry. @@ -388,14 +409,23 @@ /** * Moves the caret position when the mouse is dragged over the text - * component, modifying the selection accordingly. + * component, modifying the selectiony. + * + * pWhen the text component where the caret is installed is disabled, + * the selection is not change but you can still scroll the text and + * update the caret's location./p * * @param event the codeMouseEvent/code describing the drag operation */ public void mouseDragged(MouseEvent event) { if (event.getButton() == MouseEvent.BUTTON1) - moveCaret(event); + { +if (textComponent.isEnabled()) + moveCaret(event); +else + positionCaret(event); + } } /** @@ -426,6 +456,10 @@ */ public void mouseClicked(MouseEvent event) { +// Do not modify selection if component is disabled. +if (!textComponent.isEnabled()) + return; + int count = event.getClickCount(); if (event.getButton() == MouseEvent.BUTTON1 count = 2) @@ -523,7 +557,7 @@ // implemented (in regard to text components): // - a left-click moves the caret // - a left-click when shift is held down expands the selection -// - a right-click or click with any additionaly mouse button +// - a right-click or click with any additional mouse button // on a text component is ignored // - a middle-click positions the caret and pastes the clipboard // contents.
[cp-patches] FYI: javax.swing.plaf.metal.* - format/style updates
This patch (committed) cleans up some formatting/style issues: 2006-05-11 David Gilbert [EMAIL PROTECTED] * javax/swing/plaf/metal/MetalBorders.java: Clean up formatting/style, * javax/swing/plaf/metal/MetalButtonUI.java: Likewise, * javax/swing/plaf/metal/MetalCheckBoxUI.java: Likewise, * javax/swing/plaf/metal/MetalComboBoxButton.java: Likewise, * javax/swing/plaf/metal/MetalComboBoxIcon.java: Likewise, * javax/swing/plaf/metal/MetalFileChooserUI.java: Likewise, * javax/swing/plaf/metal/MetalIconFactory.java: Likewise, * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java: Likewise, * javax/swing/plaf/metal/MetalLookAndFeel.java: Likewise, * javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java: Likewise, * javax/swing/plaf/metal/MetalRootPaneUI.java: Likewise, * javax/swing/plaf/metal/MetalScrollBarUI.java: Likewise, * javax/swing/plaf/metal/MetalSeparatorUI.java: Likewise, * javax/swing/plaf/metal/MetalSliderUI.java: Likewise, * javax/swing/plaf/metal/MetalSplitPaneDivider.java: Likewise, * javax/swing/plaf/metal/MetalTabbedPaneUI.java: Likewise, * javax/swing/plaf/metal/MetalToolTipUI.java: Likewise, * javax/swing/plaf/metal/MetalUtils.java: Likewise. Regards, Dave Index: javax/swing/plaf/metal/MetalBorders.java === RCS file: /sources/classpath/classpath/javax/swing/plaf/metal/MetalBorders.java,v retrieving revision 1.33 diff -u -r1.33 MetalBorders.java --- javax/swing/plaf/metal/MetalBorders.java25 Mar 2006 00:01:59 - 1.33 +++ javax/swing/plaf/metal/MetalBorders.java11 May 2006 16:58:17 - @@ -191,7 +191,7 @@ { // The normal border. This is used when the button is not // pressed or the button is not armed. - if (! (bmodel.isPressed() bmodel.isArmed()) ) + if (! (bmodel.isPressed() bmodel.isArmed())) { // draw light border g.setColor(light); @@ -568,12 +568,12 @@ { boolean enabledTextBorder; if (c instanceof JTextComponent) - { - JTextComponent tc = (JTextComponent) c; - enabledTextBorder = tc.isEnabled() tc.isEditable(); - } +{ + JTextComponent tc = (JTextComponent) c; + enabledTextBorder = tc.isEnabled() tc.isEditable(); +} else - enabledTextBorder = false; +enabledTextBorder = false; if (enabledTextBorder) super.paintBorder(c, g, x, y, w, h); @@ -829,35 +829,36 @@ { Color dark = MetalLookAndFeel.getPrimaryControlDarkShadow(); Color light = MetalLookAndFeel.getPrimaryControlHighlight(); - if (c instanceof JMenu) { -JMenu menu = (JMenu) c; -if (menu.isSelected()) + if (c instanceof JMenu) { - g.setColor(dark); - g.drawLine(x, y, x, y + h); - g.drawLine(x, y, x + w, y); - g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); - g.setColor(light); - g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); + JMenu menu = (JMenu) c; + if (menu.isSelected()) +{ + g.setColor(dark); + g.drawLine(x, y, x, y + h); + g.drawLine(x, y, x + w, y); + g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); + g.setColor(light); + g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); +} } - } else if (c instanceof JMenuItem) - { -JMenuItem item = (JMenuItem) c; -if (item.isArmed()) - { -g.setColor(dark); -g.drawLine(x, y, x + w, y); -g.setColor(light); -g.drawLine(x, y + h - 1, x + w, y + h - 1); - } -else - { -// Normally we draw a light line on the left. -g.setColor(light); -g.drawLine(x, y, x, y + h); - } - } +{ + JMenuItem item = (JMenuItem) c; + if (item.isArmed()) +{ + g.setColor(dark); + g.drawLine(x, y, x + w, y); + g.setColor(light); + g.drawLine(x, y + h - 1, x + w, y + h - 1); +} + else +{ + // Normally we draw a light line on the left. + g.setColor(light); + g.drawLine(x, y, x, y + h); +} +} } /** @@ -1469,8 +1470,8 @@ { Border outer = new ButtonBorder(); Border inner = getMarginBorder(); -buttonBorder = new BorderUIResource.CompoundBorderUIResource -(outer, inner); +buttonBorder = new BorderUIResource.CompoundBorderUIResource(outer, +inner); } return buttonBorder; } @@ -1488,8
[cp-patches] Patch: Focus traversal fix
When trying to traverse through focusable and non-focusable objects using the TAB key, several issues came up where not all components were visited and some exceptions were being thrown in the wrong places. You can test out the issue with the buttons in the Swing demo's main frame or the attached test case that Riccardo sent me (they are very helpful). We are now able to successfully traverse through all focusable components forwards and backwards continuously :) The main issue was because we only traversed from the current component to the end of the array of components. It should have been set to traverse from the current component to the component prior to it. 2006-05-11 Lillian Angel [EMAIL PROTECTED] * java/awt/ContainerOrderFocusTraversalPolicy.java (getComponentAfter): Should not throw exception if the ancestor is null. Added a check for this. Also, changed to use new helper function, we should iterate through all the components at least once. (getNextAvailableComponent): New helper function. (getPrevAvailableComponent): New helper function. (getComponentBefore): Should not throw exception if the ancestor is null. Added a check for this. Also, changed to use new helper function, we should iterate through all the components at least once. (getFirstComponent): Changed check to manually check fields. Calling accept() casts the object to a Component, so different values may be returned. (getLastComponent): Likewise. Index: java/awt/ContainerOrderFocusTraversalPolicy.java === RCS file: /cvsroot/classpath/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java,v retrieving revision 1.8 diff -u -r1.8 ContainerOrderFocusTraversalPolicy.java --- java/awt/ContainerOrderFocusTraversalPolicy.java 2 Jul 2005 20:32:24 - 1.8 +++ java/awt/ContainerOrderFocusTraversalPolicy.java 11 May 2006 20:25:31 - @@ -111,14 +111,16 @@ ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { - // We've reached the top focus cycle root ancestor. Check - // if it is root. - if (ancestor != root) +// We've reached the top focus cycle root ancestor. Check +// if it is root. +if (ancestor == null) + ancestor = root; +else if (ancestor != root) throw new IllegalArgumentException (the given container is not + a focus cycle root of the + current component); - else - break; +else + break; } prevAncestor = ancestor; } @@ -146,47 +147,104 @@ // Find component's index. for (int i = 0; i numComponents; i++) { -if (components[i] == current) +if (components[i].equals(current)) componentIndex = i; } -// Search forward for the next acceptable component. -for (int i = componentIndex + 1; i numComponents; i++) +// Search forward for the next acceptable component. +// Search through all components at least one time +// i.e. start at componentIndex + 1 -- nComponents -1 -- 0 --- componentIndex +int i = componentIndex + 1; +int end = numComponents - 1; +Component next = getNextAvailableComponent(components, i, end); +if (next != null) + return next; + +// Now check remainder of components from 0 to componentIndex +i = 0; +end = componentIndex; +next = getNextAvailableComponent(components, i, end); +if (next != null) + return next; + +// No focusable components after current in its Container. So go +// to the next Component after current's Container (parent). +Component result = getComponentAfter (root, parent); +return result; + } + } + + /** + * Gets the next available component in the array between the given range. + * + * @param components - the array of components. + * @param start - where to start + * @param end - where to end + * @return next component if found + */ + private Component getNextAvailableComponent(Component[] components, int start, int end) + { +while (start = end) + { +Component c = components[start]; + +if (c.visible c.isDisplayable() c.enabled c.focusable) + return c; + +if (c instanceof Container) { -if (accept (components[i])) - return components[i]; +Component result = getFirstComponent((Container) c); -if (components[i] instanceof Container) - { -Component result = getFirstComponent ((Container) components[i]); - -if (result != null - implicitDownCycleTraversal) - return