Commit 8aa540d2 by Mark Wielaard

Imported GNU Classpath 0.90

       Imported GNU Classpath 0.90
       * scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
       * gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
       * java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
       * java/lang/Math.java: New override file.
       * java/lang/Character.java: Merged from Classpath.
       (start, end): Now 'int's.
       (canonicalName): New field.
       (CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
       (UnicodeBlock): Added argument.
       (of): New overload.
       (forName): New method.
       Updated unicode blocks.
       (sets): Updated.
       * sources.am: Regenerated.
       * Makefile.in: Likewise.

From-SVN: r111942
parent 27079765

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

2006-03-09 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
2006-03-09 Tom Tromey <tromey@redhat.com>
PR libgcj/23495:
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding=".externalToolBuilders/|.settings/|ChangeLog*|Makefile*|autom4te.cache/|compat/|config*|doc/|examples/|external/|gnu/javax/swing/plaf/|include/|install/|lib/|m4/|native/|resource/|scripts/|test/|testsuite/|vm/reference/" kind="src" path=""/>
<classpathentry excluding=".externalToolBuilders/|.settings/|ChangeLog*|Makefile*|autom4te.cache/|compat/|config*|doc/|examples/|external/|gnu/javax/swing/plaf/|include/|install/|lib/|m4/|native/|resource/|scripts/|test/|testsuite/|vm/reference/|tools/|external/relaxngDatatype/" kind="src" path=""/>
<classpathentry kind="src" path="external/relaxngDatatype"/>
<classpathentry kind="src" path="tools"/>
<classpathentry kind="src" path="resource"/>
<classpathentry kind="src" path="vm/reference"/>
<classpathentry kind="src" path="external/sax"/>
......
......@@ -36,6 +36,11 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
......@@ -56,11 +61,6 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
......
#Tue Sep 13 16:15:04 MDT 2005
#Tue Feb 07 05:21:36 EST 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
......@@ -72,14 +72,15 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=17
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=17
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
......@@ -111,7 +112,7 @@ org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
......@@ -128,7 +129,7 @@ org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
......@@ -198,7 +199,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
......@@ -302,3 +303,4 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
......@@ -22,6 +22,7 @@ Anthony Green (green@redhat.com)
Jochen Hoenicke (Jochen.Hoenicke@Informatik.Uni-Oldenburg.de)
Kazumitsu Ito (kaz@maczuka.gcd.org)
Andrew John Hughes (gnu_andrew@member.fsf.org)
Olivier Jolly (olivier.jolly@pcedev.com)
Brian Jones (cbj@gnu.org)
Roman Kennke (roman@kennke.org)
Michael Koch (konqueror@gmx.de)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -298,3 +298,51 @@ terms:
for any purpose is hereby granted without fee, provided that the
above copyright notice and this permission notice are included in
all copies or substantial portions of the software.
Directory external/relaxngDatatype
RELAX NG Pluggable Datatype Libraries. All files are distributed under
the following notice:
Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun
Microsystems. 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 names of the copyright holders 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 REGENTS 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.
## Input file for automake to generate the Makefile.in used by configure
# lib first, to compile .class files before native code, last examples
SUBDIRS = lib doc external include native resource scripts $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts examples
SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples
## GCJ LOCAL: we need an extra -I here.
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
......
......@@ -96,6 +96,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -103,6 +104,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -133,6 +136,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -144,6 +148,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -194,6 +200,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......@@ -273,8 +280,8 @@ target_vendor = @target_vendor@
vm_classes = @vm_classes@
# lib first, to compile .class files before native code, last examples
SUBDIRS = lib doc external include native resource scripts $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts examples
SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 \
......
New in release 0.90 (March 6, 2006)
* Free Swing improvements: JTable columns are rearrangeable and
resizeable with mouse. Painting and scrolling are now much
faster. Plain text components now support highlighting and
copy+paste to the system clipboard. Support for styled text has been
improved, including some very basic HTML support. JFileChooser is
now usable. Global event dispatching has been implemented. Memory
consumption of Swing components has been reduced. Lots of general
bugfixes. Added new system property to turn off Graphics2D use in
Swing, even if Graphics2D is available: gnu.javax.swing.noGraphics2D
* AWT. Improved support for mixing "lightweight" and "heavyweight"
Components in Containers. Better support for dynamically updated
menus. Better 1.0 event model support for Scrollbars. Better class
documentation of gtk+ awt peers.
* GNU Crypto and Jessie have been merged into GNU Classpath; this
provides Classpath with a wide array of cryptographic algorithms
(ciphers, message digests, etc.) and implementations of SSL version
3 and TLS version 1. These roughly complement the public
`java.security.' `javax.crypto,' and `javax.net.ssl' packages, and
are service providers implementing the underlying algorithms.
* Updated HTTP and FTP URLConnection protocol handlers. HTTPS support
out of the box.
* Unicode 4.0.0 is supported. Character now includes support for using
ether a char or an int to identify code points.
* More correct handling of Object methods and serialization support
for Proxy and abstract classes.
* The new folder tools includes GIOP and RMI stub and tie source code
generators, IOR parser and both transient and persistent GIOP naming
services.
* Added experimental support for dynamic creation of the RMI stubs
using proxy classes. The rmic compiler is no longer required (unless
for research and specific stubs).
* XML validaton support for RELAX NG and W3C XML schema namespace
URIs. RELAX NG pluggable XML schema datatype library API and an
implementation for XML Schema Datatypes
(http://www.w3.org/TR/xmlschema-2/).
* Updated StAX implementaton to be compatible with final JSWDP 2.0.
* The default back end for java.util.prefs has been changed. The new
default is capable of saving and restoring preferences to and from
the file system.
* javax.imageio.plugins.bmp implementation.
* Added --enable-collections configure option which builds
"collections.jar", a 1.1 VM compatibility jar.
* gnu.regexp updated from GNU/Posix syntax to support util.regex
syntax including various Unicode blocks, categories and properties.
Runtime interface changes:
* A new class, VMMath, is now available which separates the native
mathematical functions from java.lang.Math. The previous fdlibm
implementation now forms the reference material for this class.
* Updated VMObjectInputStream class to return Thread context class
loader if no other class loader is found.
* Updated documentation on InstrumentationImpl in vmintegration guide.
New in release 0.20 (Jan 13, 2006)
* New StAX pull parser and SAX-over-StAX driver. Lots of DOM, SAX/StAX,
......
......@@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
AC_INIT([GNU Classpath],[0.20],[classpath@gnu.org],[classpath])
AC_INIT([GNU Classpath],[0.90],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
AC_CANONICAL_TARGET
......@@ -39,6 +39,20 @@ AC_CONFIG_HEADERS([include/config.h])
AC_PREFIX_DEFAULT(/usr/local/classpath)
dnl -----------------------------------------------------------
dnl Enable collections.jar (disabled by default)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([collections],
[AS_HELP_STRING(--enable-collections,create collections.jar [default=no])],
[case x"${enableval}" in
xyes) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
xno) COMPILE_COLLECTIONS=no ;;
x) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
*) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"${enableval}\"" ;;
esac],
[COMPILE_COLLECTIONS=no])
AM_CONDITIONAL(CREATE_COLLECTIONS, test "x${COMPILE_COLLECTIONS}" = xyes)
dnl -----------------------------------------------------------
dnl Enable JNI libraries (enabled by default)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([jni],
......@@ -238,6 +252,14 @@ AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
if test "x${COMPILE_COLLECTIONS}" = xyes; then
AC_PATH_PROG(PERL, [perl])
AC_SUBST(PERL)
AC_SUBST(COLLECTIONS_PREFIX)
AC_CONFIG_FILES([lib/mkcollections.pl])
AC_CONFIG_COMMANDS([mkcollections.pl],[chmod 755 lib/mkcollections.pl])
fi
if test "x${COMPILE_JNI}" = xyes; then
AC_HEADER_STDC
......@@ -359,12 +381,15 @@ if test "x${COMPILE_JNI}" = xyes; then
PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
fi
PKG_CHECK_MODULES(FREETYPE2, freetype2)
PKG_CHECK_MODULES(PANGOFT2, pangoft2)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(CAIRO_LIBS)
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(FREETYPE2_LIBS)
AC_SUBST(FREETYPE2_CFLAGS)
AC_SUBST(PANGOFT2_LIBS)
AC_SUBST(PANGOFT2_CFLAGS)
fi
......@@ -572,6 +597,7 @@ doc/api/Makefile
external/Makefile
external/sax/Makefile
external/w3c_dom/Makefile
external/relaxngDatatype/Makefile
gnu/classpath/Configuration.java
include/Makefile
native/Makefile
......@@ -598,6 +624,7 @@ scripts/classpath.spec
lib/Makefile
lib/gen-classlist.sh
lib/copy-vmresources.sh
tools/Makefile
examples/Makefile
examples/Makefile.jawt])
AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
......
......@@ -80,6 +80,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -87,6 +88,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -117,6 +120,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -128,6 +132,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -178,6 +184,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......
......@@ -30,6 +30,7 @@ classes in the above packages.
. org.xml.sax.* ... SAX2 interfaces
. org.w3c.dom.* ... DOM Level 3 interfaces
. org.relaxng.datatype.* ... RELAX NG pluggable datatypes API
CONFORMANCE
......@@ -175,3 +176,29 @@ using thread context variables.
Update: thread context variables have been introduced. This is very
untested though, libxmll therefore still has the single thread
bottleneck.
Validation
===================================================
Pluggable datatypes
---------------------------------------------------
Validators should use the RELAX NG pluggable datatypes API to retrieve
datatype (XML Schema simple type) implementations in a schema-neutral
fashion. The following code demonstrates looking up a W3C XML Schema
nonNegativeInteger datatype:
DatatypeLibrary xsd = DatatypeLibraryLoader
.createDatatypeLibrary(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Datatype nonNegativeInteger = xsd.createDatatype("nonNegativeInteger");
It is also possible to create new types by derivation. For instance,
to create a datatype that will match a US ZIP code:
DatatypeBuilder b = xsd.createDatatypeBuilder("string");
b.addParameter("pattern", "(^[0-9]{5}$)|(^[0-9]{5}-[0-9]{4}$)");
Datatype zipCode = b.createDatatype();
A datatype library implementation for XML Schema is provided; other
library implementations may be added.
......@@ -44,6 +44,7 @@ create_html:
-licensetext \
-linksource \
-splitindex \
-validhtml \
-d html \
-doctitle "GNU Classpath $(VERSION)" \
-windowtitle "GNU Classpath $(VERSION) Documentation" \
......
......@@ -73,6 +73,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -80,6 +81,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -110,6 +113,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -121,6 +125,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -171,6 +177,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......@@ -449,6 +456,7 @@ create_html:
-licensetext \
-linksource \
-splitindex \
-validhtml \
-d html \
-doctitle "GNU Classpath $(VERSION)" \
-windowtitle "GNU Classpath $(VERSION) Documentation" \
......
# Blocks-4.0.0.txt
# Correlated with Unicode 4.0
# Note: The casing of block names is not normative.
# For example, "Basic Latin" and "BASIC LATIN" are equivalent.
#
# Code points not explicitly listed in this file are given the value No_Block.
#
# Start Code..End Code; Block Name
0000..007F; Basic Latin
0080..00FF; Latin-1 Supplement
0100..017F; Latin Extended-A
0180..024F; Latin Extended-B
0250..02AF; IPA Extensions
02B0..02FF; Spacing Modifier Letters
0300..036F; Combining Diacritical Marks
0370..03FF; Greek and Coptic
0400..04FF; Cyrillic
0500..052F; Cyrillic Supplementary
0530..058F; Armenian
0590..05FF; Hebrew
0600..06FF; Arabic
0700..074F; Syriac
0780..07BF; Thaana
0900..097F; Devanagari
0980..09FF; Bengali
0A00..0A7F; Gurmukhi
0A80..0AFF; Gujarati
0B00..0B7F; Oriya
0B80..0BFF; Tamil
0C00..0C7F; Telugu
0C80..0CFF; Kannada
0D00..0D7F; Malayalam
0D80..0DFF; Sinhala
0E00..0E7F; Thai
0E80..0EFF; Lao
0F00..0FFF; Tibetan
1000..109F; Myanmar
10A0..10FF; Georgian
1100..11FF; Hangul Jamo
1200..137F; Ethiopic
13A0..13FF; Cherokee
1400..167F; Unified Canadian Aboriginal Syllabics
1680..169F; Ogham
16A0..16FF; Runic
1700..171F; Tagalog
1720..173F; Hanunoo
1740..175F; Buhid
1760..177F; Tagbanwa
1780..17FF; Khmer
1800..18AF; Mongolian
1900..194F; Limbu
1950..197F; Tai Le
19E0..19FF; Khmer Symbols
1D00..1D7F; Phonetic Extensions
1E00..1EFF; Latin Extended Additional
1F00..1FFF; Greek Extended
2000..206F; General Punctuation
2070..209F; Superscripts and Subscripts
20A0..20CF; Currency Symbols
20D0..20FF; Combining Diacritical Marks for Symbols
2100..214F; Letterlike Symbols
2150..218F; Number Forms
2190..21FF; Arrows
2200..22FF; Mathematical Operators
2300..23FF; Miscellaneous Technical
2400..243F; Control Pictures
2440..245F; Optical Character Recognition
2460..24FF; Enclosed Alphanumerics
2500..257F; Box Drawing
2580..259F; Block Elements
25A0..25FF; Geometric Shapes
2600..26FF; Miscellaneous Symbols
2700..27BF; Dingbats
27C0..27EF; Miscellaneous Mathematical Symbols-A
27F0..27FF; Supplemental Arrows-A
2800..28FF; Braille Patterns
2900..297F; Supplemental Arrows-B
2980..29FF; Miscellaneous Mathematical Symbols-B
2A00..2AFF; Supplemental Mathematical Operators
2B00..2BFF; Miscellaneous Symbols and Arrows
2E80..2EFF; CJK Radicals Supplement
2F00..2FDF; Kangxi Radicals
2FF0..2FFF; Ideographic Description Characters
3000..303F; CJK Symbols and Punctuation
3040..309F; Hiragana
30A0..30FF; Katakana
3100..312F; Bopomofo
3130..318F; Hangul Compatibility Jamo
3190..319F; Kanbun
31A0..31BF; Bopomofo Extended
31F0..31FF; Katakana Phonetic Extensions
3200..32FF; Enclosed CJK Letters and Months
3300..33FF; CJK Compatibility
3400..4DBF; CJK Unified Ideographs Extension A
4DC0..4DFF; Yijing Hexagram Symbols
4E00..9FFF; CJK Unified Ideographs
A000..A48F; Yi Syllables
A490..A4CF; Yi Radicals
AC00..D7AF; Hangul Syllables
D800..DB7F; High Surrogates
DB80..DBFF; High Private Use Surrogates
DC00..DFFF; Low Surrogates
E000..F8FF; Private Use Area
F900..FAFF; CJK Compatibility Ideographs
FB00..FB4F; Alphabetic Presentation Forms
FB50..FDFF; Arabic Presentation Forms-A
FE00..FE0F; Variation Selectors
FE20..FE2F; Combining Half Marks
FE30..FE4F; CJK Compatibility Forms
FE50..FE6F; Small Form Variants
FE70..FEFF; Arabic Presentation Forms-B
FF00..FFEF; Halfwidth and Fullwidth Forms
FFF0..FFFF; Specials
10000..1007F; Linear B Syllabary
10080..100FF; Linear B Ideograms
10100..1013F; Aegean Numbers
10300..1032F; Old Italic
10330..1034F; Gothic
10380..1039F; Ugaritic
10400..1044F; Deseret
10450..1047F; Shavian
10480..104AF; Osmanya
10800..1083F; Cypriot Syllabary
1D000..1D0FF; Byzantine Musical Symbols
1D100..1D1FF; Musical Symbols
1D300..1D35F; Tai Xuan Jing Symbols
1D400..1D7FF; Mathematical Alphanumeric Symbols
20000..2A6DF; CJK Unified Ideographs Extension B
2F800..2FA1F; CJK Compatibility Ideographs Supplement
E0000..E007F; Tags
E0100..E01EF; Variation Selectors Supplement
F0000..FFFFF; Supplementary Private Use Area-A
100000..10FFFF; Supplementary Private Use Area-B
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -227,6 +227,7 @@ become operable.
* java.lang.VMString::
* java.lang.VMThread::
* java.lang.VMInstrumentationImpl::
* java.lang.VMMath::
@end menu
@node java.lang.VMClass, java.lang.VMObject ,java.lang,java.lang
......@@ -684,17 +685,18 @@ having returned true, and is thus deprecated as a result.
@end itemize
@end itemize
@node java.lang.VMInstrumentationImpl,, java.lang.VMThread, java.lang
@node java.lang.VMInstrumentationImpl, java.lang.VMMath, java.lang.VMThread, java.lang
@subsection @code{java.lang.VMInstrumentationImpl}
The @code{java.lang.VMInstrumentationImpl} and
@code{java.lang.InstrumentationImpl} provides an implementation of the
@code{java.lang.InstrumentationImpl} classes provide an implementation of the
@code{java.lang.instrument.Instrument} interface. This interface is for java
1.5 and is only in the generics branch.
A @code{InstrumentationImpl} object should be given to any agent
given in the command line (see the @code{java.lang.instrument} package
documentation). A VM has to implement the static native methods of the
@code{VMInstrumentationImpl} class.
A @code{InstrumentationImpl} object should be created by the VM when agents
are given in the command line (see the @code{java.lang.instrument} package
documentation). The VM has to set the static field
@code{VMClassLoader.instrumenter} to this object. The VM should implement the
static native methods of the @code{VMInstrumentationImpl} class.
@itemize @bullet
@item @code{isRedefineClassesSupported()} -- Returns true if the JVM supports
......@@ -707,21 +709,72 @@ by a specific class loader.
@item @code{getObjectSize()} -- Gives the size of an object.
@end itemize
When agents are defined, the VM has to call transformers of the
@code{InstrumentImpl} object each time a class is loaded, eg a call to
@code{VMClassLoader.defineClass}. The @code{InstrumentationImpl} class defines
a method that has to be called before reading a class file in the VM.
Instrumentation allows to modify the bytecode of a class before it gets read
by the VM. In GNU Classpath, the @code{ClassLoader.defineClass} method calls
the @code{VMClassLoader.defineClassWithTransformers} method which first checks
if @code{VMClassLoader.instrumenter} is @code{null}. If it's the case, it
directly calls @code{VMClassLoader.defineClass}. If it's not the case, the
method calls at first the @code{InstrumentationImpl.callTransformers} method,
which calls each transformer registered to the @code{InstrumentationImpl}
object and returns a new bytecode array. Then, it calls the
@code{VMClassLoader.defineClass} method with this new bytecode array.
The second use of instrumentation is to redefine a class after it has been
loaded by the VM. This is done in the Java application by calling the
@code{Instrumentation.redefineClasses} method of the standard interface on
a @code{Instrumentation} object. The @code{InstrumentationImpl.redefineClasses}
method calls the @code{VMInstrumentationImpl.redefineClasses} native method
which must be implemented by the VM. The implementation should call the
@code{InstrumentationImpl.callTransformers} method.
@node java.lang.VMMath, , java.lang.VMInstrumentationImpl, java.lang
@subsection @code{java.lang.VMMath}
The @code{VMMath} class provides a series of native methods
for some of the mathematical functions present in @code{java.lang.Math}.
Classpath provides a default implementation of these which maps the
functions to those provided by @code{fdlibm}. VM implementors are welcome
to replace this with more efficent implementations, as long as the accuracy
contract of these methods, specified in @code{java.lang.Math}, is maintained.
@itemize @bullet
@item @code{callTransformers} -- Calls each transformer registered to
the @code{InstrumentationImpl} object and returns a new bytecode file.
@item 1.0
@itemize @bullet
@item @code{sin(double)} -- Returns the sine value for the given angle.
@item @code{cos(double)} -- Returns the cosine value for the given angle.
@item @code{tan(double)} -- Returns the tangent value for the given angle.
@item @code{asin(double)} -- Returns the arc sine value for the given angle.
@item @code{acos(double)} -- Returns the arc cosine value for the given angle.
@item @code{atan(double)} -- Returns the arc tangent value for the given angle.
@item @code{atan2(double,double)} -- Returns the arc tangent of the ratio of
the two arguments.
@item @code{exp(double)} -- Returns the exponent raised to the given power.
@item @code{log(double)} -- Returns the natural logarithm for the given value.
@item @code{sqrt(double)} -- Returns the square root of the value.
@item @code{pow(double,double)} -- Returns x to the power of y.
@item @code{IEEEremainder(double,double)} -- Returns the IEEE 754 remainder
for the two values.
@item @code{ceil(double)} -- Returns the nearest integer >= the value.
@item @code{floor(double)} -- Returns the nearest integer <= the value.
@item @code{rint(double)} -- Returns the nearest integer or the even one
if the distance between the two is equal.
@end itemize
@item 1.5
@itemize @bullet
@item @code{cbrt(double)} -- Returns the cube root of the value.
@item @code{cosh(double)} -- Returns the hyperbolic cosine value for the given
angle.
@item @code{expm1(double)} -- Returns the exponent of the value minus one.
@item @code{hypot(double,double)} -- Returns the hypotenuse corresponding to
x and y.
@item @code{log10(double)} -- Returns the base 10 logarithm of the given value.
@item @code{log1p(double)} -- Returns the natural logarithm of the value plus
one.
@item @code{sinh(double)} -- Returns the hyperbolic sine value for the given
angle.
@item @code{tanh(double)} -- Returns the hyperbolic tangent value for the given angle.
@end itemize
@end itemize
No default implementation is provided in gnu classpath for the
@code{VMInstrumentationImpl} methods. A default implementation will perhaps
be written, but it might break the @code{ClassLoader/VMClassLoader} interface
for calling the @code{InstrumentationImpl.callTransformers} when a class byte
code is defined with @code{ClassLoader.defineClass}.
@node gnu.classpath, java.util, java.lang, Classpath Hooks
@section @code{gnu.classpath}
......
......@@ -77,10 +77,10 @@ sub mylink {
<download-block>
<download
date="02 November 2005"
version="0.19"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.19.tar.gz"
notes="http://www.gnu.org/software/classpath/announce/20051102.html"
date="13 January 2006"
version="0.20"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.20.tar.gz"
notes="http://www.gnu.org/software/classpath/announce/20060113.html"
>
<!-- download
......@@ -100,6 +100,12 @@ sub mylink {
<download-block>
<download
date="02 November 2005"
version="0.19"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.19.tar.gz"
notes="http://www.gnu.org/software/classpath/announce/20051102.html"
>
<download
date="06 September 2005"
version="0.18"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.18.tar.gz"
......
......@@ -3,6 +3,11 @@
url="events/fosdem06.html">
</newsitem>
<newsitem date="13 Jan 2006">
<createlink name="GNU Classpath 0.20"
url="announce/20060113.html">
</newsitem>
<newsitem date="02 Nov 2005">
<createlink name="GNU Classpath 0.19"
url="announce/20051102.html">
......
......@@ -95,7 +95,10 @@ $(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
mkdir -p classes/gnu/classpath/examples/icons
cp $(EXAMPLE_ICONS) classes/gnu/classpath/examples/icons
$(JCOMPILER) -d classes $(EXAMPLE_JAVA_FILES)
cd classes; $(ZIP) -r ../$(EXAMPLE_ZIP) .; cd ..
(cd classes; \
if test "$(ZIP)" != ""; then $(ZIP) -r ../$(EXAMPLE_ZIP) .; fi; \
if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(EXAMPLE_ZIP) .; fi; \
cd ..)
rm -rf classes
# Zip file be gone! (and make sure the classes are gone too)
......
......@@ -82,6 +82,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -89,6 +90,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -119,6 +122,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -130,6 +134,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -180,6 +186,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......@@ -532,7 +539,10 @@ $(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
mkdir -p classes/gnu/classpath/examples/icons
cp $(EXAMPLE_ICONS) classes/gnu/classpath/examples/icons
$(JCOMPILER) -d classes $(EXAMPLE_JAVA_FILES)
cd classes; $(ZIP) -r ../$(EXAMPLE_ZIP) .; cd ..
(cd classes; \
if test "$(ZIP)" != ""; then $(ZIP) -r ../$(EXAMPLE_ZIP) .; fi; \
if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(EXAMPLE_ZIP) .; fi; \
cd ..)
rm -rf classes
# Zip file be gone! (and make sure the classes are gone too)
......
......@@ -433,7 +433,6 @@ public class PlayingDesk
else
{
blacks.add(new Point(x, y));
repaint();
if (victory != null)
{
......@@ -448,6 +447,7 @@ public class PlayingDesk
+ ". Your move?");
player.set_current_state(I_THINK);
}
repaint();
}
}
catch (RemoteException rex)
......
......@@ -57,13 +57,8 @@ import org.omg.PortableServer.Servant;
* Tie on the client side. The Game Manager methods contain the code for remote
* invocation.
*
* This class is normally generated with rmic from the {@link GameManagerImpl}:
*
* <pre>
* rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
* </pre>
*
* (the compiled package must be present in the current folder).
* This class is normally generated with rmic or grmic from the
* {@link GameManagerImpl}. See tools/gnu/classpath/tools/giop/README.
*
* In this example the class was manually edited and commented for better
* understanding of functionality.
......
......@@ -58,11 +58,8 @@ import org.omg.PortableServer.Servant;
* rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
* (the compiled package must be present in the current folder).
*
* This class is normally generated with rmic from the {@link PlayerImpl}:
* <pre>
* rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
* </pre>
* (the compiled package must be present in the current folder).
* This class is normally generated with rmic or grmic from the
* {@link PlayerImpl}. See tools/gnu/classpath/tools/giop/README.
*
* In this example the class was manually edited and commented for better
* understanding of functionality.
......
/* ButtonDemo.java -- An example showing various buttons in Swing.
Copyright (C) 2005, Free Software Foundation, Inc.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -46,6 +46,8 @@ public class ButtonDemo
implements ActionListener
{
private JPanel content;
private JCheckBox buttonState;
private JButton button1;
private JButton button2;
......@@ -77,6 +79,19 @@ public class ButtonDemo
{
super(title);
JPanel content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
......@@ -95,13 +110,16 @@ public class ButtonDemo
*/
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
if (content == null)
{
content = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(4, 1));
panel.add(createButtonPanel());
panel.add(createTogglePanel());
panel.add(createCheckBoxPanel());
panel.add(createRadioPanel());
content.add(panel);
}
return content;
}
......@@ -277,6 +295,7 @@ public class ButtonDemo
public static void main(String[] args)
{
ButtonDemo app = new ButtonDemo("Button Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
......
/* ComboBoxDemo.java -- An example showing various combo boxes in Swing.
Copyright (C) 2005, Free Software Foundation, Inc.
Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -69,6 +69,7 @@ public class ComboBoxDemo
}
}
private JPanel content;
private JCheckBox comboState1;
private JComboBox combo1;
private JComboBox combo2;
......@@ -102,6 +103,19 @@ public class ComboBoxDemo
{
super(title);
JPanel content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
......@@ -120,7 +134,9 @@ public class ComboBoxDemo
*/
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
if (content == null)
{
content = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(6, 1));
panel.add(createPanel1());
panel.add(createPanel2());
......@@ -129,6 +145,7 @@ public class ComboBoxDemo
panel.add(createPanel5());
panel.add(createPanel6());
content.add(panel);
}
return content;
}
......@@ -353,6 +370,7 @@ public class ComboBoxDemo
e.printStackTrace();
}
ComboBoxDemo app = new ComboBoxDemo("ComboBox Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
......
/* SwingDemo.java -- An example of using the javax.swing UI.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -164,18 +164,6 @@ public class Demo
(new ButtonDemo("Button Demo")).createContent(),
examples);
new PopUpAction("Toggles",
mkToggle("cool and refreshing"),
examples);
new PopUpAction("Checkbox",
mkCheckbox("ice cold"),
examples);
new PopUpAction("Radio",
mkRadio("delicious"),
examples);
new PopUpAction("Slider",
(new SliderDemo("Slider Demo")).createContent(),
examples);
......@@ -214,8 +202,7 @@ public class Demo
examples);
new PopUpAction("Spinner",
mkSpinner(),
examples);
new SpinnerDemo("Spinner Demo").createContent(), examples);
new PopUpAction("TextField",
(new TextFieldDemo("TextField Demo")).createContent(),
......@@ -715,6 +702,7 @@ public class Demo
main.add(mkButtonBar());
component.add(main, BorderLayout.CENTER);
frame.pack();
frame.setSize(800, 600);
frame.show();
}
......@@ -732,26 +720,6 @@ public class Demo
SwingUtilities.invokeLater(new LaterMain());
}
public static JCheckBox mkCheckbox(String label)
{
JCheckBox c = new JCheckBox(label);
c.setFont(new Font("Luxi", Font.PLAIN, 14));
return c;
}
public static JPanel mkRadio(String label)
{
JPanel p = new JPanel();
JRadioButton c = new JRadioButton(label);
JRadioButton d = new JRadioButton("not " + label);
ButtonGroup bg = new ButtonGroup();
bg.add(c);
bg.add(d);
p.add(c);
p.add(d);
return p;
}
public static JList mkList(Object[] elts)
{
JList list = new JList(elts);
......@@ -775,12 +743,6 @@ public class Demo
return box;
}
public static JSpinner mkSpinner()
{
JSpinner spinner = new JSpinner();
return spinner;
}
public static JButton mkBigButton(String title)
{
JButton b = new JButton(title);
......@@ -789,14 +751,6 @@ public class Demo
return b;
}
public static JToggleButton mkToggle(String title)
{
JToggleButton b = new JToggleButton(title);
b.setMargin(new Insets(5,5,5,5));
b.setFont(new Font("Luxi", Font.PLAIN, 14));
return b;
}
public static JPanel mkPanel(JComponent[] inners)
{
JPanel p = new JPanel();
......@@ -947,37 +901,16 @@ public class Demo
return editorPane;
}
private static JTree mkTree()
/**
* Create the tree.
*
* @return thr scroll pane, containing the tree.
*/
private static JComponent mkTree()
{
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node");
DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child node 1");
DefaultMutableTreeNode child11 =
new DefaultMutableTreeNode("Child node 1.1");
DefaultMutableTreeNode child12 =
new DefaultMutableTreeNode("Child node 1.2");
DefaultMutableTreeNode child13 =
new DefaultMutableTreeNode("Child node 1.3");
DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child node 2");
DefaultMutableTreeNode child21 =
new DefaultMutableTreeNode("Child node 2.1");
DefaultMutableTreeNode child22 =
new DefaultMutableTreeNode("Child node 2.2");
DefaultMutableTreeNode child23 =
new DefaultMutableTreeNode("Child node 2.3");
DefaultMutableTreeNode child24 =
new DefaultMutableTreeNode("Child node 2.4");
DefaultMutableTreeNode child3 = new DefaultMutableTreeNode("Child node 3");
root.add(child1);
root.add(child2);
root.add(child3);
child1.add(child11);
child1.add(child12);
child1.add(child13);
child2.add(child21);
child2.add(child22);
child2.add(child23);
child2.add(child24);
addChildren("Node", root, 12);
JTree tree = new JTree(root);
tree.setLargeModel(true);
......@@ -985,60 +918,58 @@ public class Demo
dtsm.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setSelectionModel(dtsm);
return tree;
// Make it editable.
tree.setEditable(true);
JComponent t = mkScrollPane(tree);
t.setPreferredSize(new Dimension(200,200));
return t;
}
private static JTable mkTable()
{
Object[][] tableData = new Object[][] {
/**
* Add the specified number of children to this parent node. For each
* child, the method is called recursively adding the nChildren-3 number of
* grandchildren.
*
* @param parent the parent node
* @param nChildren the number of children
*/
private static void addChildren(String name, DefaultMutableTreeNode parent,
int nChildren)
{
"Field 1", "Field 2" , "Field 3"
},
for (int i = 0; i < nChildren; i++)
{
"Field 4", "Field 5" , "Field 6"
},
{
"Field 7", "Field 8" , "Field 9"
},
{
"Field 10", "Field 11" , "Field 12"
String child_name = parent+"."+i;
DefaultMutableTreeNode child = new DefaultMutableTreeNode
(child_name);
parent.add(child);
addChildren(child_name, child, nChildren-3);
}
}
};
Object[] columnNames = new Object[] {"Column 1", "Column 2", "Column 3"};
JTable table = new JTable(tableData, columnNames);
return table;
/**
* Make a sample table component.
*/
private static JPanel mkTable()
{
return new TableDemo("Table demo, double click to edit")
.createContent();
}
private JPanel mkButtonBar()
{
JPanel panel = new JPanel (new GridLayout(2, 1));
JPanel panelA = new JPanel(new FlowLayout());
JPanel panelB = new JPanel(new FlowLayout());
JPanel panel = new JPanel(new FlowLayout());
new PopUpAction("Buttons",
(new ButtonDemo("Button Demo")).createContent(),
panelA);
new PopUpAction("Toggles",
mkToggle("cool and refreshing"),
panelA);
new PopUpAction("Checkbox",
mkCheckbox("ice cold"),
panelA);
new PopUpAction("Radio",
mkRadio("delicious"),
panelA);
panel);
new PopUpAction("Slider",
(new SliderDemo("Slider Demo")).createContent(),
panelA);
panel);
new PopUpAction("ProgressBar",
ProgressBarDemo.createContent(),
panelA);
panel);
new PopUpAction("List",
......@@ -1050,60 +981,59 @@ public class Demo
"that",
"wraps",
"over"}),
panelA);
panel);
new PopUpAction("Scrollbar",
(new ScrollBarDemo("ScrollBar Demo")).createContent(),
panelA);
panel);
new PopUpAction("Viewport",
mkViewportBox(mkBigButton("View Me!")),
panelA);
panel);
new PopUpAction("ScrollPane",
mkScrollPane(mkBigButton("Scroll Me!")),
panelA);
panel);
new PopUpAction("TabPane",
mkTabs(new String[] {"happy",
"sad",
"indifferent"}),
panelB);
panel);
new PopUpAction("Spinner",
mkSpinner(),
panelB);
new SpinnerDemo("Spinner Demo").createContent(), panel);
new PopUpAction("TextField",
(new TextFieldDemo("TextField Demo")).createContent(),
panelB);
panel);
new PopUpAction("FileChooser",
(new FileChooserDemo("FileChooser Demo")).createContent(),
panelB);
panel);
new PopUpAction("ColorChooser",
mkColorChooser(),
panelB);
panel);
new PopUpAction("ComboBox",
(new ComboBoxDemo("ComboBox Demo")).createContent(),
panelB);
panel);
new PopUpAction("Editor",
mkEditorPane(),
panelB);
panel);
new PopUpAction("Tree",
mkTree(),
panelB);
panel);
new PopUpAction("Table",
mkTable(),
panelB);
panel);
JButton exitDisposer = mkDisposerButton(frame);
panelB.add(exitDisposer);
panel.add(exitDisposer);
exitDisposer.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
......@@ -1111,8 +1041,6 @@ public class Demo
System.exit(1);
}
});
panel.add(panelA);
panel.add(panelB);
return panel;
}
}
/* FileChooserDemo.java -- An example showing file choosers in Swing.
Copyright (C) 2005, Free Software Foundation, Inc.
Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -64,6 +64,8 @@ public class FileChooserDemo extends JFrame implements ActionListener
}
}
private JPanel content;
/** A label to display the selected file. */
JLabel selectedFileLabel;
......@@ -85,6 +87,19 @@ public class FileChooserDemo extends JFrame implements ActionListener
{
super(frameTitle);
JPanel content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
......@@ -103,6 +118,8 @@ public class FileChooserDemo extends JFrame implements ActionListener
*/
JPanel createContent()
{
if (content == null)
{
JPanel panel = new JPanel(new BorderLayout());
// create a panel of buttons to select the different styles of file
......@@ -147,7 +164,9 @@ public class FileChooserDemo extends JFrame implements ActionListener
displayPanel.add(returnCodeLabel, BorderLayout.SOUTH);
panel.add(displayPanel);
return panel;
content = panel;
}
return content;
}
/**
......@@ -221,6 +240,7 @@ public class FileChooserDemo extends JFrame implements ActionListener
public static void main(String[] args)
{
FileChooserDemo app = new FileChooserDemo("File Chooser Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
......
/* MiniDemo.java -- A Swing demo suitable for embedded environments
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.classpath.examples.swing;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalIconFactory;
import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* A Swing demo suitable for embedded environments (e.g. small display,
* b/w graphics etc).
*
* @author Roman Kennke (kennke@aicas.com)
*/
public class MiniDemo extends JFrame
{
/**
* Creates a new MiniDemo instance.
*/
MiniDemo()
{
createGUI();
}
private void createGUI()
{
JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP,
JTabbedPane.SCROLL_TAB_LAYOUT);
// Setup scrolling list in first tab.
Object[] listData = new Object[]{"Milk", "Beer", "Wine", "Water",
"Orange juice", "Tea", "Coffee", "Whiskey",
"Lemonade", "Apple juice", "Gin Tonic",
"Pangalactic Garleblaster", "Coke"};
JList list = new JList(listData);
JScrollPane sp = new JScrollPane(list);
tabPane.addTab("List", sp);
// Setup some buttons in the second tab.
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(4, 1));
// JButtons
JPanel jButtonPanel = new JPanel();
jButtonPanel.setLayout(new BorderLayout());
final JCheckBox buttonState1 = new JCheckBox("Enabled", true);
jButtonPanel.add(buttonState1, BorderLayout.EAST);
JPanel jButtonContainer = new JPanel();
final JButton jButton1 = new JButton("JButton");
final JButton jButton2 =
new JButton(MetalIconFactory.getInternalFrameDefaultMenuIcon());
jButtonContainer.add(jButton1);
jButtonContainer.add(jButton2);
jButtonPanel.add(jButtonContainer, BorderLayout.CENTER);
buttonState1.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
boolean enabled = buttonState1.isSelected();
jButton1.setEnabled(enabled);
jButton2.setEnabled(enabled);
}
});
buttonPanel.add(jButtonPanel);
// JToggleButtons
JPanel jToggleButtonPanel = new JPanel();
jToggleButtonPanel.setLayout(new BorderLayout());
final JCheckBox buttonState2 = new JCheckBox("Enabled", true);
jToggleButtonPanel.add(buttonState2, BorderLayout.EAST);
JPanel jToggleButtonContainer = new JPanel();
final JButton jToggleButton1 = new JButton("JToggleButton");
final JButton jToggleButton2 =
new JButton(MetalIconFactory.getInternalFrameDefaultMenuIcon());
jToggleButtonContainer.add(jToggleButton1);
jToggleButtonContainer.add(jToggleButton2);
jToggleButtonPanel.add(jToggleButtonContainer, BorderLayout.CENTER);
buttonState2.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
boolean enabled = buttonState2.isSelected();
jToggleButton1.setEnabled(enabled);
jToggleButton2.setEnabled(enabled);
}
});
buttonPanel.add(jToggleButtonPanel);
tabPane.addTab("Buttons", buttonPanel);
// ComboBoxes
JPanel comboBoxPanel = new JPanel();
JComboBox comboBox = new JComboBox(listData);
comboBoxPanel.add(comboBox);
tabPane.add("ComboBox", comboBoxPanel);
// TextFields
JPanel textFieldPanel = new JPanel();
textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.Y_AXIS));
textFieldPanel.add(Box.createVerticalStrut(70));
JPanel leftAlignedPanel = new JPanel(new BorderLayout());
JPanel textFieldPanel1 = new JPanel();
textFieldPanel1.setLayout(new BoxLayout(textFieldPanel1,
BoxLayout.X_AXIS));
final JTextField textfield1 = new JTextField("Hello World!");
textfield1.setHorizontalAlignment(JTextField.LEFT);
textfield1.setFont(new Font("Dialog", Font.PLAIN, 8));
textFieldPanel1.add(textfield1);
final JTextField textfield2 = new JTextField("Hello World!");
textfield2.setHorizontalAlignment(JTextField.LEFT);
textfield2.setFont(new Font("Dialog", Font.ITALIC, 12));
textFieldPanel1.add(textfield2);
final JTextField textfield3 = new JTextField("Hello World!");
textfield3.setHorizontalAlignment(JTextField.LEFT);
textfield3.setFont(new Font("Dialog", Font.BOLD, 14));
textFieldPanel1.add(textfield3);
leftAlignedPanel.add(textFieldPanel1);
JPanel statePanel = new JPanel();
statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
statePanel.add(Box.createVerticalGlue());
final JCheckBox enabled1 = new JCheckBox("enabled");
enabled1.setSelected(true);
enabled1.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
boolean enabled = enabled1.isSelected();
textfield1.setEnabled(enabled);
textfield2.setEnabled(enabled);
textfield3.setEnabled(enabled);
}
});
statePanel.add(enabled1);
final JCheckBox editable1 = new JCheckBox("editable");
editable1.setSelected(true);
editable1.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
boolean editable = editable1.isSelected();
textfield1.setEditable(editable);
textfield2.setEditable(editable);
textfield3.setEditable(editable);
}
});
statePanel.add(editable1);
statePanel.add(Box.createVerticalGlue());
leftAlignedPanel.add(statePanel, BorderLayout.EAST);
textFieldPanel.add(leftAlignedPanel);
System.err.println(leftAlignedPanel.getPreferredSize());
textFieldPanel.add(Box.createVerticalStrut(70));
//panel.add(rightAlignedPanel);
tabPane.add("TextField", textFieldPanel);
setContentPane(tabPane);
}
/**
* Starts the demo application.
*
* @param args the command line arguments (ignored)
*/
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable() {
public void run()
{
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
MiniDemo demo = new MiniDemo();
demo.setSize(320, 200);
demo.setUndecorated(true);
demo.setVisible(true);
demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
});
}
}
/* ScrollBarDemo.java -- An example showing scroll bars in Swing.
Copyright (C) 2005, Free Software Foundation, Inc.
Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -40,6 +40,8 @@ public class ScrollBarDemo
implements ActionListener
{
private JPanel content;
/**
* Creates a new demo instance.
*
......@@ -49,6 +51,19 @@ public class ScrollBarDemo
{
super(title);
JPanel content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
......@@ -67,9 +82,12 @@ public class ScrollBarDemo
*/
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
if (content == null)
{
content = new JPanel(new BorderLayout());
JPanel panel = createScrollBarPanel();
content.add(panel);
}
return content;
}
......@@ -134,6 +152,7 @@ public class ScrollBarDemo
public static void main(String[] args)
{
ScrollBarDemo app = new ScrollBarDemo("ScrollBar Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
......
/* SliderDemo.java -- An example showing JSlider in various configurations.
Copyright (C) 2005, Free Software Foundation, Inc.
Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -36,6 +36,8 @@ import javax.swing.JSlider;
public class SliderDemo extends JFrame implements ActionListener
{
private JPanel content;
JSlider hslider1;
JSlider hslider2;
JSlider hslider3;
......@@ -59,7 +61,20 @@ public class SliderDemo extends JFrame implements ActionListener
public SliderDemo(String frameTitle)
{
super(frameTitle);
JPanel content = createContent();
content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
......@@ -78,7 +93,9 @@ public class SliderDemo extends JFrame implements ActionListener
*/
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
if (content == null)
{
content = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(1, 2));
panel.add(createHorizontalPanel());
panel.add(createVerticalPanel());
......@@ -92,6 +109,7 @@ public class SliderDemo extends JFrame implements ActionListener
panel2.add(panel);
panel2.add(checkBoxPanel, BorderLayout.SOUTH);
content.add(panel2);
}
return content;
}
......@@ -242,6 +260,7 @@ public class SliderDemo extends JFrame implements ActionListener
public static void main(String[] args)
{
SliderDemo app = new SliderDemo("Slider Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
......
/* SpinnerDemo.java -- An example showing various spinners in Swing.
Copyright (C) 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
package gnu.classpath.examples.swing;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;
import java.util.Date;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.SpinnerListModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.UIManager;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalLookAndFeel;
/**
* A simple demo showing various spinners in different states.
*/
public class SpinnerDemo
extends JFrame
implements ActionListener
{
private JPanel content;
private JCheckBox spinnerState1;
private JSpinner spinner1;
private JSpinner spinner2;
private JCheckBox spinnerState2;
private JSpinner spinner3;
private JSpinner spinner4;
private JCheckBox spinnerState3;
private JSpinner spinner5;
private JSpinner spinner6;
/**
* Creates a new demo instance.
*
* @param title the frame title.
*/
public SpinnerDemo(String title)
{
super(title);
JPanel content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
closeButton.addActionListener(this);
closePanel.add(closeButton);
content.add(closePanel, BorderLayout.SOUTH);
getContentPane().add(content);
}
/**
* Returns a panel with the demo content. The panel
* uses a BorderLayout(), and the BorderLayout.SOUTH area
* is empty, to allow callers to add controls to the
* bottom of the panel if they want to (a close button is
* added if this demo is being run as a standalone demo).
*/
JPanel createContent()
{
if (content == null)
{
content = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(3, 1));
panel.add(createPanel1());
panel.add(createPanel2());
panel.add(createPanel3());
content.add(panel);
}
return content;
}
private JPanel createPanel1()
{
JPanel panel = new JPanel(new BorderLayout());
this.spinnerState1 = new JCheckBox("Enabled", true);
this.spinnerState1.setActionCommand("COMBO_STATE1");
this.spinnerState1.addActionListener(this);
panel.add(this.spinnerState1, BorderLayout.EAST);
JPanel controlPanel = new JPanel();
controlPanel.setBorder(BorderFactory.createTitledBorder(
"Number Spinner: "));
this.spinner1 = new JSpinner(new SpinnerNumberModel(5.0, 0.0, 10.0, 0.5));
this.spinner2 = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5));
this.spinner2.setFont(new Font("Dialog", Font.PLAIN, 20));
controlPanel.add(this.spinner1);
controlPanel.add(this.spinner2);
panel.add(controlPanel);
return panel;
}
private JPanel createPanel2()
{
JPanel panel = new JPanel(new BorderLayout());
this.spinnerState2 = new JCheckBox("Enabled", true);
this.spinnerState2.setActionCommand("COMBO_STATE2");
this.spinnerState2.addActionListener(this);
panel.add(this.spinnerState2, BorderLayout.EAST);
JPanel controlPanel = new JPanel();
controlPanel.setBorder(BorderFactory.createTitledBorder("Date Spinner: "));
this.spinner3 = new JSpinner(new SpinnerDateModel(new Date(), null, null,
Calendar.DATE));
this.spinner4 = new JSpinner(new SpinnerDateModel(new Date(), null, null,
Calendar.YEAR));
this.spinner4.setFont(new Font("Dialog", Font.PLAIN, 20));
controlPanel.add(this.spinner3);
controlPanel.add(this.spinner4);
panel.add(controlPanel);
return panel;
}
private JPanel createPanel3()
{
JPanel panel = new JPanel(new BorderLayout());
this.spinnerState3 = new JCheckBox("Enabled", true);
this.spinnerState3.setActionCommand("COMBO_STATE3");
this.spinnerState3.addActionListener(this);
panel.add(this.spinnerState3, BorderLayout.EAST);
JPanel controlPanel = new JPanel();
controlPanel.setBorder(BorderFactory.createTitledBorder("List Spinner: "));
this.spinner5 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
"Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
this.spinner6 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
"Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
this.spinner6.setValue("Yellow");
this.spinner6.setFont(new Font("Dialog", Font.PLAIN, 20));
controlPanel.add(this.spinner5);
controlPanel.add(this.spinner6);
panel.add(controlPanel);
return panel;
}
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("COMBO_STATE1"))
{
spinner1.setEnabled(spinnerState1.isSelected());
spinner2.setEnabled(spinnerState1.isSelected());
}
else if (e.getActionCommand().equals("COMBO_STATE2"))
{
spinner3.setEnabled(spinnerState2.isSelected());
spinner4.setEnabled(spinnerState2.isSelected());
}
else if (e.getActionCommand().equals("COMBO_STATE3"))
{
spinner5.setEnabled(spinnerState3.isSelected());
spinner6.setEnabled(spinnerState3.isSelected());
}
else if (e.getActionCommand().equals("CLOSE"))
{
System.exit(0);
}
}
public static void main(String[] args)
{
try
{
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
}
catch (Exception e) {
e.printStackTrace();
}
SpinnerDemo app = new SpinnerDemo("Spinner Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
}
/* TableDemo.java -- Demonstrates the use of JTable.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.classpath.examples.swing;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableColumnModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
/**
* Displays the editable table. The first column consists of check boxes.
*
* @author Audrius Meskauskas (audriusa@bioinformatics.org)
*/
public class TableDemo extends JFrame
{
/**
* The initial row count for this table.
*/
static int rows = 32;
/**
* The initial column count for this table.
*/
static int cols = 7;
/**
* The table model.
*/
class TModel extends DefaultTableModel
{
/**
* Return true if the cell is editable. All cells are editable.
*/
public boolean isCellEditable(int parm1, int parm2)
{
return true;
}
/**
* Get the number of the table rows.
*/
public int getRowCount()
{
return rows;
}
/**
* Get the number of the table columns.
*/
public int getColumnCount()
{
return cols;
}
/**
* Set the value at the given position
*/
public void setValueAt(Object aValue, int aRow, int aColumn)
{
values[aRow][aColumn] = aValue;
}
/**
* Get the value at the given position.
*/
public Object getValueAt(int aRow, int aColumn)
{
return values[aRow][aColumn];
}
/**
* The column name, as suggested by model. This header should not be
* visible, as it is overridden by setting the header name with
* {@link TableColumn#setHeaderValue} in {@link TableDemo#createContent}.
*/
public String getColumnName(int column)
{
return "Error "+column;
}
/**
* The first column contains booleans, others - default class.
*/
public Class getColumnClass(int column)
{
if (column == 0)
return Boolean.class;
else
return super.getColumnClass(column);
}
}
private JPanel content;
/**
* The table being displayed.
*/
JTable table = new JTable();
/**
* The table model.
*/
TModel model = new TModel();
/**
* The table value array.
*/
Object[][] values;
/**
* Create the table demo with the given titel.
*
* @param title the frame title.
*/
public TableDemo(String title)
{
super(title);
getContentPane().add(createContent(), BorderLayout.CENTER);
}
/**
* Returns a panel with the demo content. The panel uses a BorderLayout(), and
* the BorderLayout.SOUTH area is empty, to allow callers to add controls to
* the bottom of the panel if they want to (a close button is added if this
* demo is being run as a standalone demo).
*/
JPanel createContent()
{
if (content == null)
{
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
values = new Object[rows][];
for (int i = 0; i < values.length; i++)
{
values[i] = new Object[cols];
for (int j = 1; j < cols; j++)
{
values[i][j] = "" + ((char) ('a' + j)) + i;
}
values [i][0] = i % 2 == 0? Boolean.TRUE : Boolean.FALSE;
}
table.setModel(model);
// Make the columns with gradually increasing width:
DefaultTableColumnModel cm = new DefaultTableColumnModel();
for (int i = 0; i < cols; i++)
{
TableColumn column = new TableColumn(i);
// Showing the variable width columns.
int width = 100+20*i;
column.setPreferredWidth(width);
// If we do not set the header value here, the value, returned
// by model, is used.
column.setHeaderValue("Width +"+(20*i));
cm.addColumn(column);
}
table.setColumnModel(cm);
// Create the table, place it into scroll pane and place
// the pane into this frame.
JScrollPane scroll = new JScrollPane();
// The horizontal scroll bar is never needed.
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroll.getViewport().add(table);
p.add(scroll, BorderLayout.CENTER);
content = p;
}
return content;
}
/**
* The executable method to display the editable table.
*
* @param args
* unused.
*/
public static void main(String[] args)
{
TableDemo frame = new TableDemo("Table double click on the cell to edit.");
frame.setSize(new Dimension(640, 100));
frame.validate();
frame.setVisible(true);
}
}
/* TextFieldDemo.java -- An example showing various textfields in Swing.
Copyright (C) 2005, Free Software Foundation, Inc.
Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
......@@ -107,6 +107,8 @@ public class TextFieldDemo
}
}
private JPanel content;
/**
* The left aligned textfields and state buttons.
*/
......@@ -115,7 +117,7 @@ public class TextFieldDemo
JTextField textfield3;
JCheckBox enabled1;
JCheckBox editable1;
JPanel textFieldPanel1;
JPanel textFieldPanel1;
/**
* The right aligned textfields and state buttons.
*/
......@@ -162,6 +164,19 @@ JPanel textFieldPanel1;
{
super(title);
JPanel content = createContent();
// initFrameContent() is only called (from main) when running this app
// standalone
}
/**
* When the demo is run independently, the frame is displayed, so we should
* initialise the content panel (including the demo content and a close
* button). But when the demo is run as part of the Swing activity board,
* only the demo content panel is used, the frame itself is never displayed,
* so we can avoid this step.
*/
public void initFrameContent()
{
JPanel closePanel = new JPanel();
JButton closeButton = new JButton("Close");
closeButton.setActionCommand("CLOSE");
......@@ -180,7 +195,9 @@ JPanel textFieldPanel1;
*/
JPanel createContent()
{
JPanel content = new JPanel(new BorderLayout());
if (content == null)
{
content = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(5, 1));
panel.add(createLeftAlignedPanel());
panel.add(createRightAlignedPanel());
......@@ -189,6 +206,7 @@ JPanel textFieldPanel1;
panel.add(createMiscPanel());
content.add(panel);
//content.setPreferredSize(new Dimension(400, 300));
}
return content;
}
......@@ -481,6 +499,7 @@ JPanel textFieldPanel1;
public static void main(String[] args)
{
TextFieldDemo app = new TextFieldDemo("TextField Demo");
app.initFrameContent();
app.pack();
app.setVisible(true);
}
......
## Input file for automake to generate the Makefile.in used by configure
SUBDIRS = sax w3c_dom
SUBDIRS = sax w3c_dom relaxngDatatype
EXTRA_DIST = README
......@@ -80,6 +80,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -87,6 +88,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -117,6 +120,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -128,6 +132,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -178,6 +184,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......@@ -255,7 +262,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
SUBDIRS = sax w3c_dom
SUBDIRS = sax w3c_dom relaxngDatatype
EXTRA_DIST = README
all: all-recursive
......
## Input file for automake to generate the Makefile.in used by configure
EXTRA_DIST = README.txt \
copying.txt \
org/relaxng/datatype/Datatype.java \
org/relaxng/datatype/DatatypeBuilder.java \
org/relaxng/datatype/DatatypeException.java \
org/relaxng/datatype/DatatypeLibrary.java \
org/relaxng/datatype/DatatypeLibraryFactory.java \
org/relaxng/datatype/DatatypeStreamingValidator.java \
org/relaxng/datatype/ValidationContext.java \
org/relaxng/datatype/helpers/DatatypeLibraryLoader.java \
org/relaxng/datatype/helpers/ParameterlessDatatypeBuilder.java \
org/relaxng/datatype/helpers/StreamingValidatorImpl.java
======================================================================
README FILE FOR DATATYPE INTERFACES FOR RELAX NG
======================================================================
RELAX NG supports multiple datatype vocabularies. To achive this, an
interface between datatype vocabularies and schema processors is
necessary. This interface is intended to be a standard Java interface
for this purpose.
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
See copying.txt.
Note: this license is the BSD license.
----------------------------------------------------------------------
FOR DEVELOPER
----------------------------------------------------------------------
If you are planning to implement a datatype library, A sample datatype
library implementation by James Clark is available at [1], which
comes with documentation and source code.
If you are planning to implement a schema processor, then don't forget
to check out org.relaxng.datatype.helpers.DatatypeLibraryLoader, as
this allows you to dynamically locate datatype implementations.
----------------------------------------------------------------------
LINKS
----------------------------------------------------------------------
* OASIS RELAX NG TC
http://www.oasis-open.org/committees/relax-ng/
* RELAX home page
http://www.xml.gr.jp/relax/
----------------------------------------------------------------------
REFERENCES
----------------------------------------------------------------------
[1] Sample datatype library implementation by James Clark
http://www.thaiopensource.com/relaxng/datatype-sample.zip
Document written by Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
======================================================================
END OF README
Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
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 names of the copyright holders 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 REGENTS 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.
package org.relaxng.datatype;
/**
* Datatype object.
*
* This object has the following functionality:
*
* <ol>
* <li> functionality to identify a class of character sequences. This is
* done through the isValid method.
*
* <li> functionality to produce a "value object" from a character sequence and
* context information.
*
* <li> functionality to test the equality of two value objects.
* </ol>
*
* This interface also defines the createStreamingValidator method,
* which is intended to efficiently support the validation of
* large character sequences.
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public interface Datatype {
/**
* Checks if the specified 'literal' matches this Datatype
* with respect to the current context.
*
* @param literal
* the lexical representation to be checked.
* @param context
* If this datatype is context-dependent
* (i.e. the {@link #isContextDependent} method returns true),
* then the caller must provide a non-null valid context object.
* Otherwise, the caller can pass null.
*
* @return
* true if the 'literal' is a member of this Datatype;
* false if it's not a member of this Datatype.
*/
boolean isValid( String literal, ValidationContext context );
/**
* Similar to the isValid method but throws an exception with diagnosis
* in case of errors.
*
* <p>
* If the specified 'literal' is a valid lexical representation for this
* datatype, then this method must return without throwing any exception.
* If not, the callee must throw an exception (with diagnosis message,
* if possible.)
*
* <p>
* The application can use this method to provide detailed error message
* to users. This method is kept separate from the isValid method to
* achieve higher performance during normal validation.
*
* @exception DatatypeException
* If the given literal is invalid, then this exception is thrown.
* If the callee supports error diagnosis, then the exception should
* contain a diagnosis message.
*/
void checkValid( String literal, ValidationContext context )
throws DatatypeException;
/**
* Creates an instance of a streaming validator for this type.
*
* <p>
* By using streaming validators instead of the isValid method,
* the caller can avoid keeping the entire string, which is
* sometimes quite big, in memory.
*
* @param context
* If this datatype is context-dependent
* (i.e. the {@link #isContextDependent} method returns true),
* then the caller must provide a non-null valid context object.
* Otherwise, the caller can pass null.
* The callee may keep a reference to this context object
* only while the returned streaming validator is being used.
*/
DatatypeStreamingValidator createStreamingValidator( ValidationContext context );
/**
* Converts lexcial value and the current context to the corresponding
* value object.
*
* <p>
* The caller cannot generally assume that the value object is
* a meaningful Java object. For example, the caller cannot expect
* this method to return <code>java.lang.Number</code> type for
* the "integer" type of XML Schema Part 2.
*
* <p>
* Also, the caller cannot assume that the equals method and
* the hashCode method of the value object are consistent with
* the semantics of the datatype. For that purpose, the sameValue
* method and the valueHashCode method have to be used. Note that
* this means you cannot use classes like
* <code>java.util.Hashtable</code> to store the value objects.
*
* <p>
* The returned value object should be used solely for the sameValue
* and valueHashCode methods.
*
* @param context
* If this datatype is context-dependent
* (when the {@link #isContextDependent} method returns true),
* then the caller must provide a non-null valid context object.
* Otherwise, the caller can pass null.
*
* @return null
* when the given lexical value is not a valid lexical
* value for this type.
*/
Object createValue( String literal, ValidationContext context );
/**
* Tests the equality of two value objects which were originally
* created by the createValue method of this object.
*
* The behavior is undefined if objects not created by this type
* are passed. It is the caller's responsibility to ensure that
* value objects belong to this type.
*
* @return
* true if two value objects are considered equal according to
* the definition of this datatype; false if otherwise.
*/
boolean sameValue( Object value1, Object value2 );
/**
* Computes the hash code for a value object,
* which is consistent with the sameValue method.
*
* @return
* hash code for the specified value object.
*/
int valueHashCode( Object value );
/**
* Indicates that the datatype doesn't have ID/IDREF semantics.
*
* This value is one of the possible return values of the
* {@link #getIdType} method.
*/
public static final int ID_TYPE_NULL = 0;
/**
* Indicates that RELAX NG compatibility processors should
* treat this datatype as having ID semantics.
*
* This value is one of the possible return values of the
* {@link #getIdType} method.
*/
public static final int ID_TYPE_ID = 1;
/**
* Indicates that RELAX NG compatibility processors should
* treat this datatype as having IDREF semantics.
*
* This value is one of the possible return values of the
* {@link #getIdType} method.
*/
public static final int ID_TYPE_IDREF = 2;
/**
* Indicates that RELAX NG compatibility processors should
* treat this datatype as having IDREFS semantics.
*
* This value is one of the possible return values of the
* {@link #getIdType} method.
*/
public static final int ID_TYPE_IDREFS = 3;
/**
* Checks if the ID/IDREF semantics is associated with this
* datatype.
*
* <p>
* This method is introduced to support the RELAX NG DTD
* compatibility spec. (Of course it's always free to use
* this method for other purposes.)
*
* <p>
* If you are implementing a datatype library and have no idea about
* the "RELAX NG DTD compatibility" thing, just return
* <code>ID_TYPE_NULL</code> is fine.
*
* @return
* If this datatype doesn't have any ID/IDREF semantics,
* it returns {@link #ID_TYPE_NULL}. If it has such a semantics
* (for example, XSD:ID, XSD:IDREF and comp:ID type), then
* it returns {@link #ID_TYPE_ID}, {@link #ID_TYPE_IDREF} or
* {@link #ID_TYPE_IDREFS}.
*/
public int getIdType();
/**
* Checks if this datatype may need a context object for
* the validation.
*
* <p>
* The callee must return true even when the context
* is not always necessary. (For example, the "QName" type
* doesn't need a context object when validating unprefixed
* string. But nonetheless QName must return true.)
*
* <p>
* XSD's <code>string</code> and <code>short</code> types
* are examples of context-independent datatypes.
* Its <code>QName</code> and <code>ENTITY</code> types
* are examples of context-dependent datatypes.
*
* <p>
* When a datatype is context-independent, then
* the {@link #isValid} method, the {@link #checkValid} method,
* the {@link #createStreamingValidator} method and
* the {@link #createValue} method can be called without
* providing a context object.
*
* @return
* <b>true</b> if this datatype is context-dependent
* (it needs a context object sometimes);
*
* <b>false</b> if this datatype is context-<b>in</b>dependent
* (it never needs a context object).
*/
public boolean isContextDependent();
}
package org.relaxng.datatype;
/**
* Creates a user-defined type by adding parameters to
* the pre-defined type.
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public interface DatatypeBuilder {
/**
* Adds a new parameter.
*
* @param name
* The name of the parameter to be added.
* @param strValue
* The raw value of the parameter. Caller may not normalize
* this value because any white space is potentially significant.
* @param context
* The context information which can be used by the callee to
* acquire additional information. This context object is
* valid only during this method call. The callee may not
* keep a reference to this object.
* @exception DatatypeException
* When the given parameter is inappropriate for some reason.
* The callee is responsible to recover from this error.
* That is, the object should behave as if no such error
* was occured.
*/
void addParameter( String name, String strValue, ValidationContext context )
throws DatatypeException;
/**
* Derives a new Datatype from a Datatype by parameters that
* were already set through the addParameter method.
*
* @exception DatatypeException
* DatatypeException must be thrown if the derivation is
* somehow invalid. For example, a required parameter is missing,
* etc. The exception should contain a diagnosis message
* if possible.
*/
Datatype createDatatype() throws DatatypeException;
}
package org.relaxng.datatype;
/**
* Signals Datatype related exceptions.
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public class DatatypeException extends Exception {
public DatatypeException( int index, String msg ) {
super(msg);
this.index = index;
}
public DatatypeException( String msg ) {
this(UNKNOWN,msg);
}
/**
* A constructor for those datatype libraries which don't support any
* diagnostic information at all.
*/
public DatatypeException() {
this(UNKNOWN,null);
}
private final int index;
public static final int UNKNOWN = -1;
/**
* Gets the index of the content where the error occured.
* UNKNOWN can be returned to indicate that no index information
* is available.
*/
public int getIndex() {
return index;
}
}
package org.relaxng.datatype;
/**
* A Datatype library
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public interface DatatypeLibrary {
/**
* Creates a new instance of DatatypeBuilder.
*
* The callee should throw a DatatypeException in case of an error.
*
* @param baseTypeLocalName
* The local name of the base type.
*
* @return
* A non-null valid datatype object.
*/
DatatypeBuilder createDatatypeBuilder( String baseTypeLocalName )
throws DatatypeException;
/**
* Gets or creates a pre-defined type.
*
* This is just a short-cut of
* <code>createDatatypeBuilder(typeLocalName).createDatatype();</code>
*
* The callee should throw a DatatypeException in case of an error.
*
* @return
* A non-null valid datatype object.
*/
Datatype createDatatype( String typeLocalName ) throws DatatypeException;
}
package org.relaxng.datatype;
/**
* Factory class for the DatatypeLibrary class.
*
* <p>
* The datatype library should provide the implementation of
* this interface if it wants to be found by the schema processors.
* The implementor also have to place a file in your jar file.
* See the reference datatype library implementation for detail.
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public interface DatatypeLibraryFactory
{
/**
* Creates a new instance of a DatatypeLibrary that supports
* the specified namespace URI.
*
* @return
* <code>null</code> if the specified namespace URI is not
* supported.
*/
DatatypeLibrary createDatatypeLibrary( String namespaceURI );
}
package org.relaxng.datatype;
/**
* Datatype streaming validator.
*
* <p>
* The streaming validator is an optional feature that is useful for
* certain Datatypes. It allows the caller to incrementally provide
* the literal.
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public interface DatatypeStreamingValidator {
/**
* Passes an additional fragment of the literal.
*
* <p>
* The application can call this method several times, then call
* the isValid method (or the checkValid method) to check the validity
* of the accumulated characters.
*/
void addCharacters( char[] buf, int start, int len );
/**
* Tells if the accumulated literal is valid with respect to
* the underlying Datatype.
*
* @return
* True if it is valid. False if otherwise.
*/
boolean isValid();
/**
* Similar to the isValid method, but this method throws
* Exception (with possibly diagnostic information), instead of
* returning false.
*
* @exception DatatypeException
* If the callee supports the diagnosis and the accumulated
* literal is invalid, then this exception that possibly
* contains diagnosis information is thrown.
*/
void checkValid() throws DatatypeException;
}
package org.relaxng.datatype;
/**
* An interface that must be implemented by caller to
* provide context information that is necessary to
* perform validation of some Datatypes.
*
* @author <a href="mailto:jjc@jclark.com">James Clark</a>
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public interface ValidationContext {
/**
* Resolves a namespace prefix to the corresponding namespace URI.
*
* This method is used for validating the QName type, for example.
*
* <p>
* If the prefix is "" (empty string), it indicates
* an unprefixed value. The callee
* should resolve it as for an unprefixed
* element, rather than for an unprefixed attribute.
*
* <p>
* If the prefix is "xml", then the callee must resolve
* this prefix into "http://www.w3.org/XML/1998/namespace",
* as defined in the XML Namespaces Recommendation.
*
* @return
* namespace URI of this prefix.
* If the specified prefix is not declared,
* the implementation must return null.
*/
String resolveNamespacePrefix( String prefix );
/**
* Returns the base URI of the context. The null string may be returned
* if no base URI is known.
*/
String getBaseUri();
/**
* Checks if an unparsed entity is declared with the
* specified name.
*
* @return
* true
* if the DTD has an unparsed entity declaration for
* the specified name.
* false
* otherwise.
*/
boolean isUnparsedEntity( String entityName );
/**
* Checks if a notation is declared with the
* specified name.
*
* @return
* true
* if the DTD has a notation declaration for the specified name.
* false
* otherwise.
*/
boolean isNotation( String notationName );
}
/**
* Copyright (c) 2001, Thai Open Source Software Center Ltd
* 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 the Thai Open Source Software Center Ltd 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 REGENTS 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.
*/
package org.relaxng.datatype.helpers;
import org.relaxng.datatype.DatatypeLibraryFactory;
import org.relaxng.datatype.DatatypeLibrary;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.io.Reader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
/**
* Discovers the datatype library implementation from the classpath.
*
* <p>
* The call of the createDatatypeLibrary method finds an implementation
* from a given datatype library URI at run-time.
*/
public class DatatypeLibraryLoader implements DatatypeLibraryFactory {
private final Service service = new Service(DatatypeLibraryFactory.class);
public DatatypeLibrary createDatatypeLibrary(String uri) {
for (Enumeration e = service.getProviders();
e.hasMoreElements();) {
DatatypeLibraryFactory factory
= (DatatypeLibraryFactory)e.nextElement();
DatatypeLibrary library = factory.createDatatypeLibrary(uri);
if (library != null)
return library;
}
return null;
}
private static class Service {
private final Class serviceClass;
private final Enumeration configFiles;
private Enumeration classNames = null;
private final Vector providers = new Vector();
private Loader loader;
private class ProviderEnumeration implements Enumeration {
private int nextIndex = 0;
public boolean hasMoreElements() {
return nextIndex < providers.size() || moreProviders();
}
public Object nextElement() {
try {
return providers.elementAt(nextIndex++);
}
catch (ArrayIndexOutOfBoundsException e) {
throw new NoSuchElementException();
}
}
}
private static class Singleton implements Enumeration {
private Object obj;
private Singleton(Object obj) {
this.obj = obj;
}
public boolean hasMoreElements() {
return obj != null;
}
public Object nextElement() {
if (obj == null)
throw new NoSuchElementException();
Object tem = obj;
obj = null;
return tem;
}
}
// JDK 1.1
private static class Loader {
Enumeration getResources(String resName) {
ClassLoader cl = Loader.class.getClassLoader();
URL url;
if (cl == null)
url = ClassLoader.getSystemResource(resName);
else
url = cl.getResource(resName);
return new Singleton(url);
}
Class loadClass(String name) throws ClassNotFoundException {
return Class.forName(name);
}
}
// JDK 1.2+
private static class Loader2 extends Loader {
private ClassLoader cl;
Loader2() {
cl = Loader2.class.getClassLoader();
// If the thread context class loader has the class loader
// of this class as an ancestor, use the thread context class
// loader. Otherwise, the thread context class loader
// probably hasn't been set up properly, so don't use it.
ClassLoader clt = Thread.currentThread().getContextClassLoader();
for (ClassLoader tem = clt; tem != null; tem = tem.getParent())
if (tem == cl) {
cl = clt;
break;
}
}
Enumeration getResources(String resName) {
try {
return cl.getResources(resName);
}
catch (IOException e) {
return new Singleton(null);
}
}
Class loadClass(String name) throws ClassNotFoundException {
return Class.forName(name, true, cl);
}
}
public Service(Class cls) {
try {
loader = new Loader2();
}
catch (NoSuchMethodError e) {
loader = new Loader();
}
serviceClass = cls;
String resName = "META-INF/services/" + serviceClass.getName();
configFiles = loader.getResources(resName);
}
public Enumeration getProviders() {
return new ProviderEnumeration();
}
synchronized private boolean moreProviders() {
for (;;) {
while (classNames == null) {
if (!configFiles.hasMoreElements())
return false;
classNames = parseConfigFile((URL)configFiles.nextElement());
}
while (classNames.hasMoreElements()) {
String className = (String)classNames.nextElement();
try {
Class cls = loader.loadClass(className);
Object obj = cls.newInstance();
if (serviceClass.isInstance(obj)) {
providers.addElement(obj);
return true;
}
}
catch (ClassNotFoundException e) { }
catch (InstantiationException e) { }
catch (IllegalAccessException e) { }
catch (LinkageError e) { }
}
classNames = null;
}
}
private static final int START = 0;
private static final int IN_NAME = 1;
private static final int IN_COMMENT = 2;
private static Enumeration parseConfigFile(URL url) {
try {
InputStream in = url.openStream();
Reader r;
try {
r = new InputStreamReader(in, "UTF-8");
}
catch (UnsupportedEncodingException e) {
r = new InputStreamReader(in, "UTF8");
}
r = new BufferedReader(r);
Vector tokens = new Vector();
StringBuffer tokenBuf = new StringBuffer();
int state = START;
for (;;) {
int n = r.read();
if (n < 0)
break;
char c = (char)n;
switch (c) {
case '\r':
case '\n':
state = START;
break;
case ' ':
case '\t':
break;
case '#':
state = IN_COMMENT;
break;
default:
if (state != IN_COMMENT) {
state = IN_NAME;
tokenBuf.append(c);
}
break;
}
if (tokenBuf.length() != 0 && state != IN_NAME) {
tokens.addElement(tokenBuf.toString());
tokenBuf.setLength(0);
}
}
if (tokenBuf.length() != 0)
tokens.addElement(tokenBuf.toString());
return tokens.elements();
}
catch (IOException e) {
return null;
}
}
}
}
package org.relaxng.datatype.helpers;
import org.relaxng.datatype.*;
/**
* Dummy implementation of {@link DatatypeBuilder}.
*
* This implementation can be used for Datatypes which have no parameters.
* Any attempt to add parameters will be rejected.
*
* <p>
* Typical usage would be:
* <PRE><XMP>
* class MyDatatypeLibrary implements DatatypeLibrary {
* ....
* DatatypeBuilder createDatatypeBuilder( String typeName ) {
* return new ParameterleessDatatypeBuilder(createDatatype(typeName));
* }
* ....
* }
* </XMP></PRE>
*
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public final class ParameterlessDatatypeBuilder implements DatatypeBuilder {
/** This type object is returned for the derive method. */
private final Datatype baseType;
public ParameterlessDatatypeBuilder( Datatype baseType ) {
this.baseType = baseType;
}
public void addParameter( String name, String strValue, ValidationContext context )
throws DatatypeException {
throw new DatatypeException();
}
public Datatype createDatatype() throws DatatypeException {
return baseType;
}
}
package org.relaxng.datatype.helpers;
import org.relaxng.datatype.*;
/**
* Dummy implementation of {@link DatatypeStreamingValidator}.
*
* <p>
* This implementation can be used as a quick hack when the performance
* of streaming validation is not important. And this implementation
* also shows you how to implement the DatatypeStreamingValidator interface.
*
* <p>
* Typical usage would be:
* <PRE><XMP>
* class MyDatatype implements Datatype {
* ....
* public DatatypeStreamingValidator createStreamingValidator( ValidationContext context ) {
* return new StreamingValidatorImpl(this,context);
* }
* ....
* }
* </XMP></PRE>
*
* @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
*/
public final class StreamingValidatorImpl implements DatatypeStreamingValidator {
/** This buffer accumulates characters. */
private final StringBuffer buffer = new StringBuffer();
/** Datatype obejct that creates this streaming validator. */
private final Datatype baseType;
/** The current context. */
private final ValidationContext context;
public void addCharacters( char[] buf, int start, int len ) {
// append characters to the current buffer.
buffer.append(buf,start,len);
}
public boolean isValid() {
return baseType.isValid(buffer.toString(),context);
}
public void checkValid() throws DatatypeException {
baseType.checkValid(buffer.toString(),context);
}
public StreamingValidatorImpl( Datatype baseType, ValidationContext context ) {
this.baseType = baseType;
this.context = context;
}
}
......@@ -71,6 +71,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -78,6 +79,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -108,6 +111,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -119,6 +123,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -169,6 +175,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......
......@@ -71,6 +71,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
......@@ -78,6 +79,8 @@ CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@
CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
......@@ -108,6 +111,7 @@ EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FIND = @FIND@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
......@@ -119,6 +123,8 @@ FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
......@@ -169,6 +175,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
......
......@@ -142,6 +142,27 @@ public class IOR
}
/**
* Get a better formatted multiline string representation.
*/
public String toStringFormatted()
{
StringBuffer b = new StringBuffer();
b.append("\n Native set " + name(native_set));
if (conversion != null && conversion.length > 0)
{
b.append("\n Other supported sets:\n ");
for (int i = 0; i < conversion.length; i++)
{
b.append(name(conversion[i]));
b.append(' ');
}
}
b.append("\n");
return b.toString();
}
/**
* Write into CDR stream.
*/
public void write(org.omg.CORBA.portable.OutputStream out)
......@@ -592,6 +613,39 @@ public class IOR
}
/**
* Returns a multiline formatted human readable string representation of
* this IOR object.
*/
public String toStringFormatted()
{
StringBuffer b = new StringBuffer();
b.append("\nObject Id:\n ");
b.append(Id);
b.append("\nObject is accessible at:\n ");
b.append(Internet);
if (Big_Endian)
b.append("\n Big endian encoding");
else
b.append("\n Little endian encoding.");
b.append("\nObject Key\n ");
for (int i = 0; i < key.length; i++)
{
b.append(Integer.toHexString(key[i] & 0xFF));
}
b.append("\nSupported code sets:");
b.append("\n Wide:");
b.append(Internet.CodeSets.wide.toStringFormatted());
b.append(" Narrow:");
b.append(Internet.CodeSets.wide.toStringFormatted());
return b.toString();
}
/**
* Returs a stringified reference.
*
* @return a newly constructed stringified reference.
......
......@@ -58,11 +58,11 @@ public class NamingMap
/**
* The actual map.
*/
private final TreeMap map;
protected final TreeMap map;
/**
* Creates an instance of the naming map, intialising the comparator
* to the {@link cmpNameComparator}.
* to the {@link NameComponentComparator}.
*/
public NamingMap()
{
......@@ -70,7 +70,7 @@ public class NamingMap
}
/**
* Put the given CORBA object, specifying the given name as a key.
* Put the given GIOP object, specifying the given name as a key.
* If the entry with the given name already exists, or if the given
* object is already mapped under another name, the
* {@link AlreadyBound} exception will be thrown.
......@@ -93,8 +93,11 @@ public class NamingMap
else
{
if (containsValue(object))
throw new AlreadyBound("Tha object has another name");
throw new AlreadyBound("The object has another name");
}
// There are no restrictions in binding the object.
rebind(name, object);
}
/**
......@@ -141,7 +144,7 @@ public class NamingMap
}
/**
* Put the given CORBA object, specifying the given name as a key.
* Put the given GIOP object, specifying the given name as a key.
* Remove all pre - existing mappings for the given name and object.
*
* @param name the name.
......
......@@ -136,7 +136,7 @@ public class NamingServiceTransient
System.out.println("GNU Classpath transient naming service "
+ "started at " + iorr.Internet.host + ":" + iorr.Internet.port
+ " key 'NameService'.\n\n"
+ "Copyright (C) 2005 Free Software Foundation\n"
+ "Copyright (C) 2006 Free Software Foundation\n"
+ "This tool comes with ABSOLUTELY NO WARRANTY. "
+ "This is free software, and you are\nwelcome to "
+ "redistribute it under conditions, defined in "
......
......@@ -59,7 +59,7 @@ import java.util.Map;
/**
* This class implements the transient naming service, defined by
* {@link NamingContex}. The 'transient' means that the service does
* {@link NamingContext}. The 'transient' means that the service does
* not store its state into the persistent memory. If the service is
* restarted, the named objects must be re-registered again.
*
......@@ -72,14 +72,39 @@ public class TransientContext
implements NamingContext, NamingContextOperations
{
/**
* Use serial version UID for interoperability.
*/
private static final long serialVersionUID = 2;
/**
* The already named contexts.
*/
protected final NamingMap named_contexts = new NamingMap();
protected final NamingMap named_contexts;
/**
* The already named objects.
*/
protected final NamingMap named_objects = new NamingMap();
protected final NamingMap named_objects;
/**
* Create the naming conetxt with default (transient) naming maps.
*/
public TransientContext()
{
this(new NamingMap(), new NamingMap());
}
/**
* Create the naming conetxt with the two provided naming maps.
*
* @param context_map the map for contexts
* @param object_map the map for objectss
*/
public TransientContext(NamingMap context_map, NamingMap object_map)
{
named_contexts = context_map;
named_objects = object_map;
}
/**
* Gives the object a name, valid in this context.
......@@ -376,7 +401,7 @@ public class TransientContext
/**
* Create a binding.
*
* @param entry the entry, defining the bound object.
* @param an_entry the entry, defining the bound object.
* @param type the binding type.
* @return the created binding.
*/
......@@ -396,7 +421,7 @@ public class TransientContext
* name, and pass the remainder (without the first node)
* of the name for that context to resolve.
*
* @param name the name to resolve.
* @param a_name the name to resolve.
*
* @return the resolved context
*/
......
......@@ -282,7 +282,7 @@ public final class ServiceFactory
* An iterator over service providers that are listed in service
* provider configuration files, which get passed as an Enumeration
* of URLs. This is a helper class for {@link
* ServiceFactory#lookupProviders}.
* ServiceFactory#lookupProviders(Class, ClassLoader)}.
*
* @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
*/
......@@ -314,7 +314,8 @@ public final class ServiceFactory
* The security context used when loading and initializing service
* providers. We want to load and initialize all plug-in service
* providers under the same security context, namely the one that
* was active when {@link #lookupProviders} has been called.
* was active when {@link #lookupProviders(Class, ClassLoader)} has
* been called.
*/
private final AccessControlContext securityContext;
......@@ -527,7 +528,7 @@ public final class ServiceFactory
* framework. This call returns very quickly if no log message will
* be produced, so there is not much overhead in the standard case.
*
* @param the severity of the message, for instance {@link
* @param level the severity of the message, for instance {@link
* Level#WARNING}.
*
* @param msg the log message, for instance <code>&#x201c;Could not
......
......@@ -48,9 +48,9 @@ import java.security.PrivilegedExceptionAction;
* <code>PriviledgedAction</code> in order to restrict the loaded
* service providers to the {@link java.security.AccessControlContext}
* that was active when {@link
* gnu.classpath.ServiceFactory#lookupProviders} was called, even
* though the actual loading is delayed to the time when the provider
* is actually needed.
* gnu.classpath.ServiceFactory#lookupProviders(Class, ClassLoader)} was
* called, even though the actual loading is delayed to the time when the
* provider is actually needed.
*
* @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
*/
......
......@@ -89,9 +89,9 @@ public final class Component extends Level
public static final Component SSL_HANDSHAKE = new Component ("SSL HANDSHAKE", 0);
/**
* Traces the application messages during SSL communications.
* Traces record layer messages during SSL communications.
*/
public static final Component SSL_APPLICATION = new Component ("SSL APPLICATION", 1);
public static final Component SSL_RECORD_LAYER = new Component ("SSL RECORD LAYER", 1);
/**
* Trace details about the SSL key exchange.
......
/* Simple1LineFormatter.java -- A simple 1-line logging formatter
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.classpath.debug;
import gnu.classpath.SystemProperties;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
/**
* A simple 1-line formatter to use instead of the 2-line SimpleFormatter used
* by default in the JDK logging handlers.
* <p>
* The fixed format of this formatter is as follows:
* <p>
* <ol>
* <li>Date: As a yyyy-MM-dd string.</li>
* <li>Time: As a HH:mm:ss.SSSS Z string.</li>
* <li>Thread identifier, right-justified, and framed in an 11-digit field.</li>
* <li>Class name, without its package name, left-justified, and framed in a
* 32-character field.</li>
* <li>Method name, left-justified, and framed in a 32-character field.</li>
* <li>Level name, left-justified, and framed in a 6-character field.</li>
* <li>User message and arguments.</li>
* <li>Platform-dependent line-separator.</li>
* <li>Optionally, if the log-record contains a thrown exception, that
* exception's stack trace is appended to the output.</li>
* </ol>
* <p>
* Here is an example of the output generated by this formatter:
* <p>
* <pre>
* 2006-02-27 21:59:12.0881 +1100 -1343151280 EncodedKeyFactory engineGeneratePublic() FINER - ENTRY java.security.spec.X509EncodedKeySpec@b00d7fc0
* 2006-02-27 21:59:12.0887 +1100 -1343151280 EncodedKeyFactory engineGeneratePublic() FINE - Exception in DSSPublicKey.valueOf(). Ignore
* java.security.InvalidParameterException: Unexpected OID: 1.2.840.113549.1.1.1
* at gnu.java.security.key.dss.DSSKeyPairX509Codec.decodePublicKey (DSSKeyPairX509Codec.java:205)
* at gnu.java.security.key.dss.DSSPublicKey.valueOf (DSSPublicKey.java:136)
* at gnu.java.security.jce.sig.EncodedKeyFactory.engineGeneratePublic (EncodedKeyFactory.java:218)
* at java.security.KeyFactory.generatePublic (KeyFactory.java:219)
* at gnu.java.security.x509.X509Certificate.parse (X509Certificate.java:657)
* at gnu.java.security.x509.X509Certificate.<init> (X509Certificate.java:163)
* ...
* 2006-02-27 21:59:12.0895 +1100 -1343151280 RSAKeyPairX509Codec decodePublicKey() FINER - ENTRY [B@b00d7fd0
* 2006-02-27 21:59:12.0897 +1100 -1343151280 RSAKeyPairX509Codec decodePublicKey() FINER - RETURN gnu.java.security.key.rsa.GnuRSAPublicKey@b00fb940
* </pre>
*/
public class Simple1LineFormatter
extends Formatter
{
private static final String DAT_PATTERN = "yyyy-MM-dd HH:mm:ss.SSSS Z ";
private static final DateFormat DAT_FORMAT = new SimpleDateFormat(DAT_PATTERN);
private static final String THREAD_PATTERN = " #########0;-#########0";
private static final NumberFormat THREAD_FORMAT = new DecimalFormat(THREAD_PATTERN);
private static final String SPACES_32 = " ";
private static final String SPACES_6 = " ";
private static final String LS = SystemProperties.getProperty("line.separator");
// default 0-arguments constructor
public String format(LogRecord record)
{
StringBuffer sb = new StringBuffer(180)
.append(DAT_FORMAT.format(new Date(record.getMillis())))
.append(THREAD_FORMAT.format(record.getThreadID()))
.append(" ");
String s = record.getSourceClassName();
if (s == null)
sb.append(SPACES_32);
else
{
s = s.trim();
int i = s.lastIndexOf(".");
if (i != - 1)
s = s.substring(i + 1);
s = (s + SPACES_32).substring(0, 32);
}
sb.append(s).append(" ");
s = record.getSourceMethodName();
if (s == null)
sb.append(SPACES_32);
else
{
s = s.trim();
if (s.endsWith("()"))
s = (s.trim() + SPACES_32).substring(0, 32);
else
s = (s.trim() + "()" + SPACES_32).substring(0, 32);
}
sb.append(s).append(" ");
s = String.valueOf(record.getLevel());
if (s == null)
sb.append(SPACES_6);
else
s = (s.trim() + SPACES_6).substring(0, 6);
sb.append(s).append(" - ").append(formatMessage(record)).append(LS);
Throwable cause = record.getThrown();
if (cause != null)
{
StringWriter sw = new StringWriter();
cause.printStackTrace(new PrintWriter(sw, true));
sb.append(sw.toString());
}
return sb.toString();
}
}
/* Jdwp.java -- Virtual machine to JDWP back-end programming interface
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
......@@ -159,7 +159,7 @@ public class Jdwp
{
AccessController.doPrivileged (_packetProcessor);
}
});
}, "packet processor");
_ppThread.start ();
}
......@@ -258,7 +258,7 @@ public class Jdwp
break;
case EventRequest.SUSPEND_THREAD:
VMVirtualMachine.suspendThread (this);
VMVirtualMachine.suspendThread (Thread.currentThread ());
break;
case EventRequest.SUSPEND_ALL:
......
/* EventRequest.java -- an event request from the debugger
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
......@@ -44,8 +44,9 @@ import gnu.classpath.jdwp.event.filters.*;
import gnu.classpath.jdwp.exception.JdwpIllegalArgumentException;
import gnu.classpath.jdwp.id.*;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
/**
* A class which represents a request by the debugger for an event
......@@ -320,6 +321,14 @@ public class EventRequest
}
/**
* Returns the filters attached to this request
*/
public Collection getFilters ()
{
return _filters;
}
/**
* Returns the suspend policy for this request
*/
public byte getSuspendPolicy ()
......@@ -363,7 +372,7 @@ public class EventRequest
// Loop through filters; all must match
// Note that we must allow EVERY filter to evaluate. This way
// things like CountFilter will work.
ListIterator iter = _filters.listIterator ();
Iterator iter = _filters.iterator ();
while (iter.hasNext ())
{
IEventFilter filter = (IEventFilter) iter.next ();
......
/* JdwpId.java -- base class for all object ID types
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
......@@ -51,6 +51,11 @@ import java.lang.ref.SoftReference;
public abstract class JdwpId
{
/**
* The size of an ID. The default is 8 bytes (a long).
*/
public static final int SIZE = 8;
/**
* ID assigned to this object
*/
protected long _id;
......@@ -122,11 +127,6 @@ public abstract class JdwpId
}
/**
* Returns size of this type (used by IDSizes)
*/
public abstract int size ();
/**
* Writes the contents of this type to the <code>DataOutputStream</code>
* @param outStream the <code>DataOutputStream</code> to use
* @throws IOException when an error occurs on the <code>OutputStream</code>
......
/* ObjectId.java -- object IDs
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
......@@ -83,14 +83,6 @@ public class ObjectId
}
/**
* Returns the size of this id type
*/
public int size ()
{
return 8;
}
/**
* Returns the object referred to by this ID
*
* @returns the object
......
/* ReferenceTypeId.java -- a base class for all reference type IDs
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
......@@ -62,14 +62,6 @@ public class ReferenceTypeId
}
/**
* Returns the size of this ID type
*/
public int size ()
{
return 8;
}
/**
* Gets the class associated with this ID
*
* @returns the class
......
/* VirtualMachineCommandSet.java -- class to implement the VirtualMachine
Command Set
Copyright (C) 2005 Free Software Foundation
Copyright (C) 2005, 2006 Free Software Foundation
This file is part of GNU Classpath.
......@@ -40,6 +40,7 @@ exception statement from your version. */
package gnu.classpath.jdwp.processor;
import gnu.classpath.jdwp.JdwpConstants;
import gnu.classpath.jdwp.VMFrame;
import gnu.classpath.jdwp.VMVirtualMachine;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
......@@ -298,12 +299,11 @@ public class VirtualMachineCommandSet
private void executeIDsizes(ByteBuffer bb, DataOutputStream os)
throws JdwpException, IOException
{
ObjectId oid = new ObjectId();
os.writeInt(oid.size()); // fieldId
os.writeInt(oid.size()); // methodId
os.writeInt(oid.size()); // objectId
os.writeInt(new ReferenceTypeId((byte) 0x00).size()); // referenceTypeId
os.writeInt(oid.size()); // frameId
os.writeInt(ObjectId.SIZE); // fieldId FIXME
os.writeInt(ObjectId.SIZE); // methodId FIXME
os.writeInt(ObjectId.SIZE); // objectId
os.writeInt(ReferenceTypeId.SIZE); // referenceTypeId
os.writeInt(VMFrame.SIZE); // frameId
}
private void executeSuspend(ByteBuffer bb, DataOutputStream os)
......
......@@ -229,9 +229,9 @@ public class GLightweightPeer
public void repaint(long tm, int x, int y, int width, int height)
{
Component p = comp.getParent ();
if(p != null)
p.repaint(tm,x+comp.getX(),y+comp.getY(),width,height);
Component p = comp.getParent();
if (p != null)
p.repaint(tm, x + comp.getX(), y + comp.getY(), width, height);
}
public void requestFocus() {}
......
/* GtkButtonPeer.java -- Implements ButtonPeer with GTK
Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -57,7 +57,10 @@ public class GtkButtonPeer extends GtkComponentPeer
public native void connectSignals ();
native void gtkWidgetModifyFont (String name, int style, int size);
/**
* Overridden to set Font of Label inside Button inside EventBox.
*/
protected native void gtkWidgetModifyFont(String name, int style, int size);
native void gtkSetLabel (String label);
native void gtkWidgetSetForeground (int red, int green, int blue);
native void gtkWidgetSetBackground (int red, int green, int blue);
......
/* GtkCheckboxMenuItemPeer.java -- Implements CheckboxMenuItemPeer with GTK+
Copyright (C) 1999, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -46,7 +46,7 @@ import java.awt.peer.CheckboxMenuItemPeer;
public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
implements CheckboxMenuItemPeer
{
native void create (String label);
protected native void create (String label);
public GtkCheckboxMenuItemPeer (CheckboxMenuItem menu)
{
......@@ -56,6 +56,11 @@ public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
public native void setState(boolean t);
/**
* Called from the signal handler of the gtk widget. Posts a
* ItemEvent to indicate a state changed, then calls super to post
* an ActionEvent.
*/
protected void postMenuActionEvent ()
{
CheckboxMenuItem item = (CheckboxMenuItem)awtWidget;
......
/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -42,6 +42,8 @@ import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.peer.CheckboxPeer;
import java.awt.event.ItemEvent;
public class GtkCheckboxPeer extends GtkComponentPeer
implements CheckboxPeer
{
......@@ -49,12 +51,15 @@ public class GtkCheckboxPeer extends GtkComponentPeer
public GtkCheckboxGroupPeer old_group;
// The current state of the GTK checkbox.
private boolean currentState;
private boolean changing = false;
public native void create (GtkCheckboxGroupPeer group);
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
public native void connectSignals ();
native void gtkWidgetModifyFont (String name, int style, int size);
/**
* Overridden to set Font of label inside button.
*/
protected native void gtkWidgetModifyFont(String name, int style, int size);
native void gtkButtonSetLabel (String label);
native void gtkToggleButtonSetActive (boolean is_active);
......@@ -71,23 +76,24 @@ public class GtkCheckboxPeer extends GtkComponentPeer
CheckboxGroup g = checkbox.getCheckboxGroup ();
old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
create (old_group);
gtkToggleButtonSetActive (checkbox.getState ());
currentState = checkbox.getState();
gtkToggleButtonSetActive(currentState);
gtkButtonSetLabel (checkbox.getLabel ());
}
public void setState (boolean state)
/**
* Sets native GtkCheckButton is state is different from current
* state. Will set currentState to state to prevent posting an
* event since events should only be posted for user initiated
* clicks on the GtkCheckButton.
*/
synchronized public void setState (boolean state)
{
// prevent item_toggled_cb -> postItemEvent ->
// awtComponent.setState -> this.setState ->
// gtkToggleButtonSetActive self-deadlock on the GDK lock.
if (changing && Thread.currentThread() == GtkToolkit.mainThread)
if (currentState != state)
{
changing = false;
return;
currentState = state;
gtkToggleButtonSetActive(state);
}
if (currentState != state)
gtkToggleButtonSetActive (state);
}
public void setLabel (String label)
......@@ -111,21 +117,14 @@ public class GtkCheckboxPeer extends GtkComponentPeer
// Override the superclass postItemEvent so that the peer doesn't
// need information that we have.
// called back by native side: item_toggled_cb
public void postItemEvent (Object item, int stateChange)
synchronized public void postItemEvent(Object item, boolean state)
{
Checkbox currentCheckBox = ((Checkbox)awtComponent);
// A firing of the event is only desired if the state has changed due to a
// button press. The currentCheckBox's state must be different from the
// one that the stateChange is changing to.
// stateChange = 1 if it goes from false -> true
// stateChange = 2 if it goes from true -> false
if (( !currentCheckBox.getState() && stateChange == 1)
|| (currentCheckBox.getState() && stateChange == 2))
// Only fire event is state actually changed.
if (currentState != state)
{
super.postItemEvent (awtComponent, stateChange);
currentState = !currentCheckBox.getState();
changing = true;
currentCheckBox.setState(currentState);
currentState = state;
super.postItemEvent(awtComponent,
state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
}
}
......
/* GtkComponentPeer.java -- Implements ComponentPeer with GTK
Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -46,10 +47,10 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Insets;
......@@ -87,8 +88,6 @@ public class GtkComponentPeer extends GtkGenericPeer
boolean isInRepaint;
static final Timer repaintTimer = new Timer (true);
/* this isEnabled differs from Component.isEnabled, in that it
knows if a parent is disabled. In that case Component.isEnabled
may return true, but our isEnabled will always return false */
......@@ -146,11 +145,6 @@ public class GtkComponentPeer extends GtkGenericPeer
Component parent = awtComponent.getParent ();
// Only set our parent on the GTK side if our parent on the AWT
// side is not showing. Otherwise the gtk peer will be shown
// before we've had a chance to position and size it properly.
if (awtComponent instanceof Window
|| (parent != null && ! parent.isShowing ()))
setParentAndBounds ();
setNativeEventMask ();
......@@ -202,11 +196,6 @@ public class GtkComponentPeer extends GtkGenericPeer
void setComponentBounds ()
{
Rectangle bounds = awtComponent.getBounds ();
if (bounds.x == 0 && bounds.y == 0
&& bounds.width == 0 && bounds.height == 0)
return;
setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
}
......@@ -306,24 +295,24 @@ public class GtkComponentPeer extends GtkGenericPeer
{
try
{
Graphics g = getGraphics ();
Graphics g = getGraphics();
// Some peers like GtkFileDialogPeer are repainted by Gtk itself
if (g == null)
if (!awtComponent.isShowing() || awtComponent.getWidth() < 1
|| awtComponent.getHeight() < 1 || g == null)
break;
g.setClip (((PaintEvent) event).getUpdateRect());
g.setClip(((PaintEvent) event).getUpdateRect());
if (id == PaintEvent.PAINT)
awtComponent.paint (g);
awtComponent.paint(g);
else
awtComponent.update (g);
awtComponent.update(g);
g.dispose ();
g.dispose();
}
catch (InternalError e)
{
System.err.println (e);
System.err.println(e);
}
}
break;
......@@ -383,19 +372,30 @@ public class GtkComponentPeer extends GtkGenericPeer
if (x == 0 && y == 0 && width == 0 && height == 0)
return;
repaintTimer.schedule(new RepaintTimerTask(x, y, width, height), tm);
if (tm <= 0)
q().postEvent(new PaintEvent(awtComponent, PaintEvent.UPDATE,
new Rectangle(x, y, width, height)));
else
RepaintTimerTask.schedule(tm, x, y, width, height, awtComponent);
}
private class RepaintTimerTask extends TimerTask
/**
* Used for scheduling delayed paint updates on the event queue.
*/
private static class RepaintTimerTask extends TimerTask
{
private static final Timer repaintTimer = new Timer(true);
private int x, y, width, height;
private Component awtComponent;
RepaintTimerTask(int x, int y, int width, int height)
RepaintTimerTask(Component c, int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.awtComponent = c;
}
public void run()
......@@ -403,6 +403,12 @@ public class GtkComponentPeer extends GtkGenericPeer
q().postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
new Rectangle (x, y, width, height)));
}
static void schedule(long tm, int x, int y, int width, int height,
Component c)
{
repaintTimer.schedule(new RepaintTimerTask(c, x, y, width, height), tm);
}
}
public void requestFocus ()
......@@ -429,7 +435,6 @@ public class GtkComponentPeer extends GtkGenericPeer
int new_y = y;
Component parent = awtComponent.getParent ();
Component next_parent;
// Heavyweight components that are children of one or more
// lightweight containers have to be handled specially. Because
......@@ -441,33 +446,19 @@ public class GtkComponentPeer extends GtkGenericPeer
// so we need to continue adding offsets until we reach a
// container whose position GTK knows -- that is, the first
// non-lightweight.
boolean lightweightChild = false;
Insets i;
while (parent.isLightweight ())
while (parent.isLightweight())
{
lightweightChild = true;
next_parent = parent.getParent ();
i = ((Container) parent).getInsets();
i = ((Container) parent).getInsets ();
new_x += parent.getX() + i.left;
new_y += parent.getY() + i.top;
if (next_parent instanceof Window)
{
new_x += i.left;
new_y += i.top;
parent = parent.getParent();
}
else
{
new_x += parent.getX () + i.left;
new_y += parent.getY () + i.top;
}
parent = next_parent;
}
// We only need to convert from Java to GTK coordinates if we're
// placing a heavyweight component in a Window.
if (parent instanceof Window && !lightweightChild)
if (parent instanceof Window)
{
GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer ();
// important: we want the window peer's insets here, not the
......@@ -480,11 +471,16 @@ public class GtkComponentPeer extends GtkGenericPeer
if (peer instanceof GtkFramePeer)
menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight ();
new_x = x - insets.left;
new_y = y - insets.top + menuBarHeight;
new_x -= insets.left;
new_y -= insets.top;
new_y += menuBarHeight;
}
setNativeBounds (new_x, new_y, width, height);
// If the height or width were (or are now) smaller than zero
// then we want to adjust the visibility.
setVisible(awtComponent.isVisible());
}
void setCursor ()
......@@ -535,6 +531,13 @@ public class GtkComponentPeer extends GtkGenericPeer
public void setVisible (boolean b)
{
// Only really set visible when component is bigger than zero pixels.
if (b)
{
Rectangle bounds = awtComponent.getBounds();
b = (bounds.width > 0) && (bounds.height > 0);
}
if (Thread.currentThread() == GtkToolkit.mainThread)
setVisibleNativeUnlocked (b);
else
......@@ -571,6 +574,8 @@ public class GtkComponentPeer extends GtkGenericPeer
KeyEvent keyEvent = new KeyEvent (awtComponent, id, when, mods,
keyCode, keyChar, keyLocation);
EventQueue q = q();
// Also post a KEY_TYPED event if keyEvent is a key press that
// doesn't represent an action or modifier key.
if (keyEvent.getID () == KeyEvent.KEY_PRESSED
......@@ -579,15 +584,17 @@ public class GtkComponentPeer extends GtkGenericPeer
&& keyCode != KeyEvent.VK_CONTROL
&& keyCode != KeyEvent.VK_ALT))
{
synchronized (q)
synchronized(q)
{
q().postEvent (keyEvent);
q().postEvent (new KeyEvent (awtComponent, KeyEvent.KEY_TYPED, when, mods,
KeyEvent.VK_UNDEFINED, keyChar, keyLocation));
q.postEvent(keyEvent);
keyEvent = new KeyEvent(awtComponent, KeyEvent.KEY_TYPED, when,
mods, KeyEvent.VK_UNDEFINED, keyChar,
keyLocation);
q.postEvent(keyEvent);
}
}
else
q().postEvent (keyEvent);
q.postEvent(keyEvent);
}
protected void postFocusEvent (int id, boolean temporary)
......
/* GtkContainerPeer.java -- Implements ContainerPeer with GTK
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -65,29 +65,6 @@ public class GtkContainerPeer extends GtkComponentPeer
public void endValidate ()
{
Component parent = awtComponent.getParent ();
// Only set our parent on the GTK side if our parent on the AWT
// side is not showing. Otherwise the gtk peer will be shown
// before we've had a chance to position and size it properly.
if (parent != null && parent.isShowing ())
{
Component[] components = ((Container) awtComponent).getComponents ();
int ncomponents = components.length;
for (int i = 0; i < ncomponents; i++)
{
ComponentPeer peer = components[i].getPeer ();
// Skip lightweight peers.
if (peer instanceof GtkComponentPeer)
((GtkComponentPeer) peer).setParentAndBounds ();
}
// GTK windows don't have parents.
if (!(awtComponent instanceof Window))
setParentAndBounds ();
}
}
public Insets getInsets()
......
......@@ -41,8 +41,6 @@ package gnu.java.awt.peer.gtk;
import java.awt.Dialog;
import java.awt.FileDialog;
import java.awt.Graphics;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.peer.FileDialogPeer;
import java.io.File;
import java.io.FilenameFilter;
......@@ -69,6 +67,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
FileDialog fd = (FileDialog) awtComponent;
nativeSetDirectory(System.getProperty("user.dir"));
setDirectory(fd.getDirectory());
setFile(fd.getFile());
......@@ -117,13 +116,9 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
// is not absolute, let's construct it based on current directory.
currentFile = fileName;
if (fileName.indexOf(FS) == 0)
{
nativeSetFile (fileName);
}
nativeSetFile(fileName);
else
{
nativeSetFile (nativeGetDirectory() + FS + fileName);
}
nativeSetFile(nativeGetDirectory() + FS + fileName);
}
public void setDirectory (String directory)
......@@ -132,18 +127,24 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
the only way we have to set the directory in FileDialog is by
calling its setDirectory which will call us back. */
if ((directory == null && currentDirectory == null)
|| (directory != null && directory.equals (currentDirectory)))
|| (directory != null && directory.equals(currentDirectory)))
return;
if (directory == null || directory.equals (""))
if (directory == null || directory.equals(""))
{
currentDirectory = FS;
nativeSetFile (FS);
nativeSetDirectory(FS);
return;
}
// GtkFileChooser requires absolute directory names. If the given directory
// name is not absolute, construct it based on current directory if it is not
// null. Otherwise, use FS.
currentDirectory = directory;
nativeSetDirectory (directory);
if (directory.indexOf(FS) == 0)
nativeSetDirectory(directory);
else
nativeSetDirectory(nativeGetDirectory() + FS + directory);
}
public void setFilenameFilter (FilenameFilter filter)
......
......@@ -43,10 +43,7 @@ import java.awt.Graphics;
import java.awt.Image;
import java.awt.MenuBar;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.PaintEvent;
import java.awt.image.ColorModel;
import java.awt.peer.FramePeer;
import java.awt.peer.MenuBarPeer;
......@@ -77,6 +74,9 @@ public class GtkFramePeer extends GtkWindowPeer
removeMenuBarPeer ();
insets.top -= menuBarHeight;
menuBarHeight = 0;
// if component has already been validated, we need to revalidate.
// otherwise, it will be validated when it is shown.
if (awtComponent.isValid())
awtComponent.validate ();
gtkFixedSetVisible (true);
}
......@@ -92,6 +92,9 @@ public class GtkFramePeer extends GtkWindowPeer
setMenuBarWidth (menuBar, menuBarWidth);
menuBarHeight = getMenuBarHeight ();
insets.top += menuBarHeight;
// if component has already been validated, we need to revalidate.
// otherwise, it will be validated when it is shown.
if (awtComponent.isValid())
awtComponent.validate ();
gtkFixedSetVisible (true);
}
......
/* GtkGenericPeer.java - Has a hashcode. Yuck.
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2002, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -39,23 +39,28 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
public class GtkGenericPeer
{
// Used by Native State Association (NSA) functions to map
// gtk_widget to peer object.
final int native_state = getUniqueInteger ();
// Next native state value we will assign.
private static int next_native_state = 0;
// The widget or other java-side object we wrap.
protected Object awtWidget;
// Global event queue.
protected static EventQueue q = null;
// Dispose of our native state.
protected final Object awtWidget;
/**
* Dispose of our native state. Calls gtk_widget_destroy on the
* native widget and removes the awtWidget from the native state
* tables. Should be overridden by subclasses if this is not (all)
* that needs to be done.
*/
public native void dispose ();
static EventQueue q ()
......@@ -68,12 +73,6 @@ public class GtkGenericPeer
this.awtWidget = awtWidget;
}
public static void enableQueue (EventQueue sq)
{
if (q == null)
q = sq;
}
protected void postActionEvent (String command, int mods)
{
q().postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED,
......@@ -89,7 +88,19 @@ public class GtkGenericPeer
return next_native_state++;
}
native void gtkWidgetModifyFont (String name, int style, int size);
/**
* Helper method to set Font for Gtk Widget.
*/
protected void gtkWidgetModifyFont(Font f)
{
gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
}
/**
* Sets font for this Gtk Widget. Should be overridden by peers which
* are composed of different widgets or are contained in bins.
*/
protected native void gtkWidgetModifyFont(String name, int style, int size);
static void printCurrentThread ()
{
......
/* GtkImage.java
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -329,6 +329,24 @@ public class GtkImage extends Image
props = new Hashtable();
}
// The singleton GtkImage that is returned on errors by GtkToolkit.
private static GtkImage errorImage;
/**
* Returns an empty GtkImage with the errorLoading flag set.
* Called from GtkToolKit when some error occured, but an image needs
* to be returned anyway.
*/
static synchronized GtkImage getErrorImage()
{
if (errorImage == null)
{
errorImage = new GtkImage();
errorImage.errorLoading = true;
}
return errorImage;
}
/**
* Native helper function for constructor that takes a pixbuf Pointer.
*/
......
/* GtkLabelPeer.java -- Implements LabelPeer with GTK
Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -48,7 +48,12 @@ public class GtkLabelPeer extends GtkComponentPeer
implements LabelPeer
{
native void create (String text, float alignment);
native void gtkWidgetModifyFont (String name, int style, int size);
/**
* Overridden to set the Font of the label inside the gtk_event_box.
*/
protected native void gtkWidgetModifyFont(String name, int style, int size);
native void nativeSetAlignment (float alignment);
public native void setText(String text);
......
/* GtkListPeer.java -- Implements ListPeer with GTK
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -59,7 +59,12 @@ public class GtkListPeer extends GtkComponentPeer
native void create (int rows);
native void connectSignals ();
native void gtkWidgetModifyFont (String name, int style, int size);
/**
* Overridden to set the Font of the text insode the gtk_scrolled_window.
*/
protected native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkWidgetRequestFocus ();
native void getSize (int rows, int visibleRows, int dims[]);
......
/* GtkMenuBarPeer.java -- Implements MenuBarPeer with GTK+
Copyright (C) 1999, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -48,38 +48,69 @@ import java.awt.peer.MenuPeer;
public class GtkMenuBarPeer extends GtkMenuComponentPeer
implements MenuBarPeer
{
native void create ();
native void addMenu (MenuPeer menu);
public GtkMenuBarPeer (MenuBar target)
/** Whether we already have an help menu set on this peer. */
private boolean hasHelpMenu;
/**
* Creates the gtk+ widget for this peer and puts it in the nsa
* table. Called from the (super class) constructor.
*/
protected native void create();
/**
* Adds a new GtkMenuPeer to the end of the GtkMenuBarPeer.
*/
private native void addMenu(GtkMenuPeer menu);
/**
* Creates a new GtkMenuBarPeer associated with the given MenuBar.
*/
public GtkMenuBarPeer(MenuBar menubar)
{
super (target);
super(menubar);
}
void setFont ()
/**
* Adds a help menu to this MenuBar. Gnome styleguides say the help
* menu is just the last item in the menubar (they are NOT right
* justified).
*/
public void addHelpMenu (Menu menu)
{
MenuComponent mc = (MenuComponent) awtWidget;
Font f = mc.getFont ();
if (f == null)
mc.setFont (new Font ("Dialog", Font.PLAIN, 12));
if (hasHelpMenu)
{
// Remove the (help) menu, which is after all the other items.
delMenu(((MenuBar) awtWidget).getMenuCount());
hasHelpMenu = false;
}
// FIXME: remove this method or replace it with one that does
// something useful.
/* In Gnome, help menus are no longer right flushed. */
native void nativeSetHelpMenu(MenuPeer menuPeer);
public void addHelpMenu (Menu menu)
if (menu != null)
{
// nativeSetHelpMenu((MenuPeer) menu.getPeer());
addMenu(menu);
hasHelpMenu = true;
}
}
/**
* Deletes the menu at (zero-based) index from this GtkMenuBar.
*/
public native void delMenu(int index);
public void addMenu (Menu m)
/**
* Adds the GtkMenuPeer associated with the Menu to this
* GtkMenuBarPeer. Makes sure that any help menus keep the last menu
* on the bar.
*/
public void addMenu(Menu m)
{
// FIXME: implement
// Make sure the help menu is the last one.
if (hasHelpMenu)
{
addHelpMenu(null);
addMenu((GtkMenuPeer) m.getPeer());
addHelpMenu(((MenuBar) awtWidget).getHelpMenu());
}
else
addMenu((GtkMenuPeer) m.getPeer());
}
}
/* GtkMenuComponentPeer.java -- Implements MenuComponentPeer with GTK+
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -39,31 +39,66 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
import java.awt.Font;
import java.awt.MenuComponent;
import java.awt.MenuContainer;
import java.awt.peer.MenuComponentPeer;
public class GtkMenuComponentPeer extends GtkGenericPeer
public abstract class GtkMenuComponentPeer extends GtkGenericPeer
implements MenuComponentPeer
{
void create ()
/**
* Creates the associated gtk+ widget and stores it in the nsa table
* for this peer. Called by the constructor.
*/
protected abstract void create ();
/**
* Sets font based on MenuComponent font, or containing menu(bar)
* parent font.
*/
private void setFont()
{
throw new RuntimeException ();
}
MenuComponent mc = ((MenuComponent) awtWidget);
Font f = mc.getFont();
void setFont ()
if (f == null)
{
MenuContainer parent = mc.getParent ();
// Submenus inherit the font of their containing Menu(Bar).
if (parent instanceof MenuComponent)
f = parent.getFont ();
}
setFont(f);
}
public GtkMenuComponentPeer (Object awtWidget)
/**
* Will call the abstract <code>create()</code> that needs to be
* overridden by subclasses, to create the MenuComponent. It will
* then correctly setup the font for the component based on the
* component and/or its containing parent component.
*/
public GtkMenuComponentPeer(MenuComponent component)
{
super (awtWidget);
create ();
setFont ();
super(component);
create();
setFont();
}
/**
* Removes the awtWidget components from the native state tables.
* Subclasses should call <code>super.dispose()</code> if they don't
* remove these themselves.
*/
public native void dispose();
/**
* Sets the font for this particular MenuComponent only (not any
* containing items, if any).
*/
public void setFont(Font font)
{
// FIXME: implement
if (font != null)
gtkWidgetModifyFont(font);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment