Merge
This commit is contained in:
commit
1d27e4abd3
@ -57,3 +57,4 @@ ab4ae8f4514693a9fe17ca2fec0239d8f8450d2c jdk7-b78
|
|||||||
a3242906c7747b5d9bcc3d118c7c3c69aa40f4b7 jdk7-b80
|
a3242906c7747b5d9bcc3d118c7c3c69aa40f4b7 jdk7-b80
|
||||||
8403096d1fe7ff5318df9708cfec84a3fd3e1cf9 jdk7-b81
|
8403096d1fe7ff5318df9708cfec84a3fd3e1cf9 jdk7-b81
|
||||||
e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82
|
e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82
|
||||||
|
6880a3af9addb41541e80ebe8cde6f79ec402a58 jdk7-b83
|
||||||
|
@ -57,3 +57,4 @@ ec0421b5703b677e2226cf4bf7ae4eaafd8061c5 jdk7-b79
|
|||||||
0336e70ca0aeabc783cc01658f36cb6e27ea7934 jdk7-b80
|
0336e70ca0aeabc783cc01658f36cb6e27ea7934 jdk7-b80
|
||||||
e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81
|
e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81
|
||||||
1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82
|
1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82
|
||||||
|
fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
|
||||||
|
@ -79,3 +79,4 @@ ac59d4e6dae51ac5fc31a9a4940d1857f91161b1 hs16-b08
|
|||||||
2581d90c6c9b2012da930eb4742add94a03069a0 hs15-b03
|
2581d90c6c9b2012da930eb4742add94a03069a0 hs15-b03
|
||||||
9ab385cb0c42997e16a7761ebcd25c90560a2714 hs15-b04
|
9ab385cb0c42997e16a7761ebcd25c90560a2714 hs15-b04
|
||||||
fafab5d5349c7c066d677538db67a1ee0fb33bd2 hs15-b05
|
fafab5d5349c7c066d677538db67a1ee0fb33bd2 hs15-b05
|
||||||
|
3f370a32906eb5ba993fabd7b4279be7f31052b9 jdk7-b83
|
||||||
|
@ -57,3 +57,4 @@ e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77
|
|||||||
049cfaaa9a7374e3768a79969a799e8b59ad52fa jdk7-b80
|
049cfaaa9a7374e3768a79969a799e8b59ad52fa jdk7-b80
|
||||||
10b993d417fcdb40480dad7032ac241f4b87f1af jdk7-b81
|
10b993d417fcdb40480dad7032ac241f4b87f1af jdk7-b81
|
||||||
69ef657320ad5c35cfa12e4d8322d877e778f8b3 jdk7-b82
|
69ef657320ad5c35cfa12e4d8322d877e778f8b3 jdk7-b82
|
||||||
|
9027c6b9d7e2c9ca04a1add691b5b50d0f22b1aa jdk7-b83
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
|
# Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1093,6 +1093,7 @@ endif
|
|||||||
# Check for existence of misc Hotspot imported files
|
# Check for existence of misc Hotspot imported files
|
||||||
######################################################
|
######################################################
|
||||||
HOTSPOT_INCLUDE_FILE_LIST = jvmti.h
|
HOTSPOT_INCLUDE_FILE_LIST = jvmti.h
|
||||||
|
HOTSPOT_INCLUDE_FILE_LIST += jvmticmlr.h
|
||||||
#HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
|
#HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
|
||||||
#HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
|
#HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
|
||||||
#HOTSPOT_INCLUDE_FILE_LIST += jmm.h
|
#HOTSPOT_INCLUDE_FILE_LIST += jmm.h
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 1995-2005 Sun Microsystems, Inc. All Rights Reserved.
|
# Copyright 1995-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -34,7 +34,8 @@ include $(BUILDDIR)/common/Defs.gmk
|
|||||||
|
|
||||||
FILES_h = $(INCLUDEDIR)/jni.h \
|
FILES_h = $(INCLUDEDIR)/jni.h \
|
||||||
$(PLATFORM_INCLUDE)/jni_md.h \
|
$(PLATFORM_INCLUDE)/jni_md.h \
|
||||||
$(INCLUDEDIR)/jvmti.h \
|
$(INCLUDEDIR)/jvmti.h \
|
||||||
|
$(INCLUDEDIR)/jvmticmlr.h \
|
||||||
$(INCLUDEDIR)/classfile_constants.h
|
$(INCLUDEDIR)/classfile_constants.h
|
||||||
|
|
||||||
$(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
|
$(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
|
||||||
|
@ -31,7 +31,7 @@ BUILDDIR = ../..
|
|||||||
PACKAGE = sun.nio
|
PACKAGE = sun.nio
|
||||||
PRODUCT = sun
|
PRODUCT = sun
|
||||||
|
|
||||||
OTHER_JAVACFLAGS += -Xlint:serial -Werror
|
OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
|
||||||
include $(BUILDDIR)/common/Defs.gmk
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
|
# Copyright 2004-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -34,12 +34,13 @@ include $(BUILDDIR)/common/Defs.gmk
|
|||||||
|
|
||||||
# Can be built in any order, the JRE version of hprof and java_crw_demo are
|
# Can be built in any order, the JRE version of hprof and java_crw_demo are
|
||||||
# really built in make/java.
|
# really built in make/java.
|
||||||
# The hprof target here just deliveres the sources and README files.
|
# The hprof target here just delivers the sources and README files.
|
||||||
# The java_crw_demo and agent_util files are copied into each demo that
|
# The java_crw_demo and agent_util files are copied into each demo that
|
||||||
# uses them.
|
# uses them.
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
versionCheck \
|
versionCheck \
|
||||||
gctest \
|
compiledMethodLoad \
|
||||||
|
gctest \
|
||||||
heapViewer \
|
heapViewer \
|
||||||
heapTracker \
|
heapTracker \
|
||||||
minst \
|
minst \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
|
# Copyright 2004-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,8 +27,8 @@ Instructions on adding a jvmti demo agent.
|
|||||||
|
|
||||||
Basically you want to mimic the jvmti demo agent "mtrace".
|
Basically you want to mimic the jvmti demo agent "mtrace".
|
||||||
|
|
||||||
* Create and populate a source directory at src/demo/jvmti
|
* Create and populate a source directory at src/share/demo/jvmti
|
||||||
(Try and re-use code in agent_util area like src/demo/jvmti/mtrace)
|
(Try and re-use code in agent_util area like src/share/demo/jvmti/mtrace)
|
||||||
(This should include a small README.txt document on what this demo is)
|
(This should include a small README.txt document on what this demo is)
|
||||||
|
|
||||||
* Make sure the appropriate "demo" copyright notice is added to all the
|
* Make sure the appropriate "demo" copyright notice is added to all the
|
||||||
@ -44,7 +44,7 @@ Basically you want to mimic the jvmti demo agent "mtrace".
|
|||||||
* Create test directory at test/demo/jvmti, create at least one test
|
* Create test directory at test/demo/jvmti, create at least one test
|
||||||
(Use test/demo/jvmti/mtrace as a template)
|
(Use test/demo/jvmti/mtrace as a template)
|
||||||
|
|
||||||
* Don't forget to SCCS in all the new files
|
* Don't forget to check in all the new files
|
||||||
|
|
||||||
* Build and create images (cd make && gnumake && gnumake images)
|
* Build and create images (cd make && gnumake && gnumake images)
|
||||||
(Do this on Solaris, Linux, and at least one Windows platform)
|
(Do this on Solaris, Linux, and at least one Windows platform)
|
||||||
@ -54,5 +54,5 @@ Basically you want to mimic the jvmti demo agent "mtrace".
|
|||||||
* Run the tests: cd test/demo/jvmti && runregress .
|
* Run the tests: cd test/demo/jvmti && runregress .
|
||||||
(Do this on Solaris, Linux, and at least one Windows platform)
|
(Do this on Solaris, Linux, and at least one Windows platform)
|
||||||
|
|
||||||
Contact: jk-svc-group@sun.com for more information or help.
|
Contact: serviceability-dev@openjdk.java.net for more information or help.
|
||||||
|
|
||||||
|
41
jdk/make/mkdemo/jvmti/compiledMethodLoad/Makefile
Normal file
41
jdk/make/mkdemo/jvmti/compiledMethodLoad/Makefile
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2010 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
BUILDDIR = ../../..
|
||||||
|
PRODUCT = demo/jvmti
|
||||||
|
DEMONAME = compiledMethodLoad
|
||||||
|
include $(BUILDDIR)/common/Defs.gmk
|
||||||
|
|
||||||
|
DEMO_ROOT = $(SHARE_SRC)/demo/jvmti/$(DEMONAME)
|
||||||
|
DEMO_TOPFILES = ./README.txt
|
||||||
|
DEMO_DESTDIR = $(DEMODIR)/jvmti/$(DEMONAME)
|
||||||
|
|
||||||
|
DEMO_OBJECTS = agent_util.$(OBJECT_SUFFIX)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Demo jar building rules.
|
||||||
|
#
|
||||||
|
include $(BUILDDIR)/common/Demo.gmk
|
||||||
|
|
@ -179,6 +179,8 @@ FILES_cpp = \
|
|||||||
awt_Mlib.cpp \
|
awt_Mlib.cpp \
|
||||||
awt_new.cpp \
|
awt_new.cpp \
|
||||||
awt_TrayIcon.cpp \
|
awt_TrayIcon.cpp \
|
||||||
|
awt_DCHolder.cpp \
|
||||||
|
awt_ole.cpp \
|
||||||
ShaderList.cpp \
|
ShaderList.cpp \
|
||||||
D3DBlitLoops.cpp \
|
D3DBlitLoops.cpp \
|
||||||
D3DBufImgOps.cpp \
|
D3DBufImgOps.cpp \
|
||||||
|
@ -250,13 +250,14 @@ ifeq ($(PLATFORM), windows)
|
|||||||
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv WINDOWS
|
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv WINDOWS
|
||||||
OTHER_LDLIBS = kernel32.lib user32.lib gdi32.lib winspool.lib \
|
OTHER_LDLIBS = kernel32.lib user32.lib gdi32.lib winspool.lib \
|
||||||
imm32.lib ole32.lib uuid.lib shell32.lib \
|
imm32.lib ole32.lib uuid.lib shell32.lib \
|
||||||
comdlg32.lib winmm.lib comctl32.lib delayimp.lib \
|
comdlg32.lib winmm.lib comctl32.lib \
|
||||||
|
shlwapi.lib delayimp.lib \
|
||||||
$(JVMLIB) \
|
$(JVMLIB) \
|
||||||
/DELAYLOAD:user32.dll /DELAYLOAD:gdi32.dll \
|
/DELAYLOAD:user32.dll /DELAYLOAD:gdi32.dll \
|
||||||
/DELAYLOAD:shell32.dll /DELAYLOAD:winmm.dll \
|
/DELAYLOAD:shell32.dll /DELAYLOAD:winmm.dll \
|
||||||
/DELAYLOAD:winspool.drv /DELAYLOAD:imm32.dll \
|
/DELAYLOAD:winspool.drv /DELAYLOAD:imm32.dll \
|
||||||
/DELAYLOAD:ole32.dll /DELAYLOAD:comdlg32.dll \
|
/DELAYLOAD:ole32.dll /DELAYLOAD:comdlg32.dll \
|
||||||
/DELAYLOAD:comctl32.dll
|
/DELAYLOAD:comctl32.dll /DELAYLOAD:shlwapi.dll
|
||||||
|
|
||||||
clean:: awt.clean
|
clean:: awt.clean
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -110,7 +110,7 @@ public abstract class GraphicsEnvironment {
|
|||||||
// long t1 = System.currentTimeMillis();
|
// long t1 = System.currentTimeMillis();
|
||||||
// System.out.println("GE creation took " + (t1-t0)+ "ms.");
|
// System.out.println("GE creation took " + (t1-t0)+ "ms.");
|
||||||
if (isHeadless()) {
|
if (isHeadless()) {
|
||||||
localEnv = new HeadlessGraphicsEnvironment(localEnv);
|
ge = new HeadlessGraphicsEnvironment(ge);
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new Error("Could not find class: "+nm);
|
throw new Error("Could not find class: "+nm);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -146,6 +146,8 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
|
|||||||
* @param out The code output stream.
|
* @param out The code output stream.
|
||||||
* @return An expression whose value is <code>oldInstance</code>.
|
* @return An expression whose value is <code>oldInstance</code>.
|
||||||
*
|
*
|
||||||
|
* @throws NullPointerException if {@code out} is {@code null}
|
||||||
|
*
|
||||||
* @see #DefaultPersistenceDelegate(String[])
|
* @see #DefaultPersistenceDelegate(String[])
|
||||||
*/
|
*/
|
||||||
protected Expression instantiate(Object oldInstance, Encoder out) {
|
protected Expression instantiate(Object oldInstance, Encoder out) {
|
||||||
@ -367,6 +369,8 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
|
|||||||
* @param newInstance The instance that is to be modified.
|
* @param newInstance The instance that is to be modified.
|
||||||
* @param out The stream to which any initialization statements should be written.
|
* @param out The stream to which any initialization statements should be written.
|
||||||
*
|
*
|
||||||
|
* @throws NullPointerException if {@code out} is {@code null}
|
||||||
|
*
|
||||||
* @see java.beans.Introspector#getBeanInfo
|
* @see java.beans.Introspector#getBeanInfo
|
||||||
* @see java.beans.PropertyDescriptor
|
* @see java.beans.PropertyDescriptor
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -112,54 +112,82 @@ public class Encoder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the persistence delegate for the given type.
|
* Returns the persistence delegate for the given type.
|
||||||
* The persistence delegate is calculated
|
* The persistence delegate is calculated by applying
|
||||||
* by applying the following of rules in order:
|
* the following rules in order:
|
||||||
* <ul>
|
* <ol>
|
||||||
* <li>
|
* <li>
|
||||||
* If the type is an array, an internal persistence
|
* If a persistence delegate is associated with the given type
|
||||||
* delegate is returned which will instantiate an
|
* by using the {@link #setPersistenceDelegate} method
|
||||||
* array of the appropriate type and length, initializing
|
* it is returned.
|
||||||
* each of its elements as if they are properties.
|
|
||||||
* <li>
|
* <li>
|
||||||
* If the type is a proxy, an internal persistence
|
* A persistence delegate is then looked up by the name
|
||||||
* delegate is returned which will instantiate a
|
* composed of the the fully qualified name of the given type
|
||||||
* new proxy instance using the static
|
* and the "PersistenceDelegate" postfix.
|
||||||
* "newProxyInstance" method defined in the
|
* For example, a persistence delegate for the {@code Bean} class
|
||||||
* Proxy class.
|
* should be named {@code BeanPersistenceDelegate}
|
||||||
|
* and located in the same package.
|
||||||
|
* <pre>
|
||||||
|
* public class Bean { ... }
|
||||||
|
* public class BeanPersistenceDelegate { ... }</pre>
|
||||||
|
* The instance of the {@code BeanPersistenceDelegate} class
|
||||||
|
* is returned for the {@code Bean} class.
|
||||||
* <li>
|
* <li>
|
||||||
* If the BeanInfo for this type has a <code>BeanDescriptor</code>
|
* If the type is {@code null},
|
||||||
* which defined a "persistenceDelegate" property, this
|
* a shared internal persistence delegate is returned
|
||||||
* value is returned.
|
* that encodes {@code null} value.
|
||||||
* <li>
|
* <li>
|
||||||
* In all other cases the default persistence delegate
|
* If the type is a {@code enum} declaration,
|
||||||
* is returned. The default persistence delegate assumes
|
* a shared internal persistence delegate is returned
|
||||||
* the type is a <em>JavaBean</em>, implying that it has a default constructor
|
* that encodes constants of this enumeration
|
||||||
* and that its state may be characterized by the matching pairs
|
* by their names.
|
||||||
* of "setter" and "getter" methods returned by the Introspector.
|
* <li>
|
||||||
|
* If the type is a primitive type or the corresponding wrapper,
|
||||||
|
* a shared internal persistence delegate is returned
|
||||||
|
* that encodes values of the given type.
|
||||||
|
* <li>
|
||||||
|
* If the type is an array,
|
||||||
|
* a shared internal persistence delegate is returned
|
||||||
|
* that encodes an array of the appropriate type and length,
|
||||||
|
* and each of its elements as if they are properties.
|
||||||
|
* <li>
|
||||||
|
* If the type is a proxy,
|
||||||
|
* a shared internal persistence delegate is returned
|
||||||
|
* that encodes a proxy instance by using
|
||||||
|
* the {@link java.lang.reflect.Proxy#newProxyInstance} method.
|
||||||
|
* <li>
|
||||||
|
* If the {@link BeanInfo} for this type has a {@link BeanDescriptor}
|
||||||
|
* which defined a "persistenceDelegate" attribute,
|
||||||
|
* the value of this named attribute is returned.
|
||||||
|
* <li>
|
||||||
|
* In all other cases the default persistence delegate is returned.
|
||||||
|
* The default persistence delegate assumes the type is a <em>JavaBean</em>,
|
||||||
|
* implying that it has a default constructor and that its state
|
||||||
|
* may be characterized by the matching pairs of "setter" and "getter"
|
||||||
|
* methods returned by the {@link Introspector} class.
|
||||||
* The default constructor is the constructor with the greatest number
|
* The default constructor is the constructor with the greatest number
|
||||||
* of parameters that has the {@link ConstructorProperties} annotation.
|
* of parameters that has the {@link ConstructorProperties} annotation.
|
||||||
* If none of the constructors have the {@code ConstructorProperties} annotation,
|
* If none of the constructors has the {@code ConstructorProperties} annotation,
|
||||||
* then the nullary constructor (constructor with no parameters) will be used.
|
* then the nullary constructor (constructor with no parameters) will be used.
|
||||||
* For example, in the following the nullary constructor
|
* For example, in the following code fragment, the nullary constructor
|
||||||
* for {@code Foo} will be used, while the two parameter constructor
|
* for the {@code Foo} class will be used,
|
||||||
* for {@code Bar} will be used.
|
* while the two-parameter constructor
|
||||||
* <code>
|
* for the {@code Bar} class will be used.
|
||||||
* public class Foo {
|
* <pre>
|
||||||
|
* public class Foo {
|
||||||
* public Foo() { ... }
|
* public Foo() { ... }
|
||||||
* public Foo(int x) { ... }
|
* public Foo(int x) { ... }
|
||||||
* }
|
* }
|
||||||
* public class Bar {
|
* public class Bar {
|
||||||
* public Bar() { ... }
|
* public Bar() { ... }
|
||||||
* @ConstructorProperties({"x"})
|
* @ConstructorProperties({"x"})
|
||||||
* public Bar(int x) { ... }
|
* public Bar(int x) { ... }
|
||||||
* @ConstructorProperties({"x", "y"})
|
* @ConstructorProperties({"x", "y"})
|
||||||
* public Bar(int x, int y) { ... }
|
* public Bar(int x, int y) { ... }
|
||||||
* }
|
* }</pre>
|
||||||
* </code>
|
* </ol>
|
||||||
* </ul>
|
|
||||||
*
|
*
|
||||||
* @param type The type of the object.
|
* @param type the class of the objects
|
||||||
* @return The persistence delegate for this type of object.
|
* @return the persistence delegate for the given type
|
||||||
*
|
*
|
||||||
* @see #setPersistenceDelegate
|
* @see #setPersistenceDelegate
|
||||||
* @see java.beans.Introspector#getBeanInfo
|
* @see java.beans.Introspector#getBeanInfo
|
||||||
@ -176,21 +204,18 @@ public class Encoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the persistence delegate associated with this <code>type</code> to
|
* Associates the specified persistence delegate with the given type.
|
||||||
* <code>persistenceDelegate</code>.
|
|
||||||
*
|
*
|
||||||
* @param type The class of objects that <code>persistenceDelegate</code> applies to.
|
* @param type the class of objects that the specified persistence delegate applies to
|
||||||
* @param persistenceDelegate The persistence delegate for instances of <code>type</code>.
|
* @param delegate the persistence delegate for instances of the given type
|
||||||
*
|
*
|
||||||
* @see #getPersistenceDelegate
|
* @see #getPersistenceDelegate
|
||||||
* @see java.beans.Introspector#getBeanInfo
|
* @see java.beans.Introspector#getBeanInfo
|
||||||
* @see java.beans.BeanInfo#getBeanDescriptor
|
* @see java.beans.BeanInfo#getBeanDescriptor
|
||||||
*/
|
*/
|
||||||
public void setPersistenceDelegate(Class<?> type,
|
public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate) {
|
||||||
PersistenceDelegate persistenceDelegate)
|
|
||||||
{
|
|
||||||
synchronized (this.finder) {
|
synchronized (this.finder) {
|
||||||
this.finder.register(type, persistenceDelegate);
|
this.finder.register(type, delegate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -51,12 +51,19 @@ public class Expression extends Statement {
|
|||||||
private Object value = unbound;
|
private Object value = unbound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>Statement</code> object with a <code>target</code>,
|
* Creates a new {@link Expression} object
|
||||||
* <code>methodName</code> and <code>arguments</code> as per the parameters.
|
* for the specified target object to invoke the method
|
||||||
|
* specified by the name and by the array of arguments.
|
||||||
|
* <p>
|
||||||
|
* The {@code target} and the {@code methodName} values should not be {@code null}.
|
||||||
|
* Otherwise an attempt to execute this {@code Expression}
|
||||||
|
* will result in a {@code NullPointerException}.
|
||||||
|
* If the {@code arguments} value is {@code null},
|
||||||
|
* an empty array is used as the value of the {@code arguments} property.
|
||||||
*
|
*
|
||||||
* @param target The target of this expression.
|
* @param target the target object of this expression
|
||||||
* @param methodName The methodName of this expression.
|
* @param methodName the name of the method to invoke on the specified target
|
||||||
* @param arguments The arguments of this expression. If <code>null</code> then an empty array will be used.
|
* @param arguments the array of arguments to invoke the specified method
|
||||||
*
|
*
|
||||||
* @see #getValue
|
* @see #getValue
|
||||||
*/
|
*/
|
||||||
@ -66,16 +73,23 @@ public class Expression extends Statement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>Expression</code> object for a method
|
* Creates a new {@link Expression} object with the specified value
|
||||||
* that returns a result. The result will never be calculated
|
* for the specified target object to invoke the method
|
||||||
* however, since this constructor uses the <code>value</code>
|
* specified by the name and by the array of arguments.
|
||||||
* parameter to set the value property by calling the
|
* The {@code value} value is used as the value of the {@code value} property,
|
||||||
* <code>setValue</code> method.
|
* so the {@link #getValue} method will return it
|
||||||
|
* without executing this {@code Expression}.
|
||||||
|
* <p>
|
||||||
|
* The {@code target} and the {@code methodName} values should not be {@code null}.
|
||||||
|
* Otherwise an attempt to execute this {@code Expression}
|
||||||
|
* will result in a {@code NullPointerException}.
|
||||||
|
* If the {@code arguments} value is {@code null},
|
||||||
|
* an empty array is used as the value of the {@code arguments} property.
|
||||||
*
|
*
|
||||||
* @param value The value of this expression.
|
* @param value the value of this expression
|
||||||
* @param target The target of this expression.
|
* @param target the target object of this expression
|
||||||
* @param methodName The methodName of this expression.
|
* @param methodName the name of the method to invoke on the specified target
|
||||||
* @param arguments The arguments of this expression. If <code>null</code> then an empty array will be used.
|
* @param arguments the array of arguments to invoke the specified method
|
||||||
*
|
*
|
||||||
* @see #setValue
|
* @see #setValue
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1996-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,6 +29,8 @@ import com.sun.beans.WeakCache;
|
|||||||
import com.sun.beans.finder.BeanInfoFinder;
|
import com.sun.beans.finder.BeanInfoFinder;
|
||||||
import com.sun.beans.finder.ClassFinder;
|
import com.sun.beans.finder.ClassFinder;
|
||||||
|
|
||||||
|
import java.lang.ref.Reference;
|
||||||
|
import java.lang.ref.SoftReference;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ import java.util.Iterator;
|
|||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import sun.awt.AppContext;
|
import sun.awt.AppContext;
|
||||||
import sun.reflect.misc.ReflectUtil;
|
import sun.reflect.misc.ReflectUtil;
|
||||||
@ -155,11 +158,11 @@ public class Introspector {
|
|||||||
return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
|
||||||
}
|
}
|
||||||
synchronized (BEANINFO_CACHE) {
|
synchronized (BEANINFO_CACHE) {
|
||||||
WeakCache<Class<?>, BeanInfo> beanInfoCache =
|
Map<Class<?>, BeanInfo> beanInfoCache =
|
||||||
(WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
(Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||||
|
|
||||||
if (beanInfoCache == null) {
|
if (beanInfoCache == null) {
|
||||||
beanInfoCache = new WeakCache<Class<?>, BeanInfo>();
|
beanInfoCache = new WeakHashMap<Class<?>, BeanInfo>();
|
||||||
AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
|
AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
|
||||||
}
|
}
|
||||||
BeanInfo beanInfo = beanInfoCache.get(beanClass);
|
BeanInfo beanInfo = beanInfoCache.get(beanClass);
|
||||||
@ -341,7 +344,7 @@ public class Introspector {
|
|||||||
|
|
||||||
public static void flushCaches() {
|
public static void flushCaches() {
|
||||||
synchronized (BEANINFO_CACHE) {
|
synchronized (BEANINFO_CACHE) {
|
||||||
WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
|
Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||||
if (beanInfoCache != null) {
|
if (beanInfoCache != null) {
|
||||||
beanInfoCache.clear();
|
beanInfoCache.clear();
|
||||||
}
|
}
|
||||||
@ -369,7 +372,7 @@ public class Introspector {
|
|||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
synchronized (BEANINFO_CACHE) {
|
synchronized (BEANINFO_CACHE) {
|
||||||
WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
|
Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
|
||||||
if (beanInfoCache != null) {
|
if (beanInfoCache != null) {
|
||||||
beanInfoCache.put(clz, null);
|
beanInfoCache.put(clz, null);
|
||||||
}
|
}
|
||||||
@ -1458,7 +1461,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
|
|||||||
private PropertyDescriptor[] properties;
|
private PropertyDescriptor[] properties;
|
||||||
private int defaultProperty;
|
private int defaultProperty;
|
||||||
private MethodDescriptor[] methods;
|
private MethodDescriptor[] methods;
|
||||||
private BeanInfo targetBeanInfo;
|
private final Reference<BeanInfo> targetBeanInfoRef;
|
||||||
|
|
||||||
public GenericBeanInfo(BeanDescriptor beanDescriptor,
|
public GenericBeanInfo(BeanDescriptor beanDescriptor,
|
||||||
EventSetDescriptor[] events, int defaultEvent,
|
EventSetDescriptor[] events, int defaultEvent,
|
||||||
@ -1470,7 +1473,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
|
|||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.defaultProperty = defaultProperty;
|
this.defaultProperty = defaultProperty;
|
||||||
this.methods = methods;
|
this.methods = methods;
|
||||||
this.targetBeanInfo = targetBeanInfo;
|
this.targetBeanInfoRef = new SoftReference<BeanInfo>(targetBeanInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1509,7 +1512,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
|
|||||||
methods[i] = new MethodDescriptor(old.methods[i]);
|
methods[i] = new MethodDescriptor(old.methods[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
targetBeanInfo = old.targetBeanInfo;
|
this.targetBeanInfoRef = old.targetBeanInfoRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyDescriptor[] getPropertyDescriptors() {
|
public PropertyDescriptor[] getPropertyDescriptors() {
|
||||||
@ -1537,6 +1540,7 @@ class GenericBeanInfo extends SimpleBeanInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public java.awt.Image getIcon(int iconKind) {
|
public java.awt.Image getIcon(int iconKind) {
|
||||||
|
BeanInfo targetBeanInfo = this.targetBeanInfoRef.get();
|
||||||
if (targetBeanInfo != null) {
|
if (targetBeanInfo != null) {
|
||||||
return targetBeanInfo.getIcon(iconKind);
|
return targetBeanInfo.getIcon(iconKind);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -105,6 +105,8 @@ public abstract class PersistenceDelegate {
|
|||||||
*
|
*
|
||||||
* @param oldInstance The instance that will be created by this expression.
|
* @param oldInstance The instance that will be created by this expression.
|
||||||
* @param out The stream to which this expression will be written.
|
* @param out The stream to which this expression will be written.
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code out} is {@code null}
|
||||||
*/
|
*/
|
||||||
public void writeObject(Object oldInstance, Encoder out) {
|
public void writeObject(Object oldInstance, Encoder out) {
|
||||||
Object newInstance = out.get(oldInstance);
|
Object newInstance = out.get(oldInstance);
|
||||||
@ -158,6 +160,8 @@ public abstract class PersistenceDelegate {
|
|||||||
* @param oldInstance The instance that will be created by this expression.
|
* @param oldInstance The instance that will be created by this expression.
|
||||||
* @param out The stream to which this expression will be written.
|
* @param out The stream to which this expression will be written.
|
||||||
* @return An expression whose value is <code>oldInstance</code>.
|
* @return An expression whose value is <code>oldInstance</code>.
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code out} is {@code null}
|
||||||
*/
|
*/
|
||||||
protected abstract Expression instantiate(Object oldInstance, Encoder out);
|
protected abstract Expression instantiate(Object oldInstance, Encoder out);
|
||||||
|
|
||||||
@ -196,6 +200,8 @@ public abstract class PersistenceDelegate {
|
|||||||
* @param oldInstance The instance to be copied.
|
* @param oldInstance The instance to be copied.
|
||||||
* @param newInstance The instance that is to be modified.
|
* @param newInstance The instance that is to be modified.
|
||||||
* @param out The stream to which any initialization statements should be written.
|
* @param out The stream to which any initialization statements should be written.
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code out} is {@code null}
|
||||||
*/
|
*/
|
||||||
protected void initialize(Class<?> type,
|
protected void initialize(Class<?> type,
|
||||||
Object oldInstance, Object newInstance,
|
Object oldInstance, Object newInstance,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -69,13 +69,19 @@ public class Statement {
|
|||||||
ClassLoader loader;
|
ClassLoader loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>Statement</code> object with a <code>target</code>,
|
* Creates a new {@link Statement} object
|
||||||
* <code>methodName</code> and <code>arguments</code> as per the parameters.
|
* for the specified target object to invoke the method
|
||||||
*
|
* specified by the name and by the array of arguments.
|
||||||
* @param target The target of this statement.
|
* <p>
|
||||||
* @param methodName The methodName of this statement.
|
* The {@code target} and the {@code methodName} values should not be {@code null}.
|
||||||
* @param arguments The arguments of this statement. If <code>null</code> then an empty array will be used.
|
* Otherwise an attempt to execute this {@code Expression}
|
||||||
|
* will result in a {@code NullPointerException}.
|
||||||
|
* If the {@code arguments} value is {@code null},
|
||||||
|
* an empty array is used as the value of the {@code arguments} property.
|
||||||
*
|
*
|
||||||
|
* @param target the target object of this statement
|
||||||
|
* @param methodName the name of the method to invoke on the specified target
|
||||||
|
* @param arguments the array of arguments to invoke the specified method
|
||||||
*/
|
*/
|
||||||
@ConstructorProperties({"target", "methodName", "arguments"})
|
@ConstructorProperties({"target", "methodName", "arguments"})
|
||||||
public Statement(Object target, String methodName, Object[] arguments) {
|
public Statement(Object target, String methodName, Object[] arguments) {
|
||||||
@ -85,27 +91,36 @@ public class Statement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the target of this statement.
|
* Returns the target object of this statement.
|
||||||
|
* If this method returns {@code null},
|
||||||
|
* the {@link #execute} method
|
||||||
|
* throws a {@code NullPointerException}.
|
||||||
*
|
*
|
||||||
* @return The target of this statement.
|
* @return the target object of this statement
|
||||||
*/
|
*/
|
||||||
public Object getTarget() {
|
public Object getTarget() {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the method.
|
* Returns the name of the method to invoke.
|
||||||
|
* If this method returns {@code null},
|
||||||
|
* the {@link #execute} method
|
||||||
|
* throws a {@code NullPointerException}.
|
||||||
*
|
*
|
||||||
* @return The name of the method.
|
* @return the name of the method
|
||||||
*/
|
*/
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return methodName;
|
return methodName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the arguments of this statement.
|
* Returns the arguments for the method to invoke.
|
||||||
|
* The number of arguments and their types
|
||||||
|
* must match the method being called.
|
||||||
|
* {@code null} can be used as a synonym of an empty array.
|
||||||
*
|
*
|
||||||
* @return the arguments of this statement.
|
* @return the array of arguments
|
||||||
*/
|
*/
|
||||||
public Object[] getArguments() {
|
public Object[] getArguments() {
|
||||||
return arguments;
|
return arguments;
|
||||||
@ -154,6 +169,9 @@ public class Statement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object[] arguments = getArguments();
|
Object[] arguments = getArguments();
|
||||||
|
if (arguments == null) {
|
||||||
|
arguments = emptyArray;
|
||||||
|
}
|
||||||
// Class.forName() won't load classes outside
|
// Class.forName() won't load classes outside
|
||||||
// of core from a class inside core. Special
|
// of core from a class inside core. Special
|
||||||
// case this method.
|
// case this method.
|
||||||
@ -285,7 +303,9 @@ public class Statement {
|
|||||||
Object target = getTarget();
|
Object target = getTarget();
|
||||||
String methodName = getMethodName();
|
String methodName = getMethodName();
|
||||||
Object[] arguments = getArguments();
|
Object[] arguments = getArguments();
|
||||||
|
if (arguments == null) {
|
||||||
|
arguments = emptyArray;
|
||||||
|
}
|
||||||
StringBuffer result = new StringBuffer(instanceName(target) + "." + methodName + "(");
|
StringBuffer result = new StringBuffer(instanceName(target) + "." + methodName + "(");
|
||||||
int n = arguments.length;
|
int n = arguments.length;
|
||||||
for(int i = 0; i < n; i++) {
|
for(int i = 0; i < n; i++) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -663,15 +663,23 @@ public class PKIXParameters implements CertPathParameters {
|
|||||||
*/
|
*/
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
try {
|
try {
|
||||||
Object copy = super.clone();
|
PKIXParameters copy = (PKIXParameters)super.clone();
|
||||||
// Must clone these because addCertStore, et al. modify them
|
|
||||||
|
// must clone these because addCertStore, et al. modify them
|
||||||
if (certStores != null) {
|
if (certStores != null) {
|
||||||
certStores = new ArrayList<CertStore>(certStores);
|
copy.certStores = new ArrayList<CertStore>(certStores);
|
||||||
}
|
}
|
||||||
if (certPathCheckers != null) {
|
if (certPathCheckers != null) {
|
||||||
certPathCheckers =
|
copy.certPathCheckers =
|
||||||
new ArrayList<PKIXCertPathChecker>(certPathCheckers);
|
new ArrayList<PKIXCertPathChecker>(certPathCheckers.size());
|
||||||
|
for (PKIXCertPathChecker checker : certPathCheckers) {
|
||||||
|
copy.certPathCheckers.add(
|
||||||
|
(PKIXCertPathChecker)checker.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// other class fields are immutable to public, don't bother
|
||||||
|
// to clone the read-only fields.
|
||||||
return copy;
|
return copy;
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
/* Cannot happen */
|
/* Cannot happen */
|
||||||
|
@ -232,7 +232,7 @@ public final class CollationElementIterator
|
|||||||
buffer = makeReorderedBuffer(consonant, value, buffer, true);
|
buffer = makeReorderedBuffer(consonant, value, buffer, true);
|
||||||
value = buffer[0];
|
value = buffer[0];
|
||||||
expIndex = 1;
|
expIndex = 1;
|
||||||
} else {
|
} else if (consonant != NormalizerBase.DONE) {
|
||||||
text.previous();
|
text.previous();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ public final class CollationElementIterator
|
|||||||
buffer = makeReorderedBuffer(consonant, value, buffer, true);
|
buffer = makeReorderedBuffer(consonant, value, buffer, true);
|
||||||
value = buffer[0];
|
value = buffer[0];
|
||||||
expIndex = 1;
|
expIndex = 1;
|
||||||
} else {
|
} else if (consonant != NormalizerBase.DONE) {
|
||||||
text.previous();
|
text.previous();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,6 +621,8 @@ class RuleBasedBreakIterator extends BreakIterator {
|
|||||||
return handleNext();
|
return handleNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int cachedLastKnownBreak = BreakIterator.DONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advances the iterator backwards, to the last boundary preceding this one.
|
* Advances the iterator backwards, to the last boundary preceding this one.
|
||||||
* @return The position of the last boundary position preceding this one.
|
* @return The position of the last boundary position preceding this one.
|
||||||
@ -638,8 +640,16 @@ class RuleBasedBreakIterator extends BreakIterator {
|
|||||||
// the current position), but not necessarily the last one before
|
// the current position), but not necessarily the last one before
|
||||||
// where we started
|
// where we started
|
||||||
int start = current();
|
int start = current();
|
||||||
getPrevious();
|
int lastResult = cachedLastKnownBreak;
|
||||||
int lastResult = handlePrevious();
|
if (lastResult >= start || lastResult <= BreakIterator.DONE) {
|
||||||
|
getPrevious();
|
||||||
|
lastResult = handlePrevious();
|
||||||
|
} else {
|
||||||
|
//it might be better to check if handlePrevious() give us closer
|
||||||
|
//safe value but handlePrevious() is slow too
|
||||||
|
//So, this has to be done carefully
|
||||||
|
text.setIndex(lastResult);
|
||||||
|
}
|
||||||
int result = lastResult;
|
int result = lastResult;
|
||||||
|
|
||||||
// iterate forward from the known break position until we pass our
|
// iterate forward from the known break position until we pass our
|
||||||
@ -653,6 +663,7 @@ class RuleBasedBreakIterator extends BreakIterator {
|
|||||||
// set the current iteration position to be the last break position
|
// set the current iteration position to be the last break position
|
||||||
// before where we started, and then return that value
|
// before where we started, and then return that value
|
||||||
text.setIndex(lastResult);
|
text.setIndex(lastResult);
|
||||||
|
cachedLastKnownBreak = lastResult;
|
||||||
return lastResult;
|
return lastResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,7 +768,8 @@ class RuleBasedBreakIterator extends BreakIterator {
|
|||||||
// then we can just use next() to get our return value
|
// then we can just use next() to get our return value
|
||||||
text.setIndex(offset);
|
text.setIndex(offset);
|
||||||
if (offset == text.getBeginIndex()) {
|
if (offset == text.getBeginIndex()) {
|
||||||
return handleNext();
|
cachedLastKnownBreak = handleNext();
|
||||||
|
return cachedLastKnownBreak;
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, we have to sync up first. Use handlePrevious() to back
|
// otherwise, we have to sync up first. Use handlePrevious() to back
|
||||||
@ -767,10 +779,19 @@ class RuleBasedBreakIterator extends BreakIterator {
|
|||||||
// position at or before our starting position. Advance forward
|
// position at or before our starting position. Advance forward
|
||||||
// from here until we've passed the starting position. The position
|
// from here until we've passed the starting position. The position
|
||||||
// we stop on will be the first break position after the specified one.
|
// we stop on will be the first break position after the specified one.
|
||||||
int result = handlePrevious();
|
int result = cachedLastKnownBreak;
|
||||||
|
if (result >= offset || result <= BreakIterator.DONE) {
|
||||||
|
result = handlePrevious();
|
||||||
|
} else {
|
||||||
|
//it might be better to check if handlePrevious() give us closer
|
||||||
|
//safe value but handlePrevious() is slow too
|
||||||
|
//So, this has to be done carefully
|
||||||
|
text.setIndex(result);
|
||||||
|
}
|
||||||
while (result != BreakIterator.DONE && result <= offset) {
|
while (result != BreakIterator.DONE && result <= offset) {
|
||||||
result = handleNext();
|
result = handleNext();
|
||||||
}
|
}
|
||||||
|
cachedLastKnownBreak = result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,6 +886,8 @@ class RuleBasedBreakIterator extends BreakIterator {
|
|||||||
text = new SafeCharIterator(newText);
|
text = new SafeCharIterator(newText);
|
||||||
}
|
}
|
||||||
text.first();
|
text.first();
|
||||||
|
|
||||||
|
cachedLastKnownBreak = BreakIterator.DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -953,7 +953,7 @@ public class Date
|
|||||||
* without affecting its internal state.
|
* without affecting its internal state.
|
||||||
*/
|
*/
|
||||||
static final long getMillisOf(Date date) {
|
static final long getMillisOf(Date date) {
|
||||||
if (date.cdate == null) {
|
if (date.cdate == null || date.cdate.isNormalized()) {
|
||||||
return date.fastTime;
|
return date.fastTime;
|
||||||
}
|
}
|
||||||
BaseCalendar.Date d = (BaseCalendar.Date) date.cdate.clone();
|
BaseCalendar.Date d = (BaseCalendar.Date) date.cdate.clone();
|
||||||
|
@ -860,6 +860,14 @@ public final class Pattern
|
|||||||
*/
|
*/
|
||||||
private transient int patternLength;
|
private transient int patternLength;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the Start node might possibly match supplementary characters.
|
||||||
|
* It is set to true during compiling if
|
||||||
|
* (1) There is supplementary char in pattern, or
|
||||||
|
* (2) There is complement node of Category or Block
|
||||||
|
*/
|
||||||
|
private transient boolean hasSupplementary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles the given regular expression into a pattern. </p>
|
* Compiles the given regular expression into a pattern. </p>
|
||||||
*
|
*
|
||||||
@ -1481,7 +1489,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
// Use double zero to terminate pattern
|
// Use double zero to terminate pattern
|
||||||
temp = new int[patternLength + 2];
|
temp = new int[patternLength + 2];
|
||||||
|
|
||||||
boolean hasSupplementary = false;
|
hasSupplementary = false;
|
||||||
int c, count = 0;
|
int c, count = 0;
|
||||||
// Convert all chars into code points
|
// Convert all chars into code points
|
||||||
for (int x = 0; x < patternLength; x += Character.charCount(c)) {
|
for (int x = 0; x < patternLength; x += Character.charCount(c)) {
|
||||||
@ -1787,7 +1795,8 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
* character or unpaired surrogate.
|
* character or unpaired surrogate.
|
||||||
*/
|
*/
|
||||||
private static final boolean isSupplementary(int ch) {
|
private static final boolean isSupplementary(int ch) {
|
||||||
return ch >= Character.MIN_SUPPLEMENTARY_CODE_POINT || isSurrogate(ch);
|
return ch >= Character.MIN_SUPPLEMENTARY_CODE_POINT ||
|
||||||
|
Character.isSurrogate((char)ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1885,7 +1894,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
} else {
|
} else {
|
||||||
oneLetter = false;
|
oneLetter = false;
|
||||||
}
|
}
|
||||||
node = family(oneLetter).maybeComplement(comp);
|
node = family(oneLetter, comp);
|
||||||
} else {
|
} else {
|
||||||
unread();
|
unread();
|
||||||
node = atom();
|
node = atom();
|
||||||
@ -2001,7 +2010,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
unread();
|
unread();
|
||||||
else
|
else
|
||||||
oneLetter = false;
|
oneLetter = false;
|
||||||
return family(oneLetter).maybeComplement(comp);
|
return family(oneLetter, comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unread();
|
unread();
|
||||||
@ -2404,7 +2413,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
unread();
|
unread();
|
||||||
else
|
else
|
||||||
oneLetter = false;
|
oneLetter = false;
|
||||||
return family(oneLetter).maybeComplement(comp);
|
return family(oneLetter, comp);
|
||||||
} else { // ordinary escape
|
} else { // ordinary escape
|
||||||
unread();
|
unread();
|
||||||
ch = escape(true, true);
|
ch = escape(true, true);
|
||||||
@ -2450,9 +2459,12 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
/**
|
/**
|
||||||
* Parses a Unicode character family and returns its representative node.
|
* Parses a Unicode character family and returns its representative node.
|
||||||
*/
|
*/
|
||||||
private CharProperty family(boolean singleLetter) {
|
private CharProperty family(boolean singleLetter,
|
||||||
|
boolean maybeComplement)
|
||||||
|
{
|
||||||
next();
|
next();
|
||||||
String name;
|
String name;
|
||||||
|
CharProperty node;
|
||||||
|
|
||||||
if (singleLetter) {
|
if (singleLetter) {
|
||||||
int c = temp[cursor];
|
int c = temp[cursor];
|
||||||
@ -2477,12 +2489,18 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name.startsWith("In")) {
|
if (name.startsWith("In")) {
|
||||||
return unicodeBlockPropertyFor(name.substring(2));
|
node = unicodeBlockPropertyFor(name.substring(2));
|
||||||
} else {
|
} else {
|
||||||
if (name.startsWith("Is"))
|
if (name.startsWith("Is"))
|
||||||
name = name.substring(2);
|
name = name.substring(2);
|
||||||
return charPropertyNodeFor(name);
|
node = charPropertyNodeFor(name);
|
||||||
}
|
}
|
||||||
|
if (maybeComplement) {
|
||||||
|
if (node instanceof Category || node instanceof Block)
|
||||||
|
hasSupplementary = true;
|
||||||
|
node = node.complement();
|
||||||
|
}
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2495,9 +2513,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
throw error("Unknown character block name {" + name + "}");
|
throw error("Unknown character block name {" + name + "}");
|
||||||
}
|
}
|
||||||
return new CharProperty() {
|
return new Block(block);
|
||||||
boolean isSatisfiedBy(int ch) {
|
|
||||||
return block == Character.UnicodeBlock.of(ch);}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2968,13 +2984,6 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
// Utility methods for code point support
|
// Utility methods for code point support
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests a surrogate value.
|
|
||||||
*/
|
|
||||||
private static final boolean isSurrogate(int c) {
|
|
||||||
return c >= Character.MIN_HIGH_SURROGATE && c <= Character.MAX_LOW_SURROGATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int countChars(CharSequence seq, int index,
|
private static final int countChars(CharSequence seq, int index,
|
||||||
int lengthInCodePoints) {
|
int lengthInCodePoints) {
|
||||||
// optimization
|
// optimization
|
||||||
@ -3174,20 +3183,17 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
matcher.hitEnd = true;
|
matcher.hitEnd = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean ret = false;
|
|
||||||
int guard = matcher.to - minLength;
|
int guard = matcher.to - minLength;
|
||||||
for (; i <= guard; i++) {
|
for (; i <= guard; i++) {
|
||||||
if (ret = next.match(matcher, i, seq))
|
if (next.match(matcher, i, seq)) {
|
||||||
break;
|
matcher.first = i;
|
||||||
if (i == guard)
|
matcher.groups[0] = matcher.first;
|
||||||
matcher.hitEnd = true;
|
matcher.groups[1] = matcher.last;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ret) {
|
matcher.hitEnd = true;
|
||||||
matcher.first = i;
|
return false;
|
||||||
matcher.groups[0] = matcher.first;
|
|
||||||
matcher.groups[1] = matcher.last;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
boolean study(TreeInfo info) {
|
boolean study(TreeInfo info) {
|
||||||
next.study(info);
|
next.study(info);
|
||||||
@ -3209,27 +3215,28 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
matcher.hitEnd = true;
|
matcher.hitEnd = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean ret = false;
|
|
||||||
int guard = matcher.to - minLength;
|
int guard = matcher.to - minLength;
|
||||||
while (i <= guard) {
|
while (i <= guard) {
|
||||||
if ((ret = next.match(matcher, i, seq)) || i == guard)
|
//if ((ret = next.match(matcher, i, seq)) || i == guard)
|
||||||
|
if (next.match(matcher, i, seq)) {
|
||||||
|
matcher.first = i;
|
||||||
|
matcher.groups[0] = matcher.first;
|
||||||
|
matcher.groups[1] = matcher.last;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (i == guard)
|
||||||
break;
|
break;
|
||||||
// Optimization to move to the next character. This is
|
// Optimization to move to the next character. This is
|
||||||
// faster than countChars(seq, i, 1).
|
// faster than countChars(seq, i, 1).
|
||||||
if (Character.isHighSurrogate(seq.charAt(i++))) {
|
if (Character.isHighSurrogate(seq.charAt(i++))) {
|
||||||
if (i < seq.length() && Character.isLowSurrogate(seq.charAt(i))) {
|
if (i < seq.length() &&
|
||||||
|
Character.isLowSurrogate(seq.charAt(i))) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == guard)
|
|
||||||
matcher.hitEnd = true;
|
|
||||||
}
|
}
|
||||||
if (ret) {
|
matcher.hitEnd = true;
|
||||||
matcher.first = i;
|
return false;
|
||||||
matcher.groups[0] = matcher.first;
|
|
||||||
matcher.groups[1] = matcher.last;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3461,9 +3468,6 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
boolean isSatisfiedBy(int ch) {
|
boolean isSatisfiedBy(int ch) {
|
||||||
return ! CharProperty.this.isSatisfiedBy(ch);}};
|
return ! CharProperty.this.isSatisfiedBy(ch);}};
|
||||||
}
|
}
|
||||||
CharProperty maybeComplement(boolean complement) {
|
|
||||||
return complement ? complement() : this;
|
|
||||||
}
|
|
||||||
boolean match(Matcher matcher, int i, CharSequence seq) {
|
boolean match(Matcher matcher, int i, CharSequence seq) {
|
||||||
if (i < matcher.to) {
|
if (i < matcher.to) {
|
||||||
int ch = Character.codePointAt(seq, i);
|
int ch = Character.codePointAt(seq, i);
|
||||||
@ -3548,6 +3552,20 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node class that matches a Unicode block.
|
||||||
|
*/
|
||||||
|
static final class Block extends CharProperty {
|
||||||
|
final Character.UnicodeBlock block;
|
||||||
|
Block(Character.UnicodeBlock block) {
|
||||||
|
this.block = block;
|
||||||
|
}
|
||||||
|
boolean isSatisfiedBy(int ch) {
|
||||||
|
return block == Character.UnicodeBlock.of(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node class that matches a Unicode category.
|
* Node class that matches a Unicode category.
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +27,7 @@ package javax.swing;
|
|||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -89,11 +90,7 @@ class MultiUIDefaults extends UIDefaults
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
int n = super.size();
|
return entrySet().size();
|
||||||
for (UIDefaults table : tables) {
|
|
||||||
n += (table != null) ? table.size() : 0;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,40 +101,26 @@ class MultiUIDefaults extends UIDefaults
|
|||||||
@Override
|
@Override
|
||||||
public Enumeration<Object> keys()
|
public Enumeration<Object> keys()
|
||||||
{
|
{
|
||||||
Enumeration[] enums = new Enumeration[1 + tables.length];
|
return new MultiUIDefaultsEnumerator(
|
||||||
enums[0] = super.keys();
|
MultiUIDefaultsEnumerator.Type.KEYS, entrySet());
|
||||||
for(int i = 0; i < tables.length; i++) {
|
|
||||||
UIDefaults table = tables[i];
|
|
||||||
if (table != null) {
|
|
||||||
enums[i + 1] = table.keys();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new MultiUIDefaultsEnumerator(enums);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<Object> elements()
|
public Enumeration<Object> elements()
|
||||||
{
|
{
|
||||||
Enumeration[] enums = new Enumeration[1 + tables.length];
|
return new MultiUIDefaultsEnumerator(
|
||||||
enums[0] = super.elements();
|
MultiUIDefaultsEnumerator.Type.ELEMENTS, entrySet());
|
||||||
for(int i = 0; i < tables.length; i++) {
|
|
||||||
UIDefaults table = tables[i];
|
|
||||||
if (table != null) {
|
|
||||||
enums[i + 1] = table.elements();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new MultiUIDefaultsEnumerator(enums);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Entry<Object, Object>> entrySet() {
|
public Set<Entry<Object, Object>> entrySet() {
|
||||||
Set<Entry<Object, Object>> set = new HashSet<Entry<Object, Object>>();
|
Set<Entry<Object, Object>> set = new HashSet<Entry<Object, Object>>();
|
||||||
if (tables == null) return set;
|
for (int i = tables.length - 1; i >= 0; i--) {
|
||||||
for (UIDefaults table : tables) {
|
if (tables[i] != null) {
|
||||||
if (table != null) {
|
set.addAll(tables[i].entrySet());
|
||||||
set.addAll(table.entrySet());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set.addAll(super.entrySet());
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,50 +135,46 @@ class MultiUIDefaults extends UIDefaults
|
|||||||
|
|
||||||
private static class MultiUIDefaultsEnumerator implements Enumeration<Object>
|
private static class MultiUIDefaultsEnumerator implements Enumeration<Object>
|
||||||
{
|
{
|
||||||
Enumeration[] enums;
|
public static enum Type { KEYS, ELEMENTS };
|
||||||
int n = 0;
|
private Iterator<Entry<Object, Object>> iterator;
|
||||||
|
private Type type;
|
||||||
|
|
||||||
MultiUIDefaultsEnumerator(Enumeration[] enums) {
|
MultiUIDefaultsEnumerator(Type type, Set<Entry<Object, Object>> entries) {
|
||||||
this.enums = enums;
|
this.type = type;
|
||||||
|
this.iterator = entries.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMoreElements() {
|
public boolean hasMoreElements() {
|
||||||
for(int i = n; i < enums.length; i++) {
|
return iterator.hasNext();
|
||||||
Enumeration e = enums[i];
|
|
||||||
if ((e != null) && (e.hasMoreElements())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object nextElement() {
|
public Object nextElement() {
|
||||||
for(; n < enums.length; n++) {
|
switch (type) {
|
||||||
Enumeration e = enums[n];
|
case KEYS: return iterator.next().getKey();
|
||||||
if ((e != null) && (e.hasMoreElements())) {
|
case ELEMENTS: return iterator.next().getValue();
|
||||||
return e.nextElement();
|
default: return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object remove(Object key)
|
public Object remove(Object key)
|
||||||
{
|
{
|
||||||
Object value = super.remove(key);
|
Object value = null;
|
||||||
if (value != null) {
|
for (int i = tables.length - 1; i >= 0; i--) {
|
||||||
return value;
|
if (tables[i] != null) {
|
||||||
}
|
Object v = tables[i].remove(key);
|
||||||
|
if (v != null) {
|
||||||
for (UIDefaults table : tables) {
|
value = v;
|
||||||
value = (table != null) ? table.remove(key) : null;
|
}
|
||||||
if (value != null) {
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Object v = super.remove(key);
|
||||||
|
if (v != null) {
|
||||||
|
value = v;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -627,6 +627,69 @@ public class TransferHandler implements Serializable {
|
|||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* image for the {@code startDrag} method
|
||||||
|
*
|
||||||
|
* @see java.awt.dnd.DragGestureEvent#startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)
|
||||||
|
*/
|
||||||
|
private Image dragImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* anchor offset for the {@code startDrag} method
|
||||||
|
*
|
||||||
|
* @see java.awt.dnd.DragGestureEvent#startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl)
|
||||||
|
*/
|
||||||
|
private Point dragImageOffset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the drag image parameter. The image has to be prepared
|
||||||
|
* for rendering by the moment of the call. The image is stored
|
||||||
|
* by reference because of some performance reasons.
|
||||||
|
*
|
||||||
|
* @param img an image to drag
|
||||||
|
*/
|
||||||
|
public void setDragImage(Image img) {
|
||||||
|
dragImage = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the drag image. If there is no image to drag,
|
||||||
|
* the returned value is {@code null}.
|
||||||
|
*
|
||||||
|
* @return the reference to the drag image
|
||||||
|
*/
|
||||||
|
public Image getDragImage() {
|
||||||
|
return dragImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an anchor offset for the image to drag.
|
||||||
|
* It can not be {@code null}.
|
||||||
|
*
|
||||||
|
* @param p a {@code Point} object that corresponds
|
||||||
|
* to coordinates of an anchor offset of the image
|
||||||
|
* relative to the upper left corner of the image
|
||||||
|
*/
|
||||||
|
public void setDragImageOffset(Point p) {
|
||||||
|
dragImageOffset = new Point(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an anchor offset for the image to drag.
|
||||||
|
*
|
||||||
|
* @return a {@code Point} object that corresponds
|
||||||
|
* to coordinates of an anchor offset of the image
|
||||||
|
* relative to the upper left corner of the image.
|
||||||
|
* The point {@code (0,0)} returns by default.
|
||||||
|
*/
|
||||||
|
public Point getDragImageOffset() {
|
||||||
|
if (dragImageOffset == null) {
|
||||||
|
return new Point(0,0);
|
||||||
|
}
|
||||||
|
return new Point(dragImageOffset);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes the Swing drag support to be initiated. This is called by
|
* Causes the Swing drag support to be initiated. This is called by
|
||||||
* the various UI implementations in the <code>javax.swing.plaf.basic</code>
|
* the various UI implementations in the <code>javax.swing.plaf.basic</code>
|
||||||
@ -1522,7 +1585,12 @@ public class TransferHandler implements Serializable {
|
|||||||
scrolls = c.getAutoscrolls();
|
scrolls = c.getAutoscrolls();
|
||||||
c.setAutoscrolls(false);
|
c.setAutoscrolls(false);
|
||||||
try {
|
try {
|
||||||
dge.startDrag(null, t, this);
|
Image im = th.getDragImage();
|
||||||
|
if (im == null) {
|
||||||
|
dge.startDrag(null, t, this);
|
||||||
|
} else {
|
||||||
|
dge.startDrag(null, im, th.getDragImageOffset(), t, this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} catch (RuntimeException re) {
|
} catch (RuntimeException re) {
|
||||||
c.setAutoscrolls(scrolls);
|
c.setAutoscrolls(scrolls);
|
||||||
|
@ -90,6 +90,10 @@ final class ${LAF_NAME}Defaults {
|
|||||||
*/
|
*/
|
||||||
private Map<String, Region> registeredRegions =
|
private Map<String, Region> registeredRegions =
|
||||||
new HashMap<String, Region>();
|
new HashMap<String, Region>();
|
||||||
|
|
||||||
|
private Map<JComponent, Map<Region, SynthStyle>> overridesCache =
|
||||||
|
new WeakHashMap<JComponent, Map<Region, SynthStyle>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our fallback style to avoid NPEs if the proper style cannot be found in
|
* Our fallback style to avoid NPEs if the proper style cannot be found in
|
||||||
* this class. Not sure if relying on DefaultSynthStyle is the best choice.
|
* this class. Not sure if relying on DefaultSynthStyle is the best choice.
|
||||||
@ -251,7 +255,11 @@ ${UI_DEFAULT_INIT}
|
|||||||
}
|
}
|
||||||
|
|
||||||
//return the style, if found, or the default style if not found
|
//return the style, if found, or the default style if not found
|
||||||
return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp);
|
return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearOverridesCache(JComponent c) {
|
||||||
|
overridesCache.remove(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -457,15 +465,6 @@ ${UI_DEFAULT_INIT}
|
|||||||
* Cached shared style.
|
* Cached shared style.
|
||||||
*/
|
*/
|
||||||
private NimbusStyle style;
|
private NimbusStyle style;
|
||||||
/**
|
|
||||||
* A weakly referenced hash map such that if the reference JComponent
|
|
||||||
* key is garbage collected then the entry is removed from the map.
|
|
||||||
* This cache exists so that when a JComponent has nimbus overrides
|
|
||||||
* in its client map, a unique style will be created and returned
|
|
||||||
* for that JComponent instance, always. In such a situation each
|
|
||||||
* JComponent instance must have its own instance of NimbusStyle.
|
|
||||||
*/
|
|
||||||
private WeakHashMap<JComponent, WeakReference<NimbusStyle>> overridesCache;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new LazyStyle.
|
* Create a new LazyStyle.
|
||||||
@ -513,17 +512,21 @@ ${UI_DEFAULT_INIT}
|
|||||||
* Gets the style. Creates it if necessary.
|
* Gets the style. Creates it if necessary.
|
||||||
* @return the style
|
* @return the style
|
||||||
*/
|
*/
|
||||||
SynthStyle getStyle(JComponent c) {
|
SynthStyle getStyle(JComponent c, Region r) {
|
||||||
// if the component has overrides, it gets its own unique style
|
// if the component has overrides, it gets its own unique style
|
||||||
// instead of the shared style.
|
// instead of the shared style.
|
||||||
if (c.getClientProperty("Nimbus.Overrides") != null) {
|
if (c.getClientProperty("Nimbus.Overrides") != null) {
|
||||||
if (overridesCache == null)
|
Map<Region, SynthStyle> map = overridesCache.get(c);
|
||||||
overridesCache = new WeakHashMap<JComponent, WeakReference<NimbusStyle>>();
|
SynthStyle s = null;
|
||||||
WeakReference<NimbusStyle> ref = overridesCache.get(c);
|
if (map == null) {
|
||||||
NimbusStyle s = ref == null ? null : ref.get();
|
map = new HashMap<Region, SynthStyle>();
|
||||||
|
overridesCache.put(c, map);
|
||||||
|
} else {
|
||||||
|
s = map.get(r);
|
||||||
|
}
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
s = new NimbusStyle(prefix, c);
|
s = new NimbusStyle(prefix, c);
|
||||||
overridesCache.put(c, new WeakReference<NimbusStyle>(s));
|
map.put(r, s);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -280,11 +280,15 @@ public class NimbusLookAndFeel extends SynthLookAndFeel {
|
|||||||
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
|
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
|
||||||
String eName = ev.getPropertyName();
|
String eName = ev.getPropertyName();
|
||||||
|
|
||||||
// Always update when overrides or size variant change
|
// These properties affect style cached inside NimbusDefaults (6860433)
|
||||||
if ("Nimbus.Overrides" == eName ||
|
if ("name" == eName ||
|
||||||
|
"ancestor" == eName ||
|
||||||
|
"Nimbus.Overrides" == eName ||
|
||||||
"Nimbus.Overrides.InheritDefaults" == eName ||
|
"Nimbus.Overrides.InheritDefaults" == eName ||
|
||||||
"JComponent.sizeVariant" == eName) {
|
"JComponent.sizeVariant" == eName) {
|
||||||
|
|
||||||
|
JComponent c = (JComponent) ev.getSource();
|
||||||
|
defaults.clearOverridesCache(c);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,16 @@ public class SynthButtonUI extends BasicButtonUI implements
|
|||||||
// ********************************
|
// ********************************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -250,7 +259,13 @@ public class SynthButtonUI extends BasicButtonUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -264,7 +279,8 @@ public class SynthButtonUI extends BasicButtonUI implements
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
AbstractButton b = (AbstractButton)context.getComponent();
|
AbstractButton b = (AbstractButton)context.getComponent();
|
||||||
|
@ -137,7 +137,16 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -151,7 +160,13 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -166,7 +181,8 @@ public class SynthColorChooserUI extends BasicColorChooserUI implements
|
|||||||
* This implementation does not perform any actions.
|
* This implementation does not perform any actions.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,16 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements
|
|||||||
// begin ComponentUI Implementation
|
// begin ComponentUI Implementation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -319,7 +328,13 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -333,7 +348,8 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
hasFocus = comboBox.hasFocus();
|
hasFocus = comboBox.hasFocus();
|
||||||
|
@ -152,7 +152,16 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -166,7 +175,13 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -180,7 +195,8 @@ public class SynthDesktopIconUI extends BasicDesktopIconUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,16 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -453,7 +462,13 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -467,7 +482,8 @@ public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,16 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -164,7 +173,8 @@ public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
super.paint(g, getComponent());
|
super.paint(g, getComponent());
|
||||||
|
@ -194,7 +194,16 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -208,7 +217,13 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -222,7 +237,8 @@ public class SynthInternalFrameUI extends BasicInternalFrameUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -156,12 +156,16 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies this UI delegate that it's time to paint the specified
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
* component. This method is invoked by <code>JComponent</code>
|
* This method paints the component background, then calls
|
||||||
* when the specified component is being painted.
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
*/
|
*
|
||||||
/**
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
* @inheritDoc
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -175,7 +179,13 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -189,7 +199,8 @@ public class SynthLabelUI extends BasicLabelUI implements SynthUI {
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
JLabel label = (JLabel)context.getComponent();
|
JLabel label = (JLabel)context.getComponent();
|
||||||
|
@ -57,7 +57,16 @@ public class SynthListUI extends BasicListUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
|
@ -125,7 +125,16 @@ public class SynthMenuBarUI extends BasicMenuBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -139,7 +148,13 @@ public class SynthMenuBarUI extends BasicMenuBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -153,7 +168,8 @@ public class SynthMenuBarUI extends BasicMenuBarUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,16 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -240,7 +249,13 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -254,7 +269,8 @@ public class SynthMenuItemUI extends BasicMenuItemUI implements
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
SynthContext accContext = getContext(menuItem,
|
SynthContext accContext = getContext(menuItem,
|
||||||
|
@ -227,7 +227,16 @@ public class SynthMenuUI extends BasicMenuUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -241,7 +250,13 @@ public class SynthMenuUI extends BasicMenuUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -255,7 +270,8 @@ public class SynthMenuUI extends BasicMenuUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
SynthContext accContext = getContext(menuItem,
|
SynthContext accContext = getContext(menuItem,
|
||||||
|
@ -149,7 +149,16 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -163,7 +172,13 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -177,7 +192,8 @@ public class SynthOptionPaneUI extends BasicOptionPaneUI implements
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,16 @@ public class SynthPanelUI extends BasicPanelUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -150,7 +159,13 @@ public class SynthPanelUI extends BasicPanelUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -164,7 +179,8 @@ public class SynthPanelUI extends BasicPanelUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
// do actual painting
|
// do actual painting
|
||||||
|
@ -132,7 +132,16 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -146,7 +155,13 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -160,7 +175,8 @@ public class SynthPopupMenuUI extends BasicPopupMenuUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,16 @@ public class SynthProgressBarUI extends BasicProgressBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -208,7 +217,13 @@ public class SynthProgressBarUI extends BasicProgressBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -222,7 +237,8 @@ public class SynthProgressBarUI extends BasicProgressBarUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
JProgressBar pBar = (JProgressBar)context.getComponent();
|
JProgressBar pBar = (JProgressBar)context.getComponent();
|
||||||
|
@ -102,7 +102,16 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -116,7 +125,13 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -130,7 +145,8 @@ public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI {
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,16 @@ public class SynthScrollBarUI extends BasicScrollBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -237,7 +246,13 @@ public class SynthScrollBarUI extends BasicScrollBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -251,7 +266,8 @@ public class SynthScrollBarUI extends BasicScrollBarUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
SynthContext subcontext = getContext(scrollbar,
|
SynthContext subcontext = getContext(scrollbar,
|
||||||
|
@ -64,7 +64,16 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -78,7 +87,13 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -92,7 +107,8 @@ public class SynthScrollPaneUI extends BasicScrollPaneUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
Border vpBorder = scrollpane.getViewportBorder();
|
Border vpBorder = scrollpane.getViewportBorder();
|
||||||
|
@ -135,7 +135,16 @@ public class SynthSeparatorUI extends SeparatorUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -151,7 +160,13 @@ public class SynthSeparatorUI extends SeparatorUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -165,7 +180,8 @@ public class SynthSeparatorUI extends SeparatorUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
JSeparator separator = (JSeparator)context.getComponent();
|
JSeparator separator = (JSeparator)context.getComponent();
|
||||||
|
@ -788,7 +788,16 @@ public class SynthSliderUI extends BasicSliderUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -802,7 +811,13 @@ public class SynthSliderUI extends BasicSliderUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -815,7 +830,8 @@ public class SynthSliderUI extends BasicSliderUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
recalculateIfInsetsChanged();
|
recalculateIfInsetsChanged();
|
||||||
|
@ -283,7 +283,16 @@ public class SynthSpinnerUI extends BasicSpinnerUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -298,7 +307,13 @@ public class SynthSpinnerUI extends BasicSpinnerUI
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -312,7 +327,8 @@ public class SynthSpinnerUI extends BasicSpinnerUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,16 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -283,7 +292,13 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -297,7 +312,8 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
// This is done to update package private variables in
|
// This is done to update package private variables in
|
||||||
|
@ -92,8 +92,8 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
|
|||||||
private SynthStyle tabAreaStyle;
|
private SynthStyle tabAreaStyle;
|
||||||
private SynthStyle tabContentStyle;
|
private SynthStyle tabContentStyle;
|
||||||
|
|
||||||
private Rectangle textRect;
|
private Rectangle textRect = new Rectangle();
|
||||||
private Rectangle iconRect;
|
private Rectangle iconRect = new Rectangle();
|
||||||
|
|
||||||
private Rectangle tabAreaBounds = new Rectangle();
|
private Rectangle tabAreaBounds = new Rectangle();
|
||||||
|
|
||||||
@ -115,11 +115,6 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
|
|||||||
return new SynthTabbedPaneUI();
|
return new SynthTabbedPaneUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SynthTabbedPaneUI() {
|
|
||||||
textRect = new Rectangle();
|
|
||||||
iconRect = new Rectangle();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean scrollableTabLayoutEnabled() {
|
private boolean scrollableTabLayoutEnabled() {
|
||||||
return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
|
return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||||
}
|
}
|
||||||
@ -362,7 +357,16 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -409,7 +413,13 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -423,7 +433,8 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
int selectedIndex = tabPane.getSelectedIndex();
|
int selectedIndex = tabPane.getSelectedIndex();
|
||||||
|
@ -123,7 +123,16 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -137,7 +146,13 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -151,7 +166,8 @@ public class SynthTableHeaderUI extends BasicTableHeaderUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
super.paint(g, context.getComponent());
|
super.paint(g, context.getComponent());
|
||||||
|
@ -256,7 +256,16 @@ public class SynthTableUI extends BasicTableUI
|
|||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -279,7 +288,13 @@ public class SynthTableUI extends BasicTableUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -293,7 +308,8 @@ public class SynthTableUI extends BasicTableUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
Rectangle clip = g.getClipBounds();
|
Rectangle clip = g.getClipBounds();
|
||||||
|
@ -123,7 +123,16 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -140,7 +149,8 @@ public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
super.paint(g, getComponent());
|
super.paint(g, getComponent());
|
||||||
|
@ -161,7 +161,16 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -182,7 +191,8 @@ public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI {
|
|||||||
* model to potentially be updated asynchronously.
|
* model to potentially be updated asynchronously.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
super.paint(g, getComponent());
|
super.paint(g, getComponent());
|
||||||
|
@ -198,7 +198,16 @@ public class SynthToolBarUI extends BasicToolBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -213,7 +222,13 @@ public class SynthToolBarUI extends BasicToolBarUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -258,7 +273,8 @@ public class SynthToolBarUI extends BasicToolBarUI
|
|||||||
* Paints the toolbar.
|
* Paints the toolbar.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
if (handleIcon != null && toolBar.isFloatable()) {
|
if (handleIcon != null && toolBar.isFloatable()) {
|
||||||
|
@ -121,7 +121,16 @@ public class SynthToolTipUI extends BasicToolTipUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -144,7 +153,13 @@ public class SynthToolTipUI extends BasicToolTipUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -158,7 +173,8 @@ public class SynthToolTipUI extends BasicToolTipUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
JToolTip tip = (JToolTip)context.getComponent();
|
JToolTip tip = (JToolTip)context.getComponent();
|
||||||
|
@ -250,7 +250,16 @@ public class SynthTreeUI extends BasicTreeUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -273,7 +282,13 @@ public class SynthTreeUI extends BasicTreeUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -287,7 +302,8 @@ public class SynthTreeUI extends BasicTreeUI
|
|||||||
* Paints the specified component.
|
* Paints the specified component.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
paintContext = context;
|
paintContext = context;
|
||||||
|
@ -150,7 +150,16 @@ public class SynthViewportUI extends ViewportUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Notifies this UI delegate to repaint the specified component.
|
||||||
|
* This method paints the component background, then calls
|
||||||
|
* the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* <p>In general, this method does not need to be overridden by subclasses.
|
||||||
|
* All Look and Feel rendering code should reside in the {@code paint} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Graphics g, JComponent c) {
|
public void update(Graphics g, JComponent c) {
|
||||||
@ -174,7 +183,13 @@ public class SynthViewportUI extends ViewportUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Paints the specified component according to the Look and Feel.
|
||||||
|
* <p>This method is not used by Synth Look and Feel.
|
||||||
|
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
|
||||||
|
*
|
||||||
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @param c the component being painted
|
||||||
|
* @see #paint(SynthContext,Graphics)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g, JComponent c) {
|
public void paint(Graphics g, JComponent c) {
|
||||||
@ -188,7 +203,8 @@ public class SynthViewportUI extends ViewportUI
|
|||||||
* Paints the specified component. This implementation does nothing.
|
* Paints the specified component. This implementation does nothing.
|
||||||
*
|
*
|
||||||
* @param context context for the component being painted
|
* @param context context for the component being painted
|
||||||
* @param g {@code Graphics} object used for painting
|
* @param g the {@code Graphics} object used for painting
|
||||||
|
* @see #update(Graphics,JComponent)
|
||||||
*/
|
*/
|
||||||
protected void paint(SynthContext context, Graphics g) {
|
protected void paint(SynthContext context, Graphics g) {
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class ExtendedKeyCodes {
|
|||||||
*/
|
*/
|
||||||
// Keycodes declared in KeyEvent.java with corresponding Unicode values.
|
// Keycodes declared in KeyEvent.java with corresponding Unicode values.
|
||||||
private final static HashMap<Integer, Integer> regularKeyCodesMap =
|
private final static HashMap<Integer, Integer> regularKeyCodesMap =
|
||||||
new HashMap<Integer,Integer>(122, 1.0f);
|
new HashMap<Integer,Integer>(83, 1.0f);
|
||||||
|
|
||||||
// Keycodes derived from Unicode values. Here should be collected codes
|
// Keycodes derived from Unicode values. Here should be collected codes
|
||||||
// for characters appearing on the primary layer of at least one
|
// for characters appearing on the primary layer of at least one
|
||||||
@ -22,7 +22,6 @@ public class ExtendedKeyCodes {
|
|||||||
private final static HashSet<Integer> extendedKeyCodesSet =
|
private final static HashSet<Integer> extendedKeyCodesSet =
|
||||||
new HashSet<Integer>(501, 1.0f);
|
new HashSet<Integer>(501, 1.0f);
|
||||||
final public static int getExtendedKeyCodeForChar( int c ) {
|
final public static int getExtendedKeyCodeForChar( int c ) {
|
||||||
int rc = KeyEvent.VK_UNDEFINED;
|
|
||||||
int uc = Character.toUpperCase( c );
|
int uc = Character.toUpperCase( c );
|
||||||
int lc = Character.toLowerCase( c );
|
int lc = Character.toLowerCase( c );
|
||||||
if (regularKeyCodesMap.containsKey( c )) {
|
if (regularKeyCodesMap.containsKey( c )) {
|
||||||
@ -38,22 +37,25 @@ public class ExtendedKeyCodes {
|
|||||||
}else if (extendedKeyCodesSet.contains( lc )) {
|
}else if (extendedKeyCodesSet.contains( lc )) {
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
return rc;
|
return KeyEvent.VK_UNDEFINED;
|
||||||
}
|
}
|
||||||
static {
|
static {
|
||||||
regularKeyCodesMap.put(0x0a, KeyEvent.VK_ENTER);
|
|
||||||
regularKeyCodesMap.put(0x08, KeyEvent.VK_BACK_SPACE);
|
regularKeyCodesMap.put(0x08, KeyEvent.VK_BACK_SPACE);
|
||||||
regularKeyCodesMap.put(0x09, KeyEvent.VK_TAB);
|
regularKeyCodesMap.put(0x09, KeyEvent.VK_TAB);
|
||||||
|
regularKeyCodesMap.put(0x0a, KeyEvent.VK_ENTER);
|
||||||
regularKeyCodesMap.put(0x1B, KeyEvent.VK_ESCAPE);
|
regularKeyCodesMap.put(0x1B, KeyEvent.VK_ESCAPE);
|
||||||
|
regularKeyCodesMap.put(0x20AC, KeyEvent.VK_EURO_SIGN);
|
||||||
regularKeyCodesMap.put(0x20, KeyEvent.VK_SPACE);
|
regularKeyCodesMap.put(0x20, KeyEvent.VK_SPACE);
|
||||||
regularKeyCodesMap.put(0x21, KeyEvent.VK_PAGE_UP);
|
regularKeyCodesMap.put(0x21, KeyEvent.VK_EXCLAMATION_MARK);
|
||||||
regularKeyCodesMap.put(0x22, KeyEvent.VK_PAGE_DOWN);
|
regularKeyCodesMap.put(0x22, KeyEvent.VK_QUOTEDBL);
|
||||||
regularKeyCodesMap.put(0x23, KeyEvent.VK_END);
|
regularKeyCodesMap.put(0x23, KeyEvent.VK_NUMBER_SIGN);
|
||||||
regularKeyCodesMap.put(0x24, KeyEvent.VK_HOME);
|
regularKeyCodesMap.put(0x24, KeyEvent.VK_DOLLAR);
|
||||||
regularKeyCodesMap.put(0x25, KeyEvent.VK_LEFT);
|
regularKeyCodesMap.put(0x26, KeyEvent.VK_AMPERSAND);
|
||||||
regularKeyCodesMap.put(0x26, KeyEvent.VK_UP);
|
regularKeyCodesMap.put(0x27, KeyEvent.VK_QUOTE);
|
||||||
regularKeyCodesMap.put(0x27, KeyEvent.VK_RIGHT);
|
regularKeyCodesMap.put(0x28, KeyEvent.VK_LEFT_PARENTHESIS);
|
||||||
regularKeyCodesMap.put(0x28, KeyEvent.VK_DOWN);
|
regularKeyCodesMap.put(0x29, KeyEvent.VK_RIGHT_PARENTHESIS);
|
||||||
|
regularKeyCodesMap.put(0x2A, KeyEvent.VK_ASTERISK);
|
||||||
|
regularKeyCodesMap.put(0x2B, KeyEvent.VK_PLUS);
|
||||||
regularKeyCodesMap.put(0x2C, KeyEvent.VK_COMMA);
|
regularKeyCodesMap.put(0x2C, KeyEvent.VK_COMMA);
|
||||||
regularKeyCodesMap.put(0x2D, KeyEvent.VK_MINUS);
|
regularKeyCodesMap.put(0x2D, KeyEvent.VK_MINUS);
|
||||||
regularKeyCodesMap.put(0x2E, KeyEvent.VK_PERIOD);
|
regularKeyCodesMap.put(0x2E, KeyEvent.VK_PERIOD);
|
||||||
@ -68,102 +70,59 @@ public class ExtendedKeyCodes {
|
|||||||
regularKeyCodesMap.put(0x37, KeyEvent.VK_7);
|
regularKeyCodesMap.put(0x37, KeyEvent.VK_7);
|
||||||
regularKeyCodesMap.put(0x38, KeyEvent.VK_8);
|
regularKeyCodesMap.put(0x38, KeyEvent.VK_8);
|
||||||
regularKeyCodesMap.put(0x39, KeyEvent.VK_9);
|
regularKeyCodesMap.put(0x39, KeyEvent.VK_9);
|
||||||
|
regularKeyCodesMap.put(0x3A, KeyEvent.VK_COLON);
|
||||||
regularKeyCodesMap.put(0x3B, KeyEvent.VK_SEMICOLON);
|
regularKeyCodesMap.put(0x3B, KeyEvent.VK_SEMICOLON);
|
||||||
|
regularKeyCodesMap.put(0x3C, KeyEvent.VK_LESS);
|
||||||
regularKeyCodesMap.put(0x3D, KeyEvent.VK_EQUALS);
|
regularKeyCodesMap.put(0x3D, KeyEvent.VK_EQUALS);
|
||||||
|
regularKeyCodesMap.put(0x3E, KeyEvent.VK_GREATER);
|
||||||
|
regularKeyCodesMap.put(0x40, KeyEvent.VK_AT);
|
||||||
regularKeyCodesMap.put(0x41, KeyEvent.VK_A);
|
regularKeyCodesMap.put(0x41, KeyEvent.VK_A);
|
||||||
regularKeyCodesMap.put(0x61, KeyEvent.VK_A);
|
|
||||||
regularKeyCodesMap.put(0x42, KeyEvent.VK_B);
|
regularKeyCodesMap.put(0x42, KeyEvent.VK_B);
|
||||||
regularKeyCodesMap.put(0x62, KeyEvent.VK_B);
|
|
||||||
regularKeyCodesMap.put(0x43, KeyEvent.VK_C);
|
regularKeyCodesMap.put(0x43, KeyEvent.VK_C);
|
||||||
regularKeyCodesMap.put(0x63, KeyEvent.VK_C);
|
|
||||||
regularKeyCodesMap.put(0x44, KeyEvent.VK_D);
|
regularKeyCodesMap.put(0x44, KeyEvent.VK_D);
|
||||||
regularKeyCodesMap.put(0x64, KeyEvent.VK_D);
|
|
||||||
regularKeyCodesMap.put(0x45, KeyEvent.VK_E);
|
regularKeyCodesMap.put(0x45, KeyEvent.VK_E);
|
||||||
regularKeyCodesMap.put(0x65, KeyEvent.VK_E);
|
|
||||||
regularKeyCodesMap.put(0x46, KeyEvent.VK_F);
|
regularKeyCodesMap.put(0x46, KeyEvent.VK_F);
|
||||||
regularKeyCodesMap.put(0x66, KeyEvent.VK_F);
|
|
||||||
regularKeyCodesMap.put(0x47, KeyEvent.VK_G);
|
regularKeyCodesMap.put(0x47, KeyEvent.VK_G);
|
||||||
regularKeyCodesMap.put(0x67, KeyEvent.VK_G);
|
|
||||||
regularKeyCodesMap.put(0x48, KeyEvent.VK_H);
|
regularKeyCodesMap.put(0x48, KeyEvent.VK_H);
|
||||||
regularKeyCodesMap.put(0x68, KeyEvent.VK_H);
|
|
||||||
regularKeyCodesMap.put(0x49, KeyEvent.VK_I);
|
regularKeyCodesMap.put(0x49, KeyEvent.VK_I);
|
||||||
regularKeyCodesMap.put(0x69, KeyEvent.VK_I);
|
|
||||||
regularKeyCodesMap.put(0x4A, KeyEvent.VK_J);
|
regularKeyCodesMap.put(0x4A, KeyEvent.VK_J);
|
||||||
regularKeyCodesMap.put(0x6A, KeyEvent.VK_J);
|
|
||||||
regularKeyCodesMap.put(0x4B, KeyEvent.VK_K);
|
regularKeyCodesMap.put(0x4B, KeyEvent.VK_K);
|
||||||
regularKeyCodesMap.put(0x6B, KeyEvent.VK_K);
|
|
||||||
regularKeyCodesMap.put(0x4C, KeyEvent.VK_L);
|
regularKeyCodesMap.put(0x4C, KeyEvent.VK_L);
|
||||||
regularKeyCodesMap.put(0x6C, KeyEvent.VK_L);
|
|
||||||
regularKeyCodesMap.put(0x4D, KeyEvent.VK_M);
|
regularKeyCodesMap.put(0x4D, KeyEvent.VK_M);
|
||||||
regularKeyCodesMap.put(0x6D, KeyEvent.VK_M);
|
|
||||||
regularKeyCodesMap.put(0x4E, KeyEvent.VK_N);
|
regularKeyCodesMap.put(0x4E, KeyEvent.VK_N);
|
||||||
regularKeyCodesMap.put(0x6E, KeyEvent.VK_N);
|
|
||||||
regularKeyCodesMap.put(0x4F, KeyEvent.VK_O);
|
regularKeyCodesMap.put(0x4F, KeyEvent.VK_O);
|
||||||
regularKeyCodesMap.put(0x6F, KeyEvent.VK_O);
|
|
||||||
regularKeyCodesMap.put(0x50, KeyEvent.VK_P);
|
regularKeyCodesMap.put(0x50, KeyEvent.VK_P);
|
||||||
regularKeyCodesMap.put(0x70, KeyEvent.VK_P);
|
|
||||||
regularKeyCodesMap.put(0x51, KeyEvent.VK_Q);
|
regularKeyCodesMap.put(0x51, KeyEvent.VK_Q);
|
||||||
regularKeyCodesMap.put(0x71, KeyEvent.VK_Q);
|
|
||||||
regularKeyCodesMap.put(0x52, KeyEvent.VK_R);
|
regularKeyCodesMap.put(0x52, KeyEvent.VK_R);
|
||||||
regularKeyCodesMap.put(0x72, KeyEvent.VK_R);
|
|
||||||
regularKeyCodesMap.put(0x53, KeyEvent.VK_S);
|
regularKeyCodesMap.put(0x53, KeyEvent.VK_S);
|
||||||
regularKeyCodesMap.put(0x73, KeyEvent.VK_S);
|
|
||||||
regularKeyCodesMap.put(0x54, KeyEvent.VK_T);
|
regularKeyCodesMap.put(0x54, KeyEvent.VK_T);
|
||||||
regularKeyCodesMap.put(0x74, KeyEvent.VK_T);
|
|
||||||
regularKeyCodesMap.put(0x55, KeyEvent.VK_U);
|
regularKeyCodesMap.put(0x55, KeyEvent.VK_U);
|
||||||
regularKeyCodesMap.put(0x75, KeyEvent.VK_U);
|
|
||||||
regularKeyCodesMap.put(0x56, KeyEvent.VK_V);
|
regularKeyCodesMap.put(0x56, KeyEvent.VK_V);
|
||||||
regularKeyCodesMap.put(0x76, KeyEvent.VK_V);
|
|
||||||
regularKeyCodesMap.put(0x57, KeyEvent.VK_W);
|
regularKeyCodesMap.put(0x57, KeyEvent.VK_W);
|
||||||
regularKeyCodesMap.put(0x77, KeyEvent.VK_W);
|
|
||||||
regularKeyCodesMap.put(0x58, KeyEvent.VK_X);
|
regularKeyCodesMap.put(0x58, KeyEvent.VK_X);
|
||||||
regularKeyCodesMap.put(0x78, KeyEvent.VK_X);
|
|
||||||
regularKeyCodesMap.put(0x59, KeyEvent.VK_Y);
|
regularKeyCodesMap.put(0x59, KeyEvent.VK_Y);
|
||||||
regularKeyCodesMap.put(0x79, KeyEvent.VK_Y);
|
|
||||||
regularKeyCodesMap.put(0x5A, KeyEvent.VK_Z);
|
regularKeyCodesMap.put(0x5A, KeyEvent.VK_Z);
|
||||||
regularKeyCodesMap.put(0x7A, KeyEvent.VK_Z);
|
|
||||||
regularKeyCodesMap.put(0x5B, KeyEvent.VK_OPEN_BRACKET);
|
regularKeyCodesMap.put(0x5B, KeyEvent.VK_OPEN_BRACKET);
|
||||||
regularKeyCodesMap.put(0x5C, KeyEvent.VK_BACK_SLASH);
|
regularKeyCodesMap.put(0x5C, KeyEvent.VK_BACK_SLASH);
|
||||||
regularKeyCodesMap.put(0x5D, KeyEvent.VK_CLOSE_BRACKET);
|
regularKeyCodesMap.put(0x5D, KeyEvent.VK_CLOSE_BRACKET);
|
||||||
// regularKeyCodesMap.put(0x60, KeyEvent.VK_NUMPAD0);
|
regularKeyCodesMap.put(0x5E, KeyEvent.VK_CIRCUMFLEX);
|
||||||
// regularKeyCodesMap.put(0x61, KeyEvent.VK_NUMPAD1);
|
regularKeyCodesMap.put(0x5F, KeyEvent.VK_UNDERSCORE);
|
||||||
// regularKeyCodesMap.put(0x62, KeyEvent.VK_NUMPAD2);
|
regularKeyCodesMap.put(0x60, KeyEvent.VK_BACK_QUOTE);
|
||||||
// regularKeyCodesMap.put(0x63, KeyEvent.VK_NUMPAD3);
|
regularKeyCodesMap.put(0x70, KeyEvent.VK_P);
|
||||||
// regularKeyCodesMap.put(0x64, KeyEvent.VK_NUMPAD4);
|
regularKeyCodesMap.put(0x71, KeyEvent.VK_Q);
|
||||||
// regularKeyCodesMap.put(0x65, KeyEvent.VK_NUMPAD5);
|
regularKeyCodesMap.put(0x72, KeyEvent.VK_R);
|
||||||
// regularKeyCodesMap.put(0x66, KeyEvent.VK_NUMPAD6);
|
regularKeyCodesMap.put(0x73, KeyEvent.VK_S);
|
||||||
// regularKeyCodesMap.put(0x67, KeyEvent.VK_NUMPAD7);
|
regularKeyCodesMap.put(0x74, KeyEvent.VK_T);
|
||||||
// regularKeyCodesMap.put(0x68, KeyEvent.VK_NUMPAD8);
|
regularKeyCodesMap.put(0x75, KeyEvent.VK_U);
|
||||||
// regularKeyCodesMap.put(0x69, KeyEvent.VK_NUMPAD9);
|
regularKeyCodesMap.put(0x76, KeyEvent.VK_V);
|
||||||
regularKeyCodesMap.put(0x6A, KeyEvent.VK_MULTIPLY);
|
regularKeyCodesMap.put(0x77, KeyEvent.VK_W);
|
||||||
regularKeyCodesMap.put(0x6B, KeyEvent.VK_ADD);
|
regularKeyCodesMap.put(0x78, KeyEvent.VK_X);
|
||||||
regularKeyCodesMap.put(0x6C, KeyEvent.VK_SEPARATER);
|
regularKeyCodesMap.put(0x79, KeyEvent.VK_Y);
|
||||||
regularKeyCodesMap.put(0x6D, KeyEvent.VK_SUBTRACT);
|
regularKeyCodesMap.put(0x7A, KeyEvent.VK_Z);
|
||||||
regularKeyCodesMap.put(0x6E, KeyEvent.VK_DECIMAL);
|
|
||||||
regularKeyCodesMap.put(0x6F, KeyEvent.VK_DIVIDE);
|
|
||||||
regularKeyCodesMap.put(0x7F, KeyEvent.VK_DELETE);
|
|
||||||
regularKeyCodesMap.put(0xC0, KeyEvent.VK_BACK_QUOTE);
|
|
||||||
regularKeyCodesMap.put(0xDE, KeyEvent.VK_QUOTE);
|
|
||||||
regularKeyCodesMap.put(0x26, KeyEvent.VK_AMPERSAND);
|
|
||||||
regularKeyCodesMap.put(0x2A, KeyEvent.VK_ASTERISK);
|
|
||||||
regularKeyCodesMap.put(0x22, KeyEvent.VK_QUOTEDBL);
|
|
||||||
regularKeyCodesMap.put(0x3C, KeyEvent.VK_LESS);
|
|
||||||
regularKeyCodesMap.put(0x3E, KeyEvent.VK_GREATER);
|
|
||||||
regularKeyCodesMap.put(0x7B, KeyEvent.VK_BRACELEFT);
|
regularKeyCodesMap.put(0x7B, KeyEvent.VK_BRACELEFT);
|
||||||
regularKeyCodesMap.put(0x7D, KeyEvent.VK_BRACERIGHT);
|
regularKeyCodesMap.put(0x7D, KeyEvent.VK_BRACERIGHT);
|
||||||
regularKeyCodesMap.put(0x40, KeyEvent.VK_AT);
|
regularKeyCodesMap.put(0x7F, KeyEvent.VK_DELETE);
|
||||||
regularKeyCodesMap.put(0x3A, KeyEvent.VK_COLON);
|
|
||||||
regularKeyCodesMap.put(0x5E, KeyEvent.VK_CIRCUMFLEX);
|
|
||||||
regularKeyCodesMap.put(0x24, KeyEvent.VK_DOLLAR);
|
|
||||||
regularKeyCodesMap.put(0x20AC, KeyEvent.VK_EURO_SIGN);
|
|
||||||
regularKeyCodesMap.put(0x21, KeyEvent.VK_EXCLAMATION_MARK);
|
|
||||||
regularKeyCodesMap.put(0xA1, KeyEvent.VK_INVERTED_EXCLAMATION_MARK);
|
regularKeyCodesMap.put(0xA1, KeyEvent.VK_INVERTED_EXCLAMATION_MARK);
|
||||||
regularKeyCodesMap.put(0x28, KeyEvent.VK_LEFT_PARENTHESIS);
|
|
||||||
regularKeyCodesMap.put(0x23, KeyEvent.VK_NUMBER_SIGN);
|
|
||||||
regularKeyCodesMap.put(0x2B, KeyEvent.VK_PLUS);
|
|
||||||
regularKeyCodesMap.put(0x29, KeyEvent.VK_RIGHT_PARENTHESIS);
|
|
||||||
regularKeyCodesMap.put(0x5F, KeyEvent.VK_UNDERSCORE);
|
|
||||||
|
|
||||||
|
|
||||||
extendedKeyCodesSet.add(0x01000000+0x0060);
|
extendedKeyCodesSet.add(0x01000000+0x0060);
|
||||||
extendedKeyCodesSet.add(0x01000000+0x007C);
|
extendedKeyCodesSet.add(0x01000000+0x007C);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -67,6 +67,8 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
|
|||||||
private DragGestureEvent trigger;
|
private DragGestureEvent trigger;
|
||||||
private Component component;
|
private Component component;
|
||||||
private Cursor cursor;
|
private Cursor cursor;
|
||||||
|
private Image dragImage;
|
||||||
|
private Point dragImageOffset;
|
||||||
private long nativeCtxt;
|
private long nativeCtxt;
|
||||||
private DragSourceContext dragSourceContext;
|
private DragSourceContext dragSourceContext;
|
||||||
private int sourceActions;
|
private int sourceActions;
|
||||||
@ -120,6 +122,8 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
|
|||||||
dragSourceContext = dsc;
|
dragSourceContext = dsc;
|
||||||
cursor = c;
|
cursor = c;
|
||||||
sourceActions = getDragSourceContext().getSourceActions();
|
sourceActions = getDragSourceContext().getSourceActions();
|
||||||
|
dragImage = di;
|
||||||
|
dragImageOffset = p;
|
||||||
|
|
||||||
Transferable transferable = getDragSourceContext().getTransferable();
|
Transferable transferable = getDragSourceContext().getTransferable();
|
||||||
SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
|
SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
|
||||||
@ -168,6 +172,31 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
|
|||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the drag image. If there is no image to drag,
|
||||||
|
* the returned value is {@code null}
|
||||||
|
*
|
||||||
|
* @return the reference to the drag image
|
||||||
|
*/
|
||||||
|
public Image getDragImage() {
|
||||||
|
return dragImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an anchor offset for the image to drag.
|
||||||
|
*
|
||||||
|
* @return a {@code Point} object that corresponds
|
||||||
|
* to coordinates of an anchor offset of the image
|
||||||
|
* relative to the upper left corner of the image.
|
||||||
|
* The point {@code (0,0)} returns by default.
|
||||||
|
*/
|
||||||
|
public Point getDragImageOffset() {
|
||||||
|
if (dragImageOffset == null) {
|
||||||
|
return new Point(0,0);
|
||||||
|
}
|
||||||
|
return new Point(dragImageOffset);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* downcall into native code
|
* downcall into native code
|
||||||
*/
|
*/
|
||||||
@ -317,6 +346,8 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
|
|||||||
|
|
||||||
startSecondaryEventLoop();
|
startSecondaryEventLoop();
|
||||||
setNativeContext(0);
|
setNativeContext(0);
|
||||||
|
dragImage = null;
|
||||||
|
dragImageOffset = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDragDropInProgress(boolean b)
|
public static void setDragDropInProgress(boolean b)
|
||||||
|
@ -68,38 +68,34 @@ public final class FontManagerFactory {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
String fmClassName = AccessController.doPrivileged(
|
AccessController.doPrivileged(new PrivilegedAction() {
|
||||||
new GetPropertyAction("sun.font.fontmanager",
|
|
||||||
DEFAULT_CLASS));
|
|
||||||
|
|
||||||
try {
|
public Object run() {
|
||||||
@SuppressWarnings("unchecked")
|
try {
|
||||||
ClassLoader cl = (ClassLoader)
|
String fmClassName =
|
||||||
AccessController.doPrivileged(new PrivilegedAction() {
|
System.getProperty("sun.font.fontmanager",
|
||||||
public Object run() {
|
DEFAULT_CLASS);
|
||||||
return ClassLoader.getSystemClassLoader();
|
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||||
}
|
Class fmClass = Class.forName(fmClassName, true, cl);
|
||||||
});
|
instance = (FontManager) fmClass.newInstance();
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
InternalError err = new InternalError();
|
||||||
|
err.initCause(ex);
|
||||||
|
throw err;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
} catch (InstantiationException ex) {
|
||||||
Class fmClass = Class.forName(fmClassName, true, cl);
|
InternalError err = new InternalError();
|
||||||
instance = (FontManager) fmClass.newInstance();
|
err.initCause(ex);
|
||||||
|
throw err;
|
||||||
|
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (IllegalAccessException ex) {
|
||||||
InternalError err = new InternalError();
|
InternalError err = new InternalError();
|
||||||
err.initCause(ex);
|
err.initCause(ex);
|
||||||
throw err;
|
throw err;
|
||||||
|
}
|
||||||
} catch (InstantiationException ex) {
|
return null;
|
||||||
InternalError err = new InternalError();
|
}
|
||||||
err.initCause(ex);
|
});
|
||||||
throw err;
|
|
||||||
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
InternalError err = new InternalError();
|
|
||||||
err.initCause(ex);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ import java.io.FileInputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
|
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
import javax.swing.plaf.FontUIResource;
|
import javax.swing.plaf.FontUIResource;
|
||||||
|
|
||||||
import sun.security.action.GetPropertyAction;
|
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,79 +42,82 @@ import sun.util.logging.PlatformLogger;
|
|||||||
*/
|
*/
|
||||||
public final class FontUtilities {
|
public final class FontUtilities {
|
||||||
|
|
||||||
public static final boolean isSolaris;
|
public static boolean isSolaris;
|
||||||
|
|
||||||
public static final boolean isLinux;
|
public static boolean isLinux;
|
||||||
|
|
||||||
public static final boolean isSolaris8;
|
public static boolean isSolaris8;
|
||||||
|
|
||||||
public static final boolean isSolaris9;
|
public static boolean isSolaris9;
|
||||||
|
|
||||||
public static final boolean isOpenSolaris;
|
public static boolean isOpenSolaris;
|
||||||
|
|
||||||
public static final boolean useT2K;
|
public static boolean useT2K;
|
||||||
|
|
||||||
public static final boolean isWindows;
|
public static boolean isWindows;
|
||||||
|
|
||||||
public static final boolean isOpenJDK;
|
public static boolean isOpenJDK;
|
||||||
|
|
||||||
static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
|
static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
|
||||||
|
|
||||||
// This static initializer block figures out the OS constants.
|
// This static initializer block figures out the OS constants.
|
||||||
static {
|
static {
|
||||||
|
|
||||||
String osName = AccessController.doPrivileged(
|
AccessController.doPrivileged(new PrivilegedAction () {
|
||||||
new GetPropertyAction("os.name", "unknownOS"));
|
public Object run() {
|
||||||
isSolaris = osName.startsWith("SunOS");
|
String osName = System.getProperty("os.name", "unknownOS");
|
||||||
|
isSolaris = osName.startsWith("SunOS");
|
||||||
|
|
||||||
isLinux = osName.startsWith("Linux");
|
isLinux = osName.startsWith("Linux");
|
||||||
|
|
||||||
String t2kStr = AccessController.doPrivileged(
|
String t2kStr = System.getProperty("sun.java2d.font.scaler");
|
||||||
new GetPropertyAction("sun.java2d.font.scaler"));
|
if (t2kStr != null) {
|
||||||
if (t2kStr != null) {
|
useT2K = "t2k".equals(t2kStr);
|
||||||
useT2K = "t2k".equals(t2kStr);
|
|
||||||
} else {
|
|
||||||
useT2K = false;
|
|
||||||
}
|
|
||||||
if (isSolaris) {
|
|
||||||
String version = AccessController.doPrivileged(
|
|
||||||
new GetPropertyAction("os.version", "0.0"));
|
|
||||||
isSolaris8 = version.startsWith("5.8");
|
|
||||||
isSolaris9 = version.startsWith("5.9");
|
|
||||||
float ver = Float.parseFloat(version);
|
|
||||||
if (ver > 5.10f) {
|
|
||||||
File f = new File("/etc/release");
|
|
||||||
String line = null;
|
|
||||||
try {
|
|
||||||
FileInputStream fis = new FileInputStream(f);
|
|
||||||
InputStreamReader isr = new InputStreamReader(
|
|
||||||
fis, "ISO-8859-1");
|
|
||||||
BufferedReader br = new BufferedReader(isr);
|
|
||||||
line = br.readLine();
|
|
||||||
fis.close();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// Nothing to do here.
|
|
||||||
}
|
|
||||||
if (line != null && line.indexOf("OpenSolaris") >= 0) {
|
|
||||||
isOpenSolaris = true;
|
|
||||||
} else {
|
} else {
|
||||||
|
useT2K = false;
|
||||||
|
}
|
||||||
|
if (isSolaris) {
|
||||||
|
String version = System.getProperty("os.version", "0.0");
|
||||||
|
isSolaris8 = version.startsWith("5.8");
|
||||||
|
isSolaris9 = version.startsWith("5.9");
|
||||||
|
float ver = Float.parseFloat(version);
|
||||||
|
if (ver > 5.10f) {
|
||||||
|
File f = new File("/etc/release");
|
||||||
|
String line = null;
|
||||||
|
try {
|
||||||
|
FileInputStream fis = new FileInputStream(f);
|
||||||
|
InputStreamReader isr = new InputStreamReader(
|
||||||
|
fis, "ISO-8859-1");
|
||||||
|
BufferedReader br = new BufferedReader(isr);
|
||||||
|
line = br.readLine();
|
||||||
|
fis.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// Nothing to do here.
|
||||||
|
}
|
||||||
|
if (line != null && line.indexOf("OpenSolaris") >= 0) {
|
||||||
|
isOpenSolaris = true;
|
||||||
|
} else {
|
||||||
|
isOpenSolaris = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isOpenSolaris = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isSolaris8 = false;
|
||||||
|
isSolaris9 = false;
|
||||||
isOpenSolaris = false;
|
isOpenSolaris = false;
|
||||||
}
|
}
|
||||||
} else {
|
isWindows = osName.startsWith("Windows");
|
||||||
isOpenSolaris= false;
|
String jreLibDirName = System.getProperty("java.home", "")
|
||||||
|
+ File.separator + "lib";
|
||||||
|
String jreFontDirName =
|
||||||
|
jreLibDirName + File.separator + "fonts";
|
||||||
|
File lucidaFile = new File(jreFontDirName + File.separator
|
||||||
|
+ LUCIDA_FILE_NAME);
|
||||||
|
isOpenJDK = !lucidaFile.exists();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
isSolaris8 = false;
|
|
||||||
isSolaris9 = false;
|
|
||||||
isOpenSolaris = false;
|
|
||||||
}
|
|
||||||
isWindows = osName.startsWith("Windows");
|
|
||||||
String jreLibDirName = AccessController.doPrivileged(
|
|
||||||
new GetPropertyAction("java.home","")) + File.separator + "lib";
|
|
||||||
String jreFontDirName = jreLibDirName + File.separator + "fonts";
|
|
||||||
File lucidaFile =
|
|
||||||
new File(jreFontDirName + File.separator + LUCIDA_FILE_NAME);
|
|
||||||
isOpenJDK = !lucidaFile.exists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +113,7 @@ public class ByteToCharUTF8 extends ByteToCharConverter {
|
|||||||
savedSize = 1;
|
savedSize = 1;
|
||||||
} else {
|
} else {
|
||||||
savedSize = 2;
|
savedSize = 2;
|
||||||
savedBytes[1] = (byte)input[byteOff++];
|
savedBytes[1] = input[byteOff++];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -135,11 +135,11 @@ public class ByteToCharUTF8 extends ByteToCharConverter {
|
|||||||
savedSize = 1;
|
savedSize = 1;
|
||||||
} else if (byteOff + 1 >= inEnd) {
|
} else if (byteOff + 1 >= inEnd) {
|
||||||
savedSize = 2;
|
savedSize = 2;
|
||||||
savedBytes[1] = (byte)input[byteOff++];
|
savedBytes[1] = input[byteOff++];
|
||||||
} else {
|
} else {
|
||||||
savedSize = 3;
|
savedSize = 3;
|
||||||
savedBytes[1] = (byte)input[byteOff++];
|
savedBytes[1] = input[byteOff++];
|
||||||
savedBytes[2] = (byte)input[byteOff++];
|
savedBytes[2] = input[byteOff++];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -154,10 +154,10 @@ public class ByteToCharUTF8 extends ByteToCharConverter {
|
|||||||
throw new MalformedInputException();
|
throw new MalformedInputException();
|
||||||
}
|
}
|
||||||
// this byte sequence is UTF16 character
|
// this byte sequence is UTF16 character
|
||||||
int ucs4 = (int)(0x07 & byte1) << 18 |
|
int ucs4 = (0x07 & byte1) << 18 |
|
||||||
(int)(0x3f & byte2) << 12 |
|
(0x3f & byte2) << 12 |
|
||||||
(int)(0x3f & byte3) << 6 |
|
(0x3f & byte3) << 6 |
|
||||||
(int)(0x3f & byte4);
|
(0x3f & byte4);
|
||||||
outputChar[0] = (char)((ucs4 - 0x10000) / 0x400 + 0xd800);
|
outputChar[0] = (char)((ucs4 - 0x10000) / 0x400 + 0xd800);
|
||||||
outputChar[1] = (char)((ucs4 - 0x10000) % 0x400 + 0xdc00);
|
outputChar[1] = (char)((ucs4 - 0x10000) % 0x400 + 0xdc00);
|
||||||
outputSize = 2;
|
outputSize = 2;
|
||||||
|
@ -46,7 +46,7 @@ public class CharToByteUnicode extends CharToByteConverter {
|
|||||||
protected int byteOrder = UNKNOWN;
|
protected int byteOrder = UNKNOWN;
|
||||||
|
|
||||||
public CharToByteUnicode() {
|
public CharToByteUnicode() {
|
||||||
String enc = (String) java.security.AccessController.doPrivileged(
|
String enc = java.security.AccessController.doPrivileged(
|
||||||
new sun.security.action.GetPropertyAction("sun.io.unicode.encoding",
|
new sun.security.action.GetPropertyAction("sun.io.unicode.encoding",
|
||||||
"UnicodeBig"));
|
"UnicodeBig"));
|
||||||
if (enc.equals("UnicodeBig"))
|
if (enc.equals("UnicodeBig"))
|
||||||
|
@ -50,11 +50,11 @@ public class CharacterEncoding {
|
|||||||
|
|
||||||
private static boolean sjisIsMS932;
|
private static boolean sjisIsMS932;
|
||||||
|
|
||||||
private static Map aliasTable;
|
private static Map<String,String> aliasTable;
|
||||||
private static volatile boolean installedAll;
|
private static volatile boolean installedAll;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
aliasTable = new HashMap(460, 1.0f); /* MDA */
|
aliasTable = new HashMap<>(460, 1.0f); /* MDA */
|
||||||
|
|
||||||
aliasTable.put("us-ascii", "ASCII");
|
aliasTable.put("us-ascii", "ASCII");
|
||||||
aliasTable.put("ascii", "ASCII");
|
aliasTable.put("ascii", "ASCII");
|
||||||
@ -119,11 +119,11 @@ public class CharacterEncoding {
|
|||||||
}
|
}
|
||||||
// need to use Locale.US so we can load ISO converters in tr_TR locale
|
// need to use Locale.US so we can load ISO converters in tr_TR locale
|
||||||
String lower = name.toLowerCase(Locale.US);
|
String lower = name.toLowerCase(Locale.US);
|
||||||
String val = (String) aliasTable.get(lower);
|
String val = aliasTable.get(lower);
|
||||||
|
|
||||||
if (val == null && !installedAll) {
|
if (val == null && !installedAll) {
|
||||||
installAll();
|
installAll();
|
||||||
val = (String) aliasTable.get(lower);
|
val = aliasTable.get(lower);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ public class CharacterEncoding {
|
|||||||
private static synchronized void installAll() {
|
private static synchronized void installAll() {
|
||||||
if (!installedAll) {
|
if (!installedAll) {
|
||||||
GetPropertyAction a = new GetPropertyAction("sun.nio.cs.map");
|
GetPropertyAction a = new GetPropertyAction("sun.nio.cs.map");
|
||||||
String map = ((String)AccessController.doPrivileged(a));
|
String map = AccessController.doPrivileged(a);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
sjisIsMS932 = map.equalsIgnoreCase("Windows-31J/Shift_JIS");
|
sjisIsMS932 = map.equalsIgnoreCase("Windows-31J/Shift_JIS");
|
||||||
} else {
|
} else {
|
||||||
@ -857,9 +857,9 @@ public class CharacterEncoding {
|
|||||||
* Auto Detect converter.
|
* Auto Detect converter.
|
||||||
*/
|
*/
|
||||||
static String getSJISName() {
|
static String getSJISName() {
|
||||||
String encodeName = (String) AccessController.doPrivileged(
|
String encodeName = AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction<String>() {
|
||||||
public Object run() {
|
public String run() {
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
if (osName.equals("Solaris") || osName.equals("SunOS")){
|
if (osName.equals("Solaris") || osName.equals("SunOS")){
|
||||||
return "PCK";
|
return "PCK";
|
||||||
@ -880,9 +880,9 @@ public class CharacterEncoding {
|
|||||||
|
|
||||||
|
|
||||||
static String getEUCJPName() {
|
static String getEUCJPName() {
|
||||||
String encodeName = (String) AccessController.doPrivileged(
|
String encodeName = AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction<String>() {
|
||||||
public Object run() {
|
public String run() {
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
if (osName.equals("Solaris") || osName.equals("SunOS"))
|
if (osName.equals("Solaris") || osName.equals("SunOS"))
|
||||||
return "eucJP-open";
|
return "eucJP-open";
|
||||||
|
@ -85,10 +85,11 @@ public class Converters {
|
|||||||
* this code can be involved in the startup sequence it's important to keep
|
* this code can be involved in the startup sequence it's important to keep
|
||||||
* the footprint down.
|
* the footprint down.
|
||||||
*/
|
*/
|
||||||
private static SoftReference[][] classCache
|
@SuppressWarnings("unchecked")
|
||||||
= new SoftReference[][] {
|
private static SoftReference<Object[]>[][] classCache
|
||||||
new SoftReference[CACHE_SIZE],
|
= (SoftReference<Object[]>[][]) new SoftReference<?>[][] {
|
||||||
new SoftReference[CACHE_SIZE]
|
new SoftReference<?>[CACHE_SIZE],
|
||||||
|
new SoftReference<?>[CACHE_SIZE]
|
||||||
};
|
};
|
||||||
|
|
||||||
private static void moveToFront(Object[] oa, int i) {
|
private static void moveToFront(Object[] oa, int i) {
|
||||||
@ -98,28 +99,28 @@ public class Converters {
|
|||||||
oa[0] = ob;
|
oa[0] = ob;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Class cache(int type, Object encoding) {
|
private static Class<?> cache(int type, Object encoding) {
|
||||||
SoftReference[] srs = classCache[type];
|
SoftReference<Object[]>[] srs = classCache[type];
|
||||||
for (int i = 0; i < CACHE_SIZE; i++) {
|
for (int i = 0; i < CACHE_SIZE; i++) {
|
||||||
SoftReference sr = srs[i];
|
SoftReference<Object[]> sr = srs[i];
|
||||||
if (sr == null)
|
if (sr == null)
|
||||||
continue;
|
continue;
|
||||||
Object[] oa = (Object[])sr.get();
|
Object[] oa = sr.get();
|
||||||
if (oa == null) {
|
if (oa == null) {
|
||||||
srs[i] = null;
|
srs[i] = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (oa[1].equals(encoding)) {
|
if (oa[1].equals(encoding)) {
|
||||||
moveToFront(srs, i);
|
moveToFront(srs, i);
|
||||||
return (Class)oa[0];
|
return (Class<?>)oa[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Class cache(int type, Object encoding, Class c) {
|
private static Class<?> cache(int type, Object encoding, Class<?> c) {
|
||||||
SoftReference[] srs = classCache[type];
|
SoftReference<Object[]>[] srs = classCache[type];
|
||||||
srs[CACHE_SIZE - 1] = new SoftReference(new Object[] { c, encoding });
|
srs[CACHE_SIZE - 1] = new SoftReference<Object[]>(new Object[] { c, encoding });
|
||||||
moveToFront(srs, CACHE_SIZE - 1);
|
moveToFront(srs, CACHE_SIZE - 1);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -129,12 +130,12 @@ public class Converters {
|
|||||||
*/
|
*/
|
||||||
public static boolean isCached(int type, String encoding) {
|
public static boolean isCached(int type, String encoding) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
SoftReference[] srs = classCache[type];
|
SoftReference<Object[]>[] srs = classCache[type];
|
||||||
for (int i = 0; i < CACHE_SIZE; i++) {
|
for (int i = 0; i < CACHE_SIZE; i++) {
|
||||||
SoftReference sr = srs[i];
|
SoftReference<Object[]> sr = srs[i];
|
||||||
if (sr == null)
|
if (sr == null)
|
||||||
continue;
|
continue;
|
||||||
Object[] oa = (Object[])sr.get();
|
Object[] oa = sr.get();
|
||||||
if (oa == null) {
|
if (oa == null) {
|
||||||
srs[i] = null;
|
srs[i] = null;
|
||||||
continue;
|
continue;
|
||||||
@ -152,9 +153,9 @@ public class Converters {
|
|||||||
private static String getConverterPackageName() {
|
private static String getConverterPackageName() {
|
||||||
String cp = converterPackageName;
|
String cp = converterPackageName;
|
||||||
if (cp != null) return cp;
|
if (cp != null) return cp;
|
||||||
java.security.PrivilegedAction pa =
|
java.security.PrivilegedAction<String> pa =
|
||||||
new sun.security.action.GetPropertyAction("file.encoding.pkg");
|
new sun.security.action.GetPropertyAction("file.encoding.pkg");
|
||||||
cp = (String)java.security.AccessController.doPrivileged(pa);
|
cp = java.security.AccessController.doPrivileged(pa);
|
||||||
if (cp != null) {
|
if (cp != null) {
|
||||||
/* Property is set, so take it as the true converter package */
|
/* Property is set, so take it as the true converter package */
|
||||||
converterPackageName = cp;
|
converterPackageName = cp;
|
||||||
@ -168,9 +169,9 @@ public class Converters {
|
|||||||
public static String getDefaultEncodingName() {
|
public static String getDefaultEncodingName() {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (defaultEncoding == null) {
|
if (defaultEncoding == null) {
|
||||||
java.security.PrivilegedAction pa =
|
java.security.PrivilegedAction<String> pa =
|
||||||
new sun.security.action.GetPropertyAction("file.encoding");
|
new sun.security.action.GetPropertyAction("file.encoding");
|
||||||
defaultEncoding = (String)java.security.AccessController.doPrivileged(pa);
|
defaultEncoding = java.security.AccessController.doPrivileged(pa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultEncoding;
|
return defaultEncoding;
|
||||||
@ -194,7 +195,7 @@ public class Converters {
|
|||||||
* encoding, or throw an UnsupportedEncodingException if no such class can
|
* encoding, or throw an UnsupportedEncodingException if no such class can
|
||||||
* be found
|
* be found
|
||||||
*/
|
*/
|
||||||
private static Class getConverterClass(int type, String encoding)
|
private static Class<?> getConverterClass(int type, String encoding)
|
||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String enc = null;
|
String enc = null;
|
||||||
@ -241,7 +242,7 @@ public class Converters {
|
|||||||
* Instantiate the given converter class, or throw an
|
* Instantiate the given converter class, or throw an
|
||||||
* UnsupportedEncodingException if it cannot be instantiated
|
* UnsupportedEncodingException if it cannot be instantiated
|
||||||
*/
|
*/
|
||||||
private static Object newConverter(String enc, Class c)
|
private static Object newConverter(String enc, Class<?> c)
|
||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -261,7 +262,7 @@ public class Converters {
|
|||||||
static Object newConverter(int type, String enc)
|
static Object newConverter(int type, String enc)
|
||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
Class c;
|
Class<?> c;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
c = cache(type, enc);
|
c = cache(type, enc);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
@ -279,9 +280,9 @@ public class Converters {
|
|||||||
* not yet defined, return a class that implements the fallback default
|
* not yet defined, return a class that implements the fallback default
|
||||||
* encoding, which is just ISO 8859-1.
|
* encoding, which is just ISO 8859-1.
|
||||||
*/
|
*/
|
||||||
private static Class getDefaultConverterClass(int type) {
|
private static Class<?> getDefaultConverterClass(int type) {
|
||||||
boolean fillCache = false;
|
boolean fillCache = false;
|
||||||
Class c;
|
Class<?> c;
|
||||||
|
|
||||||
/* First check the class cache */
|
/* First check the class cache */
|
||||||
c = cache(type, DEFAULT_NAME);
|
c = cache(type, DEFAULT_NAME);
|
||||||
@ -325,7 +326,7 @@ public class Converters {
|
|||||||
* encoding cannot be determined.
|
* encoding cannot be determined.
|
||||||
*/
|
*/
|
||||||
static Object newDefaultConverter(int type) {
|
static Object newDefaultConverter(int type) {
|
||||||
Class c;
|
Class<?> c;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
c = getDefaultConverterClass(type);
|
c = getDefaultConverterClass(type);
|
||||||
}
|
}
|
||||||
|
@ -671,6 +671,10 @@ public class FtpClient extends sun.net.ftp.FtpClient {
|
|||||||
}
|
}
|
||||||
if (!issueCommand(cmd)) {
|
if (!issueCommand(cmd)) {
|
||||||
s.close();
|
s.close();
|
||||||
|
if (getLastReplyCode() == FtpReplyCode.FILE_UNAVAILABLE) {
|
||||||
|
// Ensure backward compatibility
|
||||||
|
throw new FileNotFoundException(cmd);
|
||||||
|
}
|
||||||
throw new sun.net.ftp.FtpProtocolException(cmd + ":" + getResponseString(), getLastReplyCode());
|
throw new sun.net.ftp.FtpProtocolException(cmd + ":" + getResponseString(), getLastReplyCode());
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
@ -688,7 +692,16 @@ public class FtpClient extends sun.net.ftp.FtpClient {
|
|||||||
Socket clientSocket;
|
Socket clientSocket;
|
||||||
|
|
||||||
if (passiveMode) {
|
if (passiveMode) {
|
||||||
return openPassiveDataConnection(cmd);
|
try {
|
||||||
|
return openPassiveDataConnection(cmd);
|
||||||
|
} catch (sun.net.ftp.FtpProtocolException e) {
|
||||||
|
// If Passive mode failed, fall back on PORT
|
||||||
|
// Otherwise throw exception
|
||||||
|
String errmsg = e.getMessage();
|
||||||
|
if (!errmsg.startsWith("PASV") && !errmsg.startsWith("EPSV")) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ServerSocket portSocket;
|
ServerSocket portSocket;
|
||||||
InetAddress myAddress;
|
InetAddress myAddress;
|
||||||
|
@ -48,23 +48,23 @@ public class AbstractCharsetProvider
|
|||||||
|
|
||||||
/* Maps canonical names to class names
|
/* Maps canonical names to class names
|
||||||
*/
|
*/
|
||||||
private Map classMap
|
private Map<String,String> classMap
|
||||||
= new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
= new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
/* Maps alias names to canonical names
|
/* Maps alias names to canonical names
|
||||||
*/
|
*/
|
||||||
private Map aliasMap
|
private Map<String,String> aliasMap
|
||||||
= new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
= new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
/* Maps canonical names to alias-name arrays
|
/* Maps canonical names to alias-name arrays
|
||||||
*/
|
*/
|
||||||
private Map aliasNameMap
|
private Map<String,String[]> aliasNameMap
|
||||||
= new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
= new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
/* Maps canonical names to soft references that hold cached instances
|
/* Maps canonical names to soft references that hold cached instances
|
||||||
*/
|
*/
|
||||||
private Map cache
|
private Map<String,SoftReference<Charset>> cache
|
||||||
= new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
= new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
private String packagePrefix;
|
private String packagePrefix;
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ public class AbstractCharsetProvider
|
|||||||
/* Add an entry to the given map, but only if no mapping yet exists
|
/* Add an entry to the given map, but only if no mapping yet exists
|
||||||
* for the given name.
|
* for the given name.
|
||||||
*/
|
*/
|
||||||
private static void put(Map m, String name, Object value) {
|
private static <K,V> void put(Map<K,V> m, K name, V value) {
|
||||||
if (!m.containsKey(name))
|
if (!m.containsKey(name))
|
||||||
m.put(name, value);
|
m.put(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void remove(Map m, String name) {
|
private static <K,V> void remove(Map<K,V> m, K name) {
|
||||||
Object x = m.remove(name);
|
V x = m.remove(name);
|
||||||
assert (x != null);
|
assert (x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,22 +116,22 @@ public class AbstractCharsetProvider
|
|||||||
protected void init() { }
|
protected void init() { }
|
||||||
|
|
||||||
private String canonicalize(String charsetName) {
|
private String canonicalize(String charsetName) {
|
||||||
String acn = (String)aliasMap.get(charsetName);
|
String acn = aliasMap.get(charsetName);
|
||||||
return (acn != null) ? acn : charsetName;
|
return (acn != null) ? acn : charsetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Charset lookup(String csn) {
|
private Charset lookup(String csn) {
|
||||||
|
|
||||||
// Check cache first
|
// Check cache first
|
||||||
SoftReference sr = (SoftReference)cache.get(csn);
|
SoftReference<Charset> sr = cache.get(csn);
|
||||||
if (sr != null) {
|
if (sr != null) {
|
||||||
Charset cs = (Charset)sr.get();
|
Charset cs = sr.get();
|
||||||
if (cs != null)
|
if (cs != null)
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we even support this charset?
|
// Do we even support this charset?
|
||||||
String cln = (String)classMap.get(csn);
|
String cln = classMap.get(csn);
|
||||||
|
|
||||||
if (cln == null)
|
if (cln == null)
|
||||||
return null;
|
return null;
|
||||||
@ -139,12 +139,12 @@ public class AbstractCharsetProvider
|
|||||||
// Instantiate the charset and cache it
|
// Instantiate the charset and cache it
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Class c = Class.forName(packagePrefix + "." + cln,
|
Class<?> c = Class.forName(packagePrefix + "." + cln,
|
||||||
true,
|
true,
|
||||||
this.getClass().getClassLoader());
|
this.getClass().getClassLoader());
|
||||||
|
|
||||||
Charset cs = (Charset)c.newInstance();
|
Charset cs = (Charset)c.newInstance();
|
||||||
cache.put(csn, new SoftReference(cs));
|
cache.put(csn, new SoftReference<Charset>(cs));
|
||||||
return cs;
|
return cs;
|
||||||
} catch (ClassNotFoundException x) {
|
} catch (ClassNotFoundException x) {
|
||||||
return null;
|
return null;
|
||||||
@ -164,21 +164,21 @@ public class AbstractCharsetProvider
|
|||||||
|
|
||||||
public final Iterator<Charset> charsets() {
|
public final Iterator<Charset> charsets() {
|
||||||
|
|
||||||
final ArrayList ks;
|
final ArrayList<String> ks;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
init();
|
init();
|
||||||
ks = new ArrayList(classMap.keySet());
|
ks = new ArrayList<>(classMap.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Iterator<Charset>() {
|
return new Iterator<Charset>() {
|
||||||
Iterator i = ks.iterator();
|
Iterator<String> i = ks.iterator();
|
||||||
|
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return i.hasNext();
|
return i.hasNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Charset next() {
|
public Charset next() {
|
||||||
String csn = (String)i.next();
|
String csn = i.next();
|
||||||
return lookup(csn);
|
return lookup(csn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ public class AbstractCharsetProvider
|
|||||||
public final String[] aliases(String charsetName) {
|
public final String[] aliases(String charsetName) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
init();
|
init();
|
||||||
return (String[])aliasNameMap.get(charsetName);
|
return aliasNameMap.get(charsetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Portions Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
|
* Portions Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -49,7 +49,7 @@ import java.io.InputStream;
|
|||||||
public class KeyTabInputStream extends KrbDataInputStream implements KeyTabConstants {
|
public class KeyTabInputStream extends KrbDataInputStream implements KeyTabConstants {
|
||||||
|
|
||||||
boolean DEBUG = Krb5.DEBUG;
|
boolean DEBUG = Krb5.DEBUG;
|
||||||
static int index;
|
int index;
|
||||||
|
|
||||||
public KeyTabInputStream(InputStream is) {
|
public KeyTabInputStream(InputStream is) {
|
||||||
super(is);
|
super(is);
|
||||||
|
@ -40,6 +40,8 @@ import static sun.security.pkcs11.TemplateManager.*;
|
|||||||
import sun.security.pkcs11.wrapper.*;
|
import sun.security.pkcs11.wrapper.*;
|
||||||
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
||||||
|
|
||||||
|
import sun.security.util.DerValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EC KeyFactory implemenation.
|
* EC KeyFactory implemenation.
|
||||||
*
|
*
|
||||||
@ -201,7 +203,16 @@ final class P11ECKeyFactory extends P11KeyFactory {
|
|||||||
|
|
||||||
private PublicKey generatePublic(ECPoint point, ECParameterSpec params) throws PKCS11Exception {
|
private PublicKey generatePublic(ECPoint point, ECParameterSpec params) throws PKCS11Exception {
|
||||||
byte[] encodedParams = ECParameters.encodeParameters(params);
|
byte[] encodedParams = ECParameters.encodeParameters(params);
|
||||||
byte[] encodedPoint = ECParameters.encodePoint(point, params.getCurve());
|
byte[] encodedPoint = null;
|
||||||
|
DerValue pkECPoint = new DerValue(DerValue.tag_OctetString,
|
||||||
|
ECParameters.encodePoint(point, params.getCurve()));
|
||||||
|
|
||||||
|
try {
|
||||||
|
encodedPoint = pkECPoint.toByteArray();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalArgumentException("Could not DER encode point", e);
|
||||||
|
}
|
||||||
|
|
||||||
CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
|
CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
|
||||||
new CK_ATTRIBUTE(CKA_CLASS, CKO_PUBLIC_KEY),
|
new CK_ATTRIBUTE(CKA_CLASS, CKO_PUBLIC_KEY),
|
||||||
new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_EC),
|
new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_EC),
|
||||||
|
@ -45,6 +45,8 @@ import sun.security.internal.interfaces.TlsMasterSecret;
|
|||||||
import sun.security.pkcs11.wrapper.*;
|
import sun.security.pkcs11.wrapper.*;
|
||||||
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
||||||
|
|
||||||
|
import sun.security.util.DerValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key implementation classes.
|
* Key implementation classes.
|
||||||
*
|
*
|
||||||
@ -998,10 +1000,18 @@ abstract class P11Key implements Key {
|
|||||||
};
|
};
|
||||||
fetchAttributes(attributes);
|
fetchAttributes(attributes);
|
||||||
try {
|
try {
|
||||||
|
params = P11ECKeyFactory.decodeParameters
|
||||||
|
(attributes[1].getByteArray());
|
||||||
|
DerValue wECPoint = new DerValue(attributes[0].getByteArray());
|
||||||
|
if (wECPoint.getTag() != DerValue.tag_OctetString)
|
||||||
|
throw new IOException("Unexpected tag: " +
|
||||||
|
wECPoint.getTag());
|
||||||
params = P11ECKeyFactory.decodeParameters
|
params = P11ECKeyFactory.decodeParameters
|
||||||
(attributes[1].getByteArray());
|
(attributes[1].getByteArray());
|
||||||
w = P11ECKeyFactory.decodePoint
|
w = P11ECKeyFactory.decodePoint
|
||||||
(attributes[0].getByteArray(), params.getCurve());
|
(wECPoint.getDataBytes(), params.getCurve());
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Could not parse key values", e);
|
throw new RuntimeException("Could not parse key values", e);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -77,6 +77,7 @@ import sun.security.x509.*;
|
|||||||
|
|
||||||
import static java.security.KeyStore.*;
|
import static java.security.KeyStore.*;
|
||||||
import static sun.security.tools.KeyTool.Command.*;
|
import static sun.security.tools.KeyTool.Command.*;
|
||||||
|
import static sun.security.tools.KeyTool.Option.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tool manages keystores.
|
* This tool manages keystores.
|
||||||
@ -150,77 +151,77 @@ public final class KeyTool {
|
|||||||
|
|
||||||
enum Command {
|
enum Command {
|
||||||
CERTREQ("Generates a certificate request",
|
CERTREQ("Generates a certificate request",
|
||||||
"-alias", "-sigalg", "-file", "-keypass", "-keystore",
|
ALIAS, SIGALG, FILEOUT, KEYPASS, KEYSTORE,
|
||||||
"-storepass", "-storetype", "-providername", "-providerclass",
|
STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
|
||||||
"-providerarg", "-providerpath", "-v", "-protected"),
|
PROVIDERARG, PROVIDERPATH, V, PROTECTED),
|
||||||
CHANGEALIAS("Changes an entry's alias",
|
CHANGEALIAS("Changes an entry's alias",
|
||||||
"-alias", "-destalias", "-keypass", "-keystore", "-storepass",
|
ALIAS, DESTALIAS, KEYPASS, KEYSTORE, STOREPASS,
|
||||||
"-storetype", "-providername", "-providerclass", "-providerarg",
|
STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
|
||||||
"-providerpath", "-v", "-protected"),
|
PROVIDERPATH, V, PROTECTED),
|
||||||
DELETE("Deletes an entry",
|
DELETE("Deletes an entry",
|
||||||
"-alias", "-keystore", "-storepass", "-storetype",
|
ALIAS, KEYSTORE, STOREPASS, STORETYPE,
|
||||||
"-providername", "-providerclass", "-providerarg",
|
PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
|
||||||
"-providerpath", "-v", "-protected"),
|
PROVIDERPATH, V, PROTECTED),
|
||||||
EXPORTCERT("Exports certificate",
|
EXPORTCERT("Exports certificate",
|
||||||
"-rfc", "-alias", "-file", "-keystore", "-storepass",
|
RFC, ALIAS, FILEOUT, KEYSTORE, STOREPASS,
|
||||||
"-storetype", "-providername", "-providerclass", "-providerarg",
|
STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
|
||||||
"-providerpath", "-v", "-protected"),
|
PROVIDERPATH, V, PROTECTED),
|
||||||
GENKEYPAIR("Generates a key pair",
|
GENKEYPAIR("Generates a key pair",
|
||||||
"-alias", "-keyalg", "-keysize", "-sigalg", "-destalias",
|
ALIAS, KEYALG, KEYSIZE, SIGALG, DESTALIAS,
|
||||||
"-startdate", "-ext", "-validity", "-keypass", "-keystore",
|
STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE,
|
||||||
"-storepass", "-storetype", "-providername", "-providerclass",
|
STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
|
||||||
"-providerarg", "-providerpath", "-v", "-protected"),
|
PROVIDERARG, PROVIDERPATH, V, PROTECTED),
|
||||||
GENSECKEY("Generates a secret key",
|
GENSECKEY("Generates a secret key",
|
||||||
"-alias", "-keypass", "-keyalg", "-keysize", "-keystore",
|
ALIAS, KEYPASS, KEYALG, KEYSIZE, KEYSTORE,
|
||||||
"-storepass", "-storetype", "-providername", "-providerclass",
|
STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
|
||||||
"-providerarg", "-providerpath", "-v", "-protected"),
|
PROVIDERARG, PROVIDERPATH, V, PROTECTED),
|
||||||
GENCERT("Generates certificate from a certificate request",
|
GENCERT("Generates certificate from a certificate request",
|
||||||
"-rfc", "-infile", "-outfile", "-alias", "-sigalg",
|
RFC, INFILE, OUTFILE, ALIAS, SIGALG,
|
||||||
"-startdate", "-ext", "-validity", "-keypass", "-keystore",
|
STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE,
|
||||||
"-storepass", "-storetype", "-providername", "-providerclass",
|
STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
|
||||||
"-providerarg", "-providerpath", "-v", "-protected"),
|
PROVIDERARG, PROVIDERPATH, V, PROTECTED),
|
||||||
IDENTITYDB("Imports entries from a JDK 1.1.x-style identity database",
|
IDENTITYDB("Imports entries from a JDK 1.1.x-style identity database",
|
||||||
"-file", "-storetype", "-keystore", "-storepass", "-providername",
|
FILEIN, STORETYPE, KEYSTORE, STOREPASS, PROVIDERNAME,
|
||||||
"-providerclass", "-providerarg", "-providerpath", "-v"),
|
PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V),
|
||||||
IMPORTCERT("Imports a certificate or a certificate chain",
|
IMPORTCERT("Imports a certificate or a certificate chain",
|
||||||
"-noprompt", "-trustcacerts", "-protected", "-alias", "-file",
|
NOPROMPT, TRUSTCACERTS, PROTECTED, ALIAS, FILEIN,
|
||||||
"-keypass", "-keystore", "-storepass", "-storetype",
|
KEYPASS, KEYSTORE, STOREPASS, STORETYPE,
|
||||||
"-providername", "-providerclass", "-providerarg",
|
PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
|
||||||
"-providerpath", "-v"),
|
PROVIDERPATH, V),
|
||||||
IMPORTKEYSTORE("Imports one or all entries from another keystore",
|
IMPORTKEYSTORE("Imports one or all entries from another keystore",
|
||||||
"-srckeystore", "-destkeystore", "-srcstoretype",
|
SRCKEYSTORE, DESTKEYSTORE, SRCSTORETYPE,
|
||||||
"-deststoretype", "-srcstorepass", "-deststorepass",
|
DESTSTORETYPE, SRCSTOREPASS, DESTSTOREPASS,
|
||||||
"-srcprotected", "-srcprovidername", "-destprovidername",
|
SRCPROTECTED, SRCPROVIDERNAME, DESTPROVIDERNAME,
|
||||||
"-srcalias", "-destalias", "-srckeypass", "-destkeypass",
|
SRCALIAS, DESTALIAS, SRCKEYPASS, DESTKEYPASS,
|
||||||
"-noprompt", "-providerclass", "-providerarg", "-providerpath",
|
NOPROMPT, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH,
|
||||||
"-v"),
|
V),
|
||||||
KEYCLONE("Clones a key entry",
|
KEYCLONE("Clones a key entry",
|
||||||
"-alias", "-destalias", "-keypass", "-new", "-storetype",
|
ALIAS, DESTALIAS, KEYPASS, NEW, STORETYPE,
|
||||||
"-keystore", "-storepass", "-providername", "-providerclass",
|
KEYSTORE, STOREPASS, PROVIDERNAME, PROVIDERCLASS,
|
||||||
"-providerarg", "-providerpath", "-v"),
|
PROVIDERARG, PROVIDERPATH, V),
|
||||||
KEYPASSWD("Changes the key password of an entry",
|
KEYPASSWD("Changes the key password of an entry",
|
||||||
"-alias", "-keypass", "-new", "-keystore", "-storepass",
|
ALIAS, KEYPASS, NEW, KEYSTORE, STOREPASS,
|
||||||
"-storetype", "-providername", "-providerclass", "-providerarg",
|
STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
|
||||||
"-providerpath", "-v"),
|
PROVIDERPATH, V),
|
||||||
LIST("Lists entries in a keystore",
|
LIST("Lists entries in a keystore",
|
||||||
"-rfc", "-alias", "-keystore", "-storepass", "-storetype",
|
RFC, ALIAS, KEYSTORE, STOREPASS, STORETYPE,
|
||||||
"-providername", "-providerclass", "-providerarg",
|
PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
|
||||||
"-providerpath", "-v", "-protected"),
|
PROVIDERPATH, V, PROTECTED),
|
||||||
PRINTCERT("Prints the content of a certificate",
|
PRINTCERT("Prints the content of a certificate",
|
||||||
"-rfc", "-file", "-sslserver", "-jarfile", "-v"),
|
RFC, FILEIN, SSLSERVER, JARFILE, V),
|
||||||
PRINTCERTREQ("Prints the content of a certificate request",
|
PRINTCERTREQ("Prints the content of a certificate request",
|
||||||
"-file", "-v"),
|
FILEIN, V),
|
||||||
SELFCERT("Generates a self-signed certificate",
|
SELFCERT("Generates a self-signed certificate",
|
||||||
"-alias", "-sigalg", "-dname", "-startdate", "-validity", "-keypass",
|
ALIAS, SIGALG, DNAME, STARTDATE, VALIDITY, KEYPASS,
|
||||||
"-storetype", "-keystore", "-storepass", "-providername",
|
STORETYPE, KEYSTORE, STOREPASS, PROVIDERNAME,
|
||||||
"-providerclass", "-providerarg", "-providerpath", "-v"),
|
PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V),
|
||||||
STOREPASSWD("Changes the store password of a keystore",
|
STOREPASSWD("Changes the store password of a keystore",
|
||||||
"-new", "-keystore", "-storepass", "-storetype", "-providername",
|
NEW, KEYSTORE, STOREPASS, STORETYPE, PROVIDERNAME,
|
||||||
"-providerclass", "-providerarg", "-providerpath", "-v");
|
PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V);
|
||||||
|
|
||||||
final String description;
|
final String description;
|
||||||
final String[] options;
|
final Option[] options;
|
||||||
Command(String d, String... o) {
|
Command(String d, Option... o) {
|
||||||
description = d;
|
description = d;
|
||||||
options = o;
|
options = o;
|
||||||
}
|
}
|
||||||
@ -230,50 +231,60 @@ public final class KeyTool {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static String[][] options = {
|
enum Option {
|
||||||
// name, arg, description
|
ALIAS("alias", "<alias>", "alias name of the entry to process"),
|
||||||
{"-alias", "<alias>", "alias name of the entry to process"},
|
DESTALIAS("destalias", "<destalias>", "destination alias"),
|
||||||
{"-destalias", "<destalias>", "destination alias"},
|
DESTKEYPASS("destkeypass", "<arg>", "destination key password"),
|
||||||
{"-destkeypass", "<arg>", "destination key password"},
|
DESTKEYSTORE("destkeystore", "<destkeystore>", "destination keystore name"),
|
||||||
{"-destkeystore", "<destkeystore>", "destination keystore name"},
|
DESTPROTECTED("destprotected", null, "destination keystore password protected"),
|
||||||
{"-destprotected", null, "destination keystore password protected"},
|
DESTPROVIDERNAME("destprovidername", "<destprovidername>", "destination keystore provider name"),
|
||||||
{"-destprovidername", "<destprovidername>", "destination keystore provider name"},
|
DESTSTOREPASS("deststorepass", "<arg>", "destination keystore password"),
|
||||||
{"-deststorepass", "<arg>", "destination keystore password"},
|
DESTSTORETYPE("deststoretype", "<deststoretype>", "destination keystore type"),
|
||||||
{"-deststoretype", "<deststoretype>", "destination keystore type"},
|
DNAME("dname", "<dname>", "distinguished name"),
|
||||||
{"-dname", "<dname>", "distinguished name"},
|
EXT("ext", "<value>", "X.509 extension"),
|
||||||
{"-ext", "<value>", "X.509 extension"},
|
FILEOUT("file", "<filename>", "output file name"),
|
||||||
{"-file", "<filename>", "output file name"},
|
FILEIN("file", "<filename>", "input file name"),
|
||||||
{"-file", "<filename>", "input file name"},
|
INFILE("infile", "<filename>", "input file name"),
|
||||||
{"-infile", "<filename>", "input file name"},
|
KEYALG("keyalg", "<keyalg>", "key algorithm name"),
|
||||||
{"-keyalg", "<keyalg>", "key algorithm name"},
|
KEYPASS("keypass", "<arg>", "key password"),
|
||||||
{"-keypass", "<arg>", "key password"},
|
KEYSIZE("keysize", "<keysize>", "key bit size"),
|
||||||
{"-keysize", "<keysize>", "key bit size"},
|
KEYSTORE("keystore", "<keystore>", "keystore name"),
|
||||||
{"-keystore", "<keystore>", "keystore name"},
|
NEW("new", "<arg>", "new password"),
|
||||||
{"-new", "<arg>", "new password"},
|
NOPROMPT("noprompt", null, "do not prompt"),
|
||||||
{"-noprompt", null, "do not prompt"},
|
OUTFILE("outfile", "<filename>", "output file name"),
|
||||||
{"-outfile", "<filename>", "output file name"},
|
PROTECTED("protected", null, "password through protected mechanism"),
|
||||||
{"-protected", null, "password through protected mechanism"},
|
PROVIDERARG("providerarg", "<arg>", "provider argument"),
|
||||||
{"-providerarg", "<arg>", "provider argument"},
|
PROVIDERCLASS("providerclass", "<providerclass>", "provider class name"),
|
||||||
{"-providerclass", "<providerclass>", "provider class name"},
|
PROVIDERNAME("providername", "<providername>", "provider name"),
|
||||||
{"-providername", "<providername>", "provider name"},
|
PROVIDERPATH("providerpath", "<pathlist>", "provider classpath"),
|
||||||
{"-providerpath", "<pathlist>", "provider classpath"},
|
RFC("rfc", null, "output in RFC style"),
|
||||||
{"-rfc", null, "output in RFC style"},
|
SIGALG("sigalg", "<sigalg>", "signature algorithm name"),
|
||||||
{"-sigalg", "<sigalg>", "signature algorithm name"},
|
SRCALIAS("srcalias", "<srcalias>", "source alias"),
|
||||||
{"-srcalias", "<srcalias>", "source alias"},
|
SRCKEYPASS("srckeypass", "<arg>", "source keystore password"),
|
||||||
{"-srckeypass", "<arg>", "source keystore password"},
|
SRCKEYSTORE("srckeystore", "<srckeystore>", "source keystore name"),
|
||||||
{"-srckeystore", "<srckeystore>", "source keystore name"},
|
SRCPROTECTED("srcprotected", null, "source keystore password protected"),
|
||||||
{"-srcprotected", null, "source keystore password protected"},
|
SRCPROVIDERNAME("srcprovidername", "<srcprovidername>", "source keystore provider name"),
|
||||||
{"-srcprovidername", "<srcprovidername>", "source keystore provider name"},
|
SRCSTOREPASS("srcstorepass", "<arg>", "source keystore password"),
|
||||||
{"-srcstorepass", "<arg>", "source keystore password"},
|
SRCSTORETYPE("srcstoretype", "<srcstoretype>", "source keystore type"),
|
||||||
{"-srcstoretype", "<srcstoretype>", "source keystore type"},
|
SSLSERVER("sslserver", "<server[:port]>", "SSL server host and port"),
|
||||||
{"-sslserver", "<server[:port]>", "SSL server host and port"},
|
JARFILE("jarfile", "<filename>", "signed jar file"),
|
||||||
{"-jarfile", "<filename>", "signed jar file"},
|
STARTDATE("startdate", "<startdate>", "certificate validity start date/time"),
|
||||||
{"-startdate", "<startdate>", "certificate validity start date/time"},
|
STOREPASS("storepass", "<arg>", "keystore password"),
|
||||||
{"-storepass", "<arg>", "keystore password"},
|
STORETYPE("storetype", "<storetype>", "keystore type"),
|
||||||
{"-storetype", "<storetype>", "keystore type"},
|
TRUSTCACERTS("trustcacerts", null, "trust certificates from cacerts"),
|
||||||
{"-trustcacerts", null, "trust certificates from cacerts"},
|
V("v", null, "verbose output"),
|
||||||
{"-v", null, "verbose output"},
|
VALIDITY("validity", "<valDays>", "validity number of days");
|
||||||
{"-validity", "<valDays>", "validity number of days"},
|
|
||||||
|
final String name, arg, description;
|
||||||
|
Option(String name, String arg, String description) {
|
||||||
|
this.name = name;
|
||||||
|
this.arg = arg;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "-" + name;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Class[] PARAM_STRING = { String.class };
|
private static final Class[] PARAM_STRING = { String.class };
|
||||||
@ -344,10 +355,10 @@ public final class KeyTool {
|
|||||||
|
|
||||||
// Check if the last option needs an arg
|
// Check if the last option needs an arg
|
||||||
if (i == args.length - 1) {
|
if (i == args.length - 1) {
|
||||||
for (String[] option: options) {
|
for (Option option: Option.values()) {
|
||||||
// Only options with an arg need to be checked
|
// Only options with an arg need to be checked
|
||||||
if (collator.compare(flags, option[0]) == 0) {
|
if (collator.compare(flags, option.toString()) == 0) {
|
||||||
if (option[1] != null) errorNeedArgument(flags);
|
if (option.arg != null) errorNeedArgument(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3792,21 +3803,13 @@ public final class KeyTool {
|
|||||||
// Length of left side of options list
|
// Length of left side of options list
|
||||||
int lenLeft = 0;
|
int lenLeft = 0;
|
||||||
for (int j=0; j<left.length; j++) {
|
for (int j=0; j<left.length; j++) {
|
||||||
for (String[] opt: options) {
|
Option opt = command.options[j];
|
||||||
if (collator.compare(opt[0], command.options[j]) == 0) {
|
left[j] = opt.toString();
|
||||||
left[j] = opt[0];
|
if (opt.arg != null) left[j] += " " + opt.arg;
|
||||||
if (opt[1] != null) left[j] += " " + opt[1];
|
if (left[j].length() > lenLeft) {
|
||||||
if (left[j].length() > lenLeft) {
|
lenLeft = left[j].length();
|
||||||
lenLeft = left[j].length();
|
|
||||||
}
|
|
||||||
right[j] = rb.getString(opt[2]);
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
throw new RuntimeException("ERROR: CANNOT FIND " + command.options[j]);
|
|
||||||
}
|
}
|
||||||
|
right[j] = rb.getString(opt.description);
|
||||||
}
|
}
|
||||||
for (int j=0; j<left.length; j++) {
|
for (int j=0; j<left.length; j++) {
|
||||||
System.err.printf(" %-" + lenLeft + "s %s\n",
|
System.err.printf(" %-" + lenLeft + "s %s\n",
|
||||||
|
@ -535,6 +535,10 @@ public class PlatformLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void doLog(int level, String msg, Object... params) {
|
void doLog(int level, String msg, Object... params) {
|
||||||
|
int paramsNumber = (params != null) ? params.length : 0;
|
||||||
|
for (int i = 0; i < paramsNumber; i++) {
|
||||||
|
params[i] = String.valueOf(params[i]);
|
||||||
|
}
|
||||||
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, params);
|
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
jdk/src/share/demo/jvmti/compiledMethodLoad/README.txt
Normal file
42
jdk/src/share/demo/jvmti/compiledMethodLoad/README.txt
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# - Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# - Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# - Neither the name of Sun Microsystems nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived
|
||||||
|
# from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
compiledMethodLoad
|
||||||
|
|
||||||
|
This agent library traces CompiledMethodLoad events along
|
||||||
|
with the HotSpot specific compile_info parameter.
|
||||||
|
|
||||||
|
You can use this agent library as follows:
|
||||||
|
|
||||||
|
java -agentlib:compiledMethodLoad ...
|
||||||
|
|
||||||
|
See ${JAVA_HOME}/demo/jvmti/index.html for help running and building agents.
|
||||||
|
|
268
jdk/src/share/demo/jvmti/compiledMethodLoad/compiledMethodLoad.c
Normal file
268
jdk/src/share/demo/jvmti/compiledMethodLoad/compiledMethodLoad.c
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* - Neither the name of Sun Microsystems nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
#include "jvmti.h"
|
||||||
|
#include "jvmticmlr.h"
|
||||||
|
|
||||||
|
#include "agent_util.h"
|
||||||
|
|
||||||
|
/* Global static data */
|
||||||
|
static char OUTPUT_FILE[] = "compiledMethodLoad.txt";
|
||||||
|
static FILE *fp;
|
||||||
|
static jvmtiEnv *jvmti;
|
||||||
|
static jrawMonitorID lock;
|
||||||
|
|
||||||
|
/* print a jvmtiCompiledMethodLoadDummyRecord */
|
||||||
|
void
|
||||||
|
print_dummy_record(jvmtiCompiledMethodLoadDummyRecord* record,
|
||||||
|
jvmtiEnv* jvmti, FILE* fp) {
|
||||||
|
|
||||||
|
if (record != NULL) {
|
||||||
|
fprintf(fp, "Dummy record detected containing message: %s\n",
|
||||||
|
(char *)record->message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* print the specified stack frames */
|
||||||
|
void
|
||||||
|
print_stack_frames(PCStackInfo* record, jvmtiEnv *jvmti, FILE* fp) {
|
||||||
|
if (record != NULL && record->methods != NULL) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < record->numstackframes; i++) {
|
||||||
|
jvmtiError err;
|
||||||
|
char* method_name = NULL;
|
||||||
|
char* class_name = NULL;
|
||||||
|
char* method_signature = NULL;
|
||||||
|
char* class_signature = NULL;
|
||||||
|
char* generic_ptr_method = NULL;
|
||||||
|
char* generic_ptr_class = NULL;
|
||||||
|
jmethodID id;
|
||||||
|
jclass declaringclassptr;
|
||||||
|
id = record->methods[i];
|
||||||
|
|
||||||
|
err = (*jvmti)->GetMethodDeclaringClass(jvmti, id,
|
||||||
|
&declaringclassptr);
|
||||||
|
check_jvmti_error(jvmti, err, "get method declaring class");
|
||||||
|
|
||||||
|
err = (*jvmti)->GetClassSignature(jvmti, declaringclassptr,
|
||||||
|
&class_signature, &generic_ptr_class);
|
||||||
|
check_jvmti_error(jvmti, err, "get class signature");
|
||||||
|
|
||||||
|
err = (*jvmti)->GetMethodName(jvmti, id, &method_name,
|
||||||
|
&method_signature, &generic_ptr_method);
|
||||||
|
check_jvmti_error(jvmti, err, "get method name");
|
||||||
|
|
||||||
|
fprintf(fp, "%s::%s %s %s @%d\n", class_signature, method_name,
|
||||||
|
method_signature,
|
||||||
|
generic_ptr_method == NULL ? "" : generic_ptr_method,
|
||||||
|
record->bcis[i]);
|
||||||
|
|
||||||
|
if (method_name != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti, (unsigned char*)method_name);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate method_name");
|
||||||
|
}
|
||||||
|
if (method_signature != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti,
|
||||||
|
(unsigned char*)method_signature);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate method_signature");
|
||||||
|
}
|
||||||
|
if (generic_ptr_method != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti,
|
||||||
|
(unsigned char*)generic_ptr_method);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate generic_ptr_method");
|
||||||
|
}
|
||||||
|
if (class_name != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti, (unsigned char*)class_name);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate class_name");
|
||||||
|
}
|
||||||
|
if (class_signature != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti,
|
||||||
|
(unsigned char*)class_signature);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate class_signature");
|
||||||
|
}
|
||||||
|
if (generic_ptr_class != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti,
|
||||||
|
(unsigned char*)generic_ptr_class);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate generic_ptr_class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* print a jvmtiCompiledMethodLoadInlineRecord */
|
||||||
|
void
|
||||||
|
print_inline_info_record(jvmtiCompiledMethodLoadInlineRecord* record,
|
||||||
|
jvmtiEnv *jvmti, FILE* fp) {
|
||||||
|
|
||||||
|
if (record != NULL && record->pcinfo != NULL) {
|
||||||
|
int numpcs = record->numpcs;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < numpcs; i++) {
|
||||||
|
PCStackInfo pcrecord = (record->pcinfo[i]);
|
||||||
|
fprintf(fp, "PcDescriptor(pc=0x%lx):\n", (jint)(pcrecord.pc));
|
||||||
|
print_stack_frames(&pcrecord, jvmti, fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode kind of CompiledMethodLoadRecord and print */
|
||||||
|
void
|
||||||
|
print_records(jvmtiCompiledMethodLoadRecordHeader* list, jvmtiEnv *jvmti,
|
||||||
|
FILE* fp)
|
||||||
|
{
|
||||||
|
jvmtiCompiledMethodLoadRecordHeader* curr = list;
|
||||||
|
fprintf(fp, "\nPrinting PC Descriptors\n\n");
|
||||||
|
while (curr != NULL) {
|
||||||
|
switch (curr->kind) {
|
||||||
|
case JVMTI_CMLR_DUMMY:
|
||||||
|
print_dummy_record((jvmtiCompiledMethodLoadDummyRecord *)curr,
|
||||||
|
jvmti, fp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JVMTI_CMLR_INLINE_INFO:
|
||||||
|
print_inline_info_record(
|
||||||
|
(jvmtiCompiledMethodLoadInlineRecord *)curr, jvmti, fp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(fp, "Warning: unrecognized record: kind=%d\n", curr->kind);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
curr = (jvmtiCompiledMethodLoadRecordHeader *)curr->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Callback for JVMTI_EVENT_COMPILED_METHOD_LOAD */
|
||||||
|
void JNICALL
|
||||||
|
compiled_method_load(jvmtiEnv *jvmti, jmethodID method, jint code_size,
|
||||||
|
const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map,
|
||||||
|
const void* compile_info)
|
||||||
|
{
|
||||||
|
jvmtiError err;
|
||||||
|
char* name = NULL;
|
||||||
|
char* signature = NULL;
|
||||||
|
char* generic_ptr = NULL;
|
||||||
|
jvmtiCompiledMethodLoadRecordHeader* pcs;
|
||||||
|
|
||||||
|
err = (*jvmti)->RawMonitorEnter(jvmti, lock);
|
||||||
|
check_jvmti_error(jvmti, err, "raw monitor enter");
|
||||||
|
|
||||||
|
err = (*jvmti)->GetMethodName(jvmti, method, &name, &signature,
|
||||||
|
&generic_ptr);
|
||||||
|
check_jvmti_error(jvmti, err, "get method name");
|
||||||
|
|
||||||
|
fprintf(fp, "\nCompiled method load event\n");
|
||||||
|
fprintf(fp, "Method name %s %s %s\n\n", name, signature,
|
||||||
|
generic_ptr == NULL ? "" : generic_ptr);
|
||||||
|
pcs = (jvmtiCompiledMethodLoadRecordHeader *)compile_info;
|
||||||
|
if (pcs != NULL) {
|
||||||
|
print_records(pcs, jvmti, fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti, (unsigned char*)name);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate name");
|
||||||
|
}
|
||||||
|
if (signature != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti, (unsigned char*)signature);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate signature");
|
||||||
|
}
|
||||||
|
if (generic_ptr != NULL) {
|
||||||
|
err = (*jvmti)->Deallocate(jvmti, (unsigned char*)generic_ptr);
|
||||||
|
check_jvmti_error(jvmti, err, "deallocate generic_ptr");
|
||||||
|
}
|
||||||
|
|
||||||
|
err = (*jvmti)->RawMonitorExit(jvmti, lock);
|
||||||
|
check_jvmti_error(jvmti, err, "raw monitor exit");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Agent_OnLoad() is called first, we prepare for a COMPILED_METHOD_LOAD
|
||||||
|
* event here.
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
|
||||||
|
{
|
||||||
|
jint rc;
|
||||||
|
jvmtiError err;
|
||||||
|
jvmtiCapabilities capabilities;
|
||||||
|
jvmtiEventCallbacks callbacks;
|
||||||
|
|
||||||
|
fp = fopen(OUTPUT_FILE, "w");
|
||||||
|
if (fp == NULL) {
|
||||||
|
fatal_error("ERROR: %s: Unable to create output file\n", OUTPUT_FILE);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get JVMTI environment */
|
||||||
|
rc = (*vm)->GetEnv(vm, (void **)&jvmti, JVMTI_VERSION);
|
||||||
|
if (rc != JNI_OK) {
|
||||||
|
fatal_error(
|
||||||
|
"ERROR: Unable to create jvmtiEnv, GetEnv failed, error=%d\n", rc);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add JVMTI capabilities */
|
||||||
|
memset(&capabilities,0, sizeof(capabilities));
|
||||||
|
capabilities.can_generate_compiled_method_load_events = 1;
|
||||||
|
err = (*jvmti)->AddCapabilities(jvmti, &capabilities);
|
||||||
|
check_jvmti_error(jvmti, err, "add capabilities");
|
||||||
|
|
||||||
|
/* set JVMTI callbacks for events */
|
||||||
|
memset(&callbacks, 0, sizeof(callbacks));
|
||||||
|
callbacks.CompiledMethodLoad = &compiled_method_load;
|
||||||
|
err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, sizeof(callbacks));
|
||||||
|
check_jvmti_error(jvmti, err, "set event callbacks");
|
||||||
|
|
||||||
|
/* enable JVMTI events */
|
||||||
|
err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE,
|
||||||
|
JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
|
||||||
|
check_jvmti_error(jvmti, err, "set event notify");
|
||||||
|
|
||||||
|
/* create coordination monitor */
|
||||||
|
err = (*jvmti)->CreateRawMonitor(jvmti, "agent lock", &lock);
|
||||||
|
check_jvmti_error(jvmti, err, "create raw monitor");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Agent_OnUnload() is called last */
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Agent_OnUnload(JavaVM *vm)
|
||||||
|
{
|
||||||
|
}
|
148
jdk/src/share/demo/jvmti/compiledMethodLoad/sample.makefile.txt
Normal file
148
jdk/src/share/demo/jvmti/compiledMethodLoad/sample.makefile.txt
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# - Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# - Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# - Neither the name of Sun Microsystems nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived
|
||||||
|
# from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
#
|
||||||
|
# Sample GNU Makefile for building JVMTI Demo compiledMethodLoad
|
||||||
|
#
|
||||||
|
# Example uses:
|
||||||
|
# gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparc]
|
||||||
|
# gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparcv9]
|
||||||
|
# gnumake JDK=<java_home> OSNAME=linux [OPT=true]
|
||||||
|
# gnumake JDK=<java_home> OSNAME=win32 [OPT=true]
|
||||||
|
#
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
# Source lists
|
||||||
|
LIBNAME=compiledMethodLoad
|
||||||
|
SOURCES=compiledMethodLoad.c ../agent_util/agent_util.c
|
||||||
|
|
||||||
|
# Solaris Sun C Compiler Version 5.5
|
||||||
|
ifeq ($(OSNAME), solaris)
|
||||||
|
# Sun Solaris Compiler options needed
|
||||||
|
COMMON_FLAGS=-mt -KPIC
|
||||||
|
# Options that help find errors
|
||||||
|
COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
|
||||||
|
# Check LIBARCH for any special compiler options
|
||||||
|
LIBARCH=$(shell uname -p)
|
||||||
|
ifeq ($(LIBARCH), sparc)
|
||||||
|
COMMON_FLAGS+=-xarch=v8 -xregs=no%appl
|
||||||
|
endif
|
||||||
|
ifeq ($(LIBARCH), sparcv9)
|
||||||
|
COMMON_FLAGS+=-xarch=v9 -xregs=no%appl
|
||||||
|
endif
|
||||||
|
ifeq ($(OPT), true)
|
||||||
|
CFLAGS=-xO2 $(COMMON_FLAGS)
|
||||||
|
else
|
||||||
|
CFLAGS=-g $(COMMON_FLAGS)
|
||||||
|
endif
|
||||||
|
# Object files needed to create library
|
||||||
|
OBJECTS=$(SOURCES:%.c=%.o)
|
||||||
|
# Library name and options needed to build it
|
||||||
|
LIBRARY=lib$(LIBNAME).so
|
||||||
|
LDFLAGS=-z defs -ztext
|
||||||
|
# Libraries we are dependent on
|
||||||
|
LIBRARIES= -lc
|
||||||
|
# Building a shared library
|
||||||
|
LINK_SHARED=$(LINK.c) -G -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Linux GNU C Compiler
|
||||||
|
ifeq ($(OSNAME), linux)
|
||||||
|
# GNU Compiler options needed to build it
|
||||||
|
COMMON_FLAGS=-fno-strict-aliasing -fPIC -fno-omit-frame-pointer
|
||||||
|
# Options that help find errors
|
||||||
|
COMMON_FLAGS+= -W -Wall -Wno-unused -Wno-parentheses
|
||||||
|
ifeq ($(OPT), true)
|
||||||
|
CFLAGS=-O2 $(COMMON_FLAGS)
|
||||||
|
else
|
||||||
|
CFLAGS=-g $(COMMON_FLAGS)
|
||||||
|
endif
|
||||||
|
# Object files needed to create library
|
||||||
|
OBJECTS=$(SOURCES:%.c=%.o)
|
||||||
|
# Library name and options needed to build it
|
||||||
|
LIBRARY=lib$(LIBNAME).so
|
||||||
|
LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
|
||||||
|
# Libraries we are dependent on
|
||||||
|
LIBRARIES=-lc
|
||||||
|
# Building a shared library
|
||||||
|
LINK_SHARED=$(LINK.c) -shared -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Windows Microsoft C/C++ Optimizing Compiler Version 12
|
||||||
|
ifeq ($(OSNAME), win32)
|
||||||
|
CC=cl
|
||||||
|
# Compiler options needed to build it
|
||||||
|
COMMON_FLAGS=-Gy -DWIN32
|
||||||
|
# Options that help find errors
|
||||||
|
COMMON_FLAGS+=-W0 -WX
|
||||||
|
ifeq ($(OPT), true)
|
||||||
|
CFLAGS= -Ox -Op -Zi $(COMMON_FLAGS)
|
||||||
|
else
|
||||||
|
CFLAGS= -Od -Zi $(COMMON_FLAGS)
|
||||||
|
endif
|
||||||
|
# Object files needed to create library
|
||||||
|
OBJECTS=$(SOURCES:%.c=%.obj)
|
||||||
|
# Library name and options needed to build it
|
||||||
|
LIBRARY=$(LIBNAME).dll
|
||||||
|
LDFLAGS=
|
||||||
|
# Libraries we are dependent on
|
||||||
|
LIBRARIES=
|
||||||
|
# Building a shared library
|
||||||
|
LINK_SHARED=link -dll -out:$@
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Common -I options
|
||||||
|
CFLAGS += -I.
|
||||||
|
CFLAGS += -I../agent_util
|
||||||
|
CFLAGS += -I$(JDK)/include -I$(JDK)/include/$(OSNAME)
|
||||||
|
|
||||||
|
# Default rule
|
||||||
|
all: $(LIBRARY)
|
||||||
|
|
||||||
|
# Build native library
|
||||||
|
$(LIBRARY): $(OBJECTS)
|
||||||
|
$(LINK_SHARED) $(OBJECTS) $(LIBRARIES)
|
||||||
|
|
||||||
|
# Cleanup the built bits
|
||||||
|
clean:
|
||||||
|
rm -f $(LIBRARY) $(OBJECTS)
|
||||||
|
|
||||||
|
# Simple tester
|
||||||
|
test: all
|
||||||
|
LD_LIBRARY_PATH=`pwd` $(JDK)/bin/java -agentlib:$(LIBNAME) -version
|
||||||
|
|
||||||
|
# Compilation rule only needed on Windows
|
||||||
|
ifeq ($(OSNAME), win32)
|
||||||
|
%.obj: %.c
|
||||||
|
$(COMPILE.c) $<
|
||||||
|
endif
|
||||||
|
|
@ -99,6 +99,13 @@ version string supplied in the jvmti.h file, with the version
|
|||||||
number supplied by the VM at runtime.
|
number supplied by the VM at runtime.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<A HREF="compiledMethodLoad">compiledMethodLoad</A>
|
||||||
|
<br>
|
||||||
|
This is a small agent that traces CompiledMethodLoad events along
|
||||||
|
with the HotSpot specific compile_info parameter.
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<A HREF="mtrace">mtrace</A>
|
<A HREF="mtrace">mtrace</A>
|
||||||
<br>
|
<br>
|
||||||
|
115
jdk/src/share/javavm/export/jvmticmlr.h
Normal file
115
jdk/src/share/javavm/export/jvmticmlr.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This header file defines the data structures sent by the VM
|
||||||
|
* through the JVMTI CompiledMethodLoad callback function via the
|
||||||
|
* "void * compile_info" parameter. The memory pointed to by the
|
||||||
|
* compile_info parameter may not be referenced after returning from
|
||||||
|
* the CompiledMethodLoad callback. These are VM implementation
|
||||||
|
* specific data structures that may evolve in future releases. A
|
||||||
|
* JVMTI agent should interpret a non-NULL compile_info as a pointer
|
||||||
|
* to a region of memory containing a list of records. In a typical
|
||||||
|
* usage scenario, a JVMTI agent would cast each record to a
|
||||||
|
* jvmtiCompiledMethodLoadRecordHeader, a struct that represents
|
||||||
|
* arbitrary information. This struct contains a kind field to indicate
|
||||||
|
* the kind of information being passed, and a pointer to the next
|
||||||
|
* record. If the kind field indicates inlining information, then the
|
||||||
|
* agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
|
||||||
|
* This record contains an array of PCStackInfo structs, which indicate
|
||||||
|
* for every pc address what are the methods on the invocation stack.
|
||||||
|
* The "methods" and "bcis" fields in each PCStackInfo struct specify a
|
||||||
|
* 1-1 mapping between these inlined methods and their bytecode indices.
|
||||||
|
* This can be used to derive the proper source lines of the inlined
|
||||||
|
* methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JVMTI_CMLR_H_
|
||||||
|
#define _JVMTI_CMLR_H_
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
|
||||||
|
JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
|
||||||
|
|
||||||
|
JVMTI_CMLR_MAJOR_VERSION = 0x00000001,
|
||||||
|
JVMTI_CMLR_MINOR_VERSION = 0x00000000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This comment is for the "JDK import from HotSpot" sanity check:
|
||||||
|
* version: 1.0.0
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
JVMTI_CMLR_DUMMY = 1,
|
||||||
|
JVMTI_CMLR_INLINE_INFO = 2
|
||||||
|
} jvmtiCMLRKind;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record that represents arbitrary information passed through JVMTI
|
||||||
|
* CompiledMethodLoadEvent void pointer.
|
||||||
|
*/
|
||||||
|
typedef struct _jvmtiCompiledMethodLoadRecordHeader {
|
||||||
|
jvmtiCMLRKind kind; /* id for the kind of info passed in the record */
|
||||||
|
jint majorinfoversion; /* major and minor info version values. Init'ed */
|
||||||
|
jint minorinfoversion; /* to current version value in jvmtiExport.cpp. */
|
||||||
|
|
||||||
|
struct _jvmtiCompiledMethodLoadRecordHeader* next;
|
||||||
|
} jvmtiCompiledMethodLoadRecordHeader;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record that gives information about the methods on the compile-time
|
||||||
|
* stack at a specific pc address of a compiled method. Each element in
|
||||||
|
* the methods array maps to same element in the bcis array.
|
||||||
|
*/
|
||||||
|
typedef struct _PCStackInfo {
|
||||||
|
void* pc; /* the pc address for this compiled method */
|
||||||
|
jint numstackframes; /* number of methods on the stack */
|
||||||
|
jmethodID* methods; /* array of numstackframes method ids */
|
||||||
|
jint* bcis; /* array of numstackframes bytecode indices */
|
||||||
|
} PCStackInfo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Record that contains inlining information for each pc address of
|
||||||
|
* an nmethod.
|
||||||
|
*/
|
||||||
|
typedef struct _jvmtiCompiledMethodLoadInlineRecord {
|
||||||
|
jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
|
||||||
|
jint numpcs; /* number of pc descriptors in this nmethod */
|
||||||
|
PCStackInfo* pcinfo; /* array of numpcs pc descriptors */
|
||||||
|
} jvmtiCompiledMethodLoadInlineRecord;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy record used to test that we can pass records with different
|
||||||
|
* information through the void pointer provided that they can be cast
|
||||||
|
* to a jvmtiCompiledMethodLoadRecordHeader.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _jvmtiCompiledMethodLoadDummyRecord {
|
||||||
|
jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
|
||||||
|
char message[50];
|
||||||
|
} jvmtiCompiledMethodLoadDummyRecord;
|
||||||
|
|
||||||
|
#endif
|
@ -162,10 +162,11 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
|||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
|
NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
|
||||||
{
|
{
|
||||||
jint family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
|
jint family = AF_INET;
|
||||||
AF_INET : AF_INET6;
|
|
||||||
|
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
|
family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
|
||||||
|
AF_INET : AF_INET6;
|
||||||
if (him->sa_family == AF_INET6) {
|
if (him->sa_family == AF_INET6) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
||||||
|
@ -189,21 +189,22 @@ public abstract class InfoWindow extends Window {
|
|||||||
* WARNING: this method is executed on Toolkit thread!
|
* WARNING: this method is executed on Toolkit thread!
|
||||||
*/
|
*/
|
||||||
private void display() {
|
private void display() {
|
||||||
String tooltipString = liveArguments.getTooltipString();
|
|
||||||
if (tooltipString == null) {
|
|
||||||
return;
|
|
||||||
} else if (tooltipString.length() > TOOLTIP_MAX_LENGTH) {
|
|
||||||
textLabel.setText(tooltipString.substring(0, TOOLTIP_MAX_LENGTH));
|
|
||||||
} else {
|
|
||||||
textLabel.setText(tooltipString);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute on EDT to avoid deadlock (see 6280857).
|
// Execute on EDT to avoid deadlock (see 6280857).
|
||||||
SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
|
SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (liveArguments.isDisposed()) {
|
if (liveArguments.isDisposed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String tooltipString = liveArguments.getTooltipString();
|
||||||
|
if (tooltipString == null) {
|
||||||
|
return;
|
||||||
|
} else if (tooltipString.length() > TOOLTIP_MAX_LENGTH) {
|
||||||
|
textLabel.setText(tooltipString.substring(0, TOOLTIP_MAX_LENGTH));
|
||||||
|
} else {
|
||||||
|
textLabel.setText(tooltipString);
|
||||||
|
}
|
||||||
|
|
||||||
Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
|
Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
if (!isPointerOverTrayIcon(liveArguments.getBounds())) {
|
if (!isPointerOverTrayIcon(liveArguments.getBounds())) {
|
||||||
|
@ -2144,9 +2144,11 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
// Outside this toplevel hierarchy
|
// Outside this toplevel hierarchy
|
||||||
// According to the specification of UngrabEvent, post it
|
// According to the specification of UngrabEvent, post it
|
||||||
// when press occurs outside of the window and not on its owned windows
|
// when press occurs outside of the window and not on its owned windows
|
||||||
grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this);
|
if (xbe.get_type() == XConstants.ButtonPress) {
|
||||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this);
|
||||||
return;
|
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// First, get the toplevel
|
// First, get the toplevel
|
||||||
XWindowPeer toplevel = target.getToplevelXWindow();
|
XWindowPeer toplevel = target.getToplevelXWindow();
|
||||||
|
@ -46,11 +46,6 @@
|
|||||||
#define HENT_BUF_SIZE 1024
|
#define HENT_BUF_SIZE 1024
|
||||||
#define BIG_HENT_BUF_SIZE 10240 /* a jumbo-sized one */
|
#define BIG_HENT_BUF_SIZE 10240 /* a jumbo-sized one */
|
||||||
|
|
||||||
#ifndef __GLIBC__
|
|
||||||
/* gethostname() is in libc.so but I can't find a header file for it */
|
|
||||||
extern int gethostname(char *buf, int buf_len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Inet4AddressImpl
|
* Inet4AddressImpl
|
||||||
*/
|
*/
|
||||||
|
@ -49,10 +49,6 @@
|
|||||||
#define NI_MAXHOST 1025
|
#define NI_MAXHOST 1025
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GLIBC__
|
|
||||||
/* gethostname() is in libc.so but I can't find a header file for it */
|
|
||||||
extern int gethostname(char *buf, int buf_len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Inet6AddressImpl
|
* Inet6AddressImpl
|
||||||
@ -360,8 +356,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AF_INET6 */
|
|
||||||
|
|
||||||
cleanupAndReturn:
|
cleanupAndReturn:
|
||||||
{
|
{
|
||||||
struct addrinfo *iterator, *tmp;
|
struct addrinfo *iterator, *tmp;
|
||||||
@ -374,7 +368,6 @@ cleanupAndReturn:
|
|||||||
JNU_ReleaseStringPlatformChars(env, host, hostname);
|
JNU_ReleaseStringPlatformChars(env, host, hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AF_INET6
|
|
||||||
if (NET_addrtransAvailable())
|
if (NET_addrtransAvailable())
|
||||||
(*freeaddrinfo_ptr)(res);
|
(*freeaddrinfo_ptr)(res);
|
||||||
#endif /* AF_INET6 */
|
#endif /* AF_INET6 */
|
||||||
|
@ -253,8 +253,12 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
|
|||||||
(JNIEnv *env, jclass cls, jobject iaObj) {
|
(JNIEnv *env, jclass cls, jobject iaObj) {
|
||||||
|
|
||||||
netif *ifs, *curr;
|
netif *ifs, *curr;
|
||||||
|
#ifdef AF_INET6
|
||||||
int family = (*env)->GetIntField(env, iaObj, ni_iafamilyID) == IPv4?
|
int family = (*env)->GetIntField(env, iaObj, ni_iafamilyID) == IPv4?
|
||||||
AF_INET : AF_INET6;
|
AF_INET : AF_INET6;
|
||||||
|
#else
|
||||||
|
int family = AF_INET;
|
||||||
|
#endif
|
||||||
jobject obj = NULL;
|
jobject obj = NULL;
|
||||||
jboolean match = JNI_FALSE;
|
jboolean match = JNI_FALSE;
|
||||||
|
|
||||||
@ -1528,6 +1532,7 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas
|
|||||||
strcpy((caddr_t)&(lifr.lifr_name), name_utf);
|
strcpy((caddr_t)&(lifr.lifr_name), name_utf);
|
||||||
if (ioctl(sock, SIOCGLIFMTU, (caddr_t)&lifr) >= 0) {
|
if (ioctl(sock, SIOCGLIFMTU, (caddr_t)&lifr) >= 0) {
|
||||||
ret = lifr.lifr_mtu;
|
ret = lifr.lifr_mtu;
|
||||||
|
#ifdef AF_INET6
|
||||||
} else {
|
} else {
|
||||||
/* Try wIth an IPv6 socket in case the interface has only IPv6 addresses assigned to it */
|
/* Try wIth an IPv6 socket in case the interface has only IPv6 addresses assigned to it */
|
||||||
close(sock);
|
close(sock);
|
||||||
@ -1547,6 +1552,12 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas
|
|||||||
"IOCTL failed");
|
"IOCTL failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
} else {
|
||||||
|
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
|
||||||
|
"IOCTL failed");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
close(sock);
|
close(sock);
|
||||||
}
|
}
|
||||||
|
@ -605,8 +605,12 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
|
|||||||
}
|
}
|
||||||
|
|
||||||
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
|
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
|
||||||
|
#ifdef AF_INET6
|
||||||
family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
|
family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
|
||||||
AF_INET : AF_INET6;
|
AF_INET : AF_INET6;
|
||||||
|
#else
|
||||||
|
family = AF_INET;
|
||||||
|
#endif
|
||||||
if (family == AF_INET) { /* this api can't handle IPV6 addresses */
|
if (family == AF_INET) { /* this api can't handle IPV6 addresses */
|
||||||
int address = (*env)->GetIntField(env, iaObj, ia_addressID);
|
int address = (*env)->GetIntField(env, iaObj, ia_addressID);
|
||||||
(*env)->SetIntField(env, addressObj, ia_addressID, address);
|
(*env)->SetIntField(env, addressObj, ia_addressID, address);
|
||||||
@ -812,9 +816,9 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
|
|||||||
jboolean retry;
|
jboolean retry;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
jboolean connected = JNI_FALSE;
|
jboolean connected = JNI_FALSE;
|
||||||
jobject connectedAddress;
|
jobject connectedAddress = NULL;
|
||||||
jint connectedPort;
|
jint connectedPort = 0;
|
||||||
jlong prevTime;
|
jlong prevTime = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (IS_NULL(fdObj)) {
|
if (IS_NULL(fdObj)) {
|
||||||
@ -1186,6 +1190,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
|
|||||||
* Set outgoing multicast interface designated by a NetworkInterface.
|
* Set outgoing multicast interface designated by a NetworkInterface.
|
||||||
* Throw exception if failed.
|
* Throw exception if failed.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject value) {
|
static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject value) {
|
||||||
static jfieldID ni_indexID;
|
static jfieldID ni_indexID;
|
||||||
int index;
|
int index;
|
||||||
@ -1222,6 +1227,7 @@ static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject val
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* AF_INET6 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set outgoing multicast interface designated by an InetAddress.
|
* Set outgoing multicast interface designated by an InetAddress.
|
||||||
@ -1251,6 +1257,7 @@ static void mcast_set_if_by_addr_v4(JNIEnv *env, jobject this, int fd, jobject v
|
|||||||
* Set outgoing multicast interface designated by an InetAddress.
|
* Set outgoing multicast interface designated by an InetAddress.
|
||||||
* Throw exception if failed.
|
* Throw exception if failed.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject value) {
|
static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject value) {
|
||||||
static jclass ni_class;
|
static jclass ni_class;
|
||||||
if (ni_class == NULL) {
|
if (ni_class == NULL) {
|
||||||
@ -1272,6 +1279,7 @@ static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject v
|
|||||||
|
|
||||||
mcast_set_if_by_if_v6(env, this, fd, value);
|
mcast_set_if_by_if_v6(env, this, fd, value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the multicast interface.
|
* Sets the multicast interface.
|
||||||
@ -1307,6 +1315,7 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
|
|||||||
/*
|
/*
|
||||||
* value is an InetAddress.
|
* value is an InetAddress.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
if (ipv6_available()) {
|
if (ipv6_available()) {
|
||||||
mcast_set_if_by_addr_v6(env, this, fd, value);
|
mcast_set_if_by_addr_v6(env, this, fd, value);
|
||||||
@ -1320,12 +1329,16 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
|
|||||||
mcast_set_if_by_addr_v6(env, this, fd, value);
|
mcast_set_if_by_addr_v6(env, this, fd, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
mcast_set_if_by_addr_v4(env, this, fd, value);
|
||||||
|
#endif /* AF_INET6 */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt == java_net_SocketOptions_IP_MULTICAST_IF2) {
|
if (opt == java_net_SocketOptions_IP_MULTICAST_IF2) {
|
||||||
/*
|
/*
|
||||||
* value is a NetworkInterface.
|
* value is a NetworkInterface.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
if (ipv6_available()) {
|
if (ipv6_available()) {
|
||||||
mcast_set_if_by_if_v6(env, this, fd, value);
|
mcast_set_if_by_if_v6(env, this, fd, value);
|
||||||
@ -1339,6 +1352,9 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
|
|||||||
mcast_set_if_by_if_v6(env, this, fd, value);
|
mcast_set_if_by_if_v6(env, this, fd, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
mcast_set_if_by_if_v4(env, this, fd, value);
|
||||||
|
#endif /* AF_INET6 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1368,6 +1384,7 @@ static void mcast_set_loop_v4(JNIEnv *env, jobject this, int fd, jobject value)
|
|||||||
/*
|
/*
|
||||||
* Enable/disable local loopback of multicast datagrams.
|
* Enable/disable local loopback of multicast datagrams.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value) {
|
static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value) {
|
||||||
jclass cls;
|
jclass cls;
|
||||||
jfieldID fid;
|
jfieldID fid;
|
||||||
@ -1397,12 +1414,14 @@ static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* AF_INET6 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the multicast loopback mode.
|
* Sets the multicast loopback mode.
|
||||||
*/
|
*/
|
||||||
static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
|
static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
|
||||||
jint opt, jobject value) {
|
jint opt, jobject value) {
|
||||||
|
#ifdef AF_INET6
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
if (ipv6_available()) {
|
if (ipv6_available()) {
|
||||||
mcast_set_loop_v6(env, this, fd, value);
|
mcast_set_loop_v6(env, this, fd, value);
|
||||||
@ -1416,6 +1435,9 @@ static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
|
|||||||
mcast_set_loop_v6(env, this, fd, value);
|
mcast_set_loop_v6(env, this, fd, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
mcast_set_loop_v4(env, this, fd, value);
|
||||||
|
#endif /* AF_INET6 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1838,7 +1860,7 @@ Java_java_net_PlainDatagramSocketImpl_socketGetOption(JNIEnv *env, jobject this,
|
|||||||
if (opt == java_net_SocketOptions_SO_BINDADDR) {
|
if (opt == java_net_SocketOptions_SO_BINDADDR) {
|
||||||
/* find out local IP address */
|
/* find out local IP address */
|
||||||
SOCKADDR him;
|
SOCKADDR him;
|
||||||
int len = 0;
|
socklen_t len = 0;
|
||||||
int port;
|
int port;
|
||||||
jobject iaObj;
|
jobject iaObj;
|
||||||
|
|
||||||
@ -1941,6 +1963,7 @@ static void setTTL(JNIEnv *env, int fd, jint ttl) {
|
|||||||
/*
|
/*
|
||||||
* Set hops limit for a socket. Throw exception if failed.
|
* Set hops limit for a socket. Throw exception if failed.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
|
static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
|
||||||
int ittl = (int)ttl;
|
int ittl = (int)ttl;
|
||||||
if (JVM_SetSockOpt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
|
if (JVM_SetSockOpt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
|
||||||
@ -1949,6 +1972,7 @@ static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
|
|||||||
"Error setting socket option");
|
"Error setting socket option");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: java_net_PlainDatagramSocketImpl
|
* Class: java_net_PlainDatagramSocketImpl
|
||||||
@ -1971,6 +1995,7 @@ Java_java_net_PlainDatagramSocketImpl_setTimeToLive(JNIEnv *env, jobject this,
|
|||||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||||
}
|
}
|
||||||
/* setsockopt to be correct ttl */
|
/* setsockopt to be correct ttl */
|
||||||
|
#ifdef AF_INET6
|
||||||
#ifdef __solaris__
|
#ifdef __solaris__
|
||||||
if (ipv6_available()) {
|
if (ipv6_available()) {
|
||||||
setHopLimit(env, fd, ttl);
|
setHopLimit(env, fd, ttl);
|
||||||
@ -1986,7 +2011,10 @@ Java_java_net_PlainDatagramSocketImpl_setTimeToLive(JNIEnv *env, jobject this,
|
|||||||
(*env)->SetIntField(env, this, pdsi_ttlID, ttl);
|
(*env)->SetIntField(env, this, pdsi_ttlID, ttl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // __linux__
|
||||||
|
#else
|
||||||
|
setTTL(env, fd, ttl);
|
||||||
|
#endif /* AF_INET6 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -319,8 +319,6 @@ jint IPv6_supported()
|
|||||||
|
|
||||||
#endif /* __solaris */
|
#endif /* __solaris */
|
||||||
|
|
||||||
#endif /* AF_INET6 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OK we may have the stack available in the kernel,
|
* OK we may have the stack available in the kernel,
|
||||||
* we should also check if the APIs are available.
|
* we should also check if the APIs are available.
|
||||||
@ -354,6 +352,7 @@ jint IPv6_supported()
|
|||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
|
#endif /* AF_INET6 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -133,7 +133,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define SOCKADDR union { struct sockaddr_in him4 }
|
#define SOCKADDR union { struct sockaddr_in him4; }
|
||||||
#define SOCKADDR_LEN sizeof(SOCKADDR)
|
#define SOCKADDR_LEN sizeof(SOCKADDR)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,7 +44,11 @@ JNIEXPORT void JNICALL
|
|||||||
Java_sun_net_spi_SdpProvider_convert(JNIEnv *env, jclass cls, jint fd)
|
Java_sun_net_spi_SdpProvider_convert(JNIEnv *env, jclass cls, jint fd)
|
||||||
{
|
{
|
||||||
#ifdef PROTO_SDP
|
#ifdef PROTO_SDP
|
||||||
|
#ifdef AF_INET6
|
||||||
int domain = ipv6_available() ? AF_INET6 : AF_INET;
|
int domain = ipv6_available() ? AF_INET6 : AF_INET;
|
||||||
|
#else
|
||||||
|
int domain = AF_INET;
|
||||||
|
#endif
|
||||||
int s = socket(domain, SOCK_STREAM, PROTO_SDP);
|
int s = socket(domain, SOCK_STREAM, PROTO_SDP);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
JNU_ThrowIOExceptionWithLastError(env, "socket");
|
JNU_ThrowIOExceptionWithLastError(env, "socket");
|
||||||
|
@ -124,6 +124,7 @@ struct my_group_source_req {
|
|||||||
* Copy IPv6 group, interface index, and IPv6 source address
|
* Copy IPv6 group, interface index, and IPv6 source address
|
||||||
* into group_source_req structure.
|
* into group_source_req structure.
|
||||||
*/
|
*/
|
||||||
|
#ifdef AF_INET6
|
||||||
static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
|
static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
|
||||||
jbyteArray source, struct my_group_source_req* req)
|
jbyteArray source, struct my_group_source_req* req)
|
||||||
{
|
{
|
||||||
@ -139,7 +140,7 @@ static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
|
|||||||
sin6->sin6_family = AF_INET6;
|
sin6->sin6_family = AF_INET6;
|
||||||
COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
|
COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
|
Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
|
||||||
@ -159,7 +160,11 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
|
int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
|
||||||
|
#ifdef AF_INET6
|
||||||
int domain = (ipv6_available() && preferIPv6) ? AF_INET6 : AF_INET;
|
int domain = (ipv6_available() && preferIPv6) ? AF_INET6 : AF_INET;
|
||||||
|
#else
|
||||||
|
int domain = AF_INET;
|
||||||
|
#endif
|
||||||
|
|
||||||
fd = socket(domain, type, 0);
|
fd = socket(domain, type, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@ -176,7 +181,7 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef __linux__
|
#if defined(__linux__) && defined(AF_INET6)
|
||||||
/* By default, Linux uses the route default */
|
/* By default, Linux uses the route default */
|
||||||
if (domain == AF_INET6 && type == SOCK_DGRAM) {
|
if (domain == AF_INET6 && type == SOCK_DGRAM) {
|
||||||
int arg = 1;
|
int arg = 1;
|
||||||
@ -424,6 +429,7 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobject fdo,
|
Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobject fdo,
|
||||||
jbyteArray group, jint index, jbyteArray source)
|
jbyteArray group, jint index, jbyteArray source)
|
||||||
{
|
{
|
||||||
|
#ifdef AF_INET6
|
||||||
struct ipv6_mreq mreq6;
|
struct ipv6_mreq mreq6;
|
||||||
struct my_group_source_req req;
|
struct my_group_source_req req;
|
||||||
int opt, n, optlen;
|
int opt, n, optlen;
|
||||||
@ -454,12 +460,17 @@ Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobjec
|
|||||||
handleSocketError(env, errno);
|
handleSocketError(env, errno);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
JNU_ThrowInternalError(env, "Should not get here");
|
||||||
|
return IOS_THROWN;
|
||||||
|
#endif /* AF_INET6 */
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, jobject fdo,
|
Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, jobject fdo,
|
||||||
jbyteArray group, jint index, jbyteArray source)
|
jbyteArray group, jint index, jbyteArray source)
|
||||||
{
|
{
|
||||||
|
#ifdef AF_INET6
|
||||||
struct my_group_source_req req;
|
struct my_group_source_req req;
|
||||||
int n;
|
int n;
|
||||||
int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE;
|
int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE;
|
||||||
@ -474,6 +485,10 @@ Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, j
|
|||||||
handleSocketError(env, errno);
|
handleSocketError(env, errno);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
JNU_ThrowInternalError(env, "Should not get here");
|
||||||
|
return IOS_THROWN;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
|
@ -168,14 +168,18 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpNet_socket0
|
|||||||
(JNIEnv *env, jclass klass, jboolean oneToOne) {
|
(JNIEnv *env, jclass klass, jboolean oneToOne) {
|
||||||
int fd;
|
int fd;
|
||||||
struct sctp_event_subscribe event;
|
struct sctp_event_subscribe event;
|
||||||
|
#ifdef AF_INET6
|
||||||
|
int domain = ipv6_available() ? AF_INET6 : AF_INET;
|
||||||
|
#else
|
||||||
|
int domain = AF_INET;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Try to load the socket API extension functions */
|
/* Try to load the socket API extension functions */
|
||||||
if (!funcsLoaded && !loadSocketExtensionFuncs(env)) {
|
if (!funcsLoaded && !loadSocketExtensionFuncs(env)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = socket(ipv6_available() ? AF_INET6 : AF_INET,
|
fd = socket(domain, (oneToOne ? SOCK_STREAM : SOCK_SEQPACKET), IPPROTO_SCTP);
|
||||||
(oneToOne ? SOCK_STREAM : SOCK_SEQPACKET), IPPROTO_SCTP);
|
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return handleSocketError(env, errno);
|
return handleSocketError(env, errno);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -56,6 +56,7 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
@ -130,6 +131,10 @@ public class WDataTransferer extends DataTransferer {
|
|||||||
public static final long CF_PNG = registerClipboardFormat("PNG");
|
public static final long CF_PNG = registerClipboardFormat("PNG");
|
||||||
public static final long CF_JFIF = registerClipboardFormat("JFIF");
|
public static final long CF_JFIF = registerClipboardFormat("JFIF");
|
||||||
|
|
||||||
|
public static final long CF_FILEGROUPDESCRIPTORW = registerClipboardFormat("FileGroupDescriptorW");
|
||||||
|
public static final long CF_FILEGROUPDESCRIPTORA = registerClipboardFormat("FileGroupDescriptor");
|
||||||
|
//CF_FILECONTENTS supported as mandatory associated clipboard
|
||||||
|
|
||||||
private static final Long L_CF_LOCALE = (Long)
|
private static final Long L_CF_LOCALE = (Long)
|
||||||
predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
|
predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
|
||||||
|
|
||||||
@ -203,6 +208,30 @@ public class WDataTransferer extends DataTransferer {
|
|||||||
str = new HTMLCodec(str, EHTMLReadMode.HTML_READ_SELECTION);
|
str = new HTMLCodec(str, EHTMLReadMode.HTML_READ_SELECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (format == CF_FILEGROUPDESCRIPTORA || format == CF_FILEGROUPDESCRIPTORW) {
|
||||||
|
if (null != str ) {
|
||||||
|
str.close();
|
||||||
|
}
|
||||||
|
if (bytes == null || !DataFlavor.javaFileListFlavor.equals(flavor)) {
|
||||||
|
throw new IOException("data translation failed");
|
||||||
|
}
|
||||||
|
String st = new String(bytes, 0, bytes.length, "UTF-16LE");
|
||||||
|
String[] filenames = st.split("\0");
|
||||||
|
if( 0 == filenames.length ){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the strings to File objects
|
||||||
|
File[] files = new File[filenames.length];
|
||||||
|
for (int i = 0; i < filenames.length; ++i) {
|
||||||
|
files[i] = new File(filenames[i]);
|
||||||
|
//They are temp-files from memory Stream, so they have to be removed on exit
|
||||||
|
files[i].deleteOnExit();
|
||||||
|
}
|
||||||
|
// Turn the list of Files into a List and return
|
||||||
|
return Arrays.asList(files);
|
||||||
|
}
|
||||||
|
|
||||||
if (format == CFSTR_INETURL &&
|
if (format == CFSTR_INETURL &&
|
||||||
URL.class.equals(flavor.getRepresentationClass()))
|
URL.class.equals(flavor.getRepresentationClass()))
|
||||||
{
|
{
|
||||||
@ -233,7 +262,7 @@ public class WDataTransferer extends DataTransferer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFileFormat(long format) {
|
public boolean isFileFormat(long format) {
|
||||||
return format == CF_HDROP;
|
return format == CF_HDROP || format == CF_FILEGROUPDESCRIPTORA || format == CF_FILEGROUPDESCRIPTORW;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Long getFormatForNativeAsLong(String str) {
|
protected Long getFormatForNativeAsLong(String str) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -27,6 +27,10 @@ package sun.awt.windows;
|
|||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.DataBufferInt;
|
||||||
|
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
|
|
||||||
@ -88,11 +92,56 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
|
|||||||
throw new InvalidDnDOperationException("failed to create native peer");
|
throw new InvalidDnDOperationException("failed to create native peer");
|
||||||
}
|
}
|
||||||
|
|
||||||
setNativeContext(nativeCtxtLocal);
|
int[] imageData = null;
|
||||||
|
Point op = null;
|
||||||
|
|
||||||
|
Image im = getDragImage();
|
||||||
|
int imageWidth = -1;
|
||||||
|
int imageHeight = -1;
|
||||||
|
if (im != null) {
|
||||||
|
//image is ready (partial images are ok)
|
||||||
|
try{
|
||||||
|
imageWidth = im.getWidth(null);
|
||||||
|
imageHeight = im.getHeight(null);
|
||||||
|
if (imageWidth < 0 || imageHeight < 0) {
|
||||||
|
throw new InvalidDnDOperationException("drag image is not ready");
|
||||||
|
}
|
||||||
|
//We could get an exception from user code here.
|
||||||
|
//"im" and "dragImageOffset" are user-defined objects
|
||||||
|
op = getDragImageOffset(); //op could not be null here
|
||||||
|
BufferedImage bi = new BufferedImage(
|
||||||
|
imageWidth,
|
||||||
|
imageHeight,
|
||||||
|
BufferedImage.TYPE_INT_ARGB);
|
||||||
|
bi.getGraphics().drawImage(im, 0, 0, null);
|
||||||
|
|
||||||
|
//we can get out-of-memory here
|
||||||
|
imageData = ((DataBufferInt)bi.getData().getDataBuffer()).getData();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
throw new InvalidDnDOperationException("drag image creation problem: " + ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//We shouldn't have user-level exceptions since now.
|
||||||
|
//Any exception leads to corrupted D'n'D state.
|
||||||
|
setNativeContext(nativeCtxtLocal);
|
||||||
WDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(trans);
|
WDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(trans);
|
||||||
|
|
||||||
doDragDrop(getNativeContext(), getCursor());
|
if (imageData != null) {
|
||||||
|
doDragDrop(
|
||||||
|
getNativeContext(),
|
||||||
|
getCursor(),
|
||||||
|
imageData,
|
||||||
|
imageWidth, imageHeight,
|
||||||
|
op.x, op.y);
|
||||||
|
} else {
|
||||||
|
doDragDrop(
|
||||||
|
getNativeContext(),
|
||||||
|
getCursor(),
|
||||||
|
null,
|
||||||
|
-1, -1,
|
||||||
|
0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +159,12 @@ final class WDragSourceContextPeer extends SunDragSourceContextPeer {
|
|||||||
* downcall into native code
|
* downcall into native code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
native void doDragDrop(long nativeCtxt, Cursor cursor);
|
native void doDragDrop(
|
||||||
|
long nativeCtxt,
|
||||||
|
Cursor cursor,
|
||||||
|
int[] imageData,
|
||||||
|
int imgWidth, int imgHight,
|
||||||
|
int offsetX, int offsetY);
|
||||||
|
|
||||||
protected native void setNativeCursor(long nativeCtxt, Cursor c, int cType);
|
protected native void setNativeCursor(long nativeCtxt, Cursor c, int cType);
|
||||||
|
|
||||||
|
@ -895,6 +895,8 @@ public class WToolkit extends SunToolkit implements Runnable {
|
|||||||
Integer.valueOf(50));
|
Integer.valueOf(50));
|
||||||
desktopProperties.put("DnD.Autoscroll.interval",
|
desktopProperties.put("DnD.Autoscroll.interval",
|
||||||
Integer.valueOf(50));
|
Integer.valueOf(50));
|
||||||
|
desktopProperties.put("DnD.isDragImageSupported",
|
||||||
|
Boolean.TRUE);
|
||||||
desktopProperties.put("Shell.shellFolderManager",
|
desktopProperties.put("Shell.shellFolderManager",
|
||||||
"sun.awt.shell.Win32ShellFolderManager2");
|
"sun.awt.shell.Win32ShellFolderManager2");
|
||||||
}
|
}
|
||||||
|
@ -73,3 +73,5 @@ LOCALE=application/x-java-text-encoding;class="[B"
|
|||||||
UniformResourceLocator=application/x-java-url;class=java.net.URL
|
UniformResourceLocator=application/x-java-url;class=java.net.URL
|
||||||
UniformResourceLocator=text/uri-list;eoln="\r\n";terminators=1
|
UniformResourceLocator=text/uri-list;eoln="\r\n";terminators=1
|
||||||
UniformResourceLocator=text/plain;eoln="\r\n";terminators=1
|
UniformResourceLocator=text/plain;eoln="\r\n";terminators=1
|
||||||
|
FileGroupDescriptorW=application/x-java-file-list;class=java.util.List
|
||||||
|
FileGroupDescriptor=application/x-java-file-list;class=java.util.List
|
||||||
|
@ -172,7 +172,7 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
|
|||||||
DWORD ret;
|
DWORD ret;
|
||||||
IP_ADAPTER_ADDRESSES *ptr, *adapters=0;
|
IP_ADAPTER_ADDRESSES *ptr, *adapters=0;
|
||||||
ULONG len=ipinflen, count=0;
|
ULONG len=ipinflen, count=0;
|
||||||
netif *nif=0, *dup_nif, *last=0, *loopif=0;
|
netif *nif=0, *dup_nif, *last=0, *loopif=0, *curr;
|
||||||
int tun=0, net=0;
|
int tun=0, net=0;
|
||||||
|
|
||||||
*netifPP = 0;
|
*netifPP = 0;
|
||||||
@ -197,6 +197,20 @@ int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
|
|||||||
last = nif;
|
last = nif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retrieve IPv4 addresses with the IP Helper API
|
||||||
|
curr = *netifPP;
|
||||||
|
while (curr != NULL) {
|
||||||
|
netaddr *netaddrP;
|
||||||
|
ret = enumAddresses_win(env, curr, &netaddrP);
|
||||||
|
if ((*env)->ExceptionOccurred(env)) {
|
||||||
|
free_netaddr(netaddrP);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
curr->addrs = netaddrP;
|
||||||
|
curr->naddrs += ret;
|
||||||
|
curr = curr->next;
|
||||||
|
}
|
||||||
|
|
||||||
ret = getAdapters (env, &adapters);
|
ret = getAdapters (env, &adapters);
|
||||||
if (ret != ERROR_SUCCESS) {
|
if (ret != ERROR_SUCCESS) {
|
||||||
goto err;
|
goto err;
|
||||||
@ -350,6 +364,14 @@ static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP) {
|
|||||||
/* address is only usable if dad state is preferred or deprecated */
|
/* address is only usable if dad state is preferred or deprecated */
|
||||||
if (uni_addr->DadState == IpDadStateDeprecated ||
|
if (uni_addr->DadState == IpDadStateDeprecated ||
|
||||||
uni_addr->DadState == IpDadStatePreferred) {
|
uni_addr->DadState == IpDadStatePreferred) {
|
||||||
|
sock = uni_addr->Address.lpSockaddr;
|
||||||
|
|
||||||
|
// IPv4 addresses already retrieved with enumAddresses_win
|
||||||
|
if (sock->sa_family == AF_INET) {
|
||||||
|
uni_addr = uni_addr->Next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
curr = (netaddr *)calloc (1, sizeof (netaddr));
|
curr = (netaddr *)calloc (1, sizeof (netaddr));
|
||||||
if (curr == 0) {
|
if (curr == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -361,15 +383,9 @@ static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP) {
|
|||||||
prev->next = curr;
|
prev->next = curr;
|
||||||
}
|
}
|
||||||
prev = curr;
|
prev = curr;
|
||||||
sock = uni_addr->Address.lpSockaddr;
|
|
||||||
SOCKETADDRESS_COPY (&curr->addr, sock);
|
SOCKETADDRESS_COPY (&curr->addr, sock);
|
||||||
if (prefix != NULL) {
|
if (prefix != NULL) {
|
||||||
curr->mask = (short)prefix->PrefixLength;
|
curr->mask = (short)prefix->PrefixLength;
|
||||||
if (sock->sa_family == AF_INET) {
|
|
||||||
sock = prefix->Address.lpSockaddr;
|
|
||||||
SOCKETADDRESS_COPY(&curr->brdcast, sock);
|
|
||||||
curr->brdcast.him4.sin_addr.s_addr |= htonl((0xffffffff >> curr->mask));
|
|
||||||
}
|
|
||||||
prefix = prefix->Next;
|
prefix = prefix->Next;
|
||||||
}
|
}
|
||||||
count ++;
|
count ++;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -233,4 +233,122 @@ extern JavaVM *jvm;
|
|||||||
#define CHECK_ISNOT_TOOLKIT_THREAD()
|
#define CHECK_ISNOT_TOOLKIT_THREAD()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct EnvHolder
|
||||||
|
{
|
||||||
|
JavaVM *m_pVM;
|
||||||
|
JNIEnv *m_env;
|
||||||
|
bool m_isOwner;
|
||||||
|
EnvHolder(
|
||||||
|
JavaVM *pVM,
|
||||||
|
LPCSTR name = "COM holder",
|
||||||
|
jint ver = JNI_VERSION_1_2)
|
||||||
|
: m_pVM(pVM),
|
||||||
|
m_env((JNIEnv *)JNU_GetEnv(pVM, ver)),
|
||||||
|
m_isOwner(false)
|
||||||
|
{
|
||||||
|
if (NULL == m_env) {
|
||||||
|
JavaVMAttachArgs attachArgs;
|
||||||
|
attachArgs.version = ver;
|
||||||
|
attachArgs.name = const_cast<char *>(name);
|
||||||
|
attachArgs.group = NULL;
|
||||||
|
jint status = m_pVM->AttachCurrentThread(
|
||||||
|
(void**)&m_env,
|
||||||
|
&attachArgs);
|
||||||
|
m_isOwner = (NULL!=m_env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~EnvHolder() {
|
||||||
|
if (m_isOwner) {
|
||||||
|
m_pVM->DetachCurrentThread();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
operator bool() const { return NULL!=m_env; }
|
||||||
|
bool operator !() const { return NULL==m_env; }
|
||||||
|
operator JNIEnv*() const { return m_env; }
|
||||||
|
JNIEnv* operator ->() const { return m_env; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class JLocalRef {
|
||||||
|
JNIEnv* m_env;
|
||||||
|
T m_localJRef;
|
||||||
|
|
||||||
|
public:
|
||||||
|
JLocalRef(JNIEnv* env, T localJRef = NULL)
|
||||||
|
: m_env(env),
|
||||||
|
m_localJRef(localJRef)
|
||||||
|
{}
|
||||||
|
T Detach() {
|
||||||
|
T ret = m_localJRef;
|
||||||
|
m_localJRef = NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
void Attach(T newValue) {
|
||||||
|
if (m_localJRef) {
|
||||||
|
m_env->DeleteLocalRef((jobject)m_localJRef);
|
||||||
|
}
|
||||||
|
m_localJRef = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
operator T() { return m_localJRef; }
|
||||||
|
operator bool() { return NULL!=m_localJRef; }
|
||||||
|
bool operator !() { return NULL==m_localJRef; }
|
||||||
|
|
||||||
|
~JLocalRef() {
|
||||||
|
if (m_localJRef) {
|
||||||
|
m_env->DeleteLocalRef((jobject)m_localJRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef JLocalRef<jobject> JLObject;
|
||||||
|
typedef JLocalRef<jstring> JLString;
|
||||||
|
typedef JLocalRef<jclass> JLClass;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class to encapsulate the extraction of the java string contents
|
||||||
|
* into a buffer and the cleanup of the buffer
|
||||||
|
*/
|
||||||
|
class JavaStringBuffer
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
LPWSTR m_pStr;
|
||||||
|
jsize m_dwSize;
|
||||||
|
|
||||||
|
public:
|
||||||
|
JavaStringBuffer(jsize cbTCharCount) {
|
||||||
|
m_dwSize = cbTCharCount;
|
||||||
|
m_pStr = (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
|
||||||
|
}
|
||||||
|
|
||||||
|
JavaStringBuffer(JNIEnv *env, jstring text) {
|
||||||
|
if (NULL == text) {
|
||||||
|
m_pStr = L"";
|
||||||
|
m_dwSize = 0;
|
||||||
|
} else {
|
||||||
|
m_dwSize = env->GetStringLength(text);
|
||||||
|
m_pStr = (LPWSTR)safe_Malloc( (m_dwSize+1)*sizeof(WCHAR) );
|
||||||
|
env->GetStringRegion(text, 0, m_dwSize, reinterpret_cast<jchar *>(m_pStr));
|
||||||
|
m_pStr[m_dwSize] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
~JavaStringBuffer() {
|
||||||
|
free(m_pStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Resize(jsize cbTCharCount) {
|
||||||
|
m_dwSize = cbTCharCount;
|
||||||
|
m_pStr = (LPWSTR)safe_Realloc(m_pStr, (m_dwSize+1)*sizeof(WCHAR) );
|
||||||
|
}
|
||||||
|
//we are in UNICODE now, so LPWSTR:=:LPTSTR
|
||||||
|
operator LPWSTR() { return m_pStr; }
|
||||||
|
operator LPARAM() { return (LPARAM)m_pStr; }
|
||||||
|
void *GetData() { return (void *)m_pStr; }
|
||||||
|
jsize GetSize() { return m_dwSize; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* _AWT_H_ */
|
#endif /* _AWT_H_ */
|
||||||
|
@ -378,7 +378,9 @@ LRESULT CALLBACK AwtComponent::WndProc(HWND hWnd, UINT message,
|
|||||||
TRY;
|
TRY;
|
||||||
|
|
||||||
AwtComponent * self = AwtComponent::GetComponentImpl(hWnd);
|
AwtComponent * self = AwtComponent::GetComponentImpl(hWnd);
|
||||||
if (self == NULL || self->GetHWnd() != hWnd) {
|
if (self == NULL || self->GetHWnd() != hWnd ||
|
||||||
|
message == WM_UNDOCUMENTED_CLIENTSHUTDOWN) // handle log-off gracefully
|
||||||
|
{
|
||||||
return ComCtl32Util::GetInstance().DefWindowProc(NULL, hWnd, message, wParam, lParam);
|
return ComCtl32Util::GetInstance().DefWindowProc(NULL, hWnd, message, wParam, lParam);
|
||||||
} else {
|
} else {
|
||||||
return self->WindowProc(message, wParam, lParam);
|
return self->WindowProc(message, wParam, lParam);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user