提交 82065168 编写于 作者: Y yan

Merge

^build/
^dist/
^nbproject/private/
^make/netbeans/.*/nbproject/private/
^make/netbeans/.*/build/
^make/netbeans/.*/dist/
......@@ -45,3 +45,5 @@ a952aafd5181af953b0ef3010dbd2fcc28460e8a jdk7-b67
b23d905cb5d3b382295240d28ab0bfb266b4503c jdk7-b68
226b20019b1f020c09ea97d137d98e011ce65d76 jdk7-b69
893bcca951b747ddcf6986362b877f0e1dbb835b jdk7-b70
b3f3240135f0c10b9f2481c174b81b7fcf0daa60 jdk7-b71
460639b036f327282832a4fe52b7aa45688afd50 jdk7-b72
......@@ -9,35 +9,25 @@ Simple Build Instructions:
http://java.sun.com/javase/downloads/index.jsp
Set the environment variable ALT_BOOTDIR to the location of this JDK 6.
2. Download and install the JIBX libraries, version 1.1.5 from
http://sourceforge.net/project/showfiles.php?group_id=69358&package_id=68290
You'll need the following four JAR files:
bcel.jar
jibx-bind.jar
jibx-run.jar
xpp3.jar
Set the environment variable ALT_JIBX_LIBS_PATH to the location of
these JAR files.
3. Download and install the Binary Plugs for the most recent JDK7 from
2. Download and install the Binary Plugs for the most recent JDK7 from
http://download.java.net/openjdk/jdk7/
Set the environment variable ALT_BINARY_PLUGS_PATH to the location of
these binary plugs.
4. Either download and install the latest JDK7 from
3. Either download and install the latest JDK7 from
http://download.java.net/openjdk/jdk7/, or build your own complete
OpenJDK7 by using the top level Makefile in the OpenJDK Mercurial forest.
Set the environment variable ALT_JDK_IMPORT_PATH to the location of
this latest JDK7 or OpenJDK7 build.
5. Check the sanity of doing a build with the current machine:
4. Check the sanity of doing a build with the current machine:
cd make && gnumake sanity
See README-builds.html if you run into problems.
6. Do a partial build of the jdk:
5. Do a partial build of the jdk:
cd make && gnumake all
7. Construct the images:
6. Construct the images:
cd make && gnumake images
The resulting JDK image should be found in build/*/j2sdk-image
......
......@@ -67,15 +67,14 @@ ifeq ($(STANDALONE),true)
$(ZIPOBJDIR)/deflate.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/trees.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/zadler32.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/compress.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/zutil.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/inflate.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/infblock.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/infcodes.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/infback.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/inftrees.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/infutil.$(OBJECT_SUFFIX) \
$(ZIPOBJDIR)/inffast.$(OBJECT_SUFFIX)
ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
ZINCLUDE=-I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
OTHER_CXXFLAGS += $(ZINCLUDE)
LDDFLAGS += $(ZIPOBJS)
else
......
......@@ -242,6 +242,12 @@ DEVTOOLS_FT_DIR_EXISTS = $(shell \
endif
endif
#
# zlib version
#
ZLIB_VERSION = 1.2.3
#
# Localizations for the different parts of the product beyond English
#
......
......@@ -93,8 +93,7 @@ sanity-all:: sanity-base \
sane-alt_bootdir \
sane-bootdir \
sane-local-bootdir \
sane-alsa-headers \
sane-jibx
sane-alsa-headers
ifdef OPENJDK
sanity-all:: sane-freetype
......
......@@ -201,7 +201,10 @@ endif
ifeq ($(JAVAC_WARNINGS_FATAL), true)
BOOT_JAVACFLAGS += -Werror
endif
BOOT_JAVACFLAGS += -encoding ascii
BOOT_SOURCE_LANGUAGE_VERSION = 6
BOOT_TARGET_CLASS_VERSION = 6
BOOT_JAVACFLAGS += -encoding ascii -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
......
......@@ -536,15 +536,6 @@ endif
# NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64
BINDIR = $(OUTPUTDIR)/bin$(ISA_DIR)
# JIBX_LIBS_PATH: path to JIBX libraries, needed for NimbusLookAndFeel
ifdef ALT_JIBX_LIBS_PATH
JIBX_LIBS_PATH:=$(call FullPath,$(ALT_JIBX_LIBS_PATH))
JIBX_LIBS_PATH:=$(call AltCheckSpaces,JIBX_LIBS_PATH)
JIBX_LIBS_PATH:=$(call AltCheckValue,JIBX_LIBS_PATH)
else
JIBX_LIBS_PATH=$(JDK_DEVTOOLS_DIR)/share/jibx/lib
endif
# MOZILLA_HEADERS_PATH: path to mozilla header files for plugin
ifdef ALT_MOZILLA_HEADERS_PATH
MOZILLA_HEADERS_PATH :=$(call FullPath,$(ALT_MOZILLA_HEADERS_PATH))
......
......@@ -233,7 +233,6 @@ ifeq ($(PLATFORM),windows)
endif
endif
ALL_SETTINGS+=$(call addAltSetting,CACERTS_FILE)
ALL_SETTINGS+=$(call addAltSetting,JIBX_LIBS_PATH)
ifndef OPENJDK
ALL_SETTINGS+=$(call addAltSetting,MOZILLA_HEADERS_PATH)
endif
......
......@@ -214,7 +214,6 @@ include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk
sane-link \
sane-cacerts \
sane-alsa-headers \
sane-jibx \
sane-ant_version \
sane-zip_version \
sane-unzip_version \
......@@ -1516,22 +1515,6 @@ ifeq ($(PLATFORM), solaris)
endif
######################################################
# JIBX_LIBS_PATH must be valid
######################################################
sane-jibx:
ifdef DISABLE_NIMBUS
$(call SanityWarning,Disabling Nimbus will remove public API in javax.swing.plaf.nimbus.)
else
@if [ ! -r $(subst \,/,$(JIBX_LIBS_PATH))/jibx-run.jar ]; then \
$(ECHO) "ERROR: You do not have access to valid JIBX library files. \n" \
" Please check your access to \n" \
" $(subst \,/,$(JIBX_LIBS_PATH))/jibx-run.jar \n" \
" and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_JIBX_LIBS_PATH \n" \
"" >> $(ERROR_FILE) ; \
fi
endif
######################################################
# MOZILLA_HEADERS_PATH must be valid
######################################################
......
......@@ -44,7 +44,6 @@ MS_RUNTIME_STATIC = true
include $(BUILDDIR)/common/Defs.gmk
ZLIB_VERSION = 1.1.3
ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin
......@@ -68,12 +67,10 @@ FILES_c = \
wildcard.c \
jli_util.c \
inflate.c \
infblock.c \
inftrees.c \
infcodes.c \
inffast.c \
infutil.c \
zadler32.c \
zcrc32.c \
zutil.c
ifneq ($(PLATFORM), windows)
......
......@@ -160,7 +160,6 @@ FILES_src = \
\
sun/nio/ByteBuffered.java \
\
sun/nio/ch/AbstractFuture.java \
sun/nio/ch/AbstractPollArrayWrapper.java \
sun/nio/ch/AllocatedNativeObject.java \
sun/nio/ch/AsynchronousChannelGroupImpl.java \
......
......@@ -29,15 +29,16 @@ FILES_c = \
Deflater.c \
Inflater.c \
ZipFile.c \
zadler32.c \
zcrc32.c \
zip_util.c \
compress.c \
deflate.c \
trees.c \
zutil.c \
gzio.c \
infback.c \
inffast.c \
inflate.c \
infblock.c \
inftrees.c \
infcodes.c \
infutil.c \
inffast.c \
zip_util.c
trees.c \
uncompr.c \
zadler32.c \
zcrc32.c \
zutil.c
......@@ -30,7 +30,9 @@ LIBRARY = zip
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
ZLIB_VERSION = 1.1.3
#
# ZLIB_VERSION is defined in make/common/Defs.gmk
#
#
# Files to compile.
......
......@@ -32,38 +32,17 @@ text: .text%Java_java_util_zip_Inflater_initIDs;
text: .text%Java_java_util_zip_Inflater_init;
text: .text%inflateInit2_;
text: .text%zcalloc;
text: .text%inflate_blocks_new;
text: .text%inflate_blocks_reset;
text: .text%inflateReset;
text: .text%Java_java_util_zip_Inflater_inflateBytes;
text: .text%inflate;
text: .text%inflate_blocks;
text: .text%inflate_flush;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
text: .text%inflate_trees_bits;
text: .text%huft_build: OUTPUTDIR/tmp/sun/java.util.zip/zip/obj/inftrees.o;
text: .text%zcfree;
text: .text%inflate_trees_dynamic;
text: .text%inflate_codes_new;
text: .text%inflate_codes;
text: .text%inflate_fast;
text: .text%inflate_codes_free;
text: .text%inflate_trees_fixed;
# Test Exit
# Test Hello
# Test Sleep
# Test IntToString
# Test LoadToolkit
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
text: .text%ZIP_ReadEntry;
text: .text%InflateFully;
text: .text%inflateEnd;
text: .text%inflate_blocks_free;
# Test LoadFrame
# Test LoadJFrame
# Test JHello
# SwingSet
text: .text%Java_java_util_zip_Inflater_reset;
text: .text%Java_java_util_zip_ZipFile_close;
text: .text%ZIP_Close;
......
......@@ -31,37 +31,13 @@ text: .text%Java_java_util_zip_Inflater_initIDs;
text: .text%Java_java_util_zip_Inflater_init;
text: .text%inflateInit2_;
text: .text%zcalloc;
text: .text%inflate_blocks_new;
text: .text%inflate_blocks_reset;
text: .text%inflateReset;
text: .text%Java_java_util_zip_Inflater_inflateBytes;
text: .text%inflate;
text: .text%inflate_blocks;
text: .text%inflate_flush;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
text: .text%inflate_trees_bits;
text: .text%huft_build: OUTPUTDIR/tmp/sun/java.util.zip/zip/obj/inftrees.o;
text: .text%zcfree;
text: .text%inflate_trees_dynamic;
text: .text%inflate_codes_new;
text: .text%inflate_codes;
text: .text%inflate_fast;
text: .text%inflate_codes_free;
text: .text%inflate_trees_fixed;
# Test Exit
# Test Hello
# Test Sleep
# Test IntToString
# Test LoadToolkit
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
# Test LoadFrame
# Test LoadJFrame
# Test JHello
# SwingSet
text: .text%Java_java_util_zip_Inflater_reset;
text: .text%Java_java_util_zip_Inflater_end;
text: .text%inflateEnd;
text: .text%inflate_blocks_free;
text: .text%Java_java_util_zip_ZipFile_close;
text: .text%ZIP_Close;
data = R0x2000;
text = LOAD ?RXO;
# Test Null
text: .text%ZIP_Open;
text: .text%ZIP_Open_Generic;
text: .text%InitializeZip;
......@@ -32,38 +31,17 @@ text: .text%Java_java_util_zip_Inflater_initIDs;
text: .text%Java_java_util_zip_Inflater_init;
text: .text%inflateInit2_;
text: .text%zcalloc;
text: .text%inflate_blocks_new;
text: .text%inflate_blocks_reset;
text: .text%inflateReset;
text: .text%Java_java_util_zip_Inflater_inflateBytes;
text: .text%inflate;
text: .text%inflate_blocks;
text: .text%inflate_flush;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
text: .text%inflate_trees_bits;
text: .text%huft_build: OUTPUTDIR/tmp/sun/java.util.zip/zip/obj64/inftrees.o;
text: .text%zcfree;
text: .text%inflate_trees_dynamic;
text: .text%inflate_codes_new;
text: .text%inflate_codes;
text: .text%inflate_fast;
text: .text%inflate_codes_free;
text: .text%inflate_trees_fixed;
# Test Exit
# Test Hello
# Test Sleep
# Test IntToString
# Test LoadToolkit
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
text: .text%ZIP_ReadEntry;
text: .text%InflateFully;
text: .text%inflateEnd;
text: .text%inflate_blocks_free;
# Test LoadFrame
# Test LoadJFrame
# Test JHello
# SwingSet
text: .text%Java_java_util_zip_Inflater_reset;
text: .text%Java_java_util_zip_ZipFile_close;
text: .text%ZIP_Close;
......
......@@ -34,16 +34,14 @@ include $(BUILDDIR)/common/Defs.gmk
#
include FILES.gmk
AUTO_FILES_JAVA_DIRS = javax/swing/plaf sun/swing com/sun/java/swing/plaf
ifndef DISABLE_NIMBUS
SUBDIRS = nimbus
endif
# Nimbus is handled in its own directory
AUTO_JAVA_PRUNE = nimbus
ifeq ($(PLATFORM), windows)
# Don't build GTK L&F on Windows
AUTO_JAVA_PRUNE += gtk
AUTO_JAVA_PRUNE = gtk
endif
ifdef DISABLE_NIMBUS
AUTO_JAVA_PRUNE += nimbus
endif
MISC_FILES = $(MISC_SWING_FILES)
......@@ -52,6 +50,10 @@ ifneq ($(PLATFORM), windows)
MISC_FILES += $(MISC_SWING_FILES_UNIX)
endif
NIMBUS_GENSRC_DIR = $(GENSRCDIR)/javax/swing/plaf/nimbus
NIMBUS_SKIN_FILE = $(SWING_SRC)/plaf/nimbus/skin.laf
NIMBUS_GENERATOR_JAR = $(BUILDTOOLJARDIR)/generatenimbus.jar
FILES_java = $(FILES_SWING_java)
#
......@@ -75,14 +77,25 @@ endif
# Process LOGO_ICONS and Motif Icons first.
#
build: $(LOGO_ICONS) $(MISC_SWING_FILES_MOTIF_GIF) $(MISC_SWING_FILES_MOTIF_PNG) other_files
$(SUBDIRS-loop)
clean clobber::
$(SUBDIRS-loop)
$(NIMBUS_GENSRC_DIR): $(NIMBUS_SKIN_FILE) $(NIMBUS_GENERATOR_JAR)
@$(ECHO) "Generating Nimbus source files:"
$(RM) -r $(NIMBUS_GENSRC_DIR)
$(BOOT_JAVA_CMD) -jar $(NIMBUS_GENERATOR_JAR) \
-skinFile $(NIMBUS_SKIN_FILE) -buildDir $(GENSRCDIR) \
-packagePrefix $(PACKAGE).nimbus -lafName Nimbus
@$(ECHO) "Finished generating Nimbus source files"
clean:: classes.clean
$(RM) -r $(NIMBUS_GENSRC_DIR)
#
# Include
#
ifndef DISABLE_NIMBUS
CLASSES_INIT = $(NIMBUS_GENSRC_DIR)
endif
include $(BUILDDIR)/common/Classes.gmk
ifndef OPENJDK
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="jdwpgen" default="default" basedir=".">
<description>Builds, tests, and runs the project jdwpgen.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="jdwpgen-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
此差异已折叠。
#FindBugs User Preferences
#Mon Jun 15 13:37:16 PDT 2009
detectorAbnormalFinallyBlockReturn=AbnormalFinallyBlockReturn|false
detectorAbstractClassEmptyMethods=AbstractClassEmptyMethods|false
detectorAbstractOverriddenMethod=AbstractOverriddenMethod|false
detectorArrayBasedCollections=ArrayBasedCollections|false
detectorArrayWrappedCallByReference=ArrayWrappedCallByReference|false
detectorBloatedAssignmentScope=BloatedAssignmentScope|false
detectorBloatedSynchronizedBlock=BloatedSynchronizedBlock|false
detectorClassEnvy=ClassEnvy|false
detectorCollectStatistics=CollectStatistics|false
detectorConfusingAutoboxedOverloading=ConfusingAutoboxedOverloading|false
detectorConstantListIndex=ConstantListIndex|false
detectorCopiedOverriddenMethod=CopiedOverriddenMethod|false
detectorCustomBuiltXML=CustomBuiltXML|false
detectorCyclomaticComplexity=CyclomaticComplexity|false
detectorDateComparison=DateComparison|false
detectorDeclaredRuntimeException=DeclaredRuntimeException|false
detectorDeletingWhileIterating=DeletingWhileIterating|false
detectorDubiousListCollection=DubiousListCollection|false
detectorFieldCouldBeLocal=FieldCouldBeLocal|false
detectorFinalParameters=FinalParameters|false
detectorFloatingPointLoops=FloatingPointLoops|false
detectorInefficientStringBuffering=InefficientStringBuffering|false
detectorInheritanceTypeChecking=InheritanceTypeChecking|false
detectorJDBCVendorReliance=JDBCVendorReliance|false
detectorListIndexedIterating=ListIndexedIterating|false
detectorLiteralStringComparison=LiteralStringComparison|false
detectorLocalSynchronizedCollection=LocalSynchronizedCollection|false
detectorLostExceptionStackTrace=LostExceptionStackTrace|false
detectorManualArrayCopy=ManualArrayCopy|false
detectorMethodReturnsConstant=MethodReturnsConstant|false
detectorNeedlessAutoboxing=NeedlessAutoboxing|false
detectorNeedlessCustomSerialization=NeedlessCustomSerialization|false
detectorNeedlessInstanceRetrieval=NeedlessInstanceRetrieval|false
detectorNeedlessMemberCollectionSynchronization=NeedlessMemberCollectionSynchronization|false
detectorNonCollectionMethodUse=NonCollectionMethodUse|false
detectorNonOwnedSynchronization=NonOwnedSynchronization|false
detectorNonRecycleableTaglibs=NonRecycleableTaglibs|false
detectorOrphanedDOMNode=OrphanedDOMNode|false
detectorOverlyConcreteParameter=OverlyConcreteParameter|false
detectorParallelLists=ParallelLists|false
detectorPartiallyConstructedObjectAccess=PartiallyConstructedObjectAccess|false
detectorPossibleIncompleteSerialization=PossibleIncompleteSerialization|false
detectorPossibleMemoryBloat=PossibleMemoryBloat|false
detectorPossiblyRedundantMethodCalls=PossiblyRedundantMethodCalls|false
detectorSQLInLoop=SQLInLoop|false
detectorSection508Compliance=Section508Compliance|false
detectorSillynessPotPourri=SillynessPotPourri|false
detectorSloppyClassReflection=SloppyClassReflection|false
detectorSluggishGui=SluggishGui|false
detectorSpoiledChildInterfaceImplementor=SpoiledChildInterfaceImplementor|false
detectorSpuriousThreadStates=SpuriousThreadStates|false
detectorStaticArrayCreatedInMethod=StaticArrayCreatedInMethod|false
detectorStaticMethodInstanceInvocation=StaticMethodInstanceInvocation|false
detectorSuspiciousComparatorReturnValues=SuspiciousComparatorReturnValues|false
detectorSuspiciousJDKVersionUse=SuspiciousJDKVersionUse|false
detectorSuspiciousWaitOnConcurrentObject=SuspiciousWaitOnConcurrentObject|false
detectorSyncCollectionIterators=SyncCollectionIterators|false
detectorTailRecursion=TailRecursion|false
detectorUnnecessaryStoreBeforeReturn=UnnecessaryStoreBeforeReturn|false
detectorUnrelatedCollectionContents=UnrelatedCollectionContents|false
detectorUnrelatedReturnValues=UnrelatedReturnValues|false
detectorUseAddAll=UseAddAll|false
detectorUseCharacterParameterizedMethod=UseCharacterParameterizedMethod|false
detectorUseEnumCollections=UseEnumCollections|false
detectorUseSplit=UseSplit|false
detectorUseToArray=UseToArray|false
detector_threshold=2
effort=default
filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false
filter_settings_neg=|
build.xml.data.CRC32=b40e775f
build.xml.script.CRC32=af8dc3cb
build.xml.stylesheet.CRC32=958a1d3e
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=b40e775f
nbproject/build-impl.xml.script.CRC32=624d12c5
nbproject/build-impl.xml.stylesheet.CRC32=65b8de21
application.title=jdwpgen
application.vendor=sun
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/jdwpgen.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.tools-jdwpgen=../../tools/src/build/tools/jdwpgen
file.reference.tools-src=../../tools/src
includes=build/tools/jdwpgen/**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:all
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=true
javadoc.nonavbar=true
javadoc.notree=true
javadoc.private=true
javadoc.splitindex=false
javadoc.use=false
javadoc.version=false
javadoc.windowtitle=
main.class=jdwpgen.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.src.dir=${file.reference.tools-src}
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>jdwpgen</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
#Path to FindbugsSettingsFile (relative)
findbugs.settings.file=findbugs.settings
......@@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
tzdata2009g
tzdata2009l
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
......@@ -263,18 +265,18 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 -
# The following appeared in Red Hat bugzilla[1] (edited):
#
# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC =3D Thu =
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC = Thu =
# Apr 23
# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC =3D Fri =
# > 23:59:59 2009 EET isdst=0 gmtoff=7200
# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC = Fri =
# Apr 24
# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC =3D Thu =
# > 01:00:00 2009 EEST isdst=1 gmtoff=10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC = Thu =
# Aug 27
# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC =3D Thu =
# > 23:59:59 2009 EEST isdst=1 gmtoff=10800
# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC = Thu =
# Aug 27
# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
# > 23:00:00 2009 EET isdst=0 gmtoff=7200
#
# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
# :59)
......@@ -282,11 +284,11 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 -
#
# timeanddate[2] and another site I've found[3] also support that.
#
# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=3D492263">
# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=492263">
# https://bugzilla.redhat.com/show_bug.cgi?id=492263
# </a>
# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=3D53">
# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=53">
# http://www.timeanddate.com/worldclock/clockchange.html?n=53
# </a>
# [3] <a href="http://wwp.greenwichmeantime.com/time-zone/africa/egypt/">
# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
......@@ -296,8 +298,27 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s 0 -
# In 2009 (and for the next several years), Ramadan ends before the fourth
# Thursday in September; Egypt is expected to revert to the last Thursday
# in September.
# From Steffen Thorsen (2009-08-11):
# We have been able to confirm the August change with the Egyptian Cabinet
# Information and Decision Support Center:
# <a href="http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html">
# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
# </a>
#
# The Middle East News Agency
# <a href="http://www.mena.org.eg/index.aspx">
# http://www.mena.org.eg/index.aspx
# </a>
# also reports "Egypt starts winter time on August 21"
# today in article numbered "71, 11/08/2009 12:25 GMT."
# Only the title above is available without a subscription to their service,
# and can be found by searching for "winter" in their search engine
# (at least today).
Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
Rule Egypt 2009 max - Sep lastThu 23:00s 0 -
Rule Egypt 2009 only - Aug 20 23:00s 0 -
Rule Egypt 2010 max - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
......@@ -499,8 +520,8 @@ Zone Africa/Nouakchott -1:03:48 - LMT 1912
# From Riad M. Hossen Ally (2008-08-03):
# The Government of Mauritius weblink
# <a href="http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=3D4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD">
# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=3D4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
# <a href="http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD">
# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
# </a>
# Cabinet Decision of July 18th, 2008 states as follows:
#
......@@ -522,11 +543,33 @@ Zone Africa/Nouakchott -1:03:48 - LMT 1912
# http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
# </a>
# From Steffen Thorsen (2009-06-05):
# According to several sources, Mauritius will not continue to observe
# DST the coming summer...
#
# Some sources, in French:
# <a href="http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB">
# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
# </a>
# <a href="http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-">
# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
# </a>
#
# Our wrap-up:
# <a href="http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html">
# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
# </a>
# From Arthur David Olson (2009-07-11):
# The "mauritius-dst-will-not-repeat" wrapup includes this:
# "The trial ended on March 29, 2009, when the clocks moved back by one hour
# at 2am (or 02:00) local time..."
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mauritius 1982 only - Oct 10 0:00 1:00 S
Rule Mauritius 1983 only - Mar 21 0:00 0 -
Rule Mauritius 2008 max - Oct lastSun 2:00s 1:00 S
Rule Mauritius 2009 max - Mar lastSun 2:00s 0 -
Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 S
Rule Mauritius 2009 only - Mar lastSun 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
4:00 Mauritius MU%sT # Mauritius Time
......
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# From Paul Eggert (1999-11-15):
# To keep things manageable, we list only locations occupied year-round; see
......
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
......@@ -147,6 +149,57 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
3:00 - AST
# Bangladesh
# From Alexander Krivenyshev (2009-05-13):
# According to newspaper Asian Tribune (May 6, 2009) Bangladesh may introduce
# Daylight Saving Time from June 16 to Sept 30
#
# Bangladesh to introduce daylight saving time likely from June 16
# <a href="http://www.asiantribune.com/?q=node/17288">
# http://www.asiantribune.com/?q=node/17288
# </a>
# or
# <a href="http://www.worldtimezone.com/dst_news/dst_news_bangladesh02.html">
# http://www.worldtimezone.com/dst_news/dst_news_bangladesh02.html
# </a>
#
# "... Bangladesh government has decided to switch daylight saving time from
# June
# 16 till September 30 in a bid to ensure maximum use of daylight to cope with
# crippling power crisis. "
#
# The switch will remain in effect from June 16 to Sept 30 (2009) but if
# implemented the next year, it will come in force from April 1, 2010
# From Steffen Thorsen (2009-06-02):
# They have finally decided now, but changed the start date to midnight between
# the 19th and 20th, and they have not set the end date yet.
#
# Some sources:
# <a href="http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601">
# http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
# </a>
# <a href="http://bdnews24.com/details.php?id=85889&cid=2">
# http://bdnews24.com/details.php?id=85889&cid=2
# </a>
#
# Our wrap-up:
# <a href="http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html">
# http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
# </a>
# From A. N. M. Kamrus Saadat (2009-06-15):
# Finally we've got the official mail regarding DST start time where DST start
# time is mentioned as Jun 19 2009, 23:00 from BTRC (Bangladesh
# Telecommunication Regulatory Commission).
#
# No DST end date has been announced yet.
# From Arthur David Olson (2009-07-11):
# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
# can appear in the Dhaka binary file and for the benefit of old glibc
# reimplementations of the time zone software that mishandle permanent DST.
# A change will be required once the end date is known.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Dhaka 6:01:40 - LMT 1890
5:53:20 - HMT 1941 Oct # Howrah Mean Time?
......@@ -154,7 +207,9 @@ Zone Asia/Dhaka 6:01:40 - LMT 1890
5:30 - IST 1942 Sep
6:30 - BURT 1951 Sep 30
6:00 - DACT 1971 Mar 26 # Dacca Time
6:00 - BDT # Bangladesh Time
6:00 - BDT 2009 Jun 19 23:00 # Bangladesh Time
6:00 1:00 BDST 2010
6:00 - BDT
# Bhutan
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
......@@ -1129,7 +1184,7 @@ Rule Jordan 1995 1998 - Sep Fri>=15 0:00s 0 -
Rule Jordan 1999 only - Jul 1 0:00s 1:00 S
Rule Jordan 1999 2002 - Sep lastFri 0:00s 0 -
Rule Jordan 2000 2001 - Mar lastThu 0:00s 1:00 S
Rule Jordan 2002 max - Mar lastFri 0:00s 1:00 S
Rule Jordan 2002 max - Mar lastThu 24:00 1:00 S
Rule Jordan 2003 only - Oct 24 0:00s 0 -
Rule Jordan 2004 only - Oct 15 0:00s 0 -
Rule Jordan 2005 only - Sep lastFri 0:00s 0 -
......
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This file also includes Pacific islands.
......@@ -447,6 +449,22 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
-11:00 - SST # S=Samoa
# Samoa
# From Alexander Krivenyshev (2008-12-06):
# The Samoa government (Western Samoa) may implement DST on the first Sunday of
# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28,
# 2010).
#
# "Selected Committee reports to Cabinet on Daylight Saving Time",
# Government of Samoa:
# <a href="http://www.govt.ws/pr_article.cfm?pr_id=560">
# http://www.govt.ws/pr_article.cfm?pr_id=560
# </a>
# or
# <a href="http://www.worldtimezone.com/dst_news/dst_news_samoa01.html">
# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
# </a>
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
-11:26:56 - LMT 1911
-11:30 - SAMT 1950 # Samoa Time
......@@ -1141,6 +1159,27 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# From Paul Eggert (2007-07-23):
# See "southeast Australia" above for 2008 and later.
# From Steffen Thorsen (2009-04-28):
# According to the official press release, South Australia's extended daylight
# saving period will continue with the same rules as used during the 2008-2009
# summer (southern hemisphere).
#
# From
# <a href="http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf">
# http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf
# </a>
# The extended daylight saving period that South Australia has been trialling
# for over the last year is now set to be ongoing.
# Daylight saving will continue to start on the first Sunday in October each
# year and finish on the first Sunday in April the following year.
# Industrial Relations Minister, Paul Caica, says this provides South Australia
# with a consistent half hour time difference with NSW, Victoria, Tasmania and
# the ACT for all 52 weeks of the year...
#
# We have a wrap-up here:
# <a href="http://www.timeanddate.com/news/time/south-australia-extends-dst.html">
# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
# </a>
###############################################################################
# New Zealand
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This file provides links between current names for time zones
# and their old names. Many names changed in late 1993.
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# These entries are mostly present for historical reasons, so that
# people in areas not otherwise covered by the tz files could "zic -l"
......
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
......@@ -479,7 +481,7 @@ Rule EU 1979 1995 - Sep lastSun 1:00u 0 -
Rule EU 1981 max - Mar lastSun 1:00u 1:00 S
Rule EU 1996 max - Oct lastSun 1:00u 0 -
# The most recent directive covers the years starting in 2002. See:
# <a href="http://europa.eu.int/eur-lex/en/lif/dat/2000/en_300L0084.html">
# <a="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32000L0084:EN:NOT">
# Directive 2000/84/EC of the European Parliament and of the Council
# of 19 January 2001 on summer-time arrangements.
# </a>
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# For companies who don't want to put time zone specification in
# their installation procedures. When users run date, they'll get the message.
......
......@@ -21,9 +21,11 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# ISO 3166 alpha-2 country codes
#
#
# From Paul Eggert (2006-09-27):
#
# This file contains a table with the following columns:
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# Allowance for leapseconds added to each timezone file.
......@@ -75,13 +78,13 @@ Leap 2008 Dec 31 23:59:60 + S
# SERVICE DE LA ROTATION TERRESTRE
# OBSERVATOIRE DE PARIS
# 61, Av. de l'Observatoire 75014 PARIS (France)
# Tel. : 33 (0) 1 40 51 22 29
# Tel. : 33 (0) 1 40 51 22 26
# FAX : 33 (0) 1 40 51 22 91
# Internet : services.iers@obspm.fr
#
# Paris, 15 January 2009
# Paris, 4 July 2009
#
# Bulletin C 37
# Bulletin C 38
#
# To authorities responsible
# for the measurement and
......@@ -89,7 +92,7 @@ Leap 2008 Dec 31 23:59:60 + S
#
# INFORMATION ON UTC - TAI
#
# NO positive leap second will be introduced at the end of June 2009.
# NO positive leap second will be introduced at the end of December 2009.
# The difference between Coordinated Universal Time UTC and the
# International Atomic Time TAI is :
#
......@@ -101,6 +104,6 @@ Leap 2008 Dec 31 23:59:60 + S
# will be no time step at the next possible date.
#
# Daniel GAMBIS
# Head
# Earth Orientation Center of the IERS
# Director
# Earth Orientation Center of IERS
# Observatoire de Paris, France
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# also includes Central America and the Caribbean
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# From Arthur David Olson (1989-04-05):
# On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# So much for footnotes about Saudi Arabia.
# Apparent noon times below are for Riyadh; your mileage will vary.
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# Apparent noon times below are for Riyadh; they're a bit off for other places.
# Times were computed using formulas in the U.S. Naval Observatory's
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# Apparent noon times below are for Riyadh; they're a bit off for other places.
# Times were computed using a formula provided by the U. S. Naval Observatory:
......
......@@ -22,6 +22,8 @@
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
......@@ -696,8 +698,8 @@ Zone America/La_Paz -4:32:36 - LMT 1890
# From Rodrigo Severo (2008-06-24):
# Just correcting the URL:
# <a href="https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008">
# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008
# <a href="https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008">
# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008
# </a>
#
# As a result of the above Decree I believe the America/Rio_Branco
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# Old rules, should the need arise.
# No attempt is made to handle Newfoundland, since it cannot be expressed
......
......@@ -21,6 +21,9 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
# TZ zone descriptions
#
......@@ -123,7 +126,7 @@ BR -0640-06952 America/Eirunepe W Amazonas
BR -0958-06748 America/Rio_Branco Acre
BS +2505-07721 America/Nassau
BT +2728+08939 Asia/Thimphu
BW -2545+02555 Africa/Gaborone
BW -2439+02555 Africa/Gaborone
BY +5354+02734 Europe/Minsk
BZ +1730-08812 America/Belize
CA +4734-05243 America/St_Johns Newfoundland Time, including SE Labrador
......@@ -307,7 +310,7 @@ MY +0310+10142 Asia/Kuala_Lumpur peninsular Malaysia
MY +0133+11020 Asia/Kuching Sabah & Sarawak
MZ -2558+03235 Africa/Maputo
NA -2234+01706 Africa/Windhoek
NC -2216+16530 Pacific/Noumea
NC -2216+16627 Pacific/Noumea
NE +1331+00207 Africa/Niamey
NF -2903+16758 Pacific/Norfolk
NG +0627+00324 Africa/Lagos
......@@ -387,7 +390,7 @@ TK -0922-17114 Pacific/Fakaofo
TL -0833+12535 Asia/Dili
TM +3757+05823 Asia/Ashgabat
TN +3648+01011 Africa/Tunis
TO -2110+17510 Pacific/Tongatapu
TO -2110-17510 Pacific/Tongatapu
TR +4101+02858 Europe/Istanbul
TT +1039-06131 America/Port_of_Spain
TV -0831+17913 Pacific/Funafuti
......@@ -431,7 +434,7 @@ US +211825-1575130 Pacific/Honolulu Hawaii
UY -3453-05611 America/Montevideo
UZ +3940+06648 Asia/Samarkand west Uzbekistan
UZ +4120+06918 Asia/Tashkent east Uzbekistan
VA +4154+01227 Europe/Vatican
VA +415408+0122711 Europe/Vatican
VC +1309-06114 America/St_Vincent
VE +1030-06656 America/Caracas
VG +1827-06437 America/Tortola
......
......@@ -52,12 +52,10 @@ FILES_c = \
compress.c \
deflate.c \
gzio.c \
infblock.c \
infcodes.c \
infback.c \
inffast.c \
inflate.c \
inftrees.c \
infutil.c \
trees.c \
uncompr.c \
zadler32.c \
......
......@@ -77,13 +77,13 @@ endif # PLATFORM
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/splashscreen
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/giflib
vpath %.c $(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
vpath %.c $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/libpng
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/image/jpeg
vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen
CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen -I$(SHARE_SRC)/native/$(PKGDIR)/splashscreen
CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg -I$(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
# Shun the less than portable MMX assembly code in pnggccrd.c,
# and use alternative implementations in C.
......
......@@ -54,7 +54,7 @@ SUBDIRS = \
CharsetMapping
ifndef DISABLE_NIMBUS
SUBDIRS += swing-nimbus
SUBDIRS += generate_nimbus
endif
all build clean clobber::
......
......@@ -28,16 +28,21 @@ BUILDDIR = ../..
include $(BUILDDIR)/common/Defs.gmk
# Default name
FT_TEST = $(BUILDTOOLBINDIR)/freetype_versioncheck$(EXE_SUFFIX)
PROGRAM = freetype_versioncheck
FT_OBJ = $(BUILDTOOLBINDIR)/$(PROGRAM).$(OBJECT_SUFFIX)
FT_TEST = $(BUILDTOOLBINDIR)/$(PROGRAM)$(EXE_SUFFIX)
# Used on openjdk only
ifeq ($(OPENJDK),true)
# Start with CFLAGS (which gets us the required -xarch setting on solaris)
ifeq ($(PLATFORM), windows)
FT_OPTIONS = /nologo $(CC_OBJECT_OUTPUT_FLAG)$(TEMPDIR)
FT_OPTIONS = /nologo /c
FREETYPE_DLL = $(FREETYPE_LIB_PATH)/freetype.dll
FT_LD_OPTIONS = $(FREETYPE_LIB_PATH)/freetype.lib
ifdef MT
FT_LD_OPTIONS += /manifest
endif
else
FT_OPTIONS = $(CFLAGS)
FT_LD_OPTIONS = -L$(FREETYPE_LIB_PATH)
......@@ -55,15 +60,22 @@ FT_LD_OPTIONS += $(LFLAGS_$(COMPILER_VERSION))
# Create test program
all: $(FT_TEST)
@$(FT_TEST)
$(FT_TEST)
# On windows we need to copy dll to test dir to ensure it will be found
# at runtime
$(FT_TEST): freetypecheck.c
@$(prep-target)
@$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FT_LD_OPTIONS)
$(prep-target)
ifeq ($(PLATFORM), windows)
@$(CP) $(FREETYPE_DLL) `dirname $@`
$(CC) $(FT_OPTIONS) $(CC_OBJECT_OUTPUT_FLAG)$(FT_OBJ) $<
$(LINK) $(FT_LD_OPTIONS) /OUT:$(FT_TEST) $(FT_OBJ)
$(CP) $(FREETYPE_DLL) $(@D)/
ifdef MT
$(CP) $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(@D)/
$(MT) /manifest $(FT_TEST).manifest /outputresource:$(FT_TEST);#1
endif
else
@$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FT_LD_OPTIONS)
endif
else
......
......@@ -32,6 +32,45 @@
#include "ft2build.h"
#include FT_FREETYPE_H
#ifdef _MSC_VER
#if _MSC_VER > 1400
/*
* When building for Microsoft Windows, your program has a dependency
* on msvcr??.dll.
*
* When using Visual Studio 2005 or later, that must be recorded in
* the <program>.exe.manifest file.
*
* Reference:
* C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
*/
#include <crtassem.h>
#ifdef _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='x86' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif /* _M_IX86 */
//This may not be necessary yet for the Windows 64-bit build, but it
//will be when that build environment is updated. Need to test to see
//if it is harmless:
#ifdef _M_AMD64
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='amd64' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif /* _M_AMD64 */
#endif /* _MSC_VER > 1400 */
#endif /* _MSC_VER */
#define QUOTEMACRO(x) QUOTEME(x)
#define QUOTEME(x) #x
......
#
# Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -23,38 +23,50 @@
# have any questions.
#
BUILDDIR = ../../../..
PACKAGE = javax.swing.plaf.nimbus
PRODUCT = com
SWING_SRC = $(SHARE_SRC)/classes/javax/swing
#
# Makefile for building the Nimbus generator
#
BUILDDIR = ../..
PACKAGE = build.tools.generatenimbus
PRODUCT = tools
PROGRAM = generatenimbus
include $(BUILDDIR)/common/Defs.gmk
BUILDTOOL_SOURCE_ROOT = $(BUILDDIR)/tools/src
BUILDTOOL_MAIN = $(PKGDIR)/Generator.java
#
# Files
#
NIMBUS_PKG = javax/swing/plaf/nimbus
NIMBUS_COMPAT_PKG = com/sun/java/swing/plaf/nimbus
NIMBUS_GENSRC_DIR = $(GENSRCDIR)/$(NIMBUS_PKG)
NIMBUS_SKIN_FILE = $(SHARE_SRC)/classes/$(NIMBUS_PKG)/skin.laf
NIMBUS_GENERATOR_JAR = $(BUILDTOOLJARDIR)/nimbus_generator.jar
AUTO_FILES_JAVA_DIRS = $(NIMBUS_PKG) $(NIMBUS_COMPAT_PKG)
SOURCE_FILES = Generator.java \
ObjectFactory.java \
Paint.java \
SynthModel.java \
UIDefault.java \
UIStyle.java
TEMPLATE_FILES = Defaults.template \
PainterImpl.template \
StateImpl.template
TEMPLATE_DEST = $(BUILDTOOLCLASSDIR)/$(PKGDIR)/resources
#
# Rules
#
CLASSES_INIT = $(NIMBUS_GENSRC_DIR)
include $(BUILDDIR)/common/Classes.gmk
all: $(TEMPLATE_DEST) $(BUILDTOOL_JAR_FILE)
include $(BUILDDIR)/common/BuildToolJar.gmk
$(TEMPLATE_DEST): $(TEMPLATE_FILES:%=$(SHARE_SRC)/classes/javax/swing/plaf/nimbus/%)
$(MKDIR) -p $@
$(RM) $(TEMPLATE_FILES:%=$@/%)
$(CP) $^ $@
$(NIMBUS_GENSRC_DIR): $(NIMBUS_SKIN_FILE) $(NIMBUS_GENERATOR_JAR)
@$(ECHO) "Generating Nimbus source files:"
$(BOOT_JAVA_CMD) -jar $(NIMBUS_GENERATOR_JAR) \
-skinFile $(NIMBUS_SKIN_FILE) \
-buildDir $(GENSRCDIR) -srcDir $(GENSRCDIR) \
-packagePrefix $(PACKAGE) -lafName Nimbus
@$(ECHO) "Finished generating Nimbus source files"
BUILDTOOL_MAIN_SOURCE_FILE = $(SOURCE_FILES:%=$(BUILDTOOL_SOURCE_ROOT)/$(PKGDIR)/%)
clean clobber::
$(RM) -r $(NIMBUS_GENSRC_DIR)
$(RM) -r $(TEMPLATE_DEST)
......@@ -22,20 +22,13 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.jdesktop.synthdesigner.generator;
package build.tools.generatenimbus;
import static org.jdesktop.synthdesigner.generator.TemplateWriter.read;
import static org.jdesktop.synthdesigner.generator.TemplateWriter.writeSrcFile;
import org.jdesktop.synthdesigner.synthmodel.SynthModel;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
/**
* Generates the various Java artifacts based on a SynthModel.
......@@ -51,12 +44,12 @@ import java.util.Map;
* @author Jasper Potts
*/
public class Generator {
private static Generator instance;
/** A map of variables that are used for variable substitution in the template files. */
private Map<String, String> variables;
private boolean full = false;
private File buildPackageRoot;
private File srcPackageRoot;
private String packageNamePrefix;
private String lafName;
private SynthModel model;
......@@ -68,7 +61,7 @@ public class Generator {
*
* @param args The commandline arguments
*/
public static void main(String[] args) {
public static void main(String[] args) throws Exception {
if (args.length == 0 || (args.length % 2) != 0) {
System.out.println("Usage: generator [-options]\n" +
" -full <true|false> True if we should build the whole LAF or false for building just states and painters.\n" +
......@@ -76,9 +69,6 @@ public class Generator {
" -buildDir <value> The directory beneath which the build-controlled artifacts (such as the Painters) should\n" +
" be placed. This is the root directory beneath which the necessary packages and source\n" +
" files will be created.\n" +
" -srcDir <value> The directory beneath which the normal user-controlled artifacts (such as the core\n" +
" LookAndFeel file) should be placed. These are one-time generated files. This is the root\n" +
" directory beneath which the necessary packages and source files will be created.\n" +
" -resourcesDir <value> The resources directory containing templates and images.\n" +
" -packagePrefix <value> The package name associated with this synth look and feel. For example,\n" +
" \"org.mypackage.mylaf\"\n" +
......@@ -87,7 +77,6 @@ public class Generator {
boolean full = false;
File skinFile = new File(System.getProperty("user.dir"));
File buildDir = new File(System.getProperty("user.dir"));
File srcDir = new File(System.getProperty("user.dir"));
File resourcesDir = new File(System.getProperty("user.dir"));
String packagePrefix = "org.mypackage.mylaf";
String lafName = "MyLAF";
......@@ -100,8 +89,6 @@ public class Generator {
skinFile = new File(value);
} else if ("-builddir".equals(key)) {
buildDir = new File(value);
} else if ("-srcdir".equals(key)) {
srcDir = new File(value);
} else if ("-resourcesdir".equals(key)) {
resourcesDir = new File(value);
} else if ("-packageprefix".equals(key)) {
......@@ -114,25 +101,15 @@ public class Generator {
System.out.println(" full :" + full);
System.out.println(" skinFile :" + skinFile.getAbsolutePath());
System.out.println(" buildDir :" + buildDir.getAbsolutePath());
System.out.println(" srcDir :" + srcDir.getAbsolutePath());
System.out.println(" resourcesDir :" + resourcesDir.getAbsolutePath());
System.out.println(" packagePrefix :" +packagePrefix);
System.out.println(" lafName :" +lafName);
try {
// LOAD SKIN MODEL
IBindingFactory bindingFactory = BindingDirectory.getFactory(SynthModel.class);
IUnmarshallingContext mctx = bindingFactory.createUnmarshallingContext();
mctx.setDocument(new FileInputStream(skinFile), "UTF-8");
// pass resources directory in as user context so it can be used in SynthModel preSet
mctx.setUserContext(resourcesDir);
SynthModel model = (SynthModel) mctx.unmarshalElement();
// create and run generator
Generator generator = new Generator(full, buildDir, srcDir, packagePrefix, lafName, model);
generator.generate();
} catch (Exception e) {
System.err.println("Error loading skin and generating java src:");
e.printStackTrace();
}
JAXBContext ctx = JAXBContext.newInstance("build.tools.generatenimbus");
Unmarshaller u = ctx.createUnmarshaller();
SynthModel model = (SynthModel) u.unmarshal(skinFile);
Generator.init(full, buildDir, packagePrefix, lafName, model);
Generator.getInstance().generate();
}
}
......@@ -152,8 +129,8 @@ public class Generator {
* @param lafName The name of the laf, such as MyLAF.
* @param model The actual SynthModel to base these generated files on.
*/
public Generator(boolean full, File buildDir, File srcDir, String packageNamePrefix, String lafName,
SynthModel model) {
private Generator(boolean full, File buildDir,
String packageNamePrefix, String lafName, SynthModel model) {
this.full = full;
//validate the input variables
if (packageNamePrefix == null) {
......@@ -162,9 +139,6 @@ public class Generator {
if (buildDir == null) {
throw new IllegalArgumentException("You must specify the build directory");
}
if (srcDir == null) {
throw new IllegalArgumentException("You must specify the source directory");
}
if (model == null) {
throw new IllegalArgumentException("You must specify the SynthModel");
}
......@@ -183,8 +157,6 @@ public class Generator {
//org.mypackage.mylaf subdirectories)
buildPackageRoot = new File(buildDir, packageNamePrefix.replaceAll("\\.", "\\/"));
buildPackageRoot.mkdirs();
srcPackageRoot = new File(srcDir, packageNamePrefix.replaceAll("\\.", "\\/"));
srcPackageRoot.mkdirs();
//save the variables
this.packageNamePrefix = packageNamePrefix;
......@@ -192,98 +164,104 @@ public class Generator {
this.model = model;
}
public void generate() {
//Generate the one-time files. If these files already exist, skip the
//ones that exist and create the missing ones. Register warnings for the
//already existing files.
//TODO Skip existing files, send warnings, etc.
if (full) {
try {
//create the LookAndFeel file
String template = read("resources/LookAndFeel.template");
writeSrcFile(template, variables, new File(srcPackageRoot, lafName + "LookAndFeel.java"));
} catch (IOException e) {
e.printStackTrace();
}
}
//create the painters and such.
regenerate();
public static void init(boolean full, File buildDir,
String packageNamePrefix, String lafName, SynthModel model) {
instance = new Generator(full, buildDir, packageNamePrefix, lafName, model);
model.initStyles();
}
public void regenerate() {
try {
if (full) {
//first, create the AbstractRegionPainter.java file.
String template = read("resources/AbstractRegionPainter.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "AbstractRegionPainter.java"));
//write out BlendingMode.java
template = read("resources/BlendingMode.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "BlendingMode.java"));
//create the SynthPainterImpl class
template = read("resources/SynthPainterImpl.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "SynthPainterImpl.java"));
public static Generator getInstance() {
return instance;
}
//create the IconImpl class
template = read("resources/IconImpl.template");
writeSrcFile(template, variables, new File(buildPackageRoot, lafName + "Icon.java"));
public static Map<String, String> getVariables() {
return new HashMap<String, String>(instance.variables);
}
//create the StyleImpl class
template = read("resources/StyleImpl.template");
writeSrcFile(template, variables, new File(buildPackageRoot, lafName + "Style.java"));
public void generate() {
if (full) {
//create the LookAndFeel file
writeSrcFileImpl("LookAndFeel", variables, lafName + "LookAndFeel");
//write out Effect.java
template = read("resources/Effect.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "Effect.java"));
writeSrcFileImpl("AbstractRegionPainter", variables);
writeSrcFileImpl("BlendingMode", variables);
writeSrcFileImpl("SynthPainterImpl", variables);
writeSrcFileImpl("IconImpl", variables, lafName + "Icon.java");
writeSrcFileImpl("StyleImpl", variables, lafName + "Style.java");
writeSrcFileImpl("Effect", variables);
writeSrcFileImpl("EffectUtils", variables);
writeSrcFileImpl("ShadowEffect", variables);
writeSrcFileImpl("DropShadowEffect", variables);
writeSrcFileImpl("InnerShadowEffect", variables);
writeSrcFileImpl("InnerGlowEffect", variables);
writeSrcFileImpl("OuterGlowEffect", variables);
writeSrcFileImpl("State", variables);
writeSrcFileImpl("ImageCache", variables);
writeSrcFileImpl("ImageScalingHelper", variables);
}
//next, populate the first set of ui defaults based on what is in the
//various palettes of the synth model
StringBuilder defBuffer = new StringBuilder();
StringBuilder styleBuffer = new StringBuilder();
model.write(defBuffer, styleBuffer, packageNamePrefix);
//write out EffectUtils.java
template = read("resources/EffectUtils.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "EffectUtils.java"));
Map<String, String> vars = getVariables();
vars.put("UI_DEFAULT_INIT", defBuffer.toString());
vars.put("STYLE_INIT", styleBuffer.toString());
writeSrcFile("Defaults", vars, lafName + "Defaults");
}
//write out ShadowEffect.java
template = read("resources/ShadowEffect.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "ShadowEffect.java"));
private void writeSrcFileImpl(String name, Map<String, String> variables) {
writeSrcFileImpl(name, variables, name);
}
//write out DropShadowEffect.java
template = read("resources/DropShadowEffect.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "DropShadowEffect.java"));
private void writeSrcFileImpl(String templateName,
Map<String, String> variables, String outputName) {
PrintWriter out = null;
try {
InputStream stream = getClass().getResourceAsStream(
"resources/" + templateName + ".template");
TemplateReader in = new TemplateReader(variables, stream);
//write out InnerShadowEffect.java
template = read("resources/InnerShadowEffect.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "InnerShadowEffect.java"));
out = new PrintWriter(new File(buildPackageRoot, outputName + ".java"));
String line = in.readLine();
while (line != null) {
out.println(line);
line = in.readLine();
}
} catch (IOException e) {
throw new RuntimeException("IOException in writer", e);
} finally {
if (out != null) out.close();
}
}
//write out InnerGlowEffect.java
template = read("resources/InnerGlowEffect.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "InnerGlowEffect.java"));
public static void writeSrcFile(String templateName,
Map<String, String> variables, String outputName) {
instance.writeSrcFileImpl(templateName, variables, outputName);
}
//write out OuterGlowEffect.java
template = read("resources/OuterGlowEffect.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "OuterGlowEffect.java"));
/** A BufferedReader implementation that automatically performs
* string replacements as needed.
*/
private static final class TemplateReader extends BufferedReader {
private Map<String, String> variables;
//write out State.java
template = read("resources/State.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "State.java"));
TemplateReader(Map<String, String> variables, InputStream template) {
super(new InputStreamReader(template));
this.variables = variables;
}
template = read("resources/ImageCache.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "ImageCache.java"));
@Override public String readLine() throws IOException {
return substituteVariables(super.readLine());
}
template = read("resources/ImageScalingHelper.template");
writeSrcFile(template, variables, new File(buildPackageRoot, "ImageScalingHelper.java"));
private String substituteVariables(String input) {
if (input == null) return null;
for (Map.Entry<String, String> variable : variables.entrySet()) {
input = input.replace("${" + variable.getKey() + "}", variable.getValue());
}
//next, populate the first set of ui defaults based on what is in the
//various palettes of the synth model
StringBuilder uiDefaultInit = new StringBuilder();
StringBuilder styleInit = new StringBuilder();
DefaultsGenerator.generateDefaults(uiDefaultInit, styleInit, model, variables, packageNamePrefix,
buildPackageRoot);
variables.put("UI_DEFAULT_INIT", uiDefaultInit.toString());
variables.put("STYLE_INIT", styleInit.toString());
writeSrcFile(read("resources/Defaults.template"), variables,
new File(buildPackageRoot, lafName + "Defaults.java"));
} catch (IOException e) {
e.printStackTrace();
return input;
}
}
}
......@@ -22,34 +22,41 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.jdesktop.swingx.designer.effects;
import org.jdesktop.swingx.designer.paint.Matte;
package build.tools.generatenimbus;
import javax.xml.bind.annotation.XmlRegistry;
import javax.swing.UIDefaults;
import java.awt.Color;
/**
* OuterGlowEffect
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the test package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
* @author Created by Jasper Potts (Jun 21, 2007)
*/
public class OuterGlowEffect extends DropShadowEffect {
protected OuterGlowEffect() {
distance = 0;
}
@XmlRegistry
public class ObjectFactory {
public OuterGlowEffect(UIDefaults uiDefaults) {
color = new Matte(new Color(255, 255, 211), uiDefaults);
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test
*
*/
public ObjectFactory() {
}
/**
* Get the display name for this effect
* Create an instance of {@link SynthModel }
*
* @return The user displayable name
*/
public String getDisplayName() {
return "Outer Glow";
public SynthModel createSynthModel() {
return new SynthModel();
}
}
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.generatenimbus;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
public abstract class Paint {
}
class Matte extends Paint {
@XmlAttribute private int red;
@XmlAttribute private int green;
@XmlAttribute private int blue;
@XmlAttribute private int alpha;
@XmlAttribute private String uiDefaultParentName = null;
@XmlAttribute private float hueOffset = 0;
@XmlAttribute private float saturationOffset = 0;
@XmlAttribute private float brightnessOffset = 0;
@XmlAttribute private int alphaOffset = 0;
@XmlAttribute private String componentPropertyName = null;
public String getComponentPropertyName() { return componentPropertyName; }
@XmlAttribute private boolean uiResource = true;
public boolean isAbsolute() {
return uiDefaultParentName == null;
}
public String getDeclaration() {
if (isAbsolute()) {
return String.format("new Color(%d, %d, %d, %d)",
red, green, blue, alpha);
} else {
return String.format("decodeColor(\"%s\", %sf, %sf, %sf, %d)",
uiDefaultParentName, String.valueOf(hueOffset),
String.valueOf(saturationOffset),
String.valueOf(brightnessOffset), alphaOffset);
}
}
public String write() {
if (isAbsolute()) {
return String.format("%s, %s, %s, %s", red, green, blue, alpha);
} else {
String s = String.format("\"%s\", %sf, %sf, %sf, %d",
uiDefaultParentName, String.valueOf(hueOffset),
String.valueOf(saturationOffset),
String.valueOf(brightnessOffset), alphaOffset);
if (! uiResource) {
s += ", false";
}
return s;
}
}
public ComponentColor createComponentColor(String variableName) {
return new ComponentColor(componentPropertyName, variableName,
saturationOffset, brightnessOffset, alphaOffset);
}
}
class ComponentColor {
private String propertyName;
private String defaultColorVariableName;
private float saturationOffset = 0, brightnessOffset = 0;
private int alphaOffset = 0;
ComponentColor(String propertyName,
String defaultColorVariableName,
float saturationOffset,
float brightnessOffset,
int alphaOffset) {
this.propertyName = propertyName;
this.defaultColorVariableName = defaultColorVariableName;
this.saturationOffset = saturationOffset;
this.brightnessOffset = brightnessOffset;
this.alphaOffset = alphaOffset;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComponentColor c = (ComponentColor) o;
if (alphaOffset != c.alphaOffset) {
return false;
}
if (Float.compare(saturationOffset, c.saturationOffset) != 0) {
return false;
}
if (Float.compare(brightnessOffset, c.brightnessOffset) != 0) {
return false;
}
if (defaultColorVariableName != null ? !defaultColorVariableName.equals(c.defaultColorVariableName) : c.defaultColorVariableName != null) {
return false;
}
if (propertyName != null ? !propertyName.equals(c.propertyName) : c.propertyName != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 61 * hash + (this.propertyName != null ? this.propertyName.hashCode() : 0);
hash = 61 * hash + (this.defaultColorVariableName != null ? this.defaultColorVariableName.hashCode() : 0);
hash = 61 * hash + Float.floatToIntBits(this.saturationOffset);
hash = 61 * hash + Float.floatToIntBits(this.brightnessOffset);
hash = 61 * hash + this.alphaOffset;
return hash;
}
public void write(StringBuilder sb) {
sb.append(" getComponentColor(c, \"").
append(propertyName).append("\", ").
append(defaultColorVariableName).append(", ").
append(saturationOffset).append("f, ").
append(brightnessOffset).append("f, ").
append(alphaOffset);
}
}
class GradientStop {
@XmlAttribute private float position;
public float getPosition() { return position; }
@XmlAttribute private float midpoint;
public float getMidpoint() { return midpoint; }
@XmlElement private Matte matte;
public Matte getColor() { return matte; }
}
class AbstractGradient extends Paint {
public static enum CycleMethod {
NO_CYCLE, REFLECT, REPEAT
}
@XmlElement(name="stop") private ArrayList<GradientStop> stops;
public List<GradientStop> getStops() { return stops; }
}
class Gradient extends AbstractGradient {
}
class RadialGradient extends AbstractGradient {
}
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.generatenimbus;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlElements;
public abstract class Shape {
@XmlElement
private PaintPoints paintPoints;
public double getPaintX1() { return paintPoints.x1; }
public double getPaintX2() { return paintPoints.x2; }
public double getPaintY1() { return paintPoints.y1; }
public double getPaintY2() { return paintPoints.y2; }
@XmlElements({
@XmlElement(name = "matte", type = Matte.class),
@XmlElement(name = "gradient", type = Gradient.class),
@XmlElement(name = "radialGradient", type = RadialGradient.class)
})
private Paint paint;
public Paint getPaint() { return paint; }
static class PaintPoints {
@XmlAttribute double x1;
@XmlAttribute double y1;
@XmlAttribute double x2;
@XmlAttribute double y2;
}
}
class Point {
@XmlAttribute private double x;
public double getX() { return x; }
@XmlAttribute private double y;
public double getY() { return y; }
@XmlAttribute(name="cp1x") private double cp1x;
public double getCp1X() { return cp1x; }
@XmlAttribute(name="cp1y") private double cp1y;
public double getCp1Y() { return cp1y; }
@XmlAttribute(name="cp2x") private double cp2x;
public double getCp2X() { return cp2x; }
@XmlAttribute(name="cp2y") private double cp2y;
public double getCp2Y() { return cp2y; }
public boolean isP1Sharp() {
return cp1x == x && cp1y == y;
}
public boolean isP2Sharp() {
return cp2x == x && cp2y == y;
}
}
class Path extends Shape {
@XmlElement(name="point")
@XmlElementWrapper(name="points")
private List<Point> controlPoints = new ArrayList<Point>();
public List<Point> getControlPoints() { return controlPoints; }
}
class Rectangle extends Shape {
@XmlAttribute private double x1;
public double getX1() { return x1; }
@XmlAttribute private double x2;
public double getX2() { return x2; }
@XmlAttribute private double y1;
public double getY1() { return y1; }
@XmlAttribute private double y2;
public double getY2() { return y2; }
@XmlAttribute
public double getRounding() {
double rounding = Math.abs(roundingX - x1) * 2;
return rounding > 2 ? rounding : 0;
}
public void setRounding(double rounding) {
if (rounding > 0 && rounding < 2) {
rounding = 0;
}
roundingX = rounding / 2d + x1;
}
private double roundingX;
public boolean isRounded() {
return getRounding() > 0;
}
}
class Ellipse extends Shape {
@XmlAttribute private double x1;
public double getX1() { return x1; }
@XmlAttribute private double x2;
public double getX2() { return x2; }
@XmlAttribute private double y1;
public double getY1() { return y1; }
@XmlAttribute private double y2;
public double getY2() { return y2; }
}
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.generatenimbus;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.*;
@XmlRootElement(name="synthModel")
public class SynthModel {
@XmlElement private UIStyle style;
@XmlElement(name="uiColor")
@XmlElementWrapper(name="colors")
private ArrayList<UIColor> colors;
@XmlElement(name="uiFont")
@XmlElementWrapper(name="fonts")
private ArrayList<UIFont> fonts;
@XmlElement(name="uiComponent")
@XmlElementWrapper(name="components")
private ArrayList<UIComponent> components;
public void initStyles() {
for (UIComponent c: components) {
c.initStyles(this.style);
}
}
public void write(StringBuilder defBuffer, StringBuilder styleBuffer, String packageName) {
defBuffer.append(" //Color palette\n");
for (UIColor c: colors) defBuffer.append(c.write());
defBuffer.append('\n');
defBuffer.append(" //Font palette\n");
defBuffer.append(" d.put(\"defaultFont\", new FontUIResource(defaultFont));\n");
for (UIFont f: fonts) defBuffer.append(f.write());
defBuffer.append('\n');
defBuffer.append(" //Border palette\n");
defBuffer.append('\n');
defBuffer.append(" //The global style definition\n");
defBuffer.append(style.write(""));
defBuffer.append('\n');
for (UIComponent c: components) {
String prefix = Utils.escape(c.getKey());
defBuffer.append(" //Initialize ").append(prefix).append("\n");
c.write(defBuffer, styleBuffer, c, prefix, packageName);
defBuffer.append('\n');
}
}
}
class Typeface {
public enum DeriveStyle {
Default, Off, On;
@Override public String toString() {
switch (this) {
default: return "null";
case On: return "true";
case Off: return "false";
}
}
}
@XmlAttribute private String uiDefaultParentName;
@XmlAttribute(name="family") private String name;
@XmlAttribute private int size;
@XmlAttribute private DeriveStyle bold = DeriveStyle.Default;
@XmlAttribute private DeriveStyle italic = DeriveStyle.Default;
@XmlAttribute private float sizeOffset = 1f;
public boolean isAbsolute() {
return uiDefaultParentName == null;
}
public String write() {
if (isAbsolute()) {
int style = Font.PLAIN;
if (bold == DeriveStyle.On) {
style = style | Font.BOLD;
}
if (italic == DeriveStyle.On) {
style = style | Font.ITALIC;
}
return String.format(
"new javax.swing.plaf.FontUIResource(\"%s\", %d, %d)",
name, style, size);
} else {
return String.format(
"new DerivedFont(\"%s\", %sf, %s, %s)",
uiDefaultParentName, String.valueOf(sizeOffset), bold, italic);
}
}
}
class Border {
enum BorderType {
@XmlEnumValue("empty") EMPTY,
@XmlEnumValue("painter") PAINTER
}
@XmlAttribute private BorderType type;
@XmlAttribute private String painter;
@XmlAttribute private int top;
@XmlAttribute private int left;
@XmlAttribute private int bottom;
@XmlAttribute private int right;
public String write() {
switch (type) {
case PAINTER:
return String.format("new PainterBorder(\"%s\", new Insets(%d, %d, %d, %d))",
painter, top, left, bottom, right);
case EMPTY:
return String.format("BorderFactory.createEmptyBorder(%d, %d, %d, %d)",
top, left, bottom, right);
default:
return "### Look, here's an unknown border! $$$";
}
}
}
class Insets {
@XmlAttribute int top;
@XmlAttribute int left;
@XmlAttribute int bottom;
@XmlAttribute int right;
public Insets() {
this(0, 0, 0, 0);
}
public Insets(int top, int left, int bottom, int right) {
this.top = top;
this.left = left;
this.bottom = bottom;
this.right = right;
}
public String write(boolean uiResource) {
String uiSuffix = (uiResource ? "UIResource" : "");
return String.format("new Insets%s(%d, %d, %d, %d)",
uiSuffix, top, left, bottom, right);
}
}
class Dimension {
@XmlAttribute int width;
@XmlAttribute int height;
public String write(boolean uiResource) {
String uiSuffix = (uiResource ? "UIResource" : "");
return String.format("new Dimension%s(%d, %d)", uiSuffix, width, height);
}
}
class Canvas {
@XmlElement private Dimension size;
public Dimension getSize() { return size; }
@XmlElement(name="layer") private List<Layer> layers;
public List<Layer> getLayers() { return layers; }
@XmlElement private Insets stretchingInsets = null;
public Insets getStretchingInsets() { return stretchingInsets; }
public boolean isBlank() {
return layers.size() == 0 || (layers.size() == 1 && layers.get(0).isEmpty());
}
}
class Layer {
/** List of shapes in this layer, first shape is painted on top */
@XmlElements({
@XmlElement(name = "ellipse", type = Ellipse.class),
@XmlElement(name = "path", type = Path.class),
@XmlElement(name = "rectangle", type = Rectangle.class)
})
@XmlElementWrapper(name="shapes")
private List<Shape> shapes = new ArrayList<Shape>();
public List<Shape> getShapes() { return shapes; }
public boolean isEmpty() {
return shapes.isEmpty();
}
}
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -22,64 +22,105 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.jdesktop.synthdesigner.synthmodel;
import org.jdesktop.beans.AbstractBean;
package build.tools.generatenimbus;
/**
* UIProperty
*
* @author Richard Bair
* @author Jasper Potts
*/
public class UIProperty extends AbstractBean {
public static enum PropertyType {
BOOLEAN, INT, FLOAT, DOUBLE, STRING, FONT, COLOR, INSETS, DIMENSION, BORDER
}
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
private String name;
private PropertyType type;
private Object value;
public class UIDefault<T> {
@XmlAttribute private String name;
private T value;
protected UIProperty() {
public String getName() {
return name;
}
public UIProperty(String name, PropertyType type, Object value) {
this.name = name;
this.type = type;
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}
// =================================================================================================================
// Bean Methods
class UIColor extends UIDefault<Matte> {
public String getName() {
return name;
@XmlElement
public void setMatte(Matte m) {
setValue(m);
}
public void setName(String name) {
String old = getName();
this.name = name;
firePropertyChange("name", old, getName());
public String write() {
return String.format(" addColor(d, \"%s\", %s);\n",
getName(), getValue().write());
}
}
public PropertyType getType() {
return type;
class UIFont extends UIDefault<Typeface> {
@XmlElement
public void setTypeface(Typeface t) {
setValue(t);
}
public void setType(PropertyType type) {
PropertyType old = getType();
this.type = type;
firePropertyChange("type", old, getType());
public String write() {
return String.format(" d.put(\"%s\", %s);\n",
getName(), getValue().write());
}
}
public Object getValue() {
return value;
class UIProperty extends UIDefault<String> {
public static enum PropertyType {
BOOLEAN, INT, FLOAT, DOUBLE, STRING, FONT, COLOR, INSETS, DIMENSION, BORDER
}
@XmlAttribute private PropertyType type;
public void setValue(Object value) {
Object old = getValue();
this.value = value;
firePropertyChange("value", old, getValue());
@XmlElement private Border border;
@XmlElement private Dimension dimension;
@XmlElement private Insets insets;
@XmlElement private Matte matte;
@XmlElement private Typeface typeface;
@XmlAttribute
@Override public void setValue(String value) {
super.setValue(value);
}
public String write(String prefix) {
switch (type) {
case BOOLEAN:
return String.format(" d.put(\"%s%s\", Boolean.%s);\n",
prefix, getName(), getValue().toUpperCase()); ///autobox
case STRING:
return String.format(" d.put(\"%s%s\", \"%s\");\n",
prefix, getName(), getValue());
case INT:
return String.format(" d.put(\"%s%s\", new Integer(%s));\n",
prefix, getName(), getValue());
case FLOAT:
return String.format(" d.put(\"%s%s\", new Float(%sf));\n",
prefix, getName(), getValue());
case DOUBLE:
return String.format(" d.put(\"%s%s\", new Double(%s));\n",
prefix, getName(), getValue());
case COLOR:
return String.format(" addColor(d, \"%s%s\", %s);\n",
prefix, getName(), matte.write());
case FONT:
return String.format(" d.put(\"%s%s\", %s);\n",
prefix, getName(), typeface.write());
case INSETS:
return String.format(" d.put(\"%s%s\", %s);\n",
prefix, getName(), insets.write(true));
case DIMENSION:
return String.format(" d.put(\"%s%s\", new DimensionUIResource(%d, %d));\n",
prefix, getName(), dimension.width, dimension.height);
case BORDER:
return String.format(" d.put(\"%s%s\", new BorderUIResource(%s));\n",
prefix, getName(), border.write());
default:
return "### Look, something's wrong with UIProperty.write() $$$";
}
}
}
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package build.tools.generatenimbus;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlElements;
class UIStyle {
public static enum CacheMode {
NO_CACHING, FIXED_SIZES, NINE_SQUARE_SCALE
}
@XmlElement private UIColor textForeground = null;
@XmlElement(name="inherit-textForeground")
private boolean textForegroundInherited = true;
@XmlElement private UIColor textBackground = null;
@XmlElement(name="inherit-textBackground")
private boolean textBackgroundInherited = true;
@XmlElement private UIColor background = null;
@XmlElement(name="inherit-background")
private boolean backgroundInherited = true;
@XmlElement private boolean cacheSettingsInherited = true;
@XmlElement CacheMode cacheMode = CacheMode.FIXED_SIZES;
@XmlElement String maxHozCachedImgScaling = "1.0";
@XmlElement String maxVertCachedImgScaling = "1.0";
@XmlElement(name="uiProperty")
@XmlElementWrapper(name="uiproperties")
private List<UIProperty> uiProperties = new ArrayList<UIProperty>();
private UIStyle parentStyle = null;
public void setParentStyle(UIStyle parentStyle) {
this.parentStyle = parentStyle;
}
public CacheMode getCacheMode() {
if (cacheSettingsInherited) {
return (parentStyle == null ?
CacheMode.FIXED_SIZES : parentStyle.getCacheMode());
} else {
return cacheMode;
}
}
public String getMaxHozCachedImgScaling() {
if (cacheSettingsInherited) {
return (parentStyle == null ?
"1.0" : parentStyle.getMaxHozCachedImgScaling());
} else {
return maxHozCachedImgScaling;
}
}
public String getMaxVertCachedImgScaling() {
if (cacheSettingsInherited) {
return (parentStyle == null ?
"1.0" : parentStyle.getMaxVertCachedImgScaling());
} else {
return maxVertCachedImgScaling;
}
}
public String write(String prefix) {
StringBuilder sb = new StringBuilder();
if (! textForegroundInherited) {
sb.append(String.format(" addColor(d, \"%s%s\", %s);\n",
prefix, "textForeground", textForeground.getValue().write()));
}
if (! textBackgroundInherited) {
sb.append(String.format(" addColor(d, \"%s%s\", %s);\n",
prefix, "textBackground", textBackground.getValue().write()));
}
if (! backgroundInherited) {
sb.append(String.format(" addColor(d, \"%s%s\", %s);\n",
prefix, "background", background.getValue().write()));
}
for (UIProperty property : uiProperties) {
sb.append(property.write(prefix));
}
return sb.toString();
}
}
class UIRegion {
@XmlAttribute protected String name;
@XmlAttribute protected String key;
@XmlAttribute private boolean opaque = false;
@XmlElement private Insets contentMargins = new Insets(0, 0, 0, 0);
@XmlElement(name="state")
@XmlElementWrapper(name="backgroundStates")
protected List<UIState> backgroundStates = new ArrayList<UIState>();
public List<UIState> getBackgroundStates() { return backgroundStates; }
@XmlElement(name="state")
@XmlElementWrapper(name="foregroundStates")
protected List<UIState> foregroundStates = new ArrayList<UIState>();
public List<UIState> getForegroundStates() { return foregroundStates; }
@XmlElement(name="state")
@XmlElementWrapper(name="borderStates")
protected List<UIState> borderStates = new ArrayList<UIState>();
public List<UIState> getBorderStates() { return borderStates; }
@XmlElement private UIStyle style = new UIStyle();
@XmlElements({
@XmlElement(name = "region", type = UIRegion.class),
@XmlElement(name = "uiComponent", type = UIComponent.class),
@XmlElement(name = "uiIconRegion", type = UIIconRegion.class)
})
@XmlElementWrapper(name="regions")
private List<UIRegion> subRegions = new ArrayList<UIRegion>();
public List<UIRegion> getSubRegions() { return subRegions; }
protected void initStyles(UIStyle parentStyle) {
style.setParentStyle(parentStyle);
for (UIState state: backgroundStates) {
state.getStyle().setParentStyle(this.style);
}
for (UIState state: foregroundStates) {
state.getStyle().setParentStyle(this.style);
}
for (UIState state: borderStates) {
state.getStyle().setParentStyle(this.style);
}
for (UIRegion region: subRegions) {
region.initStyles(this.style);
}
}
public String getKey() {
return key == null || "".equals(key) ? name : key;
}
private boolean hasCanvas() {
for (UIState s : backgroundStates) {
if (s.hasCanvas()) return true;
}
for (UIState s : borderStates) {
if (s.hasCanvas()) return true;
}
for (UIState s : foregroundStates) {
if (s.hasCanvas()) return true;
}
for (UIRegion r: subRegions) {
if (r.hasCanvas()) return true;
}
return false;
}
public void write(StringBuilder sb, StringBuilder styleBuffer,
UIComponent comp, String prefix, String pkg) {
// write content margins
sb.append(String.format(" d.put(\"%s.contentMargins\", %s);\n",
prefix, contentMargins.write(true)));
// write opaque if true
if (opaque) {
sb.append(String.format(" d.put(\"%s.opaque\", Boolean.TRUE);\n", prefix));
}
// register component with LAF
String regionCode = "Region." + Utils.regionNameToCaps(name);
styleBuffer.append(String.format(" register(%s, \"%s\");\n",
regionCode, prefix));
//write the State, if necessary
StringBuffer regString = new StringBuffer();
List<UIStateType> types = comp.getStateTypes();
if (types != null && types.size() > 0) {
for (UIStateType type : types) {
regString.append(type.getKey());
regString.append(",");
}
//remove the last ","
regString.deleteCharAt(regString.length() - 1);
}
if (! regString.equals("Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Default") && types.size() > 0) {
//there were either custom states, or the normal states were in a custom order
//so go ahead and write out prefix.State
sb.append(String.format(" d.put(\"%s.States\", \"%s\");\n",
prefix, regString));
}
// write out any custom states, if necessary
for (UIStateType type : types) {
String synthState = type.getKey();
if (! "Enabled".equals(synthState) &&
! "MouseOver".equals(synthState) &&
! "Pressed".equals(synthState) &&
! "Disabled".equals(synthState) &&
! "Focused".equals(synthState) &&
! "Selected".equals(synthState) &&
! "Default".equals(synthState)) {
//what we have here, gentlemen, is a bona-fide custom state.
//if the type is not one of the standard types, then construct a name for
//the new type, and write out a new subclass of State.
String className = Utils.normalize(prefix) + synthState + "State";
sb.append(String.format(" d.put(\"%s.%s\", new %s());\n",
prefix, synthState, className));
String body = type.getCodeSnippet();
Map<String, String> variables = Generator.getVariables();
variables.put("STATE_NAME", className);
variables.put("STATE_KEY", synthState);
variables.put("BODY", body);
Generator.writeSrcFile("StateImpl", variables, className);
}
}
// write style
sb.append(style.write(prefix + '.'));
String fileName = Utils.normalize(prefix) + "Painter";
boolean hasCanvas = hasCanvas();
if (hasCanvas) {
PainterGenerator.writePainter(this, fileName);
}
// write states ui defaults
for (UIState state : backgroundStates) {
state.write(sb, prefix, pkg, fileName, "background");
}
for (UIState state : foregroundStates) {
state.write(sb, prefix, pkg, fileName, "foreground");
}
for (UIState state : borderStates) {
state.write(sb, prefix, pkg, fileName, "border");
}
// handle sub regions
for (UIRegion subreg : subRegions) {
String p = prefix;
if (! (subreg instanceof UIIconRegion)) {
p = prefix + ":" + Utils.escape(subreg.getKey());
}
UIComponent c = comp;
if (subreg instanceof UIComponent) {
c = (UIComponent) subreg;
}
subreg.write(sb, styleBuffer, c, p, pkg);
}
}
}
class UIIconRegion extends UIRegion {
@XmlAttribute private String basicKey;
@Override public void write(StringBuilder sb, StringBuilder styleBuffer, UIComponent comp, String prefix, String pkg) {
Dimension size = null;
String fileNamePrefix = Utils.normalize(prefix) + "Painter";
// write states ui defaults
for (UIState state : backgroundStates) {
Canvas canvas = state.getCanvas();
if (!canvas.isBlank()) {
state.write(sb, prefix, pkg, fileNamePrefix, getKey());
size = canvas.getSize();
}
}
if (size != null) {
// Put SynthIconImpl wrapper in UiDefaults
String k = (basicKey == null ? prefix + "." + getKey() : basicKey);
sb.append(String.format(
" d.put(\"%s\", new NimbusIcon(\"%s\", \"%sPainter\", %d, %d));\n",
k, prefix, getKey(), size.width, size.height));
}
}
}
class UIComponent extends UIRegion {
@XmlAttribute private String componentName;
@XmlElement(name="stateType")
@XmlElementWrapper(name="stateTypes")
private List<UIStateType> stateTypes = new ArrayList<UIStateType>();
public List<UIStateType> getStateTypes() { return stateTypes; }
@Override public String getKey() {
if (key == null || "".equals(key)) {
if (componentName == null || "".equals(componentName)) {
return name;
} else {
return "\"" + componentName + "\"";
}
} else {
return key;
}
}
}
class UIState {
@XmlAttribute private String stateKeys;
public String getStateKeys() { return stateKeys; }
/** Indicates whether to invert the meaning of the 9-square stretching insets */
@XmlAttribute private boolean inverted;
/** A cached string representing the list of stateKeys deliminated with "+" */
private String cachedName = null;
@XmlElement private Canvas canvas;
public Canvas getCanvas() { return canvas; }
@XmlElement private UIStyle style;
public UIStyle getStyle() { return style; }
public boolean hasCanvas() {
return ! canvas.isBlank();
}
public static List<String> stringToKeys(String keysString) {
return Arrays.asList(keysString.split("\\+"));
}
public String getName() {
if (cachedName == null) {
StringBuilder buf = new StringBuilder();
List<String> keys = stringToKeys(stateKeys);
Collections.sort(keys);
for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
buf.append(iter.next());
if (iter.hasNext()) {
buf.append('+');
}
}
cachedName = buf.toString();
}
return cachedName;
}
public void write(StringBuilder sb, String prefix, String pkg, String fileNamePrefix, String painterPrefix) {
String statePrefix = prefix + "[" + getName() + "]";
// write state style
sb.append(style.write(statePrefix + '.'));
// write painter
if (hasCanvas()) {
writeLazyPainter(sb, statePrefix, pkg, fileNamePrefix, painterPrefix);
}
}
private void writeLazyPainter(StringBuilder sb, String statePrefix, String packageNamePrefix, String fileNamePrefix, String painterPrefix) {
String cacheModeString = "AbstractRegionPainter.PaintContext.CacheMode." + style.getCacheMode();
String stateConstant = Utils.statesToConstantName(painterPrefix + "_" + stateKeys);
sb.append(String.format(
" d.put(\"%s.%sPainter\", new LazyPainter(\"%s.%s\", %s.%s, %s, %s, %b, %s, %s, %s));\n",
statePrefix, painterPrefix, packageNamePrefix, fileNamePrefix,
fileNamePrefix, stateConstant, canvas.getStretchingInsets().write(false),
canvas.getSize().write(false), inverted, cacheModeString,
Utils.formatDouble(style.getMaxHozCachedImgScaling()),
Utils.formatDouble(style.getMaxVertCachedImgScaling())));
}
}
class UIStateType {
@XmlAttribute private String key;
public String getKey() { return key; }
@XmlElement private String codeSnippet;
public String getCodeSnippet() { return codeSnippet; }
}
......@@ -22,158 +22,61 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.jdesktop.synthdesigner.generator;
import javax.swing.plaf.synth.Region;
import javax.swing.plaf.synth.SynthConstants;
/**
* GeneratorUtils
*
* @author Richard Bair
* @author Jasper Potts
*/
class GeneratorUtils {
private GeneratorUtils() {}
package build.tools.generatenimbus;
/**
* Given a synth state, create the appropriate name as it would be used for a ui default key.
* <p/>
* For example:
* <p/>
* enabled enabled+over enabled+over+selected
*/
static String toUIDefaultKey(int state) {
StringBuffer buffer = new StringBuffer();
if ((state & SynthConstants.DEFAULT) == SynthConstants.DEFAULT) {
buffer.append("default");
}
if ((state & SynthConstants.DISABLED) == SynthConstants.DISABLED) {
if (buffer.length() > 0) buffer.append("+");
buffer.append("disabled");
}
if ((state & SynthConstants.ENABLED) == SynthConstants.ENABLED) {
if (buffer.length() > 0) buffer.append("+");
buffer.append("enabled");
}
if ((state & SynthConstants.FOCUSED) == SynthConstants.FOCUSED) {
if (buffer.length() > 0) buffer.append("+");
buffer.append("focused");
}
if ((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER) {
if (buffer.length() > 0) buffer.append("+");
buffer.append("over");
}
if ((state & SynthConstants.PRESSED) == SynthConstants.PRESSED) {
if (buffer.length() > 0) buffer.append("+");
buffer.append("down");
}
if ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED) {
if (buffer.length() > 0) buffer.append("+");
buffer.append("selected");
}
return buffer.toString();
}
import java.util.ArrayList;
import java.util.List;
import javax.swing.plaf.synth.Region;
//takes a states string of the form Enabled+Foo+Bar.
//removes any whitespace. Replaces the + signs with And.
static String toClassName(String states) {
String s = states.replace(" ", "");
s = states.replace("+", "And");
return s;
}
public class Utils {
//takes a states string of the form Enabled+Foo+Bar.
//removes any whitespace. Replaces the + signs with _.
//capitalizes the whole lot
static String toConstantName(String states) {
String s = states.replace(" ", "");
s = states.replace("+", "_");
return s.toUpperCase();
public static String escape(String s) {
return s.replace("\"", "\\\"");
}
/**
* Given a string "s" of the form:
*
* A.\"A.a\".B
*
* Make it such that:
*
* AAAB
*
* For example, ComboBox.\"ComboBox.arrowButton\" would become
* ComboBoxComboBoxArrowButton
*
* @param s
* @return
*/
static String makePretty(String s) {
public static String normalize(String s) {
char[] src = s.toCharArray();
char[] dst = new char[src.length];
int dstIndex = 0;
for (int i=0; i<src.length; i++) {
//if the src char is a period and there is a following character,
//make sure the character is capitalized.
if ((src[i] == '.' || src[i] == ':') && i < src.length -1) {
src[i+1] = Character.toUpperCase(src[i+1]);
continue;
}
//if the src char is one that is to be removed, skip it.
if (src[i] == '.' || src[i] == ':' || src[i] == '\\' || src[i] == '"') {
continue;
StringBuilder buf = new StringBuilder();
List<String> parts = new ArrayList<String>();
boolean capitalize = false;
for (int i = 0; i < src.length; i++) {
switch (src[i]) {
case '\\':
case '"':
break;
case '.':
capitalize = true;
break;
case ':':
parts.add(buf.toString());
buf.delete(0, buf.length());
capitalize = true;
break;
default:
buf.append(capitalize ? Character.toUpperCase(src[i]) : src[i]);
capitalize = false;
break;
}
//copy over the current char.
dst[dstIndex++] = src[i];
}
//at this point, dstIndex is 1 greater than the last valid index position in dst
//or in other words it represents the count.
return new String(dst, 0, dstIndex);
}
parts.add(buf.toString());
/**
* Encodes the given synth state as if it were specified in java code, such as
* <p/>
* SynthConstants.ENABLED | SynthConstants.MOUSE_OVER
*/
static String toJavaList(int state) {
StringBuffer buffer = new StringBuffer();
if ((state & SynthConstants.DEFAULT) == SynthConstants.DEFAULT) {
buffer.append("SynthConstants.DEFAULT");
}
if ((state & SynthConstants.DISABLED) == SynthConstants.DISABLED) {
if (buffer.length() > 0) buffer.append(" | ");
buffer.append("SynthConstants.DISABLED");
}
if ((state & SynthConstants.ENABLED) == SynthConstants.ENABLED) {
if (buffer.length() > 0) buffer.append(" | ");
buffer.append("SynthConstants.ENABLED");
}
if ((state & SynthConstants.FOCUSED) == SynthConstants.FOCUSED) {
if (buffer.length() > 0) buffer.append(" | ");
buffer.append("SynthConstants.FOCUSED");
}
if ((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER) {
if (buffer.length() > 0) buffer.append(" | ");
buffer.append("SynthConstants.MOUSE_OVER");
}
if ((state & SynthConstants.PRESSED) == SynthConstants.PRESSED) {
if (buffer.length() > 0) buffer.append(" | ");
buffer.append("SynthConstants.PRESSED");
}
if ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED) {
if (buffer.length() > 0) buffer.append(" | ");
buffer.append("SynthConstants.SELECTED");
// Try to optimize long class names by omitting repeating prefixes, e.g.
// SliderTrackPainter.java instead of SliderSliderTrackPainter.java
String result = parts.get(0);
for (int i = 1; i < parts.size(); i++) {
String part = parts.get(i);
if (part.startsWith(result)) {
result = part;
} else {
result += part;
}
}
return buffer.toString();
return result;
}
/**
* Checks the given region name to discover if it is one of the standard synth regions. If so, return the name in
* caps and such. Otherwise, return a big fat null.
* <p/>
* I have to do this because, unfortunately, synth's Region doesn't implement equals.
*/
static String getRegionNameCaps(String regionName) {
public static String regionNameToCaps(String regionName) {
if (Region.ARROW_BUTTON.getName().equals(regionName)) {
return "ARROW_BUTTON";
} else if (Region.BUTTON.getName().equals(regionName)) {
......@@ -289,7 +192,24 @@ class GeneratorUtils {
} else if (Region.VIEWPORT.getName().equals(regionName)) {
return "VIEWPORT";
}
System.err.println("[Info] Couldn't find a Region for " + regionName);
return null;
throw new RuntimeException("Bad Region name " + regionName);
}
public static String statesToConstantName(String states) {
String s = states.replace(" ", "");
s = states.replace("+", "_");
return s.toUpperCase();
}
//takes a states string of the form Enabled+Foo+Bar.
//removes any whitespace. Replaces the + signs with And.
public static String statesToClassName(String states) {
String s = states.replace(" ", "");
s = states.replace("+", "And");
return s;
}
public static String formatDouble(String doubleValue) {
return doubleValue.replace("INF", "Double.POSITIVE_INFINITY");
}
}
......@@ -30,7 +30,7 @@ import java.io.*;
abstract class AbstractNamedNode extends Node {
NameNode nameNode;
NameNode nameNode = null;
String name;
public String name() {
......
......@@ -30,7 +30,7 @@ import java.io.*;
class AltNode extends AbstractGroupNode implements TypeNode {
SelectNode select;
SelectNode select = null;
void constrain(Context ctx) {
super.constrain(ctx);
......
......@@ -33,13 +33,7 @@ class ConstantSetNode extends AbstractNamedNode {
/**
* The mapping between a constant and its value.
*/
protected static Map<String, String> constantMap;
ConstantSetNode(){
if (constantMap == null) {
constantMap = new HashMap<String, String>();
}
}
protected static final Map<String, String> constantMap = new HashMap<String, String>();
void prune() {
List<Node> addons = new ArrayList<Node>();
......@@ -95,9 +89,6 @@ class ConstantSetNode extends AbstractNamedNode {
}
public static String getConstant(String key){
if (constantMap == null) {
return "";
}
String com = constantMap.get(key);
if(com == null){
return "";
......
......@@ -25,13 +25,11 @@
package build.tools.jdwpgen;
import java.util.*;
import java.io.*;
class Main {
static String specSource;
static Map nameMap = new HashMap();
static boolean genDebug = true;
static void usage() {
......@@ -43,7 +41,6 @@ class Main {
System.err.println("-doc <doc_output>");
System.err.println("-jdi <java_output>");
System.err.println("-include <include_file_output>");
System.exit(1);
}
public static void main(String args[]) throws IOException {
......@@ -66,6 +63,7 @@ class Main {
} else {
System.err.println("Invalid option: " + arg);
usage();
return;
}
} else {
specSource = arg;
......@@ -75,6 +73,7 @@ class Main {
if (reader == null) {
System.err.println("<spec_input> must be specified");
usage();
return;
}
Parse parse = new Parse(reader);
......
......@@ -36,7 +36,7 @@ abstract class Node {
int lineno;
List<String> commentList = new ArrayList<String>();
Node parent = null;
Context context;
Context context = null;
static final int maxStructIndent = 5;
static int structIndent = 0; // horrible hack
......@@ -82,7 +82,7 @@ abstract class Node {
}
void indent(PrintWriter writer, int depth) {
for (int i = depth; i > 0; --i) {
for (int i = 0; i < depth; i++) {
writer.print(" ");
}
}
......@@ -195,6 +195,6 @@ abstract class Node {
System.err.println(Main.specSource + ":" + lineno + ": " +
kind + " - " + errmsg);
System.err.println();
System.exit(1);
throw new RuntimeException("Error: " + errmsg);
}
}
......@@ -146,8 +146,12 @@ class Parse {
Node node = (Node)proto.getClass().newInstance();
node.set(kind, list, izer.lineno());
return node;
} catch (Exception exc) {
} catch (InstantiationException exc) {
error(exc.toString());
return null;
} catch (IllegalAccessException exc) {
error(exc.toString());
return null;
}
}
} else {
......@@ -166,6 +170,6 @@ class Parse {
void error(String errmsg) {
System.err.println(Main.specSource + ":" + izer.lineno() +
": " + errmsg);
System.exit(1);
throw new RuntimeException("Error: " + errmsg);
}
}
......@@ -30,7 +30,7 @@ import java.io.*;
class RepeatNode extends AbstractTypeNode {
Node member;
Node member = null;
void constrain(Context ctx) {
super.constrain(ctx);
......
......@@ -30,7 +30,7 @@ import java.io.*;
class SelectNode extends AbstractGroupNode implements TypeNode {
AbstractSimpleTypeNode typeNode;
AbstractSimpleTypeNode typeNode = null;
void prune() {
super.prune();
......
#
# Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
# Makefile for building the Nimbus generator
#
BUILDDIR = ../..
PACKAGE = org.jdesktop.synthdesigner.generator
PRODUCT = tools
PROGRAM = nimbus_generator
include $(BUILDDIR)/common/Defs.gmk
BUILDTOOL_SOURCE_ROOT = classes
BUILDTOOL_MAIN = $(PKGDIR)/Generator.java
#
# Files
#
MAIN_CLASS_FILE = $(BUILDTOOLCLASSDIR)/$(BUILDTOOL_MAIN:%.java=%.class)
SOURCE_FILES = $(shell $(FIND) $(BUILDTOOL_SOURCE_ROOT) -name '*.java' -print)
TEMPLATE_FILES = $(SHARE_SRC)/classes/javax/swing/plaf/nimbus/Defaults.template \
$(SHARE_SRC)/classes/javax/swing/plaf/nimbus/PainterImpl.template \
$(SHARE_SRC)/classes/javax/swing/plaf/nimbus/StateImpl.template
TEMPLATE_DEST = $(BUILDTOOLCLASSDIR)/org/jdesktop/synthdesigner/generator/resources
JIBX_FILES = $(BUILDTOOL_SOURCE_ROOT)/org/jdesktop/swingx/designer/Designer.jibx.xml \
$(BUILDTOOL_SOURCE_ROOT)/org/jdesktop/synthdesigner/synthmodel/SynthModel.jibx.xml
JIBX_LIBS_CP = $(JIBX_LIBS_PATH)/bcel.jar$(CLASSPATH_SEPARATOR)$(JIBX_LIBS_PATH)/xpp3.jar$(CLASSPATH_SEPARATOR)$(JIBX_LIBS_PATH)/jibx-bind.jar$(CLASSPATH_SEPARATOR)$(JIBX_LIBS_PATH)/jibx-run.jar
JIBX_LIBS_LIST = $(subst $(CLASSPATH_SEPARATOR), ,$(JIBX_LIBS_CP))
#
# Rules
#
include $(BUILDDIR)/common/BuildToolJar.gmk
$(MAIN_CLASS_FILE): $(SOURCE_FILES) $(JIBX_LIBS_LIST)
@$(MKDIR) -p $(BUILDTOOLCLASSDIR)
$(BOOT_JAVAC_CMD) -classpath "$(JIBX_LIBS_CP)" \
-d $(BUILDTOOLCLASSDIR) -sourcepath $(BUILDTOOL_SOURCE_ROOT) \
$(SOURCE_FILES)
$(TEMPLATE_DEST): $(TEMPLATE_FILES)
$(MKDIR) -p $(TEMPLATE_DEST)
$(RM) $(TEMPLATE_DEST)/*.template
$(CP) $(TEMPLATE_FILES) $(TEMPLATE_DEST)
$(BUILDTOOL_MANIFEST_FILE): $(MAIN_CLASS_FILE)
$(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@
$(ECHO) "Class-Path: $(JIBX_LIBS_LIST:$(JIBX_LIBS_PATH)/%=%)" >> $@
$(CP) $(JIBX_LIBS_LIST) $(BUILDTOOLJARDIR)
$(BUILDTOOL_JAR_FILE): $(MAIN_CLASS_FILE) $(TEMPLATE_DEST) \
$(JIBX_FILES) $(BUILDTOOL_MANIFEST_FILE)
@$(prep-target)
$(BOOT_JAVA_CMD) \
-classpath "$(JIBX_LIBS_CP)$(CLASSPATH_SEPARATOR)$(BUILDTOOLCLASSDIR)" \
org.jibx.binding.Compile $(JIBX_FILES)
$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
-C $(BUILDTOOLCLASSDIR) org \
$(BOOT_JAR_JFLAGS) || $(RM) $@
@$(java-vm-cleanup)
clean clobber::
$(RM) -r $(TEMPLATE_DEST)
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.jdesktop.beans;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.beans.VetoableChangeSupport;
/**
* <p>A convenience class from which to extend all non-visual AbstractBeans. It
* manages the PropertyChange notification system, making it relatively trivial
* to add support for property change events in getters/setters.</p>
*
* <p>A non-visual java bean is a Java class that conforms to the AbstractBean
* patterns to allow visual manipulation of the bean's properties and event
* handlers at design-time.</p>
*
* <p>Here is a simple example bean that contains one property, foo, and the
* proper pattern for implementing property change notification:
* <pre><code>
* public class ABean extends AbstractBean {
* private String foo;
*
* public void setFoo(String newFoo) {
* String old = getFoo();
* this.foo = newFoo;
* firePropertyChange("foo", old, getFoo());
* }
*
* public String getFoo() {
* return foo;
* }
* }
* </code></pre></p>
*
* <p>You will notice that "getFoo()" is used in the setFoo method rather than
* accessing "foo" directly for the gets. This is done intentionally so that if
* a subclass overrides getFoo() to return, for instance, a constant value the
* property change notification system will continue to work properly.</p>
*
* <p>The firePropertyChange method takes into account the old value and the new
* value. Only if the two differ will it fire a property change event. So you can
* be assured from the above code fragment that a property change event will only
* occur if old is indeed different from getFoo()</p>
*
* <p><code>AbstractBean</code> also supports {@link VetoablePropertyChange} events.
* These events are similar to <code>PropertyChange</code> events, except a special
* exception can be used to veto changing the property. For example, perhaps the
* property is changing from "fred" to "red", but a listener deems that "red" is
* unexceptable. In this case, the listener can fire a veto exception and the property must
* remain "fred". For example:
* <pre><code>
* public class ABean extends AbstractBean {
* private String foo;
*
* public void setFoo(String newFoo) throws PropertyVetoException {
* String old = getFoo();
* this.foo = newFoo;
* fireVetoableChange("foo", old, getFoo());
* }
*
* public String getFoo() {
* return foo;
* }
* }
*
* public class Tester {
* public static void main(String... args) {
* try {
* ABean a = new ABean();
* a.setFoo("fred");
* a.addVetoableChangeListener(new VetoableChangeListener() {
* public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
* if ("red".equals(evt.getNewValue()) {
* throw new PropertyVetoException("Cannot be red!", evt);
* }
* }
* }
* a.setFoo("red");
* } catch (Exception e) {
* e.printStackTrace(); // this will be executed
* }
* }
* }
* </code></pre></p>
*
* @status REVIEWED
* @author rbair
*/
public abstract class AbstractBean {
/**
* Helper class that manages all the property change notification machinery.
* PropertyChangeSupport cannot be extended directly because it requires
* a bean in the constructor, and the "this" argument is not valid until
* after super construction. Hence, delegation instead of extension
*/
private transient PropertyChangeSupport pcs;
/**
* Helper class that manages all the veto property change notification machinery.
*/
private transient VetoableChangeSupport vcs;
/** Creates a new instance of AbstractBean */
protected AbstractBean() {
pcs = new PropertyChangeSupport(this);
vcs = new VetoableChangeSupport(this);
}
/**
* Creates a new instance of AbstractBean, using the supplied PropertyChangeSupport and
* VetoableChangeSupport delegates. Neither of these may be null.
*/
protected AbstractBean(PropertyChangeSupport pcs, VetoableChangeSupport vcs) {
if (pcs == null) {
throw new NullPointerException("PropertyChangeSupport must not be null");
}
if (vcs == null) {
throw new NullPointerException("VetoableChangeSupport must not be null");
}
this.pcs = pcs;
this.vcs = vcs;
}
/**
* Add a PropertyChangeListener to the listener list.
* The listener is registered for all properties.
* The same listener object may be added more than once, and will be called
* as many times as it is added.
* If <code>listener</code> is null, no exception is thrown and no action
* is taken.
*
* @param listener The PropertyChangeListener to be added
*/
public final void addPropertyChangeListener(PropertyChangeListener listener) {
pcs.addPropertyChangeListener(listener);
}
/**
* Remove a PropertyChangeListener from the listener list.
* This removes a PropertyChangeListener that was registered
* for all properties.
* If <code>listener</code> was added more than once to the same event
* source, it will be notified one less time after being removed.
* If <code>listener</code> is null, or was never added, no exception is
* thrown and no action is taken.
*
* @param listener The PropertyChangeListener to be removed
*/
public final void removePropertyChangeListener(PropertyChangeListener listener) {
pcs.removePropertyChangeListener(listener);
}
/**
* Returns an array of all the listeners that were added to the
* PropertyChangeSupport object with addPropertyChangeListener().
* <p>
* If some listeners have been added with a named property, then
* the returned array will be a mixture of PropertyChangeListeners
* and <code>PropertyChangeListenerProxy</code>s. If the calling
* method is interested in distinguishing the listeners then it must
* test each element to see if it's a
* <code>PropertyChangeListenerProxy</code>, perform the cast, and examine
* the parameter.
*
* <pre>
* PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
* for (int i = 0; i < listeners.length; i++) {
* if (listeners[i] instanceof PropertyChangeListenerProxy) {
* PropertyChangeListenerProxy proxy =
* (PropertyChangeListenerProxy)listeners[i];
* if (proxy.getPropertyName().equals("foo")) {
* // proxy is a PropertyChangeListener which was associated
* // with the property named "foo"
* }
* }
* }
*</pre>
*
* @see java.beans.PropertyChangeListenerProxy
* @return all of the <code>PropertyChangeListeners</code> added or an
* empty array if no listeners have been added
*/
public final PropertyChangeListener[] getPropertyChangeListeners() {
return pcs.getPropertyChangeListeners();
}
/**
* Add a PropertyChangeListener for a specific property. The listener
* will be invoked only when a call on firePropertyChange names that
* specific property.
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
* If <code>propertyName</code> or <code>listener</code> is null, no
* exception is thrown and no action is taken.
*
* @param propertyName The name of the property to listen on.
* @param listener The PropertyChangeListener to be added
*/
public final void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
pcs.addPropertyChangeListener(propertyName, listener);
}
/**
* Remove a PropertyChangeListener for a specific property.
* If <code>listener</code> was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
* If <code>propertyName</code> is null, no exception is thrown and no
* action is taken.
* If <code>listener</code> is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param propertyName The name of the property that was listened on.
* @param listener The PropertyChangeListener to be removed
*/
public final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
pcs.removePropertyChangeListener(propertyName, listener);
}
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @param propertyName The name of the property being listened to
* @return all of the <code>PropertyChangeListeners</code> associated with
* the named property. If no such listeners have been added,
* or if <code>propertyName</code> is null, an empty array is
* returned.
*/
public final PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
return pcs.getPropertyChangeListeners(propertyName);
}
/**
* Report a bound property update to any registered listeners.
* No event is fired if old and new are equal and non-null.
*
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes {@code
* PropertyChangeEvent} value.
*
* @param propertyName The programmatic name of the property
* that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
*/
protected final void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
pcs.firePropertyChange(propertyName, oldValue, newValue);
}
/**
* Fire an existing PropertyChangeEvent to any registered listeners.
* No event is fired if the given event's old and new values are
* equal and non-null.
* @param evt The PropertyChangeEvent object.
*/
protected final void firePropertyChange(PropertyChangeEvent evt) {
pcs.firePropertyChange(evt);
}
/**
* Report a bound indexed property update to any registered
* listeners.
* <p>
* No event is fired if old and new values are equal
* and non-null.
*
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes {@code PropertyChangeEvent} value.
*
* @param propertyName The programmatic name of the property that
* was changed.
* @param index index of the property element that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
*/
protected final void fireIndexedPropertyChange(String propertyName,
int index, Object oldValue, Object newValue) {
pcs.fireIndexedPropertyChange(propertyName, index, oldValue, newValue);
}
/**
* Check if there are any listeners for a specific property, including
* those registered on all properties. If <code>propertyName</code>
* is null, only check for listeners registered on all properties.
*
* @param propertyName the property name.
* @return true if there are one or more listeners for the given property
*/
protected final boolean hasPropertyChangeListeners(String propertyName) {
return pcs.hasListeners(propertyName);
}
/**
* Check if there are any listeners for a specific property, including
* those registered on all properties. If <code>propertyName</code>
* is null, only check for listeners registered on all properties.
*
* @param propertyName the property name.
* @return true if there are one or more listeners for the given property
*/
protected final boolean hasVetoableChangeListeners(String propertyName) {
return vcs.hasListeners(propertyName);
}
/**
* Add a VetoableListener to the listener list.
* The listener is registered for all properties.
* The same listener object may be added more than once, and will be called
* as many times as it is added.
* If <code>listener</code> is null, no exception is thrown and no action
* is taken.
*
* @param listener The VetoableChangeListener to be added
*/
public final void addVetoableChangeListener(VetoableChangeListener listener) {
vcs.addVetoableChangeListener(listener);
}
/**
* Remove a VetoableChangeListener from the listener list.
* This removes a VetoableChangeListener that was registered
* for all properties.
* If <code>listener</code> was added more than once to the same event
* source, it will be notified one less time after being removed.
* If <code>listener</code> is null, or was never added, no exception is
* thrown and no action is taken.
*
* @param listener The VetoableChangeListener to be removed
*/
public final void removeVetoableChangeListener(VetoableChangeListener listener) {
vcs.removeVetoableChangeListener(listener);
}
/**
* Returns the list of VetoableChangeListeners. If named vetoable change listeners
* were added, then VetoableChangeListenerProxy wrappers will returned
* <p>
* @return List of VetoableChangeListeners and VetoableChangeListenerProxys
* if named property change listeners were added.
*/
public final VetoableChangeListener[] getVetoableChangeListeners(){
return vcs.getVetoableChangeListeners();
}
/**
* Add a VetoableChangeListener for a specific property. The listener
* will be invoked only when a call on fireVetoableChange names that
* specific property.
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
* If <code>propertyName</code> or <code>listener</code> is null, no
* exception is thrown and no action is taken.
*
* @param propertyName The name of the property to listen on.
* @param listener The VetoableChangeListener to be added
*/
public final void addVetoableChangeListener(String propertyName,
VetoableChangeListener listener) {
vcs.addVetoableChangeListener(propertyName, listener);
}
/**
* Remove a VetoableChangeListener for a specific property.
* If <code>listener</code> was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
* If <code>propertyName</code> is null, no exception is thrown and no
* action is taken.
* If <code>listener</code> is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param propertyName The name of the property that was listened on.
* @param listener The VetoableChangeListener to be removed
*/
public final void removeVetoableChangeListener(String propertyName,
VetoableChangeListener listener) {
vcs.removeVetoableChangeListener(propertyName, listener);
}
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @param propertyName The name of the property being listened to
* @return all the <code>VetoableChangeListeners</code> associated with
* the named property. If no such listeners have been added,
* or if <code>propertyName</code> is null, an empty array is
* returned.
*/
public final VetoableChangeListener[] getVetoableChangeListeners(String propertyName) {
return vcs.getVetoableChangeListeners(propertyName);
}
/**
* Report a vetoable property update to any registered listeners. If
* anyone vetos the change, then fire a new event reverting everyone to
* the old value and then rethrow the PropertyVetoException.
* <p>
* No event is fired if old and new are equal and non-null.
*
* @param propertyName The programmatic name of the property
* that is about to change..
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
* @exception PropertyVetoException if the recipient wishes the property
* change to be rolled back.
*/
protected final void fireVetoableChange(String propertyName,
Object oldValue, Object newValue)
throws PropertyVetoException {
vcs.fireVetoableChange(propertyName, oldValue, newValue);
}
/**
* Fire a vetoable property update to any registered listeners. If
* anyone vetos the change, then fire a new event reverting everyone to
* the old value and then rethrow the PropertyVetoException.
* <p>
* No event is fired if old and new are equal and non-null.
*
* @param evt The PropertyChangeEvent to be fired.
* @exception PropertyVetoException if the recipient wishes the property
* change to be rolled back.
*/
protected final void fireVetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException {
vcs.fireVetoableChange(evt);
}
/**
* @inheritDoc
*/
public Object clone() throws CloneNotSupportedException {
AbstractBean result = (AbstractBean) super.clone();
result.pcs = new PropertyChangeSupport(result);
result.vcs = new VetoableChangeSupport(result);
return result;
}
}
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.jdesktop.swingx.designer;
import java.awt.Color;
/**
* GraphicsHelper
*
* @author Created by Jasper Potts (May 29, 2007)
*/
public class GraphicsHelper {
public static final Color FILL_LINE = Color.BLUE;
public static final Color FILL_CP_LINE = Color.BLUE;
public static final Color FILL_CP_FILL = Color.WHITE;
public static final Color CONTROL_LINE = Color.RED;
public static final Color CONTROL_POINT_LINE = Color.RED;
public static final Color CONTROL_POINT_FILL = Color.WHITE;
public static final Color BEZIER_CONTROL_POINT_LINE = CONTROL_POINT_LINE;
public static final Color BEZIER_CONTROL_POINT_FILL = CONTROL_POINT_FILL;
public static final Color BEZIER_CONTROL_LINE = Color.DARK_GRAY;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册