This commit is contained in:
Lana Steuck 2008-10-13 17:13:29 -07:00
commit fb52866502
316 changed files with 11536 additions and 6866 deletions

View File

@ -209,6 +209,7 @@ JAVA_JAVA_java = \
sun/util/TimeZoneNameUtility.java \
sun/util/calendar/ZoneInfo.java \
sun/util/calendar/ZoneInfoFile.java \
sun/util/calendar/TzIDOldMapping.java \
java/util/TooManyListenersException.java \
java/util/Comparator.java \
java/util/Collections.java \

View File

@ -33,7 +33,7 @@ include $(BUILDDIR)/common/Defs.gmk
# Files
#
include FILES.gmk
AUTO_FILES_JAVA_DIRS = javax/swing sun/swing
AUTO_FILES_JAVA_DIRS = javax/swing sun/swing com/sun/java/swing
AUTO_JAVA_PRUNE = plaf
SUBDIRS = html32dtd plaf

View File

@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
tzdata2007h
tzdata2008e

View File

@ -409,9 +409,63 @@ Zone Africa/Nouakchott -1:03:48 - LMT 1912
0:00 - GMT
# Mauritius
# From Steffen Thorsen (2008-06-25):
# Mauritius plans to observe DST from 2008-11-01 to 2009-03-31 on a trial
# basis....
# It seems that Mauritius observed daylight saving time from 1982-10-10 to
# 1983-03-20 as well, but that was not successful....
# http://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html
# From Alex Krivenyshev (2008-06-25):
# http://economicdevelopment.gov.mu/portal/site/Mainhomepage/menuitem.a42b24128104d9845dabddd154508a0c/?content_id=0a7cee8b5d69a110VgnVCM1000000a04a8c0RCRD
# From Arthur David Olson (2008-06-30):
# The www.timeanddate.com article cited by Steffen Thorsen notes that "A
# final decision has yet to be made on the times that daylight saving
# would begin and end on these dates." As a place holder, use midnight.
# From Paul Eggert (2008-06-30):
# Follow Thorsen on DST in 1982/1983, instead of Shanks & Pottenger.
# From Steffen Thorsen (2008-07-10):
# According to
# <a href="http://www.lexpress.mu/display_article.php?news_id=111216">
# http://www.lexpress.mu/display_article.php?news_id=111216
# </a>
# (in French), Mauritius will start and end their DST a few days earlier
# than previously announced (2008-11-01 to 2009-03-31). The new start
# date is 2008-10-26 at 02:00 and the new end date is 2009-03-27 (no time
# given, but it is probably at either 2 or 3 wall clock time).
#
# A little strange though, since the article says that they moved the date
# to align itself with Europe and USA which also change time on that date,
# but that means they have not paid attention to what happened in
# USA/Canada last year (DST ends first Sunday in November). I also wonder
# why that they end on a Friday, instead of aligning with Europe which
# changes two days later.
# From Alex Krivenyshev (2008-07-11):
# Seems that English language article "The revival of daylight saving
# time: Energy conservation?"-# No. 16578 (07/11/2008) was originally
# published on Monday, June 30, 2008...
#
# I guess that article in French "Le gouvernement avance l'introduction
# de l'heure d'ete" stating that DST in Mauritius starting on October 26
# and ending on March 27, 2009 is the most recent one.
# ...
# <a href="http://www.worldtimezone.com/dst_news/dst_news_mauritius02.html">
# http://www.worldtimezone.com/dst_news/dst_news_mauritius02.html
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mauritius 1982 only - Oct 10 0:00 1:00 S
Rule Mauritius 1983 only - Mar 21 0:00 0 -
Rule Mauritius 2008 only - Oct 26 2:00s 1:00 S
Rule Mauritius 2009 only - Mar 27 2:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
4:00 - MUT # Mauritius Time
4:00 Mauritius MU%sT # Mauritius Time
# Agalega Is, Rodriguez
# no information; probably like Indian/Mauritius
@ -422,6 +476,77 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# Morocco
# See the `europe' file for Spanish Morocco (Africa/Ceuta).
# From Alex Krivenyshev (2008-05-09):
# Here is an article that Morocco plan to introduce Daylight Saving Time between
# 1 June, 2008 and 27 September, 2008.
#
# "... Morocco is to save energy by adjusting its clock during summer so it will
# be one hour ahead of GMT between 1 June and 27 September, according to
# Communication Minister and Gov ernment Spokesman, Khalid Naciri...."
#
# <a href="http://www.worldtimezone.net/dst_news/dst_news_morocco01.html">
# http://www.worldtimezone.net/dst_news/dst_news_morocco01.html
# </a>
# OR
# <a href="http://en.afrik.com/news11892.html">
# http://en.afrik.com/news11892.html
# </a>
# From Alex Krivenyshev (2008-05-09):
# The Morocco time change can be confirmed on Morocco web site Maghreb Arabe Presse:
# <a href="http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view">
# http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view
# </a>
#
# Morocco shifts to daylight time on June 1st through September 27, Govt.
# spokesman.
# From Patrice Scattolin (2008-05-09):
# According to this article:
# <a href="http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html">
# http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
# </a>
# (and republished here:
# <a href="http://www.actu.ma/heure-dete-comment_i127896_0.html">
# http://www.actu.ma/heure-dete-comment_i127896_0.html
# </a>
# )
# the changes occurs at midnight:
#
# saturday night may 31st at midnight (which in french is to be
# intrepreted as the night between saturday and sunday)
# sunday night the 28th at midnight
#
# Seeing that the 28th is monday, I am guessing that she intends to say
# the midnight of the 28th which is the midnight between sunday and
# monday, which jives with other sources that say that it's inclusive
# june1st to sept 27th.
#
# The decision was taken by decree *2-08-224 *but I can't find the decree
# published on the web.
#
# It's also confirmed here:
# <a href="http://www.maroc.ma/NR/exeres/FACF141F-D910-44B0-B7FA-6E03733425D1.htm">
# http://www.maroc.ma/NR/exeres/FACF141F-D910-44B0-B7FA-6E03733425D1.htm
# </a>
# on a government portal as being between june 1st and sept 27th (not yet
# posted in english).
#
# The following google query will generate many relevant hits:
# <a href="http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search">
# http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
# </a>
# From Alex Krivenyshev (2008-05-09):
# Is Western Sahara (part which administrated by Morocco) going to follow
# Morocco DST changes? Any information? What about other part of
# Western Sahara - under administration of POLISARIO Front (also named
# SADR Saharawi Arab Democratic Republic)?
# From Arthur David Olson (2008-05-09):
# XXX--guess that it is only Morocco for now; guess only 2008 for now.
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
Rule Morocco 1939 only - Nov 19 0:00 0 -
@ -438,11 +563,13 @@ Rule Morocco 1976 only - Aug 1 0:00 0 -
Rule Morocco 1977 only - Sep 28 0:00 0 -
Rule Morocco 1978 only - Jun 1 0:00 1:00 S
Rule Morocco 1978 only - Aug 4 0:00 0 -
Rule Morocco 2008 only - Jun 1 0:00 1:00 S
Rule Morocco 2008 only - Sep 28 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
1:00 - CET 1986
0:00 - WET
0:00 Morocco WE%sT
# Western Sahara
Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan
-1:00 - WAT 1976 Apr 14

View File

@ -251,6 +251,28 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D
# (could be true), for the moment I am assuming that those two
# counties are mistakes in the astro.com data.
# From Paul Eggert (2008-02-11):
# I just now checked Google News for western news sources that talk
# about China's single time zone, and couldn't find anything before 1986
# talking about China being in one time zone. (That article was: Jim
# Mann, "A clumsy embrace for another western custom: China on daylight
# time--sort of", Los Angeles Times, 1986-05-05. By the way, this
# article confirms the tz database's data claiming that China began
# observing daylight saving time in 1986.
#
# From Thomas S. Mullaney (2008-02-11):
# I think you're combining two subjects that need to treated
# separately: daylight savings (which, you're correct, wasn't
# implemented until the 1980s) and the unified time zone centered near
# Beijing (which was implemented in 1949). Briefly, there was also a
# "Lhasa Time" in Tibet and "Urumqi Time" in Xinjiang. The first was
# ceased, and the second eventually recognized (again, in the 1980s).
#
# From Paul Eggert (2008-06-30):
# There seems to be a good chance China switched to a single time zone in 1949
# rather than in 1980 as Shanks & Pottenger have it, but we don't have a
# reliable documentary source saying so yet, so for now we still go with
# Shanks & Pottenger.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Changbai Time ("Long-white Time", Long-white = Heilongjiang area)
@ -468,13 +490,13 @@ Zone Asia/Dili 8:22:20 - LMT 1912
# India
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Calcutta 5:53:28 - LMT 1880 # Kolkata
Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata
5:53:20 - HMT 1941 Oct # Howrah Mean Time?
6:30 - BURT 1942 May 15 # Burma Time
5:30 - IST 1942 Sep
5:30 1:00 IST 1945 Oct 15
5:30 - IST
# The following are like Asia/Calcutta:
# The following are like Asia/Kolkata:
# Andaman Is
# Lakshadweep (Laccadive, Minicoy and Amindivi Is)
# Nicobar Is
@ -599,6 +621,15 @@ Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov
# daylight saving time ...
# http://uk.reuters.com/article/oilRpt/idUKBLA65048420070916
#
# From Roozbeh Pournader (2007-11-05):
# This is quoted from Official Gazette of the Islamic Republic of
# Iran, Volume 63, Number 18242, dated Tuesday 1386/6/24
# [2007-10-16]. I am doing the best translation I can:...
# The official time of the country will be moved forward for one hour
# on the 24 hours of the first day of the month of Farvardin and will
# be changed back to its previous state on the 24 hours of the
# thirtieth day of Shahrivar.
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Iran 1978 1980 - Mar 21 0:00 1:00 D
Rule Iran 1978 only - Oct 21 0:00 0 S
@ -673,6 +704,21 @@ Zone Asia/Tehran 3:25:44 - LMT 1916
#
# So we'll ignore the Economist's claim.
# From Steffen Thorsen (2008-03-10):
# The cabinet in Iraq abolished DST last week, according to the following
# news sources (in Arabic):
# <a href="http://www.aljeeran.net/wesima_articles/news-20080305-98602.html">
# http://www.aljeeran.net/wesima_articles/news-20080305-98602.html
# </a>
# <a href="http://www.aswataliraq.info/look/article.tpl?id=2047&IdLanguage=17&IdPublication=4&NrArticle=71743&NrIssue=1&NrSection=10">
# http://www.aswataliraq.info/look/article.tpl?id=2047&IdLanguage=17&IdPublication=4&NrArticle=71743&NrIssue=1&NrSection=10
# </a>
#
# We have published a short article in English about the change:
# <a href="http://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html">
# http://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Iraq 1982 only - May 1 0:00 1:00 D
Rule Iraq 1982 1984 - Oct 1 0:00 0 S
@ -683,8 +729,8 @@ Rule Iraq 1986 1990 - Mar lastSun 1:00s 1:00 D
# IATA SSIM (1991/1996) says Apr 1 12:01am UTC; guess the `:01' is a typo.
# Shanks & Pottenger say Iraq did not observe DST 1992/1997; ignore this.
#
Rule Iraq 1991 max - Apr 1 3:00s 1:00 D
Rule Iraq 1991 max - Oct 1 3:00s 0 S
Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 D
Rule Iraq 1991 2007 - Oct 1 3:00s 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Baghdad 2:57:40 - LMT 1890
2:57:36 - BMT 1918 # Baghdad Mean Time?
@ -1374,6 +1420,42 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Male
# They decided not to adopt daylight-saving time....
# http://www.mongolnews.mn/index.php?module=unuudur&sec=view&id=15742
# From Deborah Goldsmith (2008-03-30):
# We received a bug report claiming that the tz database UTC offset for
# Asia/Choibalsan (GMT+09:00) is incorrect, and that it should be GMT
# +08:00 instead. Different sources appear to disagree with the tz
# database on this, e.g.:
#
# <a href="http://www.timeanddate.com/worldclock/city.html?n=1026">
# http://www.timeanddate.com/worldclock/city.html?n=1026
# </a>
# <a href="http://www.worldtimeserver.com/current_time_in_MN.aspx">
# http://www.worldtimeserver.com/current_time_in_MN.aspx
# </a>
#
# both say GMT+08:00.
# From Steffen Thorsen (2008-03-31):
# eznis airways, which operates several domestic flights, has a flight
# schedule here:
# <a href="http://www.eznis.com/Container.jsp?id=112">
# http://www.eznis.com/Container.jsp?id=112
# </a>
# (click the English flag for English)
#
# There it appears that flights between Choibalsan and Ulaanbatar arrive
# about 1:35 - 1:50 hours later in local clock time, no matter the
# direction, while Ulaanbaatar-Khvod takes 2 hours in the Eastern
# direction and 3:35 back, which indicates that Ulaanbatar and Khvod are
# in different time zones (like we know about), while Choibalsan and
# Ulaanbatar are in the same time zone (correction needed).
# From Arthur David Olson (2008-05-19):
# Assume that Choibalsan is indeed offset by 8:00.
# XXX--in the absence of better information, assume that transition
# was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
# this is almost surely wrong.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S
Rule Mongol 1983 only - Oct 1 0:00 0 -
@ -1409,7 +1491,8 @@ Zone Asia/Ulaanbaatar 7:07:32 - LMT 1905 Aug
Zone Asia/Choibalsan 7:38:00 - LMT 1905 Aug
7:00 - ULAT 1978
8:00 - ULAT 1983 Apr
9:00 Mongol CHO%sT # Choibalsan Time
9:00 Mongol CHO%sT 2008 Mar 31 # Choibalsan Time
8:00 Mongol CHO%sT
# Nepal
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -1459,10 +1542,32 @@ Zone Asia/Muscat 3:54:20 - LMT 1920
# The minister told a news conference that the experiment had rather
# shown 8 per cent higher consumption of electricity.
# From Alex Krivenyshev (2008-05-15):
#
# Here is an article that Pakistan plan to introduce Daylight Saving Time
# on June 1, 2008 for 3 months.
#
# "... The federal cabinet on Wednesday announced a new conservation plan to help
# reduce load shedding by approving the closure of commercial centres at 9pm and
# moving clocks forward by one hour for the next three months.
# ...."
#
# <a href="http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html">
# http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html
# </a>
# OR
# <a href="http://www.dailytimes.com.pk/default.asp?page=2008%5C05%5C15%5Cstory_15-5-2008_pg1_4">
# http://www.dailytimes.com.pk/default.asp?page=2008%5C05%5C15%5Cstory_15-5-2008_pg1_4
# </a>
# From Arthur David Olson (2008-05-19):
# XXX--midnight transitions is a guess; 2008 only is a guess.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Pakistan 2002 only - Apr Sun>=2 0:01 1:00 S
Rule Pakistan 2002 only - Oct Sun>=2 0:01 0 -
Rule Pakistan 2008 only - Jun 1 0:00 1:00 S
Rule Pakistan 2008 only - Sep 1 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Karachi 4:28:12 - LMT 1907
5:30 - IST 1942 Sep
@ -1700,7 +1805,7 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1
# kept their clocks set five and a half hours ahead of Greenwich Mean
# Time (GMT), in line with neighbor India.
# From Paul Eggert (2006-04-18):
# People who live in regions under Tamil control can use TZ='Asia/Calcutta',
# People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
# as that zone has agreed with the Tamil areas since our cutoff date of 1970.
# From K Sethu (2006-04-25):
@ -1790,10 +1895,62 @@ Rule Syria 2006 only - Sep 22 0:00 0 -
# From Paul Eggert (2007-03-29):
# Today the AP reported "Syria will switch to summertime at midnight Thursday."
# http://www.iht.com/articles/ap/2007/03/29/africa/ME-GEN-Syria-Time-Change.php
# For lack of better info, assume the rule changed to "last Friday in March"
# this year.
Rule Syria 2007 max - Mar lastFri 0:00 1:00 S
Rule Syria 2007 max - Oct 1 0:00 0 -
Rule Syria 2007 only - Mar lastFri 0:00 1:00 S
# From Jesper Norgard (2007-10-27):
# The sister center ICARDA of my work CIMMYT is confirming that Syria DST will
# not take place 1.st November at 0:00 o'clock but 1.st November at 24:00 or
# rather Midnight between Thursday and Friday. This does make more sence than
# having it between Wednesday and Thursday (two workdays in Syria) since the
# weekend in Syria is not Saturday and Sunday, but Friday and Saturday. So now
# it is implemented at midnight of the last workday before weekend...
#
# From Steffen Thorsen (2007-10-27):
# Jesper Norgaard Welen wrote:
#
# > "Winter local time in Syria will be observed at midnight of Thursday 1
# > November 2007, and the clock will be put back 1 hour."
#
# I found confirmation on this in this gov.sy-article (Arabic):
# http://wehda.alwehda.gov.sy/_print_veiw.asp?FileName=12521710520070926111247
#
# which using Google's translate tools says:
# Council of Ministers also approved the commencement of work on
# identifying the winter time as of Friday, 2/11/2007 where the 60th
# minute delay at midnight Thursday 1/11/2007.
Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# From Stephen Colebourne (2008-03-17):
# For everyone's info, I saw an IATA time zone change for [Syria] for
# this month (March 2008) in the last day or so...This is the data IATA
# are now using:
# Country Time Standard --- DST Start --- --- DST End --- DST
# Name Zone Variation Time Date Time Date
# Variation
# Syrian Arab
# Republic SY +0200 2200 03APR08 2100 30SEP08 +0300
# 2200 02APR09 2100 30SEP09 +0300
# 2200 01APR10 2100 30SEP10 +0300
# From Arthur David Olson (2008-03-17):
# Here's a link to English-language coverage by the Syrian Arab News
# Agency (SANA)...
# <a href="http://www.sana.sy/eng/21/2008/03/11/165173.htm">
# http://www.sana.sy/eng/21/2008/03/11/165173.htm
# </a>...which reads (in part) "The Cabinet approved the suggestion of the
# Ministry of Electricity to begin daylight savings time on Friday April
# 4th, advancing clocks one hour ahead on midnight of Thursday April 3rd."
# Since Syria is two hours east of UTC, the 2200 and 2100 transition times
# shown above match up with midnight in Syria.
# From Arthur David Olson (2008-03-18):
# My buest guess at a Syrian rule is "the Friday nearest April 1";
# coding that involves either using a "Mar Fri>=29" construct that old time zone
# compilers can't handle or having multiple Rules (a la Israel).
# For now, use "Apr Fri>=1", and go with IATA on a uniform Sep 30 end.
Rule Syria 2008 max - Apr Fri>=1 0:00 1:00 S
Rule Syria 2008 max - Oct 1 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq
2:00 Syria EE%sT
@ -1847,13 +2004,13 @@ Zone Asia/Tashkent 4:37:12 - LMT 1924 May 2
# Vietnam
# From Paul Eggert (1993-11-18):
# Saigon's official name is Thanh-Pho Ho Chi Minh, but it's too long.
# We'll stick with the traditional name for now.
# From Arthur David Olson (2008-03-18):
# The English-language name of Vietnam's most populous city is "Ho Chi Min City";
# we use Ho_Chi_Minh below to avoid a name of more than 14 characters.
# From Shanks & Pottenger:
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Saigon 7:06:40 - LMT 1906 Jun 9
Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jun 9
7:06:20 - SMT 1911 Mar 11 0:01 # Saigon MT?
7:00 - ICT 1912 May
8:00 - ICT 1931 May

View File

@ -1368,7 +1368,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# * Tonga will introduce DST in November
#
# I was given this link by John Letts:
# <a hef="http://news.bbc.co.uk/hi/english/world/asia-pacific/newsid_424000/424764.stm">
# <a href="http://news.bbc.co.uk/hi/english/world/asia-pacific/newsid_424000/424764.stm">
# http://news.bbc.co.uk/hi/english/world/asia-pacific/newsid_424000/424764.stm
# </a>
#
@ -1378,7 +1378,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# (12 + 1 hour DST).
# From Arthur David Olson (1999-09-20):
# According to <a href="http://www.tongaonline.com/news/sept1799.html>
# According to <a href="http://www.tongaonline.com/news/sept1799.html">
# http://www.tongaonline.com/news/sept1799.html
# </a>:
# "Daylight Savings Time will take effect on Oct. 2 through April 15, 2000

View File

@ -46,12 +46,15 @@ Link America/St_Thomas America/Virgin
Link Asia/Ashgabat Asia/Ashkhabad
Link Asia/Chongqing Asia/Chungking
Link Asia/Dhaka Asia/Dacca
Link Asia/Kolkata Asia/Calcutta
Link Asia/Macau Asia/Macao
Link Asia/Jerusalem Asia/Tel_Aviv
Link Asia/Ho_Chi_Minh Asia/Saigon
Link Asia/Thimphu Asia/Thimbu
Link Asia/Makassar Asia/Ujung_Pandang
Link Asia/Ulaanbaatar Asia/Ulan_Bator
Link Atlantic/Faroe Atlantic/Faeroe
Link Europe/Oslo Atlantic/Jan_Mayen
Link Australia/Sydney Australia/ACT
Link Australia/Sydney Australia/Canberra
Link Australia/Lord_Howe Australia/LHI

View File

@ -479,7 +479,7 @@ Rule EU 1979 1995 - Sep lastSun 1:00u 0 -
Rule EU 1981 max - Mar lastSun 1:00u 1:00 S
Rule EU 1996 max - Oct lastSun 1:00u 0 -
# The most recent directive covers the years starting in 2002. See:
# <a href="http://europa.eu.int/eur-lex/en/lif/dat/2000/en_300L0084.html"
# <a href="http://europa.eu.int/eur-lex/en/lif/dat/2000/en_300L0084.html">
# Directive 2000/84/EC of the European Parliament and of the Council
# of 19 January 2001 on summer-time arrangements.
# </a>
@ -502,9 +502,48 @@ Rule C-Eur 1940 only - Apr 1 2:00s 1:00 S
Rule C-Eur 1942 only - Nov 2 2:00s 0 -
Rule C-Eur 1943 only - Mar 29 2:00s 1:00 S
Rule C-Eur 1943 only - Oct 4 2:00s 0 -
Rule C-Eur 1944 only - Apr 3 2:00s 1:00 S
Rule C-Eur 1944 1945 - Apr Mon>=1 2:00s 1:00 S
# Whitman gives 1944 Oct 7; go with Shanks & Pottenger.
Rule C-Eur 1944 only - Oct 2 2:00s 0 -
# From Jesper Norgaard Welen (2008-07-13):
#
# I found what is probably a typo of 2:00 which should perhaps be 2:00s
# in the C-Eur rule from tz database version 2008d (this part was
# corrected in version 2008d). The circumstancial evidence is simply the
# tz database itself, as seen below:
#
# Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01
# 0:00 France WE%sT 1945 Sep 16 3:00
#
# Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15
# 0:00 France WE%sT 1945 Sep 16 3:00
#
# Zone Europe/Belgrade 1:22:00 - LMT 1884
# 1:00 1:00 CEST 1945 Sep 16 2:00s
#
# Rule France 1945 only - Sep 16 3:00 0 -
# Rule Belgium 1945 only - Sep 16 2:00s 0 -
# Rule Neth 1945 only - Sep 16 2:00s 0 -
#
# The rule line to be changed is:
#
# Rule C-Eur 1945 only - Sep 16 2:00 0 -
#
# It seems that Paris, Monaco, Rule France, Rule Belgium all agree on
# 2:00 standard time, e.g. 3:00 local time. However there are no
# countries that use C-Eur rules in September 1945, so the only items
# affected are apparently these ficticious zones that translates acronyms
# CET and MET:
#
# Zone CET 1:00 C-Eur CE%sT
# Zone MET 1:00 C-Eur ME%sT
#
# It this is right then the corrected version would look like:
#
# Rule C-Eur 1945 only - Sep 16 2:00s 0 -
#
# A small step for mankind though 8-)
Rule C-Eur 1945 only - Sep 16 2:00s 0 -
Rule C-Eur 1977 1980 - Apr Sun>=1 2:00s 1:00 S
Rule C-Eur 1977 only - Sep lastSun 2:00s 0 -
Rule C-Eur 1978 only - Oct 1 2:00s 0 -
@ -747,7 +786,8 @@ Rule Bulg 1981 only - Sep 27 2:00 0 -
Zone Europe/Sofia 1:33:16 - LMT 1880
1:56:56 - IMT 1894 Nov 30 # Istanbul MT?
2:00 - EET 1942 Nov 2 3:00
1:00 C-Eur CE%sT 1945 Apr 2 3:00
1:00 C-Eur CE%sT 1945
1:00 - CET 1945 Apr 2 3:00
2:00 - EET 1979 Mar 31 23:00
2:00 Bulg EE%sT 1982 Sep 26 2:00
2:00 C-Eur EE%sT 1991
@ -1115,33 +1155,40 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01
# [See tz-link.htm for the URL.]
# From Joerg Schilling (2002-10-23):
# In 1945, Berlin was switched to Moscow Summer time (GMT+4) by <a
# href="http://www.dhm.de/lemo/html/biografien/BersarinNikolai/">
# In 1945, Berlin was switched to Moscow Summer time (GMT+4) by
# <a href="http://www.dhm.de/lemo/html/biografien/BersarinNikolai/">
# General [Nikolai] Bersarin</a>.
# From Paul Eggert (2003-03-08):
# <a href="http://www.parlament-berlin.de/pds-fraktion.nsf/727459127c8b66ee8525662300459099/defc77cb784f180ac1256c2b0030274b/$FILE/bersarint.pdf">
# http://www.parlament-berlin.de/pds-fraktion.nsf/727459127c8b66ee8525662300459099/defc77cb784f180ac1256c2b0030274b/$FILE/bersarint.pdf
# </a>
# says that Bersarin issued an order to use Moscow time on May 20.
# However, Moscow did not observe daylight saving in 1945, so
# this was equivalent to CEMT (GMT+3), not GMT+4.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Germany 1945 only - Apr 2 2:00s 1:00 S
Rule Germany 1945 only - May 24 2:00 2:00 M # Midsummer
Rule Germany 1945 only - Sep 24 3:00 1:00 S
Rule Germany 1945 only - Nov 18 2:00s 0 -
Rule Germany 1946 only - Apr 14 2:00s 1:00 S
Rule Germany 1946 only - Oct 7 2:00s 0 -
Rule Germany 1947 1949 - Oct Sun>=1 2:00s 0 -
Rule Germany 1947 only - Apr 6 2:00s 1:00 S
# http://www.ptb.de/de/org/4/44/441/salt.htm says the following transition
# occurred at 3:00 MEZ, not the 2:00 MEZ given in Shanks & Pottenger.
# Go with the PTB.
Rule Germany 1947 only - Apr 6 3:00s 1:00 S
Rule Germany 1947 only - May 11 2:00s 2:00 M
Rule Germany 1947 only - Jun 29 3:00 1:00 S
Rule Germany 1948 only - Apr 18 2:00s 1:00 S
Rule Germany 1949 only - Apr 10 2:00s 1:00 S
Rule SovietZone 1945 only - May 24 2:00 2:00 M # Midsummer
Rule SovietZone 1945 only - Sep 24 3:00 1:00 S
Rule SovietZone 1945 only - Nov 18 2:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Berlin 0:53:28 - LMT 1893 Apr
1:00 C-Eur CE%sT 1945 Apr 2 2:00
1:00 C-Eur CE%sT 1945 May 24 2:00
1:00 SovietZone CE%sT 1946
1:00 Germany CE%sT 1980
1:00 EU CE%sT
@ -1218,7 +1265,7 @@ Rule Hungary 1980 only - Apr 6 1:00 1:00 S
Zone Europe/Budapest 1:16:20 - LMT 1890 Oct
1:00 C-Eur CE%sT 1918
1:00 Hungary CE%sT 1941 Apr 6 2:00
1:00 C-Eur CE%sT 1945 May 1 23:00
1:00 C-Eur CE%sT 1945
1:00 Hungary CE%sT 1980 Sep 28 2:00s
1:00 EU CE%sT
@ -1736,7 +1783,6 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1
# come up with more definitive info about the timekeeping during the
# war years it's probably best just do do the following for now:
Link Europe/Oslo Arctic/Longyearbyen
Link Europe/Oslo Atlantic/Jan_Mayen
# Poland
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@ -2136,7 +2182,8 @@ Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Belgrade 1:22:00 - LMT 1884
1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s
1:00 C-Eur CE%sT 1945
1:00 - CET 1945 May 8 2:00s
1:00 1:00 CEST 1945 Sep 16 2:00s
# Metod Kozelj reports that the legal date of
# transition to EU rules was 1982-11-27, for all of Yugoslavia at the time.

View File

@ -28,7 +28,7 @@
#
# This file contains a table with the following columns:
# 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 Newsletter No. V-12 (2006-09-26). See:
# ISO 3166-1 Newsletter VI-1 (2007-09-21). See:
# <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/index.html">
# ISO 3166 Maintenance agency (ISO 3166/MA)
# </a>.
@ -69,6 +69,7 @@ BG Bulgaria
BH Bahrain
BI Burundi
BJ Benin
BL St Barthelemy
BM Bermuda
BN Brunei
BO Bolivia
@ -181,6 +182,7 @@ MA Morocco
MC Monaco
MD Moldova
ME Montenegro
MF St Martin (French part)
MG Madagascar
MH Marshall Islands
MK Macedonia

View File

@ -66,8 +66,10 @@ Leap 1995 Dec 31 23:59:60 + S
Leap 1997 Jun 30 23:59:60 + S
Leap 1998 Dec 31 23:59:60 + S
Leap 2005 Dec 31 23:59:60 + S
Leap 2008 Dec 31 23:59:60 + S
# INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
#
# SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
#
# SERVICE DE LA ROTATION TERRESTRE
@ -75,30 +77,38 @@ Leap 2005 Dec 31 23:59:60 + S
# 61, Av. de l'Observatoire 75014 PARIS (France)
# Tel. : 33 (0) 1 40 51 22 26
# FAX : 33 (0) 1 40 51 22 91
# Internet : services.iers@obspm.fr
# e-mail : services.iers@obspm.fr
# http://hpiers.obspm.fr/eop-pc
#
# Paris, 28 June 2007
# Paris, 4 July 2008
#
# Bulletin C 34
# Bulletin C 36
#
# To authorities responsible
# for the measurement and
# distribution of time
#
# INFORMATION ON UTC - TAI
# UTC TIME STEP
# on the 1st of January 2009
#
# NO positive leap second will be introduced at the end of December 2007.
# The difference between Coordinated Universal Time UTC and the
# International Atomic Time TAI is :
# A positive leap second will be introduced at the end of December 2008.
# The sequence of dates of the UTC second markers will be:
#
# from 2006 January 1, 0h UTC, until further notice : UTC-TAI = -33 s
# 2008 December 31, 23h 59m 59s
# 2008 December 31, 23h 59m 60s
# 2009 January 1, 0h 0m 0s
#
# The difference between UTC and the International Atomic Time TAI is:
#
# from 2006 January 1, 0h UTC, to 2009 January 1 0h UTC : UTC-TAI = - 33s
# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = - 34s
#
# Leap seconds can be introduced in UTC at the end of the months of December
# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
# six months, either to announce a time step in UTC, or to confirm that there
# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
# six months, either to announce a time step in UTC or to confirm that there
# will be no time step at the next possible date.
#
# Daniel GAMBIS
# Director
# Head
# Earth Orientation Center of IERS
# Observatoire de Paris, France

