This commit is contained in:
Lana Steuck 2014-03-25 12:32:28 -07:00
commit 7cee5f2093
455 changed files with 11533 additions and 5142 deletions

View file

@ -307,12 +307,6 @@ ifeq ($(OPENJDK_TARGET_OS),aix)
$(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
endif
# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
$(call install-file)
# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
# JDK_FILTER at the make command line, only a subset of the JDK java files will
# be recompiled. If multiple paths are separated by comma, convert that into a
@ -341,6 +335,7 @@ $(eval $(call SetupJavaCompilation,BUILD_JDK,\
BIN:=$(JDK_OUTPUTDIR)/classes,\
COPY:=$(COPY_PATTERNS),\
COPY_FILES:=$(COPY_FILES),\
CLEAN_FILES:=$(CLEAN_FILES),\
HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
@ -378,7 +373,8 @@ ifndef OPENJDK
SETUP := GENERATE_JDKBYTECODE, \
JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit))
BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
$(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
@ -386,7 +382,8 @@ ifndef OPENJDK
SETUP := GENERATE_JDKBYTECODE, \
JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy))
BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
$(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
@ -396,7 +393,8 @@ ifndef OPENJDK
SETUP := GENERATE_JDKBYTECODE, \
JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit))
BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
$(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)

View file

@ -32,7 +32,7 @@ include NativeCompilation.gmk
# Setup the java compilers for the JDK build.
include Setup.gmk
# Prepare the find cache. Only used on windows.
# Prepare the find cache.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/bin))
# Build tools

View file

@ -35,7 +35,7 @@ include Setup.gmk
# Copy files (can now depend on $(COPY_FILES))
include CopyFiles.gmk
# Prepare the find cache. Only used if running on windows.
# Prepare the find cache.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
# Build tools

View file

