diff options
-rw-r--r-- | ChangeLog | 55 | ||||
-rw-r--r-- | gnu/java/awt/peer/ClasspathFontPeer.java | 7 | ||||
-rw-r--r-- | java/awt/Canvas.java | 4 | ||||
-rw-r--r-- | java/awt/CheckboxMenuItem.java | 20 | ||||
-rw-r--r-- | java/awt/Choice.java | 20 | ||||
-rw-r--r-- | java/awt/Cursor.java | 15 | ||||
-rw-r--r-- | java/awt/List.java | 20 | ||||
-rw-r--r-- | java/awt/Menu.java | 20 | ||||
-rw-r--r-- | java/awt/MenuBar.java | 22 | ||||
-rw-r--r-- | java/awt/MenuComponent.java | 14 | ||||
-rw-r--r-- | java/awt/MenuItem.java | 25 | ||||
-rw-r--r-- | java/awt/PopupMenu.java | 24 | ||||
-rw-r--r-- | java/awt/ScrollPane.java | 32 | ||||
-rw-r--r-- | java/awt/TextField.java | 21 |
14 files changed, 284 insertions, 15 deletions
@@ -1,3 +1,58 @@ +2006-07-13 Tania Bento <tbento@redhat.com> + + * gnu/java/awt/peer/ClasspathFontPeer.java + (isLogicalFontName): Return true if name == default. + (logicalFontNameToFaceName): Check if name == default, + and if so, return "Dialog.plain". + (setStandardAttributes(String, Map)): If name == null, + it should be set to "Default", not "SansSerif". + * java/awt/Canvas.java + (generateName): Fixed documentation. + * java/awt/CheckboxMenuItem.java + Added static variable "next_chkmenuitem_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/Choice.java + Added static variable "next_choice_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/Cursor.java + (Cursor(int)): Set name depending on the type passed. + * java/awt/List.java + Added static variable "next_list_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/Menu.java + Added static variable "next_menu_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/MenuBar.java + Added static variable "next_menubar_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/MenuComponent.java + (getName): Before returning name, check if name == null + and name is not explicity set. If this is the case, + name will be generated. + (generateName): Added and implemented method. + * java/awt/MenuItem.java + Added static variable "next_menuitem_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/PopupMenu.java + Added static variable "next_popup_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/ScrollPane.java + Added static variable "next_scrollpane_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + * java/awt/TextField.java + Added static variable "next_textfield_number". + (generateName): Added and implemented method. + (getUniqueLong): Likewise. + + 2006-07-13 David Gilbert <david.gilbert@object-refinery.com> * java/awt/image/SinglePixelPackedSampleModel.java diff --git a/gnu/java/awt/peer/ClasspathFontPeer.java b/gnu/java/awt/peer/ClasspathFontPeer.java index 78ab3a9de..dad7bb0b0 100644 --- a/gnu/java/awt/peer/ClasspathFontPeer.java +++ b/gnu/java/awt/peer/ClasspathFontPeer.java @@ -145,7 +145,8 @@ public abstract class ClasspathFontPeer uname.equals ("SERIF") || uname.equals ("MONOSPACED") || uname.equals ("DIALOG") || - uname.equals ("DIALOGINPUT")); + uname.equals ("DIALOGINPUT") || + uname.equals ("DEFAULT")); } protected static String logicalFontNameToFaceName (String name) @@ -161,6 +162,8 @@ public abstract class ClasspathFontPeer return "Helvetica"; else if (uname.equals ("DIALOGINPUT")) return "Helvetica"; + else if (uname.equals ("DEFAULT")) + return "Dialog.plain"; else return "Helvetica"; } @@ -233,7 +236,7 @@ public abstract class ClasspathFontPeer family = (String) attribs.get (TextAttribute.FAMILY); if (name == null) - name = "SansSerif"; + name = "Default"; if (attribs.containsKey (TextAttribute.WEIGHT)) { diff --git a/java/awt/Canvas.java b/java/awt/Canvas.java index 2f838d60e..843fded44 100644 --- a/java/awt/Canvas.java +++ b/java/awt/Canvas.java @@ -350,9 +350,9 @@ public class Canvas } /** - * Generate a unique name for this canvas. + * Generate a unique name for this <code>Canvas</code>. * - * @return A unique name for this canvas. + * @return A unique name for this <code>Canvas</code>. */ String generateName() { diff --git a/java/awt/CheckboxMenuItem.java b/java/awt/CheckboxMenuItem.java index 197065f65..2df621b71 100644 --- a/java/awt/CheckboxMenuItem.java +++ b/java/awt/CheckboxMenuItem.java @@ -63,6 +63,11 @@ public class CheckboxMenuItem extends MenuItem * Static Variables */ +/** + * The number used to generate the name returned by getName. + */ +private static transient long next_chkmenuitem_number; + // Serialization constant private static final long serialVersionUID = 6190621106981774043L; @@ -352,6 +357,21 @@ paramString() accessibleContext = new AccessibleAWTCheckboxMenuItem(); return accessibleContext; } + + /** + * Generate a unique name for this <code>CheckboxMenuItem</code>. + * + * @return A unique name for this <code>CheckboxMenuItem</code>. + */ + String generateName() + { + return "chkmenuitem" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_chkmenuitem_number++; + } } // class CheckboxMenuItem diff --git a/java/awt/Choice.java b/java/awt/Choice.java index 90a8d3141..f1da94bbe 100644 --- a/java/awt/Choice.java +++ b/java/awt/Choice.java @@ -63,6 +63,11 @@ public class Choice extends Component * Static Variables */ +/** + * The number used to generate the name returned by getName. + */ +private static transient long next_choice_number; + // Serialization constant private static final long serialVersionUID = -4075310674757313071L; @@ -639,4 +644,19 @@ paramString() accessibleContext = new AccessibleAWTChoice(); return accessibleContext; } + + /** + * Generate a unique name for this <code>Choice</code>. + * + * @return A unique name for this <code>Choice</code>. + */ + String generateName() + { + return "choice" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_choice_number++; + } } // class Choice diff --git a/java/awt/Cursor.java b/java/awt/Cursor.java index 0ff987cd9..4d339b721 100644 --- a/java/awt/Cursor.java +++ b/java/awt/Cursor.java @@ -116,6 +116,16 @@ public class Cursor implements java.io.Serializable */ public static final int MOVE_CURSOR = 13; + private static String[] NAMES = { "Default Cursor", "Crosshair Cursor", + "Text Cursor", "Wait Cursor", + "Southwest Resize Cursor", + "Southeast Resize Cursor", + "Northwest Resize Cursor", + "Northeast Resize Cursor", + "North Resize Cursor", "South Resize Cursor", + "West Resize Cursor", "East Resize Cursor", + "Hand Cursor", "Move Cursor" }; + public static final int CUSTOM_CURSOR = 0xFFFFFFFF; private static final int PREDEFINED_COUNT = 14; @@ -142,7 +152,10 @@ public class Cursor implements java.io.Serializable throw new IllegalArgumentException ("invalid cursor " + type); this.type = type; - // FIXME: lookup and set name? + + name = NAMES[type]; + + // FIXME: lookup? } /** This constructor is used internally only. diff --git a/java/awt/List.java b/java/awt/List.java index e6c0ec170..862702343 100644 --- a/java/awt/List.java +++ b/java/awt/List.java @@ -66,6 +66,11 @@ public class List extends Component * Static Variables */ +/** + * The number used to generate the name returned by getName. + */ +private static transient long next_list_number; + // Serialization constant private static final long serialVersionUID = -3304312411574666869L; @@ -1266,4 +1271,19 @@ paramString() accessibleContext = new AccessibleAWTList(); return accessibleContext; } + + /** + * Generate a unique name for this <code>List</code>. + * + * @return A unique name for this <code>List</code>. + */ + String generateName() + { + return "list" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_list_number++; + } } // class List diff --git a/java/awt/Menu.java b/java/awt/Menu.java index 6daec72cf..f900d9295 100644 --- a/java/awt/Menu.java +++ b/java/awt/Menu.java @@ -58,6 +58,11 @@ public class Menu extends MenuItem implements MenuContainer, Serializable * Static Variables */ +/** + * The number used to generate the name returned by getName. + */ +private static transient long next_menu_number; + // Serialization Constant private static final long serialVersionUID = -8809584163345499784L; @@ -485,5 +490,20 @@ paramString() accessibleContext = new AccessibleAWTMenu(); return accessibleContext; } + + /** + * Generate a unique name for this <code>Menu</code>. + * + * @return A unique name for this <code>Menu</code>. + */ + String generateName() + { + return "menu" + getUniqueLong(); + } + private static synchronized long getUniqueLong() + { + return next_menu_number++; + } + } // class Menu diff --git a/java/awt/MenuBar.java b/java/awt/MenuBar.java index 3c6b91564..bd658cde6 100644 --- a/java/awt/MenuBar.java +++ b/java/awt/MenuBar.java @@ -60,10 +60,15 @@ public class MenuBar extends MenuComponent implements MenuContainer, Serializable, Accessible { -//Serialization Constant + // Serialization Constant private static final long serialVersionUID = -4930327919388951260L; /** + * The number used to generate the name returned by getName. + */ + private static transient long next_menubar_number; + + /** * @serial The menu used for providing help information */ private Menu helpMenu; @@ -331,6 +336,21 @@ public class MenuBar extends MenuComponent accessibleContext = new AccessibleAWTMenuBar(); return accessibleContext; } + + /** + * Generate a unique name for this <code>MenuBar</code>. + * + * @return A unique name for this <code>MenuBar</code>. + */ + String generateName() + { + return "menubar" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_menubar_number++; + } /** * This class provides accessibility support for AWT menu bars. diff --git a/java/awt/MenuComponent.java b/java/awt/MenuComponent.java index 9bb875069..163092685 100644 --- a/java/awt/MenuComponent.java +++ b/java/awt/MenuComponent.java @@ -200,8 +200,22 @@ public abstract class MenuComponent implements Serializable */ public String getName() { + if (name == null && ! nameExplicitlySet) + name = generateName(); return name; } + + /** + * Subclasses should override this to return unique component names like + * "menuitem0". + * + * @return the generated name for this menu component + */ + String generateName() + { + // MenuComponent is abstract. + return null; + } /** * Sets the name of this component to the specified name. diff --git a/java/awt/MenuItem.java b/java/awt/MenuItem.java index a7ac79643..7cbc9219f 100644 --- a/java/awt/MenuItem.java +++ b/java/awt/MenuItem.java @@ -63,9 +63,15 @@ public class MenuItem extends MenuComponent /* * Static Variables */ + + + /** + * The number used to generate the name returned by getName. + */ + private static transient long next_menuitem_number; -// Serialization Constant -private static final long serialVersionUID = -21757335363267194L; + // Serialization Constant + private static final long serialVersionUID = - 21757335363267194L; /*************************************************************************/ @@ -599,4 +605,19 @@ public AccessibleContext getAccessibleContext() return accessibleContext; } +/** + * Generate a unique name for this <code>MenuItem</code>. + * + * @return A unique name for this <code>MenuItem</code>. + */ +String generateName() +{ + return "menuitem" + getUniqueLong(); +} + +private static synchronized long getUniqueLong() +{ + return next_menuitem_number++; +} + } // class MenuItem diff --git a/java/awt/PopupMenu.java b/java/awt/PopupMenu.java index 540fffda7..926867802 100644 --- a/java/awt/PopupMenu.java +++ b/java/awt/PopupMenu.java @@ -55,8 +55,13 @@ public class PopupMenu extends Menu * Static Variables */ -// Serialization Constant -private static final long serialVersionUID = -4620452533522760060L; + /** + * The number used to generate the name returned by getName. + */ + private static transient long next_popup_number; + + // Serialization Constant + private static final long serialVersionUID = - 4620452533522760060L; /*************************************************************************/ @@ -166,6 +171,21 @@ show(Component component, int x, int y) accessibleContext = new AccessibleAWTPopupMenu(); return accessibleContext; } + + /** + * Generate a unique name for this <code>PopupMenu</code>. + * + * @return A unique name for this <code>PopupMenu</code>. + */ + String generateName() + { + return "popup" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_popup_number++; + } } // class PopupMenu diff --git a/java/awt/ScrollPane.java b/java/awt/ScrollPane.java index 525d9d3e7..65ce484b8 100644 --- a/java/awt/ScrollPane.java +++ b/java/awt/ScrollPane.java @@ -46,6 +46,7 @@ import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; + /** * This widget provides a scrollable region that allows a single * subcomponent to be viewed through a smaller window. @@ -76,6 +77,11 @@ public static final int SCROLLBARS_ALWAYS = 1; */ public static final int SCROLLBARS_NEVER = 2; +/** + * The number used to generate the name returned by getName. + */ +private static transient long next_scrollpane_number; + // Serialization constant private static final long serialVersionUID = 7956609840827222915L; @@ -221,7 +227,7 @@ getVAdjustable() * @return The viewport size. */ public Dimension getViewportSize () -{ +{ Dimension viewsize = getSize (); Insets insets = getInsets (); @@ -231,9 +237,9 @@ public Dimension getViewportSize () Component[] list = getComponents(); if ((list == null) || (list.length <= 0)) return viewsize; - + Dimension dim = list[0].getPreferredSize(); - + if (dim.width <= 0 && dim.height <= 0) return viewsize; @@ -276,7 +282,7 @@ public Dimension getViewportSize () needHorizontal = true; else if (dim.width > (viewsize.width - vScrollbarWidth)) mayNeedHorizontal = true; - + if (needVertical && mayNeedHorizontal) needHorizontal = true; @@ -288,7 +294,7 @@ public Dimension getViewportSize () if (needVertical) viewsize.width -= vScrollbarWidth; - + return viewsize; } @@ -613,5 +619,21 @@ paramString() accessibleContext = new AccessibleAWTScrollPane(); return accessibleContext; } + + /** + * Generate a unique name for this <code>ScrollPane</code>. + * + * @return A unique name for this <code>ScrollPane</code>. + */ + String generateName() + { + return "scrollpane" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_scrollpane_number++; + } + } // class ScrollPane diff --git a/java/awt/TextField.java b/java/awt/TextField.java index 1ee07c2d3..b76f393a0 100644 --- a/java/awt/TextField.java +++ b/java/awt/TextField.java @@ -54,7 +54,13 @@ import javax.accessibility.AccessibleStateSet; */ public class TextField extends TextComponent { + + /** + * The number used to generate the name returned by getName. + */ + private static transient long next_textfield_number; + private static final long serialVersionUID = -2966288784432217853L; @@ -434,6 +440,21 @@ public class TextField extends TextComponent { return (ActionListener[]) getListeners (ActionListener.class); } + + /** + * Generate a unique name for this <code>TextField</code>. + * + * @return A unique name for this <code>TextField</code>. + */ + String generateName() + { + return "textfield" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_textfield_number++; + } protected class AccessibleAWTTextField extends AccessibleAWTTextComponent { |