View File

@ -2098,8 +2098,8 @@ Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
# http://www.jonesbahamas.com/?c=45&a=10412
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Bahamas 1964 2006 - Oct lastSun 2:00 0 S
Rule Bahamas 1964 1986 - Apr lastSun 2:00 1:00 D
Rule Bahamas 1964 1975 - Oct lastSun 2:00 0 S
Rule Bahamas 1964 1975 - Apr lastSun 2:00 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Nassau -5:09:24 - LMT 1912 Mar 2
-5:00 Bahamas E%sT 1976
@ -2209,6 +2209,69 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# says Cuban clocks will advance at midnight on March 10.
# For lack of better information, assume Cuba will use US rules,
# except that it switches at midnight standard time as usual.
#
# From Steffen Thorsen (2007-10-25):
# Carlos Alberto Fonseca Arauz informed me that Cuba will end DST one week
# earlier - on the last Sunday of October, just like in 2006.
#
# He supplied these references:
#
# http://www.prensalatina.com.mx/article.asp?ID=%7B4CC32C1B-A9F7-42FB-8A07-8631AFC923AF%7D&language=ES
# http://actualidad.terra.es/sociedad/articulo/cuba_llama_ahorrar_energia_cambio_1957044.htm
#
# From Alex Kryvenishev (2007-10-25):
# Here is also article from Granma (Cuba):
#
# [Regira] el Horario Normal desde el [proximo] domingo 28 de octubre
# http://www.granma.cubaweb.cu/2007/10/24/nacional/artic07.html
#
# http://www.worldtimezone.com/dst_news/dst_news_cuba03.html
# From Arthur David Olson (2008-03-09):
# I'm in Maryland which is now observing United States Eastern Daylight
# Time. At 9:44 local time I used RealPlayer to listen to
# <a href="http://media.enet.cu/radioreloj">
# http://media.enet.cu/radioreloj
# </a>, a Cuban information station, and heard
# the time announced as "ocho cuarenta y cuatro" ("eight forty-four"),
# indicating that Cuba is still on standard time.
# From Steffen Thorsen (2008-03-12):
# It seems that Cuba will start DST on Sunday, 2007-03-16...
# It was announced yesterday, according to this source (in Spanish):
# <a href="http://www.nnc.cubaweb.cu/marzo-2008/cien-1-11-3-08.htm">
# http://www.nnc.cubaweb.cu/marzo-2008/cien-1-11-3-08.htm
# </a>
#
# Some more background information is posted here:
# <a href="http://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html">
# http://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html
# </a>
#
# The article also says that Cuba has been observing DST since 1963,
# while Shanks (and tzdata) has 1965 as the first date (except in the
# 1940's). Many other web pages in Cuba also claim that it has been
# observed since 1963, but with the exception of 1970 - an exception
# which is not present in tzdata/Shanks. So there is a chance we need to
# change some historic records as well.
#
# One example:
# <a href="http://www.radiohc.cu/espanol/noticias/mar07/11mar/hor.htm">
# http://www.radiohc.cu/espanol/noticias/mar07/11mar/hor.htm
# </a>
# From Jesper Norgaard Welen (2008-03-13):
# The Cuban time change has just been confirmed on the most authoritative
# web site, the Granma. Please check out
# <a href="http://www.granma.cubaweb.cu/2008/03/13/nacional/artic10.html">
# http://www.granma.cubaweb.cu/2008/03/13/nacional/artic10.html
# </a>
#
# Basically as expected after Steffen Thorsens information, the change
# will take place midnight between Saturday and Sunday.
# From Arthur David Olson (2008-03-12):
# Assume Sun>=15 (third Sunday) going forward.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
@ -2240,9 +2303,9 @@ Rule Cuba 1997 only - Oct 12 0:00s 0 S
Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D
Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 2006 - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2006 only - Oct lastSun 0:00s 0 S
Rule Cuba 2007 max - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2007 max - Nov Sun>=1 0:00s 0 S
Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2008 max - Mar Sun>=15 0:00s 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890
@ -2309,6 +2372,10 @@ Zone America/Grenada -4:07:00 - LMT 1911 Jul # St George's
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Guadeloupe -4:06:08 - LMT 1911 Jun 8 # Pointe a Pitre
-4:00 - AST
# St Barthelemy
Link America/Guadeloupe America/St_Barthelemy
# St Martin (French part)
Link America/Guadeloupe America/Marigot
# Guatemala
#

View File

@ -127,7 +127,11 @@ Rule Arg 1989 1992 - Oct Sun>=15 0:00 1:00 S
# which did not result in the switch of a time zone, as they stayed 9 hours
# from the International Date Line.
Rule Arg 1999 only - Oct Sun>=1 0:00 1:00 S
Rule Arg 2000 only - Mar Sun>=1 0:00 0 -
# From Paul Eggert (2007-12-28):
# DST was set to expire on March 5, not March 3, but since it was converted
# to standard time on March 3 it's more convenient for us to pretend that
# it ended on March 3.
Rule Arg 2000 only - Mar 3 0:00 0 -
#
# From Peter Gradelski via Steffen Thorsen (2000-03-01):
# We just checked with our Sao Paulo office and they say the government of
@ -162,6 +166,30 @@ Rule Arg 2000 only - Mar Sun>=1 0:00 0 -
# This kind of things had always been done this way in Argentina.
# We are still -03:00 all year round in all of the country.
#
# From Steffen Thorsen (2007-12-21):
# A user (Leonardo Chaim) reported that Argentina will adopt DST....
# all of the country (all Zone-entries) are affected. News reports like
# http://www.lanacion.com.ar/opinion/nota.asp?nota_id=973037 indicate
# that Argentina will use DST next year as well, from October to
# March, although exact rules are not given.
#
# From Jesper Norgaard Welen (2007-12-26)
# The last hurdle of Argentina DST is over, the proposal was approved in
# the lower chamber too (Deputados) with a vote 192 for and 2 against.
# By the way thanks to Mariano Absatz and Daniel Mario Vega for the link to
# the original scanned proposal, where the dates and the zero hours are
# clear and unambiguous...This is the article about final approval:
# <a href="http://www.lanacion.com.ar/politica/nota.asp?nota_id=973996">
# http://www.lanacion.com.ar/politica/nota.asp?nota_id=973996
# </a>
#
# From Paul Eggert (2007-12-22):
# For dates after mid-2008, the following rules are my guesses and
# are quite possibly wrong, but are more likely than no DST at all.
Rule Arg 2007 only - Dec 30 0:00 1:00 S
Rule Arg 2008 max - Mar Sun>=15 0:00 0 -
Rule Arg 2008 max - Oct Sun>=1 0:00 1:00 S
# From Mariano Absatz (2004-05-21):
# Today it was officially published that the Province of Mendoza is changing
# its timezone this winter... starting tomorrow night....
@ -222,10 +250,80 @@ Rule Arg 2000 only - Mar Sun>=1 0:00 0 -
# http://www.sanjuan.gov.ar/prensa/archivo/000426.html
# http://www.sanjuan.gov.ar/prensa/archivo/000441.html
# From Alex Krivenyshev (2008-01-17):
# Here are articles that Argentina Province San Luis is planning to end DST
# as earlier as upcoming Monday January 21, 2008 or February 2008:
#
# Provincia argentina retrasa reloj y marca diferencia con resto del pais
# (Argentine Province delayed clock and mark difference with the rest of the
# country)
# <a href="http://cl.invertia.com/noticias/noticia.aspx?idNoticia=200801171849_EFE_ET4373&idtel">
# http://cl.invertia.com/noticias/noticia.aspx?idNoticia=200801171849_EFE_ET4373&idtel
# </a>
#
# Es inminente que en San Luis atrasen una hora los relojes
# (It is imminent in San Luis clocks one hour delay)
# <a href="http://www.lagaceta.com.ar/vernotae.asp?id_nota=253414">
# http://www.lagaceta.com.ar/vernotae.asp?id_nota=253414
# </a>
#
# <a href="http://www.worldtimezone.net/dst_news/dst_news_argentina02.html">
# http://www.worldtimezone.net/dst_news/dst_news_argentina02.html
# </a>
# From Jesper Norgaard Welen (2008-01-18):
# The page of the San Luis provincial government
# <a href="http://www.sanluis.gov.ar/notas.asp?idCanal=0&id=22812">
# http://www.sanluis.gov.ar/notas.asp?idCanal=0&id=22812
# </a>
# confirms what Alex Krivenyshev has earlier sent to the tz
# emailing list about that San Luis plans to return to standard
# time much earlier than the rest of the country. It also
# confirms that upon request the provinces San Juan and Mendoza
# refused to follow San Luis in this change.
#
# The change is supposed to take place Monday the 21.st at 0:00
# hours. As far as I understand it if this goes ahead, we need
# a new timezone for San Luis (although there are also documented
# independent changes in the southamerica file of San Luis in
# 1990 and 1991 which has not been confirmed).
# From Jesper Norgaard Welen (2008-01-25):
# Unfortunately the below page has become defunct, about the San Luis
# time change. Perhaps because it now is part of a group of pages "Most
# important pages of 2008."
#
# You can use
# <a href="http://www.sanluis.gov.ar/notas.asp?idCanal=8141&id=22834">
# http://www.sanluis.gov.ar/notas.asp?idCanal=8141&id=22834
# </a>
# instead it seems. Or use "Buscador" from the main page of the San Luis
# government, and fill in "huso" and click OK, and you will get 3 pages
# from which the first one is identical to the above.
# From Mariano Absatz (2008-01-28):
# I can confirm that the Province of San Luis (and so far only that
# province) decided to go back to UTC-3 effective midnight Jan 20th 2008
# (that is, Monday 21st at 0:00 is the time the clocks were delayed back
# 1 hour), and they intend to keep UTC-3 as their timezone all year round
# (that is, unless they change their mind any minute now).
#
# So we'll have to add yet another city to 'southamerica' (I think San
# Luis city is the mos populated city in the Province, so it'd be
# America/Argentina/San_Luis... of course I can't remember if San Luis's
# history of particular changes goes along with Mendoza or San Juan :-(
# (I only remember not being able to collect hard facts about San Luis
# back in 2004, when these provinces changed to UTC-4 for a few days, I
# mailed them personally and never got an answer).
# From Paul Eggert (2008-06-30):
# Unless otherwise specified, data are from Shanks & Pottenger through 1992,
# from the IATA otherwise. As noted below, Shanks & Pottenger say that
# America/Cordoba split into 6 subregions during 1991/1992, but we
# haven't verified this yet so for now we'll keep it a single region.
# America/Cordoba split into 6 subregions during 1991/1992, one of which
# was America/San_Luis, but we haven't verified this yet so for now we'll
# keep America/Cordoba a single region rather than splitting it into the
# other 5 subregions.
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
@ -236,18 +334,16 @@ Zone America/Argentina/Buenos_Aires -3:53:48 - LMT 1894 Oct 31
-4:00 Arg AR%sT 1969 Oct 5
-3:00 Arg AR%sT 1999 Oct 3
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART
-3:00 Arg AR%sT
#
# Santa Fe (SF), Entre Rios (ER), Corrientes (CN), Misiones (MN), Chaco (CC),
# Formosa (FM), Salta (SA), Santiago del Estero (SE), Cordoba (CB),
# San Luis (SL), La Pampa (LP), Neuquen (NQ), Rio Negro (RN)
# La Pampa (LP), Neuquen (NQ), Rio Negro (RN)
#
# Shanks & Pottenger also make the following claims, which we haven't verified:
# - Formosa switched to -3:00 on 1991-01-07.
# - Misiones switched to -3:00 on 1990-12-29.
# - Chaco switched to -3:00 on 1991-01-04.
# - San Luis switched to -4:00 on 1990-03-14, then to -3:00 on 1990-10-15,
# then to -4:00 on 1991-03-01, then to -3:00 on 1991-06-01.
# - Santiago del Estero switched to -4:00 on 1991-04-01,
# then to -3:00 on 1991-04-26.
#
@ -259,7 +355,7 @@ Zone America/Argentina/Cordoba -4:16:48 - LMT 1894 Oct 31
-4:00 - WART 1991 Oct 20
-3:00 Arg AR%sT 1999 Oct 3
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART
-3:00 Arg AR%sT
#
# Tucuman (TM)
Zone America/Argentina/Tucuman -4:20:52 - LMT 1894 Oct 31
@ -272,7 +368,7 @@ Zone America/Argentina/Tucuman -4:20:52 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 13
-3:00 - ART
-3:00 Arg AR%sT
#
# La Rioja (LR)
Zone America/Argentina/La_Rioja -4:27:24 - LMT 1894 Oct 31
@ -285,7 +381,7 @@ Zone America/Argentina/La_Rioja -4:27:24 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 20
-3:00 - ART
-3:00 Arg AR%sT
#
# San Juan (SJ)
Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31
@ -298,7 +394,7 @@ Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
-3:00 - ART
-3:00 Arg AR%sT
#
# Jujuy (JY)
Zone America/Argentina/Jujuy -4:21:12 - LMT 1894 Oct 31
@ -312,7 +408,7 @@ Zone America/Argentina/Jujuy -4:21:12 - LMT 1894 Oct 31
-3:00 1:00 ARST 1992
-3:00 Arg AR%sT 1999 Oct 3
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART
-3:00 Arg AR%sT
#
# Catamarca (CT), Chubut (CH)
Zone America/Argentina/Catamarca -4:23:08 - LMT 1894 Oct 31
@ -325,7 +421,7 @@ Zone America/Argentina/Catamarca -4:23:08 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 20
-3:00 - ART
-3:00 Arg AR%sT
#
# Mendoza (MZ)
Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31
@ -342,6 +438,23 @@ Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 May 23
-4:00 - WART 2004 Sep 26
-3:00 Arg AR%sT
#
# San Luis (SL)
Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
-4:16:48 - CMT 1920 May
-4:00 - ART 1930 Dec
-4:00 Arg AR%sT 1969 Oct 5
-3:00 Arg AR%sT 1990
-3:00 1:00 ARST 1990 Mar 14
-4:00 - WART 1990 Oct 15
-4:00 1:00 WARST 1991 Mar 1
-4:00 - WART 1991 Jun 1
-3:00 - ART 1999 Oct 3
-4:00 1:00 WARST 2000 Mar 3
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
-3:00 Arg AR%sT 2008 Jan 21
-3:00 - ART
#
# Santa Cruz (SC)
@ -353,7 +466,7 @@ Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 Jun 1
-4:00 - WART 2004 Jun 20
-3:00 - ART
-3:00 Arg AR%sT
#
# Tierra del Fuego, Antartida e Islas del Atlantico Sur (TF)
Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31
@ -364,7 +477,7 @@ Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31
-4:00 Arg AR%sT 2000 Mar 3
-3:00 - ART 2004 May 30
-4:00 - WART 2004 Jun 20
-3:00 - ART
-3:00 Arg AR%sT
# Aruba
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -450,6 +563,50 @@ Zone America/La_Paz -4:32:36 - LMT 1890
# Brazil will start DST on 2007-10-14 00:00 and end on 2008-02-17 00:00:
# http://www.mme.gov.br/site/news/detail.do;jsessionid=BBA06811AFCAAC28F0285210913513DA?newsId=13975
# From Paul Schulze (2008-06-24):
# ...by law number 11.662 of April 24, 2008 (published in the "Diario
# Oficial da Uniao"...) in Brazil there are changes in the timezones,
# effective today (00:00am at June 24, 2008) as follows:
#
# a) The timezone UTC+5 is e[x]tinguished, with all the Acre state and the
# part of the Amazonas state that had this timezone now being put to the
# timezone UTC+4
# b) The whole Para state now is put at timezone UTC+3, instead of just
# part of it, as was before.
#
# This change follows a proposal of senator Tiao Viana of Acre state, that
# proposed it due to concerns about open television channels displaying
# programs inappropriate to youths in the states that had the timezone
# UTC+5 too early in the night. In the occasion, some more corrections
# were proposed, trying to unify the timezones of any given state. This
# change modifies timezone rules defined in decree 2.784 of 18 June,
# 1913.
# From Rodrigo Severo (2008-06-24):
# Just correcting the URL:
# <a href="https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008">
# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008
# </a>
#
# As a result of the above Decree I believe the America/Rio_Branco
# timezone shall be modified from UTC-5 to UTC-4 and a new timezone shall
# be created to represent the the west side of the Para State. I
# suggest this new timezone be called Santarem as the most
# important/populated city in the affected area.
#
# This new timezone would be the same as the Rio_Branco timezone up to
# the 2008/06/24 change which would be to UTC-3 instead of UTC-4.
# From Alex Krivenyshev (2008-06-24):
# This is a quick reference page for New and Old Brazil Time Zones map.
# <a href="http://www.worldtimezone.com/brazil-time-new-old.php">
# http://www.worldtimezone.com/brazil-time-new-old.php
# </a>
#
# - 4 time zones replaced by 3 time zones-eliminating time zone UTC- 05
# (state Acre and the part of the Amazonas will be UTC/GMT- 04) - western
# part of Par state is moving to one timezone UTC- 03 (from UTC -04).
# From Paul Eggert (2002-10-10):
# The official decrees referenced below are mostly taken from
# <a href="http://pcdsh01.on.br/DecHV.html">
@ -572,13 +729,13 @@ Rule Brazil 2000 only - Feb 27 0:00 0 -
Rule Brazil 2000 2001 - Oct Sun>=8 0:00 1:00 S
Rule Brazil 2001 2006 - Feb Sun>=15 0:00 0 -
# Decree 4,399 (2002-10-01) repeals DST in AL, CE, MA, PB, PE, PI, RN, SE.
# <a href="http://www.presidencia.gov.br/CCIVIL/decreto/2002/D4399.htm"></a>
# <a href="http://www.presidencia.gov.br/CCIVIL/decreto/2002/D4399.htm">4,399</a>
Rule Brazil 2002 only - Nov 3 0:00 1:00 S
# Decree 4,844 (2003-09-24; corrected 2003-09-26) repeals DST in BA, MT, TO.
# <a href="http://www.presidencia.gov.br/CCIVIL/decreto/2003/D4844.htm"></a>
# <a href="http://www.presidencia.gov.br/CCIVIL/decreto/2003/D4844.htm">4,844</a>
Rule Brazil 2003 only - Oct 19 0:00 1:00 S
# Decree 5,223 (2004-10-01) reestablishes DST in MT.
# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2004-2006/2004/Decreto/D5223.htm"></a>
# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2004-2006/2004/Decreto/D5223.htm">5,223</a>
Rule Brazil 2004 only - Nov 2 0:00 1:00 S
# Decree <a href="http://pcdsh01.on.br/DecHV5539.gif">5,539</a> (2005-09-19),
# adopted by the same states as before.
@ -587,9 +744,8 @@ Rule Brazil 2005 only - Oct 16 0:00 1:00 S
# adopted by the same states as before.
Rule Brazil 2006 only - Nov 5 0:00 1:00 S
Rule Brazil 2007 only - Feb 25 0:00 0 -
# (Decree number not yet known)
# http://www.brasil.gov.br/noticias/ultimas_noticias/horario_verao070920/
# (2007-09-20) after a heads-up from Steffen Thorsen:
# Decree <a href="http://pcdsh01.on.br/DecHV6212.gif">6,212</a> (2007-09-26),
# adopted by the same states as before.
Rule Brazil 2007 max - Oct Sun>=8 0:00 1:00 S
Rule Brazil 2008 max - Feb Sun>=15 0:00 0 -
# The latest ruleset listed above says that the following states observe DST:
@ -597,7 +753,6 @@ Rule Brazil 2008 max - Feb Sun>=15 0:00 0 -
# For dates after mid-2008, the above rules with TO="max" are guesses
# and are quite possibly wrong, but are more likely than no DST at all.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
# Fernando de Noronha (administratively part of PE)
@ -623,6 +778,13 @@ Zone America/Belem -3:13:56 - LMT 1914
-3:00 Brazil BR%sT 1988 Sep 12
-3:00 - BRT
#
# west Para (PA)
# West Para includes Altamira, Oribidos, Prainha, Oriximina, and Santarem.
Zone America/Santarem -3:38:48 - LMT 1914
-4:00 Brazil AM%sT 1988 Sep 12
-4:00 - AMT 2008 Jun 24 00:00
-3:00 - BRT
#
# Maranhao (MA), Piaui (PI), Ceara (CE), Rio Grande do Norte (RN),
# Paraiba (PB)
Zone America/Fortaleza -2:34:00 - LMT 1914
@ -685,8 +847,7 @@ Zone America/Cuiaba -3:44:20 - LMT 1914
-4:00 - AMT 2004 Oct 1
-4:00 Brazil AM%sT
#
# west Para (PA), Rondonia (RO)
# West Para includes Altamira, Oribidos, Prainha, Oriximina, and Santarem.
# Rondonia (RO)
Zone America/Porto_Velho -4:15:36 - LMT 1914
-4:00 Brazil AM%sT 1988 Sep 12
-4:00 - AMT
@ -713,13 +874,14 @@ Zone America/Eirunepe -4:39:28 - LMT 1914
-5:00 Brazil AC%sT 1988 Sep 12
-5:00 - ACT 1993 Sep 28
-5:00 Brazil AC%sT 1994 Sep 22
-5:00 - ACT
-5:00 - ACT 2008 Jun 24 00:00
-4:00 - AMT
#
# Acre (AC)
Zone America/Rio_Branco -4:31:12 - LMT 1914
-5:00 Brazil AC%sT 1988 Sep 12
-5:00 - ACT
-5:00 - ACT 2008 Jun 24 00:00
-4:00 - AMT
# Chile
@ -753,6 +915,26 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# America/Santiago. The pre-1980 Pacific/Easter data are dubious,
# but we have no other source.
# From German Poo-Caaman~o (2008-03-03):
# Due to drought, Chile extends Daylight Time in three weeks. This
# is one-time change (Saturday 3/29 at 24:00 for America/Santiago
# and Saturday 3/29 at 22:00 for Pacific/Easter)
# The Supreme Decree is located at
# <a href="http://www.shoa.cl/servicios/supremo316.pdf">
# http://www.shoa.cl/servicios/supremo316.pdf
# </a>
# and the instructions for 2008 are located in:
# <a href="http://www.horaoficial.cl/cambio.htm">
# http://www.horaoficial.cl/cambio.htm
# </a>.
# From Jose Miguel Garrido (2008-03-05):
# ...
# You could see the announces of the change on
# <a href="http://www.shoa.cl/noticias/2008/04hora/hora.htm">
# http://www.shoa.cl/noticias/2008/04hora/hora.htm
# </a>.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 -
@ -783,7 +965,11 @@ Rule Chile 1998 only - Mar Sun>=9 3:00u 0 -
Rule Chile 1998 only - Sep 27 4:00u 1:00 S
Rule Chile 1999 only - Apr 4 3:00u 0 -
Rule Chile 1999 max - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2000 max - Mar Sun>=9 3:00u 0 -
Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# N.B.: the end of March 29 in Chile is March 30 in Universal time,
# which is used below in specifying the transition.
Rule Chile 2008 only - Mar 30 3:00u 0 -
Rule Chile 2009 max - Mar Sun>=9 3:00u 0 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -1129,19 +1315,17 @@ Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28
# Venezuela
#
# From Kiraz Janicke (2007-09-25), in
# http://www.venezuelanalysis.com/analysis/2645:
# The proposal ... involves turning the clock back half an hour from
# +4.00 Greenwich Mean Time (GMT), to +4.30GMT, the time zone
# Venezuela had until December 31, 1964, when the current time zone
# was adopted. The change was due to take place on September 17 and
# then on September 24, but has since been postponed until December
# 31, to allow for compliance with international organizations, such
# as the International Office of Weights and Measures.
# From John Stainforth (2007-11-28):
# ... the change for Venezuela originally expected for 2007-12-31 has
# been brought forward to 2007-12-09. The official announcement was
# published today in the "Gaceta Oficial de la Republica Bolivariana
# de Venezuela, numero 38.819" (official document for all laws or
# resolution publication)
# http://www.globovision.com/news.php?nid=72208
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Caracas -4:27:44 - LMT 1890
-4:27:40 - CMT 1912 Feb 12 # Caracas Mean Time?
-4:30 - VET 1965 # Venezuela Time
-4:00 - VET 2008
-4:00 - VET 2007 Dec 9 03:00
-4:30 - VET

View File

@ -64,7 +64,8 @@ AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Station, Terre Adelie
AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, LP, MN, NQ, RN, SA, SE, SF, SL)
AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, LP, MN, NQ, RN, SA, SE, SF)
AR -3319-06621 America/Argentina/San_Luis San Luis (SL)
AR -2411-06518 America/Argentina/Jujuy Jujuy (JY)
AR -2649-06513 America/Argentina/Tucuman Tucuman (TM)
AR -2828-06547 America/Argentina/Catamarca Catamarca (CT), Chubut (CH)
@ -99,6 +100,7 @@ BG +4241+02319 Europe/Sofia
BH +2623+05035 Asia/Bahrain
BI -0323+02922 Africa/Bujumbura
BJ +0629+00237 Africa/Porto-Novo
BL +1753-06251 America/St_Barthelemy
BM +3217-06446 Atlantic/Bermuda
BN +0456+11455 Asia/Brunei
BO -1630-06809 America/La_Paz
@ -112,7 +114,8 @@ BR -1259-03831 America/Bahia Bahia
BR -2332-04637 America/Sao_Paulo S & SE Brazil (GO, DF, MG, ES, RJ, SP, PR, SC, RS)
BR -2027-05437 America/Campo_Grande Mato Grosso do Sul
BR -1535-05605 America/Cuiaba Mato Grosso
BR -0846-06354 America/Porto_Velho W Para, Rondonia
BR -0226-05452 America/Santarem W Para
BR -0846-06354 America/Porto_Velho Rondonia
BR +0249-06040 America/Boa_Vista Roraima
BR -0308-06001 America/Manaus E Amazonas
BR -0640-06952 America/Eirunepe W Amazonas
@ -230,7 +233,7 @@ ID -0232+14042 Asia/Jayapura Irian Jaya & the Moluccas
IE +5320-00615 Europe/Dublin
IL +3146+03514 Asia/Jerusalem
IM +5409-00428 Europe/Isle_of_Man
IN +2232+08822 Asia/Calcutta
IN +2232+08822 Asia/Kolkata
IO -0720+07225 Indian/Chagos
IQ +3321+04425 Asia/Baghdad
IR +3540+05126 Asia/Tehran
@ -272,6 +275,7 @@ MA +3339-00735 Africa/Casablanca
MC +4342+00723 Europe/Monaco
MD +4700+02850 Europe/Chisinau
ME +4226+01916 Europe/Podgorica
MF +1804-06305 America/Marigot
MG -1855+04731 Indian/Antananarivo
MH +0709+17112 Pacific/Majuro most locations
MH +0905+16720 Pacific/Kwajalein Kwajalein
@ -361,8 +365,7 @@ SE +5920+01803 Europe/Stockholm
SG +0117+10351 Asia/Singapore
SH -1555-00542 Atlantic/St_Helena
SI +4603+01431 Europe/Ljubljana
SJ +7800+01600 Arctic/Longyearbyen Svalbard
SJ +7059-00805 Atlantic/Jan_Mayen Jan Mayen
SJ +7800+01600 Arctic/Longyearbyen
SK +4809+01707 Europe/Bratislava
SL +0830-01315 Africa/Freetown
SM +4355+01228 Europe/San_Marino
@ -432,7 +435,7 @@ VC +1309-06114 America/St_Vincent
VE +1030-06656 America/Caracas
VG +1827-06437 America/Tortola
VI +1821-06456 America/St_Thomas
VN +1045+10640 Asia/Saigon
VN +1045+10640 Asia/Ho_Chi_Minh
VU -1740+16825 Pacific/Efate
WF -1318-17610 Pacific/Wallis
WS -1350-17144 Pacific/Apia

View File

@ -32,7 +32,6 @@ include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = \
addjsum \
auto_multi \
buildmetaindex \
commentchecker \
compile_font_config \

View File

