diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-01-21 02:16:34 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-01-21 02:16:34 +0000 |
commit | 46761236fb83c55b5bbbe82c1320c81228871c9b (patch) | |
tree | 6f36f7de0bd8e6016436de46d4dfe92e3f961b03 | |
parent | 719ff92c13d064ec8cb5143132d8377c572b6afd (diff) | |
download | classpath-46761236fb83c55b5bbbe82c1320c81228871c9b.tar.gz |
2005-01-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
Merge of HEAD to generics-branch for 2005/01/20.
2005-01-20 Michael Koch <konqueror@gmx.de>
* java/awt/print/PrinterJob.java
(pageDialog): Throws java.awt.HeadlessException.
(printDialog): Likewise.
2005-01-20 Michael Koch <konqueror@gmx.de>
* doc/hacking.texinfo: Fixed one typo and the paragraph about time
formats.
2005-01-20 Michael Koch <konqueror@gmx.de>
* javax/print/attribute/standard/Chromaticity.java
(serialVersionUID): Fixed value.
* javax/print/attribute/standard/Destination.java
(serialVersionUID): Fixed value.
* javax/print/attribute/standard/MediaPrintableArea.java,
javax/print/attribute/standard/MediaSize.java:
New files.
2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/Currency.java:
Added new countryMap which maps country codes
to international currency codes. The cache
has been altered to map currency codes to
Currency objects.
(getInstance(java.util.Locale)): adds to both
caches and attempts initial lookup from country map
(getInstance(java.lang.String)): attempts to
use code -> currency map first
2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/awt/Checkbox.java:
(AccessibleAWTCheckbox): Added class documentation
* java/awt/Scrollbar.java:
(AccessibleAWTScrollBar): typo corrected and docs added
(AccessibleAWTScrollBar.getAccessibleRole()): documented
(AccessibleAWTScrollBar.getAccessibleStateSet()): likewise
(AccessibleAWTScrollBar.getAccessibleValue()): likewise
(AccessibleAWTScrollBar.getCurrentAccessibleValue()): likewise
(AccessibleAWTScrollBar.setCurrentAccessibleValue(java.lang.Number)): likewise
(AccessibleAWTScrollBar.getMinimumAccessibleValue()): likewise
(AccessibleAWTScrollBar.getMaximumAccessibleValue()): likewise
(getAccessibleContext()): name of accessible class corrected
2005-01-20 Mark Wielaard <mark@klomp.org>
* java/util/Currency.java (Currency(Locale)): Add Locale to
IllegalArgumentException message.
2005-01-20 Mark Wielaard <mark@klomp.org>
* java/awt/BasicStroke.java (hashCode): Implement.
(equals): Document.
2005-01-20 Michael Koch <konqueror@gmx.de>
* javax/swing/JTable.java
(getValueAt): New method.
* javax/swing/table/JTableHeader.java
(columnAtPoint): New method.
2005-01-20 Mark Wielaard <mark@klomp.org>
* java/util/Currency.java (Currency(Locale)): Clarify
IllegalArgumentException message.
2005-01-20 Mark Wielaard <mark@klomp.org>
* javax/naming/directory/BasicAttributes.java (equals): Compare to any
Attributes and attribute order doesn't matter.
(BasicAttributesEnumeration.where): Initialize to zero.
(BasicAttributesEnumeration.nextElement): Update and compare where
appropriately (zero based).
2005-01-20 Michael Koch <konqueror@gmx.de>
* javax/swing/JTextField.java
(actions): New field.
(static): Initalize actions field.
(getActions): New method.
2005-01-20 Mark Wielaard <mark@klomp.org>
* native/jni/gtk-peer/gtkpeer.h (gdk_env): Fix prototype.
2005-01-20 Graydon Hoare <graydon@redhat.com>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
(env_union): Use union to avoid type-punning warning.
2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/awt/Checkbox.java:
(AccessibleAWTCheckbox): name capitalization corrected
and serialization UID added.
(AccessibleAWTCheckbox.itemStateChanged(java.awt.event.ItemEvent)):
documented.
(AccessibleAWTCheckbox.getAccessibleAction()): likewise
(AccessibleAWTCheckbox.getAccessibleValue()): likewise
(AccessibleAWTCheckbox.getAccessibleActionCount()): likewise
(AccessibleAWTCheckbox.getAccessibleActionDescription(int)): likewise
(AccessibleAWTCheckbox.doAccessibleAction(int)): likewise
(AccessibleAWTCheckbox.getCurrentAccessibleValue()): likewise
(AccessibleAWTCheckbox.setCurrentAccessibleValue(java.lang.Number)): likewise
(AccessibleAWTCheckbox.getMinimumAccessibleValue()): likewise
(AccessibleAWTCheckbox.getMaximumAccessibleValue()): likewise
(AccessibleAWTCheckbox.getAccessibleRole()): likewise
(AccessibleAWTCheckbox.getAccessibleStateSet()): implemented and
documented
(getAccessibleContext()): name of accessible class corrected
-rw-r--r-- | ChangeLog | 115 | ||||
-rw-r--r-- | doc/hacking.texinfo | 14 | ||||
-rw-r--r-- | java/awt/BasicStroke.java | 27 | ||||
-rw-r--r-- | java/awt/Checkbox.java | 137 | ||||
-rw-r--r-- | java/awt/Scrollbar.java | 79 | ||||
-rw-r--r-- | java/awt/print/PrinterJob.java | 11 | ||||
-rw-r--r-- | java/util/Currency.java | 86 | ||||
-rw-r--r-- | javax/naming/directory/BasicAttributes.java | 30 | ||||
-rw-r--r-- | javax/print/attribute/standard/Chromaticity.java | 2 | ||||
-rw-r--r-- | javax/print/attribute/standard/Destination.java | 4 | ||||
-rw-r--r-- | javax/swing/JTable.java | 5 | ||||
-rw-r--r-- | javax/swing/JTextField.java | 24 | ||||
-rw-r--r-- | javax/swing/table/JTableHeader.java | 9 | ||||
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c | 12 | ||||
-rw-r--r-- | native/jni/gtk-peer/gtkpeer.h | 2 |
15 files changed, 474 insertions, 83 deletions
@@ -1,3 +1,24 @@ +2005-01-20 Michael Koch <konqueror@gmx.de> + + * java/awt/print/PrinterJob.java + (pageDialog): Throws java.awt.HeadlessException. + (printDialog): Likewise. + +2005-01-20 Michael Koch <konqueror@gmx.de> + + * doc/hacking.texinfo: Fixed one typo and the paragraph about time + formats. + +2005-01-20 Michael Koch <konqueror@gmx.de> + + * javax/print/attribute/standard/Chromaticity.java + (serialVersionUID): Fixed value. + * javax/print/attribute/standard/Destination.java + (serialVersionUID): Fixed value. + * javax/print/attribute/standard/MediaPrintableArea.java, + javax/print/attribute/standard/MediaSize.java: + New files. + 2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org> * include/java_lang_VMSystem.h: @@ -16,7 +37,101 @@ (getenv()): removed (environ()): new native method (getenv(String)): made native like HEAD + +2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * java/util/Currency.java: + Added new countryMap which maps country codes + to international currency codes. The cache + has been altered to map currency codes to + Currency objects. + (getInstance(java.util.Locale)): adds to both + caches and attempts initial lookup from country map + (getInstance(java.lang.String)): attempts to + use code -> currency map first +2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * java/awt/Checkbox.java: + (AccessibleAWTCheckbox): Added class documentation + * java/awt/Scrollbar.java: + (AccessibleAWTScrollBar): typo corrected and docs added + (AccessibleAWTScrollBar.getAccessibleRole()): documented + (AccessibleAWTScrollBar.getAccessibleStateSet()): likewise + (AccessibleAWTScrollBar.getAccessibleValue()): likewise + (AccessibleAWTScrollBar.getCurrentAccessibleValue()): likewise + (AccessibleAWTScrollBar.setCurrentAccessibleValue(java.lang.Number)): likewise + (AccessibleAWTScrollBar.getMinimumAccessibleValue()): likewise + (AccessibleAWTScrollBar.getMaximumAccessibleValue()): likewise + (getAccessibleContext()): name of accessible class corrected + +2005-01-20 Mark Wielaard <mark@klomp.org> + + * java/util/Currency.java (Currency(Locale)): Add Locale to + IllegalArgumentException message. + +2005-01-20 Mark Wielaard <mark@klomp.org> + + * java/awt/BasicStroke.java (hashCode): Implement. + (equals): Document. + +2005-01-20 Michael Koch <konqueror@gmx.de> + + * javax/swing/JTable.java + (getValueAt): New method. + * javax/swing/table/JTableHeader.java + (columnAtPoint): New method. + +2005-01-20 Mark Wielaard <mark@klomp.org> + + * java/util/Currency.java (Currency(Locale)): Clarify + IllegalArgumentException message. + +2005-01-20 Mark Wielaard <mark@klomp.org> + + * javax/naming/directory/BasicAttributes.java (equals): Compare to any + Attributes and attribute order doesn't matter. + (BasicAttributesEnumeration.where): Initialize to zero. + (BasicAttributesEnumeration.nextElement): Update and compare where + appropriately (zero based). + +2005-01-20 Michael Koch <konqueror@gmx.de> + + * javax/swing/JTextField.java + (actions): New field. + (static): Initalize actions field. + (getActions): New method. + +2005-01-20 Mark Wielaard <mark@klomp.org> + + * native/jni/gtk-peer/gtkpeer.h (gdk_env): Fix prototype. + +2005-01-20 Graydon Hoare <graydon@redhat.com> + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c + (env_union): Use union to avoid type-punning warning. + +2005-01-20 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * java/awt/Checkbox.java: + (AccessibleAWTCheckbox): name capitalization corrected + and serialization UID added. + (AccessibleAWTCheckbox.itemStateChanged(java.awt.event.ItemEvent)): + documented. + (AccessibleAWTCheckbox.getAccessibleAction()): likewise + (AccessibleAWTCheckbox.getAccessibleValue()): likewise + (AccessibleAWTCheckbox.getAccessibleActionCount()): likewise + (AccessibleAWTCheckbox.getAccessibleActionDescription(int)): likewise + (AccessibleAWTCheckbox.doAccessibleAction(int)): likewise + (AccessibleAWTCheckbox.getCurrentAccessibleValue()): likewise + (AccessibleAWTCheckbox.setCurrentAccessibleValue(java.lang.Number)): likewise + (AccessibleAWTCheckbox.getMinimumAccessibleValue()): likewise + (AccessibleAWTCheckbox.getMaximumAccessibleValue()): likewise + (AccessibleAWTCheckbox.getAccessibleRole()): likewise + (AccessibleAWTCheckbox.getAccessibleStateSet()): implemented and + documented + (getAccessibleContext()): name of accessible class corrected + 2005-01-19 Michael Koch <konqueror@gmx.de> * javax/swing/DefaultListSelectionModel.java diff --git a/doc/hacking.texinfo b/doc/hacking.texinfo index 9f06d7c2c..f9cddd6f7 100644 --- a/doc/hacking.texinfo +++ b/doc/hacking.texinfo @@ -1553,7 +1553,7 @@ Date formatting and parsing is handled by the @code{java.text.SimpleDateFormat} class in most locales. This class is configured by attaching an instance of the @code{java.text.DateFormatSymbols} class. That class simply reads properties from our locale specific -resource bundle. The following items are requiered (refer to the +resource bundle. The following items are required (refer to the documentation of the @code{java.text.DateFormatSymbols} class for details io what the actual values should be): @@ -1577,18 +1577,14 @@ locale. @code{DateFormat.LONG} @item fullDateFormat - The format string for dates used by @code{DateFormat.FULL} -@item defaultDateFormat - The format string for dates used by -@code{DateFormat.DEFAULT} -@item shortDateFormat - The format string for times used by +@item shortTimeFormat - The format string for times used by @code{DateFormat.SHORT} -@item mediumDateFormat - The format string for times used by +@item mediumTimeFormat - The format string for times used by @code{DateFormat.MEDIUM} -@item longDateFormat - The format string for times used by +@item longTimeFormat - The format string for times used by @code{DateFormat.LONG} -@item fullDateFormat - The format string for times used by +@item fullTimeFormat - The format string for times used by @code{DateFormat.FULL} -@item defaultDateFormat - The format string for times used by -@code{DateFormat.DEFAULT} @end itemize Note that it may not be possible to use this mechanism for all locales. diff --git a/java/awt/BasicStroke.java b/java/awt/BasicStroke.java index e302a0ebc..7537ba586 100644 --- a/java/awt/BasicStroke.java +++ b/java/awt/BasicStroke.java @@ -1,5 +1,5 @@ /* BasicStroke.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,6 +48,7 @@ public class BasicStroke implements Stroke public static final int JOIN_MITER = 0; public static final int JOIN_ROUND = 1; public static final int JOIN_BEVEL = 2; + public static final int CAP_BUTT = 0; public static final int CAP_ROUND = 1; public static final int CAP_SQUARE = 2; @@ -208,11 +209,33 @@ public class BasicStroke implements Stroke return phase; } + /** + * Returns the hash code for this object. The hash is calculated by + * xoring the hash, cap, join, limit, dash array and phase values + * (converted to <code>int</code> first with + * <code>Float.floatToIntBits()</code> if the value is a + * <code>float</code>). + */ public int hashCode() { - throw new Error("not implemented"); + int hash = Float.floatToIntBits(width); + hash ^= cap; + hash ^= join; + hash ^= Float.floatToIntBits(limit); + + for (int i = 0; i < dash.length; i++) + hash ^= Float.floatToIntBits(dash[i]); + + hash ^= Float.floatToIntBits(phase); + + return hash; } + /** + * Returns true if the given Object is an instance of BasicStroke + * and the width, cap, join, limit, dash array and phase are all + * equal. + */ public boolean equals(Object o) { if (! (o instanceof BasicStroke)) diff --git a/java/awt/Checkbox.java b/java/awt/Checkbox.java index 0ea62e943..839f12932 100644 --- a/java/awt/Checkbox.java +++ b/java/awt/Checkbox.java @@ -48,6 +48,7 @@ import javax.accessibility.AccessibleAction; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; import javax.accessibility.AccessibleState; +import javax.accessibility.AccessibleStateSet; import javax.accessibility.AccessibleValue; /** @@ -55,7 +56,7 @@ import javax.accessibility.AccessibleValue; * or more Checkboxes can be grouped by a CheckboxGroup. * * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Tom Tromey <tromey@redhat.com> + * @author Tom Tromey (tromey@redhat.com) */ public class Checkbox extends Component implements ItemSelectable, Accessible, Serializable @@ -94,13 +95,28 @@ private boolean state; // The list of listeners for this object. private transient ItemListener item_listeners; -protected class AccessibleAWTCheckBox +/** + * This class provides accessibility support for the + * checkbox. + * + * @author Jerry Quinn (jlquinn@optonline.net) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) + */ +protected class AccessibleAWTCheckbox extends AccessibleAWTComponent implements ItemListener, AccessibleAction, AccessibleValue { - - /* (non-Javadoc) + /** + * Serialization constant to match JDK 1.5 + */ + private static final long serialVersionUID = 7881579233144754107L; + + /** + * Captures changes to the state of the checkbox and + * fires appropriate accessible property change events. + * + * @param event the event fired. * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) */ public void itemStateChanged(ItemEvent event) @@ -110,58 +126,121 @@ protected class AccessibleAWTCheckBox state ? AccessibleState.CHECKED : null); } + /** + * Returns an implementation of the <code>AccessibleAction</code> + * interface for this accessible object. In this case, the + * current instance is simply returned (with a more appropriate + * type), as it also implements the accessible action as well as + * the context. + * + * @return the accessible action associated with this context. + * @see javax.accessibility.AccessibleAction + */ public AccessibleAction getAccessibleAction() { return this; } + /** + * Returns an implementation of the <code>AccessibleValue</code> + * interface for this accessible object. In this case, the + * current instance is simply returned (with a more appropriate + * type), as it also implements the accessible value as well as + * the context. + * + * @return the accessible value associated with this context. + * @see javax.accessibility.AccessibleValue + */ public AccessibleValue getAccessibleValue() { return this; } - /* (non-Javadoc) + /* + * The following methods are implemented in the JDK (up to + * 1.5) as stubs. We do likewise here. + */ + + /** + * Returns the number of actions associated with this accessible + * object. This default implementation returns 0. + * + * @return the number of accessible actions available. * @see javax.accessibility.AccessibleAction#getAccessibleActionCount() */ public int getAccessibleActionCount() { - // 1.4.1 does this + // 1.4.1 and 1.5 do this return 0; } - /* (non-Javadoc) + /** + * Returns a description of the action with the supplied id. + * This default implementation always returns null. + * + * @param i the id of the action whose description should be + * retrieved. + * @return a <code>String</code> describing the action. * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int) */ public String getAccessibleActionDescription(int i) { + // 1.5 does this return null; } - /* (non-Javadoc) + /** + * Executes the action with the specified id. This + * default implementation simply returns false. + * + * @param i the id of the action to perform. + * @return true if the action was performed. * @see javax.accessibility.AccessibleAction#doAccessibleAction(int) */ public boolean doAccessibleAction(int i) { + // 1.5 does this return false; } - /* (non-Javadoc) + /** + * Returns the current value of this accessible object. + * If no value has been set, null is returned. This + * default implementation always returns null, regardless. + * + * @return the numeric value of this object, or null if + * no value has been set. * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue() */ public Number getCurrentAccessibleValue() { + // 1.5 does this return null; } - /* (non-Javadoc) + /** + * Sets the current value of this accessible object + * to that supplied. In this default implementation, + * the value is never set and the method always returns + * false. + * + * @param number the new accessible value. + * @return true if the value was set. * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number) */ public boolean setCurrentAccessibleValue(Number number) { + // 1.5 does this return false; } - /* (non-Javadoc) + /** + * Returns the minimum acceptable accessible value used + * by this object, or null if no minimum value exists. + * This default implementation always returns null. + * + * @return the minimum acceptable accessible value, or null + * if there is no minimum. * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue() */ public Number getMinimumAccessibleValue() @@ -169,7 +248,13 @@ protected class AccessibleAWTCheckBox return null; } - /* (non-Javadoc) + /** + * Returns the maximum acceptable accessible value used + * by this object, or null if no maximum value exists. + * This default implementation always returns null. + * + * @return the maximum acceptable accessible value, or null + * if there is no maximum. * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue() */ public Number getMaximumAccessibleValue() @@ -177,11 +262,35 @@ protected class AccessibleAWTCheckBox return null; } + /** + * Returns the role of this accessible object. + * + * @return the instance of <code>AccessibleRole</code>, + * which describes this object. + * @see javax.accessibility.AccessibleRole + */ public AccessibleRole getAccessibleRole() { return AccessibleRole.CHECK_BOX; } + /** + * Returns the state set of this accessible object. + * + * @return a set of <code>AccessibleState</code>s + * which represent the current state of the + * accessible object. + * @see javax.accessibility.AccessibleState + * @see javax.accessibility.AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() + { + AccessibleStateSet set = super.getAccessibleStateSet(); + if (state) + set.add(AccessibleState.CHECKED); + return set; + } + } /*************************************************************************/ @@ -491,7 +600,7 @@ paramString() } /** - * Gets the AccessibleContext associated with this <code>CheckBox</code>. + * Gets the AccessibleContext associated with this <code>Checkbox</code>. * The context is created, if necessary. * * @return the associated context @@ -501,7 +610,7 @@ public AccessibleContext getAccessibleContext() /* Create the context if this is the first request */ if (accessibleContext == null) { - AccessibleAWTCheckBox ac = new AccessibleAWTCheckBox(); + AccessibleAWTCheckbox ac = new AccessibleAWTCheckbox(); accessibleContext = ac; addItemListener(ac); } diff --git a/java/awt/Scrollbar.java b/java/awt/Scrollbar.java index 4ec92e5b1..f1b291ca9 100644 --- a/java/awt/Scrollbar.java +++ b/java/awt/Scrollbar.java @@ -55,7 +55,8 @@ import javax.accessibility.AccessibleValue; * This class implements a scrollbar widget. * * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Tom Tromey <tromey@cygnus.com> + * @author Tom Tromey (tromey@cygnus.com) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ public class Scrollbar extends Component implements Accessible, Adjustable @@ -775,14 +776,43 @@ paramString() return next_scrollbar_number++; } - protected class AccessibleAWTScrollbar extends AccessibleAWTComponent + /** + * This class provides accessibility support for the + * scrollbar. + * + * @author Jerry Quinn (jlquinn@optonline.net) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) + */ + protected class AccessibleAWTScrollBar extends AccessibleAWTComponent implements AccessibleValue { + + /** + * Serialization constant to match JDK 1.5 + */ + private static final long serialVersionUID = -344337268523697807L; + + /** + * Returns the role of this accessible object. + * + * @return the instance of <code>AccessibleRole</code>, + * which describes this object. + * @see javax.accessibility.AccessibleRole + */ public AccessibleRole getAccessibleRole() { return AccessibleRole.SCROLL_BAR; } + /** + * Returns the state set of this accessible object. + * + * @return a set of <code>AccessibleState</code>s + * which represent the current state of the + * accessible object. + * @see javax.accessibility.AccessibleState + * @see javax.accessibility.AccessibleStateSet + */ public AccessibleStateSet getAccessibleStateSet() { AccessibleStateSet states = super.getAccessibleStateSet(); @@ -795,12 +825,28 @@ paramString() return states; } + /** + * Returns an implementation of the <code>AccessibleValue</code> + * interface for this accessible object. In this case, the + * current instance is simply returned (with a more appropriate + * type), as it also implements the accessible value as well as + * the context. + * + * @return the accessible value associated with this context. + * @see javax.accessibility.AccessibleValue + */ public AccessibleValue getAccessibleValue() { return this; } - /* (non-Javadoc) + /** + * Returns the current value of this accessible object. + * In this case, this is the same as the value for + * the scrollbar, wrapped in an <code>Integer</code> + * object. + * + * @return the numeric value of this scrollbar. * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue() */ public Number getCurrentAccessibleValue() @@ -808,7 +854,14 @@ paramString() return new Integer(getValue()); } - /* (non-Javadoc) + /** + * Sets the current value of this accessible object + * to that supplied. In this case, the value of the + * scrollbar is set, and this method always returns + * true. + * + * @param number the new accessible value. + * @return true if the value was set. * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number) */ public boolean setCurrentAccessibleValue(Number number) @@ -817,7 +870,13 @@ paramString() return true; } - /* (non-Javadoc) + /** + * Returns the minimum acceptable accessible value used + * by this object. In this case, this is the same as + * the minimum value of the scrollbar, wrapped in an + * object. + * + * @return the minimum value of this scrollbar. * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue() */ public Number getMinimumAccessibleValue() @@ -825,7 +884,13 @@ paramString() return new Integer(getMinimum()); } - /* (non-Javadoc) + /** + * Returns the maximum acceptable accessible value used + * by this object. In this case, this is the same as + * the maximum value of the scrollbar, wrapped in an + * object. + * + * @return the maximum value of this scrollbar. * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue() */ public Number getMaximumAccessibleValue() @@ -844,7 +909,7 @@ paramString() { /* Create the context if this is the first request */ if (accessibleContext == null) - accessibleContext = new AccessibleAWTScrollbar(); + accessibleContext = new AccessibleAWTScrollBar(); return accessibleContext; } diff --git a/java/awt/print/PrinterJob.java b/java/awt/print/PrinterJob.java index 1ee637536..bc5cfcd5a 100644 --- a/java/awt/print/PrinterJob.java +++ b/java/awt/print/PrinterJob.java @@ -38,6 +38,8 @@ exception statement from your version. */ package java.awt.print; +import java.awt.HeadlessException; + import javax.print.PrintService; import javax.print.attribute.PrintRequestAttributeSet; @@ -146,7 +148,8 @@ public abstract class PrinterJob * * @return The modified <code>PageFormat</code>. */ - public abstract PageFormat pageDialog(PageFormat page_format); + public abstract PageFormat pageDialog(PageFormat page_format) + throws HeadlessException; /** * Prints the pages. @@ -166,7 +169,8 @@ public abstract class PrinterJob * @return <code>false</code> if the user cancels the dialog box, * <code>true</code> otherwise. */ - public abstract boolean printDialog(); + public abstract boolean printDialog() + throws HeadlessException; /** * Displays a dialog box to the user which allows the print job @@ -175,7 +179,8 @@ public abstract class PrinterJob * @return <code>false</code> if the user cancels the dialog box, * <code>true</code> otherwise. */ - public abstract boolean printDialog(PrintRequestAttributeSet attributes); + public abstract boolean printDialog(PrintRequestAttributeSet attributes) + throws HeadlessException; /** * This sets the pages that are to be printed. diff --git a/java/util/Currency.java b/java/util/Currency.java index 26c29e36f..849a30031 100644 --- a/java/util/Currency.java +++ b/java/util/Currency.java @@ -106,11 +106,25 @@ public final class Currency private transient String currencySymbol; /** + * A cached map of country codes + * instances to international currency code + * <code>String</code>s. Seperating this + * from the <code>Currency</code> instances + * ensures we have a common lookup between + * the two <code>getInstance()</code> methods. + * + * @see #getInstance(java.util.Locale) + * @serial ignored. + */ + private static transient Map countryMap; + + /** * A cache of <code>Currency</code> instances to * ensure the singleton nature of this class. The key - * is the locale of the currency. + * is the international currency code. * * @see #getInstance(java.util.Locale) + * @see #getInstance(java.lang.String) * @see #readResolve() * @serial ignored. */ @@ -121,6 +135,8 @@ public final class Currency */ static { + /* Create a hash map for the locale mappings */ + countryMap = new HashMap(); /* Create a hash map for the cache */ cache = new HashMap(); /* Create the properties object */ @@ -169,7 +185,8 @@ public final class Currency if (countryCode.equals("")) { throw new - IllegalArgumentException("The specified country code is invalid"); + IllegalArgumentException("Invalid (empty) country code for locale:" + + loc); } /* Construct the key for the currency */ currencyKey = countryCode + ".currency"; @@ -249,31 +266,38 @@ public final class Currency */ Currency newCurrency; - if (locale == null || locale.getCountry() == null) + String country = locale.getCountry(); + if (locale == null || country == null) { throw new NullPointerException("The locale or its country is null."); } /* Attempt to get the currency from the cache */ - newCurrency = (Currency) cache.get(locale); - if (newCurrency == null) + String code = (String) countryMap.get(country); + if (code == null) { /* Create the currency for this locale */ - newCurrency = new Currency (locale); + newCurrency = new Currency(locale); /* * If the currency code is null, then creation failed * and we return null. */ - if (newCurrency.getCurrencyCode() == null) + code = newCurrency.getCurrencyCode(); + if (code == null) { return null; } else { /* Cache it */ - cache.put(locale, newCurrency); + countryMap.put(country, code); + cache.put(code, newCurrency); } } + else + { + newCurrency = (Currency) cache.get(code); + } /* Return the instance */ return newCurrency; } @@ -299,31 +323,39 @@ public final class Currency { throw new NullPointerException("The supplied currency code is null."); } - /* Get all locales */ - allLocales = Locale.getAvailableLocales(); - /* Loop through each locale, looking for the code */ - for (int i = 0;i < allLocales.length; i++) + Currency newCurrency = (Currency) cache.get(currencyCode); + if (newCurrency == null) { - try + /* Get all locales */ + allLocales = Locale.getAvailableLocales(); + /* Loop through each locale, looking for the code */ + for (int i = 0;i < allLocales.length; i++) { - Currency testCurrency = getInstance (allLocales[i]); - if (testCurrency != null && - testCurrency.getCurrencyCode().equals(currencyCode)) + try { - return testCurrency; + Currency testCurrency = getInstance (allLocales[i]); + if (testCurrency != null && + testCurrency.getCurrencyCode().equals(currencyCode)) + { + return testCurrency; + } + } + catch (IllegalArgumentException exception) + { + /* Ignore locales without valid countries */ } } - catch (IllegalArgumentException exception) - { - /* Ignore locales without valid countries */ - } + /* + * If we get this far, the code is not supported by any of + * our locales. + */ + throw new IllegalArgumentException("The currency code, " + currencyCode + + ", is not supported."); + } + else + { + return newCurrency; } - /* - * If we get this far, the code is not supported by any of - * our locales. - */ - throw new IllegalArgumentException("The currency code, " + currencyCode + - ", is not supported."); } /** diff --git a/javax/naming/directory/BasicAttributes.java b/javax/naming/directory/BasicAttributes.java index 9a9a80019..b20072424 100644 --- a/javax/naming/directory/BasicAttributes.java +++ b/javax/naming/directory/BasicAttributes.java @@ -1,5 +1,5 @@ /* BasicAttributes.java -- - Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -83,19 +83,27 @@ public class BasicAttributes implements Attributes return ba; } + /** + * Returns true if and only if the given Object is an instance of + * Attributes, the given attributes both do or don't ignore case for + * IDs and the collection of attributes is the same. + */ public boolean equals (Object obj) { - if (! (obj instanceof BasicAttributes)) + if (! (obj instanceof Attributes)) return false; - BasicAttributes b = (BasicAttributes) obj; - if (ignoreCase != b.ignoreCase - || attributes.size () != b.attributes.size ()) + + Attributes bs = (Attributes) obj; + if (ignoreCase != bs.isCaseIgnored() + || attributes.size () != bs.size ()) return false; - // Does order matter? - for (int i = 0; i < attributes.size (); ++i) + NamingEnumeration bas = bs.getAll(); + while (bas.hasMoreElements()) { - if (! attributes.get (i).equals (b.attributes.get (i))) + Attribute a = (Attribute) bas.nextElement(); + Attribute b = get(a.getID ()); + if (! a.equals(b)) return false; } @@ -191,7 +199,7 @@ public class BasicAttributes implements Attributes // Used when enumerating. private class BasicAttributesEnumeration implements NamingEnumeration { - int where = -1; + int where = 0; boolean id; public BasicAttributesEnumeration (boolean id) @@ -220,10 +228,10 @@ public class BasicAttributes implements Attributes public Object nextElement () throws NoSuchElementException { - if (where + 1 >= attributes.size ()) + if (where >= attributes.size ()) throw new NoSuchElementException ("no more elements"); - ++where; Attribute at = (Attribute) attributes.get (where); + ++where; return id ? (Object) at.getID () : (Object) at; } } diff --git a/javax/print/attribute/standard/Chromaticity.java b/javax/print/attribute/standard/Chromaticity.java index 9d34863d4..306cc38c8 100644 --- a/javax/print/attribute/standard/Chromaticity.java +++ b/javax/print/attribute/standard/Chromaticity.java @@ -49,7 +49,7 @@ import javax.print.attribute.PrintRequestAttribute; public final class Chromaticity extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { - private static final long serialVersionUID = -6890309414893262822L; + private static final long serialVersionUID = 4660543931355214012L; public static final Chromaticity MONOCHROME = new Chromaticity(0); public static final Chromaticity COLOR = new Chromaticity(1); diff --git a/javax/print/attribute/standard/Destination.java b/javax/print/attribute/standard/Destination.java index 6d73bf10f..6d723ccb9 100644 --- a/javax/print/attribute/standard/Destination.java +++ b/javax/print/attribute/standard/Destination.java @@ -1,5 +1,5 @@ /* Destination.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,7 +50,7 @@ import javax.print.attribute.URISyntax; public final class Destination extends URISyntax implements PrintJobAttribute, PrintRequestAttribute { - private static final long serialVersionUID = 7923912792485606497L; + private static final long serialVersionUID = 6776739171700415321L; /** * Constructs a <code>Destination</code> object. diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java index ade73772e..09aff0b8e 100644 --- a/javax/swing/JTable.java +++ b/javax/swing/JTable.java @@ -1859,4 +1859,9 @@ public class JTable extends JComponent setColumnSelectionInterval(0, getColumnCount() - 1); setRowSelectionInterval(0, getRowCount() - 1); } + + public Object getValueAt(int row, int column) + { + return dataModel.getValueAt(row, convertColumnIndexToModel(column)); + } } diff --git a/javax/swing/JTextField.java b/javax/swing/JTextField.java index 0c9a6eb98..b1ab17163 100644 --- a/javax/swing/JTextField.java +++ b/javax/swing/JTextField.java @@ -47,9 +47,11 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.accessibility.AccessibleStateSet; +import javax.swing.Action; import javax.swing.text.Document; import javax.swing.text.JTextComponent; import javax.swing.text.PlainDocument; +import javax.swing.text.TextAction; public class JTextField extends JTextComponent implements SwingConstants @@ -80,12 +82,25 @@ public class JTextField extends JTextComponent private static final long serialVersionUID = 353853209832607592L; + private static final Action[] actions; + public static final String notifyAction = "notify-field-accept"; + static + { + actions = new Action[1]; + actions[0] = new TextAction(notifyAction) + { + public void actionPerformed(ActionEvent event) + { + JTextField textField = (JTextField) event.getSource(); + textField.fireActionPerformed(); + } + }; + } + private int columns; - private int align; - private int scrollOffset; /** @since 1.3 */ @@ -300,6 +315,11 @@ public class JTextField extends JTextComponent scrollOffset = offset; } + public Action[] getActions() + { + return TextAction.augmentList(super.getActions(), actions); + } + public void postActionEvent() { ActionEvent event = new ActionEvent(this, 0, actionCommand); diff --git a/javax/swing/table/JTableHeader.java b/javax/swing/table/JTableHeader.java index 95ff92006..fb97e8e81 100644 --- a/javax/swing/table/JTableHeader.java +++ b/javax/swing/table/JTableHeader.java @@ -1,5 +1,5 @@ /* JTableHeader.java -- - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -616,4 +616,11 @@ public class JTableHeader extends JComponent setUI((TableHeaderUI) UIManager.getUI(this)); } + public int columnAtPoint(Point point) + { + if (getBounds().contains(point)) + return columnModel.getColumnIndexAtX(point.x); + + return -1; + } } diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c index 6e4e27a3a..81857c42b 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c @@ -72,12 +72,18 @@ jmethodID setCursorID; JavaVM *java_vm; +union env_union +{ + void *void_env; + JNIEnv *jni_env; +}; + JNIEnv * gdk_env() { - JNIEnv *tmp; - g_assert((*java_vm)->GetEnv(java_vm, (void **)&tmp, JNI_VERSION_1_2) == JNI_OK); - return tmp; + union env_union tmp; + g_assert((*java_vm)->GetEnv(java_vm, &tmp.void_env, JNI_VERSION_1_2) == JNI_OK); + return tmp.jni_env; } diff --git a/native/jni/gtk-peer/gtkpeer.h b/native/jni/gtk-peer/gtkpeer.h index 746a8c784..9b04bb116 100644 --- a/native/jni/gtk-peer/gtkpeer.h +++ b/native/jni/gtk-peer/gtkpeer.h @@ -465,7 +465,7 @@ extern jmethodID syncAttrsID; extern jclass gdkColor; extern jmethodID gdkColorID; -JNIEnv *gdk_env(); +JNIEnv *gdk_env(void); extern double dpi_conversion_factor; |