提交 ce63aef0 编写于 作者: L lana

Merge

...@@ -95,3 +95,4 @@ e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114 ...@@ -95,3 +95,4 @@ e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114
b357910aa04aead2a16b6d6ff395a8df4b51d1dd jdk7-b118 b357910aa04aead2a16b6d6ff395a8df4b51d1dd jdk7-b118
ecab7eefb8f2326fd90fb632f47f1b6f81e928f8 jdk7-b119 ecab7eefb8f2326fd90fb632f47f1b6f81e928f8 jdk7-b119
37d74e29687cf07c2bf9411af58c7e42440855c3 jdk7-b120 37d74e29687cf07c2bf9411af58c7e42440855c3 jdk7-b120
a661d8587b5d8986aacae086f5df66af9e1a96b1 jdk7-b121
...@@ -83,14 +83,19 @@ ifndef CLOSED_SRC ...@@ -83,14 +83,19 @@ ifndef CLOSED_SRC
CLOSED_SRC = $(BUILDDIR)/../src/closed CLOSED_SRC = $(BUILDDIR)/../src/closed
endif endif
# If we have no closed directory, force it to an openjdk build # If CLOSE_SRC_INCLUDED isn't set to true, check if there's any
CLOSED_SRC_DIR_EXISTS := $(shell \ # closed directory.
if [ -d $(CLOSED_SRC) ] ; then \ ifneq ($(CLOSED_SRC_INCLUDED), true)
echo true; \ CLOSED_SRC_INCLUDED := $(shell \
else \ if [ -d $(CLOSED_SRC) ] ; then \
echo false; \ echo true; \
fi) else \
ifeq ($(CLOSED_SRC_DIR_EXISTS), false) echo false; \
fi)
endif
# Set OPENJDK based on CLOSED_SRC_INCLUDED
ifeq ($(CLOSED_SRC_INCLUDED), false)
OPENJDK = true OPENJDK = true
endif endif
......
...@@ -432,6 +432,7 @@ SUNWprivate_1.1 { ...@@ -432,6 +432,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_GtkFileDialogPeer_initIDs; Java_sun_awt_X11_GtkFileDialogPeer_initIDs;
Java_sun_awt_X11_GtkFileDialogPeer_run; Java_sun_awt_X11_GtkFileDialogPeer_run;
Java_sun_awt_X11_GtkFileDialogPeer_quit; Java_sun_awt_X11_GtkFileDialogPeer_quit;
Java_sun_awt_X11_GtkFileDialogPeer_toFront;
Java_sun_print_CUPSPrinter_initIDs; Java_sun_print_CUPSPrinter_initIDs;
Java_sun_print_CUPSPrinter_getCupsServer; Java_sun_print_CUPSPrinter_getCupsServer;
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -111,7 +111,7 @@ class CharacterData00 extends CharacterData { ...@@ -111,7 +111,7 @@ class CharacterData00 extends CharacterData {
if ((val & $$maskCaseOffset) == $$maskCaseOffset) { if ((val & $$maskCaseOffset) == $$maskCaseOffset) {
switch(ch) { switch(ch) {
// map the offset overflow chars // map the offset overflow chars
case 0x0130 : mapChar = 0x0069; break; case 0x0130 : mapChar = 0x0069; break;
case 0x2126 : mapChar = 0x03C9; break; case 0x2126 : mapChar = 0x03C9; break;
case 0x212A : mapChar = 0x006B; break; case 0x212A : mapChar = 0x006B; break;
case 0x212B : mapChar = 0x00E5; break; case 0x212B : mapChar = 0x00E5; break;
...@@ -192,7 +192,11 @@ class CharacterData00 extends CharacterData { ...@@ -192,7 +192,11 @@ class CharacterData00 extends CharacterData {
case 0x2C6D : mapChar = 0x0251; break; case 0x2C6D : mapChar = 0x0251; break;
case 0x2C6E : mapChar = 0x0271; break; case 0x2C6E : mapChar = 0x0271; break;
case 0x2C6F : mapChar = 0x0250; break; case 0x2C6F : mapChar = 0x0250; break;
case 0x2C70 : mapChar = 0x0252; break;
case 0x2C7E : mapChar = 0x023F; break;
case 0x2C7F : mapChar = 0x0240; break;
case 0xA77D : mapChar = 0x1D79; break; case 0xA77D : mapChar = 0x1D79; break;
case 0xA78D : mapChar = 0x0265; break;
// default mapChar is already set, so no // default mapChar is already set, so no
// need to redo it here. // need to redo it here.
// default : mapChar = ch; // default : mapChar = ch;
...@@ -246,8 +250,12 @@ class CharacterData00 extends CharacterData { ...@@ -246,8 +250,12 @@ class CharacterData00 extends CharacterData {
case 0x1FC3 : mapChar = 0x1FCC; break; case 0x1FC3 : mapChar = 0x1FCC; break;
case 0x1FF3 : mapChar = 0x1FFC; break; case 0x1FF3 : mapChar = 0x1FFC; break;
case 0x023F : mapChar = 0x2C7E; break;
case 0x0240 : mapChar = 0x2C7F; break;
case 0x0250 : mapChar = 0x2C6F; break; case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break; case 0x0251 : mapChar = 0x2C6D; break;
case 0x0252 : mapChar = 0x2C70; break;
case 0x0265 : mapChar = 0xA78D; break;
case 0x026B : mapChar = 0x2C62; break; case 0x026B : mapChar = 0x2C62; break;
case 0x0271 : mapChar = 0x2C6E; break; case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break; case 0x027D : mapChar = 0x2C64; break;
...@@ -487,8 +495,12 @@ class CharacterData00 extends CharacterData { ...@@ -487,8 +495,12 @@ class CharacterData00 extends CharacterData {
case 0x017F : mapChar = 0x0053; break; case 0x017F : mapChar = 0x0053; break;
case 0x1FBE : mapChar = 0x0399; break; case 0x1FBE : mapChar = 0x0399; break;
case 0x023F : mapChar = 0x2C7E; break;
case 0x0240 : mapChar = 0x2C7F; break;
case 0x0250 : mapChar = 0x2C6F; break; case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break; case 0x0251 : mapChar = 0x2C6D; break;
case 0x0252 : mapChar = 0x2C70; break;
case 0x0265 : mapChar = 0xA78D; break;
case 0x026B : mapChar = 0x2C62; break; case 0x026B : mapChar = 0x2C62; break;
case 0x0271 : mapChar = 0x2C6E; break; case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break; case 0x027D : mapChar = 0x2C64; break;
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -251,9 +251,40 @@ class CharacterData01 extends CharacterData { ...@@ -251,9 +251,40 @@ class CharacterData01 extends CharacterData {
case 0x010341: retval = 90; break; // GOTHIC LETTER NINETY case 0x010341: retval = 90; break; // GOTHIC LETTER NINETY
case 0x01034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED case 0x01034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED
case 0x0103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED case 0x0103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED
case 0x01085D: retval = 100; break; // IMPERIAL ARAMAIC NUMBER ONE HUNDRED
case 0x01085E: retval = 1000; break; // IMPERIAL ARAMAIC NUMBER ONE THOUSAND
case 0x01085F: retval = 10000; break; // IMPERIAL ARAMAIC NUMBER TEN THOUSAND
case 0x010919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED case 0x010919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED
case 0x010A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED case 0x010A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED
case 0x010A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND case 0x010A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND
case 0x010A7E: retval = 50; break; // OLD SOUTH ARABIAN NUMBER FIFTY
case 0x010B5E: retval = 100; break; // INSCRIPTIONAL PARTHIAN NUMBER ONE HUNDRED
case 0x010B5F: retval = 1000; break; // INSCRIPTIONAL PARTHIAN NUMBER ONE THOUSAND
case 0x010B7E: retval = 100; break; // INSCRIPTIONAL PAHLAVI NUMBER ONE HUNDRED
case 0x010B7F: retval = 1000; break; // INSCRIPTIONAL PAHLAVI NUMBER ONE THOUSAND
case 0x010E6C: retval = 40; break; // RUMI NUMBER FORTY
case 0x010E6D: retval = 50; break; // RUMI NUMBER FIFTY
case 0x010E6E: retval = 60; break; // RUMI NUMBER SIXTY
case 0x010E6F: retval = 70; break; // RUMI NUMBER SEVENTY
case 0x010E70: retval = 80; break; // RUMI NUMBER EIGHTY
case 0x010E71: retval = 90; break; // RUMI NUMBER NINETY
case 0x010E72: retval = 100; break; // RUMI NUMBER ONE HUNDRED
case 0x010E73: retval = 200; break; // RUMI NUMBER TWO HUNDRED
case 0x010E74: retval = 300; break; // RUMI NUMBER THREE HUNDRED
case 0x010E75: retval = 400; break; // RUMI NUMBER FOUR HUNDRED
case 0x010E76: retval = 500; break; // RUMI NUMBER FIVE HUNDRED
case 0x010E77: retval = 600; break; // RUMI NUMBER SIX HUNDRED
case 0x010E78: retval = 700; break; // RUMI NUMBER SEVEN HUNDRED
case 0x010E79: retval = 800; break; // RUMI NUMBER EIGHT HUNDRED
case 0x010E7A: retval = 900; break; // RUMI NUMBER NINE HUNDRED
case 0x01105E: retval = 40; break; // BRAHMI NUMBER FORTY
case 0x01105F: retval = 50; break; // BRAHMI NUMBER FIFTY
case 0x011060: retval = 60; break; // BRAHMI NUMBER SIXTY
case 0x011061: retval = 70; break; // BRAHMI NUMBER SEVENTY
case 0x011062: retval = 80; break; // BRAHMI NUMBER EIGHTY
case 0x011063: retval = 90; break; // BRAHMI NUMBER NINETY
case 0x011064: retval = 100; break; // BRAHMI NUMBER ONE HUNDRED
case 0x011065: retval = 1000; break; // BRAHMI NUMBER ONE THOUSAND
case 0x01D36C: retval = 40; break; // COUNTING ROD TENS DIGIT FOUR case 0x01D36C: retval = 40; break; // COUNTING ROD TENS DIGIT FOUR
case 0x01D36D: retval = 50; break; // COUNTING ROD TENS DIGIT FIVE case 0x01D36D: retval = 50; break; // COUNTING ROD TENS DIGIT FIVE
case 0x01D36E: retval = 60; break; // COUNTING ROD TENS DIGIT SIX case 0x01D36E: retval = 60; break; // COUNTING ROD TENS DIGIT SIX
......
此差异已折叠。
# SpecialCasing-5.1.0.txt # SpecialCasing-6.0.0.txt
# Date: 2008-03-03, 21:58:10 GMT [MD] # Date: 2010-05-18, 00:49:39 GMT [MD]
# #
# Unicode Character Database # Unicode Character Database
# Copyright (c) 1991-2008 Unicode, Inc. # Copyright (c) 1991-2010 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html # For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see UCD.html # For documentation, see http://www.unicode.org/reports/tr44/
# #
# Special Casing Properties # Special Casing Properties
# #
...@@ -106,11 +106,11 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH ...@@ -106,11 +106,11 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
1FE7; 1FE7; 03A5 0308 0342; 03A5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI 1FE7; 1FE7; 03A5 0308 0342; 03A5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI
1FF6; 1FF6; 03A9 0342; 03A9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI 1FF6; 1FF6; 03A9 0342; 03A9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI
# IMPORTANT-when capitalizing iota-subscript (0345) # IMPORTANT-when iota-subscript (0345) is uppercased or titlecased,
# It MUST be in normalized form--moved to the end of any sequence of combining marks. # the result will be incorrect unless the iota-subscript is moved to the end
# This is because logically it represents a following base character! # of any sequence of combining marks. Otherwise, the accents will go on the capital iota.
# E.g. <iota_subscript> (<Mn> | <Mc> | <Me>)+ => (<Mn> | <Mc> | <Me>)+ <iota_subscript> # This process can be achieved by first transforming the text to NFC before casing.
# It should never be the first character in a word, so in titlecasing it can be left as is. # E.g. <alpha><iota_subscript><acute> is uppercased to <ALPHA><acute><IOTA>
# The following cases are already in the UnicodeData file, so are only commented here. # The following cases are already in the UnicodeData file, so are only commented here.
......
...@@ -611,12 +611,15 @@ public class Color implements Paint, java.io.Serializable { ...@@ -611,12 +611,15 @@ public class Color implements Paint, java.io.Serializable {
* <p> * <p>
* This method applies an arbitrary scale factor to each of the three RGB * This method applies an arbitrary scale factor to each of the three RGB
* components of this <code>Color</code> to create a brighter version * components of this <code>Color</code> to create a brighter version
* of this <code>Color</code>. Although <code>brighter</code> and * of this <code>Color</code>.
* The {@code alpha} value is preserved.
* Although <code>brighter</code> and
* <code>darker</code> are inverse operations, the results of a * <code>darker</code> are inverse operations, the results of a
* series of invocations of these two methods might be inconsistent * series of invocations of these two methods might be inconsistent
* because of rounding errors. * because of rounding errors.
* @return a new <code>Color</code> object that is * @return a new <code>Color</code> object that is
* a brighter version of this <code>Color</code>. * a brighter version of this <code>Color</code>
* with the same {@code alpha} value.
* @see java.awt.Color#darker * @see java.awt.Color#darker
* @since JDK1.0 * @since JDK1.0
*/ */
...@@ -624,6 +627,7 @@ public class Color implements Paint, java.io.Serializable { ...@@ -624,6 +627,7 @@ public class Color implements Paint, java.io.Serializable {
int r = getRed(); int r = getRed();
int g = getGreen(); int g = getGreen();
int b = getBlue(); int b = getBlue();
int alpha = getAlpha();
/* From 2D group: /* From 2D group:
* 1. black.brighter() should return grey * 1. black.brighter() should return grey
...@@ -632,7 +636,7 @@ public class Color implements Paint, java.io.Serializable { ...@@ -632,7 +636,7 @@ public class Color implements Paint, java.io.Serializable {
*/ */
int i = (int)(1.0/(1.0-FACTOR)); int i = (int)(1.0/(1.0-FACTOR));
if ( r == 0 && g == 0 && b == 0) { if ( r == 0 && g == 0 && b == 0) {
return new Color(i, i, i); return new Color(i, i, i, alpha);
} }
if ( r > 0 && r < i ) r = i; if ( r > 0 && r < i ) r = i;
if ( g > 0 && g < i ) g = i; if ( g > 0 && g < i ) g = i;
...@@ -640,7 +644,8 @@ public class Color implements Paint, java.io.Serializable { ...@@ -640,7 +644,8 @@ public class Color implements Paint, java.io.Serializable {
return new Color(Math.min((int)(r/FACTOR), 255), return new Color(Math.min((int)(r/FACTOR), 255),
Math.min((int)(g/FACTOR), 255), Math.min((int)(g/FACTOR), 255),
Math.min((int)(b/FACTOR), 255)); Math.min((int)(b/FACTOR), 255),
alpha);
} }
/** /**
...@@ -649,19 +654,23 @@ public class Color implements Paint, java.io.Serializable { ...@@ -649,19 +654,23 @@ public class Color implements Paint, java.io.Serializable {
* <p> * <p>
* This method applies an arbitrary scale factor to each of the three RGB * This method applies an arbitrary scale factor to each of the three RGB
* components of this <code>Color</code> to create a darker version of * components of this <code>Color</code> to create a darker version of
* this <code>Color</code>. Although <code>brighter</code> and * this <code>Color</code>.
* The {@code alpha} value is preserved.
* Although <code>brighter</code> and
* <code>darker</code> are inverse operations, the results of a series * <code>darker</code> are inverse operations, the results of a series
* of invocations of these two methods might be inconsistent because * of invocations of these two methods might be inconsistent because
* of rounding errors. * of rounding errors.
* @return a new <code>Color</code> object that is * @return a new <code>Color</code> object that is
* a darker version of this <code>Color</code>. * a darker version of this <code>Color</code>
* with the same {@code alpha} value.
* @see java.awt.Color#brighter * @see java.awt.Color#brighter
* @since JDK1.0 * @since JDK1.0
*/ */
public Color darker() { public Color darker() {
return new Color(Math.max((int)(getRed() *FACTOR), 0), return new Color(Math.max((int)(getRed() *FACTOR), 0),
Math.max((int)(getGreen()*FACTOR), 0), Math.max((int)(getGreen()*FACTOR), 0),
Math.max((int)(getBlue() *FACTOR), 0)); Math.max((int)(getBlue() *FACTOR), 0),
getAlpha());
} }
/** /**
......
...@@ -51,6 +51,7 @@ import javax.accessibility.*; ...@@ -51,6 +51,7 @@ import javax.accessibility.*;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import sun.awt.AppContext; import sun.awt.AppContext;
import sun.awt.AWTAccessor;
import sun.awt.CausedFocusEvent; import sun.awt.CausedFocusEvent;
import sun.awt.PeerEvent; import sun.awt.PeerEvent;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
...@@ -247,6 +248,13 @@ public class Container extends Component { ...@@ -247,6 +248,13 @@ public class Container extends Component {
if (!GraphicsEnvironment.isHeadless()) { if (!GraphicsEnvironment.isHeadless()) {
initIDs(); initIDs();
} }
AWTAccessor.setContainerAccessor(new AWTAccessor.ContainerAccessor() {
@Override
public void validateUnconditionally(Container cont) {
cont.validateUnconditionally();
}
});
} }
/** /**
......
...@@ -1248,14 +1248,31 @@ public class Dialog extends Window { ...@@ -1248,14 +1248,31 @@ public class Dialog extends Window {
/** /**
* Disables or enables decorations for this dialog. * Disables or enables decorations for this dialog.
* This method can only be called while the dialog is not displayable. * <p>
* @param undecorated <code>true</code> if no dialog decorations are * This method can only be called while the dialog is not displayable. To
* to be enabled; * make this dialog decorated, it must be opaque and have the default shape,
* <code>false</code> if dialog decorations are to be enabled. * otherwise the {@code IllegalComponentStateException} will be thrown.
* @throws <code>IllegalComponentStateException</code> if the dialog * Refer to {@link Window#setShape}, {@link Window#setOpacity} and {@link
* is displayable. * Window#setBackground} for details
*
* @param undecorated {@code true} if no dialog decorations are to be
* enabled; {@code false} if dialog decorations are to be enabled
*
* @throws IllegalComponentStateException if the dialog is displayable
* @throws IllegalComponentStateException if {@code undecorated} is
* {@code false}, and this dialog does not have the default shape
* @throws IllegalComponentStateException if {@code undecorated} is
* {@code false}, and this dialog opacity is less than {@code 1.0f}
* @throws IllegalComponentStateException if {@code undecorated} is
* {@code false}, and the alpha value of this dialog background
* color is less than {@code 1.0f}
*
* @see #isUndecorated * @see #isUndecorated
* @see Component#isDisplayable * @see Component#isDisplayable
* @see Window#getShape
* @see Window#getOpacity
* @see Window#getBackground
*
* @since 1.4 * @since 1.4
*/ */
public void setUndecorated(boolean undecorated) { public void setUndecorated(boolean undecorated) {
...@@ -1264,6 +1281,18 @@ public class Dialog extends Window { ...@@ -1264,6 +1281,18 @@ public class Dialog extends Window {
if (isDisplayable()) { if (isDisplayable()) {
throw new IllegalComponentStateException("The dialog is displayable."); throw new IllegalComponentStateException("The dialog is displayable.");
} }
if (!undecorated) {
if (getOpacity() < 1.0f) {
throw new IllegalComponentStateException("The dialog is not opaque");
}
if (getShape() != null) {
throw new IllegalComponentStateException("The dialog does not have a default shape");
}
Color bg = getBackground();
if ((bg != null) && (bg.getAlpha() < 255)) {
throw new IllegalComponentStateException("The dialog background color is not opaque");
}
}
this.undecorated = undecorated; this.undecorated = undecorated;
} }
} }
...@@ -1280,6 +1309,45 @@ public class Dialog extends Window { ...@@ -1280,6 +1309,45 @@ public class Dialog extends Window {
return undecorated; return undecorated;
} }
/**
* {@inheritDoc}
*/
@Override
public void setOpacity(float opacity) {
synchronized (getTreeLock()) {
if ((opacity < 1.0f) && !isUndecorated()) {
throw new IllegalComponentStateException("The dialog is decorated");
}
super.setOpacity(opacity);
}
}
/**
* {@inheritDoc}
*/
@Override
public void setShape(Shape shape) {
synchronized (getTreeLock()) {
if ((shape != null) && !isUndecorated()) {
throw new IllegalComponentStateException("The dialog is decorated");
}
super.setShape(shape);
}
}
/**
* {@inheritDoc}
*/
@Override
public void setBackground(Color bgColor) {
synchronized (getTreeLock()) {
if ((bgColor != null) && (bgColor.getAlpha() < 255) && !isUndecorated()) {
throw new IllegalComponentStateException("The dialog is decorated");
}
super.setBackground(bgColor);
}
}
/** /**
* Returns a string representing the state of this dialog. This * Returns a string representing the state of this dialog. This
* method is intended to be used only for debugging purposes, and the * method is intended to be used only for debugging purposes, and the
......
...@@ -99,7 +99,7 @@ public class FileDialog extends Dialog { ...@@ -99,7 +99,7 @@ public class FileDialog extends Dialog {
* Contains the File instances for all the files that the user selects. * Contains the File instances for all the files that the user selects.
* *
* @serial * @serial
* @see getFiles * @see #getFiles
* @since 1.7 * @since 1.7
*/ */
private File[] files; private File[] files;
......
...@@ -828,6 +828,11 @@ public class Frame extends Window implements MenuContainer { ...@@ -828,6 +828,11 @@ public class Frame extends Window implements MenuContainer {
return frame.state; return frame.state;
} }
} }
public Rectangle getMaximizedBounds(Frame frame) {
synchronized(frame.getObjectLock()) {
return frame.maximizedBounds;
}
}
} }
); );
} }
...@@ -855,8 +860,10 @@ public class Frame extends Window implements MenuContainer { ...@@ -855,8 +860,10 @@ public class Frame extends Window implements MenuContainer {
* @see #getMaximizedBounds() * @see #getMaximizedBounds()
* @since 1.4 * @since 1.4
*/ */
public synchronized void setMaximizedBounds(Rectangle bounds) { public void setMaximizedBounds(Rectangle bounds) {
this.maximizedBounds = bounds; synchronized(getObjectLock()) {
this.maximizedBounds = bounds;
}
FramePeer peer = (FramePeer)this.peer; FramePeer peer = (FramePeer)this.peer;
if (peer != null) { if (peer != null) {
peer.setMaximizedBounds(bounds); peer.setMaximizedBounds(bounds);
...@@ -873,21 +880,40 @@ public class Frame extends Window implements MenuContainer { ...@@ -873,21 +880,40 @@ public class Frame extends Window implements MenuContainer {
* @since 1.4 * @since 1.4
*/ */
public Rectangle getMaximizedBounds() { public Rectangle getMaximizedBounds() {
return maximizedBounds; synchronized(getObjectLock()) {
return maximizedBounds;
}
} }
/** /**
* Disables or enables decorations for this frame. * Disables or enables decorations for this frame.
* This method can only be called while the frame is not displayable. * <p>
* @param undecorated <code>true</code> if no frame decorations are * This method can only be called while the frame is not displayable. To
* to be enabled; * make this frame decorated, it must be opaque and have the default shape,
* <code>false</code> if frame decorations are to be enabled. * otherwise the {@code IllegalComponentStateException} will be thrown.
* @throws <code>IllegalComponentStateException</code> if the frame * Refer to {@link Window#setShape}, {@link Window#setOpacity} and {@link
* is displayable. * Window#setBackground} for details
*
* @param undecorated {@code true} if no frame decorations are to be
* enabled; {@code false} if frame decorations are to be enabled
*
* @throws IllegalComponentStateException if the frame is displayable
* @throws IllegalComponentStateException if {@code undecorated} is
* {@code false}, and this frame does not have the default shape
* @throws IllegalComponentStateException if {@code undecorated} is
* {@code false}, and this frame opacity is less than {@code 1.0f}
* @throws IllegalComponentStateException if {@code undecorated} is
* {@code false}, and the alpha value of this frame background
* color is less than {@code 1.0f}
*
* @see #isUndecorated * @see #isUndecorated
* @see Component#isDisplayable * @see Component#isDisplayable
* @see Window#getShape
* @see Window#getOpacity
* @see Window#getBackground
* @see javax.swing.JFrame#setDefaultLookAndFeelDecorated(boolean) * @see javax.swing.JFrame#setDefaultLookAndFeelDecorated(boolean)
*
* @since 1.4 * @since 1.4
*/ */
public void setUndecorated(boolean undecorated) { public void setUndecorated(boolean undecorated) {
...@@ -896,6 +922,18 @@ public class Frame extends Window implements MenuContainer { ...@@ -896,6 +922,18 @@ public class Frame extends Window implements MenuContainer {
if (isDisplayable()) { if (isDisplayable()) {
throw new IllegalComponentStateException("The frame is displayable."); throw new IllegalComponentStateException("The frame is displayable.");
} }
if (!undecorated) {
if (getOpacity() < 1.0f) {
throw new IllegalComponentStateException("The frame is not opaque");
}
if (getShape() != null) {
throw new IllegalComponentStateException("The frame does not have a default shape");
}
Color bg = getBackground();
if ((bg != null) && (bg.getAlpha() < 255)) {
throw new IllegalComponentStateException("The frame background color is not opaque");
}
}
this.undecorated = undecorated; this.undecorated = undecorated;
} }
} }
...@@ -912,6 +950,45 @@ public class Frame extends Window implements MenuContainer { ...@@ -912,6 +950,45 @@ public class Frame extends Window implements MenuContainer {
return undecorated; return undecorated;
} }
/**
* {@inheritDoc}
*/
@Override
public void setOpacity(float opacity) {
synchronized (getTreeLock()) {
if ((opacity < 1.0f) && !isUndecorated()) {
throw new IllegalComponentStateException("The frame is decorated");
}
super.setOpacity(opacity);
}
}
/**
* {@inheritDoc}
*/
@Override
public void setShape(Shape shape) {
synchronized (getTreeLock()) {
if ((shape != null) && !isUndecorated()) {
throw new IllegalComponentStateException("The frame is decorated");
}
super.setShape(shape);
}
}
/**
* {@inheritDoc}
*/
@Override
public void setBackground(Color bgColor) {
synchronized (getTreeLock()) {
if ((bgColor != null) && (bgColor.getAlpha() < 255) && !isUndecorated()) {
throw new IllegalComponentStateException("The frame is decorated");
}
super.setBackground(bgColor);
}
}
/** /**
* Removes the specified menu bar from this frame. * Removes the specified menu bar from this frame.
* @param m the menu component to remove. * @param m the menu component to remove.
......
...@@ -3474,14 +3474,20 @@ public class Window extends Container implements Accessible { ...@@ -3474,14 +3474,20 @@ public class Window extends Container implements Accessible {
* level of 0 may or may not disable the mouse event handling on this * level of 0 may or may not disable the mouse event handling on this
* window. This is a platform-dependent behavior. * window. This is a platform-dependent behavior.
* <p> * <p>
* In order for this method to enable the translucency effect, the {@link * The following conditions must be met in order to set the opacity value
* GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)} method must indicate that * less than {@code 1.0f}:
* the {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT} * <ul>
* translucency is supported. * <li>The {@link GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
* translucency must be supported by the underlying system
* <li>The window must be undecorated (see {@link Frame#setUndecorated}
* and {@link Dialog#setUndecorated})
* <li>The window must not be in full-screen mode (see {@link
* GraphicsDevice#setFullScreenWindow(Window)})
* </ul>
* <p> * <p>
* Also note that the window must not be in the full-screen mode when * If the requested opacity value is less than {@code 1.0f}, and any of the
* setting the opacity value &lt; 1.0f. Otherwise the {@code * above conditions are not met, the window opacity will not change,
* IllegalComponentStateException} is thrown. * and the {@code IllegalComponentStateException} will be thrown.
* <p> * <p>
* The translucency levels of individual pixels may also be effected by the * The translucency levels of individual pixels may also be effected by the
* alpha component of their color (see {@link Window#setBackground(Color)}) and the * alpha component of their color (see {@link Window#setBackground(Color)}) and the
...@@ -3491,15 +3497,20 @@ public class Window extends Container implements Accessible { ...@@ -3491,15 +3497,20 @@ public class Window extends Container implements Accessible {
* *
* @throws IllegalArgumentException if the opacity is out of the range * @throws IllegalArgumentException if the opacity is out of the range
* [0..1] * [0..1]
* @throws IllegalComponentStateException if the window is decorated and
* the opacity is less than {@code 1.0f}
* @throws IllegalComponentStateException if the window is in full screen * @throws IllegalComponentStateException if the window is in full screen
* mode, and the opacity is less than 1.0f * mode, and the opacity is less than {@code 1.0f}
* @throws UnsupportedOperationException if the {@code * @throws UnsupportedOperationException if the {@code
* GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT} * GraphicsDevice.WindowTranslucency#TRANSLUCENT TRANSLUCENT}
* translucency kind is not supported and the opacity is less than 1.0f * translucency is not supported and the opacity is less than
* {@code 1.0f}
* *
* @see Window#getOpacity * @see Window#getOpacity
* @see Window#setBackground(Color) * @see Window#setBackground(Color)
* @see Window#setShape(Shape) * @see Window#setShape(Shape)
* @see Frame#isUndecorated
* @see Dialog#isUndecorated
* @see GraphicsDevice.WindowTranslucency * @see GraphicsDevice.WindowTranslucency
* @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency) * @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
* *
...@@ -3557,24 +3568,26 @@ public class Window extends Container implements Accessible { ...@@ -3557,24 +3568,26 @@ public class Window extends Container implements Accessible {
/** /**
* Sets the shape of the window. * Sets the shape of the window.
* <p> * <p>
* Setting a shape enables cutting off some parts of the window, leaving * Setting a shape cuts off some parts of the window. Only the parts that
* visible and clickable only those parts belonging to the given shape * belong to the given {@link Shape} remain visible and clickable. If
* (see {@link Shape}). If the shape argument is null, this methods * the shape argument is {@code null}, this method restores the default
* restores the default shape (making the window rectangular on most * shape, making the window rectangular on most platforms.
* platforms.)
* <p> * <p>
* The following conditions must be met in order to set a non-null shape: * The following conditions must be met to set a non-null shape:
* <ul> * <ul>
* <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT * <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT
* PERPIXEL_TRANSPARENT} translucency kind must be supported by the * PERPIXEL_TRANSPARENT} translucency must be supported by the
* underlying system * underlying system
* <i>and</i> * <li>The window must be undecorated (see {@link Frame#setUndecorated}
* <li>The window must not be in the full-screen mode (see * and {@link Dialog#setUndecorated})
* {@link GraphicsDevice#setFullScreenWindow(Window)}) * <li>The window must not be in full-screen mode (see {@link
* GraphicsDevice#setFullScreenWindow(Window)})
* </ul> * </ul>
* If a certain condition is not met, either the {@code * <p>
* UnsupportedOperationException} or {@code IllegalComponentStateException} * If the requested shape is not {@code null}, and any of the above
* is thrown. * conditions are not met, the shape of this window will not change,
* and either the {@code UnsupportedOperationException} or {@code
* IllegalComponentStateException} will be thrown.
* <p> * <p>
* The tranlucency levels of individual pixels may also be effected by the * The tranlucency levels of individual pixels may also be effected by the
* alpha component of their color (see {@link Window#setBackground(Color)}) and the * alpha component of their color (see {@link Window#setBackground(Color)}) and the
...@@ -3584,6 +3597,8 @@ public class Window extends Container implements Accessible { ...@@ -3584,6 +3597,8 @@ public class Window extends Container implements Accessible {
* @param shape the shape to set to the window * @param shape the shape to set to the window
* *
* @throws IllegalComponentStateException if the shape is not {@code * @throws IllegalComponentStateException if the shape is not {@code
* null} and the window is decorated
* @throws IllegalComponentStateException if the shape is not {@code
* null} and the window is in full-screen mode * null} and the window is in full-screen mode
* @throws UnsupportedOperationException if the shape is not {@code * @throws UnsupportedOperationException if the shape is not {@code
* null} and {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT * null} and {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSPARENT
...@@ -3592,6 +3607,8 @@ public class Window extends Container implements Accessible { ...@@ -3592,6 +3607,8 @@ public class Window extends Container implements Accessible {
* @see Window#getShape() * @see Window#getShape()
* @see Window#setBackground(Color) * @see Window#setBackground(Color)
* @see Window#setOpacity(float) * @see Window#setOpacity(float)
* @see Frame#isUndecorated
* @see Dialog#isUndecorated
* @see GraphicsDevice.WindowTranslucency * @see GraphicsDevice.WindowTranslucency
* @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency) * @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
* *
...@@ -3645,37 +3662,46 @@ public class Window extends Container implements Accessible { ...@@ -3645,37 +3662,46 @@ public class Window extends Container implements Accessible {
* GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT} * GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}
* tranclucency, the alpha component of the given background color * tranclucency, the alpha component of the given background color
* may effect the mode of operation for this window: it indicates whether * may effect the mode of operation for this window: it indicates whether
* this window must be opaque (alpha == 1.0f) or per-pixel translucent * this window must be opaque (alpha equals {@code 1.0f}) or per-pixel translucent
* (alpha &lt; 1.0f). All the following conditions must be met in order * (alpha is less than {@code 1.0f}). If the given background color is
* to be able to enable the per-pixel transparency mode for this window: * {@code null}, the window is considered completely opaque.
* <p>
* All the following conditions must be met to enable the per-pixel
* transparency mode for this window:
* <ul> * <ul>
* <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT * <li>The {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
* PERPIXEL_TRANSLUCENT} translucency must be supported * PERPIXEL_TRANSLUCENT} translucency must be supported by the graphics
* by the graphics device where this window is located <i>and</i> * device where this window is located
* <li>The window must not be in the full-screen mode (see {@link * <li>The window must be undecorated (see {@link Frame#setUndecorated}
* and {@link Dialog#setUndecorated})
* <li>The window must not be in full-screen mode (see {@link
* GraphicsDevice#setFullScreenWindow(Window)}) * GraphicsDevice#setFullScreenWindow(Window)})
* </ul> * </ul>
* If a certain condition is not met at the time of calling this method, * <p>
* the alpha component of the given background color will not effect the * If the alpha component of the requested background color is less than
* mode of operation for this window. * {@code 1.0f}, and any of the above conditions are not met, the background
* color of this window will not change, the alpha component of the given
* background color will not affect the mode of operation for this window,
* and either the {@code UnsupportedOperationException} or {@code
* IllegalComponentStateException} will be thrown.
* <p> * <p>
* When the window is per-pixel translucent, the drawing sub-system * When the window is per-pixel translucent, the drawing sub-system
* respects the alpha value of each individual pixel. If a pixel gets * respects the alpha value of each individual pixel. If a pixel gets
* painted with the alpha color component equal to zero, it becomes * painted with the alpha color component equal to zero, it becomes
* visually transparent, if the alpha of the pixel is equal to 1.0f, the * visually transparent. If the alpha of the pixel is equal to 1.0f, the
* pixel is fully opaque. Interim values of the alpha color component make * pixel is fully opaque. Interim values of the alpha color component make
* the pixel semi-transparent. In this mode the background of the window * the pixel semi-transparent. In this mode, the background of the window
* gets painted with the alpha value of the given background color (meaning * gets painted with the alpha value of the given background color. If the
* that it is not painted at all if the alpha value of the argument of this * alpha value of the argument of this method is equal to {@code 0}, the
* method is equal to zero.) * background is not painted at all.
* <p> * <p>
* The actual level of translucency of a given pixel also depends on window * The actual level of translucency of a given pixel also depends on window
* opacity (see {@link #setOpacity(float)}), as well as the current shape of * opacity (see {@link #setOpacity(float)}), as well as the current shape of
* this window (see {@link #setShape(Shape)}). * this window (see {@link #setShape(Shape)}).
* <p> * <p>
* Note that painting a pixel with the alpha value of 0 may or may not * Note that painting a pixel with the alpha value of {@code 0} may or may
* disable the mouse event handling on this pixel. This is a * not disable the mouse event handling on this pixel. This is a
* platform-dependent behavior. To make sure the mouse clicks do not get * platform-dependent behavior. To make sure the mouse events do not get
* dispatched to a particular pixel, the pixel must be excluded from the * dispatched to a particular pixel, the pixel must be excluded from the
* shape of the window. * shape of the window.
* <p> * <p>
...@@ -3685,17 +3711,21 @@ public class Window extends Container implements Accessible { ...@@ -3685,17 +3711,21 @@ public class Window extends Container implements Accessible {
* @param bgColor the color to become this window's background color. * @param bgColor the color to become this window's background color.
* *
* @throws IllegalComponentStateException if the alpha value of the given * @throws IllegalComponentStateException if the alpha value of the given
* background color is less than 1.0f and the window is in * background color is less than {@code 1.0f} and the window is decorated
* @throws IllegalComponentStateException if the alpha value of the given
* background color is less than {@code 1.0f} and the window is in
* full-screen mode * full-screen mode
* @throws UnsupportedOperationException if the alpha value of the given * @throws UnsupportedOperationException if the alpha value of the given
* background color is less than 1.0f and * background color is less than {@code 1.0f} and {@link
* {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT * GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
* PERPIXEL_TRANSLUCENT} translucency is not supported * PERPIXEL_TRANSLUCENT} translucency is not supported
* *
* @see Window#getBackground * @see Window#getBackground
* @see Window#isOpaque * @see Window#isOpaque
* @see Window#setOpacity(float) * @see Window#setOpacity(float)
* @see Window#setShape(Shape) * @see Window#setShape(Shape)
* @see Frame#isUndecorated
* @see Dialog#isUndecorated
* @see GraphicsDevice.WindowTranslucency * @see GraphicsDevice.WindowTranslucency
* @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency) * @see GraphicsDevice#isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency)
* @see GraphicsConfiguration#isTranslucencyCapable() * @see GraphicsConfiguration#isTranslucencyCapable()
...@@ -3739,7 +3769,7 @@ public class Window extends Container implements Accessible { ...@@ -3739,7 +3769,7 @@ public class Window extends Container implements Accessible {
* <p> * <p>
* The method returns {@code false} if the background color of the window * The method returns {@code false} if the background color of the window
* is not {@code null} and the alpha component of the color is less than * is not {@code null} and the alpha component of the color is less than
* 1.0f. The method returns {@code true} otherwise. * {@code 1.0f}. The method returns {@code true} otherwise.
* *
* @return {@code true} if the window is opaque, {@code false} otherwise * @return {@code true} if the window is opaque, {@code false} otherwise
* *
......
/* /*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -262,7 +262,23 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -262,7 +262,23 @@ public final class NumericShaper implements java.io.Serializable {
/** /**
* The Cham range with the Cham digits. * The Cham range with the Cham digits.
*/ */
CHAM ('\uaa50', '\uaa00', '\uaa60'); CHAM ('\uaa50', '\uaa00', '\uaa60'),
/**
* The Tai Tham Hora range with the Tai Tham Hora digits.
*/
TAI_THAM_HORA ('\u1a80', '\u1a20', '\u1ab0'),
/**
* The Tai Tham Tham range with the Tai Tham Tham digits.
*/
TAI_THAM_THAM ('\u1a90', '\u1a20', '\u1ab0'),
/**
* The Javanese range with the Javanese digits.
*/
JAVANESE ('\ua9d0', '\ua980', '\ua9e0'),
/**
* The Meetei Mayek range with the Meetei Mayek digits.
*/
MEETEI_MAYEK ('\uabf0', '\uabc0', '\uac00');
private static int toRangeIndex(Range script) { private static int toRangeIndex(Range script) {
int index = script.ordinal(); int index = script.ordinal();
...@@ -592,10 +608,16 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -592,10 +608,16 @@ public final class NumericShaper implements java.io.Serializable {
0x07a6, 0x07b1, 0x07a6, 0x07b1,
0x07eb, 0x07f4, 0x07eb, 0x07f4,
0x07f6, 0x07fa, 0x07f6, 0x07fa,
0x0901, 0x0903, 0x0816, 0x081a,
0x081b, 0x0824,
0x0825, 0x0828,
0x0829, 0x0830,
0x0859, 0x085e,
0x0900, 0x0903,
0x093a, 0x093b,
0x093c, 0x093d, 0x093c, 0x093d,
0x0941, 0x0949, 0x0941, 0x0949,
0x094d, 0x0950, 0x094d, 0x094e,
0x0951, 0x0958, 0x0951, 0x0958,
0x0962, 0x0964, 0x0962, 0x0964,
0x0981, 0x0982, 0x0981, 0x0982,
...@@ -604,7 +626,7 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -604,7 +626,7 @@ public final class NumericShaper implements java.io.Serializable {
0x09cd, 0x09ce, 0x09cd, 0x09ce,
0x09e2, 0x09e6, 0x09e2, 0x09e6,
0x09f2, 0x09f4, 0x09f2, 0x09f4,
0x0a01, 0x0a03, 0x09fb, 0x0a03,
0x0a3c, 0x0a3e, 0x0a3c, 0x0a3e,
0x0a41, 0x0a59, 0x0a41, 0x0a59,
0x0a70, 0x0a72, 0x0a70, 0x0a72,
...@@ -630,9 +652,8 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -630,9 +652,8 @@ public final class NumericShaper implements java.io.Serializable {
0x0cbc, 0x0cbd, 0x0cbc, 0x0cbd,
0x0ccc, 0x0cd5, 0x0ccc, 0x0cd5,
0x0ce2, 0x0ce6, 0x0ce2, 0x0ce6,
0x0cf1, 0x0d02,
0x0d41, 0x0d46, 0x0d41, 0x0d46,
0x0d4d, 0x0d57, 0x0d4d, 0x0d4e,
0x0d62, 0x0d66, 0x0d62, 0x0d66,
0x0dca, 0x0dcf, 0x0dca, 0x0dcf,
0x0dd2, 0x0dd8, 0x0dd2, 0x0dd8,
...@@ -649,7 +670,7 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -649,7 +670,7 @@ public final class NumericShaper implements java.io.Serializable {
0x0f71, 0x0f7f, 0x0f71, 0x0f7f,
0x0f80, 0x0f85, 0x0f80, 0x0f85,
0x0f86, 0x0f88, 0x0f86, 0x0f88,
0x0f90, 0x0fbe, 0x0f8d, 0x0fbe,
0x0fc6, 0x0fc7, 0x0fc6, 0x0fc7,
0x102d, 0x1031, 0x102d, 0x1031,
0x1032, 0x1038, 0x1032, 0x1038,
...@@ -661,8 +682,10 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -661,8 +682,10 @@ public final class NumericShaper implements java.io.Serializable {
0x1082, 0x1083, 0x1082, 0x1083,
0x1085, 0x1087, 0x1085, 0x1087,
0x108d, 0x108e, 0x108d, 0x108e,
0x135f, 0x1360, 0x109d, 0x109e,
0x135d, 0x1360,
0x1390, 0x13a0, 0x1390, 0x13a0,
0x1400, 0x1401,
0x1680, 0x1681, 0x1680, 0x1681,
0x169b, 0x16a0, 0x169b, 0x16a0,
0x1712, 0x1720, 0x1712, 0x1720,
...@@ -682,6 +705,11 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -682,6 +705,11 @@ public final class NumericShaper implements java.io.Serializable {
0x1939, 0x1946, 0x1939, 0x1946,
0x19de, 0x1a00, 0x19de, 0x1a00,
0x1a17, 0x1a19, 0x1a17, 0x1a19,
0x1a56, 0x1a57,
0x1a58, 0x1a61,
0x1a62, 0x1a63,
0x1a65, 0x1a6d,
0x1a73, 0x1a80,
0x1b00, 0x1b04, 0x1b00, 0x1b04,
0x1b34, 0x1b35, 0x1b34, 0x1b35,
0x1b36, 0x1b3b, 0x1b36, 0x1b3b,
...@@ -691,8 +719,16 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -691,8 +719,16 @@ public final class NumericShaper implements java.io.Serializable {
0x1b80, 0x1b82, 0x1b80, 0x1b82,
0x1ba2, 0x1ba6, 0x1ba2, 0x1ba6,
0x1ba8, 0x1baa, 0x1ba8, 0x1baa,
0x1be6, 0x1be7,
0x1be8, 0x1bea,
0x1bed, 0x1bee,
0x1bef, 0x1bf2,
0x1c2c, 0x1c34, 0x1c2c, 0x1c34,
0x1c36, 0x1c3b, 0x1c36, 0x1c3b,
0x1cd0, 0x1cd3,
0x1cd4, 0x1ce1,
0x1ce2, 0x1ce9,
0x1ced, 0x1cee,
0x1dc0, 0x1e00, 0x1dc0, 0x1e00,
0x1fbd, 0x1fbe, 0x1fbd, 0x1fbe,
0x1fbf, 0x1fc2, 0x1fbf, 0x1fc2,
...@@ -716,14 +752,16 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -716,14 +752,16 @@ public final class NumericShaper implements java.io.Serializable {
0x213a, 0x213c, 0x213a, 0x213c,
0x2140, 0x2145, 0x2140, 0x2145,
0x214a, 0x214e, 0x214a, 0x214e,
0x2153, 0x2160, 0x2150, 0x2160,
0x2190, 0x2336, 0x2189, 0x2336,
0x237b, 0x2395, 0x237b, 0x2395,
0x2396, 0x249c, 0x2396, 0x249c,
0x24ea, 0x26ac, 0x24ea, 0x26ac,
0x26ad, 0x2800, 0x26ad, 0x2800,
0x2900, 0x2c00, 0x2900, 0x2c00,
0x2ce5, 0x2d00, 0x2ce5, 0x2ceb,
0x2cef, 0x2d00,
0x2d7f, 0x2d80,
0x2de0, 0x3005, 0x2de0, 0x3005,
0x3008, 0x3021, 0x3008, 0x3021,
0x302a, 0x3031, 0x302a, 0x3031,
...@@ -742,25 +780,40 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -742,25 +780,40 @@ public final class NumericShaper implements java.io.Serializable {
0x33de, 0x33e0, 0x33de, 0x33e0,
0x33ff, 0x3400, 0x33ff, 0x3400,
0x4dc0, 0x4e00, 0x4dc0, 0x4e00,
0xa490, 0xa500, 0xa490, 0xa4d0,
0xa60d, 0xa610, 0xa60d, 0xa610,
0xa66f, 0xa680, 0xa66f, 0xa680,
0xa6f0, 0xa6f2,
0xa700, 0xa722, 0xa700, 0xa722,
0xa788, 0xa789, 0xa788, 0xa789,
0xa802, 0xa803, 0xa802, 0xa803,
0xa806, 0xa807, 0xa806, 0xa807,
0xa80b, 0xa80c, 0xa80b, 0xa80c,
0xa825, 0xa827, 0xa825, 0xa827,
0xa828, 0xa840, 0xa828, 0xa830,
0xa838, 0xa840,
0xa874, 0xa880, 0xa874, 0xa880,
0xa8c4, 0xa8ce, 0xa8c4, 0xa8ce,
0xa8e0, 0xa8f2,
0xa926, 0xa92e, 0xa926, 0xa92e,
0xa947, 0xa952, 0xa947, 0xa952,
0xa980, 0xa983,
0xa9b3, 0xa9b4,
0xa9b6, 0xa9ba,
0xa9bc, 0xa9bd,
0xaa29, 0xaa2f, 0xaa29, 0xaa2f,
0xaa31, 0xaa33, 0xaa31, 0xaa33,
0xaa35, 0xaa40, 0xaa35, 0xaa40,
0xaa43, 0xaa44, 0xaa43, 0xaa44,
0xaa4c, 0xaa4d, 0xaa4c, 0xaa4d,
0xaab0, 0xaab1,
0xaab2, 0xaab5,
0xaab7, 0xaab9,
0xaabe, 0xaac0,
0xaac1, 0xaac2,
0xabe5, 0xabe6,
0xabe8, 0xabe9,
0xabed, 0xabf0,
0xfb1e, 0xfb1f, 0xfb1e, 0xfb1f,
0xfb29, 0xfb2a, 0xfb29, 0xfb2a,
0xfd3e, 0xfd50, 0xfd3e, 0xfd50,
...@@ -775,12 +828,28 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -775,12 +828,28 @@ public final class NumericShaper implements java.io.Serializable {
0x1091f, 0x10920, 0x1091f, 0x10920,
0x10a01, 0x10a10, 0x10a01, 0x10a10,
0x10a38, 0x10a40, 0x10a38, 0x10a40,
0x10b39, 0x10b40,
0x10e60, 0x11000,
0x11001, 0x11002,
0x11038, 0x11047,
0x11052, 0x11066,
0x11080, 0x11082,
0x110b3, 0x110b7,
0x110b9, 0x110bb,
0x1d167, 0x1d16a, 0x1d167, 0x1d16a,
0x1d173, 0x1d183, 0x1d173, 0x1d183,
0x1d185, 0x1d18c, 0x1d185, 0x1d18c,
0x1d1aa, 0x1d1ae, 0x1d1aa, 0x1d1ae,
0x1d200, 0x1d360, 0x1d200, 0x1d360,
0x1d7ce, 0x20000, 0x1d6db, 0x1d6dc,
0x1d715, 0x1d716,
0x1d74f, 0x1d750,
0x1d789, 0x1d78a,
0x1d7c3, 0x1d7c4,
0x1d7ce, 0x1f110,
0x1f300, 0x1f48c,
0x1f48d, 0x1f524,
0x1f525, 0x20000,
0xe0001, 0xf0000, 0xe0001, 0xf0000,
0x10fffe, 0x10ffff // sentinel 0x10fffe, 0x10ffff // sentinel
}; };
...@@ -947,6 +1016,14 @@ public final class NumericShaper implements java.io.Serializable { ...@@ -947,6 +1016,14 @@ public final class NumericShaper implements java.io.Serializable {
&& rangeSet.contains(Range.ARABIC)) { && rangeSet.contains(Range.ARABIC)) {
rangeSet.remove(Range.ARABIC); rangeSet.remove(Range.ARABIC);
} }
// As well as the above case, give precedance to TAI_THAM_THAM if both
// TAI_THAM_HORA and TAI_THAM_THAM are specified.
if (rangeSet.contains(Range.TAI_THAM_THAM)
&& rangeSet.contains(Range.TAI_THAM_HORA)) {
rangeSet.remove(Range.TAI_THAM_HORA);
}
rangeArray = rangeSet.toArray(new Range[rangeSet.size()]); rangeArray = rangeSet.toArray(new Range[rangeSet.size()]);
if (rangeArray.length > BSEARCH_THRESHOLD) { if (rangeArray.length > BSEARCH_THRESHOLD) {
// sort rangeArray for binary search // sort rangeArray for binary search
......
...@@ -29,6 +29,8 @@ import com.sun.beans.WeakCache; ...@@ -29,6 +29,8 @@ import com.sun.beans.WeakCache;
import com.sun.beans.finder.BeanInfoFinder; import com.sun.beans.finder.BeanInfoFinder;
import com.sun.beans.finder.ClassFinder; import com.sun.beans.finder.ClassFinder;
import java.awt.Component;
import java.lang.ref.Reference; import java.lang.ref.Reference;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -39,6 +41,7 @@ import java.util.ArrayList; ...@@ -39,6 +41,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.EventListener; import java.util.EventListener;
import java.util.EventObject;
import java.util.List; import java.util.List;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.WeakHashMap; import java.util.WeakHashMap;
...@@ -1234,7 +1237,23 @@ public class Introspector { ...@@ -1234,7 +1237,23 @@ public class Introspector {
} }
} }
// OK, fabricate a default BeanDescriptor. // OK, fabricate a default BeanDescriptor.
return (new BeanDescriptor(beanClass)); return new BeanDescriptor(this.beanClass, findCustomizerClass(this.beanClass));
}
private static Class<?> findCustomizerClass(Class<?> type) {
String name = type.getName() + "Customizer";
try {
type = ClassFinder.findClass(name, type.getClassLoader());
// Each customizer should inherit java.awt.Component and implement java.beans.Customizer
// according to the section 9.3 of JavaBeans specification
if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
return type;
}
}
catch (Exception exception) {
// ignore any exceptions
}
return null;
} }
private boolean isEventHandler(Method m) { private boolean isEventHandler(Method m) {
...@@ -1244,10 +1263,7 @@ public class Introspector { ...@@ -1244,10 +1263,7 @@ public class Introspector {
if (argTypes.length != 1) { if (argTypes.length != 1) {
return false; return false;
} }
if (isSubclass(argTypes[0], java.util.EventObject.class)) { return isSubclass(argTypes[0], EventObject.class);
return true;
}
return false;
} }
/* /*
......
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
package java.util.spi; package java.util.spi;
import java.util.Arrays;
import java.util.Currency; import java.util.Currency;
import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
...@@ -95,6 +97,23 @@ public abstract class CurrencyNameProvider extends LocaleServiceProvider { ...@@ -95,6 +97,23 @@ public abstract class CurrencyNameProvider extends LocaleServiceProvider {
throw new NullPointerException(); throw new NullPointerException();
} }
// Check whether the currencyCode is valid
char[] charray = currencyCode.toCharArray();
if (charray.length != 3) {
throw new IllegalArgumentException("The currencyCode is not in the form of three upper-case letters.");
}
for (char c : charray) {
if (c < 'A' || c > 'Z') {
throw new IllegalArgumentException("The currencyCode is not in the form of three upper-case letters.");
}
}
// Check whether the locale is valid
List<Locale> avail = Arrays.asList(getAvailableLocales());
if (!avail.contains(locale)) {
throw new IllegalArgumentException("The locale is not available");
}
return null; return null;
} }
} }
...@@ -94,7 +94,9 @@ public abstract class LocaleNameProvider extends LocaleServiceProvider { ...@@ -94,7 +94,9 @@ public abstract class LocaleNameProvider extends LocaleServiceProvider {
* @see java.util.Locale#getDisplayScript(java.util.Locale) * @see java.util.Locale#getDisplayScript(java.util.Locale)
* @since 1.7 * @since 1.7
*/ */
public abstract String getDisplayScript(String scriptCode, Locale locale); public String getDisplayScript(String scriptCode, Locale locale) {
return null;
}
/** /**
* Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt"> * Returns a localized name for the given <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
......
...@@ -1379,6 +1379,10 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl ...@@ -1379,6 +1379,10 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
* If <code>true</code> and the button has a border, * If <code>true</code> and the button has a border,
* the border is painted. The default value for the * the border is painted. The default value for the
* <code>borderPainted</code> property is <code>true</code>. * <code>borderPainted</code> property is <code>true</code>.
* <p/>
* Some look and feels might not support
* the <code>borderPainted</code> property,
* in which case they ignore this.
* *
* @param b if true and border property is not <code>null</code>, * @param b if true and border property is not <code>null</code>,
* the border is painted * the border is painted
......
...@@ -273,7 +273,7 @@ public class BorderFactory ...@@ -273,7 +273,7 @@ public class BorderFactory
* @since 1.7 * @since 1.7
*/ */
public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) { public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) {
return new BevelBorder(type, highlight, shadow); return new SoftBevelBorder(type, highlight, shadow);
} }
/** /**
...@@ -295,7 +295,7 @@ public class BorderFactory ...@@ -295,7 +295,7 @@ public class BorderFactory
* @since 1.7 * @since 1.7
*/ */
public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) { public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) {
return new BevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner); return new SoftBevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner);
} }
//// EtchedBorder /////////////////////////////////////////////////////////// //// EtchedBorder ///////////////////////////////////////////////////////////
......
...@@ -322,7 +322,7 @@ public final class JLayer<V extends Component> ...@@ -322,7 +322,7 @@ public final class JLayer<V extends Component>
} }
/** /**
* A non-{@code null] border, or non-zero insets, isn't supported, to prevent the geometry * A non-{@code null} border, or non-zero insets, isn't supported, to prevent the geometry
* of this component from becoming complex enough to inhibit * of this component from becoming complex enough to inhibit
* subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border, * subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border,
* add it to a {@code JPanel} that has a border. * add it to a {@code JPanel} that has a border.
...@@ -373,8 +373,12 @@ public final class JLayer<V extends Component> ...@@ -373,8 +373,12 @@ public final class JLayer<V extends Component>
* {@inheritDoc} * {@inheritDoc}
*/ */
public void removeAll() { public void removeAll() {
setView(null); if (view != null) {
setGlassPane(null); setView(null);
}
if (glassPane != null) {
setGlassPane(null);
}
} }
/** /**
......
...@@ -1443,6 +1443,10 @@ public class JTabbedPane extends JComponent ...@@ -1443,6 +1443,10 @@ public class JTabbedPane extends JComponent
* which can be <code>null</code>, in which case the tab's background color * which can be <code>null</code>, in which case the tab's background color
* will default to the background color of the <code>tabbedpane</code>. * will default to the background color of the <code>tabbedpane</code>.
* An internal exception is raised if there is no tab at that index. * An internal exception is raised if there is no tab at that index.
* <p/>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
*
* @param index the tab index where the background should be set * @param index the tab index where the background should be set
* @param background the color to be displayed in the tab's background * @param background the color to be displayed in the tab's background
* @exception IndexOutOfBoundsException if index is out of range * @exception IndexOutOfBoundsException if index is out of range
...@@ -1472,6 +1476,9 @@ public class JTabbedPane extends JComponent ...@@ -1472,6 +1476,9 @@ public class JTabbedPane extends JComponent
* <code>null</code>, in which case the tab's foreground color * <code>null</code>, in which case the tab's foreground color
* will default to the foreground color of this <code>tabbedpane</code>. * will default to the foreground color of this <code>tabbedpane</code>.
* An internal exception is raised if there is no tab at that index. * An internal exception is raised if there is no tab at that index.
* <p/>
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
* *
* @param index the tab index where the foreground should be set * @param index the tab index where the foreground should be set
* @param foreground the color to be displayed as the tab's foreground * @param foreground the color to be displayed as the tab's foreground
......
...@@ -165,11 +165,11 @@ public class TitledBorder extends AbstractBorder ...@@ -165,11 +165,11 @@ public class TitledBorder extends AbstractBorder
* @param titlePosition the position for the title * @param titlePosition the position for the title
*/ */
public TitledBorder(Border border, public TitledBorder(Border border,
String title, String title,
int titleJustification, int titleJustification,
int titlePosition) { int titlePosition) {
this(border, title, titleJustification, this(border, title, titleJustification,
titlePosition, null, null); titlePosition, null, null);
} }
/** /**
...@@ -183,12 +183,12 @@ public class TitledBorder extends AbstractBorder ...@@ -183,12 +183,12 @@ public class TitledBorder extends AbstractBorder
* @param titleFont the font for rendering the title * @param titleFont the font for rendering the title
*/ */
public TitledBorder(Border border, public TitledBorder(Border border,
String title, String title,
int titleJustification, int titleJustification,
int titlePosition, int titlePosition,
Font titleFont) { Font titleFont) {
this(border, title, titleJustification, this(border, title, titleJustification,
titlePosition, titleFont, null); titlePosition, titleFont, null);
} }
/** /**
...@@ -205,11 +205,11 @@ public class TitledBorder extends AbstractBorder ...@@ -205,11 +205,11 @@ public class TitledBorder extends AbstractBorder
*/ */
@ConstructorProperties({"border", "title", "titleJustification", "titlePosition", "titleFont", "titleColor"}) @ConstructorProperties({"border", "title", "titleJustification", "titlePosition", "titleFont", "titleColor"})
public TitledBorder(Border border, public TitledBorder(Border border,
String title, String title,
int titleJustification, int titleJustification,
int titlePosition, int titlePosition,
Font titleFont, Font titleFont,
Color titleColor) { Color titleColor) {
this.title = title; this.title = title;
this.border = border; this.border = border;
this.titleFont = titleFont; this.titleFont = titleFont;
...@@ -234,7 +234,7 @@ public class TitledBorder extends AbstractBorder ...@@ -234,7 +234,7 @@ public class TitledBorder extends AbstractBorder
* @param height the height of the painted border * @param height the height of the painted border
*/ */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Border border = getBorderUI(); Border border = getBorder();
String title = getTitle(); String title = getTitle();
if ((title != null) && !title.isEmpty()) { if ((title != null) && !title.isEmpty()) {
int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
...@@ -347,7 +347,7 @@ public class TitledBorder extends AbstractBorder ...@@ -347,7 +347,7 @@ public class TitledBorder extends AbstractBorder
* @param insets the object to be reinitialized * @param insets the object to be reinitialized
*/ */
public Insets getBorderInsets(Component c, Insets insets) { public Insets getBorderInsets(Component c, Insets insets) {
Border border = getBorderUI(); Border border = getBorder();
if (border == null) { if (border == null) {
insets.set(0, 0, 0, 0); insets.set(0, 0, 0, 0);
} }
...@@ -402,22 +402,34 @@ public class TitledBorder extends AbstractBorder ...@@ -402,22 +402,34 @@ public class TitledBorder extends AbstractBorder
/** /**
* Returns whether or not the border is opaque. * Returns whether or not the border is opaque.
*/ */
public boolean isBorderOpaque() { return false; } public boolean isBorderOpaque() {
return false;
}
/** /**
* Returns the title of the titled border. * Returns the title of the titled border.
*
* @return the title of the titled border
*/ */
public String getTitle() { return title; } public String getTitle() {
return title;
}
/** /**
* Returns the border of the titled border. * Returns the border of the titled border.
*
* @return the border of the titled border
*/ */
public Border getBorder() { public Border getBorder() {
return border; return border != null
? border
: UIManager.getBorder("TitledBorder.border");
} }
/** /**
* Returns the title-position of the titled border. * Returns the title-position of the titled border.
*
* @return the title-position of the titled border
*/ */
public int getTitlePosition() { public int getTitlePosition() {
return titlePosition; return titlePosition;
...@@ -425,20 +437,28 @@ public class TitledBorder extends AbstractBorder ...@@ -425,20 +437,28 @@ public class TitledBorder extends AbstractBorder
/** /**
* Returns the title-justification of the titled border. * Returns the title-justification of the titled border.
*
* @return the title-justification of the titled border
*/ */
public int getTitleJustification() { return titleJustification; } public int getTitleJustification() {
return titleJustification;
}
/** /**
* Returns the title-font of the titled border. * Returns the title-font of the titled border.
*
* @return the title-font of the titled border
*/ */
public Font getTitleFont() { public Font getTitleFont() {
return titleFont; return titleFont;
} }
/** /**
* Returns the title-color of the titled border. * Returns the title-color of the titled border.
*
* @return the title-color of the titled border
*/ */
public Color getTitleColor() { public Color getTitleColor() {
return titleColor; return titleColor;
} }
...@@ -447,15 +467,19 @@ public class TitledBorder extends AbstractBorder ...@@ -447,15 +467,19 @@ public class TitledBorder extends AbstractBorder
/** /**
* Sets the title of the titled border. * Sets the title of the titled border.
* param title the title for the border * @param title the title for the border
*/ */
public void setTitle(String title) { this.title = title; } public void setTitle(String title) {
this.title = title;
}
/** /**
* Sets the border of the titled border. * Sets the border of the titled border.
* @param border the border * @param border the border
*/ */
public void setBorder(Border border) { this.border = border; } public void setBorder(Border border) {
this.border = border;
}
/** /**
* Sets the title-position of the titled border. * Sets the title-position of the titled border.
...@@ -482,19 +506,19 @@ public class TitledBorder extends AbstractBorder ...@@ -482,19 +506,19 @@ public class TitledBorder extends AbstractBorder
* Sets the title-justification of the titled border. * Sets the title-justification of the titled border.
* @param titleJustification the justification for the border * @param titleJustification the justification for the border
*/ */
public void setTitleJustification(int titleJustification) { public void setTitleJustification(int titleJustification) {
switch (titleJustification) { switch (titleJustification) {
case DEFAULT_JUSTIFICATION: case DEFAULT_JUSTIFICATION:
case LEFT: case LEFT:
case CENTER: case CENTER:
case RIGHT: case RIGHT:
case LEADING: case LEADING:
case TRAILING: case TRAILING:
this.titleJustification = titleJustification; this.titleJustification = titleJustification;
break; break;
default: default:
throw new IllegalArgumentException(titleJustification + throw new IllegalArgumentException(titleJustification +
" is not a valid title justification."); " is not a valid title justification.");
} }
} }
...@@ -518,6 +542,7 @@ public class TitledBorder extends AbstractBorder ...@@ -518,6 +542,7 @@ public class TitledBorder extends AbstractBorder
* Returns the minimum dimensions this border requires * Returns the minimum dimensions this border requires
* in order to fully display the border and title. * in order to fully display the border and title.
* @param c the component where this border will be drawn * @param c the component where this border will be drawn
* @return the {@code Dimension} object
*/ */
public Dimension getMinimumSize(Component c) { public Dimension getMinimumSize(Component c) {
Insets insets = getBorderInsets(c); Insets insets = getBorderInsets(c);
...@@ -557,7 +582,7 @@ public class TitledBorder extends AbstractBorder ...@@ -557,7 +582,7 @@ public class TitledBorder extends AbstractBorder
if (height < 0) { if (height < 0) {
throw new IllegalArgumentException("Height must be >= 0"); throw new IllegalArgumentException("Height must be >= 0");
} }
Border border = getBorderUI(); Border border = getBorder();
String title = getTitle(); String title = getTitle();
if ((title != null) && !title.isEmpty()) { if ((title != null) && !title.isEmpty()) {
int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
...@@ -616,13 +641,6 @@ public class TitledBorder extends AbstractBorder ...@@ -616,13 +641,6 @@ public class TitledBorder extends AbstractBorder
return Component.BaselineResizeBehavior.OTHER; return Component.BaselineResizeBehavior.OTHER;
} }
private Border getBorderUI() {
Border border = getBorder();
return border != null
? border
: UIManager.getBorder("TitledBorder.border");
}
private int getPosition() { private int getPosition() {
int position = getTitlePosition(); int position = getTitlePosition();
if (position != DEFAULT_POSITION) { if (position != DEFAULT_POSITION) {
......
...@@ -449,8 +449,8 @@ public class LayerUI<V extends Component> ...@@ -449,8 +449,8 @@ public class LayerUI<V extends Component>
/** /**
* Configures the {@code JLayer} this {@code LayerUI} is set to. * Configures the {@code JLayer} this {@code LayerUI} is set to.
* The default implementation registers the {@code LayerUI} * The default implementation registers the passed {@code JLayer} component
* as a property change listener for the passed {@code JLayer} component. * as a {@code PropertyChangeListener} for the property changes of this {@code LayerUI}.
* *
* @param c the {@code JLayer} component where this UI delegate is being installed * @param c the {@code JLayer} component where this UI delegate is being installed
*/ */
...@@ -461,8 +461,8 @@ public class LayerUI<V extends Component> ...@@ -461,8 +461,8 @@ public class LayerUI<V extends Component>
/** /**
* Reverses the configuration which was previously set * Reverses the configuration which was previously set
* in the {@link #installUI(JComponent)} method. * in the {@link #installUI(JComponent)} method.
* The default implementation unregisters the property change listener * The default implementation unregisters the passed {@code JLayer} component
* for the passed JLayer component. * as a {@code PropertyChangeListener} for the property changes of this {@code LayerUI}.
* *
* @param c the component from which this UI delegate is being removed. * @param c the component from which this UI delegate is being removed.
*/ */
......
...@@ -196,6 +196,10 @@ public class BasicMenuUI extends BasicMenuItemUI ...@@ -196,6 +196,10 @@ public class BasicMenuUI extends BasicMenuItemUI
return getHandler(); return getHandler();
} }
protected MenuKeyListener createMenuKeyListener(JComponent c) {
return (MenuKeyListener)getHandler();
}
public Dimension getMaximumSize(JComponent c) { public Dimension getMaximumSize(JComponent c) {
if (((JMenu)menuItem).isTopLevelMenu() == true) { if (((JMenu)menuItem).isTopLevelMenu() == true) {
Dimension d = c.getPreferredSize(); Dimension d = c.getPreferredSize();
...@@ -397,7 +401,7 @@ public class BasicMenuUI extends BasicMenuItemUI ...@@ -397,7 +401,7 @@ public class BasicMenuUI extends BasicMenuItemUI
public void stateChanged(ChangeEvent e) { } public void stateChanged(ChangeEvent e) { }
} }
private class Handler extends BasicMenuItemUI.Handler { private class Handler extends BasicMenuItemUI.Handler implements MenuKeyListener {
// //
// PropertyChangeListener // PropertyChangeListener
// //
...@@ -580,5 +584,48 @@ public class BasicMenuUI extends BasicMenuItemUI ...@@ -580,5 +584,48 @@ public class BasicMenuUI extends BasicMenuItemUI
} }
public void menuDragMouseExited(MenuDragMouseEvent e) {} public void menuDragMouseExited(MenuDragMouseEvent e) {}
public void menuDragMouseReleased(MenuDragMouseEvent e) {} public void menuDragMouseReleased(MenuDragMouseEvent e) {}
//
// MenuKeyListener
//
/**
* Open the Menu
*/
public void menuKeyTyped(MenuKeyEvent e) {
if (!crossMenuMnemonic && BasicPopupMenuUI.getLastPopup() != null) {
// when crossMenuMnemonic is not set, we don't open a toplevel
// menu if another toplevel menu is already open
return;
}
if (BasicPopupMenuUI.getPopups().size() != 0) {
//Fix 6939261: to return in case not on the main menu
//and has a pop-up.
//after return code will be handled in BasicPopupMenuUI.java
return;
}
char key = Character.toLowerCase((char)menuItem.getMnemonic());
MenuElement path[] = e.getPath();
if (key == Character.toLowerCase(e.getKeyChar())) {
JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu();
ArrayList newList = new ArrayList(Arrays.asList(path));
newList.add(popupMenu);
MenuElement subs[] = popupMenu.getSubElements();
MenuElement sub =
BasicPopupMenuUI.findEnabledChild(subs, -1, true);
if(sub != null) {
newList.add(sub);
}
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement newPath[] = new MenuElement[0];;
newPath = (MenuElement[]) newList.toArray(newPath);
manager.setSelectedPath(newPath);
e.consume();
}
}
public void menuKeyPressed(MenuKeyEvent e) {}
public void menuKeyReleased(MenuKeyEvent e) {}
} }
} }
...@@ -81,17 +81,26 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI ...@@ -81,17 +81,26 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI
} }
} }
public void installListeners(JScrollPane scrollPane) { public void installListeners(JScrollPane scrollPane) {
super.installListeners(scrollPane); super.installListeners(scrollPane);
scrollBarSwapListener = createScrollBarSwapListener(); scrollBarSwapListener = createScrollBarSwapListener();
scrollPane.addPropertyChangeListener(scrollBarSwapListener); scrollPane.addPropertyChangeListener(scrollBarSwapListener);
} }
/**
* {@inheritDoc}
*/
protected void uninstallListeners(JComponent c) {
super.uninstallListeners(c);
c.removePropertyChangeListener(scrollBarSwapListener);
}
/**
* @deprecated - Replaced by {@link #uninstallListeners(JComponent)}
*/
@Deprecated
public void uninstallListeners(JScrollPane scrollPane) { public void uninstallListeners(JScrollPane scrollPane) {
super.uninstallListeners(scrollPane); super.uninstallListeners(scrollPane);
scrollPane.removePropertyChangeListener(scrollBarSwapListener); scrollPane.removePropertyChangeListener(scrollBarSwapListener);
} }
......
...@@ -223,6 +223,16 @@ public final class AWTAccessor { ...@@ -223,6 +223,16 @@ public final class AWTAccessor {
void processEvent(Component comp, AWTEvent e); void processEvent(Component comp, AWTEvent e);
} }
/*
* An interface of accessor for the java.awt.Container class.
*/
public interface ContainerAccessor {
/**
* Validates the container unconditionally.
*/
void validateUnconditionally(Container cont);
}
/* /*
* An interface of accessor for java.awt.Window class. * An interface of accessor for java.awt.Window class.
*/ */
...@@ -334,6 +344,10 @@ public final class AWTAccessor { ...@@ -334,6 +344,10 @@ public final class AWTAccessor {
* Gets the state of this frame. * Gets the state of this frame.
*/ */
int getExtendedState(Frame frame); int getExtendedState(Frame frame);
/*
* Gets the maximized bounds of this frame.
*/
Rectangle getMaximizedBounds(Frame frame);
} }
/* /*
...@@ -440,53 +454,19 @@ public final class AWTAccessor { ...@@ -440,53 +454,19 @@ public final class AWTAccessor {
} }
/* /*
* The java.awt.Component class accessor object. * Accessor instances are initialized in the static initializers of
* corresponding AWT classes by using setters defined below.
*/ */
private static ComponentAccessor componentAccessor; private static ComponentAccessor componentAccessor;
private static ContainerAccessor containerAccessor;
/*
* The java.awt.Window class accessor object.
*/
private static WindowAccessor windowAccessor; private static WindowAccessor windowAccessor;
/*
* The java.awt.AWTEvent class accessor object.
*/
private static AWTEventAccessor awtEventAccessor; private static AWTEventAccessor awtEventAccessor;
/*
* The java.awt.event.InputEvent class accessor object.
*/
private static InputEventAccessor inputEventAccessor; private static InputEventAccessor inputEventAccessor;
/*
* The java.awt.Frame class accessor object.
*/
private static FrameAccessor frameAccessor; private static FrameAccessor frameAccessor;
/*
* The java.awt.KeyboardFocusManager class accessor object.
*/
private static KeyboardFocusManagerAccessor kfmAccessor; private static KeyboardFocusManagerAccessor kfmAccessor;
/*
* The java.awt.MenuComponent class accessor object.
*/
private static MenuComponentAccessor menuComponentAccessor; private static MenuComponentAccessor menuComponentAccessor;
/*
* The java.awt.EventQueue class accessor object.
*/
private static EventQueueAccessor eventQueueAccessor; private static EventQueueAccessor eventQueueAccessor;
/*
* The java.awt.PopupMenu class accessor object.
*/
private static PopupMenuAccessor popupMenuAccessor; private static PopupMenuAccessor popupMenuAccessor;
/*
* The java.awt.FileDialog class accessor object.
*/
private static FileDialogAccessor fileDialogAccessor; private static FileDialogAccessor fileDialogAccessor;
/* /*
...@@ -497,7 +477,7 @@ public final class AWTAccessor { ...@@ -497,7 +477,7 @@ public final class AWTAccessor {
} }
/* /*
* Retrieve the accessor object for the java.awt.Window class. * Retrieve the accessor object for the java.awt.Component class.
*/ */
public static ComponentAccessor getComponentAccessor() { public static ComponentAccessor getComponentAccessor() {
if (componentAccessor == null) { if (componentAccessor == null) {
...@@ -507,6 +487,24 @@ public final class AWTAccessor { ...@@ -507,6 +487,24 @@ public final class AWTAccessor {
return componentAccessor; return componentAccessor;
} }
/*
* Set an accessor object for the java.awt.Container class.
*/
public static void setContainerAccessor(ContainerAccessor ca) {
containerAccessor = ca;
}
/*
* Retrieve the accessor object for the java.awt.Container class.
*/
public static ContainerAccessor getContainerAccessor() {
if (containerAccessor == null) {
unsafe.ensureClassInitialized(Container.class);
}
return containerAccessor;
}
/* /*
* Set an accessor object for the java.awt.Window class. * Set an accessor object for the java.awt.Window class.
*/ */
......
/* /*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1472,19 +1472,9 @@ public final class NormalizerImpl { ...@@ -1472,19 +1472,9 @@ public final class NormalizerImpl {
} }
--remove; --remove;
} }
} else if(value2!=0) { } else if(value2!=0) { // for U+1109A, U+1109C, and U+110AB
/* the composition is longer than the starter,
* move the intermediate characters back one */
starterIsSupplementary=true; starterIsSupplementary=true;
/* temporarily increment for the loop boundary */ args.source[starter+1]=(char)value2;
++starter;
q=remove;
r=++remove;
while(starter<q) {
args.source[--r]=args.source[--q];
}
args.source[starter]=(char)value2;
--starter; /* undo the temporary increment */
/* } else { both are on the BMP, nothing more to do */ /* } else { both are on the BMP, nothing more to do */
} }
......
<title>Nervous Text 1.1</title> <title>Nervous Text 1.1</title>
<hr> <hr>
<applet code="NervousText.class" width=534 height=50> <applet code="NervousText.class" width=534 height=50>
<param name=text value="Java^T^M 2 SDK, Standard Edition 6.0"> <param name=text value="Java SE Development Kit (JDK) 7.0">
</applet> </applet>
<hr> <hr>
<a href="NervousText.java">The source.</a> <a href="NervousText.java">The source.</a>
...@@ -75,7 +75,8 @@ public class J2DBench { ...@@ -75,7 +75,8 @@ public class J2DBench {
static JFrame guiFrame; static JFrame guiFrame;
static final SimpleDateFormat sdf = new SimpleDateFormat("MM.dd.yyyy 'at' HH:mm aaa z"); static final SimpleDateFormat sdf =
new SimpleDateFormat("MM.dd.yyyy 'at' HH:mm aaa z");
public static void init() { public static void init() {
progoptroot = new Group("prog", "Program Options"); progoptroot = new Group("prog", "Program Options");
...@@ -176,6 +177,8 @@ public class J2DBench { ...@@ -176,6 +177,8 @@ public class J2DBench {
public static void main(String argv[]) { public static void main(String argv[]) {
init(); init();
TestEnvironment.init(); TestEnvironment.init();
Result.init();
Destinations.init(); Destinations.init();
GraphicsTests.init(); GraphicsTests.init();
RenderTests.init(); RenderTests.init();
...@@ -323,7 +326,7 @@ public class J2DBench { ...@@ -323,7 +326,7 @@ public class J2DBench {
} else if (type.equalsIgnoreCase("m")) { } else if (type.equalsIgnoreCase("m")) {
multiplyWith = 60; multiplyWith = 60;
} else { } else {
System.out.println("Invalid \"-loop\" option specified."); System.err.println("Invalid \"-loop\" option specified.");
usage(1); usage(1);
} }
...@@ -331,32 +334,20 @@ public class J2DBench { ...@@ -331,32 +334,20 @@ public class J2DBench {
try { try {
val = Integer.parseInt(argv[i].substring(0, argv[i].length() - 1)); val = Integer.parseInt(argv[i].substring(0, argv[i].length() - 1));
} catch(Exception e) { } catch(Exception e) {
System.out.println("Invalid \"-loop\" option specified."); System.err.println("Invalid \"-loop\" option specified.");
usage(1); usage(1);
} }
requiredLoopTime = val * multiplyWith * 1000; requiredLoopTime = val * multiplyWith * 1000;
} }
} else if (arg.length() > 7 && } else if (arg.length() > 8 &&
arg.substring(0, 7).equalsIgnoreCase("-report")) arg.substring(0, 8).equalsIgnoreCase("-report:"))
{ {
for (int j = 7; j < arg.length(); j++) { String error = Result.parseRateOpt(arg.substring(8));
char c = arg.charAt(j); if (error != null) {
switch (c) { System.err.println("Invalid rate: "+error);
case 'N': Result.unitScale = Result.UNITS_WHOLE; break; usage(1);
case 'M': Result.unitScale = Result.UNITS_MILLIONS; break;
case 'K': Result.unitScale = Result.UNITS_THOUSANDS; break;
case 'A': Result.unitScale = Result.UNITS_AUTO; break;
case 'U': Result.useUnits = true; break;
case 'O': Result.useUnits = false; break;
case 's': Result.timeScale = Result.SECONDS_WHOLE; break;
case 'm': Result.timeScale = Result.SECONDS_MILLIS; break;
case 'u': Result.timeScale = Result.SECONDS_MICROS; break;
case 'n': Result.timeScale = Result.SECONDS_NANOS; break;
case 'a': Result.timeScale = Result.SECONDS_AUTO; break;
case '/': Result.invertRate = !Result.invertRate; break;
}
} }
} else { } else {
String reason = Group.root.setOption(arg); String reason = Group.root.setOption(arg);
...@@ -411,7 +402,7 @@ public class J2DBench { ...@@ -411,7 +402,7 @@ public class J2DBench {
writer.flush(); writer.flush();
} catch(IOException ioe) { } catch(IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
System.out.println("\nERROR : Could not create Loop-Report. Exit"); System.err.println("\nERROR : Could not create Loop-Report. Exit");
System.exit(1); System.exit(1);
} }
} }
...@@ -466,7 +457,7 @@ public class J2DBench { ...@@ -466,7 +457,7 @@ public class J2DBench {
} while(J2DBench.looping); } while(J2DBench.looping);
if(J2DBench.looping) { if (J2DBench.looping) {
writer.println("</html>"); writer.println("</html>");
writer.flush(); writer.flush();
writer.close(); writer.close();
......
...@@ -170,7 +170,7 @@ public abstract class Option extends Node implements Modifier { ...@@ -170,7 +170,7 @@ public abstract class Option extends Node implements Modifier {
updateGUI(); updateGUI();
jcb.addItemListener(new ItemListener() { jcb.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == e.SELECTED) { if (e.getStateChange() == ItemEvent.SELECTED) {
JComboBox jcb = (JComboBox) e.getItemSelectable(); JComboBox jcb = (JComboBox) e.getItemSelectable();
value = jcb.getSelectedIndex(); value = jcb.getSelectedIndex();
if (J2DBench.verbose.isEnabled()) { if (J2DBench.verbose.isEnabled()) {
...@@ -261,7 +261,7 @@ public abstract class Option extends Node implements Modifier { ...@@ -261,7 +261,7 @@ public abstract class Option extends Node implements Modifier {
updateGUI(); updateGUI();
jcb.addItemListener(new ItemListener() { jcb.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
value = (e.getStateChange() == e.SELECTED); value = (e.getStateChange() == ItemEvent.SELECTED);
if (J2DBench.verbose.isEnabled()) { if (J2DBench.verbose.isEnabled()) {
System.out.println(getOptionString()); System.out.println(getOptionString());
} }
...@@ -569,8 +569,6 @@ public abstract class Option extends Node implements Modifier { ...@@ -569,8 +569,6 @@ public abstract class Option extends Node implements Modifier {
} }
public String setValueFromString(String value) { public String setValueFromString(String value) {
int prev = 0;
int next = 0;
int enabled = 0; int enabled = 0;
StringTokenizer st = new StringTokenizer(value, ","); StringTokenizer st = new StringTokenizer(value, ",");
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
...@@ -588,7 +586,6 @@ public abstract class Option extends Node implements Modifier { ...@@ -588,7 +586,6 @@ public abstract class Option extends Node implements Modifier {
if (s != null) { if (s != null) {
return "Bad value in list ("+s+")"; return "Bad value in list ("+s+")";
} }
prev = next+1;
} }
this.enabled = enabled; this.enabled = enabled;
updateGUI(); updateGUI();
...@@ -623,6 +620,175 @@ public abstract class Option extends Node implements Modifier { ...@@ -623,6 +620,175 @@ public abstract class Option extends Node implements Modifier {
} }
} }
public static class ObjectChoice extends Option {
int size;
String optionnames[];
Object optionvalues[];
String abbrevnames[];
String descnames[];
int defaultselected;
int selected;
JPanel jp;
JComboBox jcombo;
public ObjectChoice(Group parent, String nodeName, String description,
String optionnames[],
Object optionvalues[],
String abbrevnames[],
String descnames[],
int defaultselected)
{
this(parent, nodeName, description,
Math.min(Math.min(optionnames.length,
optionvalues.length),
Math.min(abbrevnames.length,
descnames.length)),
optionnames, optionvalues,
abbrevnames, descnames, defaultselected);
}
public ObjectChoice(Group parent, String nodeName, String description,
int size,
String optionnames[],
Object optionvalues[],
String abbrevnames[],
String descnames[],
int defaultselected)
{
super(parent, nodeName, description);
this.size = size;
this.optionnames = trim(optionnames, size);
this.optionvalues = trim(optionvalues, size);
this.abbrevnames = trim(abbrevnames, size);
this.descnames = trim(descnames, size);
this.selected = this.defaultselected = defaultselected;
}
private static String[] trim(String list[], int size) {
if (list.length == size) {
return list;
}
String newlist[] = new String[size];
System.arraycopy(list, 0, newlist, 0, size);
return newlist;
}
private static Object[] trim(Object list[], int size) {
if (list.length == size) {
return list;
}
Object newlist[] = new Object[size];
System.arraycopy(list, 0, newlist, 0, size);
return newlist;
}
public void restoreDefault() {
if (selected != defaultselected) {
selected = defaultselected;
updateGUI();
}
}
public void updateGUI() {
if (jcombo != null) {
jcombo.setSelectedIndex(this.selected);
}
}
public boolean isDefault() {
return (selected == defaultselected);
}
public Modifier.Iterator getIterator(TestEnvironment env) {
return new SwitchIterator(optionvalues, 1 << selected);
}
public JComponent getJComponent() {
if (jp == null) {
jp = new JPanel();
jp.setLayout(new BorderLayout());
jp.add(new JLabel(getDescription()), BorderLayout.WEST);
jcombo = new JComboBox(descnames);
updateGUI();
jcombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
selected = jcombo.getSelectedIndex();
if (J2DBench.verbose.isEnabled()) {
System.out.println(getOptionString());
}
}
}
});
jp.add(jcombo, BorderLayout.EAST);
}
return jp;
}
public Object getValue() {
return optionvalues[selected];
}
public int getIntValue() {
return ((Integer) optionvalues[selected]).intValue();
}
public boolean getBooleanValue() {
return ((Boolean) optionvalues[selected]).booleanValue();
}
public String getValString() {
return optionnames[selected];
}
int findValueIndex(Object value) {
for (int i = 0; i < size; i++) {
if (optionvalues[i] == value) {
return i;
}
}
return -1;
}
public String getValString(Object value) {
return optionnames[findValueIndex(value)];
}
public String getAbbreviatedModifierDescription(Object value) {
return abbrevnames[findValueIndex(value)];
}
public String setValue(int v) {
return setValue(new Integer(v));
}
public String setValue(boolean v) {
return setValue(new Boolean(v));
}
public String setValue(Object value) {
for (int i = 0; i < size; i++) {
if (optionvalues[i].equals(value)) {
this.selected = i;
updateGUI();
return null;
}
}
return "Bad value";
}
public String setValueFromString(String value) {
for (int i = 0; i < size; i++) {
if (optionnames[i].equals(value)) {
this.selected = i;
updateGUI();
return null;
}
}
return "Bad value";
}
}
public static class BooleanIterator implements Modifier.Iterator { public static class BooleanIterator implements Modifier.Iterator {
private Boolean list[]; private Boolean list[];
private int index; private int index;
......
...@@ -35,23 +35,199 @@ import java.util.Vector; ...@@ -35,23 +35,199 @@ import java.util.Vector;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Enumeration; import java.util.Enumeration;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.HashMap;
public class Result { public class Result {
public static final int UNITS_WHOLE = 0; public static final int RATE_UNKNOWN = 0;
public static final int UNITS_THOUSANDS = 1;
public static final int UNITS_MILLIONS = 2; public static final int WORK_OPS = 1;
public static final int UNITS_AUTO = 3; public static final int WORK_UNITS = 2;
public static final int WORK_THOUSANDS = 4;
public static final int SECONDS_WHOLE = 0; public static final int WORK_MILLIONS = 6;
public static final int SECONDS_MILLIS = 1; public static final int WORK_AUTO = 8;
public static final int SECONDS_MICROS = 2;
public static final int SECONDS_NANOS = 3; public static final int TIME_SECONDS = 10;
public static final int SECONDS_AUTO = 4; public static final int TIME_MILLIS = 11;
public static final int TIME_MICROS = 12;
public static int unitScale = UNITS_WHOLE; public static final int TIME_NANOS = 13;
public static int timeScale = SECONDS_WHOLE; public static final int TIME_AUTO = 14;
public static boolean useUnits = true;
public static boolean invertRate = false; static Group resultoptroot;
static Option.ObjectChoice timeOpt;
static Option.ObjectChoice workOpt;
static Option.ObjectChoice rateOpt;
public static void init() {
resultoptroot = new Group(TestEnvironment.globaloptroot,
"results", "Result Options");
String workStrings[] = {
"units",
"kilounits",
"megaunits",
"autounits",
"ops",
"kiloops",
"megaops",
"autoops",
};
String workDescriptions[] = {
"Test Units",
"Thousands of Test Units",
"Millions of Test Units",
"Auto-scaled Test Units",
"Operations",
"Thousands of Operations",
"Millions of Operations",
"Auto-scaled Operations",
};
Integer workObjects[] = {
new Integer(WORK_UNITS),
new Integer(WORK_THOUSANDS),
new Integer(WORK_MILLIONS),
new Integer(WORK_AUTO),
new Integer(WORK_OPS | WORK_UNITS),
new Integer(WORK_OPS | WORK_THOUSANDS),
new Integer(WORK_OPS | WORK_MILLIONS),
new Integer(WORK_OPS | WORK_AUTO),
};
workOpt = new Option.ObjectChoice(resultoptroot,
"workunits", "Work Units",
workStrings, workObjects,
workStrings, workDescriptions,
0);
String timeStrings[] = {
"sec",
"msec",
"usec",
"nsec",
"autosec",
};
String timeDescriptions[] = {
"Seconds",
"Milliseconds",
"Microseconds",
"Nanoseconds",
"Auto-scaled seconds",
};
Integer timeObjects[] = {
new Integer(TIME_SECONDS),
new Integer(TIME_MILLIS),
new Integer(TIME_MICROS),
new Integer(TIME_NANOS),
new Integer(TIME_AUTO),
};
timeOpt = new Option.ObjectChoice(resultoptroot,
"timeunits", "Time Units",
timeStrings, timeObjects,
timeStrings, timeDescriptions,
0);
String rateStrings[] = {
"unitspersec",
"secsperunit",
};
String rateDescriptions[] = {
"Work units per Time",
"Time units per Work",
};
Boolean rateObjects[] = {
Boolean.FALSE,
Boolean.TRUE,
};
rateOpt = new Option.ObjectChoice(resultoptroot,
"ratio", "Rate Ratio",
rateStrings, rateObjects,
rateStrings, rateDescriptions,
0);
}
public static boolean isTimeUnit(int unit) {
return (unit >= TIME_SECONDS && unit <= TIME_AUTO);
}
public static boolean isWorkUnit(int unit) {
return (unit >= WORK_OPS && unit <= (WORK_AUTO | WORK_OPS));
}
public static String parseRateOpt(String opt) {
int timeScale = timeOpt.getIntValue();
int workScale = workOpt.getIntValue();
boolean invertRate = rateOpt.getBooleanValue();
int divindex = opt.indexOf('/');
if (divindex < 0) {
int unit = parseUnit(opt);
if (isTimeUnit(unit)) {
timeScale = unit;
} else if (isWorkUnit(unit)) {
workScale = unit;
} else {
return "Bad unit: "+opt;
}
} else {
int unit1 = parseUnit(opt.substring(0,divindex));
int unit2 = parseUnit(opt.substring(divindex+1));
if (isTimeUnit(unit1)) {
if (isWorkUnit(unit2)) {
timeScale = unit1;
workScale = unit2;
invertRate = true;
} else if (isTimeUnit(unit2)) {
return "Both time units: "+opt;
} else {
return "Bad denominator: "+opt;
}
} else if (isWorkUnit(unit1)) {
if (isWorkUnit(unit2)) {
return "Both work units: "+opt;
} else if (isTimeUnit(unit2)) {
timeScale = unit2;
workScale = unit1;
invertRate = false;
} else {
return "Bad denominator: "+opt;
}
} else {
return "Bad numerator: "+opt;
}
}
timeOpt.setValue(timeScale);
workOpt.setValue(workScale);
rateOpt.setValue(invertRate);
return null;
}
private static HashMap unitMap;
static {
unitMap = new HashMap();
unitMap.put("U", new Integer(WORK_UNITS));
unitMap.put("M", new Integer(WORK_MILLIONS));
unitMap.put("K", new Integer(WORK_THOUSANDS));
unitMap.put("A", new Integer(WORK_AUTO));
unitMap.put("MU", new Integer(WORK_MILLIONS));
unitMap.put("KU", new Integer(WORK_THOUSANDS));
unitMap.put("AU", new Integer(WORK_AUTO));
unitMap.put("O", new Integer(WORK_UNITS | WORK_OPS));
unitMap.put("NO", new Integer(WORK_UNITS | WORK_OPS));
unitMap.put("MO", new Integer(WORK_MILLIONS | WORK_OPS));
unitMap.put("KO", new Integer(WORK_THOUSANDS | WORK_OPS));
unitMap.put("AO", new Integer(WORK_AUTO | WORK_OPS));
unitMap.put("s", new Integer(TIME_SECONDS));
unitMap.put("m", new Integer(TIME_MILLIS));
unitMap.put("u", new Integer(TIME_MICROS));
unitMap.put("n", new Integer(TIME_NANOS));
unitMap.put("a", new Integer(TIME_AUTO));
}
public static int parseUnit(String c) {
Integer u = (Integer) unitMap.get(c);
if (u != null) {
return u.intValue();
}
return RATE_UNKNOWN;
}
String unitname = "unit"; String unitname = "unit";
Test test; Test test;
...@@ -157,69 +333,76 @@ public class Result { ...@@ -157,69 +333,76 @@ public class Result {
} }
public String getAverageString() { public String getAverageString() {
double units = (useUnits ? getTotalUnits() : getTotalReps()); int timeScale = timeOpt.getIntValue();
int workScale = workOpt.getIntValue();
boolean invertRate = rateOpt.getBooleanValue();
double time = getTotalTime(); double time = getTotalTime();
String timeprefix = "";
switch (timeScale) {
case TIME_AUTO:
case TIME_SECONDS:
time /= 1000;
break;
case TIME_MILLIS:
timeprefix = "m";
break;
case TIME_MICROS:
time *= 1000.0;
timeprefix = "u";
break;
case TIME_NANOS:
time *= 1000000.0;
timeprefix = "n";
break;
}
String workprefix = "";
boolean isOps = (workScale & WORK_OPS) != 0;
String workname = isOps ? "op" : unitname;
double work = isOps ? getTotalReps() : getTotalUnits();
switch (workScale & (~WORK_OPS)) {
case WORK_AUTO:
case WORK_UNITS:
break;
case WORK_THOUSANDS:
work /= 1000.0;
workprefix = "K";
break;
case WORK_MILLIONS:
work /= 1000000.0;
workprefix = "M";
break;
}
if (invertRate) { if (invertRate) {
double rate = time / units; double rate = time / work;
String prefix = ""; if (timeScale == TIME_AUTO) {
switch (timeScale) {
case SECONDS_WHOLE:
rate /= 1000;
break;
case SECONDS_MILLIS:
prefix = "m";
break;
case SECONDS_MICROS:
rate *= 1000.0;
prefix = "u";
break;
case SECONDS_NANOS:
rate *= 1000000.0;
prefix = "n";
break;
case SECONDS_AUTO:
rate /= 1000.0;
if (rate < 1.0) { if (rate < 1.0) {
rate *= 1000.0; rate *= 1000.0;
prefix = "m"; timeprefix = "m";
if (rate < 1.0) { if (rate < 1.0) {
rate *= 1000.0; rate *= 1000.0;
prefix = "u"; timeprefix = "u";
if (rate < 1.0) { if (rate < 1.0) {
rate *= 1000.0; rate *= 1000.0;
prefix = "n"; timeprefix = "n";
} }
} }
} }
break;
} }
return rate+" "+prefix+"secs/"+(useUnits ? unitname : "op"); return rate+" "+timeprefix+"secs/"+workprefix+workname;
} else { } else {
double rate = units / (time / 1000.0); double rate = work / time;
String prefix = ""; if (workScale == WORK_AUTO) {
switch (unitScale) {
case UNITS_WHOLE:
break;
case UNITS_THOUSANDS:
rate /= 1000.0;
prefix = "K";
break;
case UNITS_MILLIONS:
rate /= 1000000.0;
prefix = "M";
break;
case UNITS_AUTO:
if (rate > 1000.0) { if (rate > 1000.0) {
rate /= 1000.0; rate /= 1000.0;
prefix = "K"; workprefix = "K";
if (rate > 1000.0) { if (rate > 1000.0) {
rate /= 1000.0; rate /= 1000.0;
prefix = "M"; workprefix = "M";
} }
} }
break;
} }
return rate+" "+prefix+(useUnits ? unitname : "op")+"s/sec"; return rate+" "+workprefix+workname+"s/"+timeprefix+"sec";
} }
} }
......
...@@ -61,6 +61,8 @@ public class J2DAnalyzer { ...@@ -61,6 +61,8 @@ public class J2DAnalyzer {
"the following result sets are combined into a group"); "the following result sets are combined into a group");
out.println(" -NoGroup "+ out.println(" -NoGroup "+
"the following result sets stand on their own"); "the following result sets stand on their own");
out.println(" -ShowUncontested "+
"show results even when only result set has a result");
out.println(" -Graph "+ out.println(" -Graph "+
"graph the results visually (using lines of *'s)"); "graph the results visually (using lines of *'s)");
out.println(" -Best "+ out.println(" -Best "+
...@@ -83,6 +85,7 @@ public class J2DAnalyzer { ...@@ -83,6 +85,7 @@ public class J2DAnalyzer {
public static void main(String argv[]) { public static void main(String argv[]) {
boolean gavehelp = false; boolean gavehelp = false;
boolean graph = false; boolean graph = false;
boolean ignoreuncontested = true;
if (argv.length > 0 && argv[0].equalsIgnoreCase("-html")) { if (argv.length > 0 && argv[0].equalsIgnoreCase("-html")) {
String newargs[] = new String[argv.length-1]; String newargs[] = new String[argv.length-1];
System.arraycopy(argv, 1, newargs, 0, newargs.length); System.arraycopy(argv, 1, newargs, 0, newargs.length);
...@@ -97,6 +100,8 @@ public class J2DAnalyzer { ...@@ -97,6 +100,8 @@ public class J2DAnalyzer {
results.add(groupHolder); results.add(groupHolder);
} else if (arg.equalsIgnoreCase("-NoGroup")) { } else if (arg.equalsIgnoreCase("-NoGroup")) {
groupHolder = null; groupHolder = null;
} else if (arg.equalsIgnoreCase("-ShowUncontested")) {
ignoreuncontested = false;
} else if (arg.equalsIgnoreCase("-Graph")) { } else if (arg.equalsIgnoreCase("-Graph")) {
graph = true; graph = true;
} else if (arg.equalsIgnoreCase("-Best")) { } else if (arg.equalsIgnoreCase("-Best")) {
...@@ -171,18 +176,23 @@ public class J2DAnalyzer { ...@@ -171,18 +176,23 @@ public class J2DAnalyzer {
String key = keys[k]; String key = keys[k];
ResultHolder rh = base.getResultByKey(key); ResultHolder rh = base.getResultByKey(key);
double score = rh.getScore(); double score = rh.getScore();
System.out.println(rh.getShortKey()+":");
double maxscore = score; double maxscore = score;
if (graph) { int numcontesting = 0;
for (int i = 0; i < numsets; i++) { for (int i = 0; i < numsets; i++) {
ResultSetHolder rsh = ResultSetHolder rsh =
(ResultSetHolder) results.elementAt(i); (ResultSetHolder) results.elementAt(i);
ResultHolder rh2 = rsh.getResultByKey(key); ResultHolder rh2 = rsh.getResultByKey(key);
if (rh2 != null) { if (rh2 != null) {
if (graph) {
maxscore = Math.max(maxscore, rh2.getBestScore()); maxscore = Math.max(maxscore, rh2.getBestScore());
} }
numcontesting++;
} }
} }
if (ignoreuncontested && numcontesting < 2) {
continue;
}
System.out.println(rh.getShortKey()+":");
for (int i = 0; i < numsets; i++) { for (int i = 0; i < numsets; i++) {
ResultSetHolder rsh = (ResultSetHolder) results.elementAt(i); ResultSetHolder rsh = (ResultSetHolder) results.elementAt(i);
System.out.print(rsh.getTitle()+": "); System.out.print(rsh.getTitle()+": ");
......
...@@ -38,6 +38,8 @@ import java.awt.RenderingHints; ...@@ -38,6 +38,8 @@ import java.awt.RenderingHints;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.geom.Point2D;
import java.awt.geom.AffineTransform;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import j2dbench.Destinations; import j2dbench.Destinations;
...@@ -74,6 +76,7 @@ public abstract class GraphicsTests extends Test { ...@@ -74,6 +76,7 @@ public abstract class GraphicsTests extends Test {
static Option animList; static Option animList;
static Option sizeList; static Option sizeList;
static Option compRules; static Option compRules;
static Option transforms;
static Option doExtraAlpha; static Option doExtraAlpha;
static Option doXor; static Option doXor;
static Option doClipping; static Option doClipping;
...@@ -167,6 +170,29 @@ public abstract class GraphicsTests extends Test { ...@@ -167,6 +170,29 @@ public abstract class GraphicsTests extends Test {
j, rulenames, rules, rulenames, j, rulenames, rules, rulenames,
ruledescs, (1 << defrule)); ruledescs, (1 << defrule));
((Option.ObjectList) compRules).setNumRows(4); ((Option.ObjectList) compRules).setNumRows(4);
Transform xforms[] = {
Identity.instance,
FTranslate.instance,
Scale2x2.instance,
Rotate15.instance,
ShearX.instance,
ShearY.instance,
};
String xformnames[] = new String[xforms.length];
String xformdescs[] = new String[xforms.length];
for (int i = 0; i < xforms.length; i++) {
xformnames[i] = xforms[i].getShortName();
xformdescs[i] = xforms[i].getDescription();
}
transforms =
new Option.ObjectList(groptroot, "transform",
"Affine Transform",
xforms.length,
xformnames, xforms, xformnames,
xformdescs, 0x1);
((Option.ObjectList) transforms).setNumRows(3);
doExtraAlpha = doExtraAlpha =
new Option.Toggle(groptroot, "extraalpha", new Option.Toggle(groptroot, "extraalpha",
"Render with an \"extra alpha\" of 0.125", "Render with an \"extra alpha\" of 0.125",
...@@ -200,6 +226,7 @@ public abstract class GraphicsTests extends Test { ...@@ -200,6 +226,7 @@ public abstract class GraphicsTests extends Test {
int orgX, orgY; int orgX, orgY;
int initX, initY; int initX, initY;
int maxX, maxY; int maxX, maxY;
double pixscale;
} }
public GraphicsTests(Group parent, String nodeName, String description) { public GraphicsTests(Group parent, String nodeName, String description) {
...@@ -211,7 +238,7 @@ public abstract class GraphicsTests extends Test { ...@@ -211,7 +238,7 @@ public abstract class GraphicsTests extends Test {
public Object initTest(TestEnvironment env, Result result) { public Object initTest(TestEnvironment env, Result result) {
Context ctx = createContext(); Context ctx = createContext();
initContext(env, ctx); initContext(env, ctx);
result.setUnits(pixelsTouched(ctx)); result.setUnits((int) (ctx.pixscale * pixelsTouched(ctx)));
result.setUnitName("pixel"); result.setUnitName("pixel");
return ctx; return ctx;
} }
...@@ -232,6 +259,9 @@ public abstract class GraphicsTests extends Test { ...@@ -232,6 +259,9 @@ public abstract class GraphicsTests extends Test {
ctx.graphics = env.getGraphics(); ctx.graphics = env.getGraphics();
int w = env.getWidth(); int w = env.getWidth();
int h = env.getHeight(); int h = env.getHeight();
ctx.size = env.getIntValue(sizeList);
ctx.outdim = getOutputSize(ctx.size, ctx.size);
ctx.pixscale = 1.0;
if (hasGraphics2D) { if (hasGraphics2D) {
Graphics2D g2d = (Graphics2D) ctx.graphics; Graphics2D g2d = (Graphics2D) ctx.graphics;
AlphaComposite ac = (AlphaComposite) env.getModifier(compRules); AlphaComposite ac = (AlphaComposite) env.getModifier(compRules);
...@@ -251,11 +281,14 @@ public abstract class GraphicsTests extends Test { ...@@ -251,11 +281,14 @@ public abstract class GraphicsTests extends Test {
p.addPoint(0, 0); p.addPoint(0, 0);
g2d.clip(p); g2d.clip(p);
} }
Transform tx = (Transform) env.getModifier(transforms);
Dimension envdim = new Dimension(w, h);
tx.init(g2d, ctx, envdim);
w = envdim.width;
h = envdim.height;
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
env.getModifier(renderHint)); env.getModifier(renderHint));
} }
ctx.size = env.getIntValue(sizeList);
ctx.outdim = getOutputSize(ctx.size, ctx.size);
switch (env.getIntValue(animList)) { switch (env.getIntValue(animList)) {
case 0: case 0:
ctx.animate = false; ctx.animate = false;
...@@ -290,4 +323,201 @@ public abstract class GraphicsTests extends Test { ...@@ -290,4 +323,201 @@ public abstract class GraphicsTests extends Test {
graphics.dispose(); graphics.dispose();
((Context) ctx).graphics = null; ((Context) ctx).graphics = null;
} }
public abstract static class Transform {
public abstract String getShortName();
public abstract String getDescription();
public abstract void init(Graphics2D g2d, Context ctx, Dimension dim);
public static double scaleForPoint(AffineTransform at,
double xorig, double yorig,
double x, double y,
int w, int h)
{
Point2D.Double ptd = new Point2D.Double(x, y);
at.transform(ptd, ptd);
x = ptd.getX();
y = ptd.getY();
double scale = 1.0;
if (x < 0) {
scale = Math.min(scale, xorig / (xorig - x));
} else if (x > w) {
scale = Math.min(scale, (w - xorig) / (x - xorig));
}
if (y < 0) {
scale = Math.min(scale, yorig / (yorig - y));
} else if (y > h) {
scale = Math.min(scale, (h - yorig) / (y - yorig));
}
return scale;
}
public static Dimension scaleForTransform(AffineTransform at,
Dimension dim)
{
int w = dim.width;
int h = dim.height;
Point2D.Double ptd = new Point2D.Double(0, 0);
at.transform(ptd, ptd);
double ox = ptd.getX();
double oy = ptd.getY();
if (ox < 0 || ox > w || oy < 0 || oy > h) {
throw new InternalError("origin outside destination");
}
double scalex = scaleForPoint(at, ox, oy, w, h, w, h);
double scaley = scalex;
scalex = Math.min(scaleForPoint(at, ox, oy, w, 0, w, h), scalex);
scaley = Math.min(scaleForPoint(at, ox, oy, 0, h, w, h), scaley);
if (scalex < 0 || scaley < 0) {
throw new InternalError("could not fit dims to transform");
}
return new Dimension((int) Math.floor(w * scalex),
(int) Math.floor(h * scaley));
}
}
public static class Identity extends Transform {
public static final Identity instance = new Identity();
private Identity() {}
public String getShortName() {
return "ident";
}
public String getDescription() {
return "Identity";
}
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
}
}
public static class FTranslate extends Transform {
public static final FTranslate instance = new FTranslate();
private FTranslate() {}
public String getShortName() {
return "ftrans";
}
public String getDescription() {
return "FTranslate 1.5";
}
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.translate(1.5, 1.5);
g2d.transform(at);
dim.setSize(w-3, h-3);
}
}
public static class Scale2x2 extends Transform {
public static final Scale2x2 instance = new Scale2x2();
private Scale2x2() {}
public String getShortName() {
return "scale2x2";
}
public String getDescription() {
return "Scale 2x by 2x";
}
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.scale(2.0, 2.0);
g2d.transform(at);
dim.setSize(w/2, h/2);
ctx.pixscale = 4;
}
}
public static class Rotate15 extends Transform {
public static final Rotate15 instance = new Rotate15();
private Rotate15() {}
public String getShortName() {
return "rot15";
}
public String getDescription() {
return "Rotate 15 degrees";
}
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
double theta = Math.toRadians(15);
double cos = Math.cos(theta);
double sin = Math.sin(theta);
double xsize = sin * h + cos * w;
double ysize = sin * w + cos * h;
double scale = Math.min(w / xsize, h / ysize);
xsize *= scale;
ysize *= scale;
AffineTransform at = new AffineTransform();
at.translate((w - xsize) / 2.0, (h - ysize) / 2.0);
at.translate(sin * h * scale, 0.0);
at.rotate(theta);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
}
public static class ShearX extends Transform {
public static final ShearX instance = new ShearX();
private ShearX() {}
public String getShortName() {
return "shearx";
}
public String getDescription() {
return "Shear X to the right";
}
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.translate(0.0, (h - (w*h)/(w + h*0.1)) / 2);
at.shear(0.1, 0.0);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
}
public static class ShearY extends Transform {
public static final ShearY instance = new ShearY();
private ShearY() {}
public String getShortName() {
return "sheary";
}
public String getDescription() {
return "Shear Y down";
}
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.translate((w - (w*h)/(h + w*0.1)) / 2, 0.0);
at.shear(0.0, 0.1);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
}
} }
...@@ -454,7 +454,7 @@ public abstract class TextTests extends Test { ...@@ -454,7 +454,7 @@ public abstract class TextTests extends Test {
taaNames, taaHints, taaNames, taaHints,
taaNames, taaNames, taaNames, taaNames,
0x1); 0x1);
((Option.ObjectList) taaList).setNumRows(2); ((Option.ObjectList) taaList).setNumRows(6);
// add special TextAAOpt for backwards compatibility with // add special TextAAOpt for backwards compatibility with
// older options files // older options files
new TextAAOpt(); new TextAAOpt();
...@@ -707,3 +707,4 @@ public abstract class TextTests extends Test { ...@@ -707,3 +707,4 @@ public abstract class TextTests extends Test {
} }
} }
} }
...@@ -57,9 +57,12 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { ...@@ -57,9 +57,12 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
private native void run(String title, int mode, String dir, String file, private native void run(String title, int mode, String dir, String file,
FilenameFilter filter, boolean isMultipleMode); FilenameFilter filter, boolean isMultipleMode);
private native void quit(); private native void quit();
@Override
public native void toFront();
/** /**
* Called exclusively by the native C code. * Called exclusively by the native C code.
*/ */
......
...@@ -150,6 +150,8 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { ...@@ -150,6 +150,8 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
void updateChildrenSizes() { void updateChildrenSizes() {
super.updateChildrenSizes(); super.updateChildrenSizes();
int height = getMenuBarHeight();
// XWindow.reshape calls XBaseWindow.xSetBounds, which acquires // XWindow.reshape calls XBaseWindow.xSetBounds, which acquires
// the AWT lock, so we have to acquire the AWT lock here // the AWT lock, so we have to acquire the AWT lock here
// before getStateLock() to avoid a deadlock with the Toolkit thread // before getStateLock() to avoid a deadlock with the Toolkit thread
...@@ -159,7 +161,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { ...@@ -159,7 +161,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
synchronized(getStateLock()) { synchronized(getStateLock()) {
int width = dimensions.getClientSize().width; int width = dimensions.getClientSize().width;
if (menubarPeer != null) { if (menubarPeer != null) {
menubarPeer.reshape(0, 0, width, getMenuBarHeight()); menubarPeer.reshape(0, 0, width, height);
} }
} }
} finally { } finally {
......
...@@ -217,15 +217,18 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script, ...@@ -217,15 +217,18 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
/* Normalize the language name */ /* Normalize the language name */
if (std_language != NULL) { if (std_language != NULL) {
*std_language = "en"; *std_language = "en";
if (language != NULL) { if (language != NULL && mapLookup(language_names, language, std_language) == 0) {
mapLookup(language_names, language, std_language); *std_language = malloc(strlen(language)+1);
strcpy(*std_language, language);
} }
} }
/* Normalize the country name */ /* Normalize the country name */
if (std_country != NULL && country != NULL) { if (std_country != NULL && country != NULL) {
*std_country = country; if (mapLookup(country_names, country, std_country) == 0) {
mapLookup(country_names, country, std_country); *std_country = malloc(strlen(country)+1);
strcpy(*std_country, country);
}
} }
/* Normalize the script and variant name. Note that we only use /* Normalize the script and variant name. Note that we only use
......
...@@ -607,6 +607,7 @@ gboolean gtk2_load() ...@@ -607,6 +607,7 @@ gboolean gtk2_load()
fp_gtk_tree_view_new = dl_symbol("gtk_tree_view_new"); fp_gtk_tree_view_new = dl_symbol("gtk_tree_view_new");
fp_gtk_viewport_new = dl_symbol("gtk_viewport_new"); fp_gtk_viewport_new = dl_symbol("gtk_viewport_new");
fp_gtk_window_new = dl_symbol("gtk_window_new"); fp_gtk_window_new = dl_symbol("gtk_window_new");
fp_gtk_window_present = dl_symbol("gtk_window_present");
fp_gtk_dialog_new = dl_symbol("gtk_dialog_new"); fp_gtk_dialog_new = dl_symbol("gtk_dialog_new");
fp_gtk_frame_new = dl_symbol("gtk_frame_new"); fp_gtk_frame_new = dl_symbol("gtk_frame_new");
......
...@@ -749,6 +749,7 @@ int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf); ...@@ -749,6 +749,7 @@ int (*fp_gdk_pixbuf_get_rowstride)(const GdkPixbuf *pixbuf);
int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf); int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error); GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
void (*fp_gtk_widget_destroy)(GtkWidget *widget); void (*fp_gtk_widget_destroy)(GtkWidget *widget);
void (*fp_gtk_window_present)(GtkWindow *window);
/** /**
......
...@@ -80,6 +80,28 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit ...@@ -80,6 +80,28 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
quit(env, jpeer, FALSE); quit(env, jpeer, FALSE);
} }
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: toFront
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
(JNIEnv * env, jobject jpeer)
{
GtkWidget * dialog;
fp_gdk_threads_enter();
dialog = (GtkWidget*)jlong_to_ptr(
(*env)->GetLongField(env, jpeer, widgetFieldID));
if (dialog != NULL) {
fp_gtk_window_present((GtkWindow*)dialog);
}
fp_gdk_threads_leave();
}
/** /**
* Convert a GSList to an array of filenames (without the parent folder) * Convert a GSList to an array of filenames (without the parent folder)
*/ */
......
...@@ -33,6 +33,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_run ...@@ -33,6 +33,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_run
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
(JNIEnv *, jobject); (JNIEnv *, jobject);
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: toFront
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
(JNIEnv *, jobject);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -70,7 +70,11 @@ static void EnsureJreInstallation(const char *jrepath); ...@@ -70,7 +70,11 @@ static void EnsureJreInstallation(const char *jrepath);
*/ */
#undef ENABLE_AWT_PRELOAD #undef ENABLE_AWT_PRELOAD
#ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */ #ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */
#define ENABLE_AWT_PRELOAD /* CR6999872: fastdebug crashes if awt library is loaded before JVM is
* initialized*/
#if !defined(DEBUG)
#define ENABLE_AWT_PRELOAD
#endif
#endif #endif
#ifdef ENABLE_AWT_PRELOAD #ifdef ENABLE_AWT_PRELOAD
......
...@@ -79,10 +79,50 @@ class WFramePeer extends WWindowPeer implements FramePeer { ...@@ -79,10 +79,50 @@ class WFramePeer extends WWindowPeer implements FramePeer {
if (b == null) { if (b == null) {
clearMaximizedBounds(); clearMaximizedBounds();
} else { } else {
setMaximizedBounds(b.x, b.y, b.width, b.height); Rectangle adjBounds = (Rectangle)b.clone();
adjustMaximizedBounds(adjBounds);
setMaximizedBounds(adjBounds.x, adjBounds.y, adjBounds.width, adjBounds.height);
} }
} }
/**
* The incoming bounds describe the maximized size and position of the
* window on the monitor that displays the window. But the window manager
* expects that the bounds are based on the size and position of the
* primary monitor, even if the window ultimately maximizes onto a
* secondary monitor. And the window manager adjusts these values to
* compensate for differences between the primary monitor and the monitor
* that displays the window.
* The method translates the incoming bounds to the values acceptable
* by the window manager. For more details, please refer to 6699851.
*/
private void adjustMaximizedBounds(Rectangle b) {
GraphicsConfiguration currentDevGC = getGraphicsConfiguration();
GraphicsDevice primaryDev = GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GraphicsConfiguration primaryDevGC = primaryDev.getDefaultConfiguration();
if (currentDevGC != null && currentDevGC != primaryDevGC) {
Rectangle currentDevBounds = currentDevGC.getBounds();
Rectangle primaryDevBounds = primaryDevGC.getBounds();
b.width -= (currentDevBounds.width - primaryDevBounds.width);
b.height -= (currentDevBounds.height - primaryDevBounds.height);
}
}
@Override
public boolean updateGraphicsData(GraphicsConfiguration gc) {
boolean result = super.updateGraphicsData(gc);
Rectangle bounds = AWTAccessor.getFrameAccessor().
getMaximizedBounds((Frame)target);
if (bounds != null) {
setMaximizedBounds(bounds);
}
return result;
}
@Override @Override
boolean isTargetUndecorated() { boolean isTargetUndecorated() {
return ((Frame)target).isUndecorated(); return ((Frame)target).isUndecorated();
......
...@@ -969,12 +969,15 @@ void D3DInitializer::InitImpl() ...@@ -969,12 +969,15 @@ void D3DInitializer::InitImpl()
} }
D3DPipelineManager *pMgr = D3DPipelineManager::CreateInstance(); D3DPipelineManager *pMgr = D3DPipelineManager::CreateInstance();
if (pMgr != NULL) { if (pMgr != NULL) {
UINT adapterCount = pMgr->adapterCount; // init adapters if we are preloading
if (AwtToolkit::GetInstance().GetPreloadThread().OnPreloadThread()) {
pAdapterIniters = new D3DAdapterInitializer[adapterCount]; UINT adapterCount = pMgr->adapterCount;
for (UINT i=0; i<adapterCount; i++) {
pAdapterIniters[i].setAdapter(i); pAdapterIniters = new D3DAdapterInitializer[adapterCount];
AwtToolkit::GetInstance().GetPreloadThread().AddAction(&pAdapterIniters[i]); for (UINT i=0; i<adapterCount; i++) {
pAdapterIniters[i].setAdapter(i);
AwtToolkit::GetInstance().GetPreloadThread().AddAction(&pAdapterIniters[i]);
}
} }
} }
} }
......
...@@ -86,6 +86,7 @@ static const UINT MINIMUM_NUMBER_OF_VISIBLE_ITEMS = 8; ...@@ -86,6 +86,7 @@ static const UINT MINIMUM_NUMBER_OF_VISIBLE_ITEMS = 8;
AwtChoice::AwtChoice() { AwtChoice::AwtChoice() {
m_hList = NULL; m_hList = NULL;
m_listDefWindowProc = NULL; m_listDefWindowProc = NULL;
m_selectedItem = -1;
} }
LPCTSTR AwtChoice::GetClassName() { LPCTSTR AwtChoice::GetClassName() {
...@@ -437,9 +438,10 @@ LRESULT CALLBACK AwtChoice::ListWindowProc(HWND hwnd, UINT message, ...@@ -437,9 +438,10 @@ LRESULT CALLBACK AwtChoice::ListWindowProc(HWND hwnd, UINT message,
MsgRouting AwtChoice::WmNotify(UINT notifyCode) MsgRouting AwtChoice::WmNotify(UINT notifyCode)
{ {
if (notifyCode == CBN_SELCHANGE) { if (notifyCode == CBN_SELCHANGE) {
int itemSelect = (int)SendMessage(CB_GETCURSEL); int selectedItem = (int)SendMessage(CB_GETCURSEL);
if (itemSelect != CB_ERR){ if (selectedItem != CB_ERR && m_selectedItem != selectedItem){
DoCallback("handleAction", "(I)V", itemSelect); m_selectedItem = selectedItem;
DoCallback("handleAction", "(I)V", selectedItem);
} }
} else if (notifyCode == CBN_DROPDOWN) { } else if (notifyCode == CBN_DROPDOWN) {
......
...@@ -94,6 +94,7 @@ private: ...@@ -94,6 +94,7 @@ private:
static BOOL sm_isMouseMoveInList; static BOOL sm_isMouseMoveInList;
HWND m_hList; HWND m_hList;
WNDPROC m_listDefWindowProc; WNDPROC m_listDefWindowProc;
int m_selectedItem;
static LRESULT CALLBACK ListWindowProc(HWND hwnd, UINT message, static LRESULT CALLBACK ListWindowProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam); WPARAM wParam, LPARAM lParam);
}; };
......
...@@ -1904,6 +1904,11 @@ bool AwtToolkit::PreloadThread::InvokeAndTerminate(void(_cdecl *fn)(void *), voi ...@@ -1904,6 +1904,11 @@ bool AwtToolkit::PreloadThread::InvokeAndTerminate(void(_cdecl *fn)(void *), voi
return true; return true;
} }
bool AwtToolkit::PreloadThread::OnPreloadThread()
{
return GetThreadId() == ::GetCurrentThreadId();
}
/*static*/ /*static*/
unsigned WINAPI AwtToolkit::PreloadThread::StaticThreadProc(void *param) unsigned WINAPI AwtToolkit::PreloadThread::StaticThreadProc(void *param)
{ {
......
...@@ -559,6 +559,8 @@ public: ...@@ -559,6 +559,8 @@ public:
CriticalSection::Lock lock(threadLock); CriticalSection::Lock lock(threadLock);
return wrongThread; return wrongThread;
} }
// returns true if the current thread is "preload" thread
bool OnPreloadThread();
private: private:
// data access lock // data access lock
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<assemblyIdentity <assemblyIdentity
version="1.0.0.0" version="1.0.0.0"
processorArchitecture="X86" processorArchitecture="X86"
name="Sun Microsystems, Inc., Java(tm) 2 Standard Edition" name="Oracle Corporation, Java(tm) 2 Standard Edition"
type="win32" type="win32"
/> />
<description>AWT</description> <description>AWT</description>
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 6783910
@summary java.awt.Color.brighter()/darker() methods make color opaque
@author Andrei Dmitriev: area=awt-color
@run main OpacityChange
*/
import java.awt.*;
public class OpacityChange {
private final static int INITIAL_ALPHA = 125;
public static void main(String argv[]) {
Color color = new Color(20, 20, 20, INITIAL_ALPHA);
System.out.println("Initial alpha: " + color.getAlpha());
Color colorBrighter = color.brighter();
System.out.println("New alpha (after brighter): " + colorBrighter.getAlpha());
Color colorDarker = color.darker();
System.out.println("New alpha (after darker): " + colorDarker.getAlpha());
if (INITIAL_ALPHA != colorBrighter.getAlpha()) {
throw new RuntimeException("Brighter color alpha has changed from : " +INITIAL_ALPHA + " to " + colorBrighter.getAlpha());
}
if (INITIAL_ALPHA != colorDarker.getAlpha()) {
throw new RuntimeException("Darker color alpha has changed from : " +INITIAL_ALPHA + " to " + colorDarker.getAlpha());
}
}
}
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 6990904
@summary on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
@author Andrei Dmitriev: area=awt-menubar
@run main/timeout=30 DeadlockTest1
*/
import java.awt.*;
public class DeadlockTest1 {
Frame f = new Frame("Menu Frame");
DeadlockTest1() {
MenuBar menubar = new MenuBar();
Menu file = new Menu("File");
Menu edit = new Menu("Edit");
Menu help = new Menu("Help");
MenuItem open = new MenuItem("Open");
MenuItem close = new MenuItem("Close");
MenuItem copy = new MenuItem("Copy");
MenuItem paste = new MenuItem("Paste");
file.add(open);
file.add(close);
edit.add(copy);
edit.add(paste);
menubar.add(file);
menubar.add(edit);
menubar.add(help);
menubar.setHelpMenu(help);
f.setMenuBar(menubar);
f.setSize(400,200);
f.setVisible(true);
try {
Thread.sleep(5000);
} catch (InterruptedException z) {
throw new RuntimeException(z);
}
f.dispose();
}
public static void main(String argv[]) {
new DeadlockTest1();
}
}
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
/* /*
* @test * @test
* @bug 6842557 6943963 * @bug 6842557 6943963 6959267
* @summary confirm that shaping works as expected. (Mainly for new characters which were added in Unicode 5) * @summary confirm that shaping works as expected. (Mainly for new characters which were added in Unicode 5 and 6)
* used where appropriate. * used where appropriate.
*/ */
...@@ -39,6 +39,7 @@ public class ShapingTest { ...@@ -39,6 +39,7 @@ public class ShapingTest {
public static void main(String[] args) { public static void main(String[] args) {
test6842557(); test6842557();
test6943963(); test6943963();
test6903266();
if (err) { if (err) {
throw new RuntimeException("shape() returned unexpected value."); throw new RuntimeException("shape() returned unexpected value.");
...@@ -109,6 +110,34 @@ public class ShapingTest { ...@@ -109,6 +110,34 @@ public class ShapingTest {
checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC); checkResult("Range.ARABIC, Range.EASTERN_ARABIC", ns, given, expected_EASTERN_ARABIC);
} }
private static void test6903266() {
NumericShaper ns = getContextualShaper(EnumSet.of(Range.TAI_THAM_HORA));
String given = "\u1a20 012";
String expected = "\u1a20 \u1a80\u1a81\u1a82";
checkResult("Range.TAI_THAM_HORA", ns, given, expected);
ns = getContextualShaper(EnumSet.of(Range.TAI_THAM_HORA,
Range.TAI_THAM_THAM));
given = "\u1a20 012";
expected = "\u1a20 \u1a90\u1a91\u1a92"; // Tham digits are prioritized.
checkResult("Range.TAI_THAM_HORA, Range.TAI_THAM_THAM", ns, given, expected);
ns = getContextualShaper(EnumSet.of(Range.JAVANESE));
given = "\ua984 012";
expected = "\ua984 \ua9d0\ua9d1\ua9d2";
checkResult("Range.JAVANESE", ns, given, expected);
ns = getContextualShaper(EnumSet.of(Range.TAI_THAM_THAM));
given = "\u1a20 012";
expected = "\u1a20 \u1a90\u1a91\u1a92";
checkResult("Range.TAI_THAM_THAM", ns, given, expected);
ns = getContextualShaper(EnumSet.of(Range.MEETEI_MAYEK));
given = "\uabc0 012";
expected = "\uabc0 \uabf0\uabf1\uabf2";
checkResult("Range.MEETEI_MAYEK", ns, given, expected);
}
private static void checkResult(String ranges, NumericShaper ns, private static void checkResult(String ranges, NumericShaper ns,
String given, String expected) { String given, String expected) {
char[] text = given.toCharArray(); char[] text = given.toCharArray();
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6447751
* @summary Tests automatic search for customizers
* @author Sergey Malenkov
*/
import java.awt.Component;
import java.beans.Customizer;
import java.beans.Introspector;
import java.beans.IntrospectionException;
import java.beans.SimpleBeanInfo;
import java.beans.BeanDescriptor;
import java.beans.PropertyChangeListener;
public class Test6447751 {
public static void main(String[] args) {
test(Manual.class, AutomaticCustomizer.class);
test(Illegal.class, null);
test(Automatic.class, AutomaticCustomizer.class);
}
private static void test(Class<?> type, Class<?> expected) {
Class<?> actual;
try {
actual = Introspector.getBeanInfo(type).getBeanDescriptor().getCustomizerClass();
}
catch (IntrospectionException exception) {
throw new Error("unexpected error", exception);
}
if (actual != expected) {
StringBuilder sb = new StringBuilder();
sb.append("bean ").append(type).append(": ");
if (expected != null) {
sb.append("expected ").append(expected);
if (actual != null) {
sb.append(", but ");
}
}
if (actual != null) {
sb.append("found ").append(actual);
}
throw new Error(sb.toString());
}
}
public static class Automatic {
}
public static class AutomaticCustomizer extends Component implements Customizer {
public void setObject(Object bean) {
throw new UnsupportedOperationException();
}
}
public static class Illegal {
}
public static class IllegalCustomizer implements Customizer {
public void setObject(Object bean) {
throw new UnsupportedOperationException();
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
throw new UnsupportedOperationException();
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
throw new UnsupportedOperationException();
}
}
public static class Manual {
}
public static class ManualBeanInfo extends SimpleBeanInfo {
public BeanDescriptor getBeanDescriptor() {
return new BeanDescriptor(Manual.class, AutomaticCustomizer.class);
}
}
}
/** /**
* @test * @test
* @bug 6945564 * @bug 6945564 6959267
* @summary Check that the j.l.Character.UnicodeScript * @summary Check that the j.l.Character.UnicodeScript
* @ignore don't run until #6903266 is integrated
*/ */
import java.io.*; import java.io.*;
...@@ -15,11 +14,15 @@ public class CheckScript { ...@@ -15,11 +14,15 @@ public class CheckScript {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (args.length != 1) { BufferedReader sbfr = null;
System.out.println("java CharacterScript script.txt"); if (args.length == 0) {
System.exit(1); sbfr = new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Scripts.txt")));
} else if (args.length == 1) {
sbfr = new BufferedReader(new FileReader(args[0]));
} else {
System.out.println("java CharacterScript Scripts.txt");
throw new RuntimeException("Datafile name should be specified.");
} }
BufferedReader sbfr = new BufferedReader(new FileReader(args[0]));
Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher(""); Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher("");
String line = null; String line = null;
HashMap<String,ArrayList<Integer>> scripts = new HashMap<>(); HashMap<String,ArrayList<Integer>> scripts = new HashMap<>();
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002398
* @summary Verify that Corrigendum #8 for Unicode 6.0.0 has been applied.
*/
import java.text.*;
public class Bug7002398 {
private static final int[] directions = {
Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT,
Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT,
Bidi.DIRECTION_LEFT_TO_RIGHT,
Bidi.DIRECTION_RIGHT_TO_LEFT
};
/*
* Old Bidi class: AL AN AL AN AL
* New Bidi class: AL
*/
private static final String str = "\u0627\u0660\u0710\u070F\u070D";
private static final int[] expectedLevels = {1, 2, 1, 1, 1};
public static void main(String[] args) {
boolean err = false;
for (int dir = 0; dir < directions.length; dir ++) {
Bidi bidi = new Bidi(str, directions[dir]);
for (int index = 0; index < str.length(); index ++) {
int gotLevel = bidi.getLevelAt(index);
if (gotLevel != expectedLevels[index]) {
err = true;
System.err.println("Unexpected level for the character 0x" +
Integer.toHexString(str.charAt(index)).toUpperCase() +
": Expected level = " + expectedLevels[index] +
", actual level = " + bidi.getLevelAt(index) +
" in direction = " + directions[dir] + ".");
}
}
}
if (err) {
throw new RuntimeException("Failed.");
}
}
}
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6807534
* @summary check whether the default implementation of
* CurrencNameProvider.getDisplayName(String, Locale) throws appropriate
* exceptions when necessary.
*/
import java.util.Locale;
import java.util.spi.CurrencyNameProvider;
public class Bug6807534 {
static final CurrencyNameProvider cnp = new CurrencyNameProviderImpl();
public static void main(String[] args) throws Exception {
// test for NullPointerException (currencyCode)
try {
cnp.getDisplayName(null, Locale.US);
throwException("NPE was not thrown with null currencyCode");
} catch (NullPointerException npe) {}
// test for NullPointerException (locale)
try {
cnp.getDisplayName("USD", null);
throwException("NPE was not thrown with null locale");
} catch (NullPointerException npe) {}
// test for IllegalArgumentException (illegal currencyCode)
try {
cnp.getDisplayName("INVALID", Locale.US);
throwException("IllegalArgumentException was not thrown with invalid currency code");
} catch (IllegalArgumentException iae) {}
try {
cnp.getDisplayName("inv", Locale.US);
throwException("IllegalArgumentException was not thrown with invalid currency code");
} catch (IllegalArgumentException iae) {}
// test for IllegalArgumentException (non-supported locale)
try {
cnp.getDisplayName("USD", Locale.JAPAN);
throwException("IllegalArgumentException was not thrown with non-supported locale");
} catch (IllegalArgumentException iae) {}
}
static void throwException(String msg) {
throw new RuntimeException("test failed. "+msg);
}
static class CurrencyNameProviderImpl extends CurrencyNameProvider {
// dummy implementation
public String getSymbol(String currencyCode, Locale locale) {
return "";
}
public Locale[] getAvailableLocales() {
Locale[] avail = new Locale[1];
avail[0] = Locale.US;
return avail;
}
}
}
...@@ -518,16 +518,16 @@ display locale: ID: bn_IN, Name: Bengali (India) ...@@ -518,16 +518,16 @@ display locale: ID: bn_IN, Name: Bengali (India)
format locale: ID: bn_IN, Name: Bengali (India) format locale: ID: bn_IN, Name: Bengali (India)
default charset: UTF-8 default charset: UTF-8
OS Locale: bokmal OS Locale: bokml
default locale: ID: nb_NO, Name: Norwegian Bokml (Norway) default locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
display locale: ID: nb_NO, Name: Norwegian Bokml (Norway) display locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
format locale: ID: nb_NO, Name: Norwegian Bokml (Norway) format locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
default charset: ISO-8859-1 default charset: ISO-8859-1
OS Locale: bokml OS Locale: bokmal
default locale: ID: en, Name: English default locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
display locale: ID: en, Name: English display locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
format locale: ID: en, Name: English format locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
default charset: ISO-8859-1 default charset: ISO-8859-1
OS Locale: br_FR OS Locale: br_FR
......
...@@ -518,16 +518,16 @@ display locale: ID: bn_IN, Name: Bengali (India) ...@@ -518,16 +518,16 @@ display locale: ID: bn_IN, Name: Bengali (India)
format locale: ID: bn_IN, Name: Bengali (India) format locale: ID: bn_IN, Name: Bengali (India)
default charset: UTF-8 default charset: UTF-8
OS Locale: bokmal OS Locale: bokml
default locale: ID: nb_NO, Name: Norwegian Bokml (Norway) default locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
display locale: ID: nb_NO, Name: Norwegian Bokml (Norway) display locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
format locale: ID: nb_NO, Name: Norwegian Bokml (Norway) format locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
default charset: ISO-8859-1 default charset: ISO-8859-1
OS Locale: bokml OS Locale: bokmal
default locale: ID: en, Name: English default locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
display locale: ID: en, Name: English display locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
format locale: ID: en, Name: English format locale: ID: nb_NO, Name: Norwegian Bokml (Norway)
default charset: ISO-8859-1 default charset: ISO-8859-1
OS Locale: br_FR OS Locale: br_FR
......
...@@ -32,12 +32,6 @@ ...@@ -32,12 +32,6 @@
* *
* (C) Copyright IBM Corp. 1999 - All Rights Reserved * (C) Copyright IBM Corp. 1999 - All Rights Reserved
* *
* This software is the confidential and proprietary information
* of Sun Microsystems, Inc. ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Sun.
*
* The original version of this source code and documentation is * The original version of this source code and documentation is
* copyrighted and owned by IBM. These materials are provided * copyrighted and owned by IBM. These materials are provided
* under terms of a License Agreement between IBM and Sun. * under terms of a License Agreement between IBM and Sun.
......
<html>
<body>
<applet code="bug4150029.class" width=200 height=200></applet>
1.Go into 'subDir' folder.
2.Press BACKSPACE key.
3.Push OPEN button.
4.Push DONE button.
</body>
</html>
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4150029
@summary BackSpace keyboard button does not lead to parent directory
@author Oleg Mokhovikov
@run applet/manual=done bug4150029.html
*/
import javax.swing.*;
import java.io.File;
import java.io.IOException;
public class bug4150029 extends JApplet {
private boolean res;
public void init() {
String tmpDir = System.getProperty("java.io.tmpdir");
if (tmpDir.length() == 0) {//'java.io.tmpdir' isn't guaranteed to be defined
tmpDir = System.getProperty("user.home");
}
System.out.println("Temp directory: " + tmpDir);
File testDir = new File(tmpDir, "testDir");
testDir.mkdir();
File subDir = new File(testDir, "subDir");
subDir.mkdir();
System.out.println("Created directory: " + testDir);
System.out.println("Created sub-directory: " + subDir);
JFileChooser fileChooser = new JFileChooser(testDir);
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
try {
res = fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION ||
testDir.getCanonicalPath().equals(fileChooser.getSelectedFile().getCanonicalPath());
} catch (IOException e) {
res = false;
e.printStackTrace();
}
try {
subDir.delete();
testDir.delete();
} catch (SecurityException e) {
e.printStackTrace();
}
}
public void destroy() {
if (!res) {
throw new RuntimeException("BackSpace keyboard button does not lead to parent directory");
}
}
}
此差异已折叠。
...@@ -54,9 +54,6 @@ public class SerializationTest { ...@@ -54,9 +54,6 @@ public class SerializationTest {
JLayer newLayer = (JLayer) inputStream.readObject(); JLayer newLayer = (JLayer) inputStream.readObject();
if (newLayer.getLayout() == null) {
throw new RuntimeException("JLayer's layout is null");
}
if (newLayer.getGlassPane() == null) { if (newLayer.getGlassPane() == null) {
throw new RuntimeException("JLayer's glassPane is null"); throw new RuntimeException("JLayer's glassPane is null");
} }
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册