@ -1,458 +0,0 @@
/*
* Copyright 1998-2001 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.
*/
package build.tools.automulti;
import java.lang.reflect.*;
import java.util.*;
import java.io.*;
/**
* Automatically generates the Multiplexing UI classes
* for Swing.
* <p>
* To use, type 'java AutoMulti <plafdir> <prefix>' where <plafdir>
* is the directory containing the source for Swing's UI classes and
* <prefix> is the package prefix to use before ".swing.plaf.multi".
* For example:
*
* <pre>
* cd TEST
* ../../../../build/solaris-sparc/bin/java AutoMulti ../../../../src/share/classes/javax/swing/plaf javax
* </pre>
*
* AutoMulti will scour the plaf directory for *UI.java files and
* generate Multi*UI.java files that do the multiplexing thing.
* <p>
* NOTE: This tool depends upon the existence of <plafdir> and on the
* compiled classes from <plafdir> being somewhere in the class path.
*
* @author Willie Walker
*/
public class AutoMulti {
static String importLines;
/**
* A silly list of parameter names to use. Skips "i" because we use
* it as a 'for' loop counter. If you want to get fancy, please feel
* to change how parameter names are obtained. This will break if
* someone decides to create a UI method that takes more than 8
* parameters. Which one is a bug (this breaking or having a method
* with more than eight parameters) is a subjective thing.
*/
public static String[] paramNames = {"a","b","c","d","e","f","g","h"};
/**
* Removes the package names (e.g., javax.swing) from the name.
*/
public static String unqualifyName(String name) {
StringTokenizer parser = new StringTokenizer(name,".");
String unqualifiedName = null;
while (parser.hasMoreTokens()) {
unqualifiedName = parser.nextToken();
}
return removeDollars(unqualifiedName);
}
/**
* Strips the extension from the filename.
*/
public static String stripExtension(String name) {
StringTokenizer parser = new StringTokenizer(name,".");
return parser.nextToken();
}
/**
* Adds some spaces.
*/
public static void indent(StringBuffer s, int i) {
while (i > 0) {
s.append(" ");
i--;
}
}
/**
* Spits out all the beginning stuff.
*/
public static StringBuffer createPreamble(String prefixName) {
StringBuffer s = new StringBuffer();
s.append("/*\n");
s.append(" *\n");
s.append(" * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.\n");
s.append(" * \n");
s.append(" * This software is the proprietary information of Sun Microsystems, Inc. \n");
s.append(" * Use is subject to license terms.\n");
s.append(" * \n");
s.append(" */\n");
s.append("package " + prefixName + ".swing.plaf.multi;\n");
s.append("\n");
return s;
}
/**
* Replaces 'Xxx$Yyy' with "Xxx'. Used by addImport because you
* can't import nested classes directly.
*/
public static String removeNestedClassName(String s) {
int dollarPosition = s.indexOf('$');
if (dollarPosition >= 0) { // s contains '$'
StringBuffer sb = new StringBuffer(s);
sb.setLength(dollarPosition);
return sb.toString();
} else { // no '$'
return s;
}
}
/**
* Replaces '$' with ".'. Needed for printing inner class names
* for argument and return types.
*/
public static String removeDollars(String s) {
int dollarPosition = s.indexOf('$');
if (dollarPosition >= 0) { // s contains '$'
StringBuffer sb = new StringBuffer(s);
while (dollarPosition >= 0) {
//XXX: will there ever be more than one '$'?
sb.replace(dollarPosition, dollarPosition+1, ".");
dollarPosition = sb.indexOf("$", dollarPosition);
}
return sb.toString();
} else { // no $
return s;
}
}
/**
* Adds an import line to the String.
*/
public static void addImport(String s, Class theClass) {
if (!theClass.isPrimitive() && (theClass != Object.class)) {
String className = removeNestedClassName(theClass.getName());
String importLine = new String("import " + className + ";\n");
if (importLines.indexOf(importLine) == -1) {
importLines += importLine;
}
}
}
/**
* Spits out the class header information.
*/
public static void addHeader(StringBuffer s, String className) {
s.append("/**\n");
s.append(" * A multiplexing UI used to combine <code>" + className + "</code>s.\n");
s.append(" * \n");
s.append(" * <p>This file was automatically generated by AutoMulti.\n");
s.append(" *\n");
s.append(" * @author Otto Multey\n"); // Get it? I crack myself up.
s.append(" */\n");
s.append("public class Multi" + className + " extends " + className + " {\n");
s.append("\n");
s.append(" /**\n");
s.append(" * The vector containing the real UIs. This is populated \n");
s.append(" * in the call to <code>createUI</code>, and can be obtained by calling\n");
s.append(" * the <code>getUIs</code> method. The first element is guaranteed to be the real UI \n");
s.append(" * obtained from the default look and feel.\n");
s.append(" */\n");
s.append(" protected Vector uis = new Vector();\n");
s.append("\n");
s.append("////////////////////\n");
s.append("// Common UI methods\n");
s.append("////////////////////\n");
s.append("\n");
s.append(" /**\n");
s.append(" * Returns the list of UIs associated with this multiplexing UI. This \n");
s.append(" * allows processing of the UIs by an application aware of multiplexing \n");
s.append(" * UIs on components.\n");
s.append(" */\n");
s.append(" public ComponentUI[] getUIs() {\n");
s.append(" return MultiLookAndFeel.uisToArray(uis);\n");
s.append(" }\n");
}
/**
* Prints out the code for a method. This is pretty specific to the
* Multiplexing UI code, so don't get any fancy ideas.
*/
public static void addMethod(StringBuffer s, Method m, String origName, String className) {
// Get the method name and the return type. Be a little careful about arrays.
//
String methodName = unqualifyName(m.getName());
String returnType;
if (!m.getReturnType().isArray()) {
returnType = unqualifyName(m.getReturnType().toString());
addImport(importLines,m.getReturnType());
} else {
returnType = unqualifyName(m.getReturnType().getComponentType().toString())
+ "[]";
addImport(importLines,m.getReturnType().getComponentType());
}
// Print the javadoc
//
s.append("\n");
if (methodName.equals("createUI")) {
s.append(" /**\n");
s.append(" * Returns a multiplexing UI instance if any of the auxiliary\n");
s.append(" * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the \n");
s.append(" * UI object obtained from the default <code>LookAndFeel</code>.\n");
s.append(" */\n");
} else if (!returnType.equals("void")) {
s.append(" /**\n");
s.append(" * Invokes the <code>" + methodName + "</code> method on each UI handled by this object.\n");
s.append(" * \n");
s.append(" * @return the value obtained from the first UI, which is\n");
s.append(" * the UI obtained from the default <code>LookAndFeel</code>\n");
s.append(" */\n");
} else {
s.append(" /**\n");
s.append(" * Invokes the <code>" + methodName
+ "</code> method on each UI handled by this object.\n");
s.append(" */\n");
}
// Print the method signature
//
s.append(" public");
if (Modifier.isStatic(m.getModifiers())) {
s.append(" static");
}
s.append(" " + returnType);
s.append(" " + methodName);
s.append("(");
Class[] params = m.getParameterTypes();
Class temp;
String braces;
for (int i = 0; i < params.length; i++) {
if (i > 0) {
s.append(", ");
}
temp = params[i];
braces = new String("");
while (temp.isArray()) {
braces += "[]";
temp = temp.getComponentType();
}
s.append(unqualifyName(temp.getName()) + braces + " " + paramNames[i]);
addImport(importLines,temp);
}
s.append(")");
// Don't forget about exceptions
//
Class exceptions[] = m.getExceptionTypes();
String throwsString = new String("");
if (exceptions.length > 0) {
s.append("\n");
indent(s,12);
s.append("throws ");
for (int i = 0; i < exceptions.length; i++) {
if (i > 0) {
s.append(", ");
}
s.append(unqualifyName(exceptions[i].getName()));
addImport(importLines,exceptions[i]);
}
}
s.append(throwsString + " {\n");
// Now print out the contents of the method. We do a special thing
// for the createUI method, another thing if the method returns 'void'
// and a third thing if we don't do either of the first two. If
// you want to squash this down, feel free.
//
if (methodName.equals("createUI")) {
indent(s,8);
s.append("ComponentUI mui = new Multi" + origName + "();\n");
indent(s,8);
s.append("return MultiLookAndFeel.createUIs(mui,\n");
indent(s,42);
s.append("((Multi" + origName +") mui).uis,\n");
indent(s,42);
for (int i = 0; i < params.length; i++) {
if (i > 0) {
s.append(",");
}
s.append(paramNames[i]);
}
s.append(");\n");
} else if (!returnType.equals("void")) {
indent(s,8);
s.append(returnType + " returnValue = \n");
indent(s,12);
s.append("((" + className + ") (uis.elementAt(0)))."
+ methodName + "(");
for (int i = 0; i < params.length; i++) {
if (i > 0) {
s.append(",");
}
s.append(paramNames[i]);
}
s.append(");\n");
indent(s,8);
s.append("for (int i = 1; i < uis.size(); i++) {\n");
indent(s,12);
s.append("((" + className + ") (uis.elementAt(i)))."
+ methodName + "(");
for (int i = 0; i < params.length; i++) {
if (i > 0) {
s.append(",");
}
s.append(paramNames[i]);
}
s.append(");\n");
indent(s,8);
s.append("}\n");
indent(s,8);
s.append("return returnValue;\n");
} else {
indent(s,8);
s.append("for (int i = 0; i < uis.size(); i++) {\n");
indent(s,12);
s.append("((" + className + ") (uis.elementAt(i)))."
+ methodName + "(");
for (int i = 0; i < params.length; i++) {
if (i > 0) {
s.append(",");
}
s.append(paramNames[i]);
}
s.append(");\n");
indent(s,8);
s.append("}\n");
}
indent(s,4);
s.append("}\n");
}
/**
* Takes a plaf class name (e.g., "MenuUI") and generates the corresponding
* Multiplexing UI Java source code (e.g., "MultiMenuUI.java").
*/
public static void generateFile(String prefixName, String className) {
try {
FileOutputStream fos;
PrintWriter outFile;
importLines = new String();
importLines += new String("import java.util.Vector;\n");
StringBuffer body = new StringBuffer();
Class wee = Class.forName(prefixName + ".swing.plaf." + className);
String weeName = unqualifyName(wee.getName());
addImport(importLines,wee);
while (!weeName.equals("Object")) {
body.append("\n");
body.append("////////////////////\n");
body.append("// " + weeName + " methods\n");
body.append("////////////////////\n");
Method[] methods = wee.getDeclaredMethods();
for (int i=0; i < methods.length; i++) {
if (Modifier.isPublic(methods[i].getModifiers())) {
addMethod(body,methods[i],className,weeName);
}
}
wee = wee.getSuperclass();
weeName = unqualifyName(wee.getName());
addImport(importLines,wee);
}
fos = new FileOutputStream("Multi" + className + ".java");
outFile = new PrintWriter(fos);
StringBuffer outText = createPreamble(prefixName);
outText.append(importLines.toString() + "\n");
addHeader(outText,className);
outText.append(body.toString());
outText.append("}\n");
outFile.write(outText.toString());
outFile.flush();
outFile.close();
} catch (Exception e) {
System.err.println(e);
}
}
/**
* D'Oh! Something bad happened.
*/
public static void usage(String s) throws IOException {
System.err.println("Usage: AutoMulti <plafdir> [com.sun]");
throw new IllegalArgumentException(s);
}
/**
* Takes the plaf directory name and generates the multiplexing UI
* source code.
*/
public static void main(String[] args) throws IOException {
if (args.length < 1) {
usage("");
}
String dirName = args[0];
File dir = new File(dirName);
if (!dir.isDirectory()) {
System.err.println("No such directory: " + dirName);
usage("");
}
String prefixName;
if (args.length > 1) {
prefixName = args[1];
} else {
prefixName = "com.sun.java";
}
String plafUIs[] = dir.list(new UIJavaFilter());
for (int i = 0; i < plafUIs.length; i++) {
generateFile(prefixName,stripExtension(plafUIs[i]));
}
}
}
/**
* Only accepts file names of the form *UI.java. The one exception
* is not accepting ComponentUI.java because we don't need to generate
* a multiplexing class for it.
*/
class UIJavaFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
if (name.equals("ComponentUI.java")) {
return false;
} else if (name.endsWith("UI.java")) {
return true;
} else {
return false;
}
}
}

View File

@ -1,36 +0,0 @@
AutoMulti is the tool that automatically generates the
Multi*UI classes for the Multiplexing look and feel.
Instructions for using it are in AutoMulti.java.
TestALFGenerator is a tool (a variation of AutoMulti)
that automatically generates an auxiliary look and
feel that you can use to test the Multiplexing look
and feel. The TestALF look and feel implements every
method by printing the message "In the xxx method of
the TextALFYyyUI class." and, except in the case of
createUI, returning something meaningless (since,
except in the case of createUI, the return value is
ignored).
TestALFLookAndFeel.java is the only non-auto-generated
file for the TestALF L&F. If you specify a package
argument to TestALFGenerator, you'll have to change
the code in TestALFLookAndFeel.java to reflect the
package name.
To test any application with the TestALF, make sure the
compiled TestALF classes are in the class path. Then add
this to the <JDK_HOME>/lib/swing.properties file (which
you'll probably have to create):
swing.auxiliarylaf=TestALFLookAndFeel
E.g., if you're running SwingSet2 against your solaris
build, then you'd create/edit the swing.properties file
in <wsdir>/build/solaris-sparc/lib.
Then run any app. You'll see lots of thrilling "In the
Xxxx method of the Yyy class" messages. If you get anything
else (especially an exception), then you've found a bug.
Probably in the default look and feel.

View File

@ -1,401 +0,0 @@
/*
* Copyright 2001 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.
*/
package build.tools.automulti;
import java.lang.reflect.*;
import java.util.*;
import java.io.*;
/**
* Automatically generates an auxiliary look and feel to be
* used for testing the Multiplexing look and feel.
* <p>
* To use, type 'java TestALFGenerator <plafdir> [<package>]' where <plafdir>
* is the directory containing the source for Swing's UI classes.
* <package> is an optional argument that specifies the package
* of the TestALF classes. If it's omitted, the classes are in
* the default package.
* For example:
*
* <pre>
* ../../../../build/solaris-sparc/bin/java TestALFGenerator ../../../../src/share/classes/javax/swing/plaf com.myco.myalaf
* </pre>
*
* TestALFGenerator will scour the plaf directory for *UI.java files and
* generate TestALF*UI.java files.
* <p>
* NOTE: This tool depends upon the existence of <plafdir> and on the
* compiled classes from <plafdir> being somewhere in the class path.
*
* @author Willie Walker
*/
public class TestALFGenerator {
static String importLines;
static String packageName;
static String classPrefix = "TestALF";
/**
* A silly list of parameter names to use. Skips "i" because we use
* it as a 'for' loop counter. If you want to get fancy, please feel
* to change how parameter names are obtained. This will break if
* someone decides to create a UI method that takes more than 8
* parameters. Which one is a bug (this breaking or having a method
* with more than eight parameters) is a subjective thing.
*/
public static String[] paramNames = {"a","b","c","d","e","f","g","h"};
/**
* Removes the package names (e.g., javax.swing) from the name.
*/
public static String unqualifyName(String name) {
StringTokenizer parser = new StringTokenizer(name,".");
String unqualifiedName = null;
while (parser.hasMoreTokens()) {
unqualifiedName = parser.nextToken();
}
return removeDollars(unqualifiedName);
}
/**
* Strips the extension from the filename.
*/
public static String stripExtension(String name) {
StringTokenizer parser = new StringTokenizer(name,".");
return parser.nextToken();
}
/**
* Adds some spaces.
*/
public static void indent(StringBuffer s, int i) {
while (i > 0) {
s.append(" ");
i--;
}
}
/**
* Spits out all the beginning stuff.
*/
public static StringBuffer createPreamble(String prefixName) {
StringBuffer s = new StringBuffer();
s.append("/*\n");
s.append(" *\n");
s.append(" * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.\n");
s.append(" * \n");
s.append(" * This software is the proprietary information of Sun Microsystems, Inc. \n");
s.append(" * Use is subject to license terms.\n");
s.append(" * \n");
s.append(" */\n");
if (packageName != null) {
s.append("package " + packageName + ";\n");
s.append("\n");
}
return s;
}
/**
* Replaces 'Xxx$Yyy' with "Xxx'. Used by addImport because you
* can't import nested classes directly.
*/
public static String removeNestedClassName(String s) {
int dollarPosition = s.indexOf('$');
if (dollarPosition >= 0) { // s contains '$'
StringBuffer sb = new StringBuffer(s);
sb.setLength(dollarPosition);
return sb.toString();
} else { // no '$'
return s;
}
}
/**
* Replaces '$' with ".'. Needed for printing inner class names
* for argument and return types.
*/
public static String removeDollars(String s) {
int dollarPosition = s.indexOf('$');
if (dollarPosition >= 0) { // s contains '$'
StringBuffer sb = new StringBuffer(s);
while (dollarPosition >= 0) {
//XXX: will there ever be more than one '$'?
sb.replace(dollarPosition, dollarPosition+1, ".");
dollarPosition = sb.indexOf("$", dollarPosition);
}
return sb.toString();
} else { // no $
return s;
}
}
/**
* Adds an import line to the String.
*/
public static void addImport(String s, Class theClass) {
if (!theClass.isPrimitive() && (theClass != Object.class)) {
String className = removeNestedClassName(theClass.getName());
String importLine = new String("import " + className + ";\n");
if (importLines.indexOf(importLine) == -1) {
importLines += importLine;
}
}
}
/**
* Spits out the class header information.
*/
public static void addHeader(StringBuffer s, String className) {
s.append("/**\n");
s.append(" * An auxiliary UI for <code>" + className + "</code>s.\n");
s.append(" * \n");
s.append(" * <p>This file was automatically generated by TestALFGenerator.\n");
s.append(" *\n");
s.append(" * @author Otto Multey\n"); // Get it? I crack myself up.
s.append(" */\n");
s.append("public class " + classPrefix + className + " extends " + className + " {\n");
s.append("\n");
}
/**
* Prints out the code for a method.
*/
public static void addMethod(StringBuffer s, Method m, String origName, String className) {
// Get the method name and the return type. Be a little careful about arrays.
//
String methodName = unqualifyName(m.getName());
String returnType;
if (!m.getReturnType().isArray()) {
returnType = unqualifyName(m.getReturnType().toString());
addImport(importLines,m.getReturnType());
} else {
returnType = unqualifyName(m.getReturnType().getComponentType().toString())
+ "[]";
addImport(importLines,m.getReturnType().getComponentType());
}
// Print the javadoc
//
s.append("\n");
if (methodName.equals("createUI")) {
s.append(" /**\n");
s.append(" * Returns a UI object for this component.\n");
s.append(" */\n");
} else {
s.append(" /**\n");
s.append(" * Prints a message saying this method has been invoked.\n");
s.append(" */\n");
}
// Print the method signature
//
s.append(" public");
if (Modifier.isStatic(m.getModifiers())) {
s.append(" static");
}
s.append(" " + returnType);
s.append(" " + methodName);
s.append("(");
Class[] params = m.getParameterTypes();
Class temp;
String braces;
for (int i = 0; i < params.length; i++) {
if (i > 0) {
s.append(", ");
}
temp = params[i];
braces = new String("");
while (temp.isArray()) {
braces += "[]";
temp = temp.getComponentType();
}
s.append(unqualifyName(temp.getName()) + braces + " " + paramNames[i]);
addImport(importLines,temp);
}
s.append(")");
// Don't forget about exceptions
//
Class exceptions[] = m.getExceptionTypes();
String throwsString = new String("");
if (exceptions.length > 0) {
s.append("\n");
indent(s,12);
s.append("throws ");
for (int i = 0; i < exceptions.length; i++) {
if (i > 0) {
s.append(", ");
}
s.append(unqualifyName(exceptions[i].getName()));
addImport(importLines,exceptions[i]);
}
}
s.append(throwsString + " {\n");
// Now print out the contents of the method.
indent(s,8);
s.append("System.out.println(\"In the " + methodName
+ " method of the "
+ classPrefix + origName + " class.\");\n");
if (methodName.equals("createUI")) {
indent(s,8);
s.append("return ui;\n");
} else {
// If we have to return something, do so.
if (!returnType.equals("void")) {
Class rType = m.getReturnType();
indent(s,8);
if (!rType.isPrimitive()) {
s.append("return null;\n");
} else if (rType == Boolean.TYPE) {
s.append("return false;\n");
} else if (rType == Character.TYPE) {
s.append("return '0';\n");
} else { // byte, short, int, long, float, or double
s.append("return 0;\n");
}
}
}
indent(s,4);
s.append("}\n");
}
/**
* Takes a plaf class name (e.g., "MenuUI") and generates the corresponding
* TestALF UI Java source code (e.g., "TestALFMenuUI.java").
*/
public static void generateFile(String prefixName, String className) {
try {
FileOutputStream fos;
PrintWriter outFile;
importLines = new String();
importLines += new String("import java.util.Vector;\n");
StringBuffer body = new StringBuffer();
Class wee = Class.forName(prefixName + ".swing.plaf." + className);
String weeName = unqualifyName(wee.getName());
String thisClassName = classPrefix + className;
addImport(importLines,wee);
// Declare and initialize the shared UI object.
body.append("\n");
body.append("////////////////////\n");
body.append("// Shared UI object\n");
body.append("////////////////////\n");
body.append("private final static " + thisClassName
+ " ui = new " + thisClassName + "();\n");
while (!weeName.equals("Object")) {
body.append("\n");
body.append("////////////////////\n");
body.append("// " + weeName + " methods\n");
body.append("////////////////////\n");
Method[] methods = wee.getDeclaredMethods();
for (int i=0; i < methods.length; i++) {
if (Modifier.isPublic(methods[i].getModifiers())) {
addMethod(body,methods[i],className,weeName);
}
}
wee = wee.getSuperclass();
weeName = unqualifyName(wee.getName());
addImport(importLines,wee);
}
fos = new FileOutputStream(classPrefix + className + ".java");
outFile = new PrintWriter(fos);
StringBuffer outText = createPreamble(prefixName);
outText.append(importLines.toString() + "\n");
addHeader(outText,className);
outText.append(body.toString());
outText.append("}\n");
outFile.write(outText.toString());
outFile.flush();
outFile.close();
} catch (Exception e) {
System.err.println(e);
}
}
/**
* D'Oh! Something bad happened.
*/
public static void usage(String s) throws IOException {
System.err.println("Usage: java TestALFGenerator <plafdir> [<packageName>]");
throw new IllegalArgumentException(s);
}
/**
* Takes the plaf directory name and generates the TestALF UI
* source code.
*/
public static void main(String[] args) throws IOException {
if (args.length < 1) {
usage("");
}
String dirName = args[0];
File dir = new File(dirName);
if (!dir.isDirectory()) {
System.err.println("No such directory: " + dirName);
usage("");
}
if (args.length > 1) {
packageName = args[1];
}
String plafUIs[] = dir.list(new UIJavaFilter());
for (int i = 0; i < plafUIs.length; i++) {
generateFile("javax",stripExtension(plafUIs[i]));
}
}
}
/**
* Only accepts file names of the form *UI.java. The one exception
* is not accepting ComponentUI.java because we don't need to generate
* a TestALF class for it.
*/
class UIJavaFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
if (name.equals("ComponentUI.java")) {
return false;
} else if (name.endsWith("UI.java")) {
return true;
} else {
return false;
}
}
}

View File

@ -1,182 +0,0 @@
/*
* Copyright 2001 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.
*/
//package com.myco.myalaf; //search for myalaf for other refs to package name
package build.tools.automulti;
import java.util.Vector;
import java.lang.reflect.Method;
import javax.swing.*;
import javax.swing.plaf.*;
/**
* <p>An auxiliary look and feel used for testing the Multiplexing
* look and feel.
* <p>
*
* @see UIManager#addAuxiliaryLookAndFeel
* @see javax.swing.plaf.multi
*
* @author Kathy Walrath
* @author Will Walker
*/
public class TestALFLookAndFeel extends LookAndFeel {
//////////////////////////////
// LookAndFeel methods
//////////////////////////////
/**
* Returns a string, suitable for use in menus,
* that identifies this look and feel.
*
* @return a string such as "Test Auxiliary Look and Feel"
*/
public String getName() {
return "Test Auxiliary Look and Feel";
}
/**
* Returns a string, suitable for use by applications/services,
* that identifies this look and feel.
*
* @return "TestALF"
*/
public String getID() {
return "TestALF";
}
/**
* Returns a one-line description of this look and feel.
*
* @return a descriptive string such as "Allows multiple UI instances per component instance"
*/
public String getDescription() {
return "Allows multiple UI instances per component instance";
}
/**
* Returns <code>false</code>;
* this look and feel is not native to any platform.
*
* @return <code>false</code>
*/
public boolean isNativeLookAndFeel() {
return false;
}
/**
* Returns <code>true</code>;
* every platform permits this look and feel.
*
* @return <code>true</code>
*/
public boolean isSupportedLookAndFeel() {
return true;
}
/**
* Creates, initializes, and returns
* the look and feel specific defaults.
* For this look and feel,
* the defaults consist solely of
* mappings of UI class IDs
* (such as "ButtonUI")
* to <code>ComponentUI</code> class names
* (such as "com.myco.myalaf.MultiButtonUI").
*
* @return an initialized <code>UIDefaults</code> object
* @see javax.swing.JComponent#getUIClassID
*/
public UIDefaults getDefaults() {
System.out.println("In the TestALFLookAndFeel getDefaults method.");
UIDefaults table = new TestALFUIDefaults();
//String prefix = "com.myco.myalaf.TestALF";
String prefix = "TestALF";
Object[] uiDefaults = {
"ButtonUI", prefix + "ButtonUI",
"CheckBoxMenuItemUI", prefix + "MenuItemUI",
"CheckBoxUI", prefix + "ButtonUI",
"ColorChooserUI", prefix + "ColorChooserUI",
"ComboBoxUI", prefix + "ComboBoxUI",
"DesktopIconUI", prefix + "DesktopIconUI",
"DesktopPaneUI", prefix + "DesktopPaneUI",
"EditorPaneUI", prefix + "TextUI",
"FileChooserUI", prefix + "FileChooserUI",
"FormattedTextFieldUI", prefix + "TextUI",
"InternalFrameUI", prefix + "InternalFrameUI",
"LabelUI", prefix + "LabelUI",
"ListUI", prefix + "ListUI",
"MenuBarUI", prefix + "MenuBarUI",
"MenuItemUI", prefix + "MenuItemUI",
"MenuUI", prefix + "MenuItemUI",
"OptionPaneUI", prefix + "OptionPaneUI",
"PanelUI", prefix + "PanelUI",
"PasswordFieldUI", prefix + "TextUI",
"PopupMenuSeparatorUI", prefix + "SeparatorUI",
"PopupMenuUI", prefix + "PopupMenuUI",
"ProgressBarUI", prefix + "ProgressBarUI",
"RadioButtonMenuItemUI", prefix + "MenuItemUI",
"RadioButtonUI", prefix + "ButtonUI",
"RootPaneUI", prefix + "RootPaneUI",
"ScrollBarUI", prefix + "ScrollBarUI",
"ScrollPaneUI", prefix + "ScrollPaneUI",
"SeparatorUI", prefix + "SeparatorUI",
"SliderUI", prefix + "SliderUI",
"SpinnerUI", prefix + "SpinnerUI",
"SplitPaneUI", prefix + "SplitPaneUI",
"TabbedPaneUI", prefix + "TabbedPaneUI",
"TableHeaderUI", prefix + "TableHeaderUI",
"TableUI", prefix + "TableUI",
"TextAreaUI", prefix + "TextUI",
"TextFieldUI", prefix + "TextUI",
"TextPaneUI", prefix + "TextUI",
"ToggleButtonUI", prefix + "ButtonUI",
"ToolBarSeparatorUI", prefix + "SeparatorUI",
"ToolBarUI", prefix + "ToolBarUI",
"ToolTipUI", prefix + "ToolTipUI",
"TreeUI", prefix + "TreeUI",
"ViewportUI", prefix + "ViewportUI",
};
table.putDefaults(uiDefaults);
return table;
}
}
/**
* We want the Test auxiliary look and feel to be quiet and fallback
* gracefully if it cannot find a UI. This class overrides the
* getUIError method of UIDefaults, which is the method that
* emits error messages when it cannot find a UI class in the
* LAF.
*/
class TestALFUIDefaults extends UIDefaults {
protected void getUIError(String msg) {
System.err.println("Test auxiliary L&F: " + msg);
}
}

View File

@ -0,0 +1,84 @@
/*
* Copyright 2008 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.
*/
package com.sun.beans;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A hashtable-based cache with weak keys and weak values.
* An entry in the map will be automatically removed
* when its key is no longer in the ordinary use.
* A value will be automatically removed as well
* when it is no longer in the ordinary use.
*
* @since 1.7
*
* @author Sergey A. Malenkov
*/
public final class WeakCache<K, V> {
private final Map<K, Reference<V>> map = new WeakHashMap<K, Reference<V>>();
/**
* Returns a value to which the specified {@code key} is mapped,
* or {@code null} if this map contains no mapping for the {@code key}.
*
* @param key the key whose associated value is returned
* @return a value to which the specified {@code key} is mapped
*/
public V get(K key) {
Reference<V> reference = this.map.get(key);
if (reference == null) {
return null;
}
V value = reference.get();
if (value == null) {
this.map.remove(key);
}
return value;
}
/**
* Associates the specified {@code value} with the specified {@code key}.
* Removes the mapping for the specified {@code key} from this cache
* if it is present and the specified {@code value} is {@code null}.
* If the cache previously contained a mapping for the {@code key},
* the old value is replaced by the specified {@code value}.
*
* @param key the key with which the specified value is associated
* @param value the value to be associated with the specified key
*/
public void put(K key, V value) {
if (value != null) {
this.map.put(key, new WeakReference<V>(value));
}
else {
this.map.remove(key);
}
}
}

View File