@ -25,121 +25,53 @@
# Copy icu and _dict files used by the text break iterator
COPY_PATTERNS = .icu _dict
COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \
.png .gif .xml .dtd .txt oqlhelp.html
# Copy config files for com.sun.org.apache.xml.internal.security
# These directories should not be copied at all
EXCLUDES += \
com/sun/org/apache/xml/internal/security/resource/schema \
java/awt/doc-files \
java/lang/doc-files \
javax/swing/doc-files \
javax/swing/text/doc-files \
javax/swing/plaf/synth/doc-files \
javax/swing/undo/doc-files \
sun/awt/X11/doc-files \
sun/util/cldr/resources \
#
XMLSECURITY_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource
COPY_FILES += \
$(XMLSECURITY_RESOURCEDIR)/config.dtd \
$(XMLSECURITY_RESOURCEDIR)/config.xml
# These files should never be included
EXFILES += build.xml README.txt version.txt
# Copy sun/tools related files into the classes directory.
# Extra jstat files
JSTAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jstat/resources
COPY_FILES += \
$(JSTAT_RESOURCEDIR)/jstat_options \
$(JSTAT_RESOURCEDIR)/jstat_unsupported_options
# Extra jhat files
JHAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/hat/resources
COPY_FILES += \
$(JHAT_RESOURCEDIR)/hat.js \
$(JHAT_RESOURCEDIR)/oqlhelp.html \
$(JHAT_RESOURCEDIR)/platform_names.txt
# Extra jrunscript files
JRUNSCRIPT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell
COPY_FILES += \
$(JRUNSCRIPT_RESOURCEDIR)/init.js \
$(JRUNSCRIPT_RESOURCEDIR)/messages.properties
# Extra jvmstat files
COPY_FILES += \
$(JDK_TOPDIR)/src/share/classes/sun/jvmstat/perfdata/resources/aliasmap
# JConsole resources
JCONSOLE_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources
COPY_FILES += \
$(wildcard $(JCONSOLE_RESOURCES_DIR)/*.png) \
$(wildcard $(JCONSOLE_RESOURCES_DIR)/*.gif)
# Print resources
PRINT_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/print/resources
COPY_FILES += \
$(wildcard $(PRINT_RESOURCES_DIR)/*.png)
# IDN resources
COPY_FILES += \
$(JDK_TOPDIR)/src/share/classes/sun/net/idn/uidna.spp
#
# Swing plaf resources
#
SWING_PLAF_WINDOWS_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows
COPY_FILES += \
$(wildcard $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/*.gif) \
$(wildcard $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/*.png)
# These icons are handled in GensrcIcons.gmk
EXFILES += \
sun/awt/X11/java-icon16.png \
sun/awt/X11/java-icon24.png \
sun/awt/X11/java-icon32.png \
sun/awt/X11/java-icon48.png \
$(wildcard $(JDK_TOPDIR)/src/share/classes/sun/awt/resources/*.png) \
#
ifndef OPENJDK
SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/com/sun/java/swing/plaf/windows
# Filter out JavaCup32.png from OpenJDK
COPY_FILES := $(filter-out $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/JavaCup32.png, $(COPY_FILES))
# Alter JavaCup32.png from ClosedJDK
COPY_FILES += \
$(SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED)/icons/JavaCup32.png
# Theses icons have closed replacements
SWING_PLAF_MOTIF_RESOURCES_DIR := $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
EXFILES += \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/icons/JavaCup32.png \
$(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic/icons/JavaCup16.png \
$(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
$(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png) \
#
EXFILES += mib_core.txt
endif
ifeq ($(ENABLE_JFR), true)
JFR_CONFIGURATION_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
JFR_CONFIGURATION_DIR_CLOSED := $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
COPY_FILES += \
$(JFR_CONFIGURATION_DIR_CLOSED)/jfc.xsd
endif
SWING_PLAF_BASIC_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic
COPY_FILES += \
$(wildcard $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/*.png)
ifndef OPENJDK
SWING_PLAF_BASIC_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/javax/swing/plaf/basic
# Filter out JavaCup16.png from OpenJDK
COPY_FILES := $(filter-out $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/JavaCup16.png, $(COPY_FILES))
# Alter JavaCup16.png from ClosedJDK
COPY_FILES += \
$(SWING_PLAF_BASIC_RESOURCES_DIR_CLOSED)/icons/JavaCup16.png
endif
ifdef OPENJDK
SWING_PLAF_MOTIF_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
COPY_FILES += \
$(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
$(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png)
else
SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/com/sun/java/swing/plaf/motif
COPY_FILES += \
$(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED)/icons/*.gif) \
$(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED)/icons/*.png)
endif
SWING_PLAF_METAL_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/metal
COPY_FILES += \
$(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/*.gif) \
$(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/*.png) \
$(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/ocean/*.gif) \
$(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/ocean/*.png) \
$(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/sounds/*.wav)
ifneq ($(OPENJDK_TARGET_OS), windows)
# Only copy GTK resources on Solaris/Linux
SWING_PLAF_GTK_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk
COPY_FILES += \
$(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/icons/*.gif) \
$(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/icons/*.png) \
$(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/resources/metacity/SwingFallbackTheme/metacity-1/*.xml)
endif
# END: Swing plaf resources
SWING_BEANINFO_RESOURCES_SRC_DIR = $(JDK_TOPDIR)/make/data/swingbeaninfo/images
SWING_BEANINFO_RESOURCES_SRC = $(wildcard $(SWING_BEANINFO_RESOURCES_SRC_DIR)/*.gif)
OUT_BEANINFO_RESOURCES = $(patsubst $(SWING_BEANINFO_RESOURCES_SRC_DIR)%, \
@ -147,13 +79,13 @@ OUT_BEANINFO_RESOURCES = $(patsubst $(SWING_BEANINFO_RESOURCES_SRC_DIR)%, \
$(SWING_BEANINFO_RESOURCES_SRC))
COPY_EXTRA += $(OUT_BEANINFO_RESOURCES)
# END: Swing beaninfo resources
# Swing text resources
SWING_TEXT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/text
COPY_FILES += \
$(SWING_TEXT_RESOURCEDIR)/html/default.css \
$(wildcard $(SWING_TEXT_RESOURCEDIR)/rtf/charsets/*.txt)
# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: \
$(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
$(call install-file)
##########################################################################################
#
@ -222,14 +154,7 @@ $(foreach i, $(META-INF_RULES_SERVICES), $(eval $(call addto_meta-inf_services,
COPY_EXTRA += $(OUT_SERVICES_FILES)
COPY_EXTRA += $(OUT_SERVICES_FILES_PRINT)
###
$(JDK_OUTPUTDIR)/classes/sun/nio/cs/ext/sjis0213.dat: $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs/ext/sjis0213.dat
$(call install-file)
COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/sun/nio/cs/ext/sjis0213.dat
###
################################################################################
JAVAX_SOUND_SRC := $(JDK_TOPDIR)/src/share/classes/com/sun/media/sound/services
@ -248,3 +173,30 @@ COPY_EXTRA += $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/, $(JAVAX_S
JAVAX_SOUND_RULES := $(foreach F, $(JAVAX_SOUND_SRC_FILES), $(JDK_OUTPUTDIR)/classes/META-INF/services/$(notdir $F):$(JAVAX_SOUND_SRC)/$F)
$(foreach R, $(JAVAX_SOUND_RULES), $(eval $(call addto_meta-inf_services, $R)))
################################################################################
CLEAN_FILES := $(wildcard \
$(JDK_TOPDIR)/src/share/classes/com/sun/imageio/plugins/common/*.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/*.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/*.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/rowset/*.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell/*.properties \
$(JDK_TOPDIR)/src/share/classes/javax/sql/rowset/*.properties \
$(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources/*.properties \
$(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources/*.properties \
$(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources/*.properties \
$(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources/*.properties \
$(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources/*.properties \
$(JDK_TOPDIR)/src/share/classes/sun/tools/serialver/resources/*.properties \
)
# Copy zh_HK files from zh_TW
$(JDK_OUTPUTDIR)/classes/%_zh_HK.properties: $(JDK_OUTPUTDIR)/classes/%_zh_TW.properties
$(install-file)
COPY_EXTRA += $(patsubst $(JDK_TOPDIR)/src/share/classes/%, $(JDK_OUTPUTDIR)/classes/%, \
$(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $(CLEAN_FILES))))

View file

@ -30,9 +30,6 @@ include Setup.gmk
default: all
# Prepare the find cache. Only used if running on windows.
$(eval $(call FillCacheFind, $(JDK_OUTPUTDIR)/classes))
include Tools.gmk
include Profiles.gmk

View file

@ -30,7 +30,7 @@ include Setup.gmk
default: images
# Prepare the find cache. Only used if running on windows.
# Prepare the find cache.
$(eval $(call FillCacheFind, \
$(wildcard $(JDK_OUTPUTDIR)/bin \
$(JDK_OUTPUTDIR)/lib \

View file

@ -252,7 +252,7 @@ define unzip-sec-file
$(ECHO) Unzipping $(<F)
$(MKDIR) -p $(@D)
$(RM) $@
($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) $< > $@.tmp)
($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
$(MV) $@.tmp $@
endef

View file

@ -38,7 +38,7 @@ JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,cast,
# boot jdk to generate tools that need to be run with the boot jdk.
# Thus we force the target bytecode to the previous JDK version.
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA), \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
@ -60,7 +60,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
# I.e. the rt.jar, but since rt.jar has not yet been generated
# (it will be in "make images") therefore we use classes instead.
$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
JVM := $(JAVA), \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
# questions.
#
# Cache all finds needed for this file. Only used on windows.
# Cache all finds needed for this file.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/make/src/classes))
# The exception handling of swing beaninfo which have the own tool directory
@ -48,79 +48,76 @@ $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed: \
BUILD_TOOLS += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
# Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
TOOL_ADDJSUM = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.addjsum.AddJsum
# The buildmetaindex tool creates a meta-index to make core class loaders lazier.
TOOL_BUILDMETAINDEX = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.buildmetaindex.BuildMetaIndex
TOOL_COMPILEFONTCONFIG = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.compilefontconfig.CompileFontConfig
TOOL_COMPILEPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.compileproperties.CompileProperties
TOOL_STRIPPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.stripproperties.StripProperties
TOOL_JARREORDER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_JARREORDER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.jarreorder.JarReorder
TOOL_GENERATECHARACTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.generatecharacter.GenerateCharacter
TOOL_CHARACTERNAME = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.generatecharacter.CharacterName
TOOL_DTDBUILDER = $(JAVA) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
-cp $(JDK_OUTPUTDIR)/btclasses build.tools.dtdbuilder.DTDBuilder
TOOL_GENERATEBREAKITERATORDATA = $(JAVA) \
TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
-cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.generatebreakiteratordata.GenerateBreakIteratorData
TOOL_GENERATECURRENCYDATA = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.generatecurrencydata.GenerateCurrencyData
TOOL_HASHER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_HASHER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.hasher.Hasher
TOOL_TZDB = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.tzdb.TzdbZoneRulesCompiler
# TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
# and nbproject/project.properties in the same dir. Needs to be looked at.
TOOL_JDWPGEN = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
# TODO: Lots of files in jdk/make/tools/CharsetMapping dir
TOOL_CHARSETMAPPING = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.charsetmapping.Main $(LOG_INFO)
TOOL_SPP = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
TOOL_SPP = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
# Nimbus is used somewhere in the swing build.
TOOL_GENERATENIMBUS = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.generatenimbus.Generator
TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.x11wrappergen.WrapperGenerator
TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.icondata.awt.ToBin
TOOL_OSX_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.icondata.osxapp.ToBin
TOOL_CLDRCONVERTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.cldrconverter.CLDRConverter
TOOL_CHECKDEPS = $(JAVA) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
-cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
build.tools.deps.CheckDeps
TOOL_ADDTORESTRICTEDPKGS=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
TOOL_ADDTORESTRICTEDPKGS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
##########################################################################################

View file

@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata2013i
tzdata2014a

View file

@ -1113,8 +1113,13 @@ Rule Zion 1986 only - May 18 0:00 1:00 D
Rule Zion 1986 only - Sep 7 0:00 0 S
Rule Zion 1987 only - Apr 15 0:00 1:00 D
Rule Zion 1987 only - Sep 13 0:00 0 S
Rule Zion 1988 only - Apr 9 0:00 1:00 D
Rule Zion 1988 only - Sep 3 0:00 0 S
# From Avigdor Finkelstein (2014-03-05):
# I check the Parliament (Knesset) records and there it's stated that the
# [1988] transition should take place on Saturday night, when the Sabbath
# ends and changes to Sunday.
Rule Zion 1988 only - Apr 10 0:00 1:00 D
Rule Zion 1988 only - Sep 4 0:00 0 S
# From Ephraim Silverberg
# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,

View file

@ -377,16 +377,18 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
# From the Fijian Government Media Center (2013-08-30) via David Wheeler:
# Fiji will start daylight savings on Sunday 27th October, 2013 and end at 3am
# on Sunday 19th January, 2014.... move clocks forward by one hour from 2am
# Fiji will start daylight savings on Sunday 27th October, 2013 ...
# move clocks forward by one hour from 2am
# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
#
# From Paul Eggert (2013-09-09):
# From Steffen Thorsen (2013-01-10):
# Fiji will end DST on 2014-01-19 02:00:
# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
# From Paul Eggert (2014-01-10):
# For now, guess that Fiji springs forward the Sunday before the fourth
# Monday in October. This matches both recent practice and
# timeanddate.com's current spring-forward prediction.
# For the January 2014 transition we guessed right while timeanddate.com
# guessed wrong, so leave the fall-back prediction alone.
# Monday in October, and springs back the penultimate Sunday in January.
# This is ad hoc, but matches recent practice.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
@ -395,7 +397,8 @@ Rule Fiji 2009 only - Nov 29 2:00 1:00 S
Rule Fiji 2010 only - Mar lastSun 3:00 0 -
Rule Fiji 2010 max - Oct Sun>=21 2:00 1:00 S
Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2012 max - Jan Sun>=18 3:00 0 -
Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 -
Rule Fiji 2014 max - Jan Sun>=18 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time

View file

@ -2768,14 +2768,18 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
# According to the articles linked below, Turkey will change into summer
# time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
# This change is due to a nationwide exam on 27th.
#
# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
# </a>
# Turkish:
# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
# http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
# </a>
# From Faruk Pasin (2014-02-14):
# The DST for Turkey has been changed for this year because of the
# Turkish Local election....
# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
# From Paul Eggert (2014-02-17):
# Here is an English-language source:
# http://www.worldbulletin.net/turkey/129016/turkey-switches-to-daylight-saving-time-march-31
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Turkey 1916 only - May 1 0:00 1:00 S
@ -2844,6 +2848,8 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880
2:00 Turkey EE%sT 2007
2:00 EU EE%sT 2011 Mar 27 1:00u
2:00 - EET 2011 Mar 28 1:00u
2:00 EU EE%sT 2014 Mar 30 1:00u
2:00 - EET 2014 Mar 31 1:00u
2:00 EU EE%sT
Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
@ -2865,19 +2871,13 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# approval from 266 deputies.
#
# Ukraine abolishes transter back to the winter time (in Russian)
# <a href="http://news.mail.ru/politics/6861560/">
# http://news.mail.ru/politics/6861560/
# </a>
#
# The Ukrainians will no longer change the clock (in Russian)
# <a href="http://www.segodnya.ua/news/14290482.html">
# http://www.segodnya.ua/news/14290482.html
# </a>
#
# Deputies cancelled the winter time (in Russian)
# <a href="http://www.pravda.com.ua/rus/news/2011/09/20/6600616/">
# http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
# </a>
#
# From Philip Pizzey (2011-10-18):
# Today my Ukrainian colleagues have informed me that the
@ -2888,18 +2888,39 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# As far as I understand, the recent change to the Ukrainian time zone
# (Europe/Kiev) to introduce permanent daylight saving time (similar
# to Russia) was reverted today:
#
# <a href="http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995">
# http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
# </a>
#
# Also reported by Alexander Bokovoy (2011-10-18) who also noted:
# The law documents themselves are at
#
# <a href="http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484">
# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
# </a>
# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
# 03 25 1990 02:00 -03.00 1 Time Zone 3 with DST
# 07 01 1990 02:00 -02.00 1 Time Zone 2 with DST
# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
#
# They did not end DST in September, 1990 (according to the law,
# "summer time" was still in action):
# 09 30 1990 03:00 -02.00 1 Time Zone 2 with DST
# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
#
# Again no change in March, 1991 ("summer time" in action):
# 03 31 1991 02:00 -02.00 1 Time Zone 2 with DST
#
# DST ended in September 1991 ("summer time" ended):
# 09 29 1991 03:00 -02.00 0 Time Zone 2, no DST
# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
# This is an answer.
#
# Since 1992 they had normal DST procedure:
# 03 29 1992 02:00 -02.00 1 DST started
# 09 27 1992 03:00 -02.00 0 DST ended
# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Most of Ukraine since 1970 has been like Kiev.
@ -2910,9 +2931,8 @@ Zone Europe/Kiev 2:02:04 - LMT 1880
2:00 - EET 1930 Jun 21
3:00 - MSK 1941 Sep 20
1:00 C-Eur CE%sT 1943 Nov 6
3:00 Russia MSK/MSD 1990
3:00 - MSK 1990 Jul 1 2:00
2:00 - EET 1992
3:00 Russia MSK/MSD 1990 Jul 1 2:00
2:00 1:00 EEST 1991 Sep 29 3:00
2:00 E-Eur EE%sT 1995
2:00 EU EE%sT
# Ruthenia used CET 1990/1991.

View file

@ -414,9 +414,10 @@ Zone America/Denver -6:59:56 - LMT 1883 Nov 18 12:00:04
# US Pacific time, represented by Los Angeles
#
# California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
# and the northern three-quarters of Idaho county),
# most of Nevada, most of Oregon, and Washington
# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
# north of the Salmon River, and the towns of Burgdorf and Warren),
# Nevada (except West Wendover), Oregon (except the northern 3/4 of
# Malheur county), and Washington
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER
Rule CA 1948 only - Mar 14 2:00 1:00 D

View file

@ -1298,6 +1298,13 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# start date is 2013-09-08 00:00....
# http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
# From Jose Miguel Garrido (2014-02-19):
# Today appeared in the Diario Oficial a decree amending the time change
# dates to 2014.
# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
@ -1631,6 +1638,9 @@ Rule Para 2010 2012 - Apr Sun>=8 0:00 0 -
# From Carlos Raul Perasso (2013-03-15):
# The change in Paraguay is now final. Decree number 10780
# http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
# From Carlos Raul Perasso (2014-02-28):
# Decree 1264 can be found at:
# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
Rule Para 2013 max - Mar Sun>=22 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -1689,18 +1699,19 @@ Zone America/Paramaribo -3:40:40 - LMT 1911
Zone America/Port_of_Spain -4:06:04 - LMT 1912 Mar 2
-4:00 - AST
# These all agree with Trinidad and Tobago since 1970.
Link America/Port_of_Spain America/Anguilla
Link America/Port_of_Spain America/Dominica
Link America/Port_of_Spain America/Grenada
Link America/Port_of_Spain America/Guadeloupe
Link America/Port_of_Spain America/Marigot
Link America/Port_of_Spain America/Marigot # St Martin (French part)
Link America/Port_of_Spain America/Montserrat
Link America/Port_of_Spain America/St_Barthelemy
Link America/Port_of_Spain America/St_Kitts
Link America/Port_of_Spain America/St_Kitts # St Kitts & Nevis
Link America/Port_of_Spain America/St_Lucia
Link America/Port_of_Spain America/St_Thomas
Link America/Port_of_Spain America/St_Thomas # Virgin Islands (US)
Link America/Port_of_Spain America/St_Vincent
Link America/Port_of_Spain America/Tortola
Link America/Port_of_Spain America/Tortola # Virgin Islands (UK)
# Uruguay
# From Paul Eggert (1993-11-18):

View file

@ -23,8 +23,10 @@
# questions.
#
# Prepare the find cache. This is only used on windows.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/windows/classes))
# Prepare the find cache.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/classes \
$(JDK_TOPDIR)/src/windows/classes \
$(JDK_TOPDIR)/src/macosx/classes))
# All .properties files to be compiled are appended to this variable.
ALL_COMPILED_PROPSOURCES :=
@ -33,19 +35,10 @@ ALL_COMPILED_PROPJAVAS :=
# The (very long) command line for compilation, stored in a file, prior to use.
COMPILE_PROPCMDLINE :=
# All .properties files to be cleaned are appended to this variable.
ALL_CLEANED_PROPSOURCES :=
# All generated cleaned .properties files from cleaning are appended to this variable.
ALL_CLEANED_PROPOUTPUT :=
# The (very long) command line for cleaning, stored in a file, prior to use.
CLEAN_PROPCMDLINE :=
define add_properties_to_compile
# $1 is the name of the properties group
# $2 is the files belonging to this group
# $3 is the super class for the generated java file.
# $4 is a from pattern for translating stripped name from source to target
# $5 is the to pattern replacing $3 in the target
# Strip away prefix and suffix,
# leaving for example: sun/util/resources/CurrencyNames_sv
@ -53,16 +46,14 @@ define add_properties_to_compile
$$(patsubst $(JDK_TOPDIR)/src/macosx/classes/%.properties, %, \
$$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties, %, $2)))
# Apply optional name transformation, example: hz_TW -> hz_HK
$(if $4, $1_PROPPATHS := $$(patsubst $4, $5, $$($1_PROPPATHS)))
# Accumulate all found properties files.
ALL_COMPILED_PROPSOURCES += $2
# Generate the list of to be created java files.
ALL_COMPILED_PROPJAVAS += $$(patsubst %, $(JDK_OUTPUTDIR)/gensrc/%.java, $$($1_PROPPATHS))
# Now generate a sequence of "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
# Now generate a sequence of
# "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
# suitable to be fed into the CompileProperties command.
COMPILE_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -compile_SPACE_, $2), \
$$(addsuffix _SPACE_$(strip $3), \
@ -70,290 +61,55 @@ define add_properties_to_compile
$$(addsuffix .java, $$($1_PROPPATHS))))))
endef
define add_properties_to_clean
# $1 is the name of the properties group
# $2 is the files belonging to this group
# $3 is a from pattern for translating stripped name from source to target
# $4 is the to pattern replacing $3 in the target
# $5 optional name of extra directory to put properties files in (ex: resources)
# Strip away prefix and suffix,
# leaving for example: sun/util/resources/CurrencyNames_sv
$1_PROPPATHS := $$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/%.properties, %, \
$$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties, %, $2))
# Apply optional name transformation, example: hz_TW -> hz_HK
$(if $3, $1_PROPPATHS := $$(patsubst $3, $4, $$($1_PROPPATHS)))
# Accumulate all found properties files.
ALL_CLEANED_PROPSOURCES += $2
# Generate the list of to be created java files.
$1_PROPOUTPUT := $$(patsubst %, $(JDK_OUTPUTDIR)/classes/%.properties, $$($1_PROPPATHS))
# If the properties target file isn't in a "resources" dir, add one.
ifneq ($5, )
$1_PROPOUTPUT := $$(foreach p, $$($1_PROPOUTPUT), $$(dir $$p)$5/$$(notdir $$p))
endif
ALL_CLEANED_PROPOUTPUT += $$($1_PROPOUTPUT)
# Now generate a sequence of "-clean ...[src]...CurrencyNames_sv.properties ...[build]...CurrencyNames_sv.properties"
# suitable to be fed into the StripProperties command.
CLEAN_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -clean_SPACE_,$2), \
$$(addprefix _SPACE_, $$($1_PROPOUTPUT))))
endef
# Some packages contain pregenerated java files instead of properties files.
# But unfortunately not all properties should be converted, some should be
# copied....argggghhh.
# For example:
# sun/applet/resources
# sun/misc/resources
# sun/text/resources
# sun/tools/jconsole/resources
# sun/tools/native2ascii/resources
# sun/util/resources
################################################################################
# Some packages have properties that need to be converted to java source files.
COMPILE_PROP_SRC_FILES := \
$(filter %.properties, $(call CacheFind, \
$(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources \
$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources \
$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources \
$(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources \
$(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources \
$(JDK_TOPDIR)/src/share/classes/sun/awt/resources \
$(JDK_TOPDIR)/src/share/classes/sun/launcher/resources \
$(JDK_TOPDIR)/src/share/classes/sun/management/resources \
$(JDK_TOPDIR)/src/share/classes/sun/print/resources \
$(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources \
$(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)) \
#
#com/apple/laf/resources
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call add_properties_to_compile,COM_APPLE_LAF, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources)), \
ListResourceBundle))
COMPILE_PROP_SRC_FILES += \
$(filter %.properties, $(call CacheFind, \
$(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources \
$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)) \
#
endif
#com/sun/accessibility/internal/resources
$(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#com/sun/imageio/plugins/common
$(eval $(call add_properties_to_clean,COM_SUN_IMAGEIO, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/imageio))))
#com/sun/java/swing/plaf/gtk/resources
ifneq ($(OPENJDK_TARGET_OS), windows)
# Only compile GTK resource bundles on Solaris/Linux
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
endif
#com/sun/java/swing/plaf/motif/resources
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#com/sun/java/swing/plaf/windows/resources
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#com/sun/java/util/jar/pack
$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/intrinsic.properties))
#com/sun/jndi/cosnaming
$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
$(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties))
#com/sun/jndi/ldap
$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
$(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties))
#com/sun/org/apache/xml/internal/security/resource
#FIXME: The "xmlsecurity*.properties" pattern is not ideal; we might want to find
#a better way to select the properties files that are needed.
$(eval $(call add_properties_to_clean,XML_SECURITY, \
$(filter $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity%.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource))))
#com/sun/rowset
$(eval $(call add_properties_to_clean,COM_SUN_ROWSET, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/rowset))))
$(eval $(call add_properties_to_clean,COM_SUN_ROWSET_HK, \
$(filter %zh_TW.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/rowset)), \
%zh_TW, %zh_HK))
#com/sun/swing/internal/plaf/basic/resources
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#com/sun/swing/internal/plaf/metal/resources
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL_HK, \
$(filter %.properties, $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#com/sun/swing/internal/plaf/synth/resources
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#com/sun/tools/jdi/resources
$(eval $(call add_properties_to_compile,COM_SUN_TOOLS_JDI, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources)), \
ListResourceBundle))
#com/sun/tools/script/shell
#java/util
#javax/sql/rowset
$(eval $(call add_properties_to_clean,JAVAX_SQL_ROWSET, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset))))
#sun/awt/resources
$(eval $(call add_properties_to_compile,SUN_AWT, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/awt/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_AWT_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/awt/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#sun/awt/windows/
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call add_properties_to_compile,SUN_AWT, \
$(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_AWT_HK, \
$(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)), \
ListResourceBundle, %zh_TW, %zh_HK))
endif
# os x specific awt properties
ifeq ($(OPENJDK_TARGET_OS),macosx)
$(eval $(call add_properties_to_compile,SUN_AWT,\
$(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\
$(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\
ListResourceBundle))
COMPILE_PROP_SRC_FILES += \
$(filter %.properties, $(call CacheFind, \
$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)) \
#
else # ! windows
COMPILE_PROP_SRC_FILES += \
$(filter %.properties, $(call CacheFind, \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)) \
#
endif
#sun/launcher/resources
$(eval $(call add_properties_to_compile,SUN_LAUNCHER, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_LAUNCHER_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#sun/management/resources
$(eval $(call add_properties_to_compile,SUN_MANAGEMENT, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/management/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_MANAGEMENT_KH, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/management/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#sun/print
#sun/print/resources
$(eval $(call add_properties_to_compile,SUN_PRINT, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/print/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_PRINT_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/print/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#sun/rmi/registry/resources
$(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources))))
$(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY_HK, \
$(filter %zh_TW.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources)), \
%zh_TW, %zh_HK))
$(eval $(call add_properties_to_compile,LIST_RESOURCE_BUNDLE, \
$(COMPILE_PROP_SRC_FILES), ListResourceBundle))
#sun/rmi/rmic/resources
$(eval $(call add_properties_to_clean,SUN_RMI_RMIC, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources))))
#sun/rmi/server/resources
$(eval $(call add_properties_to_clean,SUN_RMI_SERVER, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources))))
$(eval $(call add_properties_to_clean,SUN_RMI_SERVER_HK, \
$(filter %zh_TW.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources)), \
%zh_TW, %zh_HK))
# sun/tools/jar/resources
$(eval $(call add_properties_to_compile,SUN_TOOLS_JAR, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_TOOLS_JAR_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
#sun/tools/javac/resources
# It's unclear if the other localized property files here are supposed to be copied or not
# but the old build system didn't copy them.
$(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER, \
$(filter %javac.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources))))
#sun/tools/jconsole/resources
$(eval $(call add_properties_to_clean,SUN_TOOLS_JCONSOLE, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources))))
#sun/tools/serialver
$(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver)), , ,resources))
#sun/util/logging/resources
$(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)), \
ListResourceBundle))
$(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING_HK, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)), \
ListResourceBundle, %zh_TW, %zh_HK))
# sun/util/resources
$(eval $(call add_properties_to_compile,SUN_UTIL, \
$(filter %.properties, \
$(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/resources)), \
sun.util.resources.LocaleNamesBundle))
################################################################################
# Now setup the rule for the generation of the resource bundles.
$(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties: $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)
# Generate all output directories in advance since the build tool does not do that...
@ -363,33 +119,31 @@ $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties: $(ALL_COMPILED_PROPSOURCES) $(
$(TOOL_COMPILEPROPERTIES) -quiet @$(JDK_OUTPUTDIR)/gensrc/_the.cmdline
$(TOUCH) $@
# Now setup the rule for the generation of the cleaned properties.
# FIXME: We currently don't handle removed properties incrementally.
$(JDK_OUTPUTDIR)/classes/_the.cleaned_properties: $(ALL_CLEANED_PROPSOURCES) $(BUILD_TOOLS)
$(RM) $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
# Generate all output directories in advance since the build tool does not do that...
$(MKDIR) -p $(sort $(dir $(ALL_CLEANED_PROPOUTPUT)))
$(ECHO) Copying and cleaning $(words $(ALL_CLEANED_PROPSOURCES)) properties
$(call ListPathsSafely,CLEAN_PROPCMDLINE,\n, >> $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline)
$(TOOL_STRIPPROPERTIES) @$(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
$(TOUCH) $@
$(ALL_COMPILED_PROPJAVAS): $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties
$(ALL_CLEANED_PROPOUTPUT): $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties
################################################################################
# Some zh_HK resources are just copies of zh_TW
define convert_tw_to_hk
$(MKDIR) -p $(@D)
$(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
endef
# Some zh_HK resources are just copied of zh_TW
$(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_TOPDIR)/src/share/classes/%_zh_TW.java
$(MKDIR) -p $(@D)
$(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
$(call convert_tw_to_hk)
$(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_OUTPUTDIR)/gensrc/%_zh_TW.java
$(call convert_tw_to_hk)
ZH_HK_JAVA := sun/applet/resources/MsgAppletViewer_zh_HK.java \
sun/misc/resources/Messages_zh_HK.java \
sun/security/util/AuthResources_zh_HK.java \
sun/security/util/Resources_zh_HK.java
ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA))
ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA)) \
$(filter-out $(JDK_OUTPUTDIR)/gensrc/sun/util/resources/zh/%, \
$(subst _zh_TW,_zh_HK,$(filter %_zh_TW.java, $(ALL_COMPILED_PROPJAVAS))))
################################################################################
GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ALL_CLEANED_PROPOUTPUT) $(ZH_HK_JAVA_FILES)
GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ZH_HK_JAVA_FILES)

View file

@ -1196,7 +1196,6 @@ endif
ifndef BUILD_HEADLESS_ONLY
LIBSPLASHSCREEN_DIRS := \
$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
ifeq ($(USE_EXTERNAL_LIBGIF), true)
@ -1206,6 +1205,11 @@ ifndef BUILD_HEADLESS_ONLY
GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
endif
ifeq ($(USE_EXTERNAL_LIBPNG), false)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/libpng
LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
else
@ -1268,11 +1272,13 @@ ifndef BUILD_HEADLESS_ONLY
EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
LANG := C, \
OPTIMIZATION := LOW, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
$(GIFLIB_CFLAGS) $(PNG_CFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
$(GIFLIB_LDFLAGS) $(PNG_LIBS), \
LDFLAGS_SUFFIX_solaris := -lc, \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \
@ -1315,6 +1321,7 @@ ifndef OPENJDK
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(LIBM) $(LDFLAGS_JDKLIB_SUFFIX), \
LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB), \
LDFLAGS_SUFFIX_posix := -lm, \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \

View file

@ -203,7 +203,6 @@ BUILD_LIBRARIES += $(BUILD_LIBJSDT)
##########################################################################################
LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
LIBINSTRUMENT_FILES := \
@ -218,8 +217,7 @@ LIBINSTRUMENT_FILES := \
JavaExceptions.c \
PathCharsValidator.c \
Reentrancy.c \
Utilities.c \
canonicalize_md.c
Utilities.c
LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
@ -239,6 +237,8 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
# equivalent of strcasecmp is stricmp on Windows
LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
else
LIBINSTRUMENT_LDFLAGS_SUFFIX := -ljava
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \

View file

@ -1,288 +0,0 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package build.tools.stripproperties;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
/**
* Reads a properties file from standard input and writes an equivalent
* properties file without comments to standard output.
*/
public class StripProperties {
private static void error(String msg, Exception e) {
System.err.println("ERROR: stripproperties: " + msg);
if ( e != null ) {
System.err.println("EXCEPTION: " + e.toString());
e.printStackTrace();
}
}
private static List<String> infiles = new ArrayList<String>();
private static List<String> outfiles = new ArrayList<String>();
private static boolean parseOptions(String args[]) {
boolean ok = true;
for ( int i = 0; i < args.length ; i++ ) {
if ( "-clean".equals(args[i]) && i+2 < args.length ) {
infiles.add(args[++i]);
outfiles.add(args[++i]);
} else if ( args[i].charAt(0)=='@') {
String filename = args[i].substring(1);
FileInputStream finput = null;
byte contents[] = null;
try {
finput = new FileInputStream(filename);
int byteCount = finput.available();
if ( byteCount <= 0 ) {
error("The @file is empty", null);
ok = false;
} else {
contents = new byte[byteCount];
int bytesRead = finput.read(contents);
if ( byteCount != bytesRead ) {
error("Cannot read all of @file", null);
ok = false;
}
}
} catch ( IOException e ) {
error("cannot open " + filename, e);
ok = false;
}
if ( finput != null ) {
try {
finput.close();
} catch ( IOException e ) {
ok = false;
error("cannot close " + filename, e);
}
}
if ( ok && contents != null ) {
String tokens[] = (new String(contents)).split("\\s+");
if ( tokens.length > 0 ) {
ok = parseOptions(tokens);
}
}
if ( !ok ) {
break;
}
} else {
infiles.add(args[i]);
outfiles.add(args[i]);
}
}
return ok;
}
private static boolean stripFiles(List<String> infiles, List<String> outfiles) {
boolean ok = true;
Iterator<String> inIter = infiles.iterator();
Iterator<String> outIter = outfiles.iterator();
for (; inIter.hasNext(); ) {
String infile = inIter.next();
String outfile = outIter.next();
Properties prop = new Properties();
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(infile));
prop.load(in);
} catch ( FileNotFoundException e ) {
error("Cannot access file " + infile, e);
ok = false;
} catch ( IOException e ) {
error("IO exception processing file " + infile, e);
ok = false;
}
if ( in != null ) {
try {
in.close();
} catch ( IOException e ) {
error("IO exception closing file " + infile, e);
ok = false;
}
}
if ( !ok ) {
break;
}
OutputStream out = null;
try {
out = new FileOutputStream(outfile);
storeProperties(prop, out);
out.flush();
} catch ( IOException e ) {
error("IO exception processing file " + outfile, e);
ok = false;
}
if ( out != null ) {
try {
out.close();
} catch ( IOException e ) {
error("IO exception closing file " + outfile, e);
ok = false;
}
}
if ( !ok ) {
break;
}
}
return ok;
}
/**
* Strip the properties filenames supplied, replacing their contents.
* @param args Names of properties files to process and replace contents
*/
public static void main(String args[]) {
boolean ok = parseOptions(args);
if ( !ok || !stripFiles(infiles, outfiles) ) {
System.exit(1);
}
}
// --- code below here is adapted from java.util.Properties ---
private static final String specialSaveChars = "=: \t\r\n\f#!";
/*
* Converts unicodes to encoded &#92;uxxxx
* and writes out any of the characters in specialSaveChars
* with a preceding slash
*/
private static String saveConvert(String theString, boolean escapeSpace) {
int len = theString.length();
StringBuffer outBuffer = new StringBuffer(len*2);
for(int x=0; x<len; x++) {
char aChar = theString.charAt(x);
switch(aChar) {
case ' ':
if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
outBuffer.append(' ');
break;
case '\\':
outBuffer.append('\\');
outBuffer.append('\\');
break;
case '\t':
outBuffer.append('\\');
outBuffer.append('t');
break;
case '\n':
outBuffer.append('\\');
outBuffer.append('n');
break;
case '\r':
outBuffer.append('\\');
outBuffer.append('r');
break;
case '\f':
outBuffer.append('\\');
outBuffer.append('f');
break;
default:
if ((aChar < 0x0020) || (aChar == 0x007e) || (aChar > 0x00ff)) {
outBuffer.append('\\');
outBuffer.append('u');
outBuffer.append(toHex((aChar >> 12) & 0xF));
outBuffer.append(toHex((aChar >> 8) & 0xF));
outBuffer.append(toHex((aChar >> 4) & 0xF));
outBuffer.append(toHex( aChar & 0xF));
} else {
if (specialSaveChars.indexOf(aChar) != -1) {
outBuffer.append('\\');
}
outBuffer.append(aChar);
}
}
}
return outBuffer.toString();
}
/**
* Writes the content of <code>properties</code> to <code>out</code>.
* The format is that of Properties.store with the following modifications:
* <ul>
* <li>No header or date is written
* <li>Latin-1 characters are written as single bytes, not escape sequences
* <li>Line breaks are indicated by a single \n independent of platform
* <ul>
*/
private static void storeProperties(Properties properties, OutputStream out)
throws IOException {
BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
String key = (String)e.nextElement();
String val = (String)properties.get(key);
key = saveConvert(key, true);
/* No need to escape embedded and trailing spaces for value, hence
* pass false to flag.
*/
val = saveConvert(val, false);
writeln(awriter, key + "=" + val);
}
awriter.flush();
}
private static void writeln(BufferedWriter bw, String s) throws IOException {
bw.write(s);
bw.write("\n");
}
/**
* Convert a nibble to a hex character
* @param nibble the nibble to convert.
*/
private static char toHex(int nibble) {
return hexDigit[(nibble & 0xF)];
}
/** A table of hex digits */
private static final char[] hexDigit = {
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,9 @@ package apple.laf;
import com.apple.laf.AquaImageFactory.NineSliceMetrics;
import apple.laf.JRSUIConstants.*;
import sun.security.action.GetPropertyAction;
import java.security.AccessController;
public class JRSUIUtils {
static boolean isLeopard = isMacOSXLeopard();
@ -47,7 +50,7 @@ public class JRSUIUtils {
static boolean currentMacOSXVersionMatchesGivenVersionRange(final int version, final boolean inclusive, final boolean matchBelow, final boolean matchAbove) {
// split the "10.x.y" version number
String osVersion = System.getProperty("os.version");
String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
String[] fragments = osVersion.split("\\.");
// sanity check the "10." part of the version

View file

@ -42,7 +42,6 @@ import javax.swing.filechooser.*;
import javax.swing.plaf.*;
import javax.swing.table.*;
import sun.swing.AbstractFilterComboBoxModel;
import sun.swing.SwingUtilities2;
public class AquaFileChooserUI extends FileChooserUI {
@ -1267,9 +1266,70 @@ public class AquaFileChooserUI extends FileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
protected JFileChooser getFileChooser() {
return AquaFileChooserUI.this.getFileChooser();
protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
PropertyChangeListener {
protected FileFilter[] filters;
protected FilterComboBoxModel() {
super();
filters = getFileChooser().getChoosableFileFilters();
}
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
filters = (FileFilter[]) e.getNewValue();
fireContentsChanged(this, -1, -1);
} else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
fireContentsChanged(this, -1, -1);
}
}
public void setSelectedItem(Object filter) {
if(filter != null) {
getFileChooser().setFileFilter((FileFilter) filter);
fireContentsChanged(this, -1, -1);
}
}
public Object getSelectedItem() {
// Ensure that the current filter is in the list.
// NOTE: we shouldnt' have to do this, since JFileChooser adds
// the filter to the choosable filters list when the filter
// is set. Lets be paranoid just in case someone overrides
// setFileFilter in JFileChooser.
FileFilter currentFilter = getFileChooser().getFileFilter();
boolean found = false;
if(currentFilter != null) {
for (FileFilter filter : filters) {
if (filter == currentFilter) {
found = true;
}
}
if(found == false) {
getFileChooser().addChoosableFileFilter(currentFilter);
}
}
return getFileChooser().getFileFilter();
}
public int getSize() {
if(filters != null) {
return filters.length;
} else {
return 0;
}
}
public FileFilter getElementAt(int index) {
if(index > getSize() - 1) {
// This shouldn't happen. Try to recover gracefully.
return getFileChooser().getFileFilter();
}
if(filters != null) {
return filters[index];
} else {
return null;
}
}
}

View file

@ -295,7 +295,14 @@ public class AquaIcon {
}
Image createImage() {
return AquaUtils.getCImageCreator().createSystemImageFromSelector(selector, getIconWidth(), getIconHeight());
int w = getIconWidth();
int h = getIconHeight();
return new AquaImageFactory.MultiResolutionIconImage(
AquaUtils.getCImageCreator().createSystemImageFromSelector(
selector, w, h),
AquaUtils.getCImageCreator().createSystemImageFromSelector(
selector, 2 * w, 2 * h)
);
}
}
}

View file

@ -46,6 +46,10 @@ import com.apple.laf.AquaIcon.JRSUIControlSpec;
import com.apple.laf.AquaIcon.SystemIcon;
import com.apple.laf.AquaUtils.RecyclableObject;
import com.apple.laf.AquaUtils.RecyclableSingleton;
import java.util.Arrays;
import java.util.List;
import sun.awt.image.MultiResolutionBufferedImage;
import sun.awt.image.MultiResolutionImage;
public class AquaImageFactory {
public static IconUIResource getConfirmImageIcon() {
@ -120,28 +124,48 @@ public class AquaImageFactory {
private static final int kAlertIconSize = 64;
static IconUIResource getAppIconCompositedOn(final Image background) {
final double scaleFactor = 1.0; // revise for HiDPI
final int kAlertSubIconSize = (int)(kAlertIconSize * 0.5 * scaleFactor);
final int kAlertSubIconInset = (int)(kAlertIconSize * scaleFactor) - kAlertSubIconSize;
final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(kAlertSubIconSize, kAlertSubIconSize) {
Image createImage() {
return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
}
};
final BufferedImage iconImage = getAppIconImageCompositedOn(background, 1);
final BufferedImage image = new BufferedImage(kAlertIconSize, kAlertIconSize, BufferedImage.TYPE_INT_ARGB);
if (background instanceof MultiResolutionIconImage) {
BufferedImage background2x
= ((MultiResolutionIconImage) background).resolutionVariant;
BufferedImage icon2xImage = getAppIconImageCompositedOn(background2x, 2);
return new IconUIResource(new ImageIcon(
new MultiResolutionIconImage(iconImage, icon2xImage)));
}
return new IconUIResource(new ImageIcon(iconImage));
}
static BufferedImage getAppIconImageCompositedOn(final Image background, int scaleFactor) {
final int scaledAlertIconSize = kAlertIconSize * scaleFactor;
final int kAlertSubIconSize = (int) (scaledAlertIconSize * 0.5);
final int kAlertSubIconInset = scaledAlertIconSize - kAlertSubIconSize;
final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(
kAlertSubIconSize, kAlertSubIconSize) {
Image createImage() {
return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
}
};
final BufferedImage image = new BufferedImage(scaledAlertIconSize,
scaledAlertIconSize, BufferedImage.TYPE_INT_ARGB);
final Graphics g = image.getGraphics();
g.drawImage(background, 0, 0, (int)(kAlertIconSize * scaleFactor), (int)(kAlertIconSize * scaleFactor), null);
g.drawImage(background, 0, 0,
scaledAlertIconSize, scaledAlertIconSize, null);
if (g instanceof Graphics2D) {
// improves icon rendering quality in Quartz
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
}
smallAppIconScaled.paintIcon(null, g, kAlertSubIconInset, kAlertSubIconInset);
smallAppIconScaled.paintIcon(null, g,
kAlertSubIconInset, kAlertSubIconInset);
g.dispose();
return new IconUIResource(new ImageIcon(image));
return image;
}
public static IconUIResource getTreeFolderIcon() {
@ -207,7 +231,7 @@ public class AquaImageFactory {
@Override
protected Image getInstance() {
return Toolkit.getDefaultToolkit().getImage("NSImage://" + namedImage);
return getNSIcon(namedImage);
}
}
@ -271,11 +295,27 @@ public class AquaImageFactory {
}
public static Icon getMenuItemCheckIcon() {
return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuItemSelection"), 25));
return new InvertableImageIcon(AquaUtils.generateLightenedImage(
getNSIcon("NSMenuItemSelection"), 25));
}
public static Icon getMenuItemDashIcon() {
return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuMixedState"), 25));
return new InvertableImageIcon(AquaUtils.generateLightenedImage(
getNSIcon("NSMenuMixedState"), 25));
}
private static Image getNSIcon(String imageName) {
Image icon = Toolkit.getDefaultToolkit()
.getImage("NSImage://" + imageName);
if (icon instanceof MultiResolutionImage) {
return icon;
}
Image icon2x = AquaUtils.getCImageCreator().createImageFromName(
imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null));
return new MultiResolutionBufferedImage(
BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x);
}
public static class NineSliceMetrics {
@ -484,4 +524,29 @@ public class AquaImageFactory {
public static Color getSelectionInactiveForegroundColorUIResource() {
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
}
static class MultiResolutionIconImage extends BufferedImage
implements MultiResolutionImage {
BufferedImage resolutionVariant;
public MultiResolutionIconImage(BufferedImage image, BufferedImage resolutionVariant) {
super(image.getWidth(), image.getHeight(), image.getType());
this.resolutionVariant = resolutionVariant;
Graphics g = getGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
}
@Override
public Image getResolutionVariant(int width, int height) {
return ((width <= getWidth() && height <= getHeight()))
? this : resolutionVariant;
}
@Override
public List<Image> getResolutionVariants() {
return Arrays.asList(this, resolutionVariant);
}
}
}

View file

@ -48,6 +48,7 @@ import sun.security.action.GetPropertyAction;
import sun.swing.SwingUtilities2;
import com.apple.laf.AquaImageFactory.SlicedImageControl;
import sun.awt.image.MultiResolutionBufferedImage;
final class AquaUtils {
@ -123,6 +124,13 @@ final class AquaUtils {
static Image generateLightenedImage(final Image image, final int percent) {
final GrayFilter filter = new GrayFilter(true, percent);
return (image instanceof MultiResolutionBufferedImage)
? ((MultiResolutionBufferedImage) image).map(
rv -> generateLightenedImage(rv, filter))
: generateLightenedImage(image, filter);
}
static Image generateLightenedImage(Image image, ImageFilter filter) {
final ImageProducer prod = new FilteredImageSource(image.getSource(), filter);
return Toolkit.getDefaultToolkit().createImage(prod);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,9 +30,6 @@ import java.awt.BufferCapabilities;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.ImageCapabilities;
import java.awt.Rectangle;
@ -80,23 +77,34 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
private ContextCapabilities oglCaps;
private OGLContext context;
private final Object disposerReferent = new Object();
private final int maxTextureSize;
private static native boolean initCGL();
private static native long getCGLConfigInfo(int displayID, int visualnum,
int swapInterval);
private static native int getOGLCapabilities(long configInfo);
/**
* Returns GL_MAX_TEXTURE_SIZE from the shared opengl context. Must be
* called under OGLRQ lock, because this method change current context.
*
* @return GL_MAX_TEXTURE_SIZE
*/
private static native int nativeGetMaxTextureSize();
static {
cglAvailable = initCGL();
}
private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
long configInfo, ContextCapabilities oglCaps)
{
long configInfo, int maxTextureSize,
ContextCapabilities oglCaps) {
super(device);
this.pixfmt = pixfmt;
this.pConfigInfo = configInfo;
this.oglCaps = oglCaps;
this.maxTextureSize = maxTextureSize;
context = new OGLContext(OGLRenderQueue.getInstance(), this);
// add a record to the Disposer so that we destroy the native
@ -126,6 +134,7 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
}
long cfginfo = 0;
int textureSize = 0;
final String ids[] = new String[1];
OGLRenderQueue rq = OGLRenderQueue.getInstance();
rq.lock();
@ -138,11 +147,14 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
kOpenGLSwapInterval);
if (cfginfo != 0L) {
textureSize = nativeGetMaxTextureSize();
// 7160609: GL still fails to create a square texture of this
// size. Half should be safe enough.
// Explicitly not support a texture more than 2^14, see 8010999.
textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
OGLContext.setScratchSurface(cfginfo);
rq.flushAndInvokeNow(new Runnable() {
public void run() {
ids[0] = OGLContext.getOGLIdString();
}
rq.flushAndInvokeNow(() -> {
ids[0] = OGLContext.getOGLIdString();
});
}
} finally {
@ -154,8 +166,7 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
int oglCaps = getOGLCapabilities(cfginfo);
ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
return new CGLGraphicsConfig(device, pixfmt, cfginfo, caps);
return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
}
public static boolean isCGLAvailable() {
@ -246,8 +257,6 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
} finally {
rq.unlock();
}
updateTotalDisplayBounds();
}
@Override
@ -421,57 +430,15 @@ public final class CGLGraphicsConfig extends CGraphicsConfig
AccelDeviceEventNotifier.removeListener(l);
}
private static final Rectangle totalDisplayBounds = new Rectangle();
private static void updateTotalDisplayBounds() {
synchronized (totalDisplayBounds) {
Rectangle virtualBounds = new Rectangle();
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
for (GraphicsConfiguration gc : gd.getConfigurations()) {
virtualBounds = virtualBounds.union(gc.getBounds());
}
}
totalDisplayBounds.setBounds(virtualBounds);
}
}
// 7160609: GL still fails to create a square texture of this size,
// so we use this value to cap the total display bounds.
native private static int getMaxTextureSize();
@Override
public int getMaxTextureWidth() {
//Temporary disable this logic and use some magic constrain.
/*
int width;
synchronized (totalDisplayBounds) {
if (totalDisplayBounds.width == 0) {
updateTotalDisplayBounds();
}
width = totalDisplayBounds.width;
}
return Math.min(width, getMaxTextureSize());
*/
return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
return Math.max(maxTextureSize / getDevice().getScaleFactor(),
getBounds().width);
}
@Override
public int getMaxTextureHeight() {
//Temporary disable this logic and use some magic constrain.
/*
int height;
synchronized (totalDisplayBounds) {
if (totalDisplayBounds.height == 0) {
updateTotalDisplayBounds();
}
height = totalDisplayBounds.height;
}
return Math.min(height, getMaxTextureSize());
*/
return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
return Math.max(maxTextureSize / getDevice().getScaleFactor(),
getBounds().height);
}
}

View file

@ -168,16 +168,16 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
@Override
public void firePopupMenuWillBecomeVisible() {
super.firePopupMenuWillBecomeVisible();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JPopupMenu popupMenu = getPopupMenu();
if (popupMenu != null) {
if (popupMenu.getInvoker() != LWChoicePeer.this.getTarget()) {
popupMenu.setVisible(false);
popupMenu.show(LWChoicePeer.this.getTarget(), 0, 0);
}
}
SwingUtilities.invokeLater(() -> {
JPopupMenu popupMenu = getPopupMenu();
// Need to override the invoker for proper grab handling
if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
// The popup is now visible with correct location
// Save it and restore after toggling visibility and changing invoker
Point loc = popupMenu.getLocationOnScreen();
SwingUtilities.convertPointFromScreen(loc, this);
popupMenu.setVisible(false);
popupMenu.show(getTarget(), loc.x, loc.y);
}
});
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,17 +28,16 @@ package sun.lwawt;
import java.awt.*;
import java.awt.List;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
import java.awt.dnd.peer.*;
import java.awt.image.*;
import java.awt.peer.*;
import java.security.*;
import java.util.*;
import sun.awt.*;
import sun.lwawt.macosx.*;
import sun.print.*;
import static sun.lwawt.LWWindowPeer.PeerType;
public abstract class LWToolkit extends SunToolkit implements Runnable {
private final static int STATE_NONE = 0;
@ -114,7 +113,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
/*
* Sends a request to stop the message pump.
*/
public void shutdown() {
public final void shutdown() {
setRunState(STATE_SHUTDOWN);
platformShutdown();
}
@ -145,7 +144,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
notifyAll();
}
public boolean isTerminating() {
public final boolean isTerminating() {
return getRunState() >= STATE_SHUTDOWN;
}
@ -162,7 +161,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
}
public void run() {
@Override
public final void run() {
setRunState(STATE_INIT);
platformInit();
AWTAutoShutdown.notifyToolkitThreadFree();
@ -214,80 +214,51 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
* Note that LWWindowPeer implements WindowPeer, FramePeer
* and DialogPeer interfaces.
*/
private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent,
PlatformWindow platformWindow, LWWindowPeer.PeerType peerType)
{
protected LWWindowPeer createDelegatedPeer(Window target,
PlatformComponent platformComponent,
PlatformWindow platformWindow,
PeerType peerType) {
LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType);
targetCreatedPeer(target, peer);
peer.initialize();
return peer;
}
private LWLightweightFramePeer createDelegatedLwPeer(LightweightFrame target,
PlatformComponent platformComponent,
PlatformWindow platformWindow)
{
LWLightweightFramePeer peer = new LWLightweightFramePeer(target, platformComponent, platformWindow);
@Override
public final FramePeer createLightweightFrame(LightweightFrame target) {
PlatformComponent platformComponent = createLwPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.LW_FRAME);
LWLightweightFramePeer peer = new LWLightweightFramePeer(target,
platformComponent,
platformWindow);
targetCreatedPeer(target, peer);
peer.initialize();
return peer;
}
@Override
public FramePeer createLightweightFrame(LightweightFrame target) {
PlatformComponent platformComponent = createLwPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.LW_FRAME);
return createDelegatedLwPeer(target, platformComponent, platformWindow);
public final WindowPeer createWindow(Window target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.SIMPLEWINDOW);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.SIMPLEWINDOW);
}
@Override
public WindowPeer createWindow(Window target) {
public final FramePeer createFrame(Frame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW);
}
@Override
public FramePeer createFrame(Frame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.FRAME);
}
public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME);
}
public LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
}
CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
targetCreatedPeer(target, peer);
return peer;
PlatformWindow platformWindow = createPlatformWindow(PeerType.FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.FRAME);
}
@Override
public DialogPeer createDialog(Dialog target) {
if (target instanceof CPrinterDialog) {
return createCPrinterDialog((CPrinterDialog)target);
}
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.DIALOG);
}
@Override
public FileDialogPeer createFileDialog(FileDialog target) {
public final FileDialogPeer createFileDialog(FileDialog target) {
FileDialogPeer peer = createFileDialogPeer(target);
targetCreatedPeer(target, peer);
return peer;
@ -296,7 +267,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
// ---- LIGHTWEIGHT COMPONENT PEERS ---- //
@Override
public ButtonPeer createButton(Button target) {
public final ButtonPeer createButton(Button target) {
PlatformComponent platformComponent = createPlatformComponent();
LWButtonPeer peer = new LWButtonPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -305,7 +276,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public CheckboxPeer createCheckbox(Checkbox target) {
public final CheckboxPeer createCheckbox(Checkbox target) {
PlatformComponent platformComponent = createPlatformComponent();
LWCheckboxPeer peer = new LWCheckboxPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -314,12 +285,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
throw new RuntimeException("not implemented");
}
@Override
public ChoicePeer createChoice(Choice target) {
public final ChoicePeer createChoice(Choice target) {
PlatformComponent platformComponent = createPlatformComponent();
LWChoicePeer peer = new LWChoicePeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -328,7 +294,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public LabelPeer createLabel(Label target) {
public final LabelPeer createLabel(Label target) {
PlatformComponent platformComponent = createPlatformComponent();
LWLabelPeer peer = new LWLabelPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -337,7 +303,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public CanvasPeer createCanvas(Canvas target) {
public final CanvasPeer createCanvas(Canvas target) {
PlatformComponent platformComponent = createPlatformComponent();
LWCanvasPeer<?, ?> peer = new LWCanvasPeer<>(target, platformComponent);
targetCreatedPeer(target, peer);
@ -346,7 +312,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public ListPeer createList(List target) {
public final ListPeer createList(List target) {
PlatformComponent platformComponent = createPlatformComponent();
LWListPeer peer = new LWListPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -355,22 +321,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public MenuPeer createMenu(Menu target) {
throw new RuntimeException("not implemented");
}
@Override
public MenuBarPeer createMenuBar(MenuBar target) {
throw new RuntimeException("not implemented");
}
@Override
public MenuItemPeer createMenuItem(MenuItem target) {
throw new RuntimeException("not implemented");
}
@Override
public PanelPeer createPanel(Panel target) {
public final PanelPeer createPanel(Panel target) {
PlatformComponent platformComponent = createPlatformComponent();
LWPanelPeer peer = new LWPanelPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -379,12 +330,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public PopupMenuPeer createPopupMenu(PopupMenu target) {
throw new RuntimeException("not implemented");
}
@Override
public ScrollPanePeer createScrollPane(ScrollPane target) {
public final ScrollPanePeer createScrollPane(ScrollPane target) {
PlatformComponent platformComponent = createPlatformComponent();
LWScrollPanePeer peer = new LWScrollPanePeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -393,7 +339,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public ScrollbarPeer createScrollbar(Scrollbar target) {
public final ScrollbarPeer createScrollbar(Scrollbar target) {
PlatformComponent platformComponent = createPlatformComponent();
LWScrollBarPeer peer = new LWScrollBarPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -402,7 +348,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public TextAreaPeer createTextArea(TextArea target) {
public final TextAreaPeer createTextArea(TextArea target) {
PlatformComponent platformComponent = createPlatformComponent();
LWTextAreaPeer peer = new LWTextAreaPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -411,7 +357,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public TextFieldPeer createTextField(TextField target) {
public final TextFieldPeer createTextField(TextField target) {
PlatformComponent platformComponent = createPlatformComponent();
LWTextFieldPeer peer = new LWTextFieldPeer(target, platformComponent);
targetCreatedPeer(target, peer);
@ -422,56 +368,51 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
// ---- NON-COMPONENT PEERS ---- //
@Override
public ColorModel getColorModel() throws HeadlessException {
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getColorModel();
public final ColorModel getColorModel() throws HeadlessException {
return GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice()
.getDefaultConfiguration().getColorModel();
}
@Override
public boolean isDesktopSupported() {
public final boolean isDesktopSupported() {
return true;
}
@Override
protected DesktopPeer createDesktopPeer(Desktop target) {
return new CDesktopPeer();
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) {
DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
return dscp;
}
@Override
public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
public final KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
return LWKeyboardFocusManagerPeer.getInstance();
}
@Override
public synchronized MouseInfoPeer getMouseInfoPeer() {
public final synchronized MouseInfoPeer getMouseInfoPeer() {
if (mouseInfoPeer == null) {
mouseInfoPeer = createMouseInfoPeerImpl();
}
return mouseInfoPeer;
}
protected MouseInfoPeer createMouseInfoPeerImpl() {
protected final MouseInfoPeer createMouseInfoPeerImpl() {
return new LWMouseInfoPeer();
}
public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) {
@Override
public final PrintJob getPrintJob(Frame frame, String doctitle,
Properties props) {
return getPrintJob(frame, doctitle, null, null);
}
public PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {
@Override
public final PrintJob getPrintJob(Frame frame, String doctitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes) {
if (GraphicsEnvironment.isHeadless()) {
throw new IllegalArgumentException();
}
PrintJob2D printJob = new PrintJob2D(frame, doctitle, jobAttributes, pageAttributes);
if (printJob.printDialog() == false) {
if (!printJob.printDialog()) {
printJob = null;
}
@ -479,27 +420,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
throw new RuntimeException("not implemented");
}
@Override
public boolean isTraySupported() {
throw new RuntimeException("not implemented");
}
@Override
public SystemTrayPeer createSystemTray(SystemTray target) {
throw new RuntimeException("not implemented");
}
@Override
public TrayIconPeer createTrayIcon(TrayIcon target) {
throw new RuntimeException("not implemented");
}
@Override
public Clipboard getSystemClipboard() {
public final Clipboard getSystemClipboard() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
@ -513,7 +434,8 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
return clipboard;
}
protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
protected abstract SecurityWarningWindow createSecurityWarning(
Window ownerWindow, LWWindowPeer ownerPeer);
// ---- DELEGATES ---- //
@ -522,7 +444,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
/*
* Creates a delegate for the given peer type (window, frame, dialog, etc.)
*/
protected abstract PlatformWindow createPlatformWindow(LWWindowPeer.PeerType peerType);
protected abstract PlatformWindow createPlatformWindow(PeerType peerType);
protected abstract PlatformComponent createPlatformComponent();
@ -556,7 +478,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public void grab(final Window w) {
public final void grab(final Window w) {
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
((LWWindowPeer) peer).grab();
@ -564,7 +486,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public void ungrab(final Window w) {
public final void ungrab(final Window w) {
final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
if (peer != null) {
((LWWindowPeer) peer).ungrab(false);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -629,6 +629,7 @@ public class LWWindowPeer
final boolean isNewDevice = updateGraphicsDevice();
if (resized || isNewDevice) {
replaceSurfaceData();
updateMinimumSize();
}
// Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
@ -1046,7 +1047,9 @@ public class LWWindowPeer
@Override
public final void displayChanged() {
updateGraphicsDevice();
if (updateGraphicsDevice()) {
updateMinimumSize();
}
// Replace surface unconditionally, because internal state of the
// GraphicsDevice could be changed.
replaceSurfaceData();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,20 +40,23 @@ import sun.awt.datatransfer.*;
* sun.awt.datatransfer.DataTransferer.
*/
public class CClipboard extends SunClipboard {
final class CClipboard extends SunClipboard {
public CClipboard(String name) {
super(name);
}
@Override
public long getID() {
return 0;
}
@Override
protected void clearNativeContext() {
// Leaving Empty, as WClipboard.clearNativeContext is empty as well.
}
@Override
protected void setContentsNative(Transferable contents) {
// Don't use delayed Clipboard rendering for the Transferable's data.
@ -89,6 +92,39 @@ public class CClipboard extends SunClipboard {
notifyChanged();
}
@Override
protected native long[] getClipboardFormats();
@Override
protected native byte[] getClipboardData(long format) throws IOException;
// 1.5 peer method
@Override
protected void unregisterClipboardViewerChecked() {
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
@Override
protected void registerClipboardViewerChecked() {
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
// no-op. This appears to be win32 specific. Filed 4048790 for investigation
//protected Transferable createLocaleTransferable(long[] formats) throws IOException;
private native void declareTypes(long[] formats, SunClipboard newOwner);
private native void setData(byte[] data, long format);
/**
* Invokes native check whether a change count on the general pasteboard is different
* than when we set it. The different count value means the current owner lost
* pasteboard ownership and someone else put data on the clipboard.
* @since 1.7
*/
native void checkPasteboard();
/*** Native Callbacks ***/
private void notifyLostOwnership() {
lostOwnershipImpl();
}
@ -100,32 +136,4 @@ public class CClipboard extends SunClipboard {
}
clipboard.checkChange(clipboard.getClipboardFormats());
}
protected native long[] getClipboardFormats();
protected native byte[] getClipboardData(long format) throws IOException;
// 1.5 peer method
protected void unregisterClipboardViewerChecked() {
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
protected void registerClipboardViewerChecked() {
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
// no-op. This appears to be win32 specific. Filed 4048790 for investigation
//protected Transferable createLocaleTransferable(long[] formats) throws IOException;
public native void declareTypes(long[] formats, SunClipboard newOwner);
public native void setData(byte[] data, long format);
/**
* Invokes native check whether a change count on the general pasteboard is different
* than when we set it. The different count value means the current owner lost
* pasteboard ownership and someone else put data on the clipboard.
* @since 1.7
*/
public native void checkPasteboard();
}

View file

@ -38,6 +38,8 @@ public class CCustomCursor extends Cursor {
Image fImage;
Point fHotspot;
int fWidth;
int fHeight;
public CCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
super(name);
@ -50,6 +52,7 @@ public class CCustomCursor extends Cursor {
// Make sure image is fully loaded.
final Component c = new Canvas(); // for its imageUpdate method
final MediaTracker tracker = new MediaTracker(c);
// MediaTracker loads resolution variants from MultiResolution Toolkit image
tracker.addImage(fImage, 0);
try {
tracker.waitForAll();
@ -67,15 +70,15 @@ public class CCustomCursor extends Cursor {
width = height = 1;
fImage = createTransparentImage(width, height);
} else {
// Scale image to nearest supported size
// Get the nearest supported cursor size
final Dimension nativeSize = toolkit.getBestCursorSize(width, height);
if (nativeSize.width != width || nativeSize.height != height) {
fImage = fImage.getScaledInstance(nativeSize.width, nativeSize.height, Image.SCALE_DEFAULT);
width = nativeSize.width;
height = nativeSize.height;
}
width = nativeSize.width;
height = nativeSize.height;
}
fWidth = width;
fHeight = height;
// NOTE: this was removed for 3169146, but in 1.5 the JCK tests for an exception and fails if one isn't thrown.
// See what JBuilder does.
// Verify that the hotspot is within cursor bounds.
@ -138,6 +141,7 @@ public class CCustomCursor extends Cursor {
// failed to do its job. Return null to keep the cursor unchanged.
return 0L;
} else {
fCImage.resizeRepresentations(fWidth, fHeight);
return fCImage.ptr;
}
} catch (IllegalArgumentException iae) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,11 +56,11 @@ public class CDataTransferer extends DataTransferer {
};
static {
Map<String, Long> nameMap = new HashMap<String, Long>(predefinedClipboardNames.length, 1.0f);
Map<Long, String> formatMap = new HashMap<Long, String>(predefinedClipboardNames.length, 1.0f);
Map<String, Long> nameMap = new HashMap<>(predefinedClipboardNames.length, 1.0f);
Map<Long, String> formatMap = new HashMap<>(predefinedClipboardNames.length, 1.0f);
for (int i = 1; i < predefinedClipboardNames.length; i++) {
nameMap.put(predefinedClipboardNames[i], new Long(i));
formatMap.put(new Long(i), predefinedClipboardNames[i]);
nameMap.put(predefinedClipboardNames[i], (long) i);
formatMap.put((long) i, predefinedClipboardNames[i]);
}
predefinedClipboardNameMap = Collections.synchronizedMap(nameMap);
predefinedClipboardFormatMap = Collections.synchronizedMap(formatMap);
@ -77,19 +77,11 @@ public class CDataTransferer extends DataTransferer {
public static final int CF_PNG = 10;
public static final int CF_JPEG = 11;
public static final Long L_CF_TIFF = predefinedClipboardNameMap.get(predefinedClipboardNames[CF_TIFF]);
// Image file formats with java.awt.Image representation:
private static final Long[] imageFormats = new Long[] {
L_CF_TIFF
};
private CDataTransferer() {}
private static CDataTransferer fTransferer;
public static synchronized CDataTransferer getInstanceImpl() {
static synchronized CDataTransferer getInstanceImpl() {
if (fTransferer == null) {
fTransferer = new CDataTransferer();
}
@ -97,18 +89,22 @@ public class CDataTransferer extends DataTransferer {
return fTransferer;
}
@Override
public String getDefaultUnicodeEncoding() {
return "utf-16le";
}
@Override
public boolean isLocaleDependentTextFormat(long format) {
return format == CF_STRING;
}
@Override
public boolean isFileFormat(long format) {
return format == CF_FILE;
}
@Override
public boolean isImageFormat(long format) {
int ifmt = (int)format;
switch(ifmt) {
@ -122,43 +118,12 @@ public class CDataTransferer extends DataTransferer {
}
}
protected Long[] getImageFormatsAsLongArray() {
return imageFormats;
}
public byte[] translateTransferable(Transferable contents, DataFlavor flavor, long format) throws IOException
{
byte[] bytes = super.translateTransferable(contents, flavor, format);
// 9-12-02 VL: we may need to do something like Windows here.
//if (format == CF_HTML) {
// bytes = HTMLSupport.convertToHTMLFormat(bytes);
//}
return bytes;
}
protected Object translateBytesOrStream(InputStream stream, byte[] bytes, DataFlavor flavor, long format,
Transferable transferable) throws IOException
{
// 5-28-03 VL: [Radar 3266030]
// We need to do like Windows does here.
if (format == CF_HTML && flavor.isFlavorTextType()) {
if (stream == null) {
stream = new ByteArrayInputStream(bytes);
bytes = null;
}
stream = new HTMLDecodingInputStream(stream);
}
@Override
public Object translateBytes(byte[] bytes, DataFlavor flavor,
long format, Transferable transferable) throws IOException {
if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
{
if (bytes == null) {
bytes = inputStreamToByteArray(stream);
stream = null;
}
String charset = getDefaultTextCharset();
if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
try {
@ -175,9 +140,9 @@ public class CDataTransferer extends DataTransferer {
}
return super.translateBytes(bytes, flavor, format, transferable);
}
}
@Override
synchronized protected Long getFormatForNativeAsLong(String str) {
Long format = predefinedClipboardNameMap.get(str);
@ -202,6 +167,7 @@ public class CDataTransferer extends DataTransferer {
// Get registered native format string for an index, return null if unknown:
private native String formatForIndex(long index);
@Override
protected String getNativeForFormat(long format) {
String returnValue = null;
@ -209,7 +175,7 @@ public class CDataTransferer extends DataTransferer {
if (format >= 0 && format < predefinedClipboardNames.length) {
returnValue = predefinedClipboardNames[(int) format];
} else {
Long formatObj = new Long(format);
Long formatObj = format;
returnValue = predefinedClipboardFormatMap.get(formatObj);
// predefinedClipboardFormatMap may not know this format:
@ -233,10 +199,13 @@ public class CDataTransferer extends DataTransferer {
private final ToolkitThreadBlockedHandler handler = new CToolkitThreadBlockedHandler();
@Override
public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
return handler;
}
private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
@Override
protected byte[] imageToPlatformBytes(Image image, long format) {
int w = image.getWidth(null);
int h = image.getHeight(null);
@ -252,32 +221,28 @@ public class CDataTransferer extends DataTransferer {
}
private static native String[] nativeDragQueryFile(final byte[] bytes);
@Override
protected String[] dragQueryFile(final byte[] bytes) {
if (bytes == null) return null;
if (new String(bytes).startsWith("Unsupported type")) return null;
return nativeDragQueryFile(bytes);
}
private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
private native Image getImageForByteStream(byte[] bytes);
/**
* Translates a byte array which contains
* platform-specific image data in the given format into an Image.
*/
protected Image platformImageBytesToImage(byte[] bytes, long format)
throws IOException
{
@Override
protected Image platformImageBytesToImage(byte[] bytes, long format) throws IOException {
return getImageForByteStream(bytes);
}
private native Image getImageForByteStream(byte[] bytes);
@Override
protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
for (int i = 0; i < fileList.size(); i++)
{
byte[] bytes = fileList.get(i).getBytes();
for (String file : fileList) {
byte[] bytes = file.getBytes();
bos.write(bytes, 0, bytes.length);
bos.write(0);
}
@ -303,246 +268,3 @@ public class CDataTransferer extends DataTransferer {
}
// ---- Code borrowed from WDataTransferer: ----
// This will come handy for supporting HTML data.
final class HTMLSupport {
public static final String ENCODING = "UTF-8";
public static final String VERSION = "Version:";
public static final String START_HTML = "StartHTML:";
public static final String END_HTML = "EndHTML:";
public static final String START_FRAGMENT = "StartFragment:";
public static final String END_FRAGMENT = "EndFragment:";
public static final String START_FRAGMENT_CMT = "<!--StartFragment-->";
public static final String END_FRAGMENT_CMT = "<!--EndFragment-->";
public static final String EOLN = "\r\n";
private static final String VERSION_NUM = "0.9";
private static final String HTML_START_END = "-1";
private static final int PADDED_WIDTH = 10;
private static final int HEADER_LEN =
VERSION.length() + VERSION_NUM.length() + EOLN.length() +
START_HTML.length() + HTML_START_END.length() + EOLN.length() +
END_HTML.length() + HTML_START_END.length() + EOLN.length() +
START_FRAGMENT.length() + PADDED_WIDTH + EOLN.length() +
END_FRAGMENT.length() + PADDED_WIDTH + EOLN.length() +
START_FRAGMENT_CMT.length() + EOLN.length();
private static final String HEADER_LEN_STR =
toPaddedString(HEADER_LEN, PADDED_WIDTH);
private static final String TRAILER = END_FRAGMENT_CMT + EOLN + '\0';
private static String toPaddedString(int n, int width) {
String string = "" + n;
int len = string.length();
if (n >= 0 && len < width) {
char[] array = new char[width - len];
Arrays.fill(array, '0');
StringBuffer buffer = new StringBuffer();
buffer.append(array);
buffer.append(string);
string = buffer.toString();
}
return string;
}
public static byte[] convertToHTMLFormat(byte[] bytes) {
StringBuffer header = new StringBuffer(HEADER_LEN);
header.append(VERSION);
header.append(VERSION_NUM);
header.append(EOLN);
header.append(START_HTML);
header.append(HTML_START_END);
header.append(EOLN);
header.append(END_HTML);
header.append(HTML_START_END);
header.append(EOLN);
header.append(START_FRAGMENT);
header.append(HEADER_LEN_STR);
header.append(EOLN);
header.append(END_FRAGMENT);
// Strip terminating NUL byte from array
header.append(toPaddedString(HEADER_LEN + bytes.length - 1,
PADDED_WIDTH));
header.append(EOLN);
header.append(START_FRAGMENT_CMT);
header.append(EOLN);
byte[] headerBytes = null, trailerBytes = null;
try {
headerBytes = new String(header).getBytes(ENCODING);
trailerBytes = TRAILER.getBytes(ENCODING);
} catch (UnsupportedEncodingException cannotHappen) {
}
byte[] retval = new byte[headerBytes.length + bytes.length - 1 +
trailerBytes.length];
System.arraycopy(headerBytes, 0, retval, 0, headerBytes.length);
System.arraycopy(bytes, 0, retval, headerBytes.length,
bytes.length - 1);
System.arraycopy(trailerBytes, 0, retval,
headerBytes.length + bytes.length - 1,
trailerBytes.length);
return retval;
}
}
/**
* This stream takes an InputStream which provides data in CF_HTML format,
* strips off the description and context to extract the original HTML data.
*/
class HTMLDecodingInputStream extends InputStream {
private final BufferedInputStream bufferedStream;
private boolean descriptionParsed = false;
private boolean closed = false;
private int index;
private int end;
// InputStreamReader uses an 8K buffer. The size is not customizable.
public static final int BYTE_BUFFER_LEN = 8192;
// CharToByteUTF8.getMaxBytesPerChar returns 3, so we should not buffer
// more chars than 3 times the number of bytes we can buffer.
public static final int CHAR_BUFFER_LEN = BYTE_BUFFER_LEN / 3;
private static final String FAILURE_MSG =
"Unable to parse HTML description: ";
private static final String INVALID_MSG = " invalid";
public HTMLDecodingInputStream(InputStream bytestream) throws IOException {
bufferedStream = new BufferedInputStream(bytestream, BYTE_BUFFER_LEN);
}
private void parseDescription() throws IOException {
bufferedStream.mark(BYTE_BUFFER_LEN);
BufferedReader bufferedReader = new BufferedReader
(new InputStreamReader(bufferedStream, HTMLSupport.ENCODING),
CHAR_BUFFER_LEN);
String version = bufferedReader.readLine().trim();
if (version == null || !version.startsWith(HTMLSupport.VERSION)) {
// Not MS-compliant HTML text. Return raw text from read().
index = 0;
end = -1;
bufferedStream.reset();
return;
}
String input;
boolean startHTML, endHTML, startFragment, endFragment;
startHTML = endHTML = startFragment = endFragment = false;
try {
do {
input = bufferedReader.readLine().trim();
if (input == null) {
close();
throw new IOException(FAILURE_MSG);
} else if (input.startsWith(HTMLSupport.START_HTML)) {
int val = Integer.parseInt
(input.substring(HTMLSupport.START_HTML.length(),
input.length()).trim());
if (val >= 0) {
index = val;
startHTML = true;
} else if (val != -1) {
close();
throw new IOException(FAILURE_MSG +
HTMLSupport.START_HTML +
INVALID_MSG);
}
} else if (input.startsWith(HTMLSupport.END_HTML)) {
int val = Integer.parseInt
(input.substring(HTMLSupport.END_HTML.length(),
input.length()).trim());
if (val >= 0) {
end = val;
endHTML = true;
} else if (val != -1) {
close();
throw new IOException(FAILURE_MSG +
HTMLSupport.END_HTML +
INVALID_MSG);
}
} else if (!startHTML && !endHTML &&
input.startsWith(HTMLSupport.START_FRAGMENT)) {
index = Integer.parseInt
(input.substring(HTMLSupport.START_FRAGMENT.length(),
input.length()).trim());
if (index < 0) {
close();
throw new IOException(FAILURE_MSG +
HTMLSupport.START_FRAGMENT +
INVALID_MSG);
}
startFragment = true;
} else if (!startHTML && !endHTML &&
input.startsWith(HTMLSupport.END_FRAGMENT)) {
end = Integer.parseInt
(input.substring(HTMLSupport.END_FRAGMENT.length(),
input.length()).trim());
if (end < 0) {
close();
throw new IOException(FAILURE_MSG +
HTMLSupport.END_FRAGMENT +
INVALID_MSG);
}
endFragment = true;
}
} while (!((startHTML && endHTML) ||
(startFragment && endFragment)));
} catch (NumberFormatException e) {
close();
throw new IOException(FAILURE_MSG + e);
}
bufferedStream.reset();
for (int i = 0; i < index; i++) {
if (bufferedStream.read() == -1) {
close();
throw new IOException(FAILURE_MSG +
"Byte stream ends in description.");
}
}
}
public int read() throws IOException {
if (closed) {
throw new IOException("Stream closed");
}
if (!descriptionParsed) {
parseDescription(); // initializes 'index' and 'end'
descriptionParsed = true;
}
if (end != -1 && index >= end) {
return -1;
}
int retval = bufferedStream.read();
if (retval == -1) {
index = end = 0; // so future read() calls will fail quickly
return -1;
}
index++;
// System.out.print((char)retval);
return retval;
}
public void close() throws IOException {
if (!closed) {
closed = true;
bufferedStream.close();
}
}
}

View file

@ -141,7 +141,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
// Create native dragging source:
final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
(int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
clickCount, timestamp, fDragCImage, dragImageOffset.x, dragImageOffset.y,
clickCount, timestamp, fDragCImage != null ? fDragCImage.ptr : 0L, dragImageOffset.x, dragImageOffset.y,
getDragSourceContext().getSourceActions(), formats, formatMap);
if (nativeDragSource == 0)
@ -484,7 +484,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
// Native support:
private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable,
InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp,
CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY,
long nsDragImagePtr, int dragImageOffsetX, int dragImageOffsetY,
int sourceActions, long[] formats, Map formatMap);
private native void doDragging(long nativeDragSource);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,17 +23,15 @@
* questions.
*/
package sun.lwawt.macosx;
import sun.lwawt.LWToolkit;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.CocoaConstants;
import sun.lwawt.macosx.event.NSEvent;
import java.awt.AWTKeyStroke;
import java.awt.Point;
import java.awt.Toolkit;
import sun.awt.EmbeddedFrame;
import java.awt.*;
import java.awt.event.*;
import sun.lwawt.LWWindowPeer;
public class CEmbeddedFrame extends EmbeddedFrame {
@ -48,7 +46,7 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public void addNotify() {
if (getPeer() == null) {
LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
setPeer(peer);
responder = new CPlatformResponder(peer, true);

View file

@ -46,17 +46,16 @@ class CFileDialog implements FileDialogPeer {
@Override
public void run() {
try {
boolean navigateApps = false;
boolean navigateApps = !AccessController.doPrivileged(
new GetBooleanAction("apple.awt.use-file-dialog-packages"));
boolean chooseDirectories = AccessController.doPrivileged(
new GetBooleanAction("apple.awt.fileDialogForDirectories"));
int dialogMode = target.getMode();
navigateApps = true;
String title = target.getTitle();
if (title == null) {
title = " ";
}
Boolean chooseDirectories = AccessController.doPrivileged(
new GetBooleanAction("apple.awt.fileDialogForDirectories"));
String[] userFileNames = nativeRunFileDialog(title,
dialogMode,

View file

@ -31,6 +31,7 @@ import java.awt.image.*;
import java.util.Arrays;
import java.util.List;
import sun.awt.image.MultiResolutionImage;
import sun.awt.image.SunWritableRaster;
@ -44,6 +45,7 @@ public class CImage extends CFRetainedResource {
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int w, int h);
private static native Dimension2D nativeGetNSImageSize(long image);
private static native void nativeSetNSImageSize(long image, double w, double h);
private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
static Creator creator = new Creator();
static Creator getCreator() {
@ -145,6 +147,12 @@ public class CImage extends CFRetainedResource {
// This is used to create a CImage from a Image
public CImage createFromImage(final Image image) {
if (image instanceof MultiResolutionImage) {
List<Image> resolutionVariants
= ((MultiResolutionImage) image).getResolutionVariants();
return createFromImages(resolutionVariants);
}
int[] buffer = imageToArray(image, true);
if (buffer == null) {
return null;
@ -223,4 +231,8 @@ public class CImage extends CFRetainedResource {
if (ptr != 0) nativeSetNSImageSize(ptr, w, h);
return this;
}
void resizeRepresentations(double w, double h) {
if (ptr != 0) nativeResizeNSImageRepresentations(ptr, w, h);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ package sun.lwawt.macosx;
import sun.awt.SunToolkit;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.PlatformEventNotifier;
import sun.lwawt.macosx.event.NSEvent;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.InputEvent;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,6 @@ import java.awt.geom.Rectangle2D;
import sun.awt.CGraphicsConfig;
import sun.awt.CGraphicsEnvironment;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.event.NSEvent;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLLayer;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -583,7 +583,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// setVisible could have changed the native maximized state
deliverZoom(true);
} else {
switch (((Frame)target).getExtendedState()) {
int frameState = ((Frame)target).getExtendedState();
if ((frameState & Frame.ICONIFIED) != 0) {
// Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
frameState = Frame.ICONIFIED;
}
switch (frameState) {
case Frame.ICONIFIED:
CWrapper.NSWindow.miniaturize(nsWindowPtr);
break;
@ -608,9 +613,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Add myself as a child
if (owner != null && owner.isVisible()) {
CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
if (target.isAlwaysOnTop()) {
CWrapper.NSWindow.setLevel(nsWindowPtr, CWrapper.NSWindow.NSFloatingWindowLevel);
}
applyWindowLevel(target);
}
// Add my own children to myself
@ -620,9 +623,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
if (pw != null && pw.isVisible()) {
CWrapper.NSWindow.addChildWindow(nsWindowPtr, pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove);
if (w.isAlwaysOnTop()) {
CWrapper.NSWindow.setLevel(pw.getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
}
pw.applyWindowLevel(w);
}
}
}
@ -788,6 +789,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
if (prevWindowState == windowState) return;
final long nsWindowPtr = getNSWindowPtr();
if ((windowState & Frame.ICONIFIED) != 0) {
// Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
windowState = Frame.ICONIFIED;
}
switch (windowState) {
case Frame.ICONIFIED:
if (prevWindowState == Frame.MAXIMIZED_BOTH) {
@ -1041,8 +1046,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
CWrapper.NSWindow.addChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove);
}
if (target.isAlwaysOnTop()) {
applyWindowLevel(target);
}
protected void applyWindowLevel(Window target) {
if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) {
CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
} else if (target.getType() == Window.Type.POPUP) {
CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSPopUpMenuWindowLevel);
}
}

View file

@ -41,7 +41,7 @@ import javax.print.attribute.standard.PageRanges;
import sun.java2d.*;
import sun.print.*;
public class CPrinterJob extends RasterPrinterJob {
final class CPrinterJob extends RasterPrinterJob {
// NOTE: This uses RasterPrinterJob as a base, but it doesn't use
// all of the RasterPrinterJob functions. RasterPrinterJob will
// break down printing to pieces that aren't necessary under MacOSX
@ -89,6 +89,7 @@ public class CPrinterJob extends RasterPrinterJob {
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
@Override
public boolean printDialog() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
@ -131,6 +132,7 @@ public class CPrinterJob extends RasterPrinterJob {
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.2
*/
@Override
public PageFormat pageDialog(PageFormat page) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
@ -156,12 +158,14 @@ public class CPrinterJob extends RasterPrinterJob {
* @return clone of <code>page</code>, altered to describe a default
* <code>PageFormat</code>.
*/
@Override
public PageFormat defaultPage(PageFormat page) {
PageFormat newPage = (PageFormat)page.clone();
getDefaultPage(newPage);
return newPage;
}
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
super.setAttributes(attributes);
@ -216,7 +220,7 @@ public class CPrinterJob extends RasterPrinterJob {
}
}
@Override
public void print(PrintRequestAttributeSet attributes) throws PrinterException {
// NOTE: Some of this code is copied from RasterPrinterJob.
@ -343,6 +347,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch across the width
* of the page.
*/
@Override
protected double getXRes() {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -352,6 +357,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch down the height
* of the page.
*/
@Override
protected double getYRes() {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -362,6 +368,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableX(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -372,6 +379,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableY(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -382,6 +390,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableWidth(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -392,6 +401,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPrintableHeight(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -402,6 +412,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPageWidth(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -412,6 +423,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected double getPhysicalPageHeight(Paper p) {
// NOTE: This is not used in the CPrinterJob code path.
return 0;
@ -429,6 +441,7 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* End a page.
*/
@Override
protected void endPage(PageFormat format, Printable painter, int index) throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
@ -441,6 +454,7 @@ public class CPrinterJob extends RasterPrinterJob {
* page. The width and height of the band is
* specified by the caller.
*/
@Override
protected void printBand(byte[] data, int x, int y, int width, int height) throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
@ -450,6 +464,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the start of
* a print job.
*/
@Override
protected void startDoc() throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
@ -459,12 +474,14 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the end of
* a print job.
*/
@Override
protected void endDoc() throws PrinterException {
// NOTE: This is not used in the CPrinterJob code path.
throw new PrinterException(sShouldNotReachHere);
}
/* Called by cancelDoc */
@Override
protected native void abortDoc();
/**
@ -502,10 +519,12 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* validate the paper size against the current printer.
*/
@Override
protected native void validatePaper(Paper origPaper, Paper newPaper );
// The following methods are CPrinterJob specific.
@Override
protected void finalize() {
if (fNSPrintInfo != -1) {
dispose(fNSPrintInfo);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import java.awt.*;
import java.awt.print.*;
public class CPrinterJobDialog extends CPrinterDialog {
final class CPrinterJobDialog extends CPrinterDialog {
private Pageable fPageable;
private boolean fAllowPrintToFile;
@ -39,5 +39,6 @@ public class CPrinterJobDialog extends CPrinterDialog {
fAllowPrintToFile = allowPrintToFile;
}
@Override
protected native boolean showDialog();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import java.awt.*;
import java.awt.print.*;
public class CPrinterPageDialog extends CPrinterDialog {
final class CPrinterPageDialog extends CPrinterDialog {
private PageFormat fPage;
private Printable fPainter;
@ -39,5 +39,6 @@ public class CPrinterPageDialog extends CPrinterDialog {
fPainter = painter;
}
@Override
protected native boolean showDialog();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,11 +40,11 @@ public class CPrinterSurfaceData extends OSXSurfaceData{
// public static final SurfaceType IntArgbPQ = SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_PQ);
public static final SurfaceType IntRgbPQ = SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_PQ);
public static SurfaceData createData(PageFormat pf, long context) {
static SurfaceData createData(PageFormat pf, long context) {
return new CPrinterSurfaceData(CPrinterGraphicsConfig.getConfig(pf), context);
}
public CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
private CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
super(IntRgbPQ, gc.getColorModel(), gc, gc.getBounds());
initOps(context, this.fGraphicsStates, this.fGraphicsStatesObject, gc.getBounds().width, gc.getBounds().height);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,6 @@ package sun.lwawt.macosx;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import sun.lwawt.macosx.event.NSEvent;
import javax.swing.*;
import java.awt.*;
@ -76,8 +75,9 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
menuPeer = (CPopupMenu)popup.getPeer();
if (menuPeer == null) {
popup.addNotify();
menuPeer = (CPopupMenu)popup.getPeer();
}
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
@ -97,7 +97,12 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
//invocation from the AWTTrayIcon.m
public long getPopupMenuModel(){
if(popup == null) {
return 0L;
PopupMenu popupMenu = target.getPopupMenu();
if (popupMenu != null) {
popup = popupMenu;
} else {
return 0L;
}
}
return checkAndCreatePopupPeer().getModel();
}
@ -134,6 +139,10 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
dummyFrame.dispose();
if (popup != null) {
popup.removeNotify();
}
LWCToolkit.targetDisposedPeer(target, this);
target = null;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,14 +22,17 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.lwawt.macosx;
import java.awt.AWTKeyStroke;
import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWToolkit;
import sun.lwawt.LWWindowPeer;
/*
* The CViewEmbeddedFrame class is used in the SWT_AWT bridge.
* This is a part of public API and should not be renamed or moved
@ -48,7 +51,7 @@ public class CViewEmbeddedFrame extends EmbeddedFrame {
@Override
public void addNotify() {
if (getPeer() == null) {
LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit();
LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this));
}
super.addNotify();

View file

@ -247,10 +247,7 @@ public final class CWarningWindow extends CPlatformWindow
nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
// do not allow security warning to be obscured by other windows
if (ownerWindow.isAlwaysOnTop()) {
CWrapper.NSWindow.setLevel(nsWindowPtr,
CWrapper.NSWindow.NSFloatingWindowLevel);
}
applyWindowLevel(ownerWindow);
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,73 +25,65 @@
package sun.lwawt.macosx;
import java.awt.geom.Rectangle2D;
public final class CWrapper {
final class CWrapper {
private CWrapper() { }
public static final class NSWindow {
static final class NSWindow {
// NSWindowOrderingMode
public static final int NSWindowAbove = 1;
public static final int NSWindowBelow = -1;
public static final int NSWindowOut = 0;
static final int NSWindowAbove = 1;
static final int NSWindowBelow = -1;
static final int NSWindowOut = 0;
// Window level constants
// The number of supported levels: (we'll use more in the future)
public static final int MAX_WINDOW_LEVELS = 2;
static final int MAX_WINDOW_LEVELS = 3;
// The levels: (these are NOT real constants, these are keys. See native code.)
public static final int NSNormalWindowLevel = 0;
public static final int NSFloatingWindowLevel = 1;
static final int NSNormalWindowLevel = 0;
static final int NSFloatingWindowLevel = 1;
static final int NSPopUpMenuWindowLevel = 2;
// 'level' is one of the keys defined above
public static native void setLevel(long window, int level);
static native void setLevel(long window, int level);
public static native void makeKeyAndOrderFront(long window);
public static native void makeKeyWindow(long window);
public static native void makeMainWindow(long window);
public static native boolean canBecomeMainWindow(long window);
public static native boolean isKeyWindow(long window);
static native void makeKeyAndOrderFront(long window);
static native void makeKeyWindow(long window);
static native void makeMainWindow(long window);
static native boolean canBecomeMainWindow(long window);
static native boolean isKeyWindow(long window);
public static native void orderFront(long window);
public static native void orderFrontRegardless(long window);
public static native void orderWindow(long window, int ordered, long relativeTo);
public static native void orderOut(long window);
static native void orderFront(long window);
static native void orderFrontRegardless(long window);
static native void orderWindow(long window, int ordered, long relativeTo);
static native void orderOut(long window);
public static native void addChildWindow(long parent, long child, int ordered);
public static native void removeChildWindow(long parent, long child);
static native void addChildWindow(long parent, long child, int ordered);
static native void removeChildWindow(long parent, long child);
public static native void setFrame(long window, int x, int y, int w, int h, boolean display);
static native void setAlphaValue(long window, float alpha);
static native void setOpaque(long window, boolean opaque);
static native void setBackgroundColor(long window, long color);
public static native void setAlphaValue(long window, float alpha);
public static native void setOpaque(long window, boolean opaque);
public static native void setBackgroundColor(long window, long color);
static native void miniaturize(long window);
static native void deminiaturize(long window);
static native boolean isZoomed(long window);
static native void zoom(long window);
public static native void miniaturize(long window);
public static native void deminiaturize(long window);
public static native boolean isZoomed(long window);
public static native void zoom(long window);
public static native void makeFirstResponder(long window, long responder);
static native void makeFirstResponder(long window, long responder);
}
public static final class NSView {
public static native void addSubview(long view, long subview);
public static native void removeFromSuperview(long view);
static final class NSView {
static native void addSubview(long view, long subview);
static native void removeFromSuperview(long view);
public static native void setFrame(long view, int x, int y, int w, int h);
public static native Rectangle2D frame(long view);
public static native long window(long view);
static native void setFrame(long view, int x, int y, int w, int h);
static native long window(long view);
public static native void setHidden(long view, boolean hidden);
static native void setHidden(long view, boolean hidden);
public static native void setToolTip(long view, String msg);
static native void setToolTip(long view, String msg);
}
public static final class NSObject {
public static native void release(long object);
}
public static final class NSColor {
public static native long clearColor();
static final class NSColor {
static native long clearColor();
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,20 +33,25 @@ import java.awt.event.InputEvent;
import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent;
import java.awt.im.InputMethodHighlight;
import java.awt.im.spi.InputMethodDescriptor;
import java.awt.peer.*;
import java.lang.reflect.*;
import java.net.URL;
import java.security.*;
import java.util.*;
import java.util.concurrent.Callable;
import java.net.MalformedURLException;
import sun.awt.*;
import sun.awt.datatransfer.DataTransferer;
import sun.lwawt.*;
import sun.lwawt.LWWindowPeer.PeerType;
import sun.security.action.GetBooleanAction;
import sun.awt.image.MultiResolutionImage;
import sun.util.CoreResourceBundleControl;
class NamedCursor extends Cursor {
final class NamedCursor extends Cursor {
NamedCursor(String name) {
super(name);
}
@ -72,6 +77,7 @@ public final class LWCToolkit extends LWToolkit {
ResourceBundle platformResources = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<ResourceBundle>() {
@Override
public ResourceBundle run() {
ResourceBundle platformResources = null;
try {
@ -109,8 +115,6 @@ public final class LWCToolkit extends LWToolkit {
private static final boolean inAWT;
public LWCToolkit() {
SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer");
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
@ -131,18 +135,20 @@ public final class LWCToolkit extends LWToolkit {
private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
@Override
protected void loadSystemColors(final int[] systemColors) {
if (systemColors == null) return;
loadNativeColors(systemColors, appleColors);
}
private static class AppleSpecificColor extends Color {
int index;
public AppleSpecificColor(int index) {
private final int index;
AppleSpecificColor(int index) {
super(appleColors[index]);
this.index = index;
}
@Override
public int getRGB() {
return appleColors[index];
}
@ -150,31 +156,19 @@ public final class LWCToolkit extends LWToolkit {
/**
* Returns Apple specific colors that we may expose going forward.
*
*/
public static Color getAppleColor(int color) {
return new AppleSpecificColor(color);
}
// This is only called from native code.
static void systemColorsChanged() {
// This is only called from native code.
EventQueue.invokeLater(new Runnable() {
public void run() {
AccessController.doPrivileged (new PrivilegedAction<Object>() {
public Object run() {
try {
final Method updateColorsMethod = SystemColor.class.getDeclaredMethod("updateSystemColors", new Class[0]);
updateColorsMethod.setAccessible(true);
updateColorsMethod.invoke(null, new Object[0]);
} catch (final Throwable e) {
e.printStackTrace();
// swallow this if something goes horribly wrong
}
return null;
}
});
}
});
EventQueue.invokeLater(() -> {
AccessController.doPrivileged ((PrivilegedAction<Object>) () -> {
AWTAccessor.getSystemColorAccessor().updateSystemColors();
return null;
});
});
}
public static LWCToolkit getLWCToolkit() {
@ -190,13 +184,44 @@ public final class LWCToolkit extends LWToolkit {
} else if (peerType == PeerType.LW_FRAME) {
return new CPlatformLWWindow();
} else {
assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
assert (peerType == PeerType.SIMPLEWINDOW
|| peerType == PeerType.DIALOG
|| peerType == PeerType.FRAME);
return new CPlatformWindow();
}
}
LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.EMBEDDED_FRAME);
}
LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.VIEW_EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.VIEW_EMBEDDED_FRAME);
}
private CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
targetCreatedPeer(target, peer);
return peer;
}
@Override
protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) {
public DialogPeer createDialog(Dialog target) {
if (target instanceof CPrinterDialog) {
return createCPrinterDialog((CPrinterDialog)target);
}
return super.createDialog(target);
}
@Override
protected SecurityWarningWindow createSecurityWarning(Window ownerWindow,
LWWindowPeer ownerPeer) {
return new CWarningWindow(ownerWindow, ownerPeer);
}
@ -248,13 +273,11 @@ public final class LWCToolkit extends LWToolkit {
PopupMenuPeer peer = new CPopupMenu(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public SystemTrayPeer createSystemTray(SystemTray target) {
SystemTrayPeer peer = new CSystemTray();
return peer;
return new CSystemTray();
}
@Override
@ -264,57 +287,64 @@ public final class LWCToolkit extends LWToolkit {
return peer;
}
@Override
protected DesktopPeer createDesktopPeer(Desktop target) {
return new CDesktopPeer();
}
@Override
public LWCursorManager getCursorManager() {
return CCursorManager.getInstance();
}
@Override
public Cursor createCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
public Cursor createCustomCursor(final Image cursor, final Point hotSpot,
final String name)
throws IndexOutOfBoundsException, HeadlessException {
return new CCustomCursor(cursor, hotSpot, name);
}
@Override
public Dimension getBestCursorSize(final int preferredWidth, final int preferredHeight) throws HeadlessException {
public Dimension getBestCursorSize(final int preferredWidth,
final int preferredHeight)
throws HeadlessException {
return CCustomCursor.getBestCursorSize(preferredWidth, preferredHeight);
}
@Override
protected void platformCleanup() {
// TODO Auto-generated method stub
}
@Override
protected void platformInit() {
// TODO Auto-generated method stub
}
@Override
protected void platformRunMessage() {
// TODO Auto-generated method stub
}
@Override
protected void platformShutdown() {
// TODO Auto-generated method stub
}
class OSXPlatformFont extends sun.awt.PlatformFont
{
public OSXPlatformFont(String name, int style)
OSXPlatformFont(String name, int style)
{
super(name, style);
}
@Override
protected char getMissingGlyphCharacter()
{
// Follow up for real implementation
return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/
}
}
@Override
public FontPeer getFontPeer(String name, int style) {
return new OSXPlatformFont(name, style);
}
@ -334,7 +364,7 @@ public final class LWCToolkit extends LWToolkit {
@Override
protected void initializeDesktopProperties() {
super.initializeDesktopProperties();
Map <Object, Object> fontHints = new HashMap<Object, Object>();
Map <Object, Object> fontHints = new HashMap<>();
fontHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
@ -355,14 +385,8 @@ public final class LWCToolkit extends LWToolkit {
desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
}
/*
* The method returns true if some events were processed during that timeout.
* @see sun.awt.SunToolkit#syncNativeQueue(long)
*/
@Override
protected boolean syncNativeQueue(long timeout) {
return nativeSyncQueue(timeout);
@ -386,7 +410,6 @@ public final class LWCToolkit extends LWToolkit {
@Override
public void sync() {
// TODO Auto-generated method stub
}
@Override
@ -406,6 +429,7 @@ public final class LWCToolkit extends LWToolkit {
* as Num Lock on PC keyboards is called Clear, doesn't lock
* anything and is used for entirely different purpose.
*/
@Override
public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
switch (keyCode) {
case KeyEvent.VK_NUM_LOCK:
@ -425,10 +449,12 @@ public final class LWCToolkit extends LWToolkit {
//Set to true by default.
private static boolean areExtraMouseButtonsEnabled = true;
@Override
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
return areExtraMouseButtonsEnabled;
}
@Override
public int getNumberOfButtons(){
return BUTTONS;
}
@ -438,6 +464,11 @@ public final class LWCToolkit extends LWToolkit {
return true;
}
@Override
public DataTransferer getDataTransferer() {
return CDataTransferer.getInstanceImpl();
}
@Override
public boolean isAlwaysOnTopSupported() {
return true;
@ -482,6 +513,7 @@ public final class LWCToolkit extends LWToolkit {
* @see java.awt.MenuShortcut
* @since JDK1.1
*/
@Override
public int getMenuShortcutKeyMask() {
return Event.META_MASK;
}
@ -489,13 +521,34 @@ public final class LWCToolkit extends LWToolkit {
@Override
public Image getImage(final String filename) {
final Image nsImage = checkForNSImage(filename);
if (nsImage != null) return nsImage;
if (nsImage != null) {
return nsImage;
}
return super.getImage(filename);
if (imageCached(filename)) {
return super.getImage(filename);
}
String fileneame2x = getScaledImageName(filename);
return (imageExists(fileneame2x))
? getImageWithResolutionVariant(filename, fileneame2x)
: super.getImage(filename);
}
static final String nsImagePrefix = "NSImage://";
protected Image checkForNSImage(final String imageName) {
@Override
public Image getImage(URL url) {
if (imageCached(url)) {
return super.getImage(url);
}
URL url2x = getScaledImageURL(url);
return (imageExists(url2x))
? getImageWithResolutionVariant(url, url2x) : super.getImage(url);
}
private static final String nsImagePrefix = "NSImage://";
private Image checkForNSImage(final String imageName) {
if (imageName == null) return null;
if (!imageName.startsWith(nsImagePrefix)) return null;
return CImage.getCreator().createImageFromName(imageName.substring(nsImagePrefix.length()));
@ -514,8 +567,9 @@ public final class LWCToolkit extends LWToolkit {
synchronized(ret) { return ret[0]; }
}
public static <T> T invokeAndWait(final Callable<T> callable, Component component) throws Exception {
final CallableWrapper<T> wrapper = new CallableWrapper<T>(callable);
public static <T> T invokeAndWait(final Callable<T> callable,
Component component) throws Exception {
final CallableWrapper<T> wrapper = new CallableWrapper<>(callable);
invokeAndWait(wrapper, component);
return wrapper.getResult();
}
@ -525,10 +579,11 @@ public final class LWCToolkit extends LWToolkit {
T object;
Exception e;
public CallableWrapper(final Callable<T> callable) {
CallableWrapper(final Callable<T> callable) {
this.callable = callable;
}
@Override
public void run() {
try {
object = callable.call();
@ -543,12 +598,16 @@ public final class LWCToolkit extends LWToolkit {
}
}
// Kicks an event over to the appropriate eventqueue and waits for it to finish
// To avoid deadlocking, we manually run the NSRunLoop while waiting
// Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop
// The InvocationEvent will call LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual runloop
// Does not dispatch native events while in the loop
public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException {
/**
* Kicks an event over to the appropriate eventqueue and waits for it to
* finish To avoid deadlocking, we manually run the NSRunLoop while waiting
* Any selector invoked using ThreadUtilities performOnMainThread will be
* processed in doAWTRunLoop The InvocationEvent will call
* LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
* runloop Does not dispatch native events while in the loop
*/
public static void invokeAndWait(Runnable runnable, Component component)
throws InvocationTargetException {
final long mediator = createAWTRunLoopMediator();
InvocationEvent invocationEvent =
@ -583,7 +642,8 @@ public final class LWCToolkit extends LWToolkit {
}
}
public static void invokeLater(Runnable event, Component component) throws InvocationTargetException {
public static void invokeLater(Runnable event, Component component)
throws InvocationTargetException {
final InvocationEvent invocationEvent =
new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
@ -612,16 +672,18 @@ public final class LWCToolkit extends LWToolkit {
return getSystemEventQueueImpl();
}
// DnD support
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
return dscp;
@Override
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge) throws InvalidDnDOperationException {
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl) {
@Override
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
Class<T> abstractRecognizerClass, DragSource ds, Component c,
int srcActions, DragGestureListener dgl) {
DragGestureRecognizer dgr = null;
// Create a new mouse drag gesture recognizer if we have a class match:
@ -635,6 +697,7 @@ public final class LWCToolkit extends LWToolkit {
/**
* Returns the default keyboard locale of the underlying operating system
*/
@Override
public Locale getDefaultKeyboardLocale() {
Locale locale = CInputMethod.getNativeLocale();
@ -645,7 +708,8 @@ public final class LWCToolkit extends LWToolkit {
return locale;
}
public java.awt.im.spi.InputMethodDescriptor getInputMethodAdapterDescriptor() {
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
if (sInputMethodDescriptor == null)
sInputMethodDescriptor = new CInputMethodDescriptor();
@ -661,12 +725,14 @@ public final class LWCToolkit extends LWToolkit {
* @return style attribute map, or null
* @since 1.3
*/
@Override
public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
return CInputMethod.mapInputMethodHighlight(highlight);
}
/**
* Returns key modifiers used by Swing to set up a focus accelerator key stroke.
* Returns key modifiers used by Swing to set up a focus accelerator key
* stroke.
*/
@Override
public int getFocusAcceleratorKeyMask() {
@ -674,8 +740,8 @@ public final class LWCToolkit extends LWToolkit {
}
/**
* Tests whether specified key modifiers mask can be used to enter a printable
* character.
* Tests whether specified key modifiers mask can be used to enter a
* printable character.
*/
@Override
public boolean isPrintableCharacterModifiersMask(int mods) {
@ -696,19 +762,18 @@ public final class LWCToolkit extends LWToolkit {
* Returns the value of "sun.awt.disableCALayers" property. Default
* value is {@code false}.
*/
public synchronized static boolean getSunAwtDisableCALayers() {
public static synchronized boolean getSunAwtDisableCALayers() {
if (sunAwtDisableCALayers == null) {
sunAwtDisableCALayers = AccessController.doPrivileged(
new GetBooleanAction("sun.awt.disableCALayers"));
}
return sunAwtDisableCALayers.booleanValue();
return sunAwtDisableCALayers;
}
/*
* Returns true if the application (one of its windows) owns keyboard focus.
*/
public native boolean isApplicationActive();
native boolean isApplicationActive();
/************************
* Native methods section
@ -729,7 +794,7 @@ public final class LWCToolkit extends LWToolkit {
static void doAWTRunLoop(long mediator, boolean processEvents) {
doAWTRunLoopImpl(mediator, processEvents, inAWT);
}
static private native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
private static native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
static native void stopAWTRunLoop(long mediator);
private native boolean nativeSyncQueue(long timeout);
@ -773,6 +838,7 @@ public final class LWCToolkit extends LWToolkit {
return true;
}
@Override
public boolean isSwingBackbufferTranslucencySupported() {
return true;
}
@ -781,4 +847,36 @@ public final class LWCToolkit extends LWToolkit {
public boolean enableInputMethodsForTextComponent() {
return true;
}
private static URL getScaledImageURL(URL url) {
try {
String scaledImagePath = getScaledImageName(url.getPath());
return scaledImagePath == null ? null : new URL(url.getProtocol(),
url.getHost(), url.getPort(), scaledImagePath);
} catch (MalformedURLException e) {
return null;
}
}
private static String getScaledImageName(String path) {
if (!isValidPath(path)) {
return null;
}
int slash = path.lastIndexOf('/');
String name = (slash < 0) ? path : path.substring(slash + 1);
if (name.contains("@2x")) {
return null;
}
int dot = name.lastIndexOf('.');
String name2x = (dot < 0) ? name + "@2x"
: name.substring(0, dot) + "@2x" + name.substring(dot);
return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x;
}
private static boolean isValidPath(String path) {
return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".");
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,16 +23,15 @@
* questions.
*/
package sun.lwawt.macosx.event;
package sun.lwawt.macosx;
import sun.lwawt.macosx.CocoaConstants;
import java.awt.event.*;
/**
* A class representing Cocoa NSEvent class with the fields only necessary for
* JDK functionality.
*/
public final class NSEvent {
final class NSEvent {
private int type;
private int modifierFlags;
@ -50,14 +49,16 @@ public final class NSEvent {
private short keyCode;
private String charactersIgnoringModifiers;
public NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
// Called from native
NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
this.type = type;
this.modifierFlags = modifierFlags;
this.keyCode = keyCode;
this.charactersIgnoringModifiers = charactersIgnoringModifiers;
}
public NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
// Called from native
NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
int x, int y, int absX, int absY,
double scrollDeltaY, double scrollDeltaX) {
this.type = type;
@ -72,51 +73,51 @@ public final class NSEvent {
this.scrollDeltaX = scrollDeltaX;
}
public int getType() {
int getType() {
return type;
}
public int getModifierFlags() {
int getModifierFlags() {
return modifierFlags;
}
public int getClickCount() {
int getClickCount() {
return clickCount;
}
public int getButtonNumber() {
int getButtonNumber() {
return buttonNumber;
}
public int getX() {
int getX() {
return x;
}
public int getY() {
int getY() {
return y;
}
public double getScrollDeltaY() {
double getScrollDeltaY() {
return scrollDeltaY;
}
public double getScrollDeltaX() {
double getScrollDeltaX() {
return scrollDeltaX;
}
public int getAbsX() {
int getAbsX() {
return absX;
}
public int getAbsY() {
int getAbsY() {
return absY;
}
public short getKeyCode() {
short getKeyCode() {
return keyCode;
}
public String getCharactersIgnoringModifiers() {
String getCharactersIgnoringModifiers() {
return charactersIgnoringModifiers;
}
@ -131,7 +132,7 @@ public final class NSEvent {
/*
* Converts an NSEvent button number to a MouseEvent constant.
*/
public static int nsToJavaButton(int buttonNumber) {
static int nsToJavaButton(int buttonNumber) {
int jbuttonNumber = buttonNumber + 1;
switch (buttonNumber) {
case CocoaConstants.kCGMouseButtonLeft:
@ -150,7 +151,7 @@ public final class NSEvent {
/*
* Converts NPCocoaEvent types to AWT event types.
*/
public static int npToJavaEventType(int npEventType) {
static int npToJavaEventType(int npEventType) {
int jeventType = 0;
switch (npEventType) {
case CocoaConstants.NPCocoaEventMouseDown:
@ -184,7 +185,7 @@ public final class NSEvent {
/*
* Converts NSEvent types to AWT event types.
*/
public static int nsToJavaEventType(int nsEventType) {
static int nsToJavaEventType(int nsEventType) {
int jeventType = 0;
switch (nsEventType) {
case CocoaConstants.NSLeftMouseDown:
@ -227,31 +228,31 @@ public final class NSEvent {
/*
* Converts NSEvent mouse modifiers to AWT mouse modifiers.
*/
public static native int nsToJavaMouseModifiers(int buttonNumber,
static native int nsToJavaMouseModifiers(int buttonNumber,
int modifierFlags);
/*
* Converts NSEvent key modifiers to AWT key modifiers.
*/
public static native int nsToJavaKeyModifiers(int modifierFlags);
static native int nsToJavaKeyModifiers(int modifierFlags);
/*
* Converts NSEvent key info to AWT key info.
*/
public static native boolean nsToJavaKeyInfo(int[] in, int[] out);
static native boolean nsToJavaKeyInfo(int[] in, int[] out);
/*
* Converts NSEvent key modifiers to AWT key info.
*/
public static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
/*
* There is a small number of NS characters that need to be converted
* into other characters before we pass them to AWT.
*/
public static native char nsToJavaChar(char nsChar, int modifierFlags);
static native char nsToJavaChar(char nsChar, int modifierFlags);
public static boolean isPopupTrigger(int jmodifiers) {
static boolean isPopupTrigger(int jmodifiers) {
final boolean isRightButtonDown = ((jmodifiers & InputEvent.BUTTON3_DOWN_MASK) != 0);
final boolean isLeftButtonDown = ((jmodifiers & InputEvent.BUTTON1_DOWN_MASK) != 0);
final boolean isControlDown = ((jmodifiers & InputEvent.CTRL_DOWN_MASK) != 0);

View file

@ -79,3 +79,5 @@ JFIF=image/x-java-image;class=java.awt.Image
TIFF=image/x-java-image;class=java.awt.Image
RICH_TEXT=text/rtf
HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
URL=application/x-java-url;class=java.net.URL
URL=text/uri-list;eoln="\r\n";terminators=1

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,9 @@
* questions.
*/
#include <jni_util.h>
#import "com_apple_laf_AquaFileView.h"
#import <sys/param.h> // for MAXPATHLEN
@ -98,6 +101,7 @@ JNIEXPORT jint JNICALL Java_com_apple_laf_AquaFileView_getNativeLSInfo
JNF_COCOA_ENTER(env);
jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
CHECK_NULL_RETURN(byteArray, returnValue);
jsize length = (*env)->GetArrayLength(env, absolutePath);
// Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@ -138,6 +142,7 @@ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativeDisplayName
JNF_COCOA_ENTER(env);
jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
CHECK_NULL_RETURN(byteArray, returnValue);
jsize length = (*env)->GetArrayLength(env, absolutePath);
// Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@ -153,7 +158,9 @@ JNF_COCOA_ENTER(env);
Boolean isDirectory = (isDir == JNI_TRUE ? true : false);
FSRef ref;
OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy, kFSPathMakeRefDoNotFollowLeafSymlink, &ref, &isDirectory);
OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy,
kFSPathMakeRefDoNotFollowLeafSymlink,
&ref, &isDirectory);
if (theErr == noErr) {
CFStringRef displayName = NULL;
@ -190,6 +197,7 @@ JNF_COCOA_ENTER(env);
size_t maxPathLen = sizeof(pathCString) - 1;
jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
CHECK_NULL_RETURN(byteArray, returnValue);
jsize length = (*env)->GetArrayLength(env, pathToAlias);
if (length > maxPathLen) {
@ -205,7 +213,8 @@ JNF_COCOA_ENTER(env);
OSErr theErr = FSPathMakeRef(pathCString, &fileRef, &isDirectory);
Boolean ignored;
theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored, &ignored, kResolveAliasFileNoUI);
theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored,
&ignored, kResolveAliasFileNoUI);
if (theErr == noErr) {
UInt8 resolvedPath[MAXPATHLEN];
theErr = FSRefMakePath(&fileRef, resolvedPath, MAXPATHLEN);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -633,12 +633,12 @@ Java_java_awt_AWTEvent_nativeSetSource
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaMouseModifiers
* Signature: (II)I
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaMouseModifiers
Java_sun_lwawt_macosx_NSEvent_nsToJavaMouseModifiers
(JNIEnv *env, jclass cls, jint buttonNumber, jint modifierFlags)
{
jint jmodifiers = 0;
@ -653,12 +653,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaKeyModifiers
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyModifiers
Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyModifiers
(JNIEnv *env, jclass cls, jint modifierFlags)
{
jint jmodifiers = 0;
@ -673,12 +673,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaKeyInfo
* Signature: ([I[I)Z
*/
JNIEXPORT jboolean JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyInfo
Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
BOOL postsTyped = NO;
@ -715,12 +715,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsKeyModifiersToJavaKeyInfo
* Signature: ([I[I)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsKeyModifiersToJavaKeyInfo
Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
JNF_COCOA_ENTER(env);
@ -753,12 +753,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_event_NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaChar
* Signature: (CI)C
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
{
jchar javaChar = 0;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@
#import "CDragSource.h"
#import "CDropTarget.h"
@interface AWTView : NSView<NSTextInputClient> {
@interface AWTView : NSView<NSTextInputClient, CDragSourceHolder, CDropTargetHolder> {
@private
jobject m_cPlatformView;
@ -61,14 +61,8 @@
- (id) initWithRect:(NSRect) rect platformView:(jobject)cPlatformView windowLayer:(CALayer*)windowLayer;
- (void) deliverJavaMouseEvent: (NSEvent *) event;
- (void) resetTrackingArea;
- (void) deliverJavaKeyEventHelper: (NSEvent *) event;
- (jobject) awtComponent:(JNIEnv *)env;
- (void) setDragSource:(CDragSource *)source;
- (void) setDropTarget:(CDropTarget *)target;
// Input method-related events
- (void)setInputMethod:(jobject)inputMethod;
- (void)abandonInput;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,6 +42,10 @@
@interface AWTView()
@property (retain) CDropTarget *_dropTarget;
@property (retain) CDragSource *_dragSource;
-(void) deliverResize: (NSRect) rect;
-(void) resetTrackingArea;
-(void) deliverJavaKeyEventHelper: (NSEvent*) event;
@end
// Uncomment this line to see fprintfs of each InputMethod API being called on this View
@ -363,7 +367,7 @@ AWT_ASSERT_APPKIT_THREAD;
// TODO: need consitent way for doing that both with global as well as with local coordinates.
// The reason to do it here is one more native method for getting screen dimension otherwise.
NSRect screenRect = [[NSScreen mainScreen] frame];
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
absP.y = screenRect.size.height - absP.y;
jint clickCount;
@ -376,7 +380,7 @@ AWT_ASSERT_APPKIT_THREAD;
clickCount = [event clickCount];
}
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
jobject jEvent = JNFNewObject(env, jctor_NSEvent,
[event type],
@ -393,7 +397,7 @@ AWT_ASSERT_APPKIT_THREAD;
}
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
}
@ -441,7 +445,7 @@ AWT_ASSERT_APPKIT_THREAD;
characters = JNFNSToJavaString(env, [event characters]);
}
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
jobject jevent = JNFNewObject(env, jctor_NSEvent,
[event type],
@ -451,7 +455,7 @@ AWT_ASSERT_APPKIT_THREAD;
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
"deliverKeyEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
"deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
if (characters != NULL) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#import <AppKit/AppKit.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import "jni_util.h"
#include "ThreadUtilities.h"
@ -172,7 +173,9 @@ JNF_COCOA_ENTER(env);
NSData *tiffImage = [imageRep TIFFRepresentation];
jsize tiffSize = (jsize)[tiffImage length]; // #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
returnValue = (*env)->NewByteArray(env, tiffSize);
CHECK_NULL_RETURN(returnValue, nil);
jbyte *tiffData = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, returnValue, 0);
CHECK_NULL_RETURN(tiffData, nil);
[tiffImage getBytes:tiffData];
(*env)->ReleasePrimitiveArrayCritical(env, returnValue, tiffData, 0); // Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
[imageRep release];
@ -184,12 +187,13 @@ JNF_COCOA_EXIT(env);
static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
{
if (sourceData == NULL) return NULL;
CHECK_NULL_RETURN(sourceData, NULL);
jsize sourceSize = (*env)->GetArrayLength(env, sourceData);
if (sourceSize == 0) return NULL;
jbyte *sourceBytes = (*env)->GetPrimitiveArrayCritical(env, sourceData, NULL);
CHECK_NULL_RETURN(sourceBytes, NULL);
NSData *rawData = [NSData dataWithBytes:sourceBytes length:sourceSize];
NSImage *newImage = [[NSImage alloc] initWithData:rawData];
@ -197,8 +201,7 @@ static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
[newImage release];
(*env)->ReleasePrimitiveArrayCritical(env, sourceData, sourceBytes, JNI_ABORT);
if (newImage == nil) return NULL;
CHECK_NULL_RETURN(newImage, NULL);
// The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
static JNF_CLASS_CACHE(jc_CImage, "sun/lwawt/macosx/CImage");
@ -231,7 +234,8 @@ static jobjectArray CreateJavaFilenameArray(JNIEnv *env, NSArray *filenameArray)
if (filenameCount == 0) return nil;
// Get the java.lang.String class object:
jclass stringClazz = (*env)->FindClass(env, "java/lang/String"); // can't be null
jclass stringClazz = (*env)->FindClass(env, "java/lang/String");
CHECK_NULL_RETURN(stringClazz, nil);
jobject jfilenameArray = (*env)->NewObjectArray(env, filenameCount, stringClazz, NULL); // AWT_THREADING Safe (known object)
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,9 +29,15 @@
#import <Cocoa/Cocoa.h>
#include <jni.h>
@class CDragSource;
@protocol CDragSourceHolder
- (void) setDragSource:(CDragSource *)source;
@end
@interface CDragSource : NSObject {
@private
NSView* fView;
NSView<CDragSourceHolder>* fView;
jobject fComponent;
jobject fDragSourceContextPeer;
@ -53,8 +59,6 @@
jint fDragMouseModifiers;
}
+ (CDragSource *) currentDragSource;
// Common methods:
- (id) init:(jobject)jDragSourceContextPeer
component:(jobject)jComponent
@ -66,7 +70,7 @@
modifiers:(jint)extModifiers
clickCount:(jint)clickCount
timeStamp:(jlong)timeStamp
dragImage:(jobject)jDragImage
dragImage:(jlong)nsDragImagePtr
dragImageOffsetX:(jint)jDragImageOffsetX
dragImageOffsetY:(jint)jDragImageOffsetY
sourceActions:(jint)jSourceActions
@ -84,13 +88,6 @@
- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint;
- (BOOL)ignoreModifierKeysWhileDragging;
// Updates from the destination to the source
- (void) postDragEnter;
- (void) postDragExit;
// Utility
- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
@end
#endif // CDragSource_h

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -75,14 +75,17 @@ JNF_CLASS_CACHE(CImageClass, "sun/lwawt/macosx/CImage");
static NSDragOperation sDragOperation;
static NSPoint sDraggingLocation;
static CDragSource* sCurrentDragSource;
static BOOL sNeedsEnter;
@implementation CDragSource
@interface CDragSource ()
// Updates from the destination to the source
- (void) postDragEnter;
- (void) postDragExit;
// Utility
- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
@end
+ (CDragSource *) currentDragSource {
return sCurrentDragSource;
}
@implementation CDragSource
- (id) init:(jobject)jDragSourceContextPeer
component:(jobject)jComponent
@ -94,7 +97,7 @@ static BOOL sNeedsEnter;
modifiers:(jint)extModifiers
clickCount:(jint)clickCount
timeStamp:(jlong)timeStamp
dragImage:(jobject)jDragImage
dragImage:(jlong)nsDragImagePtr
dragImageOffsetX:(jint)jDragImageOffsetX
dragImageOffsetY:(jint)jDragImageOffsetY
sourceActions:(jint)jSourceActions
@ -109,26 +112,21 @@ static BOOL sNeedsEnter;
// Construct the object if we have a valid model for it:
if (control != nil) {
JNIEnv *env = [ThreadUtilities getJNIEnv];
fComponent = JNFNewGlobalRef(env, jComponent);
fDragSourceContextPeer = JNFNewGlobalRef(env, jDragSourceContextPeer);
fTransferable = JNFNewGlobalRef(env, jTransferable);
fTriggerEvent = JNFNewGlobalRef(env, jTrigger);
if (jDragImage) {
JNF_MEMBER_CACHE(nsImagePtr, CImageClass, "ptr", "J");
jlong imgPtr = JNFGetLongField(env, jDragImage, nsImagePtr);
fDragImage = (NSImage*) jlong_to_ptr(imgPtr); // Double-casting prevents compiler 'd$|//
fComponent = jComponent;
fDragSourceContextPeer = jDragSourceContextPeer;
fTransferable = jTransferable;
fTriggerEvent = jTrigger;
if (nsDragImagePtr) {
fDragImage = (NSImage*) jlong_to_ptr(nsDragImagePtr);
[fDragImage retain];
}
fDragImageOffset = NSMakePoint(jDragImageOffsetX, jDragImageOffsetY);
fSourceActions = jSourceActions;
fFormats = JNFNewGlobalRef(env, jFormats);
fFormatMap = JNFNewGlobalRef(env, jFormatMap);
fFormats = jFormats;
fFormatMap = jFormatMap;
fTriggerEventTimeStamp = timeStamp;
fDragPos = NSMakePoint(dragPosX, dragPosY);
@ -515,8 +513,6 @@ static BOOL sNeedsEnter;
fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers];
fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers];
// Set the current DragSource
sCurrentDragSource = self;
sNeedsEnter = YES;
@try {
@ -566,8 +562,6 @@ static BOOL sNeedsEnter;
JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V");
JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable
} @finally {
// Clear the current DragSource
sCurrentDragSource = nil;
sNeedsEnter = NO;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,30 +40,39 @@
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
(JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable,
jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
jlong nsdragimageptr, jint jdragimageoffsetx, jint jdragimageoffsety,
jint jsourceactions, jlongArray jformats, jobject jformatmap)
{
id controlObj = (id) jlong_to_ptr(jnativepeer);
__block CDragSource* dragSource = nil;
JNF_COCOA_ENTER(env);
// Global references are disposed when the DragSource is removed
jobject gComponent = JNFNewGlobalRef(env, jcomponent);
jobject gDragSourceContextPeer = JNFNewGlobalRef(env, jthis);
jobject gTransferable = JNFNewGlobalRef(env, jtransferable);
jobject gTriggerEvent = JNFNewGlobalRef(env, jtrigger);
jlongArray gFormats = JNFNewGlobalRef(env, jformats);
jobject gFormatMap = JNFNewGlobalRef(env, jformatmap);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
dragSource = [[CDragSource alloc] init:jthis
component:jcomponent
dragSource = [[CDragSource alloc] init:gDragSourceContextPeer
component:gComponent
control:controlObj
transferable:jtransferable
triggerEvent:jtrigger
transferable:gTransferable
triggerEvent:gTriggerEvent
dragPosX:jdragposx
dragPosY:jdragposy
modifiers:jextmodifiers
clickCount:jclickcount
timeStamp:jtimestamp
dragImage:jnsdragimage
dragImage:nsdragimageptr
dragImageOffsetX:jdragimageoffsetx
dragImageOffsetY:jdragimageoffsety
sourceActions:jsourceactions
formats:jformats
formatMap:jformatmap];
formats:gFormats
formatMap:gFormatMap];
}];
JNF_COCOA_EXIT(env);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,9 +31,15 @@
@class ControlModel;
@class CDropTarget;
@protocol CDropTargetHolder
- (void) setDropTarget:(CDropTarget *)target;
@end
@interface CDropTarget : NSObject {
@private
NSView* fView;
NSView<CDropTargetHolder>* fView;
jobject fComponent;
jobject fDropTarget;
jobject fDropTargetContextPeer;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -143,21 +143,23 @@ JNF_COCOA_ENTER(env);
NSMutableArray * reps = [NSMutableArray arrayWithCapacity: num];
jint * ws = (*env)->GetIntArrayElements(env, widths, NULL);
jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
if (ws != NULL) {
jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
if (hs != NULL) {
jsize i;
for (i = 0; i < num; i++) {
jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
jsize i;
for (i = 0; i < num; i++) {
jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
if (imageRep) {
[reps addObject: imageRep];
}
}
NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
if (imageRep) {
[reps addObject: imageRep];
(*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
}
(*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
}
(*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
(*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
if ([reps count]) {
NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
[nsImage addRepresentations: reps];
@ -320,3 +322,26 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CImage
* Method: nativeResizeNSImageRepresentations
* Signature: (JDD)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeResizeNSImageRepresentations
(JNIEnv *env, jclass clazz, jlong image, jdouble w, jdouble h)
{
if (!image) return;
NSImage *i = (NSImage *)jlong_to_ptr(image);
JNF_COCOA_ENTER(env);
NSImageRep *imageRep = nil;
NSArray *imageRepresentations = [i representations];
NSEnumerator *imageEnumerator = [imageRepresentations objectEnumerator];
while ((imageRep = [imageEnumerator nextObject]) != nil) {
[imageRep setSize:NSMakeSize(w, h)];
}
JNF_COCOA_EXIT(env);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,9 @@
* questions.
*/
#import "jni_util.h"
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import <ApplicationServices/ApplicationServices.h>
@ -187,9 +190,8 @@ Java_sun_lwawt_macosx_CRobot_mouseEvent
// volatile, otherwise it warns that it might be clobbered by 'longjmp'
volatile CGPoint point;
// Translate the device relative point into a valid global CGPoint.
point.x = mouseLastX + globalDeviceBounds.origin.x;
point.y = mouseLastY + globalDeviceBounds.origin.y;
point.x = mouseLastX;
point.y = mouseLastY;
__block CGMouseButton button = kCGMouseButtonLeft;
__block CGEventType type = kCGEventMouseMoved;
@ -343,6 +345,7 @@ Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
// get a pointer to the Java int array
void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
CHECK_NULL(jPixelData);
// create a graphics context around the Java int array
CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -135,7 +135,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
clickCount = [event clickCount];
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
jobject jEvent = JNFNewObject(env, jctor_NSEvent,
[event type],
@ -152,7 +152,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
}
static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,37 +23,10 @@
* questions.
*/
#import "CWrapper.h"
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import "AWTWindow.h"
#import "LWCToolkit.h"
#import "GeomUtilities.h"
#import "ThreadUtilities.h"
#import "sun_lwawt_macosx_CWrapper_NSWindow.h"
/*
* Class: sun_lwawt_macosx_CWrapper$NSObject
* Method: release
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSObject_release
(JNIEnv *env, jclass cls, jlong objectPtr)
{
JNF_COCOA_ENTER(env);
id obj = (id)jlong_to_ptr(objectPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
CFRelease(obj);
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: makeKeyAndOrderFront
@ -249,6 +222,7 @@ static void initLevels()
dispatch_once(&pred, ^{
LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSNormalWindowLevel] = NSNormalWindowLevel;
LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSFloatingWindowLevel] = NSFloatingWindowLevel;
LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSPopUpMenuWindowLevel] = NSPopUpMenuWindowLevel;
});
}
@ -308,8 +282,8 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_removeChildWindow
{
JNF_COCOA_ENTER(env);
AWTWindow *parent = (AWTWindow *)jlong_to_ptr(parentPtr);
AWTWindow *child = (AWTWindow *)jlong_to_ptr(childPtr);
NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr);
NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr);
[ThreadUtilities performOnMainThread:@selector(removeChildWindow:)
on:parent
withObject:child
@ -318,26 +292,6 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: setFrame
* Signature: (JIIIIZ)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setFrame
(JNIEnv *env, jclass cls, jlong windowPtr, jint x, jint y, jint w, jint h, jboolean display)
{
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
NSRect frame = NSMakeRect(x, y, w, h);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setFrame:frame display:display];
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: setAlphaValue
@ -349,7 +303,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setAlphaValue
{
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setAlphaValue:(CGFloat)alpha];
}];
@ -368,7 +322,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setOpaque
{
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setOpaque:(BOOL)opaque];
}];
@ -387,7 +341,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor
{
JNF_COCOA_ENTER(env);
AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
NSColor *color = (NSColor *)jlong_to_ptr(colorPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
[window setBackgroundColor:color];
@ -397,6 +351,7 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: miniaturize
* Signature: (J)V
*/
@ -558,33 +513,6 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSView
* Method: frame
* Signature: (J)Ljava/awt/Rectangle;
*/
JNIEXPORT jobject JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSView_frame
(JNIEnv *env, jclass cls, jlong viewPtr)
{
jobject jRect = NULL;
JNF_COCOA_ENTER(env);
__block NSRect rect = NSZeroRect;
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
rect = [view frame];
}];
jRect = NSToJavaRect(env, rect);
JNF_COCOA_EXIT(env);
return jRect;
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSView
* Method: window

View file

@ -200,13 +200,17 @@ Java_sun_lwawt_macosx_LWCToolkit_initIDs
gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
CHECK_NULL(inputEventClazz);
jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
CHECK_NULL(getButtonDownMasksID);
jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
CHECK_NULL(tmp);
gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
if (gButtonDownMasks == NULL) {
gNumberOfButtons = 0;
(*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
JNU_ThrowOutOfMemoryError(env, NULL);
return;
}
@ -240,7 +244,7 @@ static UInt32 RGB(NSColor *c) {
return ((ia & 0xFF) << 24) | ((ir & 0xFF) << 16) | ((ig & 0xFF) << 8) | ((ib & 0xFF) << 0);
}
void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
BOOL doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
jint len = (*env)->GetArrayLength(env, jColors);
UInt32 colorsArray[len];
@ -254,8 +258,12 @@ void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
}];
jint *_colors = (*env)->GetPrimitiveArrayCritical(env, jColors, 0);
if (_colors == NULL) {
return NO;
}
memcpy(_colors, colors, len * sizeof(UInt32));
(*env)->ReleasePrimitiveArrayCritical(env, jColors, _colors, 0);
return YES;
}
/**
@ -267,8 +275,9 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_loadNativeColors
(JNIEnv *env, jobject peer, jintArray jSystemColors, jintArray jAppleColors)
{
JNF_COCOA_ENTER(env);
doLoadNativeColors(env, jSystemColors, NO);
doLoadNativeColors(env, jAppleColors, YES);
if (doLoadNativeColors(env, jSystemColors, NO)) {
doLoadNativeColors(env, jAppleColors, YES);
}
JNF_COCOA_EXIT(env);
}

View file

@ -142,10 +142,9 @@ SplashInitPlatform(Splash * splash) {
splash->screenFormat.byteOrder = 1 ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
splash->screenFormat.depthBytes = 4;
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSApplication * app = [NSApplicationAWT sharedApplication];
[NSApplicationAWT runAWTLoopWithApp: app];
});
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
[NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
}];
}
void

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -433,18 +433,18 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getOGLCapabilities
}
JNIEXPORT jint JNICALL
Java_sun_java2d_opengl_CGLGraphicsConfig_getMaxTextureSize
Java_sun_java2d_opengl_CGLGraphicsConfig_nativeGetMaxTextureSize
(JNIEnv *env, jclass cglgc)
{
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getMaxTextureSize");
J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_nativeGetMaxTextureSize");
__block int max = 0;
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
[sharedContext makeCurrentContext];
j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
[NSOpenGLContext clearCurrentContext];
}];
return (jint)max;
}

View file

@ -680,7 +680,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
gotHeader = true;
}
public Iterator getImageTypes(int imageIndex)
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
throws IOException {
checkIndex(imageIndex);
try {
@ -688,7 +688,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
ArrayList list = new ArrayList(1);
ArrayList<ImageTypeSpecifier> list = new ArrayList<>(1);
list.add(new ImageTypeSpecifier(originalColorModel,
originalSampleModel));
return list.iterator();
@ -912,6 +912,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
throw new
IIOException(I18N.getString("BMPImageReader1"));
}
break;
case VERSION_4_8_BIT:
switch((int)compression) {

View file

@ -51,7 +51,7 @@ public class BMPImageReaderSpi extends ImageReaderSpi {
entensions,
mimeType,
"com.sun.imageio.plugins.bmp.BMPImageReader",
new Class[] { ImageInputStream.class },
new Class<?>[] { ImageInputStream.class },
writerSpiNames,
false,
null, null, null, null,

View file

@ -1325,10 +1325,11 @@ public class BMPImageWriter extends ImageWriter implements BMPConstants {
ImageWriteParam bmpParam) throws IOException {
String format =
compressionType == BI_JPEG ? "jpeg" : "png";
Iterator iterator = ImageIO.getImageWritersByFormatName(format);
Iterator<ImageWriter> iterator =
ImageIO.getImageWritersByFormatName(format);
ImageWriter writer = null;
if (iterator.hasNext())
writer = (ImageWriter)iterator.next();
writer = iterator.next();
if (writer != null) {
if (embedded_stream == null) {
throw new RuntimeException("No stream for writing embedded image!");

View file

@ -56,7 +56,7 @@ public class BMPImageWriterSpi extends ImageWriterSpi {
entensions,
mimeType,
"com.sun.imageio.plugins.bmp.BMPImageWriter",
new Class[] { ImageOutputStream.class },
new Class<?>[] { ImageOutputStream.class },
readerSpiNames,
false,
null, null, null, null,

View file

@ -91,10 +91,6 @@ public class BMPMetadata extends IIOMetadata implements BMPConstants {
public int green;
public int blue;
// Fields from CommentExtension
// List of byte[]
public List comments = null; // new ArrayList();
public BMPMetadata() {
super(true,
nativeMetadataFormatName,

View file

@ -42,7 +42,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
public StandardMetadataFormat() {
super(standardMetadataFormatName, CHILD_POLICY_SOME);
List values;
List<String> values;
// root -> Chroma
addElement("Chroma", standardMetadataFormatName,
@ -52,7 +52,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
addElement("ColorSpaceType", "Chroma",
CHILD_POLICY_EMPTY);
values = new ArrayList();
values = new ArrayList<>();
values.add("XYZ");
values.add("Lab");
values.add("Luv");
@ -164,7 +164,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
// root -> Data -> PlanarConfiguration
addElement("PlanarConfiguration", "Data", CHILD_POLICY_EMPTY);
values = new ArrayList();
values = new ArrayList<>();
values.add("PixelInterleaved");
values.add("PlaneInterleaved");
values.add("LineInterleaved");
@ -178,7 +178,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
// root -> Data -> SampleFormat
addElement("SampleFormat", "Data", CHILD_POLICY_EMPTY);
values = new ArrayList();
values = new ArrayList<>();
values.add("SignedIntegral");
values.add("UnsignedIntegral");
values.add("Real");
@ -225,7 +225,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
addElement("ImageOrientation", "Dimension",
CHILD_POLICY_EMPTY);
values = new ArrayList();
values = new ArrayList<>();
values.add("Normal");
values.add("Rotate90");
values.add("Rotate180");
@ -306,7 +306,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
// root -> Document -> SubimageInterpretation
addElement("SubimageInterpretation", "Document",
CHILD_POLICY_EMPTY);
values = new ArrayList();
values = new ArrayList<>();
values.add("Standalone");
values.add("SinglePage");
values.add("FullResolution");
@ -418,7 +418,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
false,
null);
values = new ArrayList();
values = new ArrayList<>();
values.add("none");
values.add("lzw");
values.add("zip");
@ -437,7 +437,7 @@ public class StandardMetadataFormat extends IIOMetadataFormatImpl {
// root -> Transparency -> Alpha
addElement("Alpha", "Transparency", CHILD_POLICY_EMPTY);
values = new ArrayList();
values = new ArrayList<>();
values.add("none");
values.add("premultiplied");
values.add("nonpremultiplied");

View file

@ -84,17 +84,17 @@ public class GIFImageMetadata extends GIFMetadata {
// Fields from ApplicationExtension
// List of byte[]
public List applicationIDs = null; // new ArrayList();
public List<byte[]> applicationIDs = null;
// List of byte[]
public List authenticationCodes = null; // new ArrayList();
public List<byte[]> authenticationCodes = null;
// List of byte[]
public List applicationData = null; // new ArrayList();
public List<byte[]> applicationData = null;
// Fields from CommentExtension
// List of byte[]
public List comments = null; // new ArrayList();
public List<byte[]> comments = null;
protected GIFImageMetadata(boolean standardMetadataFormatSupported,
String nativeMetadataFormatName,
@ -225,13 +225,13 @@ public class GIFImageMetadata extends GIFMetadata {
for (int i = 0; i < numAppExtensions; i++) {
IIOMetadataNode appExtNode =
new IIOMetadataNode("ApplicationExtension");
byte[] applicationID = (byte[])applicationIDs.get(i);
byte[] applicationID = applicationIDs.get(i);
appExtNode.setAttribute("applicationID",
toISO8859(applicationID));
byte[] authenticationCode = (byte[])authenticationCodes.get(i);
byte[] authenticationCode = authenticationCodes.get(i);
appExtNode.setAttribute("authenticationCode",
toISO8859(authenticationCode));
byte[] appData = (byte[])applicationData.get(i);
byte[] appData = applicationData.get(i);
appExtNode.setUserObject(appData.clone());
node.appendChild(appExtNode);
}
@ -246,7 +246,7 @@ public class GIFImageMetadata extends GIFMetadata {
for (int i = 0; i < numComments; i++) {
IIOMetadataNode commentNode =
new IIOMetadataNode("CommentExtension");
byte[] comment = (byte[])comments.get(i);
byte[] comment = comments.get(i);
commentNode.setAttribute("value", toISO8859(comment));
node.appendChild(commentNode);
}
@ -374,7 +374,7 @@ public class GIFImageMetadata extends GIFMetadata {
if (comments == null) {
return null;
}
Iterator commentIter = comments.iterator();
Iterator<byte[]> commentIter = comments.iterator();
if (!commentIter.hasNext()) {
return null;
}
@ -383,7 +383,7 @@ public class GIFImageMetadata extends GIFMetadata {
IIOMetadataNode node = null; // scratch node
while (commentIter.hasNext()) {
byte[] comment = (byte[])commentIter.next();
byte[] comment = commentIter.next();
String s = null;
try {
s = new String(comment, "ISO-8859-1");

View file

@ -72,7 +72,7 @@ public class GIFImageReader extends ImageReader {
// A List of Longs indicating the stream positions of the
// start of the metadata for each image. Entries are added
// as needed.
List imageStartPosition = new ArrayList();
List<Long> imageStartPosition = new ArrayList<>();
// Length of metadata for image at 'currIndex', valid only if
// imageMetadata != null.
@ -227,7 +227,8 @@ public class GIFImageReader extends ImageReader {
return new ImageTypeSpecifier(colorModel, sampleModel);
}
public Iterator getImageTypes(int imageIndex) throws IIOException {
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
throws IIOException {
checkIndex(imageIndex);
int index = locateImage(imageIndex);
@ -236,7 +237,7 @@ public class GIFImageReader extends ImageReader {
}
readMetadata();
List l = new ArrayList(1);
List<ImageTypeSpecifier> l = new ArrayList<>(1);
byte[] colorTable;
if (imageMetadata.localColorTable != null) {
@ -605,7 +606,7 @@ public class GIFImageReader extends ImageReader {
int index = Math.min(imageIndex, imageStartPosition.size() - 1);
// Seek to that position
Long l = (Long)imageStartPosition.get(index);
Long l = imageStartPosition.get(index);
stream.seek(l.longValue());
// Skip images until at desired index or last image found
@ -731,7 +732,7 @@ public class GIFImageReader extends ImageReader {
} else if (label == 0xfe) { // Comment extension
byte[] comment = concatenateBlocks();
if (imageMetadata.comments == null) {
imageMetadata.comments = new ArrayList();
imageMetadata.comments = new ArrayList<>();
}
imageMetadata.comments.add(comment);
} else if (label == 0xff) { // Application extension
@ -762,10 +763,10 @@ public class GIFImageReader extends ImageReader {
// Init lists if necessary
if (imageMetadata.applicationIDs == null) {
imageMetadata.applicationIDs = new ArrayList();
imageMetadata.applicationIDs = new ArrayList<>();
imageMetadata.authenticationCodes =
new ArrayList();
imageMetadata.applicationData = new ArrayList();
new ArrayList<>();
imageMetadata.applicationData = new ArrayList<>();
}
imageMetadata.applicationIDs.add(applicationID);
imageMetadata.authenticationCodes.add(authCode);
@ -868,7 +869,7 @@ public class GIFImageReader extends ImageReader {
}
// Initialize the destination image
Iterator imageTypes = getImageTypes(imageIndex);
Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
this.theImage = getDestination(param,
imageTypes,
imageMetadata.imageWidth,
@ -1031,7 +1032,7 @@ public class GIFImageReader extends ImageReader {
streamMetadata = null;
currIndex = -1;
imageMetadata = null;
imageStartPosition = new ArrayList();
imageStartPosition = new ArrayList<>();
numImages = -1;
// No need to reinitialize 'block'

View file

@ -60,7 +60,7 @@ public class GIFImageReaderSpi extends ImageReaderSpi {
suffixes,
MIMETypes,
readerClassName,
new Class[] { ImageInputStream.class },
new Class<?>[] { ImageInputStream.class },
writerSpiNames,
true,
GIFStreamMetadata.nativeMetadataFormatName,

View file

@ -1204,9 +1204,9 @@ public class GIFImageWriter extends ImageWriter {
private void writeApplicationExtension(GIFWritableImageMetadata im)
throws IOException {
if (im.applicationIDs != null) {
Iterator iterIDs = im.applicationIDs.iterator();
Iterator iterCodes = im.authenticationCodes.iterator();
Iterator iterData = im.applicationData.iterator();
Iterator<byte[]> iterIDs = im.applicationIDs.iterator();
Iterator<byte[]> iterCodes = im.authenticationCodes.iterator();
Iterator<byte[]> iterData = im.applicationData.iterator();
while (iterIDs.hasNext()) {
try {
@ -1214,10 +1214,10 @@ public class GIFImageWriter extends ImageWriter {
stream.write(0xff);
stream.write(11);
stream.write((byte[])iterIDs.next(), 0, 8);
stream.write((byte[])iterCodes.next(), 0, 3);
stream.write(iterIDs.next(), 0, 8);
stream.write(iterCodes.next(), 0, 3);
writeBlocks((byte[])iterData.next());
writeBlocks(iterData.next());
stream.write(0x00);
} catch (IOException e) {
@ -1231,11 +1231,11 @@ public class GIFImageWriter extends ImageWriter {
throws IOException {
if (im.comments != null) {
try {
Iterator iter = im.comments.iterator();
Iterator<byte[]> iter = im.comments.iterator();
while (iter.hasNext()) {
stream.write(0x21);
stream.write(0xfe);
writeBlocks((byte[])iter.next());
writeBlocks(iter.next());
stream.write(0x00);
}
} catch (IOException e) {

View file

@ -60,7 +60,7 @@ public class GIFImageWriterSpi extends ImageWriterSpi {
suffixes,
MIMETypes,
writerClassName,
new Class[] { ImageOutputStream.class },
new Class<?>[] { ImageOutputStream.class },
readerSpiNames,
true,
GIFWritableStreamMetadata.NATIVE_FORMAT_NAME,

View file

@ -258,14 +258,14 @@ class GIFWritableImageMetadata extends GIFImageMetadata {
}
if (applicationIDs == null) {
applicationIDs = new ArrayList();
authenticationCodes = new ArrayList();
applicationData = new ArrayList();
applicationIDs = new ArrayList<>();
authenticationCodes = new ArrayList<>();
applicationData = new ArrayList<>();
}
applicationIDs.add(fromISO8859(applicationIDString));
authenticationCodes.add(fromISO8859(authenticationCodeString));
applicationData.add(applicationExtensionData);
applicationData.add((byte[]) applicationExtensionData);
} else if (name.equals("CommentExtensions")) {
Node commentExtension = node.getFirstChild();
if (commentExtension != null) {
@ -276,7 +276,7 @@ class GIFWritableImageMetadata extends GIFImageMetadata {
}
if (comments == null) {
comments = new ArrayList();
comments = new ArrayList<>();
}
String comment =
@ -367,7 +367,7 @@ class GIFWritableImageMetadata extends GIFImageMetadata {
String value = getAttribute(childNode, "value");
byte[] comment = fromISO8859(value);
if (comments == null) {
comments = new ArrayList();
comments = new ArrayList<>();
}
comments.add(comment);
}

View file

@ -43,7 +43,7 @@ import org.w3c.dom.NamedNodeMap;
* A DHT (Define Huffman Table) marker segment.
*/
class DHTMarkerSegment extends MarkerSegment {
List tables = new ArrayList();
List<Htable> tables = new ArrayList<>();
DHTMarkerSegment(boolean needFour) {
super(JPEG.DHT);
@ -93,11 +93,11 @@ class DHTMarkerSegment extends MarkerSegment {
protected Object clone() {
DHTMarkerSegment newGuy = (DHTMarkerSegment) super.clone();
newGuy.tables = new ArrayList(tables.size());
Iterator iter = tables.iterator();
newGuy.tables = new ArrayList<>(tables.size());
Iterator<Htable> iter = tables.iterator();
while (iter.hasNext()) {
Htable table = (Htable) iter.next();
newGuy.tables.add(table.clone());
Htable table = iter.next();
newGuy.tables.add((Htable) table.clone());
}
return newGuy;
}
@ -105,7 +105,7 @@ class DHTMarkerSegment extends MarkerSegment {
IIOMetadataNode getNativeNode() {
IIOMetadataNode node = new IIOMetadataNode("dht");
for (int i= 0; i<tables.size(); i++) {
Htable table = (Htable) tables.get(i);
Htable table = tables.get(i);
node.appendChild(table.getNativeNode());
}
return node;
@ -124,7 +124,7 @@ class DHTMarkerSegment extends MarkerSegment {
System.out.println("Num tables: "
+ Integer.toString(tables.size()));
for (int i= 0; i<tables.size(); i++) {
Htable table = (Htable) tables.get(i);
Htable table = tables.get(i);
table.print();
}
System.out.println();

View file

@ -44,7 +44,7 @@ import org.w3c.dom.NamedNodeMap;
* A DQT (Define Quantization Table) marker segment.
*/
class DQTMarkerSegment extends MarkerSegment {
List tables = new ArrayList(); // Could be 1 to 4
List<Qtable> tables = new ArrayList<>(); // Could be 1 to 4
DQTMarkerSegment(float quality, boolean needTwo) {
super(JPEG.DQT);
@ -86,11 +86,11 @@ class DQTMarkerSegment extends MarkerSegment {
protected Object clone() {
DQTMarkerSegment newGuy = (DQTMarkerSegment) super.clone();
newGuy.tables = new ArrayList(tables.size());
Iterator iter = tables.iterator();
newGuy.tables = new ArrayList<>(tables.size());
Iterator<Qtable> iter = tables.iterator();
while (iter.hasNext()) {
Qtable table = (Qtable) iter.next();
newGuy.tables.add(table.clone());
Qtable table = iter.next();
newGuy.tables.add((Qtable) table.clone());
}
return newGuy;
}
@ -98,7 +98,7 @@ class DQTMarkerSegment extends MarkerSegment {
IIOMetadataNode getNativeNode() {
IIOMetadataNode node = new IIOMetadataNode("dqt");
for (int i= 0; i<tables.size(); i++) {
Qtable table = (Qtable) tables.get(i);
Qtable table = tables.get(i);
node.appendChild(table.getNativeNode());
}
return node;
@ -117,7 +117,7 @@ class DQTMarkerSegment extends MarkerSegment {
System.out.println("Num tables: "
+ Integer.toString(tables.size()));
for (int i= 0; i<tables.size(); i++) {
Qtable table = (Qtable) tables.get(i);
Qtable table = tables.get(i);
table.print();
}
System.out.println();

View file

@ -76,7 +76,7 @@ class JFIFMarkerSegment extends MarkerSegment {
int thumbWidth;
int thumbHeight;
JFIFThumbRGB thumb = null; // If present
ArrayList extSegments = new ArrayList();
ArrayList<JFIFExtensionMarkerSegment> extSegments = new ArrayList<>();
ICCMarkerSegment iccSegment = null; // optional ICC
private static final int THUMB_JPEG = 0x10;
private static final int THUMB_PALETTE = 0x11;
@ -157,11 +157,11 @@ class JFIFMarkerSegment extends MarkerSegment {
protected Object clone() {
JFIFMarkerSegment newGuy = (JFIFMarkerSegment) super.clone();
if (!extSegments.isEmpty()) { // Clone the list with a deep copy
newGuy.extSegments = new ArrayList();
for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
JFIFExtensionMarkerSegment jfxx =
(JFIFExtensionMarkerSegment) iter.next();
newGuy.extSegments.add(jfxx.clone());
newGuy.extSegments = new ArrayList<>();
for (Iterator<JFIFExtensionMarkerSegment> iter =
extSegments.iterator(); iter.hasNext();) {
JFIFExtensionMarkerSegment jfxx = iter.next();
newGuy.extSegments.add((JFIFExtensionMarkerSegment) jfxx.clone());
}
}
if (iccSegment != null) {
@ -230,9 +230,9 @@ class JFIFMarkerSegment extends MarkerSegment {
if (!extSegments.isEmpty()) {
IIOMetadataNode JFXXnode = new IIOMetadataNode("JFXX");
node.appendChild(JFXXnode);
for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
JFIFExtensionMarkerSegment seg =
(JFIFExtensionMarkerSegment) iter.next();
for (Iterator<JFIFExtensionMarkerSegment> iter =
extSegments.iterator(); iter.hasNext();) {
JFIFExtensionMarkerSegment seg = iter.next();
JFXXnode.appendChild(seg.getNativeNode());
}
}
@ -312,8 +312,7 @@ class JFIFMarkerSegment extends MarkerSegment {
}
index--;
}
JFIFExtensionMarkerSegment jfxx =
(JFIFExtensionMarkerSegment) extSegments.get(index);
JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
return jfxx.thumb.getWidth();
}
@ -324,8 +323,7 @@ class JFIFMarkerSegment extends MarkerSegment {
}
index--;
}
JFIFExtensionMarkerSegment jfxx =
(JFIFExtensionMarkerSegment) extSegments.get(index);
JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
return jfxx.thumb.getHeight();
}
@ -340,8 +338,7 @@ class JFIFMarkerSegment extends MarkerSegment {
if (thumb != null) {
index--;
}
JFIFExtensionMarkerSegment jfxx =
(JFIFExtensionMarkerSegment) extSegments.get(index);
JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
ret = jfxx.thumb.getThumbnail(iis, reader);
}
reader.thumbnailComplete();
@ -436,13 +433,13 @@ class JFIFMarkerSegment extends MarkerSegment {
* default encoding is used for the extra thumbnails.
*/
void writeWithThumbs(ImageOutputStream ios,
List thumbnails,
List<? extends BufferedImage> thumbnails,
JPEGImageWriter writer) throws IOException {
if (thumbnails != null) {
JFIFExtensionMarkerSegment jfxx = null;
if (thumbnails.size() == 1) {
if (!extSegments.isEmpty()) {
jfxx = (JFIFExtensionMarkerSegment) extSegments.get(0);
jfxx = extSegments.get(0);
}
writeThumb(ios,
(BufferedImage) thumbnails.get(0),
@ -456,7 +453,7 @@ class JFIFMarkerSegment extends MarkerSegment {
for (int i = 0; i < thumbnails.size(); i++) {
jfxx = null;
if (i < extSegments.size()) {
jfxx = (JFIFExtensionMarkerSegment) extSegments.get(i);
jfxx = extSegments.get(i);
}
writeThumb(ios,
(BufferedImage) thumbnails.get(i),
@ -605,7 +602,7 @@ class JFIFMarkerSegment extends MarkerSegment {
* marker segments as necessary.
*/
static void writeDefaultJFIF(ImageOutputStream ios,
List thumbnails,
List<? extends BufferedImage> thumbnails,
ICC_Profile iccProfile,
JPEGImageWriter writer)
throws IOException {
@ -637,9 +634,9 @@ class JFIFMarkerSegment extends MarkerSegment {
System.out.print("Thumbnail Height: ");
System.out.println(thumbHeight);
if (!extSegments.isEmpty()) {
for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
JFIFExtensionMarkerSegment extSegment =
(JFIFExtensionMarkerSegment) iter.next();
for (Iterator<JFIFExtensionMarkerSegment> iter =
extSegments.iterator(); iter.hasNext();) {
JFIFExtensionMarkerSegment extSegment = iter.next();
extSegment.print();
}
}
@ -1373,7 +1370,7 @@ class JFIFMarkerSegment extends MarkerSegment {
* combining chunks as necessary.
*/
class ICCMarkerSegment extends MarkerSegment {
ArrayList chunks = null;
ArrayList<byte[]> chunks = null;
byte [] profile = null; // The complete profile when it's fully read
// May remain null when writing
private static final int ID_SIZE = 12;
@ -1428,7 +1425,7 @@ class JFIFMarkerSegment extends MarkerSegment {
// two chunk numbering bytes
length -= 2;
buffer.readData(profileData);
chunks = new ArrayList();
chunks = new ArrayList<>();
chunks.add(profileData);
chunksRead = 1;
inICC = true;
@ -1518,7 +1515,7 @@ class JFIFMarkerSegment extends MarkerSegment {
for (int i = 1; i <= numChunks; i++) {
boolean foundIt = false;
for (int chunk = 0; chunk < chunks.size(); chunk++) {
byte [] chunkData = (byte []) chunks.get(chunk);
byte [] chunkData = chunks.get(chunk);
if (chunkData[0] == i) { // Right one
System.arraycopy(chunkData, 2,
profile, index,

View file

@ -82,7 +82,7 @@ public class JPEGImageMetadataFormat extends JPEGMetadataFormat {
"2",
"0", "255",
true, true);
List resUnits = new ArrayList();
List<String> resUnits = new ArrayList<>();
resUnits.add("0");
resUnits.add("1");
resUnits.add("2");
@ -125,7 +125,7 @@ public class JPEGImageMetadataFormat extends JPEGMetadataFormat {
addElement("JFIFthumbPalette", "app0JFXX", CHILD_POLICY_EMPTY);
addElement("JFIFthumbRGB", "app0JFXX", CHILD_POLICY_EMPTY);
List codes = new ArrayList();
List<String> codes = new ArrayList<>();
codes.add("16"); // Hex 10
codes.add("17"); // Hex 11
codes.add("19"); // Hex 13
@ -192,7 +192,7 @@ public class JPEGImageMetadataFormat extends JPEGMetadataFormat {
"0", "65535",
true, true);
List transforms = new ArrayList();
List<String> transforms = new ArrayList<>();
transforms.add("0");
transforms.add("1");
transforms.add("2");
@ -205,7 +205,7 @@ public class JPEGImageMetadataFormat extends JPEGMetadataFormat {
addElement("componentSpec", "sof", CHILD_POLICY_EMPTY);
List procs = new ArrayList();
List<String> procs = new ArrayList<>();
procs.add("0");
procs.add("1");
procs.add("2");
@ -234,7 +234,7 @@ public class JPEGImageMetadataFormat extends JPEGMetadataFormat {
null,
"0", "65535",
true, true);
List comps = new ArrayList();
List<String> comps = new ArrayList<>();
comps.add("1");
comps.add("2");
comps.add("3");
@ -267,7 +267,7 @@ public class JPEGImageMetadataFormat extends JPEGMetadataFormat {
null,
"1", "255",
true, true);
List tabids = new ArrayList();
List<String> tabids = new ArrayList<>();
tabids.add("0");
tabids.add("1");
tabids.add("2");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,7 @@ public class JPEGImageReader extends ImageReader {
* List of stream positions for images, reinitialized every time
* a new input source is set.
*/
private List imagePositions = null;
private List<Long> imagePositions = null;
/**
* The number of images in the stream, or 0.
@ -223,9 +223,9 @@ public class JPEGImageReader extends ImageReader {
private DisposerRecord disposerRecord;
/** Sets up static C structures. */
private static native void initReaderIDs(Class iisClass,
Class qTableClass,
Class huffClass);
private static native void initReaderIDs(Class<?> iisClass,
Class<?> qTableClass,
Class<?> huffClass);
public JPEGImageReader(ImageReaderSpi originator) {
super(originator);
@ -375,7 +375,7 @@ public class JPEGImageReader extends ImageReader {
currentImage = 0;
}
if (seekForwardOnly) {
Long pos = (Long) imagePositions.get(imagePositions.size()-1);
Long pos = imagePositions.get(imagePositions.size()-1);
iis.flushBefore(pos.longValue());
}
tablesOnlyChecked = true;
@ -392,6 +392,7 @@ public class JPEGImageReader extends ImageReader {
}
}
@SuppressWarnings("fallthrough")
private int getNumImagesOnThread(boolean allowSearch)
throws IOException {
if (numImages != 0) {
@ -481,12 +482,12 @@ public class JPEGImageReader extends ImageReader {
checkTablesOnly();
}
if (imageIndex < imagePositions.size()) {
iis.seek(((Long)(imagePositions.get(imageIndex))).longValue());
iis.seek(imagePositions.get(imageIndex).longValue());
} else {
// read to start of image, saving positions
// First seek to the last position we already have, and skip the
// entire image
Long pos = (Long) imagePositions.get(imagePositions.size()-1);
Long pos = imagePositions.get(imagePositions.size()-1);
iis.seek(pos.longValue());
skipImage();
// Now add all intervening positions, skipping images
@ -766,7 +767,7 @@ public class JPEGImageReader extends ImageReader {
}
}
public Iterator getImageTypes(int imageIndex)
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
throws IOException {
setThreadLock();
try {
@ -776,7 +777,7 @@ public class JPEGImageReader extends ImageReader {
}
}
private Iterator getImageTypesOnThread(int imageIndex)
private Iterator<ImageTypeSpecifier> getImageTypesOnThread(int imageIndex)
throws IOException {
if (currentImage != imageIndex) {
cbLock.check();
@ -1063,7 +1064,7 @@ public class JPEGImageReader extends ImageReader {
if (!wantRaster){
// Can we read this image?
Iterator imageTypes = getImageTypes(imageIndex);
Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
if (imageTypes.hasNext() == false) {
throw new IIOException("Unsupported Image Type");
}
@ -1187,8 +1188,8 @@ public class JPEGImageReader extends ImageReader {
// and set knownPassCount
if (imageIndex == imageMetadataIndex) { // We have metadata
knownPassCount = 0;
for (Iterator iter = imageMetadata.markerSequence.iterator();
iter.hasNext();) {
for (Iterator<MarkerSegment> iter =
imageMetadata.markerSequence.iterator(); iter.hasNext();) {
if (iter.next() instanceof SOSMarkerSegment) {
knownPassCount++;
}
@ -1565,7 +1566,7 @@ public class JPEGImageReader extends ImageReader {
// reset local Java structures
numImages = 0;
imagePositions = new ArrayList();
imagePositions = new ArrayList<>();
currentImage = -1;
image = null;
raster = null;

View file

@ -46,7 +46,7 @@ public class JPEGImageReaderSpi extends ImageReaderSpi {
JPEG.suffixes,
JPEG.MIMETypes,
"com.sun.imageio.plugins.jpeg.JPEGImageReader",
new Class[] { ImageInputStream.class },
new Class<?>[] { ImageInputStream.class },
writerSpiNames,
true,
JPEG.nativeStreamMetadataFormatName,

View file

@ -107,7 +107,7 @@ public class JPEGImageWriter extends ImageWriter {
/**
* If there are thumbnails to be written, this is the list.
*/
private List thumbnails = null;
private List<? extends BufferedImage> thumbnails = null;
/**
* If metadata should include an icc profile, store it here.
@ -1394,14 +1394,14 @@ public class JPEGImageWriter extends ImageWriter {
*/
private int [] collectScans(JPEGMetadata metadata,
SOFMarkerSegment sof) {
List segments = new ArrayList();
List<SOSMarkerSegment> segments = new ArrayList<>();
int SCAN_SIZE = 9;
int MAX_COMPS_PER_SCAN = 4;
for (Iterator iter = metadata.markerSequence.iterator();
for (Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
iter.hasNext();) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof SOSMarkerSegment) {
segments.add(seg);
segments.add((SOSMarkerSegment) seg);
}
}
int [] retval = null;
@ -1411,7 +1411,7 @@ public class JPEGImageWriter extends ImageWriter {
retval = new int [numScans*SCAN_SIZE];
int index = 0;
for (int i = 0; i < numScans; i++) {
SOSMarkerSegment sos = (SOSMarkerSegment) segments.get(i);
SOSMarkerSegment sos = segments.get(i);
retval[index++] = sos.componentSpecs.length; // num comps
for (int j = 0; j < MAX_COMPS_PER_SCAN; j++) {
if (j < sos.componentSpecs.length) {
@ -1441,10 +1441,10 @@ public class JPEGImageWriter extends ImageWriter {
*/
private JPEGQTable [] collectQTablesFromMetadata
(JPEGMetadata metadata) {
ArrayList tables = new ArrayList();
Iterator iter = metadata.markerSequence.iterator();
ArrayList<DQTMarkerSegment.Qtable> tables = new ArrayList<>();
Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof DQTMarkerSegment) {
DQTMarkerSegment dqt =
(DQTMarkerSegment) seg;
@ -1456,7 +1456,7 @@ public class JPEGImageWriter extends ImageWriter {
retval = new JPEGQTable[tables.size()];
for (int i = 0; i < retval.length; i++) {
retval[i] =
new JPEGQTable(((DQTMarkerSegment.Qtable)tables.get(i)).data);
new JPEGQTable(tables.get(i).data);
}
}
return retval;
@ -1471,16 +1471,14 @@ public class JPEGImageWriter extends ImageWriter {
*/
private JPEGHuffmanTable[] collectHTablesFromMetadata
(JPEGMetadata metadata, boolean wantDC) throws IIOException {
ArrayList tables = new ArrayList();
Iterator iter = metadata.markerSequence.iterator();
ArrayList<DHTMarkerSegment.Htable> tables = new ArrayList<>();
Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof DHTMarkerSegment) {
DHTMarkerSegment dht =
(DHTMarkerSegment) seg;
DHTMarkerSegment dht = (DHTMarkerSegment) seg;
for (int i = 0; i < dht.tables.size(); i++) {
DHTMarkerSegment.Htable htable =
(DHTMarkerSegment.Htable) dht.tables.get(i);
DHTMarkerSegment.Htable htable = dht.tables.get(i);
if (htable.tableClass == (wantDC ? 0 : 1)) {
tables.add(htable);
}
@ -1553,6 +1551,7 @@ public class JPEGImageWriter extends ImageWriter {
retval = JPEG.JCS_YCC;
}
}
break;
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_CMYK;
break;
@ -1592,6 +1591,7 @@ public class JPEGImageWriter extends ImageWriter {
retval = JPEG.JCS_YCC;
}
}
break;
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_CMYK;
break;
@ -1638,6 +1638,7 @@ public class JPEGImageWriter extends ImageWriter {
retval = JPEG.JCS_YCC;
}
}
break;
case ColorSpace.TYPE_CMYK:
retval = JPEG.JCS_YCCK;
break;
@ -1662,8 +1663,8 @@ public class JPEGImageWriter extends ImageWriter {
////////////// Native methods and callbacks
/** Sets up static native structures. */
private static native void initWriterIDs(Class qTableClass,
Class huffClass);
private static native void initWriterIDs(Class<?> qTableClass,
Class<?> huffClass);
/** Sets up per-writer native structure and returns a pointer to it. */
private native long initJPEGImageWriter();

View file

@ -50,7 +50,7 @@ public class JPEGImageWriterSpi extends ImageWriterSpi {
JPEG.suffixes,
JPEG.MIMETypes,
"com.sun.imageio.plugins.jpeg.JPEGImageWriter",
new Class[] { ImageOutputStream.class },
new Class<?>[] { ImageOutputStream.class },
readerSpiNames,
true,
JPEG.nativeStreamMetadataFormatName,

View file

@ -52,6 +52,7 @@ import java.io.IOException;
import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.Point;
@ -69,7 +70,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
* <code>markerSequence</code> is modified. This is used by reset
* to restore the original state.
*/
private List resetSequence = null;
private List<MarkerSegment> resetSequence = null;
/**
* Set to <code>true</code> when reading a thumbnail stored as
@ -100,7 +101,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
* list is package visible so that the writer can access it.
* @see #MarkerSegment
*/
List markerSequence = new ArrayList();
List<MarkerSegment> markerSequence = new ArrayList<>();
/**
* Indicates whether this object represents stream or image
@ -645,9 +646,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
* with the given tag, or null if none is found.
*/
MarkerSegment findMarkerSegment(int tag) {
Iterator iter = markerSequence.iterator();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment)iter.next();
MarkerSegment seg = iter.next();
if (seg.tag == tag) {
return seg;
}
@ -659,19 +660,20 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
* Returns the first or last MarkerSegment object in the list
* of the given class, or null if none is found.
*/
MarkerSegment findMarkerSegment(Class cls, boolean first) {
MarkerSegment findMarkerSegment(Class<? extends MarkerSegment> cls, boolean first) {
if (first) {
Iterator iter = markerSequence.iterator();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment)iter.next();
MarkerSegment seg = iter.next();
if (cls.isInstance(seg)) {
return seg;
}
}
} else {
ListIterator iter = markerSequence.listIterator(markerSequence.size());
ListIterator<MarkerSegment> iter =
markerSequence.listIterator(markerSequence.size());
while (iter.hasPrevious()) {
MarkerSegment seg = (MarkerSegment)iter.previous();
MarkerSegment seg = iter.previous();
if (cls.isInstance(seg)) {
return seg;
}
@ -684,19 +686,21 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
* Returns the index of the first or last MarkerSegment in the list
* of the given class, or -1 if none is found.
*/
private int findMarkerSegmentPosition(Class cls, boolean first) {
private int findMarkerSegmentPosition(Class<? extends MarkerSegment> cls,
boolean first) {
if (first) {
ListIterator iter = markerSequence.listIterator();
ListIterator<MarkerSegment> iter = markerSequence.listIterator();
for (int i = 0; iter.hasNext(); i++) {
MarkerSegment seg = (MarkerSegment)iter.next();
MarkerSegment seg = iter.next();
if (cls.isInstance(seg)) {
return i;
}
}
} else {
ListIterator iter = markerSequence.listIterator(markerSequence.size());
ListIterator<MarkerSegment> iter =
markerSequence.listIterator(markerSequence.size());
for (int i = markerSequence.size()-1; iter.hasPrevious(); i--) {
MarkerSegment seg = (MarkerSegment)iter.previous();
MarkerSegment seg = iter.previous();
if (cls.isInstance(seg)) {
return i;
}
@ -706,9 +710,10 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
}
private int findLastUnknownMarkerSegmentPosition() {
ListIterator iter = markerSequence.listIterator(markerSequence.size());
ListIterator<MarkerSegment> iter =
markerSequence.listIterator(markerSequence.size());
for (int i = markerSequence.size()-1; iter.hasPrevious(); i--) {
MarkerSegment seg = (MarkerSegment)iter.previous();
MarkerSegment seg = iter.previous();
if (seg.unknown == true) {
return i;
}
@ -733,15 +738,15 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
/**
* Returns a deep copy of the current marker sequence.
*/
private List cloneSequence() {
private List<MarkerSegment> cloneSequence() {
if (markerSequence == null) {
return null;
}
List retval = new ArrayList(markerSequence.size());
Iterator iter = markerSequence.iterator();
List<MarkerSegment> retval = new ArrayList<>(markerSequence.size());
Iterator<MarkerSegment> iter = markerSequence.iterator();
while(iter.hasNext()) {
MarkerSegment seg = (MarkerSegment)iter.next();
retval.add(seg.clone());
MarkerSegment seg = iter.next();
retval.add((MarkerSegment) seg.clone());
}
return retval;
@ -774,7 +779,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
IIOMetadataNode getNativeTree() {
IIOMetadataNode root;
IIOMetadataNode top;
Iterator iter = markerSequence.iterator();
Iterator<MarkerSegment> iter = markerSequence.iterator();
if (isStream) {
root = new IIOMetadataNode(JPEG.nativeStreamMetadataFormatName);
top = root;
@ -797,7 +802,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
top = sequence;
}
while(iter.hasNext()) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
top.appendChild(seg.getNativeNode());
}
return root;
@ -961,9 +966,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
// NumProgressiveScans - count sos segments
int sosCount = 0;
Iterator iter = markerSequence.iterator();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment ms = (MarkerSegment) iter.next();
MarkerSegment ms = iter.next();
if (ms.tag == JPEG.SOS) {
sosCount++;
}
@ -1028,9 +1033,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
// Add a text entry for each COM Marker Segment
if (findMarkerSegment(JPEG.COM) != null) {
text = new IIOMetadataNode("Text");
Iterator iter = markerSequence.iterator();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
if (seg.tag == JPEG.COM) {
COMMarkerSegment com = (COMMarkerSegment) seg;
IIOMetadataNode entry = new IIOMetadataNode("TextEntry");
@ -1068,7 +1073,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
if (root == null) {
throw new IllegalArgumentException("null root!");
}
List copy = null;
List<MarkerSegment> copy = null;
if (resetSequence == null) {
resetSequence = cloneSequence(); // Deep copy
copy = resetSequence; // Avoid cloning twice
@ -1181,12 +1186,12 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
*/
private void mergeDQTNode(Node node) throws IIOInvalidTreeException {
// First collect any existing DQT nodes into a local list
ArrayList oldDQTs = new ArrayList();
Iterator iter = markerSequence.iterator();
ArrayList<DQTMarkerSegment> oldDQTs = new ArrayList<>();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof DQTMarkerSegment) {
oldDQTs.add(seg);
oldDQTs.add((DQTMarkerSegment) seg);
}
}
if (!oldDQTs.isEmpty()) {
@ -1201,10 +1206,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
DQTMarkerSegment dqt = null;
int tableIndex = -1;
for (int j = 0; j < oldDQTs.size(); j++) {
DQTMarkerSegment testDQT = (DQTMarkerSegment) oldDQTs.get(j);
DQTMarkerSegment testDQT = oldDQTs.get(j);
for (int k = 0; k < testDQT.tables.size(); k++) {
DQTMarkerSegment.Qtable testTable =
(DQTMarkerSegment.Qtable) testDQT.tables.get(k);
DQTMarkerSegment.Qtable testTable = testDQT.tables.get(k);
if (childID == testTable.tableID) {
dqt = testDQT;
tableIndex = k;
@ -1216,7 +1220,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
if (dqt != null) {
dqt.tables.set(tableIndex, dqt.getQtableFromNode(child));
} else {
dqt = (DQTMarkerSegment) oldDQTs.get(oldDQTs.size()-1);
dqt = oldDQTs.get(oldDQTs.size()-1);
dqt.tables.add(dqt.getQtableFromNode(child));
}
}
@ -1257,12 +1261,12 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
*/
private void mergeDHTNode(Node node) throws IIOInvalidTreeException {
// First collect any existing DQT nodes into a local list
ArrayList oldDHTs = new ArrayList();
Iterator iter = markerSequence.iterator();
ArrayList<DHTMarkerSegment> oldDHTs = new ArrayList<>();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while (iter.hasNext()) {
MarkerSegment seg = (MarkerSegment) iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof DHTMarkerSegment) {
oldDHTs.add(seg);
oldDHTs.add((DHTMarkerSegment) seg);
}
}
if (!oldDHTs.isEmpty()) {
@ -1283,10 +1287,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
DHTMarkerSegment dht = null;
int tableIndex = -1;
for (int j = 0; j < oldDHTs.size(); j++) {
DHTMarkerSegment testDHT = (DHTMarkerSegment) oldDHTs.get(j);
DHTMarkerSegment testDHT = oldDHTs.get(j);
for (int k = 0; k < testDHT.tables.size(); k++) {
DHTMarkerSegment.Htable testTable =
(DHTMarkerSegment.Htable) testDHT.tables.get(k);
DHTMarkerSegment.Htable testTable = testDHT.tables.get(k);
if ((childID == testTable.tableID) &&
(childClass == testTable.tableClass)) {
dht = testDHT;
@ -1299,7 +1302,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
if (dht != null) {
dht.tables.set(tableIndex, dht.getHtableFromNode(child));
} else {
dht = (DHTMarkerSegment) oldDHTs.get(oldDHTs.size()-1);
dht = oldDHTs.get(oldDHTs.size()-1);
dht.tables.add(dht.getHtableFromNode(child));
}
}
@ -1735,8 +1738,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
}
if (idsDiffer) {
// update the ids in each SOS marker segment
for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
MarkerSegment seg = (MarkerSegment) iter.next();
for (Iterator<MarkerSegment> iter = markerSequence.iterator();
iter.hasNext();) {
MarkerSegment seg = iter.next();
if (seg instanceof SOSMarkerSegment) {
SOSMarkerSegment target = (SOSMarkerSegment) seg;
for (int i = 0; i < target.componentSpecs.length; i++) {
@ -1788,11 +1792,12 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
}
if (updateQtables) {
List tableSegments = new ArrayList();
for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
MarkerSegment seg = (MarkerSegment) iter.next();
List<DQTMarkerSegment> tableSegments = new ArrayList<>();
for (Iterator<MarkerSegment> iter = markerSequence.iterator();
iter.hasNext();) {
MarkerSegment seg = iter.next();
if (seg instanceof DQTMarkerSegment) {
tableSegments.add(seg);
tableSegments.add((DQTMarkerSegment) seg);
}
}
// If there are no tables, don't add them, as the metadata encodes an
@ -1806,12 +1811,12 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
// Find the table with selector 1.
boolean found = false;
for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
DQTMarkerSegment testdqt = (DQTMarkerSegment) iter.next();
for (Iterator tabiter = testdqt.tables.iterator();
tabiter.hasNext();) {
DQTMarkerSegment.Qtable tab =
(DQTMarkerSegment.Qtable) tabiter.next();
for (Iterator<DQTMarkerSegment> iter = tableSegments.iterator();
iter.hasNext();) {
DQTMarkerSegment testdqt = iter.next();
for (Iterator<DQTMarkerSegment.Qtable> tabiter =
testdqt.tables.iterator(); tabiter.hasNext();) {
DQTMarkerSegment.Qtable tab = tabiter.next();
if (tab.tableID == 1) {
found = true;
}
@ -1820,12 +1825,12 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
if (!found) {
// find the table with selector 0. There should be one.
DQTMarkerSegment.Qtable table0 = null;
for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
DQTMarkerSegment testdqt = (DQTMarkerSegment) iter.next();
for (Iterator tabiter = testdqt.tables.iterator();
tabiter.hasNext();) {
DQTMarkerSegment.Qtable tab =
(DQTMarkerSegment.Qtable) tabiter.next();
for (Iterator<DQTMarkerSegment> iter =
tableSegments.iterator(); iter.hasNext();) {
DQTMarkerSegment testdqt = iter.next();
for (Iterator<DQTMarkerSegment.Qtable> tabiter =
testdqt.tables.iterator(); tabiter.hasNext();) {
DQTMarkerSegment.Qtable tab = tabiter.next();
if (tab.tableID == 0) {
table0 = tab;
}
@ -1835,19 +1840,19 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
// Assuming that the table with id 0 is a luminance table,
// compute a new chrominance table of the same quality and
// add it to the last DQT segment
DQTMarkerSegment dqt =
(DQTMarkerSegment) tableSegments.get(tableSegments.size()-1);
DQTMarkerSegment dqt = tableSegments.get(tableSegments.size()-1);
dqt.tables.add(dqt.getChromaForLuma(table0));
}
}
}
if (updateHtables) {
List tableSegments = new ArrayList();
for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
MarkerSegment seg = (MarkerSegment) iter.next();
List<DHTMarkerSegment> tableSegments = new ArrayList<>();
for (Iterator<MarkerSegment> iter = markerSequence.iterator();
iter.hasNext();) {
MarkerSegment seg = iter.next();
if (seg instanceof DHTMarkerSegment) {
tableSegments.add(seg);
tableSegments.add((DHTMarkerSegment) seg);
}
}
// If there are no tables, don't add them, as the metadata encodes an
@ -1860,12 +1865,12 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
// find a table with selector 1. AC/DC is irrelevant
boolean found = false;
for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
DHTMarkerSegment testdht = (DHTMarkerSegment) iter.next();
for (Iterator tabiter = testdht.tables.iterator();
tabiter.hasNext();) {
DHTMarkerSegment.Htable tab =
(DHTMarkerSegment.Htable) tabiter.next();
for (Iterator<DHTMarkerSegment> iter = tableSegments.iterator();
iter.hasNext();) {
DHTMarkerSegment testdht = iter.next();
for (Iterator<DHTMarkerSegment.Htable> tabiter =
testdht.tables.iterator(); tabiter.hasNext();) {
DHTMarkerSegment.Htable tab = tabiter.next();
if (tab.tableID == 1) {
found = true;
}
@ -1875,7 +1880,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
// Create new standard dc and ac chrominance tables and add them
// to the last DHT segment
DHTMarkerSegment lastDHT =
(DHTMarkerSegment) tableSegments.get(tableSegments.size()-1);
tableSegments.get(tableSegments.size()-1);
lastDHT.addHtable(JPEGHuffmanTable.StdDCLuminance, true, 1);
lastDHT.addHtable(JPEGHuffmanTable.StdACLuminance, true, 1);
}
@ -2181,7 +2186,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
if (resetSequence == null) {
resetSequence = markerSequence;
}
markerSequence = new ArrayList();
markerSequence = new ArrayList<>();
// Build a whole new marker sequence from the tree
@ -2310,10 +2315,10 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
* segments, including 0 if there are no SOS marker segments.
*/
private int countScanBands() {
List ids = new ArrayList();
Iterator iter = markerSequence.iterator();
List<Integer> ids = new ArrayList<>();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while(iter.hasNext()) {
MarkerSegment seg = (MarkerSegment)iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof SOSMarkerSegment) {
SOSMarkerSegment sos = (SOSMarkerSegment) seg;
SOSMarkerSegment.ScanComponentSpec [] specs = sos.componentSpecs;
@ -2334,7 +2339,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
void writeToStream(ImageOutputStream ios,
boolean ignoreJFIF,
boolean forceJFIF,
List thumbnails,
List<? extends BufferedImage> thumbnails,
ICC_Profile iccProfile,
boolean ignoreAdobe,
int newAdobeTransform,
@ -2360,9 +2365,9 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
}
}
// Iterate over each MarkerSegment
Iterator iter = markerSequence.iterator();
Iterator<MarkerSegment> iter = markerSequence.iterator();
while(iter.hasNext()) {
MarkerSegment seg = (MarkerSegment)iter.next();
MarkerSegment seg = iter.next();
if (seg instanceof JFIFMarkerSegment) {
if (ignoreJFIF == false) {
JFIFMarkerSegment jfif = (JFIFMarkerSegment) seg;
@ -2409,7 +2414,7 @@ public class JPEGMetadata extends IIOMetadata implements Cloneable {
public void print() {
for (int i = 0; i < markerSequence.size(); i++) {
MarkerSegment seg = (MarkerSegment) markerSequence.get(i);
MarkerSegment seg = markerSequence.get(i);
seg.print();
}
}

View file

@ -56,7 +56,7 @@ abstract class JPEGMetadataFormat extends IIOMetadataFormatImpl {
DATATYPE_INTEGER,
false,
"0");
List tabids = new ArrayList();
List<String> tabids = new ArrayList<>();
tabids.add("0");
tabids.add("1");
tabids.add("2");
@ -74,7 +74,7 @@ abstract class JPEGMetadataFormat extends IIOMetadataFormatImpl {
addElement("dht", parentName, 1, 4);
addElement("dhtable", "dht", CHILD_POLICY_EMPTY);
List classes = new ArrayList();
List<String> classes = new ArrayList<>();
classes.add("0");
classes.add("1");
addAttribute("dhtable",

View file

@ -60,7 +60,7 @@ public class PNGImageReaderSpi extends ImageReaderSpi {
suffixes,
MIMETypes,
readerClassName,
new Class[] { ImageInputStream.class },
new Class<?>[] { ImageInputStream.class },
writerSpiNames,
false,
null, null,

View file

@ -656,16 +656,16 @@ public class PNGImageWriter extends ImageWriter {
}
private void write_tEXt() throws IOException {
Iterator keywordIter = metadata.tEXt_keyword.iterator();
Iterator textIter = metadata.tEXt_text.iterator();
Iterator<String> keywordIter = metadata.tEXt_keyword.iterator();
Iterator<String> textIter = metadata.tEXt_text.iterator();
while (keywordIter.hasNext()) {
ChunkStream cs = new ChunkStream(PNGImageReader.tEXt_TYPE, stream);
String keyword = (String)keywordIter.next();
String keyword = keywordIter.next();
cs.writeBytes(keyword);
cs.writeByte(0);
String text = (String)textIter.next();
String text = textIter.next();
cs.writeBytes(text);
cs.finish();
}
@ -717,33 +717,33 @@ public class PNGImageWriter extends ImageWriter {
}
private void write_zTXt() throws IOException {
Iterator keywordIter = metadata.zTXt_keyword.iterator();
Iterator methodIter = metadata.zTXt_compressionMethod.iterator();
Iterator textIter = metadata.zTXt_text.iterator();
Iterator<String> keywordIter = metadata.zTXt_keyword.iterator();
Iterator<Integer> methodIter = metadata.zTXt_compressionMethod.iterator();
Iterator<String> textIter = metadata.zTXt_text.iterator();
while (keywordIter.hasNext()) {
ChunkStream cs = new ChunkStream(PNGImageReader.zTXt_TYPE, stream);
String keyword = (String)keywordIter.next();
String keyword = keywordIter.next();
cs.writeBytes(keyword);
cs.writeByte(0);
int compressionMethod = ((Integer)methodIter.next()).intValue();
int compressionMethod = (methodIter.next()).intValue();
cs.writeByte(compressionMethod);
String text = (String)textIter.next();
String text = textIter.next();
cs.write(deflate(text.getBytes("ISO-8859-1")));
cs.finish();
}
}
private void writeUnknownChunks() throws IOException {
Iterator typeIter = metadata.unknownChunkType.iterator();
Iterator dataIter = metadata.unknownChunkData.iterator();
Iterator<String> typeIter = metadata.unknownChunkType.iterator();
Iterator<byte[]> dataIter = metadata.unknownChunkData.iterator();
while (typeIter.hasNext() && dataIter.hasNext()) {
String type = (String)typeIter.next();
String type = typeIter.next();
ChunkStream cs = new ChunkStream(chunkType(type), stream);
byte[] data = (byte[])dataIter.next();
byte[] data = dataIter.next();
cs.write(data);
cs.finish();
}

View file

@ -62,7 +62,7 @@ public class PNGImageWriterSpi extends ImageWriterSpi {
suffixes,
MIMETypes,
writerClassName,
new Class[] { ImageOutputStream.class },
new Class<?>[] { ImageOutputStream.class },
readerSpiNames,
false,
null, null,

View file

@ -152,14 +152,14 @@ public class WBMPImageReader extends ImageReader {
gotHeader = true;
}
public Iterator getImageTypes(int imageIndex)
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
throws IOException {
checkIndex(imageIndex);
readHeader();
BufferedImage bi =
new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_BINARY);
ArrayList list = new ArrayList(1);
ArrayList<ImageTypeSpecifier> list = new ArrayList<>(1);
list.add(new ImageTypeSpecifier(bi));
return list.iterator();
}

View file

@ -55,7 +55,7 @@ public class WBMPImageReaderSpi extends ImageReaderSpi {
entensions,
mimeType,
"com.sun.imageio.plugins.wbmp.WBMPImageReader",
new Class[] { ImageInputStream.class },
new Class<?>[] { ImageInputStream.class },
writerSpiNames,
true,
null, null, null, null,

View file

@ -55,7 +55,7 @@ public class WBMPImageWriterSpi extends ImageWriterSpi {
entensions,
mimeType,
"com.sun.imageio.plugins.wbmp.WBMPImageWriter",
new Class[] { ImageOutputStream.class },
new Class<?>[] { ImageOutputStream.class },
readerSpiNames,
true,
null, null, null, null,

View file

@ -37,7 +37,7 @@ public class FileImageInputStreamSpi extends ImageInputStreamSpi {
private static final String version = "1.0";
private static final Class inputClass = File.class;
private static final Class<?> inputClass = File.class;
public FileImageInputStreamSpi() {
super(vendorName, version, inputClass);

View file

@ -37,7 +37,7 @@ public class FileImageOutputStreamSpi extends ImageOutputStreamSpi {
private static final String version = "1.0";
private static final Class outputClass = File.class;
private static final Class<?> outputClass = File.class;
public FileImageOutputStreamSpi() {
super(vendorName, version, outputClass);

View file

@ -40,7 +40,7 @@ public class InputStreamImageInputStreamSpi extends ImageInputStreamSpi {
private static final String version = "1.0";
private static final Class inputClass = InputStream.class;
private static final Class<?> inputClass = InputStream.class;
public InputStreamImageInputStreamSpi() {
super(vendorName, version, inputClass);

View file

@ -40,7 +40,7 @@ public class OutputStreamImageOutputStreamSpi extends ImageOutputStreamSpi {
private static final String version = "1.0";
private static final Class outputClass = OutputStream.class;
private static final Class<?> outputClass = OutputStream.class;
public OutputStreamImageOutputStreamSpi() {
super(vendorName, version, outputClass);

View file

@ -38,7 +38,7 @@ public class RAFImageInputStreamSpi extends ImageInputStreamSpi {
private static final String version = "1.0";
private static final Class inputClass = RandomAccessFile.class;
private static final Class<?> inputClass = RandomAccessFile.class;
public RAFImageInputStreamSpi() {
super(vendorName, version, inputClass);

View file

@ -38,7 +38,7 @@ public class RAFImageOutputStreamSpi extends ImageOutputStreamSpi {
private static final String version = "1.0";
private static final Class outputClass = RandomAccessFile.class;
private static final Class<?> outputClass = RandomAccessFile.class;
public RAFImageOutputStreamSpi() {
super(vendorName, version, outputClass);

View file

@ -82,7 +82,7 @@ public class StreamCloser {
};
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
new java.security.PrivilegedAction<Object>() {
public Object run() {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.

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