提交 b768b86e 编写于 作者: L lana

Merge

...@@ -92,11 +92,11 @@ FILES_java = \ ...@@ -92,11 +92,11 @@ FILES_java = \
sun/text/normalizer/SymbolTable.java \ sun/text/normalizer/SymbolTable.java \
sun/text/normalizer/Trie.java \ sun/text/normalizer/Trie.java \
sun/text/normalizer/TrieIterator.java \ sun/text/normalizer/TrieIterator.java \
sun/text/normalizer/UBiDiProps.java \
sun/text/normalizer/UCharacter.java \ sun/text/normalizer/UCharacter.java \
sun/text/normalizer/UCharacterIterator.java \ sun/text/normalizer/UCharacterIterator.java \
sun/text/normalizer/UCharacterProperty.java \ sun/text/normalizer/UCharacterProperty.java \
sun/text/normalizer/UCharacterPropertyReader.java \ sun/text/normalizer/UCharacterPropertyReader.java \
sun/text/normalizer/UProperty.java \
sun/text/normalizer/UTF16.java \ sun/text/normalizer/UTF16.java \
sun/text/normalizer/UnicodeMatcher.java \ sun/text/normalizer/UnicodeMatcher.java \
sun/text/normalizer/UnicodeSet.java \ sun/text/normalizer/UnicodeSet.java \
......
...@@ -64,7 +64,8 @@ BIFILES = $(TEXT_CLASSDIR)/CharacterBreakIteratorData \ ...@@ -64,7 +64,8 @@ BIFILES = $(TEXT_CLASSDIR)/CharacterBreakIteratorData \
$(TEXT_CLASSDIR)/SentenceBreakIteratorData $(TEXT_CLASSDIR)/SentenceBreakIteratorData
ICU_FILES = $(TEXT_CLASSDIR)/unorm.icu \ ICU_FILES = $(TEXT_CLASSDIR)/unorm.icu \
$(TEXT_CLASSDIR)/uprops.icu $(TEXT_CLASSDIR)/uprops.icu \
$(TEXT_CLASSDIR)/ubidi.icu
# builder # builder
GENERATEBREAKITERATORDATA_JARFILE = \ GENERATEBREAKITERATORDATA_JARFILE = \
...@@ -89,7 +90,7 @@ $(BIFILES): $(GENERATEBREAKITERATORDATA_JARFILE) \ ...@@ -89,7 +90,7 @@ $(BIFILES): $(GENERATEBREAKITERATORDATA_JARFILE) \
build: $(BIFILES) $(ICU_FILES) build: $(BIFILES) $(ICU_FILES)
# #
# Extra rules to copy unorm.icu and uprops.icu # Extra rules to copy unorm.icu, uprops.icu, and ubidi.icu
# #
$(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu $(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu
$(install-file) $(install-file)
...@@ -97,6 +98,9 @@ $(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu ...@@ -97,6 +98,9 @@ $(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu
$(TEXT_CLASSDIR)/uprops.icu: $(TEXT_SRCDIR)/uprops.icu $(TEXT_CLASSDIR)/uprops.icu: $(TEXT_SRCDIR)/uprops.icu
$(install-file) $(install-file)
$(TEXT_CLASSDIR)/ubidi.icu: $(TEXT_SRCDIR)/ubidi.icu
$(install-file)
clean clobber:: clean clobber::
$(RM) -r $(TEXT_CLASSES) $(RM) -r $(TEXT_CLASSES)
$(RM) -r $(BIFILES) $(RM) -r $(BIFILES)
......
...@@ -144,6 +144,55 @@ class CharacterData00 extends CharacterData { ...@@ -144,6 +144,55 @@ class CharacterData00 extends CharacterData {
case 0x1FBC : mapChar = 0x1FB3; break; case 0x1FBC : mapChar = 0x1FB3; break;
case 0x1FCC : mapChar = 0x1FC3; break; case 0x1FCC : mapChar = 0x1FC3; break;
case 0x1FFC : mapChar = 0x1FF3; break; case 0x1FFC : mapChar = 0x1FF3; break;
case 0x023A : mapChar = 0x2C65; break;
case 0x023E : mapChar = 0x2C66; break;
case 0x10A0 : mapChar = 0x2D00; break;
case 0x10A1 : mapChar = 0x2D01; break;
case 0x10A2 : mapChar = 0x2D02; break;
case 0x10A3 : mapChar = 0x2D03; break;
case 0x10A4 : mapChar = 0x2D04; break;
case 0x10A5 : mapChar = 0x2D05; break;
case 0x10A6 : mapChar = 0x2D06; break;
case 0x10A7 : mapChar = 0x2D07; break;
case 0x10A8 : mapChar = 0x2D08; break;
case 0x10A9 : mapChar = 0x2D09; break;
case 0x10AA : mapChar = 0x2D0A; break;
case 0x10AB : mapChar = 0x2D0B; break;
case 0x10AC : mapChar = 0x2D0C; break;
case 0x10AD : mapChar = 0x2D0D; break;
case 0x10AE : mapChar = 0x2D0E; break;
case 0x10AF : mapChar = 0x2D0F; break;
case 0x10B0 : mapChar = 0x2D10; break;
case 0x10B1 : mapChar = 0x2D11; break;
case 0x10B2 : mapChar = 0x2D12; break;
case 0x10B3 : mapChar = 0x2D13; break;
case 0x10B4 : mapChar = 0x2D14; break;
case 0x10B5 : mapChar = 0x2D15; break;
case 0x10B6 : mapChar = 0x2D16; break;
case 0x10B7 : mapChar = 0x2D17; break;
case 0x10B8 : mapChar = 0x2D18; break;
case 0x10B9 : mapChar = 0x2D19; break;
case 0x10BA : mapChar = 0x2D1A; break;
case 0x10BB : mapChar = 0x2D1B; break;
case 0x10BC : mapChar = 0x2D1C; break;
case 0x10BD : mapChar = 0x2D1D; break;
case 0x10BE : mapChar = 0x2D1E; break;
case 0x10BF : mapChar = 0x2D1F; break;
case 0x10C0 : mapChar = 0x2D20; break;
case 0x10C1 : mapChar = 0x2D21; break;
case 0x10C2 : mapChar = 0x2D22; break;
case 0x10C3 : mapChar = 0x2D23; break;
case 0x10C4 : mapChar = 0x2D24; break;
case 0x10C5 : mapChar = 0x2D25; break;
case 0x1E9E : mapChar = 0x00DF; break;
case 0x2C62 : mapChar = 0x026B; break;
case 0x2C63 : mapChar = 0x1D7D; break;
case 0x2C64 : mapChar = 0x027D; break;
case 0x2C6D : mapChar = 0x0251; break;
case 0x2C6E : mapChar = 0x0271; break;
case 0x2C6F : mapChar = 0x0250; break;
case 0xA77D : mapChar = 0x1D79; 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;
...@@ -196,6 +245,54 @@ class CharacterData00 extends CharacterData { ...@@ -196,6 +245,54 @@ class CharacterData00 extends CharacterData {
case 0x1FB3 : mapChar = 0x1FBC; break; case 0x1FB3 : mapChar = 0x1FBC; break;
case 0x1FC3 : mapChar = 0x1FCC; break; case 0x1FC3 : mapChar = 0x1FCC; break;
case 0x1FF3 : mapChar = 0x1FFC; break; case 0x1FF3 : mapChar = 0x1FFC; break;
case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break;
case 0x026B : mapChar = 0x2C62; break;
case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break;
case 0x1D79 : mapChar = 0xA77D; break;
case 0x1D7D : mapChar = 0x2C63; break;
case 0x2C65 : mapChar = 0x023A; break;
case 0x2C66 : mapChar = 0x023E; break;
case 0x2D00 : mapChar = 0x10A0; break;
case 0x2D01 : mapChar = 0x10A1; break;
case 0x2D02 : mapChar = 0x10A2; break;
case 0x2D03 : mapChar = 0x10A3; break;
case 0x2D04 : mapChar = 0x10A4; break;
case 0x2D05 : mapChar = 0x10A5; break;
case 0x2D06 : mapChar = 0x10A6; break;
case 0x2D07 : mapChar = 0x10A7; break;
case 0x2D08 : mapChar = 0x10A8; break;
case 0x2D09 : mapChar = 0x10A9; break;
case 0x2D0A : mapChar = 0x10AA; break;
case 0x2D0B : mapChar = 0x10AB; break;
case 0x2D0C : mapChar = 0x10AC; break;
case 0x2D0D : mapChar = 0x10AD; break;
case 0x2D0E : mapChar = 0x10AE; break;
case 0x2D0F : mapChar = 0x10AF; break;
case 0x2D10 : mapChar = 0x10B0; break;
case 0x2D11 : mapChar = 0x10B1; break;
case 0x2D12 : mapChar = 0x10B2; break;
case 0x2D13 : mapChar = 0x10B3; break;
case 0x2D14 : mapChar = 0x10B4; break;
case 0x2D15 : mapChar = 0x10B5; break;
case 0x2D16 : mapChar = 0x10B6; break;
case 0x2D17 : mapChar = 0x10B7; break;
case 0x2D18 : mapChar = 0x10B8; break;
case 0x2D19 : mapChar = 0x10B9; break;
case 0x2D1A : mapChar = 0x10BA; break;
case 0x2D1B : mapChar = 0x10BB; break;
case 0x2D1C : mapChar = 0x10BC; break;
case 0x2D1D : mapChar = 0x10BD; break;
case 0x2D1E : mapChar = 0x10BE; break;
case 0x2D1F : mapChar = 0x10BF; break;
case 0x2D20 : mapChar = 0x10C0; break;
case 0x2D21 : mapChar = 0x10C1; break;
case 0x2D22 : mapChar = 0x10C2; break;
case 0x2D23 : mapChar = 0x10C3; break;
case 0x2D24 : mapChar = 0x10C4; break;
case 0x2D25 : mapChar = 0x10C5; break;
// ch must have a 1:M case mapping, but we // ch must have a 1:M case mapping, but we
// can't handle it here. Return ch. // can't handle it here. Return ch.
// since mapChar is already set, no need // since mapChar is already set, no need
...@@ -315,6 +412,12 @@ class CharacterData00 extends CharacterData { ...@@ -315,6 +412,12 @@ class CharacterData00 extends CharacterData {
case 0x32BE: retval = 49; break; // CIRCLED NUMBER FORTY NINE case 0x32BE: retval = 49; break; // CIRCLED NUMBER FORTY NINE
case 0x32BF: retval = 50; break; // CIRCLED NUMBER FIFTY case 0x32BF: retval = 50; break; // CIRCLED NUMBER FIFTY
case 0x0D71: retval = 100; break; // MALAYALAM NUMBER ONE HUNDRED
case 0x0D72: retval = 1000; break; // MALAYALAM NUMBER ONE THOUSAND
case 0x2186: retval = 50; break; // ROMAN NUMERAL FIFTY EARLY FORM
case 0x2187: retval = 50000; break; // ROMAN NUMERAL FIFTY THOUSAND
case 0x2188: retval = 100000; break; // ROMAN NUMERAL ONE HUNDRED THOUSAND
default: retval = -2; break; default: retval = -2; break;
} }
break; break;
...@@ -383,6 +486,54 @@ class CharacterData00 extends CharacterData { ...@@ -383,6 +486,54 @@ class CharacterData00 extends CharacterData {
case 0x00B5 : mapChar = 0x039C; break; case 0x00B5 : mapChar = 0x039C; break;
case 0x017F : mapChar = 0x0053; break; case 0x017F : mapChar = 0x0053; break;
case 0x1FBE : mapChar = 0x0399; break; case 0x1FBE : mapChar = 0x0399; break;
case 0x0250 : mapChar = 0x2C6F; break;
case 0x0251 : mapChar = 0x2C6D; break;
case 0x026B : mapChar = 0x2C62; break;
case 0x0271 : mapChar = 0x2C6E; break;
case 0x027D : mapChar = 0x2C64; break;
case 0x1D79 : mapChar = 0xA77D; break;
case 0x1D7D : mapChar = 0x2C63; break;
case 0x2C65 : mapChar = 0x023A; break;
case 0x2C66 : mapChar = 0x023E; break;
case 0x2D00 : mapChar = 0x10A0; break;
case 0x2D01 : mapChar = 0x10A1; break;
case 0x2D02 : mapChar = 0x10A2; break;
case 0x2D03 : mapChar = 0x10A3; break;
case 0x2D04 : mapChar = 0x10A4; break;
case 0x2D05 : mapChar = 0x10A5; break;
case 0x2D06 : mapChar = 0x10A6; break;
case 0x2D07 : mapChar = 0x10A7; break;
case 0x2D08 : mapChar = 0x10A8; break;
case 0x2D09 : mapChar = 0x10A9; break;
case 0x2D0A : mapChar = 0x10AA; break;
case 0x2D0B : mapChar = 0x10AB; break;
case 0x2D0C : mapChar = 0x10AC; break;
case 0x2D0D : mapChar = 0x10AD; break;
case 0x2D0E : mapChar = 0x10AE; break;
case 0x2D0F : mapChar = 0x10AF; break;
case 0x2D10 : mapChar = 0x10B0; break;
case 0x2D11 : mapChar = 0x10B1; break;
case 0x2D12 : mapChar = 0x10B2; break;
case 0x2D13 : mapChar = 0x10B3; break;
case 0x2D14 : mapChar = 0x10B4; break;
case 0x2D15 : mapChar = 0x10B5; break;
case 0x2D16 : mapChar = 0x10B6; break;
case 0x2D17 : mapChar = 0x10B7; break;
case 0x2D18 : mapChar = 0x10B8; break;
case 0x2D19 : mapChar = 0x10B9; break;
case 0x2D1A : mapChar = 0x10BA; break;
case 0x2D1B : mapChar = 0x10BB; break;
case 0x2D1C : mapChar = 0x10BC; break;
case 0x2D1D : mapChar = 0x10BD; break;
case 0x2D1E : mapChar = 0x10BE; break;
case 0x2D1F : mapChar = 0x10BF; break;
case 0x2D20 : mapChar = 0x10C0; break;
case 0x2D21 : mapChar = 0x10C1; break;
case 0x2D22 : mapChar = 0x10C2; break;
case 0x2D23 : mapChar = 0x10C3; break;
case 0x2D24 : mapChar = 0x10C4; break;
case 0x2D25 : mapChar = 0x10C5; break;
default : mapChar = Character.ERROR; break; default : mapChar = Character.ERROR; break;
} }
} }
......
...@@ -218,6 +218,48 @@ class CharacterData01 extends CharacterData { ...@@ -218,6 +218,48 @@ class CharacterData01 extends CharacterData {
case 0x10132: retval = 80000; break; // AEGEAN NUMBER EIGHTY THOUSAND case 0x10132: retval = 80000; break; // AEGEAN NUMBER EIGHTY THOUSAND
case 0x10133: retval = 90000; break; // AEGEAN NUMBER NINETY THOUSAND case 0x10133: retval = 90000; break; // AEGEAN NUMBER NINETY THOUSAND
case 0x10323: retval = 50; break; // OLD ITALIC NUMERAL FIFTY case 0x10323: retval = 50; break; // OLD ITALIC NUMERAL FIFTY
case 0x010144: retval = 50; break; // ACROPHONIC ATTIC FIFTY
case 0x010145: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED
case 0x010146: retval = 5000; break; // ACROPHONIC ATTIC FIVE THOUSAND
case 0x010147: retval = 50000; break; // ACROPHONIC ATTIC FIFTY THOUSAND
case 0x01014A: retval = 50; break; // ACROPHONIC ATTIC FIFTY TALENTS
case 0x01014B: retval = 100; break; // ACROPHONIC ATTIC ONE HUNDRED TALENTS
case 0x01014C: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED TALENTS
case 0x01014D: retval = 1000; break; // ACROPHONIC ATTIC ONE THOUSAND TALENTS
case 0x01014E: retval = 5000; break; // ACROPHONIC ATTIC FIVE THOUSAND TALENTS
case 0x010151: retval = 50; break; // ACROPHONIC ATTIC FIFTY STATERS
case 0x010152: retval = 100; break; // ACROPHONIC ATTIC ONE HUNDRED STATERS
case 0x010153: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED STATERS
case 0x010154: retval = 1000; break; // ACROPHONIC ATTIC ONE THOUSAND STATERS
case 0x010155: retval = 10000; break; // ACROPHONIC ATTIC TEN THOUSAND STATERS
case 0x010156: retval = 50000; break; // ACROPHONIC ATTIC FIFTY THOUSAND STATERS
case 0x010166: retval = 50; break; // ACROPHONIC TROEZENIAN FIFTY
case 0x010167: retval = 50; break; // ACROPHONIC TROEZENIAN FIFTY ALTERNATE FORM
case 0x010168: retval = 50; break; // ACROPHONIC HERMIONIAN FIFTY
case 0x010169: retval = 50; break; // ACROPHONIC THESPIAN FIFTY
case 0x01016A: retval = 100; break; // ACROPHONIC THESPIAN ONE HUNDRED
case 0x01016B: retval = 300; break; // ACROPHONIC THESPIAN THREE HUNDRED
case 0x01016C: retval = 500; break; // ACROPHONIC EPIDAUREAN FIVE HUNDRED
case 0x01016D: retval = 500; break; // ACROPHONIC TROEZENIAN FIVE HUNDRED
case 0x01016E: retval = 500; break; // ACROPHONIC THESPIAN FIVE HUNDRED
case 0x01016F: retval = 500; break; // ACROPHONIC CARYSTIAN FIVE HUNDRED
case 0x010170: retval = 500; break; // ACROPHONIC NAXIAN FIVE HUNDRED
case 0x010171: retval = 1000; break; // ACROPHONIC THESPIAN ONE THOUSAND
case 0x010172: retval = 5000; break; // ACROPHONIC THESPIAN FIVE THOUSAND
case 0x010174: retval = 50; break; // ACROPHONIC STRATIAN FIFTY MNAS
case 0x010341: retval = 90; break; // GOTHIC LETTER NINETY
case 0x01034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED
case 0x0103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED
case 0x010919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED
case 0x010A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED
case 0x010A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND
case 0x01D36C: retval = 40; break; // COUNTING ROD TENS DIGIT FOUR
case 0x01D36D: retval = 50; break; // COUNTING ROD TENS DIGIT FIVE
case 0x01D36E: retval = 60; break; // COUNTING ROD TENS DIGIT SIX
case 0x01D36F: retval = 70; break; // COUNTING ROD TENS DIGIT SEVEN
case 0x01D370: retval = 80; break; // COUNTING ROD TENS DIGIT EIGHT
case 0x01D371: retval = 90; break; // COUNTING ROD TENS DIGIT NINE
default: retval = -2; break; default: retval = -2; break;
} }
......
# SpecialCasing-4.0.0.txt # SpecialCasing-5.1.0.txt
# Date: 2003-03-14, 20:22:04 GMT [MD] # Date: 2008-03-03, 21:58:10 GMT [MD]
#
# Unicode Character Database
# Copyright (c) 1991-2008 Unicode, Inc.
# For terms of use, see http://www.unicode.org/terms_of_use.html
# For documentation, see UCD.html
# #
# Special Casing Properties # Special Casing Properties
# #
# This file is a supplement to the UnicodeData file. # This file is a supplement to the UnicodeData file.
# It contains additional information about the casing of Unicode characters. # It contains additional information about the casing of Unicode characters.
# (For compatibility, the UnicodeData.txt file only contains case mappings for # (For compatibility, the UnicodeData.txt file only contains case mappings for
# characters where they are 1-1, and does not have locale-specific mappings.) # characters where they are 1-1, and independent of context and language.
# For more information, see the discussion of Case Mappings in the Unicode Standard. # For more information, see the discussion of Case Mappings in the Unicode Standard.
# #
# All code points not listed in this file that do not have a simple case mappings # All code points not listed in this file that do not have a simple case mappings
...@@ -18,31 +23,31 @@ ...@@ -18,31 +23,31 @@
# #
# <code>; <lower> ; <title> ; <upper> ; (<condition_list> ;)? # <comment> # <code>; <lower> ; <title> ; <upper> ; (<condition_list> ;)? # <comment>
# #
# <code>, <lower>, <title>, and <upper> provide character values in hex. If there is more than # <code>, <lower>, <title>, and <upper> provide character values in hex. If there is more
# one character, they are separated by spaces. Other than as used to separate elements, # than one character, they are separated by spaces. Other than as used to separate
# spaces are to be ignored. # elements, spaces are to be ignored.
# #
# The <condition_list> is optional. Where present, it consists of one or more locales or contexts, # The <condition_list> is optional. Where present, it consists of one or more language IDs
# separated by spaces. In these conditions: # or contexts, separated by spaces. In these conditions:
# - A condition list overrides the normal behavior if all of the listed conditions are true. # - A condition list overrides the normal behavior if all of the listed conditions are true.
# - The context is always the context of the characters in the original string, # - The context is always the context of the characters in the original string,
# NOT in the resulting string. # NOT in the resulting string.
# - Case distinctions in the condition list are not significant. # - Case distinctions in the condition list are not significant.
# - Conditions preceded by "Not_" represent the negation of the condition. # - Conditions preceded by "Not_" represent the negation of the condition.
# The condition list is not represented in the UCD as a formal property.
# #
# A locale is defined as: # A language ID is defined by BCP 47, with '-' and '_' treated equivalently.
# <locale> := <ISO_639_code> ( "_" <ISO_3166_code> ( "_" <variant> )? )?
# <ISO_3166_code> := 2-letter ISO country code,
# <ISO_639_code> := 2-letter ISO language code
# #
# A context is one of the following, as defined in the Unicode Standard: # A context for a character C is defined by Section 3.13 Default Case
# Final_Sigma, After_Soft_Dotted, More_Above, Before_Dot, Not_Before_Dot, After_I # Operations, of The Unicode Standard, Version 5.0.
# (This is identical to the context defined by Unicode 4.1.0,
# as specified in http://www.unicode.org/versions/Unicode4.1.0/)
# #
# Parsers of this file must be prepared to deal with future additions to this format: # Parsers of this file must be prepared to deal with future additions to this format:
# * Additional contexts # * Additional contexts
# * Additional fields # * Additional fields
# ================================================================================ # ================================================================================
# @missing 0000..10FFFF; <slc>; <stc>; <suc>
# ================================================================================ # ================================================================================
# Unconditional mappings # Unconditional mappings
# ================================================================================ # ================================================================================
...@@ -170,7 +175,7 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH ...@@ -170,7 +175,7 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
1FF3; 1FF3; 1FFC; 03A9 0399; # GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI 1FF3; 1FF3; 1FFC; 03A9 0399; # GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI
1FFC; 1FF3; 1FFC; 03A9 0399; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI 1FFC; 1FF3; 1FFC; 03A9 0399; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
# Some characters with YPOGEGRAMMENI are also have no corresponding titlecases # Some characters with YPOGEGRAMMENI also have no corresponding titlecases
1FB2; 1FB2; 1FBA 0345; 1FBA 0399; # GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI 1FB2; 1FB2; 1FBA 0345; 1FBA 0399; # GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI
1FB4; 1FB4; 0386 0345; 0386 0399; # GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI 1FB4; 1FB4; 0386 0345; 0386 0399; # GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI
...@@ -184,7 +189,14 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH ...@@ -184,7 +189,14 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
1FF7; 1FF7; 03A9 0342 0345; 03A9 0342 0399; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI 1FF7; 1FF7; 03A9 0342 0345; 03A9 0342 0399; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI
# ================================================================================ # ================================================================================
# Conditional mappings # Conditional Mappings
# The remainder of this file provides conditional casing data used to produce
# full case mappings.
# ================================================================================
# Language-Insensitive Mappings
# These are characters whose full case mappings do not depend on language, but do
# depend on context (which characters come before or after). For more information
# see the header of this file and the Unicode Standard.
# ================================================================================ # ================================================================================
# Special case for final form of sigma # Special case for final form of sigma
...@@ -203,7 +215,10 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH ...@@ -203,7 +215,10 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
# 03C2; 03C3; 03A3; 03A3; Not_Final_Sigma; # GREEK SMALL LETTER FINAL SIGMA # 03C2; 03C3; 03A3; 03A3; Not_Final_Sigma; # GREEK SMALL LETTER FINAL SIGMA
# ================================================================================ # ================================================================================
# Locale-sensitive mappings # Language-Sensitive Mappings
# These are characters whose full case mappings depend on language and perhaps also
# context (which characters come before or after). For more information
# see the header of this file and the Unicode Standard.
# ================================================================================ # ================================================================================
# Lithuanian # Lithuanian
...@@ -254,3 +269,6 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH ...@@ -254,3 +269,6 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
# Note: the following case is already in the UnicodeData file. # Note: the following case is already in the UnicodeData file.
# 0131; 0131; 0049; 0049; tr; # LATIN SMALL LETTER DOTLESS I # 0131; 0131; 0049; 0049; tr; # LATIN SMALL LETTER DOTLESS I
# EOF
...@@ -279,20 +279,22 @@ class GTKIconFactory { ...@@ -279,20 +279,22 @@ class GTKIconFactory {
public void paintIcon(SynthContext context, Graphics g, int x, int y, public void paintIcon(SynthContext context, Graphics g, int x, int y,
int w, int h) { int w, int h) {
JToolBar toolbar = (JToolBar)context.getComponent(); if (context != null) {
Orientation orientation = JToolBar toolbar = (JToolBar)context.getComponent();
(toolbar.getOrientation() == JToolBar.HORIZONTAL ? Orientation orientation =
Orientation.HORIZONTAL : Orientation.VERTICAL); (toolbar.getOrientation() == JToolBar.HORIZONTAL ?
Orientation.HORIZONTAL : Orientation.VERTICAL);
if (style == null) {
style = SynthLookAndFeel.getStyleFactory().getStyle( if (style == null) {
context.getComponent(), GTKRegion.HANDLE_BOX); style = SynthLookAndFeel.getStyleFactory().getStyle(
} context.getComponent(), GTKRegion.HANDLE_BOX);
context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX, }
style, SynthConstants.ENABLED); context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX,
style, SynthConstants.ENABLED);
GTKPainter.INSTANCE.paintIcon(context, g, GTKPainter.INSTANCE.paintIcon(context, g,
getMethod(), x, y, w, h, orientation); getMethod(), x, y, w, h, orientation);
}
} }
public int getIconWidth(SynthContext context) { public int getIconWidth(SynthContext context) {
...@@ -336,12 +338,14 @@ class GTKIconFactory { ...@@ -336,12 +338,14 @@ class GTKIconFactory {
public void paintIcon(SynthContext context, Graphics g, int x, int y, public void paintIcon(SynthContext context, Graphics g, int x, int y,
int w, int h) { int w, int h) {
ArrowType arrowDir = ArrowType.RIGHT; if (context != null) {
if (!context.getComponent().getComponentOrientation().isLeftToRight()) { ArrowType arrowDir = ArrowType.RIGHT;
arrowDir = ArrowType.LEFT; if (!context.getComponent().getComponentOrientation().isLeftToRight()) {
arrowDir = ArrowType.LEFT;
}
GTKPainter.INSTANCE.paintIcon(context, g,
getMethod(), x, y, w, h, arrowDir);
} }
GTKPainter.INSTANCE.paintIcon(context, g,
getMethod(), x, y, w, h, arrowDir);
} }
} }
} }
...@@ -39,6 +39,8 @@ import java.io.File; ...@@ -39,6 +39,8 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import sun.awt.shell.ShellFolder; import sun.awt.shell.ShellFolder;
import sun.awt.OSInfo; import sun.awt.OSInfo;
...@@ -1143,7 +1145,11 @@ public class WindowsFileChooserUI extends BasicFileChooserUI { ...@@ -1143,7 +1145,11 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
File[] baseFolders; File[] baseFolders;
if (useShellFolder) { if (useShellFolder) {
baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders"); baseFolders = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
public File[] run() {
return (File[]) ShellFolder.get("fileChooserComboBoxFolders");
}
});
} else { } else {
baseFolders = fsv.getRoots(); baseFolders = fsv.getRoots();
} }
......
/* /*
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1996-2009 Sun Microsystems, Inc. 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
...@@ -27,26 +27,41 @@ package java.beans; ...@@ -27,26 +27,41 @@ package java.beans;
import com.sun.beans.finder.ClassFinder; import com.sun.beans.finder.ClassFinder;
import java.applet.*; import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.applet.AudioClip;
import java.awt.*; import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.beans.AppletInitializer;
import java.beans.beancontext.BeanContext; import java.beans.beancontext.BeanContext;
import java.io.*; import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor; import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.io.StreamCorruptedException;
import java.net.URL; import java.net.URL;
import java.lang.reflect.Array;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import sun.awt.AppContext;
/** /**
* This class provides some general purpose beans control methods. * This class provides some general purpose beans control methods.
*/ */
public class Beans { public class Beans {
private static final Object DESIGN_TIME = new Object();
private static final Object GUI_AVAILABLE = new Object();
/** /**
* <p> * <p>
...@@ -59,12 +74,12 @@ public class Beans { ...@@ -59,12 +74,12 @@ public class Beans {
* @param beanName the name of the bean within the class-loader. * @param beanName the name of the bean within the class-loader.
* For example "sun.beanbox.foobah" * For example "sun.beanbox.foobah"
* *
* @exception java.lang.ClassNotFoundException if the class of a serialized * @exception ClassNotFoundException if the class of a serialized
* object could not be found. * object could not be found.
* @exception java.io.IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
*/ */
public static Object instantiate(ClassLoader cls, String beanName) throws java.io.IOException, ClassNotFoundException { public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException {
return Beans.instantiate(cls, beanName, null, null); return Beans.instantiate(cls, beanName, null, null);
} }
...@@ -80,12 +95,12 @@ public class Beans { ...@@ -80,12 +95,12 @@ public class Beans {
* For example "sun.beanbox.foobah" * For example "sun.beanbox.foobah"
* @param beanContext The BeanContext in which to nest the new bean * @param beanContext The BeanContext in which to nest the new bean
* *
* @exception java.lang.ClassNotFoundException if the class of a serialized * @exception ClassNotFoundException if the class of a serialized
* object could not be found. * object could not be found.
* @exception java.io.IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
*/ */
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException { public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
return Beans.instantiate(cls, beanName, beanContext, null); return Beans.instantiate(cls, beanName, beanContext, null);
} }
...@@ -135,19 +150,19 @@ public class Beans { ...@@ -135,19 +150,19 @@ public class Beans {
* @param beanContext The BeanContext in which to nest the new bean * @param beanContext The BeanContext in which to nest the new bean
* @param initializer The AppletInitializer for the new bean * @param initializer The AppletInitializer for the new bean
* *
* @exception java.lang.ClassNotFoundException if the class of a serialized * @exception ClassNotFoundException if the class of a serialized
* object could not be found. * object could not be found.
* @exception java.io.IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
*/ */
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer) public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
throws java.io.IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
java.io.InputStream ins; InputStream ins;
java.io.ObjectInputStream oins = null; ObjectInputStream oins = null;
Object result = null; Object result = null;
boolean serialized = false; boolean serialized = false;
java.io.IOException serex = null; IOException serex = null;
// If the given classloader is null, we check if an // If the given classloader is null, we check if an
// system classloader is available and (if so) // system classloader is available and (if so)
...@@ -166,8 +181,8 @@ public class Beans { ...@@ -166,8 +181,8 @@ public class Beans {
// Try to find a serialized object with this name // Try to find a serialized object with this name
final String serName = beanName.replace('.','/').concat(".ser"); final String serName = beanName.replace('.','/').concat(".ser");
final ClassLoader loader = cls; final ClassLoader loader = cls;
ins = (InputStream)java.security.AccessController.doPrivileged ins = (InputStream)AccessController.doPrivileged
(new java.security.PrivilegedAction() { (new PrivilegedAction() {
public Object run() { public Object run() {
if (loader == null) if (loader == null)
return ClassLoader.getSystemResourceAsStream(serName); return ClassLoader.getSystemResourceAsStream(serName);
...@@ -185,7 +200,7 @@ public class Beans { ...@@ -185,7 +200,7 @@ public class Beans {
result = oins.readObject(); result = oins.readObject();
serialized = true; serialized = true;
oins.close(); oins.close();
} catch (java.io.IOException ex) { } catch (IOException ex) {
ins.close(); ins.close();
// Drop through and try opening the class. But remember // Drop through and try opening the class. But remember
// the exception in case we can't find the class either. // the exception in case we can't find the class either.
...@@ -264,8 +279,8 @@ public class Beans { ...@@ -264,8 +279,8 @@ public class Beans {
final ClassLoader cloader = cls; final ClassLoader cloader = cls;
objectUrl = (URL) objectUrl = (URL)
java.security.AccessController.doPrivileged AccessController.doPrivileged
(new java.security.PrivilegedAction() { (new PrivilegedAction() {
public Object run() { public Object run() {
if (cloader == null) if (cloader == null)
return ClassLoader.getSystemResource return ClassLoader.getSystemResource
...@@ -377,10 +392,11 @@ public class Beans { ...@@ -377,10 +392,11 @@ public class Beans {
* @return True if we are running in an application construction * @return True if we are running in an application construction
* environment. * environment.
* *
* @see java.beans.DesignMode * @see DesignMode
*/ */
public static boolean isDesignTime() { public static boolean isDesignTime() {
return designTime; Object value = AppContext.getAppContext().get(DESIGN_TIME);
return (value instanceof Boolean) && (Boolean) value;
} }
/** /**
...@@ -393,11 +409,12 @@ public class Beans { ...@@ -393,11 +409,12 @@ public class Beans {
* false in a server environment or if an application is * false in a server environment or if an application is
* running as part of a batch job. * running as part of a batch job.
* *
* @see java.beans.Visibility * @see Visibility
* *
*/ */
public static boolean isGuiAvailable() { public static boolean isGuiAvailable() {
return guiAvailable; Object value = AppContext.getAppContext().get(GUI_AVAILABLE);
return (value instanceof Boolean) ? (Boolean) value : !GraphicsEnvironment.isHeadless();
} }
/** /**
...@@ -423,7 +440,7 @@ public class Beans { ...@@ -423,7 +440,7 @@ public class Beans {
if (sm != null) { if (sm != null) {
sm.checkPropertiesAccess(); sm.checkPropertiesAccess();
} }
designTime = isDesignTime; AppContext.getAppContext().put(DESIGN_TIME, Boolean.valueOf(isDesignTime));
} }
/** /**
...@@ -449,14 +466,7 @@ public class Beans { ...@@ -449,14 +466,7 @@ public class Beans {
if (sm != null) { if (sm != null) {
sm.checkPropertiesAccess(); sm.checkPropertiesAccess();
} }
guiAvailable = isGuiAvailable; AppContext.getAppContext().put(GUI_AVAILABLE, Boolean.valueOf(isGuiAvailable));
}
private static boolean designTime;
private static boolean guiAvailable;
static {
guiAvailable = !GraphicsEnvironment.isHeadless();
} }
} }
...@@ -501,7 +511,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream ...@@ -501,7 +511,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream
class BeansAppletContext implements AppletContext { class BeansAppletContext implements AppletContext {
Applet target; Applet target;
java.util.Hashtable imageCache = new java.util.Hashtable(); Hashtable imageCache = new Hashtable();
BeansAppletContext(Applet target) { BeansAppletContext(Applet target) {
this.target = target; this.target = target;
...@@ -546,8 +556,8 @@ class BeansAppletContext implements AppletContext { ...@@ -546,8 +556,8 @@ class BeansAppletContext implements AppletContext {
return null; return null;
} }
public java.util.Enumeration getApplets() { public Enumeration getApplets() {
java.util.Vector applets = new java.util.Vector(); Vector applets = new Vector();
applets.addElement(target); applets.addElement(target);
return applets.elements(); return applets.elements();
} }
...@@ -573,7 +583,7 @@ class BeansAppletContext implements AppletContext { ...@@ -573,7 +583,7 @@ class BeansAppletContext implements AppletContext {
return null; return null;
} }
public java.util.Iterator getStreamKeys(){ public Iterator getStreamKeys(){
// We do nothing. // We do nothing.
return null; return null;
} }
......
/* /*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2009 Sun Microsystems, Inc. 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
...@@ -41,6 +41,7 @@ package java.beans; ...@@ -41,6 +41,7 @@ package java.beans;
* @author Mark Davidson * @author Mark Davidson
*/ */
public class IndexedPropertyChangeEvent extends PropertyChangeEvent { public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
private static final long serialVersionUID = -320227448495806870L;
private int index; private int index;
......
/* /*
* Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1996-2009 Sun Microsystems, Inc. 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
...@@ -36,6 +36,7 @@ package java.beans; ...@@ -36,6 +36,7 @@ package java.beans;
public public
class IntrospectionException extends Exception { class IntrospectionException extends Exception {
private static final long serialVersionUID = -3728150539969542619L;
/** /**
* Constructs an <code>IntrospectionException</code> with a * Constructs an <code>IntrospectionException</code> with a
......
/* /*
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1996-2009 Sun Microsystems, Inc. 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
...@@ -44,6 +44,7 @@ package java.beans; ...@@ -44,6 +44,7 @@ package java.beans;
*/ */
public class PropertyChangeEvent extends java.util.EventObject { public class PropertyChangeEvent extends java.util.EventObject {
private static final long serialVersionUID = 7042693688939648123L;
/** /**
* Constructs a new <code>PropertyChangeEvent</code>. * Constructs a new <code>PropertyChangeEvent</code>.
......
/* /*
* Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1996-2009 Sun Microsystems, Inc. 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
...@@ -33,7 +33,7 @@ package java.beans; ...@@ -33,7 +33,7 @@ package java.beans;
public public
class PropertyVetoException extends Exception { class PropertyVetoException extends Exception {
private static final long serialVersionUID = 129596057694162164L;
/** /**
* Constructs a <code>PropertyVetoException</code> with a * Constructs a <code>PropertyVetoException</code> with a
......
/* /*
* Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. 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
...@@ -48,6 +48,7 @@ import java.beans.beancontext.BeanContext; ...@@ -48,6 +48,7 @@ import java.beans.beancontext.BeanContext;
*/ */
public abstract class BeanContextEvent extends EventObject { public abstract class BeanContextEvent extends EventObject {
private static final long serialVersionUID = 7267998073569045052L;
/** /**
* Contruct a BeanContextEvent * Contruct a BeanContextEvent
......
/* /*
* Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. 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
...@@ -55,6 +55,7 @@ import java.util.Iterator; ...@@ -55,6 +55,7 @@ import java.util.Iterator;
* @see java.beans.beancontext.BeanContextMembershipListener * @see java.beans.beancontext.BeanContextMembershipListener
*/ */
public class BeanContextMembershipEvent extends BeanContextEvent { public class BeanContextMembershipEvent extends BeanContextEvent {
private static final long serialVersionUID = 3499346510334590959L;
/** /**
* Contruct a BeanContextMembershipEvent * Contruct a BeanContextMembershipEvent
......
/* /*
* Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1998-2009 Sun Microsystems, Inc. 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
...@@ -40,6 +40,7 @@ import java.util.Iterator; ...@@ -40,6 +40,7 @@ import java.util.Iterator;
*/ */
public class BeanContextServiceAvailableEvent extends BeanContextEvent { public class BeanContextServiceAvailableEvent extends BeanContextEvent {
private static final long serialVersionUID = -5333985775656400778L;
/** /**
* Construct a <code>BeanContextAvailableServiceEvent</code>. * Construct a <code>BeanContextAvailableServiceEvent</code>.
......
/* /*
* Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1998-2009 Sun Microsystems, Inc. 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
...@@ -37,6 +37,7 @@ import java.beans.beancontext.BeanContextServices; ...@@ -37,6 +37,7 @@ import java.beans.beancontext.BeanContextServices;
* </p> * </p>
*/ */
public class BeanContextServiceRevokedEvent extends BeanContextEvent { public class BeanContextServiceRevokedEvent extends BeanContextEvent {
private static final long serialVersionUID = -1295543154724961754L;
/** /**
* Construct a <code>BeanContextServiceEvent</code>. * Construct a <code>BeanContextServiceEvent</code>.
......
/* /*
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1998-2009 Sun Microsystems, Inc. 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
...@@ -60,6 +60,7 @@ import java.util.Locale; ...@@ -60,6 +60,7 @@ import java.util.Locale;
public class BeanContextServicesSupport extends BeanContextSupport public class BeanContextServicesSupport extends BeanContextSupport
implements BeanContextServices { implements BeanContextServices {
private static final long serialVersionUID = -8494482757288719206L;
/** /**
* <p> * <p>
...@@ -594,6 +595,7 @@ public class BeanContextServicesSupport extends BeanContextSupport ...@@ -594,6 +595,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
*/ */
protected static class BCSSServiceProvider implements Serializable { protected static class BCSSServiceProvider implements Serializable {
private static final long serialVersionUID = 861278251667444782L;
BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) { BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
super(); super();
......
...@@ -74,6 +74,7 @@ final class ConditionalSpecialCasing { ...@@ -74,6 +74,7 @@ final class ConditionalSpecialCasing {
new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE
new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE
new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
//# ================================================================================ //# ================================================================================
//# Turkish and Azeri //# Turkish and Azeri
...@@ -84,7 +85,10 @@ final class ConditionalSpecialCasing { ...@@ -84,7 +85,10 @@ final class ConditionalSpecialCasing {
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0) // # LATIN SMALL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I
//# ================================================================================
//# Other
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE
}; };
// A hash table that contains the above entries // A hash table that contains the above entries
......
...@@ -2451,14 +2451,21 @@ public final class String ...@@ -2451,14 +2451,21 @@ public final class String
} }
if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale); lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
} else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
lowerChar = Character.ERROR;
} else { } else {
lowerChar = Character.toLowerCase(srcChar); lowerChar = Character.toLowerCase(srcChar);
} }
if ((lowerChar == Character.ERROR) || if ((lowerChar == Character.ERROR) ||
(lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) { (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
if (lowerChar == Character.ERROR) { if (lowerChar == Character.ERROR) {
lowerCharArray = if (!localeDependent && srcChar == '\u0130') {
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale); lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
} else {
lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
}
} else if (srcCount == 2) { } else if (srcCount == 2) {
resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount; resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
continue; continue;
......
...@@ -552,14 +552,15 @@ public class PopupFactory { ...@@ -552,14 +552,15 @@ public class PopupFactory {
boolean result = false; boolean result = false;
Component component = getComponent(); Component component = getComponent();
if (owner != null && component != null) { if (owner != null && component != null) {
Container parent = (Container) SwingUtilities.getRoot(owner);
int popupWidth = component.getWidth(); int popupWidth = component.getWidth();
int popupHeight = component.getHeight(); int popupHeight = component.getHeight();
Rectangle parentBounds = parent.getBounds();
Container parent = (Container) SwingUtilities.getRoot(owner);
if (parent instanceof JFrame || if (parent instanceof JFrame ||
parent instanceof JDialog || parent instanceof JDialog ||
parent instanceof JWindow) { parent instanceof JWindow) {
Rectangle parentBounds = parent.getBounds();
Insets i = parent.getInsets(); Insets i = parent.getInsets();
parentBounds.x += i.left; parentBounds.x += i.left;
parentBounds.y += i.top; parentBounds.y += i.top;
...@@ -577,11 +578,11 @@ public class PopupFactory { ...@@ -577,11 +578,11 @@ public class PopupFactory {
.contains(x, y, popupWidth, popupHeight); .contains(x, y, popupWidth, popupHeight);
} }
} else if (parent instanceof JApplet) { } else if (parent instanceof JApplet) {
Rectangle parentBounds = parent.getBounds();
Point p = parent.getLocationOnScreen(); Point p = parent.getLocationOnScreen();
parentBounds.x = p.x; parentBounds.x = p.x;
parentBounds.y = p.y; parentBounds.y = p.y;
result = parentBounds result = parentBounds.contains(x, y, popupWidth, popupHeight);
.contains(x, y, popupWidth, popupHeight);
} }
} }
return result; return result;
......
/* /*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -778,35 +778,33 @@ public abstract class SwingWorker<T, V> implements RunnableFuture<T> { ...@@ -778,35 +778,33 @@ public abstract class SwingWorker<T, V> implements RunnableFuture<T> {
threadFactory); threadFactory);
appContext.put(SwingWorker.class, executorService); appContext.put(SwingWorker.class, executorService);
//register shutdown hook for this executor service // Don't use ShutdownHook here as it's not enough. We should track
// AppContext disposal instead of JVM shutdown, see 6799345 for details
final ExecutorService es = executorService; final ExecutorService es = executorService;
final Runnable shutdownHook = appContext.addPropertyChangeListener(AppContext.DISPOSED_PROPERTY_NAME,
new Runnable() { new PropertyChangeListener() {
final WeakReference<ExecutorService> executorServiceRef = @Override
new WeakReference<ExecutorService>(es); public void propertyChange(PropertyChangeEvent pce) {
public void run() { boolean disposed = (Boolean)pce.getNewValue();
final ExecutorService executorService = if (disposed) {
executorServiceRef.get(); final WeakReference<ExecutorService> executorServiceRef =
if (executorService != null) { new WeakReference<ExecutorService>(es);
AccessController.doPrivileged( final ExecutorService executorService =
new PrivilegedAction<Void>() { executorServiceRef.get();
public Void run() { if (executorService != null) {
executorService.shutdown(); AccessController.doPrivileged(
return null; new PrivilegedAction<Void>() {
public Void run() {
executorService.shutdown();
return null;
}
} }
}); );
}
} }
} }
}; }
);
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
public Void run() {
Runtime.getRuntime().addShutdownHook(
new Thread(shutdownHook));
return null;
}
});
} }
return executorService; return executorService;
} }
......
/* /*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. 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
...@@ -191,7 +191,12 @@ class TimerQueue implements Runnable ...@@ -191,7 +191,12 @@ class TimerQueue implements Runnable
} finally { } finally {
timer.getLock().unlock(); timer.getLock().unlock();
} }
} catch (InterruptedException ignore) { } catch (InterruptedException ie) {
// Shouldn't ignore InterruptedExceptions here, so AppContext
// is disposed gracefully, see 6799345 for details
if (AppContext.getAppContext().isDisposed()) {
break;
}
} }
} }
} }
......
...@@ -58,6 +58,8 @@ import sun.awt.OSInfo; ...@@ -58,6 +58,8 @@ import sun.awt.OSInfo;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.HashMap;
import sun.awt.AppContext;
/** /**
...@@ -1323,19 +1325,29 @@ public class UIManager implements Serializable ...@@ -1323,19 +1325,29 @@ public class UIManager implements Serializable
return; return;
} }
String metalLnf = getCrossPlatformLookAndFeelClassName(); // Try to get default LAF from system property, then from AppContext
String lnfDefault = metalLnf; // (6653395), then use cross-platform one by default.
String lafName = null;
HashMap lafData =
(HashMap) AppContext.getAppContext().remove("swing.lafdata");
if (lafData != null) {
lafName = (String) lafData.remove("defaultlaf");
}
if (lafName == null) {
lafName = getCrossPlatformLookAndFeelClassName();
}
lafName = swingProps.getProperty(defaultLAFKey, lafName);
String lnfName = "<undefined>" ;
try { try {
lnfName = swingProps.getProperty(defaultLAFKey, lnfDefault); setLookAndFeel(lafName);
setLookAndFeel(lnfName);
} catch (Exception e) { } catch (Exception e) {
try { throw new Error("Cannot load " + lafName);
lnfName = swingProps.getProperty(defaultLAFKey, metalLnf); }
setLookAndFeel(lnfName);
} catch (Exception e2) { // Set any properties passed through AppContext (6653395).
throw new Error("can't load " + lnfName); if (lafData != null) {
for (Object key: lafData.keySet()) {
UIManager.put(key, lafData.get(key));
} }
} }
} }
......
...@@ -27,6 +27,7 @@ package javax.swing.plaf.basic; ...@@ -27,6 +27,7 @@ package javax.swing.plaf.basic;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.concurrent.Callable;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.*; import javax.swing.filechooser.*;
import javax.swing.event.*; import javax.swing.event.*;
...@@ -223,113 +224,115 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh ...@@ -223,113 +224,115 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh
this.fid = fid; this.fid = fid;
} }
private void invokeLater(DoChangeContents runnable) {
runnables.addElement(runnable);
SwingUtilities.invokeLater(runnable);
}
public void run() { public void run() {
run0(); run0();
setBusy(false, fid); setBusy(false, fid);
} }
public void run0() { public void run0() {
FileSystemView fileSystem = filechooser.getFileSystemView(); DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
public DoChangeContents call() throws Exception {
FileSystemView fileSystem = filechooser.getFileSystemView();
File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled()); File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
Vector<File> acceptsList = new Vector<File>(); Vector<File> acceptsList = new Vector<File>();
if (isInterrupted()) { if (isInterrupted()) {
return; return null;
} }
// run through the file list, add directories and selectable files to fileCache // run through the file list, add directories and selectable files to fileCache
for (File file : list) { for (File file : list) {
if (filechooser.accept(file)) { if (filechooser.accept(file)) {
acceptsList.addElement(file); acceptsList.addElement(file);
} }
} }
if (isInterrupted()) { if (isInterrupted()) {
return; return null;
} }
// First sort alphabetically by filename // First sort alphabetically by filename
sort(acceptsList); sort(acceptsList);
Vector<File> newDirectories = new Vector<File>(50); Vector<File> newDirectories = new Vector<File>(50);
Vector<File> newFiles = new Vector<File>(); Vector<File> newFiles = new Vector<File>();
// run through list grabbing directories in chunks of ten // run through list grabbing directories in chunks of ten
for(int i = 0; i < acceptsList.size(); i++) { for (int i = 0; i < acceptsList.size(); i++) {
File f = acceptsList.elementAt(i); File f = acceptsList.elementAt(i);
boolean isTraversable = filechooser.isTraversable(f); boolean isTraversable = filechooser.isTraversable(f);
if (isTraversable) { if (isTraversable) {
newDirectories.addElement(f); newDirectories.addElement(f);
} else if (!isTraversable && filechooser.isFileSelectionEnabled()) { } else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
newFiles.addElement(f); newFiles.addElement(f);
} }
if(isInterrupted()) { if (isInterrupted()) {
return; return null;
} }
} }
Vector<File> newFileCache = new Vector<File>(newDirectories); Vector<File> newFileCache = new Vector<File>(newDirectories);
newFileCache.addAll(newFiles); newFileCache.addAll(newFiles);
int newSize = newFileCache.size(); int newSize = newFileCache.size();
int oldSize = fileCache.size(); int oldSize = fileCache.size();
if (newSize > oldSize) { if (newSize > oldSize) {
//see if interval is added //see if interval is added
int start = oldSize; int start = oldSize;
int end = newSize; int end = newSize;
for (int i = 0; i < oldSize; i++) { for (int i = 0; i < oldSize; i++) {
if (!newFileCache.get(i).equals(fileCache.get(i))) { if (!newFileCache.get(i).equals(fileCache.get(i))) {
start = i; start = i;
for (int j = i; j < newSize; j++) { for (int j = i; j < newSize; j++) {
if (newFileCache.get(j).equals(fileCache.get(i))) { if (newFileCache.get(j).equals(fileCache.get(i))) {
end = j; end = j;
break;
}
}
break; break;
} }
} }
break; if (start >= 0 && end > start
} && newFileCache.subList(end, newSize).equals(fileCache.subList(start, oldSize))) {
} if (isInterrupted()) {
if (start >= 0 && end > start return null;
&& newFileCache.subList(end, newSize).equals(fileCache.subList(start, oldSize))) { }
if(isInterrupted()) { return new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid);
return; }
} } else if (newSize < oldSize) {
invokeLater(new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid)); //see if interval is removed
newFileCache = null; int start = -1;
} int end = -1;
} else if (newSize < oldSize) { for (int i = 0; i < newSize; i++) {
//see if interval is removed if (!newFileCache.get(i).equals(fileCache.get(i))) {
int start = -1; start = i;
int end = -1; end = i + oldSize - newSize;
for (int i = 0; i < newSize; i++) { break;
if (!newFileCache.get(i).equals(fileCache.get(i))) { }
start = i; }
end = i + oldSize - newSize; if (start >= 0 && end > start
break; && fileCache.subList(end, oldSize).equals(newFileCache.subList(start, newSize))) {
if (isInterrupted()) {
return null;
}
return new DoChangeContents(null, 0, new Vector(fileCache.subList(start, end)), start, fid);
}
} }
} if (!fileCache.equals(newFileCache)) {
if (start >= 0 && end > start if (isInterrupted()) {
&& fileCache.subList(end, oldSize).equals(newFileCache.subList(start, newSize))) { cancelRunnables(runnables);
if(isInterrupted()) { }
return; return new DoChangeContents(newFileCache, 0, fileCache, 0, fid);
} }
invokeLater(new DoChangeContents(null, 0, new Vector<File>(fileCache.subList(start, end)), return null;
start, fid));
newFileCache = null;
}
}
if (newFileCache != null && !fileCache.equals(newFileCache)) {
if (isInterrupted()) {
cancelRunnables(runnables);
} }
invokeLater(new DoChangeContents(newFileCache, 0, fileCache, 0, fid)); });
if (doChangeContents != null) {
runnables.addElement(doChangeContents);
SwingUtilities.invokeLater(doChangeContents);
} }
} }
......
...@@ -1004,47 +1004,62 @@ public class BasicSliderUI extends SliderUI{ ...@@ -1004,47 +1004,62 @@ public class BasicSliderUI extends SliderUI{
g.setColor(DefaultLookup.getColor(slider, this, "Slider.tickColor", Color.black)); g.setColor(DefaultLookup.getColor(slider, this, "Slider.tickColor", Color.black));
if ( slider.getOrientation() == JSlider.HORIZONTAL ) { if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
g.translate( 0, tickBounds.y); g.translate(0, tickBounds.y);
int value = slider.getMinimum(); if (slider.getMinorTickSpacing() > 0) {
int xPos; int value = slider.getMinimum();
if ( slider.getMinorTickSpacing() > 0 ) {
while ( value <= slider.getMaximum() ) { while ( value <= slider.getMaximum() ) {
xPos = xPositionForValue( value ); int xPos = xPositionForValue(value);
paintMinorTickForHorizSlider( g, tickBounds, xPos ); paintMinorTickForHorizSlider( g, tickBounds, xPos );
// Overflow checking
if (Integer.MAX_VALUE - slider.getMinorTickSpacing() < value) {
break;
}
value += slider.getMinorTickSpacing(); value += slider.getMinorTickSpacing();
} }
} }
if ( slider.getMajorTickSpacing() > 0 ) { if (slider.getMajorTickSpacing() > 0) {
value = slider.getMinimum(); int value = slider.getMinimum();
while ( value <= slider.getMaximum() ) { while ( value <= slider.getMaximum() ) {
xPos = xPositionForValue( value ); int xPos = xPositionForValue(value);
paintMajorTickForHorizSlider( g, tickBounds, xPos ); paintMajorTickForHorizSlider( g, tickBounds, xPos );
// Overflow checking
if (Integer.MAX_VALUE - slider.getMajorTickSpacing() < value) {
break;
}
value += slider.getMajorTickSpacing(); value += slider.getMajorTickSpacing();
} }
} }
g.translate( 0, -tickBounds.y); g.translate( 0, -tickBounds.y);
} } else {
else { g.translate(tickBounds.x, 0);
g.translate(tickBounds.x, 0);
int value = slider.getMinimum();
int yPos;
if ( slider.getMinorTickSpacing() > 0 ) { if (slider.getMinorTickSpacing() > 0) {
int offset = 0; int offset = 0;
if(!BasicGraphicsUtils.isLeftToRight(slider)) { if(!BasicGraphicsUtils.isLeftToRight(slider)) {
offset = tickBounds.width - tickBounds.width / 2; offset = tickBounds.width - tickBounds.width / 2;
g.translate(offset, 0); g.translate(offset, 0);
} }
while ( value <= slider.getMaximum() ) { int value = slider.getMinimum();
yPos = yPositionForValue( value );
while (value <= slider.getMaximum()) {
int yPos = yPositionForValue(value);
paintMinorTickForVertSlider( g, tickBounds, yPos ); paintMinorTickForVertSlider( g, tickBounds, yPos );
// Overflow checking
if (Integer.MAX_VALUE - slider.getMinorTickSpacing() < value) {
break;
}
value += slider.getMinorTickSpacing(); value += slider.getMinorTickSpacing();
} }
...@@ -1053,15 +1068,22 @@ public class BasicSliderUI extends SliderUI{ ...@@ -1053,15 +1068,22 @@ public class BasicSliderUI extends SliderUI{
} }
} }
if ( slider.getMajorTickSpacing() > 0 ) { if (slider.getMajorTickSpacing() > 0) {
value = slider.getMinimum();
if(!BasicGraphicsUtils.isLeftToRight(slider)) { if(!BasicGraphicsUtils.isLeftToRight(slider)) {
g.translate(2, 0); g.translate(2, 0);
} }
while ( value <= slider.getMaximum() ) { int value = slider.getMinimum();
yPos = yPositionForValue( value );
while (value <= slider.getMaximum()) {
int yPos = yPositionForValue(value);
paintMajorTickForVertSlider( g, tickBounds, yPos ); paintMajorTickForVertSlider( g, tickBounds, yPos );
// Overflow checking
if (Integer.MAX_VALUE - slider.getMajorTickSpacing() < value) {
break;
}
value += slider.getMajorTickSpacing(); value += slider.getMajorTickSpacing();
} }
...@@ -1775,8 +1797,6 @@ public class BasicSliderUI extends SliderUI{ ...@@ -1775,8 +1797,6 @@ public class BasicSliderUI extends SliderUI{
thumbMiddle = thumbLeft + halfThumbWidth; thumbMiddle = thumbLeft + halfThumbWidth;
slider.setValue(valueForXPosition(thumbMiddle)); slider.setValue(valueForXPosition(thumbMiddle));
break; break;
default:
return;
} }
} }
......
...@@ -38,6 +38,8 @@ import java.io.File; ...@@ -38,6 +38,8 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.accessibility.*; import javax.accessibility.*;
import sun.awt.shell.ShellFolder; import sun.awt.shell.ShellFolder;
...@@ -937,7 +939,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI { ...@@ -937,7 +939,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
File[] baseFolders; File[] baseFolders;
if (useShellFolder) { if (useShellFolder) {
baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders"); baseFolders = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
public File[] run() {
return (File[]) ShellFolder.get("fileChooserComboBoxFolders");
}
});
} else { } else {
baseFolders = fsv.getRoots(); baseFolders = fsv.getRoots();
} }
......
...@@ -233,7 +233,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh ...@@ -233,7 +233,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
tabContext.getStyle().getGraphicsUtils(tabContext).layoutText( tabContext.getStyle().getGraphicsUtils(tabContext).layoutText(
tabContext, metrics, title, icon, SwingUtilities.CENTER, tabContext, metrics, title, icon, SwingUtilities.CENTER,
SwingUtilities.CENTER, SwingUtilities.LEADING, SwingUtilities.CENTER, SwingUtilities.LEADING,
SwingUtilities.TRAILING, calcRect, SwingUtilities.CENTER, calcRect,
iconRect, textRect, textIconGap); iconRect, textRect, textIconGap);
return textRect.y + metrics.getAscent() + getBaselineOffset(); return textRect.y + metrics.getAscent() + getBaselineOffset();
} }
...@@ -426,7 +426,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh ...@@ -426,7 +426,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
ss.getStyle().getGraphicsUtils(ss).layoutText(ss, metrics, title, ss.getStyle().getGraphicsUtils(ss).layoutText(ss, metrics, title,
icon, SwingUtilities.CENTER, SwingUtilities.CENTER, icon, SwingUtilities.CENTER, SwingUtilities.CENTER,
SwingUtilities.LEADING, SwingUtilities.TRAILING, SwingUtilities.LEADING, SwingUtilities.CENTER,
tabRect, iconRect, textRect, textIconGap); tabRect, iconRect, textRect, textIconGap);
tabPane.putClientProperty("html", null); tabPane.putClientProperty("html", null);
......
...@@ -30,6 +30,7 @@ import javax.swing.event.*; ...@@ -30,6 +30,7 @@ import javax.swing.event.*;
import java.util.BitSet; import java.util.BitSet;
import java.util.Locale; import java.util.Locale;
import javax.swing.UIManager;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
/** /**
...@@ -382,11 +383,10 @@ public class GlyphView extends View implements TabableView, Cloneable { ...@@ -382,11 +383,10 @@ public class GlyphView extends View implements TabableView, Cloneable {
Color bg = getBackground(); Color bg = getBackground();
Color fg = getForeground(); Color fg = getForeground();
if (c instanceof JTextComponent) { if (c != null && ! c.isEnabled()) {
JTextComponent tc = (JTextComponent) c; fg = (c instanceof JTextComponent ?
if (!tc.isEnabled()) { ((JTextComponent)c).getDisabledTextColor() :
fg = tc.getDisabledTextColor(); UIManager.getColor("textInactiveText"));
}
} }
if (bg != null) { if (bg != null) {
g.setColor(bg); g.setColor(bg);
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
package javax.swing.text.html; package javax.swing.text.html;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.io.*;
import java.net.*; import java.net.*;
import java.util.Dictionary; import java.util.Dictionary;
import javax.swing.*; import javax.swing.*;
...@@ -97,6 +95,7 @@ public class ImageView extends View { ...@@ -97,6 +95,7 @@ public class ImageView extends View {
private AttributeSet attr; private AttributeSet attr;
private Image image; private Image image;
private Image disabledImage;
private int width; private int width;
private int height; private int height;
/** Bitmask containing some of the above bitmask values. Because the /** Bitmask containing some of the above bitmask values. Because the
...@@ -193,6 +192,17 @@ public class ImageView extends View { ...@@ -193,6 +192,17 @@ public class ImageView extends View {
return image; return image;
} }
private Image getImage(boolean enabled) {
Image img = getImage();
if (! enabled) {
if (disabledImage == null) {
disabledImage = GrayFilter.createDisabledImage(img);
}
img = disabledImage;
}
return img;
}
/** /**
* Sets how the image is loaded. If <code>newValue</code> is true, * Sets how the image is loaded. If <code>newValue</code> is true,
* the image we be loaded when first asked for, otherwise it will * the image we be loaded when first asked for, otherwise it will
...@@ -338,8 +348,6 @@ public class ImageView extends View { ...@@ -338,8 +348,6 @@ public class ImageView extends View {
Rectangle rect = (a instanceof Rectangle) ? (Rectangle)a : Rectangle rect = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds(); a.getBounds();
Image image = getImage();
Rectangle clip = g.getClipBounds(); Rectangle clip = g.getClipBounds();
fBounds.setBounds(rect); fBounds.setBounds(rect);
...@@ -350,29 +358,29 @@ public class ImageView extends View { ...@@ -350,29 +358,29 @@ public class ImageView extends View {
rect.width - leftInset - rightInset, rect.width - leftInset - rightInset,
rect.height - topInset - bottomInset); rect.height - topInset - bottomInset);
} }
if (image != null) {
if (!hasPixels(image)) {
// No pixels yet, use the default
Icon icon = (image == null) ? getNoImageIcon() :
getLoadingImageIcon();
Container host = getContainer();
Image img = getImage(host == null || host.isEnabled());
if (img != null) {
if (! hasPixels(img)) {
// No pixels yet, use the default
Icon icon = getLoadingImageIcon();
if (icon != null) { if (icon != null) {
icon.paintIcon(getContainer(), g, rect.x + leftInset, icon.paintIcon(host, g,
rect.y + topInset); rect.x + leftInset, rect.y + topInset);
} }
} }
else { else {
// Draw the image // Draw the image
g.drawImage(image, rect.x + leftInset, rect.y + topInset, g.drawImage(img, rect.x + leftInset, rect.y + topInset,
width, height, imageObserver); width, height, imageObserver);
} }
} }
else { else {
Icon icon = getNoImageIcon(); Icon icon = getNoImageIcon();
if (icon != null) { if (icon != null) {
icon.paintIcon(getContainer(), g, rect.x + leftInset, icon.paintIcon(host, g,
rect.y + topInset); rect.x + leftInset, rect.y + topInset);
} }
View view = getAltView(); View view = getAltView();
// Paint the view representing the alt text, if its non-null // Paint the view representing the alt text, if its non-null
...@@ -855,7 +863,9 @@ public class ImageView extends View { ...@@ -855,7 +863,9 @@ public class ImageView extends View {
// it will pick up the new height/width, if necessary. // it will pick up the new height/width, if necessary.
public boolean imageUpdate(Image img, int flags, int x, int y, public boolean imageUpdate(Image img, int flags, int x, int y,
int newWidth, int newHeight ) { int newWidth, int newHeight ) {
if (image == null || image != img || getParent() == null) { if (img != image && img != disabledImage ||
image == null || getParent() == null) {
return false; return false;
} }
...@@ -873,6 +883,8 @@ public class ImageView extends View { ...@@ -873,6 +883,8 @@ public class ImageView extends View {
if ((state & HEIGHT_FLAG) != HEIGHT_FLAG) { if ((state & HEIGHT_FLAG) != HEIGHT_FLAG) {
height = DEFAULT_HEIGHT; height = DEFAULT_HEIGHT;
} }
} else {
disabledImage = null;
} }
if ((state & LOADING_FLAG) == LOADING_FLAG) { if ((state & LOADING_FLAG) == LOADING_FLAG) {
// No need to resize or repaint, still in the process // No need to resize or repaint, still in the process
...@@ -885,38 +897,37 @@ public class ImageView extends View { ...@@ -885,38 +897,37 @@ public class ImageView extends View {
return false; return false;
} }
// Resize image if necessary: if (image == img) {
short changed = 0; // Resize image if necessary:
if ((flags & ImageObserver.HEIGHT) != 0 && !getElement(). short changed = 0;
getAttributes().isDefined(HTML.Attribute.HEIGHT)) { if ((flags & ImageObserver.HEIGHT) != 0 && !getElement().
changed |= 1; getAttributes().isDefined(HTML.Attribute.HEIGHT)) {
} changed |= 1;
if ((flags & ImageObserver.WIDTH) != 0 && !getElement().
getAttributes().isDefined(HTML.Attribute.WIDTH)) {
changed |= 2;
}
synchronized(ImageView.this) {
if (image != img) {
return false;
} }
if ((changed & 1) == 1 && (state & WIDTH_FLAG) == 0) { if ((flags & ImageObserver.WIDTH) != 0 && !getElement().
width = newWidth; getAttributes().isDefined(HTML.Attribute.WIDTH)) {
changed |= 2;
} }
if ((changed & 2) == 2 && (state & HEIGHT_FLAG) == 0) {
height = newHeight; synchronized(ImageView.this) {
if ((changed & 1) == 1 && (state & WIDTH_FLAG) == 0) {
width = newWidth;
}
if ((changed & 2) == 2 && (state & HEIGHT_FLAG) == 0) {
height = newHeight;
}
if ((state & LOADING_FLAG) == LOADING_FLAG) {
// No need to resize or repaint, still in the process of
// loading.
return true;
}
} }
if ((state & LOADING_FLAG) == LOADING_FLAG) { if (changed != 0) {
// No need to resize or repaint, still in the process of // May need to resize myself, asynchronously:
// loading. safePreferenceChanged();
return true; return true;
} }
} }
if (changed != 0) {
// May need to resize myself, asynchronously:
safePreferenceChanged();
return true;
}
// Repaint when done or when new pixels arrive: // Repaint when done or when new pixels arrive:
if ((flags & (FRAMEBITS|ALLBITS)) != 0) { if ((flags & (FRAMEBITS|ALLBITS)) != 0) {
......
...@@ -31,6 +31,7 @@ import java.io.*; ...@@ -31,6 +31,7 @@ import java.io.*;
import java.net.*; import java.net.*;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.UIManager;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.*; import javax.swing.text.*;
...@@ -2161,6 +2162,7 @@ public class StyleSheet extends StyleContext { ...@@ -2161,6 +2162,7 @@ public class StyleSheet extends StyleContext {
*/ */
public void paint(Graphics g, float x, float y, float w, float h, View v, int item) { public void paint(Graphics g, float x, float y, float w, float h, View v, int item) {
View cv = v.getView(item); View cv = v.getView(item);
Container host = v.getContainer();
Object name = cv.getElement().getAttributes().getAttribute Object name = cv.getElement().getAttributes().getAttribute
(StyleConstants.NameAttribute); (StyleConstants.NameAttribute);
// Only draw something if the View is a list item. This won't // Only draw something if the View is a list item. This won't
...@@ -2171,7 +2173,7 @@ public class StyleSheet extends StyleContext { ...@@ -2171,7 +2173,7 @@ public class StyleSheet extends StyleContext {
} }
// deside on what side draw bullets, etc. // deside on what side draw bullets, etc.
isLeftToRight = isLeftToRight =
cv.getContainer().getComponentOrientation().isLeftToRight(); host.getComponentOrientation().isLeftToRight();
// How the list indicator is aligned is not specified, it is // How the list indicator is aligned is not specified, it is
// left up to the UA. IE and NS differ on this behavior. // left up to the UA. IE and NS differ on this behavior.
...@@ -2200,15 +2202,15 @@ public class StyleSheet extends StyleContext { ...@@ -2200,15 +2202,15 @@ public class StyleSheet extends StyleContext {
} }
// set the color of a decoration // set the color of a decoration
if (ss != null) { Color c = (host.isEnabled()
g.setColor(ss.getForeground(cv.getAttributes())); ? (ss != null
} else { ? ss.getForeground(cv.getAttributes())
g.setColor(Color.black); : host.getForeground())
} : UIManager.getColor("textInactiveText"));
g.setColor(c);
if (img != null) { if (img != null) {
drawIcon(g, (int) x, (int) y, (int) w, (int) h, align, drawIcon(g, (int) x, (int) y, (int) w, (int) h, align, host);
v.getContainer());
return; return;
} }
CSS.Value childtype = getChildType(cv); CSS.Value childtype = getChildType(cv);
......
...@@ -31,6 +31,7 @@ import java.awt.Toolkit; ...@@ -31,6 +31,7 @@ import java.awt.Toolkit;
import java.io.*; import java.io.*;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.*; import java.util.*;
import java.util.concurrent.Callable;
/** /**
* @author Michael Martak * @author Michael Martak
...@@ -461,6 +462,35 @@ public abstract class ShellFolder extends File { ...@@ -461,6 +462,35 @@ public abstract class ShellFolder extends File {
return null; return null;
} }
private static Invoker invoker;
/**
* Provides the single access point to the {@link Invoker}. It is guaranteed that the value
* returned by this method will be always the same.
*
* @return the singleton instance of {@link Invoker}
*/
public static Invoker getInvoker() {
if (invoker == null) {
invoker = shellFolderManager.createInvoker();
}
return invoker;
}
/**
* Interface allowing to invoke tasks in different environments on different platforms.
*/
public static interface Invoker {
/**
* Invokes a callable task. If the {@code task} throws a checked exception,
* it will be wrapped into a {@link RuntimeException}
*
* @param task a task to invoke
* @return the result of {@code task}'s invokation
*/
<T> T invoke(Callable<T> task);
}
/** /**
* Provides a default comparator for the default column set * Provides a default comparator for the default column set
*/ */
......
...@@ -27,6 +27,7 @@ package sun.awt.shell; ...@@ -27,6 +27,7 @@ package sun.awt.shell;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.concurrent.Callable;
/** /**
* @author Michael Martak * @author Michael Martak
...@@ -96,9 +97,23 @@ class ShellFolderManager { ...@@ -96,9 +97,23 @@ class ShellFolderManager {
} }
public boolean isFileSystemRoot(File dir) { public boolean isFileSystemRoot(File dir) {
if (dir instanceof ShellFolder && !((ShellFolder)dir).isFileSystem()) { if (dir instanceof ShellFolder && !((ShellFolder) dir).isFileSystem()) {
return false; return false;
} }
return (dir.getParentFile() == null); return (dir.getParentFile() == null);
} }
protected ShellFolder.Invoker createInvoker() {
return new DirectInvoker();
}
private static class DirectInvoker implements ShellFolder.Invoker {
public <T> T invoke(Callable<T> task) {
try {
return task.call();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
} }
/* /*
* Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1996-2009 Sun Microsystems, Inc. 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
...@@ -29,6 +29,8 @@ import java.awt.*; ...@@ -29,6 +29,8 @@ import java.awt.*;
import java.beans.*; import java.beans.*;
public class ColorEditor extends Panel implements PropertyEditor { public class ColorEditor extends Panel implements PropertyEditor {
private static final long serialVersionUID = 1781257185164716054L;
public ColorEditor() { public ColorEditor() {
setLayout(null); setLayout(null);
......
/* /*
* Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1996-2009 Sun Microsystems, Inc. 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
...@@ -29,6 +29,7 @@ import java.awt.*; ...@@ -29,6 +29,7 @@ import java.awt.*;
import java.beans.*; import java.beans.*;
public class FontEditor extends Panel implements java.beans.PropertyEditor { public class FontEditor extends Panel implements java.beans.PropertyEditor {
private static final long serialVersionUID = 6732704486002715933L;
public FontEditor() { public FontEditor() {
setLayout(null); setLayout(null);
......
...@@ -34,6 +34,7 @@ import java.text.DateFormat; ...@@ -34,6 +34,7 @@ import java.text.DateFormat;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
...@@ -900,6 +901,16 @@ public class FilePane extends JPanel implements PropertyChangeListener { ...@@ -900,6 +901,16 @@ public class FilePane extends JPanel implements PropertyChangeListener {
} }
} }
@Override
public void sort() {
ShellFolder.getInvoker().invoke(new Callable<Void>() {
public Void call() throws Exception {
DetailsTableRowSorter.super.sort();
return null;
}
});
}
public void modelStructureChanged() { public void modelStructureChanged() {
super.modelStructureChanged(); super.modelStructureChanged();
updateComparators(detailsTableModel.getColumns()); updateComparators(detailsTableModel.getColumns());
......
...@@ -29,6 +29,8 @@ import java.awt.event.*; ...@@ -29,6 +29,8 @@ import java.awt.event.*;
import java.beans.*; import java.beans.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*; import javax.swing.event.*;
...@@ -749,7 +751,11 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI { ...@@ -749,7 +751,11 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
File[] baseFolders; File[] baseFolders;
if (useShellFolder) { if (useShellFolder) {
baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders"); baseFolders = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
public File[] run() {
return (File[]) ShellFolder.get("fileChooserComboBoxFolders");
}
});
} else { } else {
baseFolders = fsv.getRoots(); baseFolders = fsv.getRoots();
} }
......
/* /*
* Portions Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
* CA 95054 USA or visit www.sun.com if you need additional information or * CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions. * have any questions.
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
...@@ -77,6 +76,66 @@ public class CharTrie extends Trie ...@@ -77,6 +76,66 @@ public class CharTrie extends Trie
m_friendAgent_ = new FriendAgent(); m_friendAgent_ = new FriendAgent();
} }
/**
* Make a dummy CharTrie.
* A dummy trie is an empty runtime trie, used when a real data trie cannot
* be loaded.
*
* The trie always returns the initialValue,
* or the leadUnitValue for lead surrogate code points.
* The Latin-1 part is always set up to be linear.
*
* @param initialValue the initial value that is set for all code points
* @param leadUnitValue the value for lead surrogate code _units_ that do not
* have associated supplementary data
* @param dataManipulate object which provides methods to parse the char data
*/
public CharTrie(int initialValue, int leadUnitValue, DataManipulate dataManipulate) {
super(new char[BMP_INDEX_LENGTH+SURROGATE_BLOCK_COUNT], HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_, dataManipulate);
int dataLength, latin1Length, i, limit;
char block;
/* calculate the actual size of the dummy trie data */
/* max(Latin-1, block 0) */
dataLength=latin1Length= INDEX_STAGE_1_SHIFT_<=8 ? 256 : DATA_BLOCK_LENGTH;
if(leadUnitValue!=initialValue) {
dataLength+=DATA_BLOCK_LENGTH;
}
m_data_=new char[dataLength];
m_dataLength_=dataLength;
m_initialValue_=(char)initialValue;
/* fill the index and data arrays */
/* indexes are preset to 0 (block 0) */
/* Latin-1 data */
for(i=0; i<latin1Length; ++i) {
m_data_[i]=(char)initialValue;
}
if(leadUnitValue!=initialValue) {
/* indexes for lead surrogate code units to the block after Latin-1 */
block=(char)(latin1Length>>INDEX_STAGE_2_SHIFT_);
i=0xd800>>INDEX_STAGE_1_SHIFT_;
limit=0xdc00>>INDEX_STAGE_1_SHIFT_;
for(; i<limit; ++i) {
m_index_[i]=block;
}
/* data for lead surrogate code units */
limit=latin1Length+DATA_BLOCK_LENGTH;
for(i=latin1Length; i<limit; ++i) {
m_data_[i]=(char)leadUnitValue;
}
}
m_friendAgent_ = new FriendAgent();
}
/** /**
* Java friend implementation * Java friend implementation
*/ */
...@@ -130,7 +189,18 @@ public class CharTrie extends Trie ...@@ -130,7 +189,18 @@ public class CharTrie extends Trie
*/ */
public final char getCodePointValue(int ch) public final char getCodePointValue(int ch)
{ {
int offset = getCodePointOffset(ch); int offset;
// fastpath for U+0000..U+D7FF
if(0 <= ch && ch < UTF16.LEAD_SURROGATE_MIN_VALUE) {
// copy of getRawOffset()
offset = (m_index_[ch >> INDEX_STAGE_1_SHIFT_] << INDEX_STAGE_2_SHIFT_)
+ (ch & INDEX_STAGE_3_MASK_);
return m_data_[offset];
}
// handle U+D800..U+10FFFF
offset = getCodePointOffset(ch);
// return -1 if there is an error, in this case we return the default // return -1 if there is an error, in this case we return the default
// value: m_initialValue_ // value: m_initialValue_
......
/* /*
* Portions Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
* CA 95054 USA or visit www.sun.com if you need additional information or * CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions. * have any questions.
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
...@@ -127,7 +126,7 @@ import java.text.Normalizer; ...@@ -127,7 +126,7 @@ import java.text.Normalizer;
* normalize(FCD) may be implemented with NFD. * normalize(FCD) may be implemented with NFD.
* *
* For more details on FCD see the collation design document: * For more details on FCD see the collation design document:
* http://oss.software.ibm.com/cvs/icu/~checkout~/icuhtml/design/collation/ICU_collation_design.htm * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm
* *
* ICU collation performs either NFD or FCD normalization automatically if * ICU collation performs either NFD or FCD normalization automatically if
* normalization is turned on for the collator object. Beyond collation and * normalization is turned on for the collator object. Beyond collation and
......
/* /*
* Portions Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
* CA 95054 USA or visit www.sun.com if you need additional information or * CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions. * have any questions.
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
...@@ -331,7 +330,7 @@ final class NormalizerDataReader implements ICUBinary.Authenticate { ...@@ -331,7 +330,7 @@ final class NormalizerDataReader implements ICUBinary.Authenticate {
throws IOException{ throws IOException{
//Read the bytes that make up the normTrie //Read the bytes that make up the normTrie
dataInputStream.read(normBytes); dataInputStream.readFully(normBytes);
//normTrieStream= new ByteArrayInputStream(normBytes); //normTrieStream= new ByteArrayInputStream(normBytes);
...@@ -346,11 +345,11 @@ final class NormalizerDataReader implements ICUBinary.Authenticate { ...@@ -346,11 +345,11 @@ final class NormalizerDataReader implements ICUBinary.Authenticate {
} }
//Read the fcdTrie //Read the fcdTrie
dataInputStream.read(fcdBytes); dataInputStream.readFully(fcdBytes);
//Read the AuxTrie //Read the AuxTrie
dataInputStream.read(auxBytes); dataInputStream.readFully(auxBytes);
} }
public byte[] getDataFormatVersion(){ public byte[] getDataFormatVersion(){
......
/* /*
* Portions Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
* CA 95054 USA or visit www.sun.com if you need additional information or * CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions. * have any questions.
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
...@@ -102,7 +101,7 @@ public final class NormalizerImpl { ...@@ -102,7 +101,7 @@ public final class NormalizerImpl {
private static final long MIN_SPECIAL = (long)(0xfc000000 & UNSIGNED_INT_MASK); private static final long MIN_SPECIAL = (long)(0xfc000000 & UNSIGNED_INT_MASK);
private static final long SURROGATES_TOP = (long)(0xfff00000 & UNSIGNED_INT_MASK); private static final long SURROGATES_TOP = (long)(0xfff00000 & UNSIGNED_INT_MASK);
private static final long MIN_HANGUL = (long)(0xfff00000 & UNSIGNED_INT_MASK); private static final long MIN_HANGUL = (long)(0xfff00000 & UNSIGNED_INT_MASK);
private static final long MIN_JAMO_V = (long)(0xfff20000 & UNSIGNED_INT_MASK); // private static final long MIN_JAMO_V = (long)(0xfff20000 & UNSIGNED_INT_MASK);
private static final long JAMO_V_TOP = (long)(0xfff30000 & UNSIGNED_INT_MASK); private static final long JAMO_V_TOP = (long)(0xfff30000 & UNSIGNED_INT_MASK);
...@@ -908,7 +907,7 @@ public final class NormalizerImpl { ...@@ -908,7 +907,7 @@ public final class NormalizerImpl {
buffer = composePart(args,prevStarter,src,srcStart,srcLimit,options,nx); buffer = composePart(args,prevStarter,src,srcStart,srcLimit,options,nx);
// compare the normalized version with the original // compare the normalized version with the original
if(0!=strCompare(buffer,0,args.length,src,prevStarter,(srcStart-prevStarter), false)) { if(0!=strCompare(buffer,0,args.length,src,prevStarter,srcStart, false)) {
result=NormalizerBase.NO; // normalization differs result=NormalizerBase.NO; // normalization differs
break; break;
} }
...@@ -2291,7 +2290,7 @@ public final class NormalizerImpl { ...@@ -2291,7 +2290,7 @@ public final class NormalizerImpl {
private static final int OPTIONS_NX_MASK=0x1f; private static final int OPTIONS_NX_MASK=0x1f;
private static final int OPTIONS_UNICODE_MASK=0xe0; private static final int OPTIONS_UNICODE_MASK=0xe0;
public static final int OPTIONS_SETS_MASK=0xff; public static final int OPTIONS_SETS_MASK=0xff;
private static final int OPTIONS_UNICODE_SHIFT=5; // private static final int OPTIONS_UNICODE_SHIFT=5;
private static final UnicodeSet[] nxCache = new UnicodeSet[OPTIONS_SETS_MASK+1]; private static final UnicodeSet[] nxCache = new UnicodeSet[OPTIONS_SETS_MASK+1];
/* Constants for options flags for normalization.*/ /* Constants for options flags for normalization.*/
......
/* /*
* Portions Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
* CA 95054 USA or visit www.sun.com if you need additional information or * CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions. * have any questions.
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
...@@ -37,10 +36,9 @@ ...@@ -37,10 +36,9 @@
package sun.text.normalizer; package sun.text.normalizer;
import java.io.InputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
/** /**
* <p>A trie is a kind of compressed, serializable table of values * <p>A trie is a kind of compressed, serializable table of values
...@@ -81,7 +79,6 @@ public abstract class Trie ...@@ -81,7 +79,6 @@ public abstract class Trie
* This interface specifies methods to be implemented in order for * This interface specifies methods to be implemented in order for
* com.ibm.impl.Trie, to surrogate offset information encapsulated within * com.ibm.impl.Trie, to surrogate offset information encapsulated within
* the data. * the data.
* @draft 2.1
*/ */
public static interface DataManipulate public static interface DataManipulate
{ {
...@@ -92,11 +89,17 @@ public abstract class Trie ...@@ -92,11 +89,17 @@ public abstract class Trie
* @param value data value for a surrogate from the trie, including the * @param value data value for a surrogate from the trie, including the
* folding offset * folding offset
* @return data offset or 0 if there is no data for the lead surrogate * @return data offset or 0 if there is no data for the lead surrogate
* @draft 2.1
*/ */
public int getFoldingOffset(int value); public int getFoldingOffset(int value);
} }
// default implementation
private static class DefaultGetFoldingOffset implements DataManipulate {
public int getFoldingOffset(int value) {
return value;
}
}
// protected constructor ------------------------------------------- // protected constructor -------------------------------------------
/** /**
...@@ -107,7 +110,6 @@ public abstract class Trie ...@@ -107,7 +110,6 @@ public abstract class Trie
* trie data * trie data
* @throws IOException thrown when input stream does not have the * @throws IOException thrown when input stream does not have the
* right header. * right header.
* @draft 2.1
*/ */
protected Trie(InputStream inputStream, protected Trie(InputStream inputStream,
DataManipulate dataManipulate) throws IOException DataManipulate dataManipulate) throws IOException
...@@ -121,7 +123,11 @@ public abstract class Trie ...@@ -121,7 +123,11 @@ public abstract class Trie
throw new IllegalArgumentException("ICU data file error: Trie header authentication failed, please check if you have the most updated ICU data file"); throw new IllegalArgumentException("ICU data file error: Trie header authentication failed, please check if you have the most updated ICU data file");
} }
m_dataManipulate_ = dataManipulate; if(dataManipulate != null) {
m_dataManipulate_ = dataManipulate;
} else {
m_dataManipulate_ = new DefaultGetFoldingOffset();
}
m_isLatin1Linear_ = (m_options_ & m_isLatin1Linear_ = (m_options_ &
HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_) != 0; HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_) != 0;
m_dataOffset_ = input.readInt(); m_dataOffset_ = input.readInt();
...@@ -135,19 +141,21 @@ public abstract class Trie ...@@ -135,19 +141,21 @@ public abstract class Trie
* @param options used by the trie * @param options used by the trie
* @param dataManipulate object containing the information to parse the * @param dataManipulate object containing the information to parse the
* trie data * trie data
* @draft 2.2
*/ */
protected Trie(char index[], int options, DataManipulate dataManipulate) protected Trie(char index[], int options, DataManipulate dataManipulate)
{ {
m_options_ = options; m_options_ = options;
m_dataManipulate_ = dataManipulate; if(dataManipulate != null) {
m_dataManipulate_ = dataManipulate;
} else {
m_dataManipulate_ = new DefaultGetFoldingOffset();
}
m_isLatin1Linear_ = (m_options_ & m_isLatin1Linear_ = (m_options_ &
HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_) != 0; HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_) != 0;
m_index_ = index; m_index_ = index;
m_dataOffset_ = m_index_.length; m_dataOffset_ = m_index_.length;
} }
// protected data members ------------------------------------------ // protected data members ------------------------------------------
/** /**
...@@ -158,7 +166,6 @@ public abstract class Trie ...@@ -158,7 +166,6 @@ public abstract class Trie
protected static final int LEAD_INDEX_OFFSET_ = 0x2800 >> 5; protected static final int LEAD_INDEX_OFFSET_ = 0x2800 >> 5;
/** /**
* Shift size for shifting right the input index. 1..9 * Shift size for shifting right the input index. 1..9
* @draft 2.1
*/ */
protected static final int INDEX_STAGE_1_SHIFT_ = 5; protected static final int INDEX_STAGE_1_SHIFT_ = 5;
/** /**
...@@ -168,31 +175,39 @@ public abstract class Trie ...@@ -168,31 +175,39 @@ public abstract class Trie
* This requires blocks of stage 2 data to be aligned by * This requires blocks of stage 2 data to be aligned by
* DATA_GRANULARITY. * DATA_GRANULARITY.
* 0..INDEX_STAGE_1_SHIFT * 0..INDEX_STAGE_1_SHIFT
* @draft 2.1
*/ */
protected static final int INDEX_STAGE_2_SHIFT_ = 2; protected static final int INDEX_STAGE_2_SHIFT_ = 2;
/**
* Number of data values in a stage 2 (data array) block.
*/
protected static final int DATA_BLOCK_LENGTH=1<<INDEX_STAGE_1_SHIFT_;
/** /**
* Mask for getting the lower bits from the input index. * Mask for getting the lower bits from the input index.
* DATA_BLOCK_LENGTH_ - 1. * DATA_BLOCK_LENGTH - 1.
* @draft 2.1
*/ */
protected static final int INDEX_STAGE_3_MASK_ = protected static final int INDEX_STAGE_3_MASK_ = DATA_BLOCK_LENGTH - 1;
(1 << INDEX_STAGE_1_SHIFT_) - 1; /** Number of bits of a trail surrogate that are used in index table lookups. */
protected static final int SURROGATE_BLOCK_BITS=10-INDEX_STAGE_1_SHIFT_;
/**
* Number of index (stage 1) entries per lead surrogate.
* Same as number of index entries for 1024 trail surrogates,
* ==0x400>>INDEX_STAGE_1_SHIFT_
*/
protected static final int SURROGATE_BLOCK_COUNT=(1<<SURROGATE_BLOCK_BITS);
/** Length of the BMP portion of the index (stage 1) array. */
protected static final int BMP_INDEX_LENGTH=0x10000>>INDEX_STAGE_1_SHIFT_;
/** /**
* Surrogate mask to use when shifting offset to retrieve supplementary * Surrogate mask to use when shifting offset to retrieve supplementary
* values * values
* @draft 2.1
*/ */
protected static final int SURROGATE_MASK_ = 0x3FF; protected static final int SURROGATE_MASK_ = 0x3FF;
/** /**
* Index or UTF16 characters * Index or UTF16 characters
* @draft 2.1
*/ */
protected char m_index_[]; protected char m_index_[];
/** /**
* Internal TrieValue which handles the parsing of the data value. * Internal TrieValue which handles the parsing of the data value.
* This class is to be implemented by the user * This class is to be implemented by the user
* @draft 2.1
*/ */
protected DataManipulate m_dataManipulate_; protected DataManipulate m_dataManipulate_;
/** /**
...@@ -200,7 +215,6 @@ public abstract class Trie ...@@ -200,7 +215,6 @@ public abstract class Trie
* index and data into a char array, so this is used to indicate the * index and data into a char array, so this is used to indicate the
* initial offset to the data portion. * initial offset to the data portion.
* Note this index always points to the initial value. * Note this index always points to the initial value.
* @draft 2.1
*/ */
protected int m_dataOffset_; protected int m_dataOffset_;
/** /**
...@@ -215,7 +229,6 @@ public abstract class Trie ...@@ -215,7 +229,6 @@ public abstract class Trie
* @param lead lead surrogate * @param lead lead surrogate
* @param trail trailing surrogate * @param trail trailing surrogate
* @return offset to data * @return offset to data
* @draft 2.1
*/ */
protected abstract int getSurrogateOffset(char lead, char trail); protected abstract int getSurrogateOffset(char lead, char trail);
...@@ -223,14 +236,12 @@ public abstract class Trie ...@@ -223,14 +236,12 @@ public abstract class Trie
* Gets the value at the argument index * Gets the value at the argument index
* @param index value at index will be retrieved * @param index value at index will be retrieved
* @return 32 bit value * @return 32 bit value
* @draft 2.1
*/ */
protected abstract int getValue(int index); protected abstract int getValue(int index);
/** /**
* Gets the default initial value * Gets the default initial value
* @return 32 bit value * @return 32 bit value
* @draft 2.1
*/ */
protected abstract int getInitialValue(); protected abstract int getInitialValue();
...@@ -247,7 +258,6 @@ public abstract class Trie ...@@ -247,7 +258,6 @@ public abstract class Trie
* @param offset index offset which ch is to start from * @param offset index offset which ch is to start from
* @param ch index to be used after offset * @param ch index to be used after offset
* @return offset to the data * @return offset to the data
* @draft 2.1
*/ */
protected final int getRawOffset(int offset, char ch) protected final int getRawOffset(int offset, char ch)
{ {
...@@ -261,7 +271,6 @@ public abstract class Trie ...@@ -261,7 +271,6 @@ public abstract class Trie
* Treats a lead surrogate as a normal code point. * Treats a lead surrogate as a normal code point.
* @param ch BMP character * @param ch BMP character
* @return offset to data * @return offset to data
* @draft 2.1
*/ */
protected final int getBMPOffset(char ch) protected final int getBMPOffset(char ch)
{ {
...@@ -279,7 +288,6 @@ public abstract class Trie ...@@ -279,7 +288,6 @@ public abstract class Trie
* the next trailing surrogate character. * the next trailing surrogate character.
* @param ch lead surrogate character * @param ch lead surrogate character
* @return offset to data * @return offset to data
* @draft 2.1
*/ */
protected final int getLeadOffset(char ch) protected final int getLeadOffset(char ch)
{ {
...@@ -293,26 +301,27 @@ public abstract class Trie ...@@ -293,26 +301,27 @@ public abstract class Trie
* Gets the offset to data which the codepoint points to * Gets the offset to data which the codepoint points to
* @param ch codepoint * @param ch codepoint
* @return offset to data * @return offset to data
* @draft 2.1
*/ */
protected final int getCodePointOffset(int ch) protected final int getCodePointOffset(int ch)
{ {
// if ((ch >> 16) == 0) slower // if ((ch >> 16) == 0) slower
if (ch >= UTF16.CODEPOINT_MIN_VALUE if (ch < 0) {
&& ch < UTF16.SUPPLEMENTARY_MIN_VALUE) { return -1;
} else if (ch < UTF16.LEAD_SURROGATE_MIN_VALUE) {
// fastpath for the part of the BMP below surrogates (D800) where getRawOffset() works
return getRawOffset(0, (char)ch);
} else if (ch < UTF16.SUPPLEMENTARY_MIN_VALUE) {
// BMP codepoint // BMP codepoint
return getBMPOffset((char)ch); return getBMPOffset((char)ch);
} } else if (ch <= UCharacter.MAX_VALUE) {
// for optimization
if (ch >= UTF16.CODEPOINT_MIN_VALUE
&& ch <= UCharacter.MAX_VALUE) {
// look at the construction of supplementary characters // look at the construction of supplementary characters
// trail forms the ends of it. // trail forms the ends of it.
return getSurrogateOffset(UTF16.getLeadSurrogate(ch), return getSurrogateOffset(UTF16.getLeadSurrogate(ch),
(char)(ch & SURROGATE_MASK_)); (char)(ch & SURROGATE_MASK_));
} else {
// return -1 // if there is an error, in this case we return
return -1;
} }
// return -1 if there is an error, in this case we return
return -1;
} }
/** /**
...@@ -320,7 +329,6 @@ public abstract class Trie ...@@ -320,7 +329,6 @@ public abstract class Trie
* <p>This is overwritten by the child classes. * <p>This is overwritten by the child classes.
* @param inputStream input stream containing the trie information * @param inputStream input stream containing the trie information
* @exception IOException thrown when data reading fails. * @exception IOException thrown when data reading fails.
* @draft 2.1
*/ */
protected void unserialize(InputStream inputStream) throws IOException protected void unserialize(InputStream inputStream) throws IOException
{ {
...@@ -335,7 +343,6 @@ public abstract class Trie ...@@ -335,7 +343,6 @@ public abstract class Trie
/** /**
* Determines if this is a 32 bit trie * Determines if this is a 32 bit trie
* @return true if options specifies this is a 32 bit trie * @return true if options specifies this is a 32 bit trie
* @draft 2.1
*/ */
protected final boolean isIntTrie() protected final boolean isIntTrie()
{ {
...@@ -345,7 +352,6 @@ public abstract class Trie ...@@ -345,7 +352,6 @@ public abstract class Trie
/** /**
* Determines if this is a 16 bit trie * Determines if this is a 16 bit trie
* @return true if this is a 16 bit trie * @return true if this is a 16 bit trie
* @draft 2.1
*/ */
protected final boolean isCharTrie() protected final boolean isCharTrie()
{ {
...@@ -354,40 +360,20 @@ public abstract class Trie ...@@ -354,40 +360,20 @@ public abstract class Trie
// private data members -------------------------------------------- // private data members --------------------------------------------
/**
* Signature index
*/
private static final int HEADER_SIGNATURE_INDEX_ = 0;
/**
* Options index
*/
private static final int HEADER_OPTIONS_INDEX_ = 1 << 1;
/**
* Index length index
*/
private static final int HEADER_INDEX_LENGTH_INDEX_ = 2 << 1;
/**
* Data length index
*/
private static final int HEADER_DATA_LENGTH_INDEX_ = 3 << 1;
/**
* Size of header
*/
private static final int HEADER_LENGTH_ = 4 << 1;
/** /**
* Latin 1 option mask * Latin 1 option mask
*/ */
private static final int HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_ = 0x200; protected static final int HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_ = 0x200;
/** /**
* Constant number to authenticate the byte block * Constant number to authenticate the byte block
*/ */
private static final int HEADER_SIGNATURE_ = 0x54726965; protected static final int HEADER_SIGNATURE_ = 0x54726965;
/** /**
* Header option formatting * Header option formatting
*/ */
private static final int HEADER_OPTIONS_SHIFT_MASK_ = 0xF; private static final int HEADER_OPTIONS_SHIFT_MASK_ = 0xF;
private static final int HEADER_OPTIONS_INDEX_SHIFT_ = 4; protected static final int HEADER_OPTIONS_INDEX_SHIFT_ = 4;
private static final int HEADER_OPTIONS_DATA_IS_32_BIT_ = 0x100; protected static final int HEADER_OPTIONS_DATA_IS_32_BIT_ = 0x100;
/** /**
* Flag indicator for Latin quick access data block * Flag indicator for Latin quick access data block
...@@ -409,9 +395,8 @@ public abstract class Trie ...@@ -409,9 +395,8 @@ public abstract class Trie
/** /**
* Authenticates raw data header. * Authenticates raw data header.
* Checking the header information, signature and options. * Checking the header information, signature and options.
* @param rawdata array of char data to be checked * @param signature This contains the options and type of a Trie
* @return true if the header is authenticated valid * @return true if the header is authenticated valid
* @draft 2.1
*/ */
private final boolean checkHeader(int signature) private final boolean checkHeader(int signature)
{ {
......
/* /*
* Portions Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
* CA 95054 USA or visit www.sun.com if you need additional information or * CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions. * have any questions.
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
...@@ -108,15 +107,14 @@ package sun.text.normalizer; ...@@ -108,15 +107,14 @@ package sun.text.normalizer;
* @since release 2.1, Jan 17 2002 * @since release 2.1, Jan 17 2002
*/ */
public class TrieIterator implements RangeValueIterator public class TrieIterator implements RangeValueIterator
{ {
// public constructor --------------------------------------------- // public constructor ---------------------------------------------
/** /**
* TrieEnumeration constructor * TrieEnumeration constructor
* @param trie to be used * @param trie to be used
* @exception IllegalArgumentException throw when argument is null. * @exception IllegalArgumentException throw when argument is null.
* @draft 2.1
*/ */
public TrieIterator(Trie trie) public TrieIterator(Trie trie)
{ {
...@@ -141,7 +139,6 @@ public class TrieIterator implements RangeValueIterator ...@@ -141,7 +139,6 @@ public class TrieIterator implements RangeValueIterator
* @return true if we are not at the end of the iteration, false otherwise. * @return true if we are not at the end of the iteration, false otherwise.
* @exception NoSuchElementException - if no more elements exist. * @exception NoSuchElementException - if no more elements exist.
* @see com.ibm.icu.util.RangeValueIterator.Element * @see com.ibm.icu.util.RangeValueIterator.Element
* @draft 2.1
*/ */
public final boolean next(Element element) public final boolean next(Element element)
{ {
...@@ -158,7 +155,6 @@ public class TrieIterator implements RangeValueIterator ...@@ -158,7 +155,6 @@ public class TrieIterator implements RangeValueIterator
/** /**
* Resets the iterator to the beginning of the iteration * Resets the iterator to the beginning of the iteration
* @draft 2.1
*/ */
public final void reset() public final void reset()
{ {
...@@ -186,7 +182,6 @@ public class TrieIterator implements RangeValueIterator ...@@ -186,7 +182,6 @@ public class TrieIterator implements RangeValueIterator
* The default function is to return the value as it is. * The default function is to return the value as it is.
* @param value a value from the trie * @param value a value from the trie
* @return extracted value * @return extracted value
* @draft 2.1
*/ */
protected int extract(int value) protected int extract(int value)
{ {
...@@ -278,7 +273,6 @@ public class TrieIterator implements RangeValueIterator ...@@ -278,7 +273,6 @@ public class TrieIterator implements RangeValueIterator
* Note, if there are no more iterations, it will never get to here. * Note, if there are no more iterations, it will never get to here.
* Blocked out by next(). * Blocked out by next().
* @param element return result object * @param element return result object
* @draft 2.1
*/ */
private final void calculateNextSupplementaryElement(Element element) private final void calculateNextSupplementaryElement(Element element)
{ {
...@@ -516,10 +510,6 @@ public class TrieIterator implements RangeValueIterator ...@@ -516,10 +510,6 @@ public class TrieIterator implements RangeValueIterator
*/ */
private static final int TRAIL_SURROGATE_MIN_VALUE_ = 0xDC00; private static final int TRAIL_SURROGATE_MIN_VALUE_ = 0xDC00;
/** /**
* Trail surrogate maximum value
*/
private static final int TRAIL_SURROGATE_MAX_VALUE_ = 0xDFFF;
/**
* Number of trail surrogate * Number of trail surrogate
*/ */
private static final int TRAIL_SURROGATE_COUNT_ = 0x400; private static final int TRAIL_SURROGATE_COUNT_ = 0x400;
...@@ -538,11 +528,6 @@ public class TrieIterator implements RangeValueIterator ...@@ -538,11 +528,6 @@ public class TrieIterator implements RangeValueIterator
private static final int DATA_BLOCK_LENGTH_ = private static final int DATA_BLOCK_LENGTH_ =
1 << Trie.INDEX_STAGE_1_SHIFT_; 1 << Trie.INDEX_STAGE_1_SHIFT_;
/** /**
* Number of codepoints in a stage 2 block
*/
private static final int DATA_BLOCK_SUPPLEMENTARY_LENGTH_ =
DATA_BLOCK_LENGTH_ << 10;
/**
* Trie instance * Trie instance
*/ */
private Trie m_trie_; private Trie m_trie_;
...@@ -560,10 +545,4 @@ public class TrieIterator implements RangeValueIterator ...@@ -560,10 +545,4 @@ public class TrieIterator implements RangeValueIterator
private int m_nextBlock_; private int m_nextBlock_;
private int m_nextBlockIndex_; private int m_nextBlockIndex_;
private int m_nextTrailIndexOffset_; private int m_nextTrailIndexOffset_;
/**
* This is the return result element
*/
private int m_start_;
private int m_limit_;
private int m_value_;
} }
/*
* Portions Copyright 2005-2009 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
*******************************************************************************
* (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* *
* The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License *
* Agreement between IBM and Sun. This technology is protected by multiple *
* US and International patents. This notice and attribution to IBM may not *
* to removed. *
*******************************************************************************
* file name: UBiDiProps.java
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2005jan16
* created by: Markus W. Scherer
*
* Low-level Unicode bidi/shaping properties access.
* Java port of ubidi_props.h/.c.
*/
package sun.text.normalizer;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.IOException;
public final class UBiDiProps {
// constructors etc. --------------------------------------------------- ***
// port of ubidi_openProps()
public UBiDiProps() throws IOException{
InputStream is=ICUData.getStream(DATA_FILE_NAME);
BufferedInputStream b=new BufferedInputStream(is, 4096 /* data buffer size */);
readData(b);
b.close();
is.close();
}
private void readData(InputStream is) throws IOException {
DataInputStream inputStream=new DataInputStream(is);
// read the header
ICUBinary.readHeader(inputStream, FMT, new IsAcceptable());
// read indexes[]
int i, count;
count=inputStream.readInt();
if(count<IX_INDEX_TOP) {
throw new IOException("indexes[0] too small in "+DATA_FILE_NAME);
}
indexes=new int[count];
indexes[0]=count;
for(i=1; i<count; ++i) {
indexes[i]=inputStream.readInt();
}
// read the trie
trie=new CharTrie(inputStream, null);
// read mirrors[]
count=indexes[IX_MIRROR_LENGTH];
if(count>0) {
mirrors=new int[count];
for(i=0; i<count; ++i) {
mirrors[i]=inputStream.readInt();
}
}
// read jgArray[]
count=indexes[IX_JG_LIMIT]-indexes[IX_JG_START];
jgArray=new byte[count];
for(i=0; i<count; ++i) {
jgArray[i]=inputStream.readByte();
}
}
// implement ICUBinary.Authenticate
private final class IsAcceptable implements ICUBinary.Authenticate {
public boolean isDataVersionAcceptable(byte version[]) {
return version[0]==1 &&
version[2]==Trie.INDEX_STAGE_1_SHIFT_ && version[3]==Trie.INDEX_STAGE_2_SHIFT_;
}
}
// UBiDiProps singleton
private static UBiDiProps gBdp=null;
// port of ubidi_getSingleton()
public static final synchronized UBiDiProps getSingleton() throws IOException {
if(gBdp==null) {
gBdp=new UBiDiProps();
}
return gBdp;
}
// UBiDiProps dummy singleton
private static UBiDiProps gBdpDummy=null;
private UBiDiProps(boolean makeDummy) { // ignore makeDummy, only creates a unique signature
indexes=new int[IX_TOP];
indexes[0]=IX_TOP;
trie=new CharTrie(0, 0, null); // dummy trie, always returns 0
}
/**
* Get a singleton dummy object, one that works with no real data.
* This can be used when the real data is not available.
* Using the dummy can reduce checks for available data after an initial failure.
* Port of ucase_getDummy().
*/
public static final synchronized UBiDiProps getDummy() {
if(gBdpDummy==null) {
gBdpDummy=new UBiDiProps(true);
}
return gBdpDummy;
}
public final int getClass(int c) {
return getClassFromProps(trie.getCodePointValue(c));
}
// data members -------------------------------------------------------- ***
private int indexes[];
private int mirrors[];
private byte jgArray[];
private CharTrie trie;
// data format constants ----------------------------------------------- ***
private static final String DATA_FILE_NAME = "/sun/text/resources/ubidi.icu";
/* format "BiDi" */
private static final byte FMT[]={ 0x42, 0x69, 0x44, 0x69 };
/* indexes into indexes[] */
private static final int IX_INDEX_TOP=0;
private static final int IX_MIRROR_LENGTH=3;
private static final int IX_JG_START=4;
private static final int IX_JG_LIMIT=5;
private static final int IX_TOP=16;
private static final int CLASS_MASK= 0x0000001f;
private static final int getClassFromProps(int props) {
return props&CLASS_MASK;
}
}
/* /*
* Portions Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. * Portions Copyright 2005-2009 Sun Microsystems, Inc. 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
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
*/ */
/* /*
******************************************************************************* *******************************************************************************
* (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
* * * *
* The original version of this source code and documentation is copyrighted * * The original version of this source code and documentation is copyrighted *
* and owned by IBM, These materials are provided under terms of a License * * and owned by IBM, These materials are provided under terms of a License *
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
grant {
permission java.io.FilePermission "C:\\temp\\*", "read";
permission java.io.FilePermission "C:\\temp", "read";
permission java.util.PropertyPermission "*", "read";
};
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册