@ -0,0 +1,178 @@
/*
* Copyright 2002-2007 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.
*/
package com.sun.java.swing;
import sun.awt.EventQueueDelegate;
import sun.awt.AppContext;
import java.util.Map;
import java.util.concurrent.Callable;
import java.awt.AWTEvent;
import java.awt.EventQueue;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.RepaintManager;
/**
* A collection of utility methods for Swing.
* <p>
* <b>WARNING:</b> While this class is public, it should not be treated as
* public API and its API may change in incompatable ways between dot dot
* releases and even patch releases. You should not rely on this class even
* existing.
*
* This is a second part of sun.swing.SwingUtilities2. It is required
* to provide services for JavaFX applets.
*
*/
public class SwingUtilities3 {
/**
* The {@code clientProperty} key for delegate {@code RepaintManager}
*/
private static final Object DELEGATE_REPAINT_MANAGER_KEY =
new StringBuilder("DelegateRepaintManagerKey");
/**
* Registers delegate RepaintManager for {@code JComponent}.
*/
public static void setDelegateRepaintManager(JComponent component,
RepaintManager repaintManager) {
/* setting up flag in AppContext to speed up lookups in case
* there are no delegate RepaintManagers used.
*/
AppContext.getAppContext().put(DELEGATE_REPAINT_MANAGER_KEY,
Boolean.TRUE);
component.putClientProperty(DELEGATE_REPAINT_MANAGER_KEY,
repaintManager);
}
/**
* Returns delegate {@code RepaintManager} for {@code component} hierarchy.
*/
public static RepaintManager getDelegateRepaintManager(Component
component) {
RepaintManager delegate = null;
if (Boolean.TRUE == AppContext.getAppContext().get(
DELEGATE_REPAINT_MANAGER_KEY)) {
while (delegate == null && component != null) {
while (component != null
&& ! (component instanceof JComponent)) {
component = component.getParent();
}
if (component != null) {
delegate = (RepaintManager)
((JComponent) component)
.getClientProperty(DELEGATE_REPAINT_MANAGER_KEY);
component = component.getParent();
}
}
}
return delegate;
}
/*
* We use maps to avoid reflection. Hopefully it should perform better
* this way.
*/
public static void setEventQueueDelegate(
Map<String, Map<String, Object>> map) {
EventQueueDelegate.setDelegate(new EventQueueDelegateFromMap(map));
}
private static class EventQueueDelegateFromMap
implements EventQueueDelegate.Delegate {
private final AWTEvent[] afterDispatchEventArgument;
private final Object[] afterDispatchHandleArgument;
private final Callable<Void> afterDispatchCallable;
private final AWTEvent[] beforeDispatchEventArgument;
private final Callable<Object> beforeDispatchCallable;
private final EventQueue[] getNextEventEventQueueArgument;
private final Callable<AWTEvent> getNextEventCallable;
@SuppressWarnings("unchecked")
public EventQueueDelegateFromMap(Map<String, Map<String, Object>> objectMap) {
Map<String, Object> methodMap = objectMap.get("afterDispatch");
afterDispatchEventArgument = (AWTEvent[]) methodMap.get("event");
afterDispatchHandleArgument = (Object[]) methodMap.get("handle");
afterDispatchCallable = (Callable<Void>) methodMap.get("method");
methodMap = objectMap.get("beforeDispatch");
beforeDispatchEventArgument = (AWTEvent[]) methodMap.get("event");
beforeDispatchCallable = (Callable<Object>) methodMap.get("method");
methodMap = objectMap.get("getNextEvent");
getNextEventEventQueueArgument =
(EventQueue[]) methodMap.get("eventQueue");
getNextEventCallable = (Callable<AWTEvent>) methodMap.get("method");
}
@Override
public void afterDispatch(AWTEvent event, Object handle) throws InterruptedException {
afterDispatchEventArgument[0] = event;
afterDispatchHandleArgument[0] = handle;
try {
afterDispatchCallable.call();
} catch (InterruptedException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public Object beforeDispatch(AWTEvent event) throws InterruptedException {
beforeDispatchEventArgument[0] = event;
try {
return beforeDispatchCallable.call();
} catch (InterruptedException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public AWTEvent getNextEvent(EventQueue eventQueue) throws InterruptedException {
getNextEventEventQueueArgument[0] = eventQueue;
try {
return getNextEventCallable.call();
} catch (InterruptedException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}

View File

@ -442,7 +442,10 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements
}
if (updateModel) {
getColorSelectionModel().setSelectedColor(color);
ColorSelectionModel model = getColorSelectionModel();
if (model != null) {
model.setSelectedColor(color);
}
}
triangle.setColor(hue, saturation, brightness);

View File

@ -770,33 +770,56 @@ class Metacity implements SynthConstants {
JComponent maximizeButton = findChild(titlePane, "InternalFrameTitlePane.maximizeButton");
JComponent closeButton = findChild(titlePane, "InternalFrameTitlePane.closeButton");
int buttonGap = 0;
Insets button_border = (Insets)gm.get("button_border");
Dimension buttonDim = calculateButtonSize(titlePane);
int x = getInt("left_titlebar_edge");
int y = (button_border != null) ? button_border.top : 0;
if (titlePaneParent.getComponentOrientation().isLeftToRight()) {
int x = getInt("left_titlebar_edge");
menuButton.setBounds(x, y, buttonDim.width, buttonDim.height);
menuButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x = w - buttonDim.width - getInt("right_titlebar_edge");
if (button_border != null) {
x -= button_border.right;
}
x = w - buttonDim.width - getInt("right_titlebar_edge");
if (button_border != null) {
x -= button_border.right;
}
if (frame.isClosable()) {
closeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x -= (buttonDim.width + buttonGap);
}
if (frame.isClosable()) {
closeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x -= buttonDim.width;
}
if (frame.isMaximizable()) {
maximizeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x -= (buttonDim.width + buttonGap);
}
if (frame.isMaximizable()) {
maximizeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x -= buttonDim.width;
}
if (frame.isIconifiable()) {
minimizeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
if (frame.isIconifiable()) {
minimizeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
}
} else {
int x = w - buttonDim.width - getInt("right_titlebar_edge");
menuButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x = getInt("left_titlebar_edge");
if (button_border != null) {
x += button_border.left;
}
if (frame.isClosable()) {
closeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x += buttonDim.width;
}
if (frame.isMaximizable()) {
maximizeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
x += buttonDim.width;
}
if (frame.isIconifiable()) {
minimizeButton.setBounds(x, y, buttonDim.width, buttonDim.height);
}
}
}
} // end TitlePaneLayout
@ -973,10 +996,8 @@ class Metacity implements SynthConstants {
String title = jif.getTitle();
if (title != null) {
FontMetrics fm = SwingUtilities2.getFontMetrics(jif, g);
if (jif.getComponentOrientation().isLeftToRight()) {
title = SwingUtilities2.clipStringIfNecessary(jif, fm, title,
calculateTitleTextWidth(g, jif));
}
title = SwingUtilities2.clipStringIfNecessary(jif, fm, title,
calculateTitleArea(jif).width);
g.setColor(color);
SwingUtilities2.drawString(jif, g, title, x, y + fm.getAscent());
}
@ -1010,9 +1031,10 @@ class Metacity implements SynthConstants {
JComponent titlePane = findChild(jif, "InternalFrame.northPane");
Dimension buttonDim = calculateButtonSize(titlePane);
Insets title_border = (Insets)frameGeometry.get("title_border");
Rectangle r = new Rectangle();
Insets button_border = (Insets)getFrameGeometry().get("button_border");
r.x = getInt("left_titlebar_edge") + buttonDim.width;
Rectangle r = new Rectangle();
r.x = getInt("left_titlebar_edge");
r.y = 0;
r.height = titlePane.getHeight();
if (title_border != null) {
@ -1021,15 +1043,36 @@ class Metacity implements SynthConstants {
r.height -= (title_border.top + title_border.bottom);
}
r.width = titlePane.getWidth() - r.x - getInt("right_titlebar_edge");
if (jif.isClosable()) {
r.width -= buttonDim.width;
}
if (jif.isMaximizable()) {
r.width -= buttonDim.width;
}
if (jif.isIconifiable()) {
r.width -= buttonDim.width;
if (titlePane.getParent().getComponentOrientation().isLeftToRight()) {
r.x += buttonDim.width;
if (button_border != null) {
r.x += button_border.left;
}
r.width = titlePane.getWidth() - r.x - getInt("right_titlebar_edge");
if (jif.isClosable()) {
r.width -= buttonDim.width;
}
if (jif.isMaximizable()) {
r.width -= buttonDim.width;
}
if (jif.isIconifiable()) {
r.width -= buttonDim.width;
}
} else {
if (jif.isClosable()) {
r.x += buttonDim.width;
}
if (jif.isMaximizable()) {
r.x += buttonDim.width;
}
if (jif.isIconifiable()) {
r.x += buttonDim.width;
}
r.width = titlePane.getWidth() - r.x - getInt("right_titlebar_edge")
- buttonDim.width;
if (button_border != null) {
r.x -= button_border.right;
}
}
if (title_border != null) {
r.width -= title_border.right;

View File

@ -49,8 +49,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
/**
* ReferenceQueue of unreferenced WeakPCLs.
*/
private static ReferenceQueue queue;
private static ReferenceQueue<DesktopProperty> queue;
/**
* PropertyChangeListener attached to the Toolkit.
@ -76,7 +75,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
static {
queue = new ReferenceQueue();
queue = new ReferenceQueue<DesktopProperty>();
}
/**
@ -117,8 +116,8 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
XPStyle.invalidateStyle();
}
Frame appFrames[] = Frame.getFrames();
for (int j=0; j < appFrames.length; j++) {
updateWindowUI(appFrames[j]);
for (Frame appFrame : appFrames) {
updateWindowUI(appFrame);
}
}
@ -128,8 +127,8 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
private static void updateWindowUI(Window window) {
SwingUtilities.updateComponentTreeUI(window);
Window ownedWins[] = window.getOwnedWindows();
for (int i=0; i < ownedWins.length; i++) {
updateWindowUI(ownedWins[i]);
for (Window ownedWin : ownedWins) {
updateWindowUI(ownedWin);
}
}
@ -270,13 +269,13 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
* is handled via a WeakReference so as not to pin down the
* DesktopProperty.
*/
private static class WeakPCL extends WeakReference
private static class WeakPCL extends WeakReference<DesktopProperty>
implements PropertyChangeListener {
private Toolkit kit;
private String key;
private LookAndFeel laf;
WeakPCL(Object target, Toolkit kit, String key, LookAndFeel laf) {
WeakPCL(DesktopProperty target, Toolkit kit, String key, LookAndFeel laf) {
super(target, queue);
this.kit = kit;
this.key = key;
@ -284,7 +283,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
}
public void propertyChange(PropertyChangeEvent pce) {
DesktopProperty property = (DesktopProperty)get();
DesktopProperty property = get();
if (property == null || laf != UIManager.getLookAndFeel()) {
// The property was GC'ed, we're no longer interested in

View File

@ -96,7 +96,7 @@ public class WindowsDesktopManager extends DefaultDesktopManager
}
} catch (PropertyVetoException e) {}
if (f != currentFrame) {
currentFrameRef = new WeakReference(f);
currentFrameRef = new WeakReference<JInternalFrame>(f);
}
}

View File

@ -983,7 +983,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
} else if (s.equals("componentOrientation")) {
ComponentOrientation o = (ComponentOrientation)e.getNewValue();
JFileChooser cc = (JFileChooser)e.getSource();
if (o != (ComponentOrientation)e.getOldValue()) {
if (o != e.getOldValue()) {
cc.applyComponentOrientation(o);
}
} else if (s.equals("ancestor")) {
@ -1123,7 +1123,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
* Data model for a type-face selection combo-box.
*/
protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
Vector directories = new Vector();
Vector<File> directories = new Vector<File>();
int[] depths = null;
File selectedDirectory = null;
JFileChooser chooser = getFileChooser();
@ -1162,7 +1162,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
// Get the canonical (full) path. This has the side
// benefit of removing extraneous chars from the path,
// for example /foo/bar/ becomes /foo/bar
File canonical = null;
File canonical;
try {
canonical = directory.getCanonicalFile();
} catch (IOException e) {
@ -1175,7 +1175,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
: canonical;
File f = sf;
Vector path = new Vector(10);
Vector<File> path = new Vector<File>(10);
do {
path.addElement(f);
} while ((f = f.getParentFile()) != null);
@ -1183,7 +1183,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
int pathCount = path.size();
// Insert chain at appropriate place in vector
for (int i = 0; i < pathCount; i++) {
f = (File)path.get(i);
f = path.get(i);
if (directories.contains(f)) {
int topIndex = directories.indexOf(f);
for (int j = i-1; j >= 0; j--) {
@ -1202,12 +1202,12 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
private void calculateDepths() {
depths = new int[directories.size()];
for (int i = 0; i < depths.length; i++) {
File dir = (File)directories.get(i);
File dir = directories.get(i);
File parent = dir.getParentFile();
depths[i] = 0;
if (parent != null) {
for (int j = i-1; j >= 0; j--) {
if (parent.equals((File)directories.get(j))) {
if (parent.equals(directories.get(j))) {
depths[i] = depths[j] + 1;
break;
}
@ -1306,8 +1306,8 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
FileFilter currentFilter = getFileChooser().getFileFilter();
boolean found = false;
if(currentFilter != null) {
for(int i=0; i < filters.length; i++) {
if(filters[i] == currentFilter) {
for (FileFilter filter : filters) {
if (filter == currentFilter) {
found = true;
}
}

View File

@ -137,25 +137,46 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
int baseline = (getHeight() + fm.getAscent() - fm.getLeading() -
fm.getDescent()) / 2;
int titleX;
Rectangle r = new Rectangle(0, 0, 0, 0);
if (frame.isIconifiable()) r = iconButton.getBounds();
else if (frame.isMaximizable()) r = maxButton.getBounds();
else if (frame.isClosable()) r = closeButton.getBounds();
int titleW;
if(WindowsGraphicsUtils.isLeftToRight(frame) ) {
if (r.x == 0) r.x = frame.getWidth()-frame.getInsets().right;
titleX = systemLabel.getX() + systemLabel.getWidth() + 2;
if (xp != null) {
titleX += 2;
}
titleW = r.x - titleX - 3;
title = getTitle(frame.getTitle(), fm, titleW);
} else {
titleX = systemLabel.getX() - 2
- SwingUtilities2.stringWidth(frame,fm,title);
Rectangle lastIconBounds = new Rectangle(0, 0, 0, 0);
if (frame.isIconifiable()) {
lastIconBounds = iconButton.getBounds();
} else if (frame.isMaximizable()) {
lastIconBounds = maxButton.getBounds();
} else if (frame.isClosable()) {
lastIconBounds = closeButton.getBounds();
}
int titleX;
int titleW;
int gap = 2;
if (WindowsGraphicsUtils.isLeftToRight(frame)) {
if (lastIconBounds.x == 0) { // There are no icons
lastIconBounds.x = frame.getWidth() - frame.getInsets().right;
}
titleX = systemLabel.getX() + systemLabel.getWidth() + gap;
if (xp != null) {
titleX += 2;
}
titleW = lastIconBounds.x - titleX - gap;
} else {
if (lastIconBounds.x == 0) { // There are no icons
lastIconBounds.x = frame.getInsets().left;
}
titleW = SwingUtilities2.stringWidth(frame, fm, title);
int minTitleX = lastIconBounds.x + lastIconBounds.width + gap;
if (xp != null) {
minTitleX += 2;
}
int availableWidth = systemLabel.getX() - gap - minTitleX;
if (availableWidth > titleW) {
titleX = systemLabel.getX() - gap - titleW;
} else {
titleX = minTitleX;
titleW = availableWidth;
}
}
title = getTitle(frame.getTitle(), fm, titleW);
if (xp != null) {
String shadowType = null;
if (isSelected) {
@ -258,8 +279,8 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
g.fillRect(0, 0, w, h);
}
Icon icon = getIcon();
int iconWidth = 0;
int iconHeight = 0;
int iconWidth;
int iconHeight;
if (icon != null &&
(iconWidth = icon.getIconWidth()) > 0 &&
(iconHeight = icon.getIconHeight()) > 0) {
@ -304,18 +325,18 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
}
protected void addSystemMenuItems(JPopupMenu menu) {
JMenuItem mi = (JMenuItem)menu.add(restoreAction);
JMenuItem mi = menu.add(restoreAction);
mi.setMnemonic('R');
mi = (JMenuItem)menu.add(moveAction);
mi = menu.add(moveAction);
mi.setMnemonic('M');
mi = (JMenuItem)menu.add(sizeAction);
mi = menu.add(sizeAction);
mi.setMnemonic('S');
mi = (JMenuItem)menu.add(iconifyAction);
mi = menu.add(iconifyAction);
mi.setMnemonic('n');
mi = (JMenuItem)menu.add(maximizeAction);
mi = menu.add(maximizeAction);
mi.setMnemonic('x');
systemPopupMenu.add(new JSeparator());
mi = (JMenuItem)menu.add(closeAction);
mi = menu.add(closeAction);
mi.setMnemonic('C');
}
@ -441,7 +462,7 @@ public class WindowsInternalFrameTitlePane extends BasicInternalFrameTitlePane {
public class WindowsPropertyChangeHandler extends PropertyChangeHandler {
public void propertyChange(PropertyChangeEvent evt) {
String prop = (String)evt.getPropertyName();
String prop = evt.getPropertyName();
// Update the internal frame icon for the system menu.
if (JInternalFrame.FRAME_ICON_PROPERTY.equals(prop) &&

View File

@ -369,21 +369,21 @@ public class WindowsScrollBarUI extends BasicScrollBarUI {
*/
private static class Grid {
private static final int BUFFER_SIZE = 64;
private static HashMap map;
private static HashMap<String, WeakReference<Grid>> map;
private BufferedImage image;
static {
map = new HashMap();
map = new HashMap<String, WeakReference<Grid>>();
}
public static Grid getGrid(Color fg, Color bg) {
String key = fg.getRGB() + " " + bg.getRGB();
WeakReference ref = (WeakReference)map.get(key);
Grid grid = (ref == null) ? null : (Grid)ref.get();
WeakReference<Grid> ref = map.get(key);
Grid grid = (ref == null) ? null : ref.get();
if (grid == null) {
grid = new Grid(fg, bg);
map.put(key, new WeakReference(grid));
map.put(key, new WeakReference<Grid>(grid));
}
return grid;
}

View File

@ -53,13 +53,13 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
* Keys to use for forward focus traversal when the JComponent is
* managing focus.
*/
private static Set managingFocusForwardTraversalKeys;
private static Set<KeyStroke> managingFocusForwardTraversalKeys;
/**
* Keys to use for backward focus traversal when the JComponent is
* managing focus.
*/
private static Set managingFocusBackwardTraversalKeys;
private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
private boolean contentOpaque = true;
@ -69,13 +69,13 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
// focus forward traversal key
if (managingFocusForwardTraversalKeys==null) {
managingFocusForwardTraversalKeys = new HashSet();
managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
}
tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
// focus backward traversal key
if (managingFocusBackwardTraversalKeys==null) {
managingFocusBackwardTraversalKeys = new HashSet();
managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
managingFocusBackwardTraversalKeys.add( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
}
tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);

View File

@ -124,7 +124,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI {
setIcon(null);
sortIcon = null;
SortOrder sortOrder =
getColumnSortOrder(header.getTable(), column);
getColumnSortOrder(table, column);
if (sortOrder != null) {
switch (sortOrder) {
case ASCENDING:

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=Sample Text Sample Text
ColorChooser.swatchesNameText=Swatches
ColorChooser.swatchesMnemonic=83
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Recent:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=Red
ColorChooser.rgbRedMnemonic=68
ColorChooser.rgbGreenText=Green
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=Blue
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=90
ColorChooser.sampleText=Beispieltext Beispieltext
ColorChooser.swatchesNameText=Muster
ColorChooser.swatchesMnemonic=77
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Aktuell:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=Rot
ColorChooser.rgbRedMnemonic=82
ColorChooser.rgbGreenText=Gr\u00fcn
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=Blau
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=Texto de ejemplo Texto de ejemplo
ColorChooser.swatchesNameText=Muestras
ColorChooser.swatchesMnemonic=77
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Reciente:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=V
ColorChooser.hsbBlueText=A
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=Rojo
ColorChooser.rgbRedMnemonic=74
ColorChooser.rgbGreenText=Verde
ColorChooser.rgbGreenMnemonic=86
ColorChooser.rgbBlueText=Azul
ColorChooser.rgbBlueMnemonic=76
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=Echantillon de texte Echantillon de texte
ColorChooser.swatchesNameText=Echantillons
ColorChooser.swatchesMnemonic=69
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Dernier :
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=V
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RVB
ColorChooser.rgbMnemonic=86
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=Rouge
ColorChooser.rgbRedMnemonic=71
ColorChooser.rgbGreenText=Vert
ColorChooser.rgbGreenMnemonic=84
ColorChooser.rgbBlueText=Bleu
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=Testo di prova Testo di prova
ColorChooser.swatchesNameText=Colori campione
ColorChooser.swatchesMnemonic=67
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Recenti:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=Rosso
ColorChooser.rgbRedMnemonic=79
ColorChooser.rgbGreenText=Verde
ColorChooser.rgbGreenMnemonic=69
ColorChooser.rgbBlueText=Blu
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=\u30b5\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8 \u30b5\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8
ColorChooser.swatchesNameText=\u30b5\u30f3\u30d7\u30eb(S)
ColorChooser.swatchesMnemonic=83
ColorChooser.swatchesDisplayedMnemonicIndex=5
ColorChooser.swatchesRecentText=\u6700\u65b0:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=\u8d64(D)
ColorChooser.rgbRedMnemonic=68
ColorChooser.rgbGreenText=\u7dd1(N)
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=\u9752(B)
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=\uc0d8\ud50c \ud14d\uc2a4\ud2b8 \uc0d8\ud50c \ud14d\uc2a4\ud2b8
ColorChooser.swatchesNameText=\uacac\ubcf8(S)
ColorChooser.swatchesMnemonic=83
ColorChooser.swatchesDisplayedMnemonicIndex=3
ColorChooser.swatchesRecentText=\ucd5c\uadfc \ubaa9\ub85d:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=\ube68\uac04\uc0c9(D)
ColorChooser.rgbRedMnemonic=68
ColorChooser.rgbGreenText=\ub179\uc0c9(N)
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=\ud30c\ub780\uc0c9(B)
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=84
ColorChooser.sampleText=Exempeltext Exempeltext
ColorChooser.swatchesNameText=Prov
ColorChooser.swatchesMnemonic=80
ColorChooser.swatchesDisplayedMnemonicIndex=0
ColorChooser.swatchesRecentText=Tidigare:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=R\u00f6d
ColorChooser.rgbRedMnemonic=82
ColorChooser.rgbGreenText=Gr\u00f6n
ColorChooser.rgbGreenMnemonic=71
ColorChooser.rgbBlueText=Bl\u00e5
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=\u6837\u54c1\u6587\u672c \u6837\u54c1\u6587\u672c
ColorChooser.swatchesNameText=\u6837\u54c1(S)
ColorChooser.swatchesMnemonic=83
ColorChooser.swatchesDisplayedMnemonicIndex=3
ColorChooser.swatchesRecentText=\u6700\u8fd1:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=\u7ea2
ColorChooser.rgbRedMnemonic=68
ColorChooser.rgbGreenText=\u7eff
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=\u84dd
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -101,30 +101,41 @@ ColorChooser.resetMnemonic=82
ColorChooser.sampleText=\u7bc4\u4f8b\u6587\u5b57 \u7bc4\u4f8b\u6587\u5b57
ColorChooser.swatchesNameText=\u8abf\u8272\u677f(S)
ColorChooser.swatchesMnemonic=83
ColorChooser.swatchesDisplayedMnemonicIndex=4
ColorChooser.swatchesRecentText=\u6700\u65b0\u9078\u64c7:
ColorChooser.hsbNameText=HSB
# Each of the ColorChooser types can define a mnemonic, as a KeyEvent.VK_XXX
# constant, and an index into the text to render the mnemonic as. The
# mnemonic is xxxMnemonic and the index of the character to underline is
# xxxDisplayedMnemonicIndex.
ColorChooser.hsbMnemonic=72
ColorChooser.hsbDisplayedMnemonicIndex=0
ColorChooser.hsbHueText=H
ColorChooser.hsbSaturationText=S
ColorChooser.hsbBrightnessText=B
ColorChooser.hsbRedText=R
ColorChooser.hsbGreenText=G
ColorChooser.hsbBlueText=B
ColorChooser.hsvNameText=HSV
ColorChooser.hsvMnemonic=72
ColorChooser.hsvHueText=Hue
ColorChooser.hsvSaturationText=Saturation
ColorChooser.hsvValueText=Value
ColorChooser.hsvTransparencyText=Transparency
ColorChooser.hslNameText=HSL
ColorChooser.hslMnemonic=76
ColorChooser.hslHueText=Hue
ColorChooser.hslSaturationText=Saturation
ColorChooser.hslLightnessText=Lightness
ColorChooser.hslTransparencyText=Transparency
ColorChooser.rgbNameText=RGB
ColorChooser.rgbMnemonic=71
ColorChooser.rgbDisplayedMnemonicIndex=1
ColorChooser.rgbRedText=\u7d05\u8272(D)
ColorChooser.rgbRedMnemonic=68
ColorChooser.rgbGreenText=\u7da0\u8272(N)
ColorChooser.rgbGreenMnemonic=78
ColorChooser.rgbBlueText=\u85cd\u8272(B)
ColorChooser.rgbBlueMnemonic=66
ColorChooser.rgbAlphaText=Alpha
ColorChooser.rgbHexCodeText=Color Code
ColorChooser.rgbHexCodeMnemonic=67
ColorChooser.cmykNameText=CMYK
ColorChooser.cmykMnemonic=77
ColorChooser.cmykCyanText=Cyan
ColorChooser.cmykMagentaText=Magenta
ColorChooser.cmykYellowText=Yellow
ColorChooser.cmykBlackText=Black
ColorChooser.cmykAlphaText=Alpha
############ OPTION PANE STRINGS #############
# Mnemonic keys correspond to KeyEvent.VK_XXX constant

View File

@ -39,6 +39,7 @@ import java.util.Vector;
import java.util.logging.*;
import sun.awt.dnd.SunDragSourceContextPeer;
import sun.awt.EventQueueDelegate;
/**
* EventDispatchThread is a package-private AWT class which takes
@ -243,10 +244,16 @@ class EventDispatchThread extends Thread {
try {
AWTEvent event;
boolean eventOK;
EventQueueDelegate.Delegate delegate =
EventQueueDelegate.getDelegate();
do {
event = (id == ANY_EVENT)
? theQueue.getNextEvent()
: theQueue.getNextEvent(id);
if (delegate != null && id == ANY_EVENT) {
event = delegate.getNextEvent(theQueue);
} else {
event = (id == ANY_EVENT)
? theQueue.getNextEvent()
: theQueue.getNextEvent(id);
}
eventOK = true;
synchronized (eventFilters) {
@ -272,7 +279,14 @@ class EventDispatchThread extends Thread {
eventLog.log(Level.FINEST, "Dispatching: " + event);
}
Object handle = null;
if (delegate != null) {
handle = delegate.beforeDispatch(event);
}
theQueue.dispatchEvent(event);
if (delegate != null) {
delegate.afterDispatch(event, handle);
}
return true;
}
catch (ThreadDeath death) {

View File

@ -298,7 +298,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
oldL = (EventListener[])MethodUtil.invoke(m, oldInstance, new Object[]{});
newL = (EventListener[])MethodUtil.invoke(m, newInstance, new Object[]{});
}
catch (Throwable e2) {
catch (Exception e2) {
try {
Method m = type.getMethod("getListeners", new Class[]{Class.class});
oldL = (EventListener[])MethodUtil.invoke(m, oldInstance, new Object[]{listenerType});

View File

@ -404,7 +404,7 @@ public class EventHandler implements InvocationHandler {
Object newTarget = MethodUtil.invoke(getter, target, new Object[]{});
return applyGetters(newTarget, rest);
}
catch (Throwable e) {
catch (Exception e) {
throw new RuntimeException("Failed to call method: " + first +
" on " + target, e);
}

View File

@ -650,7 +650,7 @@ class java_util_Map_PersistenceDelegate extends DefaultPersistenceDelegate {
// Remove the new elements.
// Do this first otherwise we undo the adding work.
if (newMap != null) {
for ( Object newKey : newMap.keySet() ) {
for (Object newKey : newMap.keySet().toArray()) {
// PENDING: This "key" is not in the right environment.
if (!oldMap.containsKey(newKey)) {
invokeStatement(oldInstance, "remove", new Object[]{newKey}, out);
@ -986,14 +986,20 @@ class java_awt_Component_PersistenceDelegate extends DefaultPersistenceDelegate
// null to defined values after the Windows are made visible -
// special case them for now.
if (!(oldInstance instanceof java.awt.Window)) {
String[] fieldNames = new String[]{"background", "foreground", "font"};
for(int i = 0; i < fieldNames.length; i++) {
String name = fieldNames[i];
Object oldValue = ReflectionUtils.getPrivateField(oldInstance, java.awt.Component.class, name, out.getExceptionListener());
Object newValue = (newInstance == null) ? null : ReflectionUtils.getPrivateField(newInstance, java.awt.Component.class, name, out.getExceptionListener());
if (oldValue != null && !oldValue.equals(newValue)) {
invokeStatement(oldInstance, "set" + NameGenerator.capitalize(name), new Object[]{oldValue}, out);
}
Object oldBackground = c.isBackgroundSet() ? c.getBackground() : null;
Object newBackground = c2.isBackgroundSet() ? c2.getBackground() : null;
if (!MetaData.equals(oldBackground, newBackground)) {
invokeStatement(oldInstance, "setBackground", new Object[] { oldBackground }, out);
}
Object oldForeground = c.isForegroundSet() ? c.getForeground() : null;
Object newForeground = c2.isForegroundSet() ? c2.getForeground() : null;
if (!MetaData.equals(oldForeground, newForeground)) {
invokeStatement(oldInstance, "setForeground", new Object[] { oldForeground }, out);
}
Object oldFont = c.isFontSet() ? c.getFont() : null;
Object newFont = c2.isFontSet() ? c2.getFont() : null;
if (!MetaData.equals(oldFont, newFont)) {
invokeStatement(oldInstance, "setFont", new Object[] { oldFont }, out);
}
}
@ -1104,26 +1110,30 @@ class java_awt_List_PersistenceDelegate extends DefaultPersistenceDelegate {
// BorderLayout
class java_awt_BorderLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
private static final String[] CONSTRAINTS = {
BorderLayout.NORTH,
BorderLayout.SOUTH,
BorderLayout.EAST,
BorderLayout.WEST,
BorderLayout.CENTER,
BorderLayout.PAGE_START,
BorderLayout.PAGE_END,
BorderLayout.LINE_START,
BorderLayout.LINE_END,
};
@Override
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder out) {
super.initialize(type, oldInstance, newInstance, out);
String[] locations = {"north", "south", "east", "west", "center"};
String[] names = {java.awt.BorderLayout.NORTH, java.awt.BorderLayout.SOUTH,
java.awt.BorderLayout.EAST, java.awt.BorderLayout.WEST,
java.awt.BorderLayout.CENTER};
for(int i = 0; i < locations.length; i++) {
Object oldC = ReflectionUtils.getPrivateField(oldInstance,
java.awt.BorderLayout.class,
locations[i],
out.getExceptionListener());
Object newC = ReflectionUtils.getPrivateField(newInstance,
java.awt.BorderLayout.class,
locations[i],
out.getExceptionListener());
BorderLayout oldLayout = (BorderLayout) oldInstance;
BorderLayout newLayout = (BorderLayout) newInstance;
for (String constraints : CONSTRAINTS) {
Object oldC = oldLayout.getLayoutComponent(constraints);
Object newC = newLayout.getLayoutComponent(constraints);
// Pending, assume any existing elements are OK.
if (oldC != null && newC == null) {
invokeStatement(oldInstance, "addLayoutComponent",
new Object[]{oldC, names[i]}, out);
new Object[] { oldC, constraints }, out);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2008 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
@ -34,12 +34,49 @@ import java.util.Map.Entry;
/**
* This is a utility class that can be used by beans that support bound
* properties. You can use an instance of this class as a member field
* of your bean and delegate various work to it.
* properties. It manages a list of listeners and dispatches
* {@link PropertyChangeEvent}s to them. You can use an instance of this class
* as a member field of your bean and delegate these types of work to it.
* The {@link PropertyChangeListener} can be registered for all properties
* or for a property specified by name.
* <p>
* Here is an example of {@code PropertyChangeSupport} usage that follows
* the rules and recommendations laid out in the JavaBeans&trade; specification:
* <pre>
* public class MyBean {
* private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
*
* public void addPropertyChangeListener(PropertyChangeListener listener) {
* this.pcs.addPropertyChangeListener(listener);
* }
*
* public void removePropertyChangeListener(PropertyChangeListener listener) {
* this.pcs.removePropertyChangeListener(listener);
* }
*
* private String value;
*
* public String getValue() {
* return this.value;
* }
*
* public void setValue(String newValue) {
* String oldValue = this.value;
* this.value = newValue;
* this.pcs.firePropertyChange("value", oldValue, newValue);
* }
*
* [...]
* }
* </pre>
* <p>
* A {@code PropertyChangeSupport} instance is thread-safe.
* <p>
* This class is serializable. When it is serialized it will save
* (and restore) any listeners that are themselves serializable. Any
* non-serializable listeners will be skipped during serialization.
*
* @see VetoableChangeSupport
*/
public class PropertyChangeSupport implements Serializable {
private PropertyChangeListenerMap map = new PropertyChangeListenerMap();
@ -208,91 +245,91 @@ public class PropertyChangeSupport implements Serializable {
}
/**
* Report a bound property update to any registered listeners.
* No event is fired if old and new are equal and non-null.
*
* Reports a bound property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new values are equal and non-null.
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes {@code
* PropertyChangeEvent} value.
* {@link #firePropertyChange(PropertyChangeEvent)} method.
*
* @param propertyName The programmatic name of the property
* that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that was changed
* @param oldValue the old value of the property
* @param newValue the new value of the property
*/
public void firePropertyChange(String propertyName,
Object oldValue, Object newValue) {
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
firePropertyChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue));
}
firePropertyChange(new PropertyChangeEvent(source, propertyName,
oldValue, newValue));
}
/**
* Report an int bound property update to any registered listeners.
* No event is fired if old and new are equal.
* Reports an integer bound property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new values are equal.
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes Object values.
* {@link #firePropertyChange(String, Object, Object)} method.
*
* @param propertyName The programmatic name of the property
* that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that was changed
* @param oldValue the old value of the property
* @param newValue the new value of the property
*/
public void firePropertyChange(String propertyName,
int oldValue, int newValue) {
if (oldValue == newValue) {
return;
public void firePropertyChange(String propertyName, int oldValue, int newValue) {
if (oldValue != newValue) {
firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
}
firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
}
/**
* Report a boolean bound property update to any registered listeners.
* No event is fired if old and new are equal.
* Reports a boolean bound property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new values are equal.
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes Object values.
* {@link #firePropertyChange(String, Object, Object)} method.
*
* @param propertyName The programmatic name of the property
* that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that was changed
* @param oldValue the old value of the property
* @param newValue the new value of the property
*/
public void firePropertyChange(String propertyName,
boolean oldValue, boolean newValue) {
if (oldValue == newValue) {
return;
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
if (oldValue != newValue) {
firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
/**
* Fire an existing PropertyChangeEvent to any registered listeners.
* No event is fired if the given event's old and new values are
* equal and non-null.
* @param evt The PropertyChangeEvent object.
* Fires a property change event to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if the given event's old and new values are equal and non-null.
*
* @param event the {@code PropertyChangeEvent} to be fired
*/
public void firePropertyChange(PropertyChangeEvent evt) {
Object oldValue = evt.getOldValue();
Object newValue = evt.getNewValue();
String propertyName = evt.getPropertyName();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
PropertyChangeListener[] common = this.map.get(null);
PropertyChangeListener[] named = (propertyName != null)
? this.map.get(propertyName)
: null;
public void firePropertyChange(PropertyChangeEvent event) {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
String name = event.getPropertyName();
fire(common, evt);
fire(named, evt);
PropertyChangeListener[] common = this.map.get(null);
PropertyChangeListener[] named = (name != null)
? this.map.get(name)
: null;
fire(common, event);
fire(named, event);
}
}
private void fire(PropertyChangeListener[] listeners, PropertyChangeEvent event) {
private static void fire(PropertyChangeListener[] listeners, PropertyChangeEvent event) {
if (listeners != null) {
for (PropertyChangeListener listener : listeners) {
listener.propertyChange(event);
@ -301,78 +338,69 @@ public class PropertyChangeSupport implements Serializable {
}
/**
* Report a bound indexed property update to any registered
* listeners.
* Reports a bound indexed property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new values are equal
* and non-null.
*
* No event is fired if old and new values are equal and non-null.
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes {@code PropertyChangeEvent} value.
* {@link #firePropertyChange(PropertyChangeEvent)} method.
*
* @param propertyName The programmatic name of the property that
* was changed.
* @param index index of the property element that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that was changed
* @param index the index of the property element that was changed
* @param oldValue the old value of the property
* @param newValue the new value of the property
* @since 1.5
*/
public void fireIndexedPropertyChange(String propertyName, int index,
Object oldValue, Object newValue) {
firePropertyChange(new IndexedPropertyChangeEvent
(source, propertyName, oldValue, newValue, index));
public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue) {
if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
firePropertyChange(new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index));
}
}
/**
* Report an <code>int</code> bound indexed property update to any registered
* listeners.
* Reports an integer bound indexed property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new values are equal.
* <p>
* This is merely a convenience wrapper around the more general
* fireIndexedPropertyChange method which takes Object values.
* {@link #fireIndexedPropertyChange(String, int, Object, Object)} method.
*
* @param propertyName The programmatic name of the property that
* was changed.
* @param index index of the property element that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that was changed
* @param index the index of the property element that was changed
* @param oldValue the old value of the property
* @param newValue the new value of the property
* @since 1.5
*/
public void fireIndexedPropertyChange(String propertyName, int index,
int oldValue, int newValue) {
if (oldValue == newValue) {
return;
public void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue) {
if (oldValue != newValue) {
fireIndexedPropertyChange(propertyName, index, Integer.valueOf(oldValue), Integer.valueOf(newValue));
}
fireIndexedPropertyChange(propertyName, index,
Integer.valueOf(oldValue),
Integer.valueOf(newValue));
}
/**
* Report a <code>boolean</code> bound indexed property update to any
* registered listeners.
* Reports a boolean bound indexed property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new values are equal.
* <p>
* This is merely a convenience wrapper around the more general
* fireIndexedPropertyChange method which takes Object values.
* {@link #fireIndexedPropertyChange(String, int, Object, Object)} method.
*
* @param propertyName The programmatic name of the property that
* was changed.
* @param index index of the property element that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that was changed
* @param index the index of the property element that was changed
* @param oldValue the old value of the property
* @param newValue the new value of the property
* @since 1.5
*/
public void fireIndexedPropertyChange(String propertyName, int index,
boolean oldValue, boolean newValue) {
if (oldValue == newValue) {
return;
public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue) {
if (oldValue != newValue) {
fireIndexedPropertyChange(propertyName, index, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
fireIndexedPropertyChange(propertyName, index, Boolean.valueOf(oldValue),
Boolean.valueOf(newValue));
}
/**

View File

@ -204,20 +204,21 @@ public interface PropertyEditor {
//----------------------------------------------------------------------
/**
* Register a listener for the PropertyChange event. When a
* PropertyEditor changes its value it should fire a PropertyChange
* event on all registered PropertyChangeListeners, specifying the
* null value for the property name and itself as the source.
* Adds a listener for the value change.
* When the property editor changes its value
* it should fire a {@link PropertyChangeEvent}
* on all registered {@link PropertyChangeListener}s,
* specifying the {@code null} value for the property name
* and itself as the source.
*
* @param listener An object to be invoked when a PropertyChange
* event is fired.
* @param listener the {@link PropertyChangeListener} to add
*/
void addPropertyChangeListener(PropertyChangeListener listener);
/**
* Remove a listener for the PropertyChange event.
* Removes a listener for the value change.
*
* @param listener The PropertyChange listener to be removed.
* @param listener the {@link PropertyChangeListener} to remove
*/
void removePropertyChangeListener(PropertyChangeListener listener);

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2008 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
@ -25,6 +25,7 @@
package java.beans;
import com.sun.beans.WeakCache;
import sun.beans.editors.*;
/**
@ -55,32 +56,30 @@ import sun.beans.editors.*;
public class PropertyEditorManager {
/**
* Register an editor class to be used to edit values of
* a given target class.
* Registers an editor class to edit values of the given target class.
* If the editor class is {@code null},
* then any existing definition will be removed.
* Thus this method can be used to cancel the registration.
* The registration is canceled automatically
* if either the target or editor class is unloaded.
* <p>
* If there is a security manager, its {@code checkPropertiesAccess}
* method is called. This could result in a {@linkplain SecurityException}.
*
* <p>First, if there is a security manager, its <code>checkPropertiesAccess</code>
* method is called. This could result in a SecurityException.
* @param targetType the class object of the type to be edited
* @param editorClass the class object of the editor class
* @throws SecurityException if a security manager exists and
* its {@code checkPropertiesAccess} method
* doesn't allow setting of system properties
*
* @param targetType the Class object of the type to be edited
* @param editorClass the Class object of the editor class. If
* this is null, then any existing definition will be removed.
* @exception SecurityException if a security manager exists and its
* <code>checkPropertiesAccess</code> method doesn't allow setting
* of system properties.
* @see SecurityManager#checkPropertiesAccess
*/
public static void registerEditor(Class<?> targetType, Class<?> editorClass) {
public static synchronized void registerEditor(Class<?> targetType, Class<?> editorClass) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
initialize();
if (editorClass == null) {
registry.remove(targetType);
} else {
registry.put(targetType, editorClass);
}
registry.put(targetType, editorClass);
}
/**
@ -90,10 +89,8 @@ public class PropertyEditorManager {
* @return An editor object for the given target class.
* The result is null if no suitable editor can be found.
*/
public static synchronized PropertyEditor findEditor(Class<?> targetType) {
initialize();
Class editorClass = (Class)registry.get(targetType);
Class editorClass = registry.get(targetType);
if (editorClass != null) {
try {
Object o = editorClass.newInstance();
@ -143,10 +140,7 @@ public class PropertyEditorManager {
* e.g. Sun implementation initially sets to {"sun.beans.editors"}.
*/
public static synchronized String[] getEditorSearchPath() {
// Return a copy of the searchPath.
String result[] = new String[searchPath.length];
System.arraycopy(searchPath, 0, result, 0, searchPath.length);
return result;
return searchPath.clone();
}
/**
@ -162,23 +156,22 @@ public class PropertyEditorManager {
* of system properties.
* @see SecurityManager#checkPropertiesAccess
*/
public static synchronized void setEditorSearchPath(String path[]) {
public static synchronized void setEditorSearchPath(String[] path) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
if (path == null) {
path = new String[0];
}
searchPath = path;
searchPath = (path != null)
? path.clone()
: EMPTY;
}
private static synchronized void initialize() {
if (registry != null) {
return;
}
registry = new java.util.Hashtable();
private static String[] searchPath = { "sun.beans.editors" };
private static final String[] EMPTY = {};
private static final WeakCache<Class<?>, Class<?>> registry;
static {
registry = new WeakCache<Class<?>, Class<?>>();
registry.put(Byte.TYPE, ByteEditor.class);
registry.put(Short.TYPE, ShortEditor.class);
registry.put(Integer.TYPE, IntegerEditor.class);
@ -187,7 +180,4 @@ public class PropertyEditorManager {
registry.put(Float.TYPE, FloatEditor.class);
registry.put(Double.TYPE, DoubleEditor.class);
}
private static String[] searchPath = { "sun.beans.editors" };
private static java.util.Hashtable registry;
}

View File

@ -233,11 +233,20 @@ public class PropertyEditorSupport implements PropertyEditor {
//----------------------------------------------------------------------
/**
* Register a listener for the PropertyChange event. The class will
* fire a PropertyChange value whenever the value is updated.
* Adds a listener for the value change.
* When the property editor changes its value
* it should fire a {@link PropertyChangeEvent}
* on all registered {@link PropertyChangeListener}s,
* specifying the {@code null} value for the property name.
* If the source property is set,
* it should be used as the source of the event.
* <p>
* The same listener object may be added more than once,
* and will be called as many times as it is added.
* If {@code listener} is {@code null},
* no exception is thrown and no action is taken.
*
* @param listener An object to be invoked when a PropertyChange
* event is fired.
* @param listener the {@link PropertyChangeListener} to add
*/
public synchronized void addPropertyChangeListener(
PropertyChangeListener listener) {
@ -248,9 +257,14 @@ public class PropertyEditorSupport implements PropertyEditor {
}
/**
* Remove a listener for the PropertyChange event.
* Removes a listener for the value change.
* <p>
* If the same listener was added more than once,
* it will be notified one less time after being removed.
* If {@code listener} is {@code null}, or was never added,
* no exception is thrown and no action is taken.
*
* @param listener The PropertyChange listener to be removed.
* @param listener the {@link PropertyChangeListener} to remove
*/
public synchronized void removePropertyChangeListener(
PropertyChangeListener listener) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2008 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
@ -34,12 +34,49 @@ import java.util.Map.Entry;
/**
* This is a utility class that can be used by beans that support constrained
* properties. You can use an instance of this class as a member field
* of your bean and delegate various work to it.
* properties. It manages a list of listeners and dispatches
* {@link PropertyChangeEvent}s to them. You can use an instance of this class
* as a member field of your bean and delegate these types of work to it.
* The {@link VetoableChangeListener} can be registered for all properties
* or for a property specified by name.
* <p>
* Here is an example of {@code VetoableChangeSupport} usage that follows
* the rules and recommendations laid out in the JavaBeans&trade; specification:
* <pre>
* public class MyBean {
* private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
*
* public void addVetoableChangeListener(VetoableChangeListener listener) {
* this.vcs.addVetoableChangeListener(listener);
* }
*
* public void removeVetoableChangeListener(VetoableChangeListener listener) {
* this.vcs.removeVetoableChangeListener(listener);
* }
*
* private String value;
*
* public String getValue() {
* return this.value;
* }
*
* public void setValue(String newValue) throws PropertyVetoException {
* String oldValue = this.value;
* this.vcs.fireVetoableChange("value", oldValue, newValue);
* this.value = newValue;
* }
*
* [...]
* }
* </pre>
* <p>
* A {@code VetoableChangeSupport} instance is thread-safe.
* <p>
* This class is serializable. When it is serialized it will save
* (and restore) any listeners that are themselves serializable. Any
* non-serializable listeners will be skipped during serialization.
*
* @see PropertyChangeSupport
*/
public class VetoableChangeSupport implements Serializable {
private VetoableChangeListenerMap map = new VetoableChangeListenerMap();
@ -208,126 +245,149 @@ public class VetoableChangeSupport implements Serializable {
}
/**
* Report a vetoable property update to any registered listeners. If
* anyone vetos the change, then fire a new event reverting everyone to
* the old value and then rethrow the PropertyVetoException.
* Reports a constrained property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new are equal and non-null.
*
* @param propertyName The programmatic name of the property
* that is about to change..
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @exception PropertyVetoException if the recipient wishes the property
* change to be rolled back.
*/
public void fireVetoableChange(String propertyName,
Object oldValue, Object newValue)
throws PropertyVetoException {
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
PropertyChangeEvent evt = new PropertyChangeEvent(source, propertyName,
oldValue, newValue);
fireVetoableChange(evt);
}
/**
* Report a int vetoable property update to any registered listeners.
* No event is fired if old and new are equal.
* Any listener can throw a {@code PropertyVetoException} to veto the update.
* If one of the listeners vetoes the update, this method passes
* a new "undo" {@code PropertyChangeEvent} that reverts to the old value
* to all listeners that already confirmed this update
* and throws the {@code PropertyVetoException} again.
* <p>
* No event is fired if old and new values are equal and non-null.
* <p>
* This is merely a convenience wrapper around the more general
* fireVetoableChange method that takes Object values.
* {@link #fireVetoableChange(PropertyChangeEvent)} method.
*
* @param propertyName The programmatic name of the property
* that is about to change.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that is about to change
* @param oldValue the old value of the property
* @param newValue the new value of the property
* @throws PropertyVetoException if one of listeners vetoes the property update
*/
public void fireVetoableChange(String propertyName,
int oldValue, int newValue)
throws PropertyVetoException {
if (oldValue == newValue) {
return;
public void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
throws PropertyVetoException {
if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
fireVetoableChange(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue));
}
fireVetoableChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
}
/**
* Report a boolean vetoable property update to any registered listeners.
* No event is fired if old and new are equal.
* Reports an integer constrained property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* Any listener can throw a {@code PropertyVetoException} to veto the update.
* If one of the listeners vetoes the update, this method passes
* a new "undo" {@code PropertyChangeEvent} that reverts to the old value
* to all listeners that already confirmed this update
* and throws the {@code PropertyVetoException} again.
* <p>
* No event is fired if old and new values are equal.
* <p>
* This is merely a convenience wrapper around the more general
* fireVetoableChange method that takes Object values.
* {@link #fireVetoableChange(String, Object, Object)} method.
*
* @param propertyName The programmatic name of the property
* that is about to change.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @param propertyName the programmatic name of the property that is about to change
* @param oldValue the old value of the property
* @param newValue the new value of the property
* @throws PropertyVetoException if one of listeners vetoes the property update
*/
public void fireVetoableChange(String propertyName,
boolean oldValue, boolean newValue)
throws PropertyVetoException {
if (oldValue == newValue) {
return;
public void fireVetoableChange(String propertyName, int oldValue, int newValue)
throws PropertyVetoException {
if (oldValue != newValue) {
fireVetoableChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
}
fireVetoableChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
/**
* Fire a vetoable property update to any registered listeners. If
* anyone vetos the change, then fire a new event reverting everyone to
* the old value and then rethrow the PropertyVetoException.
* Reports a boolean constrained property update to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* No event is fired if old and new are equal and non-null.
* Any listener can throw a {@code PropertyVetoException} to veto the update.
* If one of the listeners vetoes the update, this method passes
* a new "undo" {@code PropertyChangeEvent} that reverts to the old value
* to all listeners that already confirmed this update
* and throws the {@code PropertyVetoException} again.
* <p>
* No event is fired if old and new values are equal.
* <p>
* This is merely a convenience wrapper around the more general
* {@link #fireVetoableChange(String, Object, Object)} method.
*
* @param evt The PropertyChangeEvent to be fired.
* @exception PropertyVetoException if the recipient wishes the property
* change to be rolled back.
* @param propertyName the programmatic name of the property that is about to change
* @param oldValue the old value of the property
* @param newValue the new value of the property
* @throws PropertyVetoException if one of listeners vetoes the property update
*/
public void fireVetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException {
Object oldValue = evt.getOldValue();
Object newValue = evt.getNewValue();
String propertyName = evt.getPropertyName();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
public void fireVetoableChange(String propertyName, boolean oldValue, boolean newValue)
throws PropertyVetoException {
if (oldValue != newValue) {
fireVetoableChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue));
}
VetoableChangeListener[] common = this.map.get(null);
VetoableChangeListener[] named = (propertyName != null)
? this.map.get(propertyName)
: null;
fire(common, evt);
fire(named, evt);
}
private void fire(VetoableChangeListener[] listeners, PropertyChangeEvent event) throws PropertyVetoException {
if (listeners != null) {
VetoableChangeListener current = null;
try {
for (VetoableChangeListener listener : listeners) {
current = listener;
listener.vetoableChange(event);
}
} catch (PropertyVetoException veto) {
// Create an event to revert everyone to the old value.
event = new PropertyChangeEvent( this.source,
event.getPropertyName(),
event.getNewValue(),
event.getOldValue() );
for (VetoableChangeListener listener : listeners) {
if (current == listener) {
break;
}
try {
listener.vetoableChange(event);
} catch (PropertyVetoException ex) {
// We just ignore exceptions that occur during reversions.
/**
* Fires a property change event to listeners
* that have been registered to track updates of
* all properties or a property with the specified name.
* <p>
* Any listener can throw a {@code PropertyVetoException} to veto the update.
* If one of the listeners vetoes the update, this method passes
* a new "undo" {@code PropertyChangeEvent} that reverts to the old value
* to all listeners that already confirmed this update
* and throws the {@code PropertyVetoException} again.
* <p>
* No event is fired if the given event's old and new values are equal and non-null.
*
* @param event the {@code PropertyChangeEvent} to be fired
* @throws PropertyVetoException if one of listeners vetoes the property update
*/
public void fireVetoableChange(PropertyChangeEvent event)
throws PropertyVetoException {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
if (oldValue == null || newValue == null || !oldValue.equals(newValue)) {
String name = event.getPropertyName();
VetoableChangeListener[] common = this.map.get(null);
VetoableChangeListener[] named = (name != null)
? this.map.get(name)
: null;
VetoableChangeListener[] listeners;
if (common == null) {
listeners = named;
}
else if (named == null) {
listeners = common;
}
else {
listeners = new VetoableChangeListener[common.length + named.length];
System.arraycopy(common, 0, listeners, 0, common.length);
System.arraycopy(named, 0, listeners, common.length, named.length);
}
if (listeners != null) {
int current = 0;
try {
while (current < listeners.length) {
listeners[current].vetoableChange(event);
current++;
}
}
// And now rethrow the PropertyVetoException.
throw veto;
catch (PropertyVetoException veto) {
event = new PropertyChangeEvent(this.source, name, newValue, oldValue);
for (int i = 0; i < current; i++) {
try {
listeners[i].vetoableChange(event);
}
catch (PropertyVetoException exception) {
// ignore exceptions that occur during rolling back
}
}
throw veto; // rethrow the veto exception
}
}
}
}

View File

@ -373,6 +373,24 @@ public class SimpleDateFormat extends DateFormat {
*/
private String pattern;
/**
* Saved numberFormat and pattern.
* @see SimpleDateFormat#checkNegativeNumberExpression
*/
transient private NumberFormat originalNumberFormat;
transient private String originalNumberPattern;
/**
* The minus sign to be used with format and parse.
*/
transient private char minusSign = '-';
/**
* True when a negative sign follows a number.
* (True as default in Arabic.)
*/
transient private boolean hasFollowingMinusSign = false;
/**
* The compiled pattern.
*/
@ -1226,6 +1244,8 @@ public class SimpleDateFormat extends DateFormat {
*/
public Date parse(String text, ParsePosition pos)
{
checkNegativeNumberExpression();
int start = pos.index;
int oldStart = start;
int textLength = text.length();
@ -1271,14 +1291,42 @@ public class SimpleDateFormat extends DateFormat {
// digit text (e.g., "20010704") with a pattern which
// has no delimiters between fields, like "yyyyMMdd".
boolean obeyCount = false;
// In Arabic, a minus sign for a negative number is put after
// the number. Even in another locale, a minus sign can be
// put after a number using DateFormat.setNumberFormat().
// If both the minus sign and the field-delimiter are '-',
// subParse() needs to determine whether a '-' after a number
// in the given text is a delimiter or is a minus sign for the
// preceding number. We give subParse() a clue based on the
// information in compiledPattern.
boolean useFollowingMinusSignAsDelimiter = false;
if (i < compiledPattern.length) {
int nextTag = compiledPattern[i] >>> 8;
if (!(nextTag == TAG_QUOTE_ASCII_CHAR || nextTag == TAG_QUOTE_CHARS)) {
if (!(nextTag == TAG_QUOTE_ASCII_CHAR ||
nextTag == TAG_QUOTE_CHARS)) {
obeyCount = true;
}
if (hasFollowingMinusSign &&
(nextTag == TAG_QUOTE_ASCII_CHAR ||
nextTag == TAG_QUOTE_CHARS)) {
int c;
if (nextTag == TAG_QUOTE_ASCII_CHAR) {
c = compiledPattern[i] & 0xff;
} else {
c = compiledPattern[i+1];
}
if (c == minusSign) {
useFollowingMinusSignAsDelimiter = true;
}
}
}
start = subParse(text, start, tag, count, obeyCount,
ambiguousYear, pos);
ambiguousYear, pos,
useFollowingMinusSignAsDelimiter);
if (start < 0) {
pos.index = oldStart;
return null;
@ -1482,10 +1530,13 @@ public class SimpleDateFormat extends DateFormat {
// If the time zone matched uses the same name
// (abbreviation) for both standard and daylight time,
// let the time zone in the Calendar decide which one.
if (!useSameName) {
//
// Also if tz.getDSTSaving() returns 0 for DST, use tz to
// determine the local time. (6645292)
int dstAmount = (nameIndex >= 3) ? tz.getDSTSavings() : 0;
if (!(useSameName || (nameIndex >= 3 && dstAmount == 0))) {
calendar.set(Calendar.ZONE_OFFSET, tz.getRawOffset());
calendar.set(Calendar.DST_OFFSET,
nameIndex >= 3 ? tz.getDSTSavings() : 0);
calendar.set(Calendar.DST_OFFSET, dstAmount);
}
return (start + zoneNames[nameIndex].length());
}
@ -1511,8 +1562,8 @@ public class SimpleDateFormat extends DateFormat {
*/
private int subParse(String text, int start, int patternCharIndex, int count,
boolean obeyCount, boolean[] ambiguousYear,
ParsePosition origPos)
{
ParsePosition origPos,
boolean useFollowingMinusSignAsDelimiter) {
Number number = null;
int value = 0;
ParsePosition pos = new ParsePosition(0);
@ -1537,10 +1588,10 @@ public class SimpleDateFormat extends DateFormat {
// a number value. We handle further, more generic cases below. We need
// to handle some of them here because some fields require extra processing on
// the parsed value.
if (patternCharIndex == 4 /*HOUR_OF_DAY1_FIELD*/ ||
patternCharIndex == 15 /*HOUR1_FIELD*/ ||
(patternCharIndex == 2 /*MONTH_FIELD*/ && count <= 2) ||
patternCharIndex == 1) {
if (patternCharIndex == 4 /* HOUR_OF_DAY1_FIELD */ ||
patternCharIndex == 15 /* HOUR1_FIELD */ ||
(patternCharIndex == 2 /* MONTH_FIELD */ && count <= 2) ||
patternCharIndex == 1 /* YEAR_FIELD */) {
// It would be good to unify this with the obeyCount logic below,
// but that's going to be difficult.
if (obeyCount) {
@ -1557,6 +1608,15 @@ public class SimpleDateFormat extends DateFormat {
}
} else {
value = number.intValue();
if (useFollowingMinusSignAsDelimiter && (value < 0) &&
(((pos.index < text.length()) &&
(text.charAt(pos.index) != minusSign)) ||
((pos.index == text.length()) &&
(text.charAt(pos.index-1) == minusSign)))) {
value = -value;
pos.index--;
}
}
}
@ -1888,7 +1948,18 @@ public class SimpleDateFormat extends DateFormat {
number = numberFormat.parse(text, pos);
}
if (number != null) {
calendar.set(field, number.intValue());
value = number.intValue();
if (useFollowingMinusSignAsDelimiter && (value < 0) &&
(((pos.index < text.length()) &&
(text.charAt(pos.index) != minusSign)) ||
((pos.index == text.length()) &&
(text.charAt(pos.index-1) == minusSign)))) {
value = -value;
pos.index--;
}
calendar.set(field, value);
return pos.index;
}
break parsing;
@ -2099,4 +2170,33 @@ public class SimpleDateFormat extends DateFormat {
}
}
}
/**
* Analyze the negative subpattern of DecimalFormat and set/update values
* as necessary.
*/
private void checkNegativeNumberExpression() {
if ((numberFormat instanceof DecimalFormat) &&
!numberFormat.equals(originalNumberFormat)) {
String numberPattern = ((DecimalFormat)numberFormat).toPattern();
if (!numberPattern.equals(originalNumberPattern)) {
hasFollowingMinusSign = false;
int separatorIndex = numberPattern.indexOf(';');
// If the negative subpattern is not absent, we have to analayze
// it in order to check if it has a following minus sign.
if (separatorIndex > -1) {
int minusIndex = numberPattern.indexOf('-', separatorIndex);
if ((minusIndex > numberPattern.lastIndexOf('0')) &&
(minusIndex > numberPattern.lastIndexOf('#'))) {
hasFollowingMinusSign = true;
minusSign = ((DecimalFormat)numberFormat).getDecimalFormatSymbols().getMinusSign();
}
}
originalNumberPattern = numberPattern;
}
originalNumberFormat = numberFormat;
}
}
}

View File

@ -1315,8 +1315,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
// Make sure the change actually took effect
if (!selected && isSelected()) {
if (getModel() instanceof DefaultButtonModel) {
ButtonGroup group = (ButtonGroup)
((DefaultButtonModel)getModel()).getGroup();
ButtonGroup group = ((DefaultButtonModel)getModel()).getGroup();
if (group != null) {
group.clearSelection();
}
@ -1886,8 +1885,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])(listenerList.getListeners(
ChangeListener.class));
return listenerList.getListeners(ChangeListener.class);
}
/**
@ -1944,8 +1942,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
* @since 1.4
*/
public ActionListener[] getActionListeners() {
return (ActionListener[])(listenerList.getListeners(
ActionListener.class));
return listenerList.getListeners(ActionListener.class);
}
/**
@ -2137,7 +2134,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
* @since 1.4
*/
public ItemListener[] getItemListeners() {
return (ItemListener[])listenerList.getListeners(ItemListener.class);
return listenerList.getListeners(ItemListener.class);
}
/**
@ -2981,7 +2978,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
paintViewR.height = AbstractButton.this.getHeight() - (paintViewInsets.top + paintViewInsets.bottom);
String clippedText = SwingUtilities.layoutCompoundLabel(
(JComponent)AbstractButton.this,
AbstractButton.this,
getFontMetrics(getFont()),
text,
icon,

View File

@ -118,8 +118,7 @@ public abstract class AbstractCellEditor implements CellEditor, Serializable {
* @since 1.4
*/
public CellEditorListener[] getCellEditorListeners() {
return (CellEditorListener[])listenerList.getListeners(
CellEditorListener.class);
return listenerList.getListeners(CellEditorListener.class);
}
/**

View File

@ -85,8 +85,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
* @since 1.4
*/
public ListDataListener[] getListDataListeners() {
return (ListDataListener[])listenerList.getListeners(
ListDataListener.class);
return listenerList.getListeners(ListDataListener.class);
}

View File

@ -98,8 +98,7 @@ public abstract class AbstractSpinnerModel implements SpinnerModel, Serializable
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}

View File

@ -197,7 +197,7 @@ public class ActionMap implements Serializable {
return pKeys;
}
HashMap keyMap = new HashMap();
HashMap<Object, Object> keyMap = new HashMap<Object, Object>();
int counter;
for (counter = keys.length - 1; counter >= 0; counter--) {

View File

@ -62,7 +62,7 @@ class AncestorNotifier implements ComponentListener, PropertyChangeListener, Ser
}
AncestorListener[] getAncestorListeners() {
return (AncestorListener[])listenerList.getListeners(AncestorListener.class);
return listenerList.getListeners(AncestorListener.class);
}
/**

View File

@ -88,10 +88,10 @@ class ArrayTable implements Cloneable {
// Write ou the Serializable key/value pairs.
s.writeInt(validCount);
if (validCount > 0) {
for (int counter = 0; counter < keys.length; counter++) {
if (keys[counter] != null) {
s.writeObject(keys[counter]);
s.writeObject(table.get(keys[counter]));
for (Object key : keys) {
if (key != null) {
s.writeObject(key);
s.writeObject(table.get(key));
if (--validCount == 0) {
break;
}
@ -315,7 +315,7 @@ class ArrayTable implements Cloneable {
*/
private void grow() {
Object[] array = (Object[])table;
Hashtable tmp = new Hashtable(array.length/2);
Hashtable<Object, Object> tmp = new Hashtable<Object, Object>(array.length/2);
for (int i = 0; i<array.length; i+=2) {
tmp.put(array[i], array[i+1]);
}

View File

@ -68,7 +68,7 @@ import java.io.Serializable;
public class ButtonGroup implements Serializable {
// the list of buttons participating in this group
protected Vector<AbstractButton> buttons = new Vector();
protected Vector<AbstractButton> buttons = new Vector<AbstractButton>();
/**
* The current selection.

View File

@ -37,7 +37,7 @@ class DebugGraphicsInfo {
Color flashColor = Color.red;
int flashTime = 100;
int flashCount = 2;
Hashtable componentToDebug;
Hashtable<JComponent, Integer> componentToDebug;
JFrame debugFrame = null;
java.io.PrintStream stream = System.out;
@ -46,7 +46,7 @@ class DebugGraphicsInfo {
return;
}
if (componentToDebug == null) {
componentToDebug = new Hashtable();
componentToDebug = new Hashtable<JComponent, Integer>();
}
if (debug > 0) {
componentToDebug.put(component, Integer.valueOf(debug));
@ -59,7 +59,7 @@ class DebugGraphicsInfo {
if (componentToDebug == null) {
return 0;
} else {
Integer integer = (Integer)componentToDebug.get(component);
Integer integer = componentToDebug.get(component);
return integer == null ? 0 : integer.intValue();
}

View File

@ -343,8 +343,7 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}

View File

@ -326,8 +326,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable {
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
/**
@ -380,8 +379,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable {
* @since 1.4
*/
public ActionListener[] getActionListeners() {
return (ActionListener[])listenerList.getListeners(
ActionListener.class);
return listenerList.getListeners(ActionListener.class);
}
/**
@ -434,7 +432,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable {
* @since 1.4
*/
public ItemListener[] getItemListeners() {
return (ItemListener[])listenerList.getListeners(ItemListener.class);
return listenerList.getListeners(ItemListener.class);
}
/**

View File

@ -156,18 +156,17 @@ final class LegacyLayoutFocusTraversalPolicy
}
}
final class CompareTabOrderComparator implements Comparator {
final class CompareTabOrderComparator implements Comparator<Component> {
private final DefaultFocusManager defaultFocusManager;
CompareTabOrderComparator(DefaultFocusManager defaultFocusManager) {
this.defaultFocusManager = defaultFocusManager;
}
public int compare(Object o1, Object o2) {
public int compare(Component o1, Component o2) {
if (o1 == o2) {
return 0;
}
return (defaultFocusManager.compareTabOrder((Component)o1,
(Component)o2)) ? -1 : 1;
return (defaultFocusManager.compareTabOrder(o1, o2)) ? -1 : 1;
}
}

View File

@ -133,8 +133,7 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable,
* @since 1.4
*/
public ListSelectionListener[] getListSelectionListeners() {
return (ListSelectionListener[])listenerList.getListeners(
ListSelectionListener.class);
return listenerList.getListeners(ListSelectionListener.class);
}
/**

View File

@ -110,8 +110,7 @@ Serializable {
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
/**

View File

@ -1119,7 +1119,7 @@ public class GroupLayout implements LayoutManager2 {
* creating one if necessary.
*/
private ComponentInfo getComponentInfo(Component component) {
ComponentInfo info = (ComponentInfo)componentInfos.get(component);
ComponentInfo info = componentInfos.get(component);
if (info == null) {
info = new ComponentInfo(component);
componentInfos.put(component, info);
@ -1698,7 +1698,7 @@ public class GroupLayout implements LayoutManager2 {
for (int counter = springs.size() - 1; counter >= 0; counter--) {
Spring spring = springs.get(counter);
if (spring instanceof AutoPreferredGapSpring) {
((AutoPreferredGapSpring)spring).unset();
spring.unset();
} else if (spring instanceof Group) {
((Group)spring).unsetAutopadding();
}

View File

@ -200,7 +200,7 @@ public class InputMap implements Serializable {
return pKeys;
}
HashMap keyMap = new HashMap();
HashMap<KeyStroke, KeyStroke> keyMap = new HashMap<KeyStroke, KeyStroke>();
int counter;
for (counter = keys.length - 1; counter >= 0; counter--) {
@ -212,7 +212,7 @@ public class InputMap implements Serializable {
KeyStroke[] allKeys = new KeyStroke[keyMap.size()];
return (KeyStroke[])keyMap.keySet().toArray(allKeys);
return keyMap.keySet().toArray(allKeys);
}
private void writeObject(ObjectOutputStream s) throws IOException {

View File

@ -131,10 +131,7 @@ public class JApplet extends Applet implements Accessible,
// Check the timerQ and restart if necessary.
TimerQueue q = TimerQueue.sharedInstance();
if(q != null) {
synchronized(q) {
if(!q.running)
q.start();
}
q.startIfNeeded();
}
/* Workaround for bug 4155072. The shared double buffer image

View File

@ -859,7 +859,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @since 1.4
*/
public ItemListener[] getItemListeners() {
return (ItemListener[])listenerList.getListeners(ItemListener.class);
return listenerList.getListeners(ItemListener.class);
}
/**
@ -897,8 +897,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @since 1.4
*/
public ActionListener[] getActionListeners() {
return (ActionListener[])listenerList.getListeners(
ActionListener.class);
return listenerList.getListeners(ActionListener.class);
}
/**
@ -937,8 +936,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @since 1.4
*/
public PopupMenuListener[] getPopupMenuListeners() {
return (PopupMenuListener[])listenerList.getListeners(
PopupMenuListener.class);
return listenerList.getListeners(PopupMenuListener.class);
}
/**
@ -1668,7 +1666,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
if (editor != null) {
Component comp = editor.getEditorComponent();
if (comp instanceof Accessible) {
AccessibleContext ac = ((Accessible)comp).getAccessibleContext();
AccessibleContext ac = comp.getAccessibleContext();
if (ac != null) { // may be null
ac.setAccessibleName(getAccessibleName());
ac.setAccessibleDescription(getAccessibleDescription());
@ -1741,7 +1739,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
// Fire a FOCUSED lost PropertyChangeEvent for the
// previously selected list item.
PropertyChangeEvent pce = null;
PropertyChangeEvent pce;
if (previousSelectedAccessible != null) {
pce = new PropertyChangeEvent(previousSelectedAccessible,

View File

@ -192,7 +192,8 @@ public abstract class JComponent extends Container implements Serializable,
/**
* @see #readObject
*/
private static final Hashtable readObjectCallbacks = new Hashtable(1);
private static final Hashtable<ObjectInputStream, ReadObjectCallback> readObjectCallbacks =
new Hashtable<ObjectInputStream, ReadObjectCallback>(1);
/**
* Keys to use for forward focus traversal when the JComponent is
@ -356,7 +357,7 @@ public abstract class JComponent extends Container implements Serializable,
/**
* Temporary rectangles.
*/
private static java.util.List tempRectangles = new java.util.ArrayList(11);
private static java.util.List<Rectangle> tempRectangles = new java.util.ArrayList<Rectangle>(11);
/** Used for <code>WHEN_FOCUSED</code> bindings. */
private InputMap focusInputMap;
@ -451,7 +452,7 @@ public abstract class JComponent extends Container implements Serializable,
Rectangle rect;
int size = tempRectangles.size();
if (size > 0) {
rect = (Rectangle)tempRectangles.remove(size - 1);
rect = tempRectangles.remove(size - 1);
}
else {
rect = new Rectangle(0, 0, 0, 0);
@ -806,7 +807,7 @@ public abstract class JComponent extends Container implements Serializable,
// its index.
if (paintingChild != null &&
(paintingChild instanceof JComponent) &&
((JComponent)paintingChild).isOpaque()) {
paintingChild.isOpaque()) {
for (; i >= 0; i--) {
if (getComponent(i) == paintingChild){
break;
@ -875,7 +876,7 @@ public abstract class JComponent extends Container implements Serializable,
shouldSetFlagBack = true;
}
if(!printing) {
((JComponent)comp).paint(cg);
comp.paint(cg);
}
else {
if (!getFlag(IS_PRINTING_ALL)) {
@ -1098,7 +1099,7 @@ public abstract class JComponent extends Container implements Serializable,
}
private void adjustPaintFlags() {
JComponent jparent = null;
JComponent jparent;
Container parent;
for(parent = getParent() ; parent != null ; parent =
parent.getParent()) {
@ -2096,7 +2097,7 @@ public abstract class JComponent extends Container implements Serializable,
private void registerWithKeyboardManager(boolean onlyIfNew) {
InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);
KeyStroke[] strokes;
Hashtable registered = (Hashtable)getClientProperty
Hashtable<KeyStroke, KeyStroke> registered = (Hashtable)getClientProperty
(WHEN_IN_FOCUSED_WINDOW_BINDINGS);
if (inputMap != null) {
@ -2120,10 +2121,10 @@ public abstract class JComponent extends Container implements Serializable,
}
// Remove any old ones.
if (registered != null && registered.size() > 0) {
Enumeration keys = registered.keys();
Enumeration<KeyStroke> keys = registered.keys();
while (keys.hasMoreElements()) {
KeyStroke ks = (KeyStroke)keys.nextElement();
KeyStroke ks = keys.nextElement();
unregisterWithKeyboardManager(ks);
}
registered.clear();
@ -2131,7 +2132,7 @@ public abstract class JComponent extends Container implements Serializable,
// Updated the registered Hashtable.
if (strokes != null && strokes.length > 0) {
if (registered == null) {
registered = new Hashtable(strokes.length);
registered = new Hashtable<KeyStroke, KeyStroke>(strokes.length);
putClientProperty(WHEN_IN_FOCUSED_WINDOW_BINDINGS, registered);
}
for (int counter = strokes.length - 1; counter >= 0; counter--) {
@ -2174,7 +2175,7 @@ public abstract class JComponent extends Container implements Serializable,
InputMap km = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);
while (km != inputMap && km != null) {
km = (ComponentInputMap)km.getParent();
km = km.getParent();
}
if (km != null) {
registerWithKeyboardManager(false);
@ -3673,7 +3674,7 @@ public abstract class JComponent extends Container implements Serializable,
if (c != null && c instanceof Accessible) {
AccessibleJComponent.this.firePropertyChange(
AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
null, ((Accessible) c).getAccessibleContext());
null, c.getAccessibleContext());
}
}
public void componentRemoved(ContainerEvent e) {
@ -3681,7 +3682,7 @@ public abstract class JComponent extends Container implements Serializable,
if (c != null && c instanceof Accessible) {
AccessibleJComponent.this.firePropertyChange(
AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
((Accessible) c).getAccessibleContext(), null);
c.getAccessibleContext(), null);
}
}
}
@ -4377,7 +4378,7 @@ public abstract class JComponent extends Container implements Serializable,
// System.out.println("A) checking opaque: " + ((JComponent)child).isOpaque() + " " + child);
// System.out.print("B) ");
// Thread.dumpStack();
return ((JComponent)child).isOpaque();
return child.isOpaque();
} else {
/** Sometimes a heavy weight can have a bound larger than its peer size
* so we should always draw under heavy weights
@ -4693,7 +4694,7 @@ public abstract class JComponent extends Container implements Serializable,
result = (T[])getPropertyChangeListeners();
}
else {
result = (T[])listenerList.getListeners(listenerType);
result = listenerList.getListeners(listenerType);
}
if (result.length == 0) {
@ -4904,7 +4905,7 @@ public abstract class JComponent extends Container implements Serializable,
if(!isShowing()) {
return;
}
while(!((JComponent)c).isOpaque()) {
while(!c.isOpaque()) {
parent = c.getParent();
if(parent != null) {
x += c.getX();
@ -5198,7 +5199,7 @@ public abstract class JComponent extends Container implements Serializable,
Rectangle siblingRect;
boolean opaque;
if (sibling instanceof JComponent) {
opaque = ((JComponent)sibling).isOpaque();
opaque = sibling.isOpaque();
if (!opaque) {
if (retValue == PARTIALLY_OBSCURED) {
continue;
@ -5345,7 +5346,7 @@ public abstract class JComponent extends Container implements Serializable,
*/
private class ReadObjectCallback implements ObjectInputValidation
{
private final Vector roots = new Vector(1);
private final Vector<JComponent> roots = new Vector<JComponent>(1);
private final ObjectInputStream inputStream;
ReadObjectCallback(ObjectInputStream s) throws Exception {
@ -5361,8 +5362,7 @@ public abstract class JComponent extends Container implements Serializable,
*/
public void validateObject() throws InvalidObjectException {
try {
for(int i = 0; i < roots.size(); i++) {
JComponent root = (JComponent)(roots.elementAt(i));
for (JComponent root : roots) {
SwingUtilities.updateComponentTreeUI(root);
}
}
@ -5382,8 +5382,7 @@ public abstract class JComponent extends Container implements Serializable,
/* If the Component c is a descendant of one of the
* existing roots (or it IS an existing root), we're done.
*/
for(int i = 0; i < roots.size(); i++) {
JComponent root = (JComponent)roots.elementAt(i);
for (JComponent root : roots) {
for(Component p = c; p != null; p = p.getParent()) {
if (p == root) {
return;
@ -5396,7 +5395,7 @@ public abstract class JComponent extends Container implements Serializable,
* to the roots vector.
*/
for(int i = 0; i < roots.size(); i++) {
JComponent root = (JComponent)roots.elementAt(i);
JComponent root = roots.elementAt(i);
for(Component p = root.getParent(); p != null; p = p.getParent()) {
if (p == c) {
roots.removeElementAt(i--); // !!
@ -5428,7 +5427,7 @@ public abstract class JComponent extends Container implements Serializable,
* in the readObjectCallbacks table. Note that the ReadObjectCallback
* constructor takes care of calling s.registerValidation().
*/
ReadObjectCallback cb = (ReadObjectCallback)(readObjectCallbacks.get(s));
ReadObjectCallback cb = readObjectCallbacks.get(s);
if (cb == null) {
try {
readObjectCallbacks.put(s, cb = new ReadObjectCallback(s));

View File

@ -133,8 +133,8 @@ public class JDesktopPane extends JLayeredPane implements Accessible
public Component getDefaultComponent(Container c) {
JInternalFrame jifArray[] = getAllFrames();
Component comp = null;
for (int i = 0; i < jifArray.length; i++) {
comp = jifArray[i].getFocusTraversalPolicy().getDefaultComponent(jifArray[i]);
for (JInternalFrame jif : jifArray) {
comp = jif.getFocusTraversalPolicy().getDefaultComponent(jif);
if (comp != null) {
break;
}
@ -262,16 +262,15 @@ public class JDesktopPane extends JLayeredPane implements Accessible
public JInternalFrame[] getAllFrames() {
int i, count;
JInternalFrame[] results;
Vector vResults = new Vector(10);
Object next, tmp;
Vector<JInternalFrame> vResults = new Vector<JInternalFrame>(10);
count = getComponentCount();
for(i = 0; i < count; i++) {
next = getComponent(i);
Component next = getComponent(i);
if(next instanceof JInternalFrame)
vResults.addElement(next);
vResults.addElement((JInternalFrame) next);
else if(next instanceof JInternalFrame.JDesktopIcon) {
tmp = ((JInternalFrame.JDesktopIcon)next).getInternalFrame();
JInternalFrame tmp = ((JInternalFrame.JDesktopIcon)next).getInternalFrame();
if(tmp != null)
vResults.addElement(tmp);
}
@ -324,18 +323,17 @@ public class JDesktopPane extends JLayeredPane implements Accessible
public JInternalFrame[] getAllFramesInLayer(int layer) {
int i, count;
JInternalFrame[] results;
Vector vResults = new Vector(10);
Object next, tmp;
Vector<JInternalFrame> vResults = new Vector<JInternalFrame>(10);
count = getComponentCount();
for(i = 0; i < count; i++) {
next = getComponent(i);
Component next = getComponent(i);
if(next instanceof JInternalFrame) {
if(((JInternalFrame)next).getLayer() == layer)
vResults.addElement(next);
vResults.addElement((JInternalFrame) next);
} else if(next instanceof JInternalFrame.JDesktopIcon) {
tmp = ((JInternalFrame.JDesktopIcon)next).getInternalFrame();
if(tmp != null && ((JInternalFrame)tmp).getLayer() == layer)
JInternalFrame tmp = ((JInternalFrame.JDesktopIcon)next).getInternalFrame();
if(tmp != null && tmp.getLayer() == layer)
vResults.addElement(tmp);
}
}

View File

@ -277,7 +277,7 @@ public class JDialog extends Dialog implements WindowConstants,
title, modal);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
dialogInit();
@ -329,7 +329,7 @@ public class JDialog extends Dialog implements WindowConstants,
title, modal, gc);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
dialogInit();

View File

@ -319,8 +319,7 @@ public class JEditorPane extends JTextComponent {
* @since 1.4
*/
public synchronized HyperlinkListener[] getHyperlinkListeners() {
return (HyperlinkListener[])listenerList.getListeners(
HyperlinkListener.class);
return listenerList.getListeners(javax.swing.event.HyperlinkListener.class);
}
/**
@ -492,8 +491,8 @@ public class JEditorPane extends JTextComponent {
if (pageProperties != null) {
// transfer properties discovered in stream to the
// document property collection.
for (Enumeration e = pageProperties.keys(); e.hasMoreElements() ;) {
Object key = e.nextElement();
for (Enumeration<String> e = pageProperties.keys(); e.hasMoreElements() ;) {
String key = e.nextElement();
doc.putProperty(key, pageProperties.get(key));
}
pageProperties.clear();
@ -775,7 +774,7 @@ public class JEditorPane extends JTextComponent {
*/
private void handleConnectionProperties(URLConnection conn) {
if (pageProperties == null) {
pageProperties = new Hashtable();
pageProperties = new Hashtable<String, Object>();
}
String type = conn.getContentType();
if (type != null) {
@ -989,7 +988,7 @@ public class JEditorPane extends JTextComponent {
* of the content type in the http header information.
*/
private void setCharsetFromContentTypeParameters(String paramlist) {
String charset = null;
String charset;
try {
// paramlist is handed to us with a leading ';', strip it.
int semi = paramlist.indexOf(';');
@ -1080,9 +1079,9 @@ public class JEditorPane extends JTextComponent {
*/
public EditorKit getEditorKitForContentType(String type) {
if (typeHandlers == null) {
typeHandlers = new Hashtable(3);
typeHandlers = new Hashtable<String, EditorKit>(3);
}
EditorKit k = (EditorKit) typeHandlers.get(type);
EditorKit k = typeHandlers.get(type);
if (k == null) {
k = createEditorKitForContentType(type);
if (k != null) {
@ -1106,7 +1105,7 @@ public class JEditorPane extends JTextComponent {
*/
public void setEditorKitForContentType(String type, EditorKit k) {
if (typeHandlers == null) {
typeHandlers = new Hashtable(3);
typeHandlers = new Hashtable<String, EditorKit>(3);
}
typeHandlers.put(type, k);
}
@ -1176,13 +1175,12 @@ public class JEditorPane extends JTextComponent {
* registered for the given type
*/
public static EditorKit createEditorKitForContentType(String type) {
EditorKit k = null;
Hashtable kitRegistry = getKitRegisty();
k = (EditorKit) kitRegistry.get(type);
Hashtable<String, EditorKit> kitRegistry = getKitRegisty();
EditorKit k = kitRegistry.get(type);
if (k == null) {
// try to dynamically load the support
String classname = (String) getKitTypeRegistry().get(type);
ClassLoader loader = (ClassLoader) getKitLoaderRegistry().get(type);
String classname = getKitTypeRegistry().get(type);
ClassLoader loader = getKitLoaderRegistry().get(type);
try {
Class c;
if (loader != null) {
@ -1252,20 +1250,20 @@ public class JEditorPane extends JTextComponent {
* @since 1.3
*/
public static String getEditorKitClassNameForContentType(String type) {
return (String)getKitTypeRegistry().get(type);
return getKitTypeRegistry().get(type);
}
private static Hashtable getKitTypeRegistry() {
private static Hashtable<String, String> getKitTypeRegistry() {
loadDefaultKitsIfNecessary();
return (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey);
}
private static Hashtable getKitLoaderRegistry() {
private static Hashtable<String, ClassLoader> getKitLoaderRegistry() {
loadDefaultKitsIfNecessary();
return (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey);
}
private static Hashtable getKitRegisty() {
private static Hashtable<String, EditorKit> getKitRegisty() {
Hashtable ht = (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);
if (ht == null) {
ht = new Hashtable(3);
@ -1512,7 +1510,7 @@ public class JEditorPane extends JTextComponent {
private EditorKit kit;
private boolean isUserSetEditorKit;
private Hashtable pageProperties;
private Hashtable<String, Object> pageProperties;
/** Should be kept in sync with javax.swing.text.html.FormView counterpart. */
final static String PostDataProperty = "javax.swing.JEditorPane.postdata";
@ -1520,7 +1518,7 @@ public class JEditorPane extends JTextComponent {
/**
* Table of registered type handlers for this editor.
*/
private Hashtable typeHandlers;
private Hashtable<String, EditorKit> typeHandlers;
/*
* Private AppContext keys for this class's static variables.
@ -1913,11 +1911,11 @@ public class JEditorPane extends JTextComponent {
}
}
private class LinkVector extends Vector {
private class LinkVector extends Vector<HTMLLink> {
public int baseElementIndex(Element e) {
HTMLLink l;
for (int i = 0; i < elementCount; i++) {
l = (HTMLLink) elementAt(i);
l = elementAt(i);
if (l.element == e) {
return i;
}
@ -2029,7 +2027,7 @@ public class JEditorPane extends JTextComponent {
buildLinkTable();
}
if (linkIndex >= 0 && linkIndex < hyperlinks.size()) {
return (AccessibleHyperlink) hyperlinks.elementAt(linkIndex);
return hyperlinks.elementAt(linkIndex);
} else {
return null;
}

View File

@ -248,7 +248,7 @@ public class JFileChooser extends JComponent implements Accessible {
private String approveButtonToolTipText = null;
private int approveButtonMnemonic = 0;
private Vector filters = new Vector(5);
private Vector<FileFilter> filters = new Vector<FileFilter>(5);
private JDialog dialog = null;
private int dialogType = OPEN_DIALOG;
private int returnValue = ERROR_OPTION;
@ -503,7 +503,7 @@ public class JFileChooser extends JComponent implements Accessible {
if(selectedFiles == null) {
return new File[0];
} else {
return (File[]) selectedFiles.clone();
return selectedFiles.clone();
}
}
@ -1415,17 +1415,17 @@ public class JFileChooser extends JComponent implements Accessible {
fileFilter = filter;
if (filter != null) {
if (isMultiSelectionEnabled() && selectedFiles != null && selectedFiles.length > 0) {
Vector fList = new Vector();
Vector<File> fList = new Vector<File>();
boolean failed = false;
for (int i = 0; i < selectedFiles.length; i++) {
if (filter.accept(selectedFiles[i])) {
fList.add(selectedFiles[i]);
for (File file : selectedFiles) {
if (filter.accept(file)) {
fList.add(file);
} else {
failed = true;
}
}
if (failed) {
setSelectedFiles((fList.size() == 0) ? null : (File[])fList.toArray(new File[fList.size()]));
setSelectedFiles((fList.size() == 0) ? null : fList.toArray(new File[fList.size()]));
}
} else if (selectedFile != null && !filter.accept(selectedFile)) {
setSelectedFile(null);
@ -1702,8 +1702,7 @@ public class JFileChooser extends JComponent implements Accessible {
* @since 1.4
*/
public ActionListener[] getActionListeners() {
return (ActionListener[])listenerList.getListeners(
ActionListener.class);
return listenerList.getListeners(ActionListener.class);
}
/**
@ -1744,7 +1743,7 @@ public class JFileChooser extends JComponent implements Accessible {
WeakReference<JFileChooser> jfcRef;
public WeakPCL(JFileChooser jfc) {
jfcRef = new WeakReference(jfc);
jfcRef = new WeakReference<JFileChooser>(jfc);
}
public void propertyChange(PropertyChangeEvent ev) {
assert ev.getPropertyName().equals(SHOW_HIDDEN_PROP);

View File

@ -421,8 +421,8 @@ public class JInternalFrame extends JComponent implements
invalidate();
Component[] children = getComponents();
if (children != null) {
for(int i = 0; i < children.length; i++) {
SwingUtilities.updateComponentTreeUI(children[i]);
for (Component child : children) {
SwingUtilities.updateComponentTreeUI(child);
}
}
}
@ -1535,8 +1535,7 @@ public class JInternalFrame extends JComponent implements
* @see #addInternalFrameListener
*/
public InternalFrameListener[] getInternalFrameListeners() {
return (InternalFrameListener[])listenerList.getListeners(
InternalFrameListener.class);
return listenerList.getListeners(InternalFrameListener.class);
}
// remind: name ok? all one method ok? need to be synchronized?
@ -2258,8 +2257,8 @@ public class JInternalFrame extends JComponent implements
invalidate();
Component[] children = getComponents();
if (children != null) {
for(int i = 0; i < children.length; i++) {
SwingUtilities.updateComponentTreeUI(children[i]);
for (Component child : children) {
SwingUtilities.updateComponentTreeUI(child);
}
}
}

View File

@ -191,7 +191,7 @@ public class JLayeredPane extends JComponent implements Accessible {
private void validateOptimizedDrawing() {
boolean layeredComponentFound = false;
synchronized(getTreeLock()) {
Integer layer = null;
Integer layer;
for (Component c : getComponents()) {
layer = null;
@ -213,7 +213,7 @@ public class JLayeredPane extends JComponent implements Accessible {
}
protected void addImpl(Component comp, Object constraints, int index) {
int layer = DEFAULT_LAYER.intValue();
int layer;
int pos;
if(constraints instanceof Integer) {
@ -364,7 +364,7 @@ public class JLayeredPane extends JComponent implements Accessible {
if(c instanceof JComponent)
((JComponent)c).putClientProperty(LAYER_PROPERTY, layerObj);
else
getComponentToLayer().put((Component)c, layerObj);
getComponentToLayer().put(c, layerObj);
if(c.getParent() == null || c.getParent() != this) {
repaint(c.getBounds());
@ -388,7 +388,7 @@ public class JLayeredPane extends JComponent implements Accessible {
if(c instanceof JComponent)
i = (Integer)((JComponent)c).getClientProperty(LAYER_PROPERTY);
else
i = (Integer)getComponentToLayer().get((Component)c);
i = getComponentToLayer().get(c);
if(i == null)
return DEFAULT_LAYER.intValue();
@ -465,9 +465,9 @@ public class JLayeredPane extends JComponent implements Accessible {
* @see #getComponentCountInLayer
*/
public int getPosition(Component c) {
int i, count, startLayer, curLayer, startLocation, pos = 0;
int i, startLayer, curLayer, startLocation, pos = 0;
count = getComponentCount();
getComponentCount();
startLocation = getIndexOf(c);
if(startLocation == -1)

View File

@ -1848,8 +1848,7 @@ public class JList extends JComponent implements Scrollable, Accessible
* @since 1.4
*/
public ListSelectionListener[] getListSelectionListeners() {
return (ListSelectionListener[])listenerList.getListeners(
ListSelectionListener.class);
return listenerList.getListeners(ListSelectionListener.class);
}
@ -2220,9 +2219,9 @@ public class JList extends JComponent implements Scrollable, Accessible
ListSelectionModel sm = getSelectionModel();
sm.clearSelection();
int size = getModel().getSize();
for(int i = 0; i < indices.length; i++) {
if (indices[i] < size) {
sm.addSelectionInterval(indices[i], indices[i]);
for (int i : indices) {
if (i < size) {
sm.addSelectionInterval(i, i);
}
}
}
@ -2724,7 +2723,7 @@ public class JList extends JComponent implements Scrollable, Accessible
return true;
}
if (getParent() instanceof JViewport) {
return (((JViewport)getParent()).getWidth() > getPreferredSize().width);
return (getParent().getWidth() > getPreferredSize().width);
}
return false;
}
@ -2749,7 +2748,7 @@ public class JList extends JComponent implements Scrollable, Accessible
return true;
}
if (getParent() instanceof JViewport) {
return (((JViewport)getParent()).getHeight() > getPreferredSize().height);
return (getParent().getHeight() > getPreferredSize().height);
}
return false;
}
@ -3161,7 +3160,7 @@ public class JList extends JComponent implements Scrollable, Accessible
private AccessibleContext getCurrentAccessibleContext() {
Component c = getComponentAtIndex(indexInParent);
if (c instanceof Accessible) {
return ((Accessible) c).getAccessibleContext();
return c.getAccessibleContext();
} else {
return null;
}

View File

@ -371,8 +371,8 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
* @since 1.3
*/
protected Point getPopupMenuOrigin() {
int x = 0;
int y = 0;
int x;
int y;
JPopupMenu pm = getPopupMenu();
// Figure out the sizes needed to caclulate the menu position
Dimension s = getSize();
@ -900,10 +900,8 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
* on another menu
*/
public boolean isTopLevelMenu() {
if (getParent() instanceof JMenuBar)
return true;
return getParent() instanceof JMenuBar;
return false;
}
/**
@ -1015,7 +1013,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
* @since 1.4
*/
public MenuListener[] getMenuListeners() {
return (MenuListener[])listenerList.getListeners(MenuListener.class);
return listenerList.getListeners(MenuListener.class);
}
/**
@ -1305,7 +1303,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
* @return the array of menu items
*/
private MenuElement[] buildMenuElementArray(JMenu leaf) {
Vector elements = new Vector();
Vector<MenuElement> elements = new Vector<MenuElement>();
Component current = leaf.getPopupMenu();
JPopupMenu pop;
JMenu menu;
@ -1409,8 +1407,8 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
public int getAccessibleChildrenCount() {
Component[] children = getMenuComponents();
int count = 0;
for (int j = 0; j < children.length; j++) {
if (children[j] instanceof Accessible) {
for (Component child : children) {
if (child instanceof Accessible) {
count++;
}
}
@ -1426,18 +1424,18 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
public Accessible getAccessibleChild(int i) {
Component[] children = getMenuComponents();
int count = 0;
for (int j = 0; j < children.length; j++) {
if (children[j] instanceof Accessible) {
for (Component child : children) {
if (child instanceof Accessible) {
if (count == i) {
if (children[j] instanceof JComponent) {
if (child instanceof JComponent) {
// FIXME: [[[WDW - probably should set this when
// the component is added to the menu. I tried
// to do this in most cases, but the separators
// added by addSeparator are hard to get to.]]]
AccessibleContext ac = ((Accessible) children[j]).getAccessibleContext();
AccessibleContext ac = child.getAccessibleContext();
ac.setAccessibleParent(JMenu.this);
}
return (Accessible) children[j];
return (Accessible) child;
} else {
count++;
}
@ -1581,7 +1579,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
}
JMenuItem mi = getItem(i);
if (mi != null && mi instanceof JMenu) {
if (((JMenu) mi).isSelected()) {
if (mi.isSelected()) {
MenuElement old[] =
MenuSelectionManager.defaultManager().getSelectedPath();
MenuElement me[] = new MenuElement[old.length-2];

View File

@ -414,7 +414,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
*/
public MenuElement[] getSubElements() {
MenuElement result[];
Vector tmp = new Vector();
Vector<MenuElement> tmp = new Vector<MenuElement>();
int c = getComponentCount();
int i;
Component m;
@ -422,12 +422,12 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
for(i=0 ; i < c ; i++) {
m = getComponent(i);
if(m instanceof MenuElement)
tmp.addElement(m);
tmp.addElement((MenuElement) m);
}
result = new MenuElement[tmp.size()];
for(i=0,c=tmp.size() ; i < c ; i++)
result[i] = (MenuElement) tmp.elementAt(i);
result[i] = tmp.elementAt(i);
return result;
}
@ -664,9 +664,9 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
if (!retValue) {
MenuElement[] subElements = getSubElements();
for (int i=0; i<subElements.length; i++) {
for (MenuElement subElement : subElements) {
if (processBindingForKeyStrokeRecursive(
subElements[i], ks, e, condition, pressed)) {
subElement, ks, e, condition, pressed)) {
return true;
}
}
@ -693,9 +693,8 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
}
MenuElement[] subElements = elem.getSubElements();
for(int i=0; i<subElements.length; i++) {
if (processBindingForKeyStrokeRecursive(subElements[i], ks, e,
condition, pressed)) {
for (MenuElement subElement : subElements) {
if (processBindingForKeyStrokeRecursive(subElement, ks, e, condition, pressed)) {
return true;
// We don't, pass along to children JMenu's
}

View File

@ -275,7 +275,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* hidden: true
*/
public void setArmed(boolean b) {
ButtonModel model = (ButtonModel) getModel();
ButtonModel model = getModel();
boolean oldValue = model.isArmed();
if(model.isArmed() != b) {
@ -290,7 +290,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @see #setArmed
*/
public boolean isArmed() {
ButtonModel model = (ButtonModel) getModel();
ButtonModel model = getModel();
return model.isArmed();
}
@ -721,8 +721,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @since 1.4
*/
public MenuDragMouseListener[] getMenuDragMouseListeners() {
return (MenuDragMouseListener[])listenerList.getListeners(
MenuDragMouseListener.class);
return listenerList.getListeners(MenuDragMouseListener.class);
}
/**
@ -752,8 +751,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @since 1.4
*/
public MenuKeyListener[] getMenuKeyListeners() {
return (MenuKeyListener[])listenerList.getListeners(
MenuKeyListener.class);
return listenerList.getListeners(MenuKeyListener.class);
}
/**

View File

@ -963,7 +963,7 @@ public class JOptionPane extends JComponent implements Accessible
}
if (window instanceof SwingUtilities.SharedOwnerFrame) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
SwingUtilities.getSharedOwnerFrameShutdownListener();
dialog.addWindowListener(ownerShutdownListener);
}
initDialog(dialog, style, parentComponent);
@ -1300,11 +1300,10 @@ public class JOptionPane extends JComponent implements Accessible
// Use reflection to get Container.startLWModal.
try {
Object obj;
obj = AccessController.doPrivileged(new ModalPrivilegedAction(
Method method = AccessController.doPrivileged(new ModalPrivilegedAction(
Container.class, "startLWModal"));
if (obj != null) {
((Method)obj).invoke(dialog, (Object[])null);
if (method != null) {
method.invoke(dialog, (Object[])null);
}
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) {
@ -1446,11 +1445,10 @@ public class JOptionPane extends JComponent implements Accessible
// Use reflection to get Container.startLWModal.
try {
Object obj;
obj = AccessController.doPrivileged(new ModalPrivilegedAction(
Method method = AccessController.doPrivileged(new ModalPrivilegedAction(
Container.class, "startLWModal"));
if (obj != null) {
((Method)obj).invoke(dialog, (Object[])null);
if (method != null) {
method.invoke(dialog, (Object[])null);
}
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) {
@ -1531,12 +1529,11 @@ public class JOptionPane extends JComponent implements Accessible
event.getPropertyName().equals(VALUE_PROPERTY)) {
// Use reflection to get Container.stopLWModal().
try {
Object obj;
obj = AccessController.doPrivileged(
Method method = AccessController.doPrivileged(
new ModalPrivilegedAction(
Container.class, "stopLWModal"));
if (obj != null) {
((Method)obj).invoke(iFrame, (Object[])null);
if (method != null) {
method.invoke(iFrame, (Object[])null);
}
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) {
@ -1852,7 +1849,7 @@ public class JOptionPane extends JComponent implements Accessible
* description: The UI object that implements the optionpane's LookAndFeel
*/
public void setUI(OptionPaneUI ui) {
if ((OptionPaneUI)this.ui != ui) {
if (this.ui != ui) {
super.setUI(ui);
invalidate();
}
@ -2327,7 +2324,7 @@ public class JOptionPane extends JComponent implements Accessible
// Serialization support.
private void writeObject(ObjectOutputStream s) throws IOException {
Vector values = new Vector();
Vector<Object> values = new Vector<Object>();
s.defaultWriteObject();
// Save the icon, if its Serializable.
@ -2342,7 +2339,7 @@ public class JOptionPane extends JComponent implements Accessible
}
// Save the treeModel, if its Serializable.
if(options != null) {
Vector serOptions = new Vector();
Vector<Object> serOptions = new Vector<Object>();
for(int counter = 0, maxCounter = options.length;
counter < maxCounter; counter++)
@ -2510,16 +2507,16 @@ public class JOptionPane extends JComponent implements Accessible
/**
* Retrieves a method from the provided class and makes it accessible.
*/
private static class ModalPrivilegedAction implements PrivilegedAction {
private Class clazz;
private static class ModalPrivilegedAction implements PrivilegedAction<Method> {
private Class<?> clazz;
private String methodName;
public ModalPrivilegedAction(Class clazz, String methodName) {
public ModalPrivilegedAction(Class<?> clazz, String methodName) {
this.clazz = clazz;
this.methodName = methodName;
}
public Object run() {
public Method run() {
Method method = null;
try {
method = clazz.getDeclaredMethod(methodName, (Class[])null);

View File

@ -584,7 +584,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
int nitems = getComponentCount();
// PENDING(ges): Why not use an array?
Vector tempItems = new Vector();
Vector<Component> tempItems = new Vector<Component>();
/* Remove the item at index, nitems-index times
storing them in a temporary vector in the
@ -600,8 +600,8 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
/* Add the removed items back to the menu, they are
already in the correct order in the temp vector.
*/
for (int i = 0; i < tempItems.size() ; i++) {
add((Component)tempItems.elementAt(i));
for (Component tempItem : tempItems) {
add(tempItem);
}
}
@ -632,8 +632,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
* @since 1.4
*/
public PopupMenuListener[] getPopupMenuListeners() {
return (PopupMenuListener[])listenerList.getListeners(
PopupMenuListener.class);
return listenerList.getListeners(PopupMenuListener.class);
}
/**
@ -665,8 +664,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
* @since 1.5
*/
public MenuKeyListener[] getMenuKeyListeners() {
return (MenuKeyListener[])listenerList.getListeners(
MenuKeyListener.class);
return listenerList.getListeners(MenuKeyListener.class);
}
/**
@ -781,7 +779,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
// set selection path before popping up!
if (isPopupMenu()) {
MenuElement me[] = new MenuElement[1];
me[0] = (MenuElement) this;
me[0] = this;
MenuSelectionManager.defaultManager().setSelectedPath(me);
}
}
@ -848,10 +846,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
* being displayed).
*/
public boolean isVisible() {
if(popup != null)
return true;
else
return false;
return popup != null;
}
/**
@ -1311,7 +1306,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
// Serialization support.
////////////
private void writeObject(ObjectOutputStream s) throws IOException {
Vector values = new Vector();
Vector<Object> values = new Vector<Object>();
s.defaultWriteObject();
// Save the invoker, if its Serializable.
@ -1494,7 +1489,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
*/
public MenuElement[] getSubElements() {
MenuElement result[];
Vector tmp = new Vector();
Vector<MenuElement> tmp = new Vector<MenuElement>();
int c = getComponentCount();
int i;
Component m;
@ -1502,12 +1497,12 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
for(i=0 ; i < c ; i++) {
m = getComponent(i);
if(m instanceof MenuElement)
tmp.addElement(m);
tmp.addElement((MenuElement) m);
}
result = new MenuElement[tmp.size()];
for(i=0,c=tmp.size() ; i < c ; i++)
result[i] = (MenuElement) tmp.elementAt(i);
result[i] = tmp.elementAt(i);
return result;
}

View File

@ -699,8 +699,7 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
/**

View File

@ -659,8 +659,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
* @since 1.4
*/
public AdjustmentListener[] getAdjustmentListeners() {
return (AdjustmentListener[])listenerList.getListeners(
AdjustmentListener.class);
return listenerList.getListeners(AdjustmentListener.class);
}
@ -754,8 +753,8 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
public void setEnabled(boolean x) {
super.setEnabled(x);
Component[] children = getComponents();
for(int i = 0; i < children.length; i++) {
children[i].setEnabled(x);
for (Component child : children) {
child.setEnabled(x);
}
}

View File

@ -270,8 +270,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible {
{
checkOrientation(orientation);
this.orientation = orientation;
sliderModel = new DefaultBoundedRangeModel(value, 0, min, max);
sliderModel.addChangeListener(changeListener);
setModel(new DefaultBoundedRangeModel(value, 0, min, max));
updateUI();
}
@ -284,7 +283,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible {
{
this.orientation = JSlider.HORIZONTAL;
setModel(brm);
sliderModel.addChangeListener(changeListener);
updateUI();
}
@ -476,15 +474,15 @@ public class JSlider extends JComponent implements SwingConstants, Accessible {
if (newModel != null) {
newModel.addChangeListener(changeListener);
}
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
(oldModel == null
? null : Integer.valueOf(oldModel.getValue())),
(newModel == null
? null : Integer.valueOf(newModel.getValue())));
}
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
(oldModel == null
? null : Integer.valueOf(oldModel.getValue())),
(newModel == null
? null : Integer.valueOf(newModel.getValue())));
}
firePropertyChange("model", oldModel, sliderModel);
@ -930,7 +928,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible {
throw new IllegalArgumentException( "Label incremement must be > 0" );
}
class SmartHashtable extends Hashtable implements PropertyChangeListener {
class SmartHashtable extends Hashtable<Object, Object> implements PropertyChangeListener {
int increment = 0;
int start = 0;
boolean startAtMin = false;
@ -977,9 +975,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible {
if ( e.getPropertyName().equals( "minimum" ) ||
e.getPropertyName().equals( "maximum" ) ) {
Dictionary labelTable = getLabelTable();
Enumeration keys = labelTable.keys();
Hashtable hashtable = new Hashtable();
Enumeration keys = getLabelTable().keys();
Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();
// Save the labels that were added by the developer
while ( keys.hasMoreElements() ) {

View File

@ -433,8 +433,7 @@ public class JSpinner extends JComponent implements Accessible
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
@ -1536,7 +1535,7 @@ public class JSpinner extends JComponent implements Accessible
return textField.getAccessibleContext();
}
} else if (editor instanceof Accessible) {
return ((Accessible)editor).getAccessibleContext();
return editor.getAccessibleContext();
}
return null;
}
@ -1693,7 +1692,7 @@ public class JSpinner extends JComponent implements Accessible
if (i < 0 || i > 1) {
return false;
}
Object o = null;
Object o;
if (i == 0) {
o = getNextValue(); // AccessibleAction.INCREMENT
} else {

View File

@ -313,8 +313,7 @@ public class JTabbedPane extends JComponent
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
/**
@ -2062,7 +2061,7 @@ public class JTabbedPane extends JComponent
* Accessibility classes unnecessarily.
*/
AccessibleContext ac;
ac = ((Accessible) component).getAccessibleContext();
ac = component.getAccessibleContext();
if (ac != null) {
ac.setAccessibleParent(this);
}

View File

@ -1677,16 +1677,16 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
if (!forDrop && state != null) {
clearSelection();
int[] rows = (int[])((int[][])state)[0];
int[] cols = (int[])((int[][])state)[1];
int[] anchleads = (int[])((int[][])state)[2];
int[] rows = ((int[][])state)[0];
int[] cols = ((int[][])state)[1];
int[] anchleads = ((int[][])state)[2];
for (int i = 0; i < rows.length; i++) {
addRowSelectionInterval(rows[i], rows[i]);
for (int row : rows) {
addRowSelectionInterval(row, row);
}
for (int i = 0; i < cols.length; i++) {
addColumnSelectionInterval(cols[i], cols[i]);
for (int col : cols) {
addColumnSelectionInterval(col, col);
}
SwingUtilities2.setLeadAnchorWithoutSelection(
@ -1776,7 +1776,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
boolean oldValue = this.autoCreateRowSorter;
this.autoCreateRowSorter = autoCreateRowSorter;
if (autoCreateRowSorter) {
setRowSorter(new TableRowSorter(getModel()));
setRowSorter(new TableRowSorter<TableModel>(getModel()));
}
firePropertyChange("autoCreateRowSorter", oldValue,
autoCreateRowSorter);
@ -3198,7 +3198,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
private void accommodateDelta(int resizingColumnIndex, int delta) {
int columnCount = getColumnCount();
int from = resizingColumnIndex;
int to = columnCount;
int to;
// Use the mode to determine how to absorb the changes.
switch(autoResizeMode) {
@ -3237,8 +3237,6 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
}
adjustSizes(totalWidth + delta, r, false);
return;
}
private interface Resizable2 {
@ -3492,7 +3490,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see #editingRow
*/
public boolean isEditing() {
return (cellEditor == null)? false : true;
return cellEditor != null;
}
/**
@ -3642,7 +3640,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
firePropertyChange("model", old, dataModel);
if (getAutoCreateRowSorter()) {
setRowSorter(new TableRowSorter(dataModel));
setRowSorter(new TableRowSorter<TableModel>(dataModel));
}
}
}
@ -5160,7 +5158,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
public boolean getScrollableTracksViewportHeight() {
return getFillsViewportHeight()
&& getParent() instanceof JViewport
&& (((JViewport)getParent()).getHeight() > getPreferredSize().height);
&& (getParent().getHeight() > getPreferredSize().height);
}
/**
@ -5214,7 +5212,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
// by setting the client property JTable.autoStartsEdit to Boolean.FALSE.
if (!retValue && condition == WHEN_ANCESTOR_OF_FOCUSED_COMPONENT &&
isFocusOwner() &&
!Boolean.FALSE.equals((Boolean)getClientProperty("JTable.autoStartsEdit"))) {
!Boolean.FALSE.equals(getClientProperty("JTable.autoStartsEdit"))) {
// We do not have a binding for the event.
Component editorComponent = getEditorComponent();
if (editorComponent == null) {
@ -5436,7 +5434,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
this.value = null;
((JComponent)getComponent()).setBorder(new LineBorder(Color.black));
try {
Class type = table.getColumnClass(column);
Class<?> type = table.getColumnClass(column);
// Since our obligation is to produce a value which is
// assignable for the required type it is OK to use the
// String constructor for columns which are declared
@ -6627,10 +6625,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
} else if (name.compareTo("tableCellEditor") == 0) {
if (oldValue != null && oldValue instanceof TableCellEditor) {
((TableCellEditor) oldValue).removeCellEditorListener((CellEditorListener) this);
((TableCellEditor) oldValue).removeCellEditorListener(this);
}
if (newValue != null && newValue instanceof TableCellEditor) {
((TableCellEditor) newValue).addCellEditorListener((CellEditorListener) this);
((TableCellEditor) newValue).addCellEditorListener(this);
}
}
}
@ -7045,7 +7043,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
*/
public Accessible getAccessibleSelection(int i) {
if (i < 0 || i > getAccessibleSelectionCount()) {
return (Accessible) null;
return null;
}
int rowsSel = JTable.this.getSelectedRowCount();
@ -7158,7 +7156,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
return getAccessibleChild((r * ttlCols) + c);
}
}
return (Accessible) null;
return null;
}
/**
@ -7906,7 +7904,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
JTable.this, getValueAt(row, column),
false, false, row, column);
if (component instanceof Accessible) {
return ((Accessible) component).getAccessibleContext();
return component.getAccessibleContext();
} else {
return null;
}

View File

@ -475,8 +475,7 @@ public class JTextField extends JTextComponent implements SwingConstants {
* @since 1.4
*/
public synchronized ActionListener[] getActionListeners() {
return (ActionListener[])listenerList.getListeners(
ActionListener.class);
return listenerList.getListeners(ActionListener.class);
}
/**

View File

@ -187,7 +187,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* information must be determined by visiting all the parent
* paths and seeing if they are visible.
*/
transient private Hashtable expandedState;
transient private Hashtable<TreePath, Boolean> expandedState;
/**
@ -281,7 +281,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* Used when <code>setExpandedState</code> is invoked,
* will be a <code>Stack</code> of <code>Stack</code>s.
*/
transient private Stack expandedStack;
transient private Stack<Stack<TreePath>> expandedStack;
/**
* Lead selection path, may not be <code>null</code>.
@ -652,9 +652,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
@ConstructorProperties({"model"})
public JTree(TreeModel newModel) {
super();
expandedStack = new Stack();
expandedStack = new Stack<Stack<TreePath>>();
toggleClickCount = 2;
expandedState = new Hashtable();
expandedState = new Hashtable<TreePath, Boolean>();
setLayout(null);
rowHeight = 16;
visibleRowCount = 20;
@ -691,7 +691,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* description: The UI object that implements the Component's LookAndFeel.
*/
public void setUI(TreeUI ui) {
if ((TreeUI)this.ui != ui) {
if (this.ui != ui) {
settingUI = true;
uiTreeExpansionListener = null;
try {
@ -1298,8 +1298,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
Object root = (model == null) ? null : model.getRoot();
TreePath rootPath = (root == null) ? null : new TreePath(root);
TreePath child = null;
TreePath parent = null;
TreePath child;
TreePath parent;
boolean outside = row == -1
|| p.y < bounds.y
|| p.y >= bounds.y + bounds.height;
@ -1940,14 +1940,14 @@ public class JTree extends JComponent implements Scrollable, Accessible
if(!isExpanded(parent))
return null;
Enumeration toggledPaths = expandedState.keys();
Vector elements = null;
Enumeration<TreePath> toggledPaths = expandedState.keys();
Vector<TreePath> elements = null;
TreePath path;
Object value;
if(toggledPaths != null) {
while(toggledPaths.hasMoreElements()) {
path = (TreePath)toggledPaths.nextElement();
path = toggledPaths.nextElement();
value = expandedState.get(path);
// Add the path if it is expanded, a descendant of parent,
// and it is visible (all parents expanded). This is rather
@ -1956,7 +1956,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
((Boolean)value).booleanValue() &&
parent.isDescendant(path) && isVisible(path)) {
if (elements == null) {
elements = new Vector();
elements = new Vector<TreePath>();
}
elements.addElement(path);
}
@ -1990,9 +1990,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
return false;
// Is this node expanded?
Object value = expandedState.get(path);
Boolean value = expandedState.get(path);
if(value == null || !((Boolean)value).booleanValue())
if(value == null || !value.booleanValue())
return false;
// It is, make sure its parent is also expanded.
@ -2018,7 +2018,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
TreePath path = tree.getPathForRow(this, row);
if(path != null) {
Boolean value = (Boolean)expandedState.get(path);
Boolean value = expandedState.get(path);
return (value != null && value.booleanValue());
}
@ -2704,8 +2704,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* @since 1.4
*/
public TreeExpansionListener[] getTreeExpansionListeners() {
return (TreeExpansionListener[])listenerList.getListeners(
TreeExpansionListener.class);
return listenerList.getListeners(TreeExpansionListener.class);
}
/**
@ -2737,8 +2736,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* @since 1.4
*/
public TreeWillExpandListener[] getTreeWillExpandListeners() {
return (TreeWillExpandListener[])listenerList.getListeners(
TreeWillExpandListener.class);
return listenerList.getListeners(TreeWillExpandListener.class);
}
/**
@ -2895,8 +2893,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* @since 1.4
*/
public TreeSelectionListener[] getTreeSelectionListeners() {
return (TreeSelectionListener[])listenerList.getListeners(
TreeSelectionListener.class);
return listenerList.getListeners(TreeSelectionListener.class);
}
/**
@ -3030,7 +3027,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
// Serialization support.
private void writeObject(ObjectOutputStream s) throws IOException {
Vector values = new Vector();
Vector<Object> values = new Vector<Object>();
s.defaultWriteObject();
// Save the cellRenderer, if its Serializable.
@ -3077,9 +3074,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
// Create an instance of expanded state.
expandedState = new Hashtable();
expandedState = new Hashtable<TreePath, Boolean>();
expandedStack = new Stack();
expandedStack = new Stack<Stack<TreePath>>();
Vector values = (Vector)s.readObject();
int indexCounter = 0;
@ -3132,13 +3129,13 @@ public class JTree extends JComponent implements Scrollable, Accessible
TreeModel model = getModel();
if(model != null) {
Enumeration paths = expandedState.keys();
Enumeration<TreePath> paths = expandedState.keys();
if(paths != null) {
Vector state = new Vector();
Vector<Object> state = new Vector<Object>();
while(paths.hasMoreElements()) {
TreePath path = (TreePath)paths.nextElement();
TreePath path = paths.nextElement();
Object archivePath;
try {
@ -3502,7 +3499,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
*/
public boolean getScrollableTracksViewportWidth() {
if (getParent() instanceof JViewport) {
return (((JViewport)getParent()).getWidth() > getPreferredSize().width);
return getParent().getWidth() > getPreferredSize().width;
}
return false;
}
@ -3518,7 +3515,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
*/
public boolean getScrollableTracksViewportHeight() {
if (getParent() instanceof JViewport) {
return (((JViewport)getParent()).getHeight() > getPreferredSize().height);
return getParent().getHeight() > getPreferredSize().height;
}
return false;
}
@ -3535,14 +3532,14 @@ public class JTree extends JComponent implements Scrollable, Accessible
protected void setExpandedState(TreePath path, boolean state) {
if(path != null) {
// Make sure all parents of path are expanded.
Stack stack;
TreePath parentPath = path.getParentPath();
Stack<TreePath> stack;
TreePath parentPath = path.getParentPath();
if (expandedStack.size() == 0) {
stack = new Stack();
stack = new Stack<TreePath>();
}
else {
stack = (Stack)expandedStack.pop();
stack = expandedStack.pop();
}
try {
@ -3556,7 +3553,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
}
}
for(int counter = stack.size() - 1; counter >= 0; counter--) {
parentPath = (TreePath)stack.pop();
parentPath = stack.pop();
if(!isExpanded(parentPath)) {
try {
fireTreeWillExpand(parentPath);
@ -3636,12 +3633,11 @@ public class JTree extends JComponent implements Scrollable, Accessible
if(parent == null)
return null;
Vector descendants = new Vector();
Enumeration nodes = expandedState.keys();
TreePath path;
Vector<TreePath> descendants = new Vector<TreePath>();
Enumeration<TreePath> nodes = expandedState.keys();
while(nodes.hasMoreElements()) {
path = (TreePath)nodes.nextElement();
TreePath path = nodes.nextElement();
if(parent.isDescendant(path))
descendants.addElement(path);
}
@ -3664,8 +3660,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
{
if(toRemove != null) {
while(toRemove.hasMoreElements()) {
Enumeration descendants = getDescendantToggledPaths
((TreePath)toRemove.nextElement());
Enumeration descendants = getDescendantToggledPaths
(toRemove.nextElement());
if(descendants != null) {
while(descendants.hasMoreElements()) {
@ -4250,7 +4246,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
private AccessibleContext getCurrentAccessibleContext() {
Component c = getCurrentComponent();
if (c instanceof Accessible) {
return (((Accessible) c).getAccessibleContext());
return c.getAccessibleContext();
} else {
return null;
}
@ -4573,7 +4569,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
private AccessibleContext getCurrentAccessibleContext() {
Component c = getCurrentComponent();
if (c instanceof Accessible) {
return (((Accessible) c).getAccessibleContext());
return c.getAccessibleContext();
} else {
return null;
}
@ -5117,12 +5113,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
public boolean isVisible() {
Rectangle pathBounds = tree.getPathBounds(path);
Rectangle parentBounds = tree.getVisibleRect();
if (pathBounds != null && parentBounds != null &&
parentBounds.intersects(pathBounds)) {
return true;
} else {
return false;
}
return pathBounds != null && parentBounds != null &&
parentBounds.intersects(pathBounds);
}
public void setVisible(boolean b) {

View File

@ -389,7 +389,7 @@ public class JViewport extends JComponent implements Accessible
// could be bigger than invalid size.
validateView();
}
int dx = 0, dy = 0;
int dx, dy;
dx = positionAdjustment(getWidth(), contentRect.width, contentRect.x);
dy = positionAdjustment(getHeight(), contentRect.height, contentRect.y);
@ -682,10 +682,7 @@ public class JViewport extends JComponent implements Accessible
* @see JComponent#isPaintingOrigin()
*/
boolean isPaintingOrigin() {
if (scrollMode == BACKINGSTORE_SCROLL_MODE) {
return true;
}
return false;
return scrollMode == BACKINGSTORE_SCROLL_MODE;
}
@ -903,11 +900,7 @@ public class JViewport extends JComponent implements Accessible
*/
public void setScrollMode(int mode) {
scrollMode = mode;
if (mode == BACKINGSTORE_SCROLL_MODE) {
backingStore = true;
} else {
backingStore = false;
}
backingStore = mode == BACKINGSTORE_SCROLL_MODE;
}
/**
@ -958,10 +951,10 @@ public class JViewport extends JComponent implements Accessible
}
}
private final boolean isBlitting() {
private boolean isBlitting() {
Component view = getView();
return (scrollMode == BLIT_SCROLL_MODE) &&
(view instanceof JComponent) && ((JComponent)view).isOpaque();
(view instanceof JComponent) && view.isOpaque();
}
@ -1380,8 +1373,7 @@ public class JViewport extends JComponent implements Accessible
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
/**

View File

@ -185,7 +185,7 @@ public class JWindow extends Window implements Accessible,
super(owner == null? SwingUtilities.getSharedOwnerFrame() : owner);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
windowInit();
@ -212,7 +212,7 @@ public class JWindow extends Window implements Accessible,
owner);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
windowInit();
@ -250,7 +250,7 @@ public class JWindow extends Window implements Accessible,
owner, gc);
if (owner == null) {
WindowListener ownerShutdownListener =
(WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
SwingUtilities.getSharedOwnerFrameShutdownListener();
addWindowListener(ownerShutdownListener);
}
windowInit();

View File

@ -68,13 +68,13 @@ class KeyboardManager {
/**
* maps top-level containers to a sub-hashtable full of keystrokes
*/
Hashtable containerMap = new Hashtable();
Hashtable<Container, Hashtable> containerMap = new Hashtable<Container, Hashtable>();
/**
* Maps component/keystroke pairs to a topLevel container
* This is mainly used for fast unregister operations
*/
Hashtable componentKeyStrokeMap = new Hashtable();
Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<ComponentKeyStrokePair, Container>();
public static KeyboardManager getCurrentManager() {
return currentManager;
@ -95,7 +95,7 @@ class KeyboardManager {
if (topContainer == null) {
return;
}
Hashtable keyMap = (Hashtable)containerMap.get(topContainer);
Hashtable keyMap = containerMap.get(topContainer);
if (keyMap == null) { // lazy evaluate one
keyMap = registerNewTopContainer(topContainer);
@ -114,8 +114,8 @@ class KeyboardManager {
// Then add the old compoennt and the new compoent to the vector
// then insert the vector in the table
if (tmp != c) { // this means this is already registered for this component, no need to dup
Vector v = new Vector();
v.addElement(tmp);
Vector<JComponent> v = new Vector<JComponent>();
v.addElement((JComponent) tmp);
v.addElement(c);
keyMap.put(k, v);
}
@ -154,13 +154,13 @@ class KeyboardManager {
ComponentKeyStrokePair ckp = new ComponentKeyStrokePair(c,ks);
Object topContainer = componentKeyStrokeMap.get(ckp);
Container topContainer = componentKeyStrokeMap.get(ckp);
if (topContainer == null) { // never heard of this pairing, so bail
return;
}
Hashtable keyMap = (Hashtable)containerMap.get(topContainer);
Hashtable keyMap = containerMap.get(topContainer);
if (keyMap == null) { // this should never happen, but I'm being safe
Thread.dumpStack();
return;
@ -221,7 +221,7 @@ class KeyboardManager {
ks=KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers(), !pressed);
}
Hashtable keyMap = (Hashtable)containerMap.get(topAncestor);
Hashtable keyMap = containerMap.get(topAncestor);
if (keyMap != null) { // this container isn't registered, so bail
Object tmp = keyMap.get(ks);
@ -293,7 +293,7 @@ class KeyboardManager {
if (top == null) {
return;
}
Hashtable keyMap = (Hashtable)containerMap.get(top);
Hashtable keyMap = containerMap.get(top);
if (keyMap == null) { // lazy evaluate one
keyMap = registerNewTopContainer(top);
@ -314,11 +314,11 @@ class KeyboardManager {
public void unregisterMenuBar(JMenuBar mb) {
Object topContainer = getTopAncestor(mb);
Container topContainer = getTopAncestor(mb);
if (topContainer == null) {
return;
}
Hashtable keyMap = (Hashtable)containerMap.get(topContainer);
Hashtable keyMap = containerMap.get(topContainer);
if (keyMap!=null) {
Vector v = (Vector)keyMap.get(JMenuBar.class);
if (v != null) {

View File

@ -39,7 +39,7 @@ import java.awt.Window;
*
* @author David Mendenhall
*/
final class LayoutComparator implements Comparator, java.io.Serializable {
final class LayoutComparator implements Comparator<Component>, java.io.Serializable {
private static final int ROW_TOLERANCE = 10;
@ -51,10 +51,7 @@ final class LayoutComparator implements Comparator, java.io.Serializable {
leftToRight = orientation.isLeftToRight();
}
public int compare(Object o1, Object o2) {
Component a = (Component)o1;
Component b = (Component)o2;
public int compare(Component a, Component b) {
if (a == b) {
return 0;
}
@ -65,9 +62,9 @@ final class LayoutComparator implements Comparator, java.io.Serializable {
// each Component and then search from the Window down until the
// hierarchy branches.
if (a.getParent() != b.getParent()) {
LinkedList aAncestory, bAncestory;
LinkedList<Component> aAncestory = new LinkedList<Component>();
for(aAncestory = new LinkedList(); a != null; a = a.getParent()) {
for(; a != null; a = a.getParent()) {
aAncestory.add(a);
if (a instanceof Window) {
break;
@ -78,7 +75,9 @@ final class LayoutComparator implements Comparator, java.io.Serializable {
throw new ClassCastException();
}
for(bAncestory = new LinkedList(); b != null; b = b.getParent()) {
LinkedList<Component> bAncestory = new LinkedList<Component>();
for(; b != null; b = b.getParent()) {
bAncestory.add(b);
if (b instanceof Window) {
break;
@ -89,18 +88,18 @@ final class LayoutComparator implements Comparator, java.io.Serializable {
throw new ClassCastException();
}
for (ListIterator
for (ListIterator<Component>
aIter = aAncestory.listIterator(aAncestory.size()),
bIter = bAncestory.listIterator(bAncestory.size()); ;) {
if (aIter.hasPrevious()) {
a = (Component)aIter.previous();
a = aIter.previous();
} else {
// a is an ancestor of b
return -1;
}
if (bIter.hasPrevious()) {
b = (Component)bIter.previous();
b = bIter.previous();
} else {
// b is an ancestor of a
return 1;

View File

@ -65,7 +65,7 @@ public class LayoutFocusTraversalPolicy extends SortingFocusTraversalPolicy
* Constructs a LayoutFocusTraversalPolicy with the passed in
* <code>Comparator</code>.
*/
LayoutFocusTraversalPolicy(Comparator c) {
LayoutFocusTraversalPolicy(Comparator<? super Component> c) {
super(c);
}

View File

@ -48,8 +48,8 @@ final class LegacyGlueFocusTraversalPolicy extends FocusTraversalPolicy
private transient FocusTraversalPolicy delegatePolicy;
private transient DefaultFocusManager delegateManager;
private HashMap forwardMap = new HashMap(),
backwardMap = new HashMap();
private HashMap<Component, Component> forwardMap = new HashMap<Component, Component>(),
backwardMap = new HashMap<Component, Component>();
LegacyGlueFocusTraversalPolicy(FocusTraversalPolicy delegatePolicy) {
this.delegatePolicy = delegatePolicy;
@ -70,11 +70,11 @@ final class LegacyGlueFocusTraversalPolicy extends FocusTraversalPolicy
public Component getComponentAfter(Container focusCycleRoot,
Component aComponent) {
Component hardCoded = aComponent, prevHardCoded;
HashSet sanity = new HashSet();
HashSet<Component> sanity = new HashSet<Component>();
do {
prevHardCoded = hardCoded;
hardCoded = (Component)forwardMap.get(hardCoded);
hardCoded = forwardMap.get(hardCoded);
if (hardCoded == null) {
if (delegatePolicy != null &&
prevHardCoded.isFocusCycleRoot(focusCycleRoot)) {
@ -99,11 +99,11 @@ final class LegacyGlueFocusTraversalPolicy extends FocusTraversalPolicy
public Component getComponentBefore(Container focusCycleRoot,
Component aComponent) {
Component hardCoded = aComponent, prevHardCoded;
HashSet sanity = new HashSet();
HashSet<Component> sanity = new HashSet<Component>();
do {
prevHardCoded = hardCoded;
hardCoded = (Component)backwardMap.get(hardCoded);
hardCoded = backwardMap.get(hardCoded);
if (hardCoded == null) {
if (delegatePolicy != null &&
prevHardCoded.isFocusCycleRoot(focusCycleRoot)) {

View File

@ -37,7 +37,7 @@ import sun.awt.AppContext;
* @author Arnaud Weber
*/
public class MenuSelectionManager {
private Vector selection = new Vector();
private Vector<MenuElement> selection = new Vector<MenuElement>();
/* diagnostic aids -- should be false for production builds. */
private static final boolean TRACE = false; // trace creates and disposes
@ -100,14 +100,14 @@ public class MenuSelectionManager {
}
for(i=0,c=path.length;i<c;i++) {
if(i < currentSelectionCount && (MenuElement)selection.elementAt(i) == path[i])
if (i < currentSelectionCount && selection.elementAt(i) == path[i])
firstDifference++;
else
break;
}
for(i=currentSelectionCount - 1 ; i >= firstDifference ; i--) {
MenuElement me = (MenuElement)selection.elementAt(i);
MenuElement me = selection.elementAt(i);
selection.removeElementAt(i);
me.menuSelectionChanged(false);
}
@ -131,7 +131,7 @@ public class MenuSelectionManager {
MenuElement res[] = new MenuElement[selection.size()];
int i,c;
for(i=0,c=selection.size();i<c;i++)
res[i] = (MenuElement) selection.elementAt(i);
res[i] = selection.elementAt(i);
return res;
}
@ -172,8 +172,7 @@ public class MenuSelectionManager {
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
return (ChangeListener[])listenerList.getListeners(
ChangeListener.class);
return listenerList.getListeners(ChangeListener.class);
}
/**
@ -258,8 +257,8 @@ public class MenuSelectionManager {
if(!mc.isShowing())
continue;
if(mc instanceof JComponent) {
cWidth = ((JComponent)mc).getWidth();
cHeight = ((JComponent)mc).getHeight();
cWidth = mc.getWidth();
cHeight = mc.getHeight();
} else {
r2 = mc.getBounds();
cWidth = r2.width;
@ -338,7 +337,7 @@ public class MenuSelectionManager {
for(i=0,j=path.length; i<j ;i++){
for (int k=0; k<=i; k++)
System.out.print(" ");
MenuElement me = (MenuElement) path[i];
MenuElement me = path[i];
if(me instanceof JMenuItem) {
System.out.println(((JMenuItem)me).getText() + ", ");
} else if (me instanceof JMenuBar) {
@ -399,8 +398,8 @@ public class MenuSelectionManager {
if(!mc.isShowing())
continue;
if(mc instanceof JComponent) {
cWidth = ((JComponent)mc).getWidth();
cHeight = ((JComponent)mc).getHeight();
cWidth = mc.getWidth();
cHeight = mc.getHeight();
} else {
r2 = mc.getBounds();
cWidth = r2.width;
@ -429,7 +428,7 @@ public class MenuSelectionManager {
*/
public void processKeyEvent(KeyEvent e) {
MenuElement[] sel2 = new MenuElement[0];
sel2 = (MenuElement[])selection.toArray(sel2);
sel2 = selection.toArray(sel2);
int selSize = sel2.length;
MenuElement[] path;
@ -474,7 +473,7 @@ public class MenuSelectionManager {
*/
public boolean isComponentPartOfCurrentMenu(Component c) {
if(selection.size() > 0) {
MenuElement me = (MenuElement)selection.elementAt(0);
MenuElement me = selection.elementAt(0);
return isComponentPartOfCurrentMenu(me,c);
} else
return false;

View File

@ -56,8 +56,7 @@ class MultiUIDefaults extends UIDefaults
return value;
}
for(int i = 0; i < tables.length; i++) {
UIDefaults table = tables[i];
for (UIDefaults table : tables) {
value = (table != null) ? table.get(key) : null;
if (value != null) {
return value;
@ -75,8 +74,7 @@ class MultiUIDefaults extends UIDefaults
return value;
}
for(int i = 0; i < tables.length; i++) {
UIDefaults table = tables[i];
for (UIDefaults table : tables) {
value = (table != null) ? table.get(key,l) : null;
if (value != null) {
return value;
@ -89,8 +87,7 @@ class MultiUIDefaults extends UIDefaults
public int size() {
int n = super.size();
for(int i = 0; i < tables.length; i++) {
UIDefaults table = tables[i];
for (UIDefaults table : tables) {
n += (table != null) ? table.size() : 0;
}
return n;
@ -102,7 +99,7 @@ class MultiUIDefaults extends UIDefaults
}
public Enumeration keys()
public Enumeration<Object> keys()
{
Enumeration[] enums = new Enumeration[1 + tables.length];
enums[0] = super.keys();
@ -116,7 +113,7 @@ class MultiUIDefaults extends UIDefaults
}
public Enumeration elements()
public Enumeration<Object> elements()
{
Enumeration[] enums = new Enumeration[1 + tables.length];
enums[0] = super.elements();
@ -137,7 +134,7 @@ class MultiUIDefaults extends UIDefaults
}
}
private static class MultiUIDefaultsEnumerator implements Enumeration
private static class MultiUIDefaultsEnumerator implements Enumeration<Object>
{
Enumeration[] enums;
int n = 0;
@ -175,8 +172,7 @@ class MultiUIDefaults extends UIDefaults
return value;
}
for(int i = 0; i < tables.length; i++) {
UIDefaults table = tables[i];
for (UIDefaults table : tables) {
value = (table != null) ? table.remove(key) : null;
if (value != null) {
return value;
@ -189,8 +185,7 @@ class MultiUIDefaults extends UIDefaults
public void clear() {
super.clear();
for(int i = 0; i < tables.length; i++) {
UIDefaults table = tables[i];
for (UIDefaults table : tables) {
if (table != null) {
table.clear();
}

View File

@ -313,9 +313,9 @@ public class PopupFactory {
if(contents instanceof JPopupMenu) {
JPopupMenu jpm = (JPopupMenu) contents;
Component popComps[] = jpm.getComponents();
for(int i=0;i<popComps.length;i++) {
if(!(popComps[i] instanceof MenuElement) &&
!(popComps[i] instanceof JSeparator)) {
for (Component popComp : popComps) {
if (!(popComp instanceof MenuElement) &&
!(popComp instanceof JSeparator)) {
focusPopup = true;
break;
}
@ -357,17 +357,16 @@ public class PopupFactory {
*/
private static HeavyWeightPopup getRecycledHeavyWeightPopup(Window w) {
synchronized (HeavyWeightPopup.class) {
List cache;
Map heavyPopupCache = getHeavyWeightPopupCache();
List<HeavyWeightPopup> cache;
Map<Window, List<HeavyWeightPopup>> heavyPopupCache = getHeavyWeightPopupCache();
if (heavyPopupCache.containsKey(w)) {
cache = (List)heavyPopupCache.get(w);
cache = heavyPopupCache.get(w);
} else {
return null;
}
int c;
if ((c = cache.size()) > 0) {
HeavyWeightPopup r = (HeavyWeightPopup)cache.get(0);
if (cache.size() > 0) {
HeavyWeightPopup r = cache.get(0);
cache.remove(0);
return r;
}
@ -380,13 +379,13 @@ public class PopupFactory {
* <code>Window</code> to a <code>List</code> of
* <code>HeavyWeightPopup</code>s.
*/
private static Map getHeavyWeightPopupCache() {
private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {
synchronized (HeavyWeightPopup.class) {
Map cache = (Map)SwingUtilities.appContextGet(
Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(
heavyWeightPopupCacheKey);
if (cache == null) {
cache = new HashMap(2);
cache = new HashMap<Window, List<HeavyWeightPopup>>(2);
SwingUtilities.appContextPut(heavyWeightPopupCacheKey,
cache);
}
@ -399,13 +398,13 @@ public class PopupFactory {
*/
private static void recycleHeavyWeightPopup(HeavyWeightPopup popup) {
synchronized (HeavyWeightPopup.class) {
List cache;
Object window = SwingUtilities.getWindowAncestor(
List<HeavyWeightPopup> cache;
Window window = SwingUtilities.getWindowAncestor(
popup.getComponent());
Map heavyPopupCache = getHeavyWeightPopupCache();
Map<Window, List<HeavyWeightPopup>> heavyPopupCache = getHeavyWeightPopupCache();
if (window instanceof Popup.DefaultFrame ||
!((Window)window).isVisible()) {
!window.isVisible()) {
// If the Window isn't visible, we don't cache it as we
// likely won't ever get a windowClosed event to clean up.
// We also don't cache DefaultFrames as this indicates
@ -414,28 +413,27 @@ public class PopupFactory {
popup._dispose();
return;
} else if (heavyPopupCache.containsKey(window)) {
cache = (List)heavyPopupCache.get(window);
cache = heavyPopupCache.get(window);
} else {
cache = new ArrayList();
cache = new ArrayList<HeavyWeightPopup>();
heavyPopupCache.put(window, cache);
// Clean up if the Window is closed
final Window w = (Window)window;
final Window w = window;
w.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
List popups;
List<HeavyWeightPopup> popups;
synchronized(HeavyWeightPopup.class) {
Map heavyPopupCache2 =
Map<Window, List<HeavyWeightPopup>> heavyPopupCache2 =
getHeavyWeightPopupCache();
popups = (List)heavyPopupCache2.remove(w);
popups = heavyPopupCache2.remove(w);
}
if (popups != null) {
for (int counter = popups.size() - 1;
counter >= 0; counter--) {
((HeavyWeightPopup)popups.get(counter)).
_dispose();
popups.get(counter)._dispose();
}
}
}
@ -534,10 +532,9 @@ public class PopupFactory {
Window[] ownedWindows = w.getOwnedWindows();
if(ownedWindows != null) {
Rectangle bnd = component.getBounds();
for(int i=0; i<ownedWindows.length;i++) {
Window owned = ownedWindows[i];
if (owned.isVisible() &&
bnd.intersects(owned.getBounds())) {
for (Window window : ownedWindows) {
if (window.isVisible() &&
bnd.intersects(window.getBounds())) {
return true;
}
@ -667,11 +664,11 @@ public class PopupFactory {
/**
* Returns the cache to use for heavy weight popups.
*/
private static List getLightWeightPopupCache() {
List cache = (List)SwingUtilities.appContextGet(
private static List<LightWeightPopup> getLightWeightPopupCache() {
List<LightWeightPopup> cache = (List<LightWeightPopup>)SwingUtilities.appContextGet(
lightWeightPopupCacheKey);
if (cache == null) {
cache = new ArrayList();
cache = new ArrayList<LightWeightPopup>();
SwingUtilities.appContextPut(lightWeightPopupCacheKey, cache);
}
return cache;
@ -682,7 +679,7 @@ public class PopupFactory {
*/
private static void recycleLightWeightPopup(LightWeightPopup popup) {
synchronized (LightWeightPopup.class) {
List lightPopupCache = getLightWeightPopupCache();
List<LightWeightPopup> lightPopupCache = getLightWeightPopupCache();
if (lightPopupCache.size() < MAX_CACHE_SIZE) {
lightPopupCache.add(popup);
}
@ -695,11 +692,9 @@ public class PopupFactory {
*/
private static LightWeightPopup getRecycledLightWeightPopup() {
synchronized (LightWeightPopup.class) {
List lightPopupCache = getLightWeightPopupCache();
int c;
if((c = lightPopupCache.size()) > 0) {
LightWeightPopup r = (LightWeightPopup)lightPopupCache.
get(0);
List<LightWeightPopup> lightPopupCache = getLightWeightPopupCache();
if (lightPopupCache.size() > 0) {
LightWeightPopup r = lightPopupCache.get(0);
lightPopupCache.remove(0);
return r;
}
@ -755,8 +750,7 @@ public class PopupFactory {
component.setLocation(p.x, p.y);
if (parent instanceof JLayeredPane) {
((JLayeredPane)parent).add(component,
JLayeredPane.POPUP_LAYER, 0);
parent.add(component, JLayeredPane.POPUP_LAYER, 0);
} else {
parent.add(component);
}
@ -826,12 +820,12 @@ public class PopupFactory {
/**
* Returns the cache to use for medium weight popups.
*/
private static List getMediumWeightPopupCache() {
List cache = (List)SwingUtilities.appContextGet(
private static List<MediumWeightPopup> getMediumWeightPopupCache() {
List<MediumWeightPopup> cache = (List<MediumWeightPopup>)SwingUtilities.appContextGet(
mediumWeightPopupCacheKey);
if (cache == null) {
cache = new ArrayList();
cache = new ArrayList<MediumWeightPopup>();
SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);
}
return cache;
@ -842,7 +836,7 @@ public class PopupFactory {
*/
private static void recycleMediumWeightPopup(MediumWeightPopup popup) {
synchronized (MediumWeightPopup.class) {
List mediumPopupCache = getMediumWeightPopupCache();
List<MediumWeightPopup> mediumPopupCache = getMediumWeightPopupCache();
if (mediumPopupCache.size() < MAX_CACHE_SIZE) {
mediumPopupCache.add(popup);
}
@ -855,12 +849,9 @@ public class PopupFactory {
*/
private static MediumWeightPopup getRecycledMediumWeightPopup() {
synchronized (MediumWeightPopup.class) {
java.util.List mediumPopupCache =
getMediumWeightPopupCache();
int c;
if ((c=mediumPopupCache.size()) > 0) {
MediumWeightPopup r = (MediumWeightPopup)mediumPopupCache.
get(0);
List<MediumWeightPopup> mediumPopupCache = getMediumWeightPopupCache();
if (mediumPopupCache.size() > 0) {
MediumWeightPopup r = mediumPopupCache.get(0);
mediumPopupCache.remove(0);
return r;
}
@ -904,7 +895,7 @@ public class PopupFactory {
x, y);
component.setVisible(false);
component.setLocation(p.x, p.y);
((JLayeredPane)parent).add(component, JLayeredPane.POPUP_LAYER,
parent.add(component, JLayeredPane.POPUP_LAYER,
0);
} else {
Point p = SwingUtilities.convertScreenLocationToParent(parent,

View File

@ -40,6 +40,8 @@ import sun.awt.SunToolkit;
import sun.java2d.SunGraphicsEnvironment;
import sun.security.action.GetPropertyAction;
import com.sun.java.swing.SwingUtilities3;
/**
* This class manages repaint requests, allowing the number
@ -303,6 +305,11 @@ public class RepaintManager
*/
public synchronized void addInvalidComponent(JComponent invalidComponent)
{
RepaintManager delegate = getDelegate(invalidComponent);
if (delegate != null) {
delegate.addInvalidComponent(invalidComponent);
return;
}
Component validateRoot = null;
/* Find the first JComponent ancestor of this component whose
@ -373,6 +380,11 @@ public class RepaintManager
* @see #addInvalidComponent
*/
public synchronized void removeInvalidComponent(JComponent component) {
RepaintManager delegate = getDelegate(component);
if (delegate != null) {
delegate.removeInvalidComponent(component);
return;
}
if(invalidComponents != null) {
int index = invalidComponents.indexOf(component);
if(index != -1) {
@ -464,6 +476,11 @@ public class RepaintManager
*/
public void addDirtyRegion(JComponent c, int x, int y, int w, int h)
{
RepaintManager delegate = getDelegate(c);
if (delegate != null) {
delegate.addDirtyRegion(c, x, y, w, h);
return;
}
addDirtyRegion0(c, x, y, w, h);
}
@ -572,7 +589,7 @@ public class RepaintManager
*/
private synchronized boolean extendDirtyRegion(
Component c, int x, int y, int w, int h) {
Rectangle r = (Rectangle)dirtyComponents.get(c);
Rectangle r = dirtyComponents.get(c);
if (r != null) {
// A non-null r implies c is already marked as dirty,
// and that the parent is valid. Therefore we can
@ -588,9 +605,13 @@ public class RepaintManager
* dirty.
*/
public Rectangle getDirtyRegion(JComponent aComponent) {
Rectangle r = null;
RepaintManager delegate = getDelegate(aComponent);
if (delegate != null) {
return delegate.getDirtyRegion(aComponent);
}
Rectangle r;
synchronized(this) {
r = (Rectangle)dirtyComponents.get(aComponent);
r = dirtyComponents.get(aComponent);
}
if(r == null)
return new Rectangle(0,0,0,0);
@ -603,6 +624,11 @@ public class RepaintManager
* completely painted during the next paintDirtyRegions() call.
*/
public void markCompletelyDirty(JComponent aComponent) {
RepaintManager delegate = getDelegate(aComponent);
if (delegate != null) {
delegate.markCompletelyDirty(aComponent);
return;
}
addDirtyRegion(aComponent,0,0,Integer.MAX_VALUE,Integer.MAX_VALUE);
}
@ -611,6 +637,11 @@ public class RepaintManager
* get painted during the next paintDirtyRegions() call.
*/
public void markCompletelyClean(JComponent aComponent) {
RepaintManager delegate = getDelegate(aComponent);
if (delegate != null) {
delegate.markCompletelyClean(aComponent);
return;
}
synchronized(this) {
dirtyComponents.remove(aComponent);
}
@ -623,6 +654,10 @@ public class RepaintManager
* if it return true.
*/
public boolean isCompletelyDirty(JComponent aComponent) {
RepaintManager delegate = getDelegate(aComponent);
if (delegate != null) {
return delegate.isCompletelyDirty(aComponent);
}
Rectangle r;
r = getDirtyRegion(aComponent);
@ -710,8 +745,8 @@ public class RepaintManager
Rectangle rect;
int localBoundsX = 0;
int localBoundsY = 0;
int localBoundsH = 0;
int localBoundsW = 0;
int localBoundsH;
int localBoundsW;
Enumeration keys;
roots = new ArrayList<Component>(count);
@ -818,7 +853,7 @@ public class RepaintManager
dx = rootDx = 0;
dy = rootDy = 0;
tmp.setBounds((Rectangle) dirtyComponents.get(dirtyComponent));
tmp.setBounds(dirtyComponents.get(dirtyComponent));
// System.out.println("Collect dirty component for bound " + tmp +
// "component bounds is " + cBounds);;
@ -865,7 +900,7 @@ public class RepaintManager
Rectangle r;
tmp.setLocation(tmp.x + rootDx - dx,
tmp.y + rootDy - dy);
r = (Rectangle)dirtyComponents.get(rootDirtyComponent);
r = dirtyComponents.get(rootDirtyComponent);
SwingUtilities.computeUnion(tmp.x,tmp.y,tmp.width,tmp.height,r);
}
@ -900,6 +935,10 @@ public class RepaintManager
* repaint manager.
*/
public Image getOffscreenBuffer(Component c,int proposedWidth,int proposedHeight) {
RepaintManager delegate = getDelegate(c);
if (delegate != null) {
return delegate.getOffscreenBuffer(c, proposedWidth, proposedHeight);
}
return _getOffscreenBuffer(c, proposedWidth, proposedHeight);
}
@ -917,6 +956,11 @@ public class RepaintManager
*/
public Image getVolatileOffscreenBuffer(Component c,
int proposedWidth,int proposedHeight) {
RepaintManager delegate = getDelegate(c);
if (delegate != null) {
return delegate.getVolatileOffscreenBuffer(c, proposedWidth,
proposedHeight);
}
GraphicsConfiguration config = c.getGraphicsConfiguration();
if (config == null) {
config = GraphicsEnvironment.getLocalGraphicsEnvironment().
@ -941,7 +985,7 @@ public class RepaintManager
private Image _getOffscreenBuffer(Component c, int proposedWidth, int proposedHeight) {
Dimension maxSize = getDoubleBufferMaximumSize();
DoubleBufferInfo doubleBuffer = null;
DoubleBufferInfo doubleBuffer;
int width, height;
if (standardDoubleBuffer == null) {
@ -1010,7 +1054,7 @@ public class RepaintManager
Iterator gcs = volatileMap.keySet().iterator();
while (gcs.hasNext()) {
GraphicsConfiguration gc = (GraphicsConfiguration)gcs.next();
VolatileImage image = (VolatileImage)volatileMap.get(gc);
VolatileImage image = volatileMap.get(gc);
if (image.getWidth() > width || image.getHeight() > height) {
image.flush();
gcs.remove();
@ -1178,7 +1222,7 @@ public class RepaintManager
*/
void beginPaint() {
boolean multiThreadedPaint = false;
int paintDepth = 0;
int paintDepth;
Thread currentThread = Thread.currentThread();
synchronized(this) {
paintDepth = this.paintDepth;
@ -1550,4 +1594,11 @@ public class RepaintManager
prePaintDirtyRegions();
}
}
private RepaintManager getDelegate(Component c) {
RepaintManager delegate = SwingUtilities3.getDelegateRepaintManager(c);
if (this == delegate) {
delegate = null;
}
return delegate;
}
}

View File

@ -79,7 +79,7 @@ public class SortingFocusTraversalPolicy
* sorted list should be reused if possible.
*/
transient private Container cachedRoot;
transient private List cachedCycle;
transient private List<Component> cachedCycle;
// Delegate our fitness test to ContainerOrder so that we only have to
// code the algorithm once.
@ -111,7 +111,7 @@ public class SortingFocusTraversalPolicy
return cycle;
}
private int getComponentIndex(List<Component> cycle, Component aComponent) {
int index = 0;
int index;
try {
index = Collections.binarySearch(cycle, aComponent, comparator);
} catch (ClassCastException e) {
@ -130,14 +130,14 @@ public class SortingFocusTraversalPolicy
return index;
}
private void enumerateAndSortCycle(Container focusCycleRoot, List cycle) {
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
if (focusCycleRoot.isShowing()) {
enumerateCycle(focusCycleRoot, cycle);
Collections.sort(cycle, comparator);
}
}
private void enumerateCycle(Container container, List cycle) {
private void enumerateCycle(Container container, List<Component> cycle) {
if (!(container.isVisible() && container.isDisplayable())) {
return;
}
@ -145,8 +145,7 @@ public class SortingFocusTraversalPolicy
cycle.add(container);
Component[] components = container.getComponents();
for (int i = 0; i < components.length; i++) {
Component comp = components[i];
for (Component comp : components) {
if (comp instanceof Container) {
Container cont = (Container)comp;
@ -385,8 +384,8 @@ public class SortingFocusTraversalPolicy
return getLastComponent(aContainer);
}
Component comp = null;
Component tryComp = null;
Component comp;
Component tryComp;
for (index--; index>=0; index--) {
comp = cycle.get(index);
@ -442,8 +441,7 @@ public class SortingFocusTraversalPolicy
}
if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle);
for (int i = 0; i < cycle.size(); i++) {
Component comp = cycle.get(i);
for (Component comp : cycle) {
if (accept(comp)) {
return comp;
} else if (comp instanceof Container && comp != aContainer) {

View File

@ -185,11 +185,11 @@ import java.util.*;
* @since 1.4
*/
public class SpringLayout implements LayoutManager2 {
private Map componentConstraints = new HashMap();
private Map<Component, Constraints> componentConstraints = new HashMap<Component, Constraints>();
private Spring cyclicReference = Spring.constant(Spring.UNSET);
private Set cyclicSprings;
private Set acyclicSprings;
private Set<Spring> cyclicSprings;
private Set<Spring> acyclicSprings;
/**
@ -415,8 +415,7 @@ public class SpringLayout implements LayoutManager2 {
}
if (!valid) {
String[] all = horizontal ? ALL_HORIZONTAL : ALL_VERTICAL;
for (int i = 0; i < all.length; i++) {
String s = all[i];
for (String s : all) {
if (!history.contains(s)) {
setConstraint(s, null);
}
@ -822,8 +821,7 @@ public class SpringLayout implements LayoutManager2 {
/*pp*/ void reset() {
Spring[] allSprings = {x, y, width, height, east, south,
horizontalCenter, verticalCenter, baseline};
for (int i = 0; i < allSprings.length; i++) {
Spring s = allSprings[i];
for (Spring s : allSprings) {
if (s != null) {
s.setValue(Spring.UNSET);
}
@ -881,8 +879,8 @@ public class SpringLayout implements LayoutManager2 {
public SpringLayout() {}
private void resetCyclicStatuses() {
cyclicSprings = new HashSet();
acyclicSprings = new HashSet();
cyclicSprings = new HashSet<Spring>();
acyclicSprings = new HashSet<Spring>();
}
private void setParent(Container p) {
@ -1145,7 +1143,7 @@ public class SpringLayout implements LayoutManager2 {
* @return the constraints for the specified component
*/
public Constraints getConstraints(Component c) {
Constraints result = (Constraints)componentConstraints.get(c);
Constraints result = componentConstraints.get(c);
if (result == null) {
if (c instanceof javax.swing.JComponent) {
Object cp = ((javax.swing.JComponent)c).getClientProperty(SpringLayout.class);

Some files were not shown because too many files have changed in this diff Show More