summaryrefslogtreecommitdiff
path: root/javax
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2006-03-05 11:38:08 +0000
committerMark Wielaard <mark@klomp.org>2006-03-05 11:38:08 +0000
commit151c7439c5d7ca440f17b408ea9e2b750cd42543 (patch)
treee6eb1ec4bfeaa33e1a3936edd8c9b5d2dd862dfd /javax
parentcb35a91377f1dc2d7b1b5bc4c70ab91cbb36506f (diff)
downloadclasspath-151c7439c5d7ca440f17b408ea9e2b750cd42543.tar.gz
* configure.ac (VERSION): Set to 0.90-pre-generics.
* Merge with CVS trunk from classpath-0_90-branch-point.
Diffstat (limited to 'javax')
-rw-r--r--javax/imageio/ImageWriteParam.java94
-rw-r--r--javax/imageio/plugins/bmp/BMPImageWriteParam.java144
-rw-r--r--javax/naming/AuthenticationException.java4
-rw-r--r--javax/naming/AuthenticationNotSupportedException.java4
-rw-r--r--javax/naming/Binding.java4
-rw-r--r--javax/naming/CannotProceedException.java4
-rw-r--r--javax/naming/CommunicationException.java4
-rw-r--r--javax/naming/ConfigurationException.java4
-rw-r--r--javax/naming/ContextNotEmptyException.java4
-rw-r--r--javax/naming/InsufficientResourcesException.java4
-rw-r--r--javax/naming/InterruptedNamingException.java4
-rw-r--r--javax/naming/InvalidNameException.java4
-rw-r--r--javax/naming/LimitExceededException.java4
-rw-r--r--javax/naming/LinkException.java4
-rw-r--r--javax/naming/LinkLoopException.java4
-rw-r--r--javax/naming/MalformedLinkException.java4
-rw-r--r--javax/naming/NameAlreadyBoundException.java4
-rw-r--r--javax/naming/NameClassPair.java4
-rw-r--r--javax/naming/NameNotFoundException.java4
-rw-r--r--javax/naming/NamingException.java2
-rw-r--r--javax/naming/NoInitialContextException.java4
-rw-r--r--javax/naming/NoPermissionException.java4
-rw-r--r--javax/naming/NotContextException.java4
-rw-r--r--javax/naming/OperationNotSupportedException.java4
-rw-r--r--javax/naming/PartialResultException.java4
-rw-r--r--javax/naming/Reference.java4
-rw-r--r--javax/naming/ServiceUnavailableException.java4
-rw-r--r--javax/naming/SizeLimitExceededException.java4
-rw-r--r--javax/naming/TimeLimitExceededException.java4
-rw-r--r--javax/naming/directory/AttributeInUseException.java4
-rw-r--r--javax/naming/directory/AttributeModificationException.java3
-rw-r--r--javax/naming/directory/InvalidAttributeIdentifierException.java4
-rw-r--r--javax/naming/directory/InvalidAttributeValueException.java4
-rw-r--r--javax/naming/directory/InvalidAttributesException.java4
-rw-r--r--javax/naming/directory/InvalidSearchControlsException.java4
-rw-r--r--javax/naming/directory/InvalidSearchFilterException.java4
-rw-r--r--javax/naming/directory/ModificationItem.java3
-rw-r--r--javax/naming/directory/NoSuchAttributeException.java4
-rw-r--r--javax/naming/directory/SchemaViolationException.java4
-rw-r--r--javax/naming/directory/SearchControls.java3
-rw-r--r--javax/naming/directory/SearchResult.java3
-rw-r--r--javax/naming/event/NamingEvent.java4
-rw-r--r--javax/naming/event/NamingExceptionEvent.java4
-rw-r--r--javax/naming/spi/ResolveResult.java4
-rw-r--r--javax/net/ssl/SSLException.java34
-rw-r--r--javax/print/ServiceUIFactory.java31
-rw-r--r--javax/swing/AbstractAction.java91
-rw-r--r--javax/swing/AbstractCellEditor.java29
-rw-r--r--javax/swing/AbstractListModel.java11
-rw-r--r--javax/swing/CellEditor.java42
-rw-r--r--javax/swing/CellRendererPane.java4
-rw-r--r--javax/swing/ComboBoxModel.java28
-rw-r--r--javax/swing/DefaultCellEditor.java28
-rw-r--r--javax/swing/DefaultListSelectionModel.java9
-rw-r--r--javax/swing/JComponent.java22
-rw-r--r--javax/swing/JEditorPane.java2
-rw-r--r--javax/swing/JInternalFrame.java44
-rw-r--r--javax/swing/JTabbedPane.java2
-rw-r--r--javax/swing/JTable.java6
-rw-r--r--javax/swing/JViewport.java22
-rw-r--r--javax/swing/RepaintManager.java89
-rw-r--r--javax/swing/Spring.java136
-rw-r--r--javax/swing/SpringLayout.java29
-rw-r--r--javax/swing/SwingUtilities.java56
-rw-r--r--javax/swing/UnsupportedLookAndFeelException.java18
-rw-r--r--javax/swing/ViewportLayout.java81
-rw-r--r--javax/swing/event/CaretEvent.java53
-rw-r--r--javax/swing/event/DocumentEvent.java22
-rw-r--r--javax/swing/event/EventListenerList.java4
-rw-r--r--javax/swing/event/ListSelectionEvent.java173
-rw-r--r--javax/swing/event/ListSelectionListener.java26
-rw-r--r--javax/swing/event/MenuDragMouseEvent.java117
-rw-r--r--javax/swing/event/MenuKeyEvent.java113
-rw-r--r--javax/swing/event/TableColumnModelEvent.java104
-rw-r--r--javax/swing/event/TableModelListener.java29
-rw-r--r--javax/swing/event/TreeExpansionEvent.java72
-rw-r--r--javax/swing/event/TreeModelEvent.java245
-rw-r--r--javax/swing/event/TreeSelectionEvent.java45
-rw-r--r--javax/swing/event/UndoableEditEvent.java70
-rw-r--r--javax/swing/plaf/basic/BasicHTML.java295
-rw-r--r--javax/swing/plaf/basic/BasicInternalFrameUI.java27
-rw-r--r--javax/swing/plaf/basic/BasicLabelUI.java57
-rw-r--r--javax/swing/plaf/basic/BasicListUI.java6
-rw-r--r--javax/swing/plaf/basic/BasicScrollBarUI.java42
-rw-r--r--javax/swing/plaf/basic/BasicTextUI.java32
-rw-r--r--javax/swing/plaf/metal/MetalFileChooserUI.java5
-rw-r--r--javax/swing/plaf/metal/MetalScrollBarUI.java59
-rw-r--r--javax/swing/plaf/metal/MetalUtils.java5
-rw-r--r--javax/swing/text/AbstractDocument.java96
-rw-r--r--javax/swing/text/CompositeView.java3
-rw-r--r--javax/swing/text/DefaultCaret.java13
-rw-r--r--javax/swing/text/DefaultFormatter.java6
-rw-r--r--javax/swing/text/DefaultStyledDocument.java152
-rw-r--r--javax/swing/text/FlowView.java7
-rw-r--r--javax/swing/text/GapContent.java2
-rw-r--r--javax/swing/text/JTextComponent.java4
-rw-r--r--javax/swing/text/PlainView.java5
-rw-r--r--javax/swing/text/Segment.java4
-rw-r--r--javax/swing/text/StyleConstants.java68
-rw-r--r--javax/swing/text/TableView.java56
-rw-r--r--javax/swing/text/Utilities.java2
-rw-r--r--javax/swing/text/View.java15
-rw-r--r--javax/swing/text/html/HTMLDocument.java80
-rw-r--r--javax/swing/text/html/HTMLEditorKit.java16
-rw-r--r--javax/swing/text/html/HTMLTableView.java (renamed from javax/xml/stream/XMLIterator.java)49
-rw-r--r--javax/swing/text/package.html4
-rw-r--r--javax/xml/stream/EventFilter.java3
-rw-r--r--javax/xml/stream/Location.java7
-rw-r--r--javax/xml/stream/StreamFilter.java3
-rw-r--r--javax/xml/stream/XMLEventFactory.java6
-rw-r--r--javax/xml/stream/XMLEventReader.java22
-rw-r--r--javax/xml/stream/XMLEventWriter.java2
-rw-r--r--javax/xml/stream/XMLFilter.java46
-rw-r--r--javax/xml/stream/XMLInputFactory.java28
-rw-r--r--javax/xml/stream/XMLOutputFactory.java30
-rw-r--r--javax/xml/stream/XMLReporter.java2
-rw-r--r--javax/xml/stream/XMLResolver.java24
-rw-r--r--javax/xml/stream/XMLStreamConstants.java16
-rw-r--r--javax/xml/stream/XMLStreamReader.java6
-rw-r--r--javax/xml/stream/events/EndEntity.java53
-rw-r--r--javax/xml/stream/events/EntityDeclaration.java6
-rw-r--r--javax/xml/stream/events/EntityReference.java24
-rw-r--r--javax/xml/stream/events/StartEntity.java53
-rw-r--r--javax/xml/stream/events/XMLEvent.java12
-rw-r--r--javax/xml/stream/util/EventReaderDelegate.java24
-rw-r--r--javax/xml/stream/util/ReaderDelegate.java10
-rw-r--r--javax/xml/validation/SchemaFactory.java8
127 files changed, 2385 insertions, 1397 deletions
diff --git a/javax/imageio/ImageWriteParam.java b/javax/imageio/ImageWriteParam.java
index 84b257e04..1979957fe 100644
--- a/javax/imageio/ImageWriteParam.java
+++ b/javax/imageio/ImageWriteParam.java
@@ -46,27 +46,121 @@ import java.util.Locale;
*/
public class ImageWriteParam extends IIOParam
{
+
+ /**
+ * Can be passed to setTilingMode, setProgressiveMode and
+ * setCompressionMode to disable feature.
+ */
public static final int MODE_DISABLED = 0;
+
+ /**
+ * Can be passed to setTilingMode, setProgressiveMode and
+ * setCompressionMode to enable feature.
+ */
public static final int MODE_DEFAULT = 1;
+
+ /**
+ * Can be passed to setTilingMode, setCompressionMode to disable feature.
+ */
public static final int MODE_EXPLICIT = 2;
+
+ /**
+ * Can be passed to setTilingMode, setProgressiveMode and
+ * setCompressionMode to enable feature.
+ */
public static final int MODE_COPY_FROM_METADATA = 3;
+ /**
+ * True if tiling grid offset parameters can be set.
+ */
protected boolean canOffsetTiles;
+
+ /**
+ * True if this writer can write images using compression.
+ */
protected boolean canWriteCompressed;
+
+ /**
+ * True if images can be written as a progressive sequence
+ * of increasing quality.
+ */
protected boolean canWriteProgressive;
+
+ /**
+ * True if tile width and height parameters can be set.
+ */
protected boolean canWriteTiles;
+
+ /**
+ * Controls compression settings, which must be set to one of the four
+ * MODE_* values.
+ */
protected int compressionMode = MODE_COPY_FROM_METADATA;
+
+ /**
+ * Contains the current compression quality setting.
+ */
protected float compressionQuality;
+
+ /**
+ * Contains the name of the available compression types.
+ */
protected String compressionType;
+
+ /**
+ * Array of the names of the available compression types.
+ */
protected String[] compressionTypes;
+
+ /**
+ * Localizes compression type names and quality descriptions,
+ * or null to use default Locale.
+ */
protected Locale locale;
+
+ /**
+ * Preferred tile size range pairs.
+ */
protected Dimension[] preferredTileSizes;
+
+ /**
+ * The mode controlling progressive encoding, which must
+ * be set to one of the four MODE_* values, except
+ * MODE_EXPLICIT.
+ */
protected int progressiveMode = MODE_COPY_FROM_METADATA;
+
+ /**
+ * The amount by which the tile grid origin should be offset
+ * horizontally from the image origin if tiling has been set.
+ */
protected int tileGridXOffset;
+
+ /**
+ * The amount by which the tile grid origin should be offset
+ * vertically from the image origin if tiling has been set.
+ */
protected int tileGridYOffset;
+
+ /**
+ * The height of each tile if tiling has been set.
+ */
protected int tileHeight;
+
+ /**
+ * The width of each tile if tiling has been set.
+ */
protected int tileWidth;
+
+ /**
+ * The mode controlling tiling settings, which must be
+ * set to one of the four MODE_* values.
+ */
protected int tilingMode;
+
+ /**
+ * True if the tiling parameters have been specified.
+ */
protected boolean tilingSet;
/**
diff --git a/javax/imageio/plugins/bmp/BMPImageWriteParam.java b/javax/imageio/plugins/bmp/BMPImageWriteParam.java
new file mode 100644
index 000000000..de59efba4
--- /dev/null
+++ b/javax/imageio/plugins/bmp/BMPImageWriteParam.java
@@ -0,0 +1,144 @@
+/* BMPImageWriteParam.java --
+ 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 javax.imageio.plugins.bmp;
+
+import java.util.Locale;
+
+import javax.imageio.ImageWriteParam;
+
+/**
+ * A class to encode images in the BMP format.
+ * By default, the data layout is bottom-up, such that the pixels are stored in
+ * bottom-up order.
+ *
+ * The compression scheme can be specified by using setCompressionType()
+ * appropriate type string. The compression scheme specified will be honored
+ * if it is compatible with the type of image being written. If the
+ * compression scheme is not compatible with the type of image being written,
+ * then an IOException will be thrown by the BMP image writer. If the
+ * compression type is not set, then getCompressionType() will return null.
+ * In this case the BMP image writer will select a compression type that
+ * supports encoding of the given image without loss of the color resolution.
+ *
+ * The compression type strings and the image type each supports are:
+ * Uncompressed RLE: BI_RGB, image type: <= 8-bits/sample.
+ * 8-bit Run Length Encoding: BI_RLE8, image type: <= 8-bits/sample
+ * 4-bit Run Length Encoding: BI_RLE4, image type: <= 4-bits/sample
+ * Packed data: BI_BITFIELDS, image type: 16 or 32 bits/sample
+ *
+ * @author Lillian Angel (langel at redhat dot com)
+ */
+public class BMPImageWriteParam
+ extends ImageWriteParam
+{
+
+ /**
+ * This boolean is true if the data will be written in a topdown manner.
+ */
+ private boolean topDown;
+
+ /**
+ * Compression type strings.
+ */
+ String rgb = "BI_RGB";
+ String rle8 = "BI_RLE8";
+ String rle4 = "BI_RLE4";
+ String bitfields = "BI_BITFIELDS";
+
+ /**
+ * Constants to represent image types.
+ */
+ static final int BI_RGB = 0;
+ static final int BI_RLE8 = 1;
+ static final int BI_RLE4 = 2;
+ static final int BI_BITFIELDS = 3;
+
+ /**
+ * Constructs an <code>BMPImageWriteParam</code> object with default values
+ * and a <code>null Locale</code>.
+ */
+ public BMPImageWriteParam()
+ {
+ this(null);
+ }
+
+ /**
+ * Constructs a <code>BMPImageWriteParam</code> set to use a given
+ * <code>Locale</code> and with default values for all parameters.
+ *
+ * @param locale - a <code>Locale</code> to be used to localize compression
+ * type names and quality descriptions, or <code>null</code>.
+ */
+ public BMPImageWriteParam(Locale locale)
+ {
+ super(locale);
+ topDown = false;
+ canWriteCompressed = true;
+
+ compressionTypes = new String[4];
+ compressionTypes[BI_RGB] = rgb;
+ compressionTypes[BI_RLE8] = rle8;
+ compressionTypes[BI_RLE4] = rle4;
+ compressionTypes[BI_BITFIELDS] = bitfields;
+
+ compressionType = compressionTypes[BI_RGB];
+ }
+
+ /**
+ * If set, the data will be written out in a top-down manner, the first
+ * scanline being written first.
+ *
+ * @param topDown - whether the data are written in top-down order.
+ */
+ public void setTopDown(boolean topDown)
+ {
+ this.topDown = topDown;
+ }
+
+ /**
+ * Returns the value of the <code>topDown</code> parameter. The default is
+ * false.
+ *
+ * @return whether the data are written in top-down order.
+ */
+ public boolean isTopDown()
+ {
+ return topDown;
+ }
+}
diff --git a/javax/naming/AuthenticationException.java b/javax/naming/AuthenticationException.java
index f332561e4..1a6ade930 100644
--- a/javax/naming/AuthenticationException.java
+++ b/javax/naming/AuthenticationException.java
@@ -1,5 +1,5 @@
/* AuthenticationException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class AuthenticationException extends NamingSecurityException
{
+ private static final long serialVersionUID = 3678497619904568096L;
+
public AuthenticationException ()
{
super ();
diff --git a/javax/naming/AuthenticationNotSupportedException.java b/javax/naming/AuthenticationNotSupportedException.java
index 52b133a5c..a1e811b44 100644
--- a/javax/naming/AuthenticationNotSupportedException.java
+++ b/javax/naming/AuthenticationNotSupportedException.java
@@ -1,5 +1,5 @@
/* AuthenticationNotSupportedException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ package javax.naming;
public class AuthenticationNotSupportedException
extends NamingSecurityException
{
+ private static final long serialVersionUID = - 7149033933259492300L;
+
public AuthenticationNotSupportedException ()
{
super ();
diff --git a/javax/naming/Binding.java b/javax/naming/Binding.java
index 91c0d95f7..9d6608aba 100644
--- a/javax/naming/Binding.java
+++ b/javax/naming/Binding.java
@@ -1,5 +1,5 @@
/* Binding.java --
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,8 @@ package javax.naming;
*/
public class Binding extends NameClassPair
{
+ private static final long serialVersionUID = 8839217842691845890L;
+
public Binding (String name, Object obj)
{
super (name, null);
diff --git a/javax/naming/CannotProceedException.java b/javax/naming/CannotProceedException.java
index 8a5b90745..bc2085879 100644
--- a/javax/naming/CannotProceedException.java
+++ b/javax/naming/CannotProceedException.java
@@ -1,5 +1,5 @@
/* CannotProceedException.java --
- Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,8 @@ import java.util.Hashtable;
public class CannotProceedException extends NamingException
{
+ private static final long serialVersionUID = 1219724816191576813L;
+
// Serialized fields.
protected Name remainingNewName;
protected Hashtable<?, ?> environment;
diff --git a/javax/naming/CommunicationException.java b/javax/naming/CommunicationException.java
index c780387cf..7b11b5fac 100644
--- a/javax/naming/CommunicationException.java
+++ b/javax/naming/CommunicationException.java
@@ -1,5 +1,5 @@
/* CommunicationException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class CommunicationException extends NamingException
{
+ private static final long serialVersionUID = 3618507780299986611L;
+
public CommunicationException ()
{
super ();
diff --git a/javax/naming/ConfigurationException.java b/javax/naming/ConfigurationException.java
index 196654865..1f4002aa4 100644
--- a/javax/naming/ConfigurationException.java
+++ b/javax/naming/ConfigurationException.java
@@ -1,5 +1,5 @@
/* ConfigurationException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class ConfigurationException extends NamingException
{
+ private static final long serialVersionUID = - 2535156726228855704L;
+
public ConfigurationException ()
{
super ();
diff --git a/javax/naming/ContextNotEmptyException.java b/javax/naming/ContextNotEmptyException.java
index c6fe5e81c..acbd46bff 100644
--- a/javax/naming/ContextNotEmptyException.java
+++ b/javax/naming/ContextNotEmptyException.java
@@ -1,5 +1,5 @@
/* ContextNotEmptyException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class ContextNotEmptyException extends NamingException
{
+ private static final long serialVersionUID = 1090963683348219877L;
+
public ContextNotEmptyException ()
{
super ();
diff --git a/javax/naming/InsufficientResourcesException.java b/javax/naming/InsufficientResourcesException.java
index bcb9fe577..7a9ebe037 100644
--- a/javax/naming/InsufficientResourcesException.java
+++ b/javax/naming/InsufficientResourcesException.java
@@ -1,5 +1,5 @@
/* InsufficientResourcesException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class InsufficientResourcesException extends NamingException
{
+ private static final long serialVersionUID = 6227672693037844532L;
+
public InsufficientResourcesException ()
{
super ();
diff --git a/javax/naming/InterruptedNamingException.java b/javax/naming/InterruptedNamingException.java
index 8cdf30d4e..90d6e5ec0 100644
--- a/javax/naming/InterruptedNamingException.java
+++ b/javax/naming/InterruptedNamingException.java
@@ -1,5 +1,5 @@
/* InterruptedNamingException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class InterruptedNamingException extends NamingException
{
+ private static final long serialVersionUID = 6404516648893194728L;
+
public InterruptedNamingException ()
{
super ();
diff --git a/javax/naming/InvalidNameException.java b/javax/naming/InvalidNameException.java
index a3b99e1f6..286f0455d 100644
--- a/javax/naming/InvalidNameException.java
+++ b/javax/naming/InvalidNameException.java
@@ -1,5 +1,5 @@
/* InvalidNameException.java -- Exception indicating an invalid component/name
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,8 @@ package javax.naming;
*/
public class InvalidNameException extends NamingException
{
+ private static final long serialVersionUID = - 8370672380823801105L;
+
/**
* Creates a new exception without setting any of its fields.
*/
diff --git a/javax/naming/LimitExceededException.java b/javax/naming/LimitExceededException.java
index 7e7af81c7..8c005ac2c 100644
--- a/javax/naming/LimitExceededException.java
+++ b/javax/naming/LimitExceededException.java
@@ -1,5 +1,5 @@
/* LimitExceededException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class LimitExceededException extends NamingException
{
+ private static final long serialVersionUID = - 776898738660207856L;
+
public LimitExceededException ()
{
super ();
diff --git a/javax/naming/LinkException.java b/javax/naming/LinkException.java
index 2c3c50711..8f5df8b03 100644
--- a/javax/naming/LinkException.java
+++ b/javax/naming/LinkException.java
@@ -1,5 +1,5 @@
/* LinkException.java --
- Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +46,8 @@ package javax.naming;
public class LinkException extends NamingException
{
+ private static final long serialVersionUID = - 7967662604076777712L;
+
// Serialized fields.
protected Name linkResolvedName;
protected Object linkResolvedObj;
diff --git a/javax/naming/LinkLoopException.java b/javax/naming/LinkLoopException.java
index 9c00dbeb6..0c68e01bf 100644
--- a/javax/naming/LinkLoopException.java
+++ b/javax/naming/LinkLoopException.java
@@ -1,5 +1,5 @@
/* LinkLoopException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class LinkLoopException extends LinkException
{
+ private static final long serialVersionUID = - 3119189944325198009L;
+
public LinkLoopException ()
{
super ();
diff --git a/javax/naming/MalformedLinkException.java b/javax/naming/MalformedLinkException.java
index 5422b9094..db0753ded 100644
--- a/javax/naming/MalformedLinkException.java
+++ b/javax/naming/MalformedLinkException.java
@@ -1,5 +1,5 @@
/* MalformedLinkException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class MalformedLinkException extends LinkException
{
+ private static final long serialVersionUID = - 3066740437737830242L;
+
public MalformedLinkException ()
{
super ();
diff --git a/javax/naming/NameAlreadyBoundException.java b/javax/naming/NameAlreadyBoundException.java
index 4b2fb0e74..5ddd7d8ba 100644
--- a/javax/naming/NameAlreadyBoundException.java
+++ b/javax/naming/NameAlreadyBoundException.java
@@ -1,5 +1,5 @@
/* NameAlreadyBoundException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class NameAlreadyBoundException extends NamingException
{
+ private static final long serialVersionUID = - 8491441000356780586L;
+
public NameAlreadyBoundException ()
{
super ();
diff --git a/javax/naming/NameClassPair.java b/javax/naming/NameClassPair.java
index 4e2605131..127730af4 100644
--- a/javax/naming/NameClassPair.java
+++ b/javax/naming/NameClassPair.java
@@ -1,5 +1,5 @@
/* NameClassPair.java --
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +46,8 @@ import java.io.Serializable;
*/
public class NameClassPair implements Serializable
{
+ private static final long serialVersionUID = 5620776610160863339L;
+
public NameClassPair (String name, String className)
{
this (name, className, true);
diff --git a/javax/naming/NameNotFoundException.java b/javax/naming/NameNotFoundException.java
index b533b0412..b7c24a629 100644
--- a/javax/naming/NameNotFoundException.java
+++ b/javax/naming/NameNotFoundException.java
@@ -1,5 +1,5 @@
/* NameNotFoundException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class NameNotFoundException extends NamingException
{
+ private static final long serialVersionUID = - 8007156725367842053L;
+
public NameNotFoundException ()
{
super ();
diff --git a/javax/naming/NamingException.java b/javax/naming/NamingException.java
index ad3923326..dbe1e3792 100644
--- a/javax/naming/NamingException.java
+++ b/javax/naming/NamingException.java
@@ -223,7 +223,7 @@ public class NamingException extends Exception
/**
* Gets the message given to the constructor or null if no message was given.
*
- * @see Throwable#getMessage();
+ * @see Throwable#getMessage()
*/
public String getExplanation()
{
diff --git a/javax/naming/NoInitialContextException.java b/javax/naming/NoInitialContextException.java
index d12dfcb7b..5e4f6df0e 100644
--- a/javax/naming/NoInitialContextException.java
+++ b/javax/naming/NoInitialContextException.java
@@ -1,5 +1,5 @@
/* NoInitialContextException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class NoInitialContextException extends NamingException
{
+ private static final long serialVersionUID = - 3413733186901258623L;
+
public NoInitialContextException()
{
super();
diff --git a/javax/naming/NoPermissionException.java b/javax/naming/NoPermissionException.java
index ddc43937c..02764a991 100644
--- a/javax/naming/NoPermissionException.java
+++ b/javax/naming/NoPermissionException.java
@@ -1,5 +1,5 @@
/* NoPermissionException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class NoPermissionException extends NamingSecurityException
{
+ private static final long serialVersionUID = 8395332708699751775L;
+
public NoPermissionException ()
{
super ();
diff --git a/javax/naming/NotContextException.java b/javax/naming/NotContextException.java
index b3d02cfbb..a27f10f18 100644
--- a/javax/naming/NotContextException.java
+++ b/javax/naming/NotContextException.java
@@ -1,5 +1,5 @@
/* NotContextException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class NotContextException extends NamingException
{
+ private static final long serialVersionUID = 849752551644540417L;
+
public NotContextException ()
{
super ();
diff --git a/javax/naming/OperationNotSupportedException.java b/javax/naming/OperationNotSupportedException.java
index a4a4945af..d813403de 100644
--- a/javax/naming/OperationNotSupportedException.java
+++ b/javax/naming/OperationNotSupportedException.java
@@ -1,5 +1,5 @@
/* OperationNotSupportedException.java --
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,8 @@ package javax.naming;
public class OperationNotSupportedException extends NamingException
{
+ private static final long serialVersionUID = 5493232822427682064L;
+
public OperationNotSupportedException()
{
super();
diff --git a/javax/naming/PartialResultException.java b/javax/naming/PartialResultException.java
index 32f389d13..61660781f 100644
--- a/javax/naming/PartialResultException.java
+++ b/javax/naming/PartialResultException.java
@@ -1,5 +1,5 @@
/* PartialResultException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class PartialResultException extends NamingException
{
+ private static final long serialVersionUID = 2572144970049426786L;
+
public PartialResultException ()
{
super ();
diff --git a/javax/naming/Reference.java b/javax/naming/Reference.java
index ebf570459..67e31c056 100644
--- a/javax/naming/Reference.java
+++ b/javax/naming/Reference.java
@@ -1,5 +1,5 @@
/* Reference.java --
- Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,8 @@ import java.util.Vector;
*/
public class Reference implements Cloneable, Serializable
{
+ private static final long serialVersionUID = - 1673475790065791735L;
+
public Reference (String className)
{
this.className = className;
diff --git a/javax/naming/ServiceUnavailableException.java b/javax/naming/ServiceUnavailableException.java
index 678eb1328..ddb154f9e 100644
--- a/javax/naming/ServiceUnavailableException.java
+++ b/javax/naming/ServiceUnavailableException.java
@@ -1,5 +1,5 @@
/* ServiceUnavailableException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class ServiceUnavailableException extends NamingException
{
+ private static final long serialVersionUID = - 4996964726566773444L;
+
public ServiceUnavailableException ()
{
super ();
diff --git a/javax/naming/SizeLimitExceededException.java b/javax/naming/SizeLimitExceededException.java
index e23f4d2da..3ca9a23b7 100644
--- a/javax/naming/SizeLimitExceededException.java
+++ b/javax/naming/SizeLimitExceededException.java
@@ -1,5 +1,5 @@
/* SizeLimitExceededException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class SizeLimitExceededException extends LimitExceededException
{
+ private static final long serialVersionUID = 7129289564879168579L;
+
public SizeLimitExceededException ()
{
super ();
diff --git a/javax/naming/TimeLimitExceededException.java b/javax/naming/TimeLimitExceededException.java
index f4be6759b..e3456f5bb 100644
--- a/javax/naming/TimeLimitExceededException.java
+++ b/javax/naming/TimeLimitExceededException.java
@@ -1,5 +1,5 @@
/* TimeLimitExceededException.java --
- Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package javax.naming;
public class TimeLimitExceededException extends LimitExceededException
{
+ private static final long serialVersionUID = - 3597009011385034696L;
+
public TimeLimitExceededException ()
{
super ();
diff --git a/javax/naming/directory/AttributeInUseException.java b/javax/naming/directory/AttributeInUseException.java
index 466142452..9be25c9a9 100644
--- a/javax/naming/directory/AttributeInUseException.java
+++ b/javax/naming/directory/AttributeInUseException.java
@@ -1,5 +1,5 @@
/* AttributeInUseException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class AttributeInUseException extends NamingException
{
+ private static final long serialVersionUID = 4437710305529322564L;
+
public AttributeInUseException ()
{
super ();
diff --git a/javax/naming/directory/AttributeModificationException.java b/javax/naming/directory/AttributeModificationException.java
index 4ef6fc20b..9614bac13 100644
--- a/javax/naming/directory/AttributeModificationException.java
+++ b/javax/naming/directory/AttributeModificationException.java
@@ -1,5 +1,5 @@
/* AttributeModificationException.java --
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,7 @@ import javax.naming.NamingException;
public class AttributeModificationException extends NamingException
{
+ private static final long serialVersionUID = 8060676069678710186L;
// Serialized fields.
private ModificationItem[] unexecs;
diff --git a/javax/naming/directory/InvalidAttributeIdentifierException.java b/javax/naming/directory/InvalidAttributeIdentifierException.java
index af1a8c7a2..afd9a902b 100644
--- a/javax/naming/directory/InvalidAttributeIdentifierException.java
+++ b/javax/naming/directory/InvalidAttributeIdentifierException.java
@@ -1,5 +1,5 @@
/* InvalidAttributeIdentifierException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class InvalidAttributeIdentifierException extends NamingException
{
+ private static final long serialVersionUID = - 9036920266322999923L;
+
public InvalidAttributeIdentifierException ()
{
super ();
diff --git a/javax/naming/directory/InvalidAttributeValueException.java b/javax/naming/directory/InvalidAttributeValueException.java
index b667fa9a7..a18adbfa2 100644
--- a/javax/naming/directory/InvalidAttributeValueException.java
+++ b/javax/naming/directory/InvalidAttributeValueException.java
@@ -1,5 +1,5 @@
/* InvalidAttributeValueException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class InvalidAttributeValueException extends NamingException
{
+ private static final long serialVersionUID = 8720050295499275011L;
+
public InvalidAttributeValueException ()
{
super ();
diff --git a/javax/naming/directory/InvalidAttributesException.java b/javax/naming/directory/InvalidAttributesException.java
index ad7f7c1c1..ac540e2d0 100644
--- a/javax/naming/directory/InvalidAttributesException.java
+++ b/javax/naming/directory/InvalidAttributesException.java
@@ -1,5 +1,5 @@
/* InvalidAttributesException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class InvalidAttributesException extends NamingException
{
+ private static final long serialVersionUID = 2607612850539889765L;
+
public InvalidAttributesException ()
{
super ();
diff --git a/javax/naming/directory/InvalidSearchControlsException.java b/javax/naming/directory/InvalidSearchControlsException.java
index 594e5d1bf..9c716fa0f 100644
--- a/javax/naming/directory/InvalidSearchControlsException.java
+++ b/javax/naming/directory/InvalidSearchControlsException.java
@@ -1,5 +1,5 @@
/* InvalidSearchControlsException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class InvalidSearchControlsException extends NamingException
{
+ private static final long serialVersionUID = - 5124108943352665777L;
+
public InvalidSearchControlsException ()
{
super ();
diff --git a/javax/naming/directory/InvalidSearchFilterException.java b/javax/naming/directory/InvalidSearchFilterException.java
index 127b381ea..21843cc01 100644
--- a/javax/naming/directory/InvalidSearchFilterException.java
+++ b/javax/naming/directory/InvalidSearchFilterException.java
@@ -1,5 +1,5 @@
/* InvalidSearchFilterException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class InvalidSearchFilterException extends NamingException
{
+ private static final long serialVersionUID = 2902700940682875441L;
+
public InvalidSearchFilterException ()
{
super ();
diff --git a/javax/naming/directory/ModificationItem.java b/javax/naming/directory/ModificationItem.java
index f0a69f56a..56a5ae609 100644
--- a/javax/naming/directory/ModificationItem.java
+++ b/javax/naming/directory/ModificationItem.java
@@ -1,5 +1,5 @@
/* ModificationItem.java --
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,7 @@ import java.io.Serializable;
public class ModificationItem implements Serializable
{
+ private static final long serialVersionUID = 7573258562534746850L;
// Serialized fields.
private int mod_op;
private Attribute attr;
diff --git a/javax/naming/directory/NoSuchAttributeException.java b/javax/naming/directory/NoSuchAttributeException.java
index cff9f95b7..8eb5e9570 100644
--- a/javax/naming/directory/NoSuchAttributeException.java
+++ b/javax/naming/directory/NoSuchAttributeException.java
@@ -1,5 +1,5 @@
/* NoSuchAttributeException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class NoSuchAttributeException extends NamingException
{
+ private static final long serialVersionUID = 4836415647935888137L;
+
public NoSuchAttributeException ()
{
super ();
diff --git a/javax/naming/directory/SchemaViolationException.java b/javax/naming/directory/SchemaViolationException.java
index a11e50f20..f60f32aad 100644
--- a/javax/naming/directory/SchemaViolationException.java
+++ b/javax/naming/directory/SchemaViolationException.java
@@ -1,5 +1,5 @@
/* SchemaViolationException.java --
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,8 @@ import javax.naming.NamingException;
public class SchemaViolationException extends NamingException
{
+ private static final long serialVersionUID = - 3041762429525049663L;
+
public SchemaViolationException ()
{
super ();
diff --git a/javax/naming/directory/SearchControls.java b/javax/naming/directory/SearchControls.java
index 4cc789d52..5ba488bf7 100644
--- a/javax/naming/directory/SearchControls.java
+++ b/javax/naming/directory/SearchControls.java
@@ -1,5 +1,5 @@
/* SearchControls.java --
- Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,7 @@ import java.io.Serializable;
public class SearchControls implements Serializable
{
+ private static final long serialVersionUID = - 2480540967773454797L;
public static final int OBJECT_SCOPE = 0;
public static final int ONELEVEL_SCOPE = 1;
public static final int SUBTREE_SCOPE = 2;
diff --git a/javax/naming/directory/SearchResult.java b/javax/naming/directory/SearchResult.java
index a6d5490df..ce6bfed6e 100644
--- a/javax/naming/directory/SearchResult.java
+++ b/javax/naming/directory/SearchResult.java
@@ -1,5 +1,5 @@
/* SearchResult.java --
- Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,7 @@ import javax.naming.Binding;
public class SearchResult extends Binding
{
+ private static final long serialVersionUID = - 9158063327699723172L;
// Serialized fields.
private Attributes attrs;
diff --git a/javax/naming/event/NamingEvent.java b/javax/naming/event/NamingEvent.java
index a121b8e13..1bf381a44 100644
--- a/javax/naming/event/NamingEvent.java
+++ b/javax/naming/event/NamingEvent.java
@@ -1,5 +1,5 @@
/* NamingEvent.java --
- Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,8 @@ import javax.naming.Binding;
*/
public class NamingEvent extends EventObject
{
+ private static final long serialVersionUID = - 7126752885365133499L;
+
public static final int OBJECT_ADDED = 0;
public static final int OBJECT_REMOVED = 1;
public static final int OBJECT_RENAMED = 2;
diff --git a/javax/naming/event/NamingExceptionEvent.java b/javax/naming/event/NamingExceptionEvent.java
index 07896d48d..3a9de21f5 100644
--- a/javax/naming/event/NamingExceptionEvent.java
+++ b/javax/naming/event/NamingExceptionEvent.java
@@ -1,5 +1,5 @@
/* NamingExceptionEvent.java --
- Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,6 +49,8 @@ import javax.naming.NamingException;
public class NamingExceptionEvent extends EventObject
{
+ private static final long serialVersionUID = - 4877678086134736336L;
+
// Serialized fields.
private NamingException exception;
diff --git a/javax/naming/spi/ResolveResult.java b/javax/naming/spi/ResolveResult.java
index 72a101ec5..07e2df3c0 100644
--- a/javax/naming/spi/ResolveResult.java
+++ b/javax/naming/spi/ResolveResult.java
@@ -1,5 +1,5 @@
/* ResolveResult.java --
- Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,6 +51,8 @@ import javax.naming.Name;
public class ResolveResult implements Serializable
{
+ private static final long serialVersionUID = - 4552108072002407559L;
+
// Serialized fields.
protected Object resolvedObj;
protected Name remainingName;
diff --git a/javax/net/ssl/SSLException.java b/javax/net/ssl/SSLException.java
index 91d4cb78c..3213b0b45 100644
--- a/javax/net/ssl/SSLException.java
+++ b/javax/net/ssl/SSLException.java
@@ -1,5 +1,5 @@
/* SSLException.java -- generic SSL exception.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,15 +45,47 @@ import java.io.IOException;
* exception is thrown instead of this exception.
*
* @author Casey Marshall (rsdio@metastatic.org)
+ *
+ * @since 1.4
*/
public class SSLException extends IOException
{
+ private static final long serialVersionUID = 4511006460650708967L;
// Constructor.
// ------------------------------------------------------------------
+ /**
+ * Create a new instance with a descriptive error message.
+ *
+ * @param message the descriptive error message
+ */
public SSLException(String message)
{
super(message);
}
+
+ /**
+ * Create a new instance with a descriptive error message and
+ * a cause.
+ * @param message the descriptive error message
+ * @param cause the cause
+ * @since 1.5
+ */
+ public SSLException(String message, Throwable cause)
+ {
+ super(message);
+ initCause(cause);
+ }
+
+ /**
+ * Create a new instance with a cause.
+ * @param cause the cause
+ * @since 1.5
+ */
+ public SSLException(Throwable cause)
+ {
+ super(cause == null ? null : cause.toString());
+ initCause(cause);
+ }
}
diff --git a/javax/print/ServiceUIFactory.java b/javax/print/ServiceUIFactory.java
index 66e611441..1a5c1cfe2 100644
--- a/javax/print/ServiceUIFactory.java
+++ b/javax/print/ServiceUIFactory.java
@@ -1,5 +1,5 @@
/* ServiceUIFactory.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,18 +39,47 @@ exception statement from your version. */
package javax.print;
/**
+ * <code>ServiceUIFactory</code> enables print services to provide additional
+ * user interface dialogs.
+ * <p>
+ * A print service may provide a <code>ServiceUIFactory</code> implementation
+ * if its <code>getServiceUIFactory()</code> method is called. If a factory
+ * object is returned it can be queried for provided user interface dialogs.
+ * Different roles are defined to denote dialogs providing informations about
+ * the print service, dialogs for administration of a print service and for
+ * end-user browsing dialogs.
+ * </p><p>
+ * The factory can support providing these UI roles in different dialog types
+ * (AWT, Swing, JComponent, Panel). The support and use of Swing interfaces is
+ * however preferred.
+ * </p>
+ *
* @author Michael Koch
*/
public abstract class ServiceUIFactory
{
+ /** A user interface providing informations about the print service. */
public static final int ABOUT_UIROLE = 1;
+
+ /** A user interface to administer the print service. */
public static final int ADMIN_UIROLE = 2;
+
+ /** A user interface for end-user browsing of the print service. */
public static final int MAIN_UIROLE = 3;
+
+ /** Role IDs greater than this may be used for other private roles. */
public static final int RESERVED_UIROLE = 99;
+ /** Identifies a UI provided as an AWT dialog. */
public static final String DIALOG_UI = "java.awt.Dialog";
+
+ /** Identifies a UI provided as a Swing JComponent. */
public static final String JCOMPONENT_UI = "javax.swing.JComponent";
+
+ /** Identifies a UI provided as a Swing JDialog. */
public static final String JDIALOG_UI = "javax.swing.JDialog";
+
+ /** Identifies a UI provided as an AWT Panel. */
public static final String PANEL_UI = "java.awt.Panel";
/**
diff --git a/javax/swing/AbstractAction.java b/javax/swing/AbstractAction.java
index 25db58ed0..4a2334570 100644
--- a/javax/swing/AbstractAction.java
+++ b/javax/swing/AbstractAction.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -82,8 +83,9 @@ public abstract class AbstractAction
}
/**
- * Creates a new action with the specified name. All other properties are
- * initialised to <code>null</code>.
+ * Creates a new action with the specified name. The name is stored as a
+ * property with the key {@link Action#NAME}, and no other properties are
+ * initialised.
*
* @param name the name (<code>null</code> permitted).
*/
@@ -93,8 +95,10 @@ public abstract class AbstractAction
}
/**
- * Creates a new action with the specified name and icon. All other
- * properties are initialised to <code>null</code>.
+ * Creates a new action with the specified name and icon. The name is stored
+ * as a property with the key {@link Action#NAME}, the icon is stored as a
+ * property with the key {@link Action#SMALL_ICON}, and no other properties
+ * are initialised.
*
* @param name the name (<code>null</code> permitted).
* @param icon the icon (<code>null</code> permitted).
@@ -132,11 +136,12 @@ public abstract class AbstractAction
}
/**
- * clone
+ * Returns a clone of the action.
*
- * @return Object
+ * @return A clone of the action.
*
- * @exception CloneNotSupportedException TODO
+ * @exception CloneNotSupportedException if there is a problem cloning the
+ * action.
*/
protected Object clone() throws CloneNotSupportedException
{
@@ -152,6 +157,8 @@ public abstract class AbstractAction
*
* @return The value associated with the specified key, or
* <code>null</code> if the key is not found.
+ *
+ * @see #putValue(String, Object)
*/
public Object getValue(String key)
{
@@ -161,11 +168,17 @@ public abstract class AbstractAction
/**
* Sets the value associated with the specified key and sends a
* {@link java.beans.PropertyChangeEvent} to all registered listeners.
- * The standard keys are: {@link #NAME}, {@link #SHORT_DESCRIPTION},
- * {@link #LONG_DESCRIPTION}, {@link #SMALL_ICON},
- * {@link #ACTION_COMMAND_KEY}, {@link #ACCELERATOR_KEY} and
- * {@link #MNEMONIC_KEY}. Any existing value associated with the key will be
- * overwritten.
+ * The standard keys are:
+ * <ul>
+ * <li>{@link #NAME}</li>
+ * <li>{@link #SHORT_DESCRIPTION}</li>
+ * <li>{@link #LONG_DESCRIPTION}</li>
+ * <li>{@link #SMALL_ICON}</li>
+ * <li>{@link #ACTION_COMMAND_KEY}</li>
+ * <li>{@link #ACCELERATOR_KEY}</li>
+ * <li>{@link #MNEMONIC_KEY}</li>
+ * </ul>
+ * Any existing value associated with the key will be overwritten.
*
* @param key the key (not <code>null</code>).
* @param value the value (<code>null</code> permitted).
@@ -184,6 +197,8 @@ public abstract class AbstractAction
* Returns the flag that indicates whether or not the action is enabled.
*
* @return The flag.
+ *
+ * @see #setEnabled(boolean)
*/
public boolean isEnabled()
{
@@ -193,9 +208,12 @@ public abstract class AbstractAction
/**
* Sets the flag that indicates whether or not the action is enabled and, if
* the value of the flag changed from the previous setting, sends a
- * {@link java.beans.PropertyChangeEvent} to all registered listeners.
+ * {@link java.beans.PropertyChangeEvent} to all registered listeners (using
+ * the property name 'enabled').
*
* @param enabled the new flag value.
+ *
+ * @see #isEnabled()
*/
public void setEnabled(boolean enabled)
{
@@ -207,8 +225,11 @@ public abstract class AbstractAction
}
/**
- * getKeys
- * @returns Object[]
+ * Returns an array of the keys for the property values that have been
+ * defined via the {@link #putValue(String, Object)} method (or the class
+ * constructor).
+ *
+ * @return An array of keys.
*/
public Object[] getKeys()
{
@@ -216,12 +237,12 @@ public abstract class AbstractAction
}
/**
- * This method fires a PropertyChangeEvent given the propertyName
- * and the old and new values.
+ * Sends a {@link PropertyChangeEvent} for the named property to all
+ * registered listeners.
*
- * @param propertyName The property that changed.
- * @param oldValue The old value of the property.
- * @param newValue The new value of the property.
+ * @param propertyName the property name.
+ * @param oldValue the old value of the property.
+ * @param newValue the new value of the property.
*/
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue)
@@ -230,22 +251,27 @@ public abstract class AbstractAction
}
/**
- * This convenience method fires a PropertyChangeEvent given
- * the propertyName and the old and new values.
+ * Sends a {@link PropertyChangeEvent} for the named property to all
+ * registered listeners. This private method is called by the
+ * {@link #setEnabled(boolean)} method.
*
- * @param propertyName The property that changed.
- * @param oldValue The old value of the property.
- * @param newValue The new value of the property.
+ * @param propertyName the property name.
+ * @param oldValue the old value of the property.
+ * @param newValue the new value of the property.
*/
- private void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
+ private void firePropertyChange(String propertyName, boolean oldValue,
+ boolean newValue)
{
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
/**
- * addPropertyChangeListener
+ * Registers a listener to receive {@link PropertyChangeEvent} notifications
+ * from this action.
*
- * @param listener the listener to add
+ * @param listener the listener.
+ *
+ * @see #removePropertyChangeListener(PropertyChangeListener)
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
{
@@ -253,9 +279,12 @@ public abstract class AbstractAction
}
/**
- * removePropertyChangeListener
+ * Deregisters a listener so that it no longer receives
+ * {@link PropertyChangeEvent} notifications from this action.
*
- * @param listener the listener to remove
+ * @param listener the listener.
+ *
+ * @see #addPropertyChangeListener(PropertyChangeListener)
*/
public void removePropertyChangeListener(PropertyChangeListener listener)
{
@@ -265,7 +294,7 @@ public abstract class AbstractAction
/**
* Returns all registered listeners.
*
- * @return array of listeners.
+ * @return An array of listeners.
*
* @since 1.4
*/
diff --git a/javax/swing/AbstractCellEditor.java b/javax/swing/AbstractCellEditor.java
index 4ed15809a..df0d3db12 100644
--- a/javax/swing/AbstractCellEditor.java
+++ b/javax/swing/AbstractCellEditor.java
@@ -1,5 +1,5 @@
/* AbstractCellEditor.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,10 +69,11 @@ public abstract class AbstractCellEditor
/**
* Creates a new instance of AbstractCellEditor.
*/
- public AbstractCellEditor() {
+ public AbstractCellEditor()
+ {
listenerList = new EventListenerList();
changeEvent = new ChangeEvent(this);
- } // AbstractCellEditor()
+ }
/**
* Returns <code>true</code> if the cell is editable using
@@ -84,9 +85,10 @@ public abstract class AbstractCellEditor
* @return <code>true</code> if the cell is editable using
* <code>event</code>, <code>false</code> if it's not
*/
- public boolean isCellEditable(EventObject event) {
+ public boolean isCellEditable(EventObject event)
+ {
return true;
- } // isCellEditable()
+ }
/**
* Returns <code>true</code> if the editing cell should be selected,
@@ -99,29 +101,32 @@ public abstract class AbstractCellEditor
* @return <code>true</code> if the editing cell should be selected,
* <code>false</code> otherwise
*/
- public boolean shouldSelectCell(EventObject event) {
+ public boolean shouldSelectCell(EventObject event)
+ {
return true;
- } // shouldSelectCell()
+ }
/**
* Stop editing the cell and accept any partial value that has been entered
* into the cell.
*
- * @returns <code>true</code> if editing has been stopped successfully,
+ * @return <code>true</code> if editing has been stopped successfully,
* <code>false</code>otherwise
*/
- public boolean stopCellEditing() {
+ public boolean stopCellEditing()
+ {
fireEditingStopped();
return true;
- } // stopCellEditing()
+ }
/**
* Stop editing the cell and do not accept any partial value that has
* been entered into the cell.
*/
- public void cancelCellEditing() {
+ public void cancelCellEditing()
+ {
fireEditingCanceled();
- } // cancelCellEditing()
+ }
/**
* Adds a CellEditorListener to the list of CellEditorListeners of this
diff --git a/javax/swing/AbstractListModel.java b/javax/swing/AbstractListModel.java
index 6cff6a28c..7d4b2bb2a 100644
--- a/javax/swing/AbstractListModel.java
+++ b/javax/swing/AbstractListModel.java
@@ -1,5 +1,5 @@
/* AbstractListModel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,6 +58,9 @@ public abstract class AbstractListModel implements ListModel, Serializable
/** List of ListDataListeners called for each change to the list. */
protected EventListenerList listenerList;
+ /**
+ * Creates a new model instance - initialises the event listener list.
+ */
public AbstractListModel()
{
listenerList = new EventListenerList();
@@ -88,7 +91,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Call {@link ListDataListener#contentsChanged} on each element of the
* {@link #listenerList} which is a {@link ListDataListener}. The event
- * fired has type {@ListDataEvent.CONTENTS_CHANGED} and represents a
+ * fired has type {@link ListDataEvent#CONTENTS_CHANGED} and represents a
* change to the data elements in the range [startIndex, endIndex]
* inclusive.
*
@@ -110,7 +113,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Call {@link ListDataListener#intervalAdded} on each element of the
* {@link #listenerList} which is a {@link ListDataListener}. The event
- * fired has type {@ListDataEvent.INTERVAL_ADDED} and represents an
+ * fired has type {@link ListDataEvent#INTERVAL_ADDED} and represents an
* addition of the data elements in the range [startIndex, endIndex]
* inclusive.
*
@@ -132,7 +135,7 @@ public abstract class AbstractListModel implements ListModel, Serializable
/**
* Call {@link ListDataListener#intervalRemoved} on each element of the
* {@link #listenerList} which is a {@link ListDataListener}. The event
- * fired has type {@ListDataEvent.INTERVAL_REMOVED} and represents a
+ * fired has type {@link ListDataEvent#INTERVAL_REMOVED} and represents a
* removal of the data elements in the range [startIndex, endIndex]
* inclusive.
*
diff --git a/javax/swing/CellEditor.java b/javax/swing/CellEditor.java
index 3d229b266..9eb083ab2 100644
--- a/javax/swing/CellEditor.java
+++ b/javax/swing/CellEditor.java
@@ -1,5 +1,5 @@
/* CellEditor.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,7 @@ package javax.swing;
import java.util.EventObject;
import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
/**
* Provides edit capabilities for components that display cells like
@@ -51,46 +52,57 @@ import javax.swing.event.CellEditorListener;
public interface CellEditor
{
/**
- * getCellEditorValue
- * @returns Object
+ * Returns the current value for the <code>CellEditor</code>.
+ *
+ * @return The value.
*/
Object getCellEditorValue();
/**
- * isCellEditable
- * @param event TODO
- * @returns boolean
+ * Returns <code>true</code> if the specified event makes the editor
+ * editable, and <code>false</code> otherwise.
+ *
+ * @param event the event.
+ *
+ * @return A boolean.
*/
boolean isCellEditable(EventObject event);
/**
* shouldSelectCell
* @param event TODO
- * @returns boolean
+ * @return boolean
*/
boolean shouldSelectCell(EventObject event);
/**
- * stopCellEditing
- * @returns boolean
+ * Signals to the <code>CellEditor</code> that it should stop editing,
+ * accepting the current cell value, and returns <code>true</code> if the
+ * editor actually stops editing, and <code>false</code> otherwise.
+ *
+ * @return A boolean.
*/
boolean stopCellEditing();
/**
- * cancelCellEditing
+ * Signals to the <code>CellEditor</code> that it should cancel editing.
*/
void cancelCellEditing();
/**
- * addCellEditorListener
- * @param listener TODO
+ * Registers a listener to receive {@link ChangeEvent} notifications from the
+ * <code>CellEditor</code>.
+ *
+ * @param listener the listener.
*/
void addCellEditorListener(CellEditorListener listener);
/**
- * removeCellEditorListener
- * @param listener TODO
+ * Deregisters a listener so that it no longer receives {@link ChangeEvent}
+ * notifications from the <code>CellEditor</code>.
+ *
+ * @param listener the listener.
*/
void removeCellEditorListener(CellEditorListener listener);
-} // CellEditor
+}
diff --git a/javax/swing/CellRendererPane.java b/javax/swing/CellRendererPane.java
index 6d7b42a12..b3d6f6a73 100644
--- a/javax/swing/CellRendererPane.java
+++ b/javax/swing/CellRendererPane.java
@@ -1,5 +1,5 @@
/* CellRendererPane.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@ public class CellRendererPane extends Container implements Accessible
/**
* getAccessibleRole
- * @returns AccessibleRole
+ * @return AccessibleRole
*/
public AccessibleRole getAccessibleRole()
{
diff --git a/javax/swing/ComboBoxModel.java b/javax/swing/ComboBoxModel.java
index 6968db490..610527587 100644
--- a/javax/swing/ComboBoxModel.java
+++ b/javax/swing/ComboBoxModel.java
@@ -1,5 +1,5 @@
/* ComboBoxModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,31 +37,33 @@ exception statement from your version. */
package javax.swing;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
/**
- * The data model for {@link JComboBox}. This model keeps
- * track of elements contained in the JComboBox as well as the current
- * combo box selection. Whenever selection in the JComboBox changes, the
- * ComboBoxModel should fire ListDataEvents to ComboBox's ListDataListeners.
+ * The data model for a {@link JComboBox}. This model keeps track of elements
+ * contained in the <code>JComboBox</code> as well as the current
+ * combo box selection. Whenever the selection in the <code>JComboBox</code>
+ * changes, the <code>ComboBoxModel</code> should fire a {@link ListDataEvent}
+ * to the model's {@link ListDataListener}s.
*
* @author Andrew Selkirk
*/
public interface ComboBoxModel extends ListModel
{
/**
- * This method sets the selected item in the combo box. Class
- * implementing this interface should fire ListDataEvents to
- * all registered ListDataListeners to indicated that the
- * selection has changed.
+ * Sets the selected item in the combo box. Classes implementing this
+ * interface should fire a {@link ListDataEvent} to all registered
+ * {@link ListDataListener}s to indicate that the selection has changed.
*
- * @param item item in the combo box that should be selected
+ * @param item the selected item (<code>null</code> permitted).
*/
void setSelectedItem(Object item);
/**
- * The method returns currently selected item in the combo box
+ * Returns the currently selected item in the combo box.
*
- * @returns item that is currently selected in the combo box.
+ * @return The selected item (possibly <code>null</code>).
*/
Object getSelectedItem();
-} // ComboBoxModel
+}
diff --git a/javax/swing/DefaultCellEditor.java b/javax/swing/DefaultCellEditor.java
index 5c692f91e..7f1c395ad 100644
--- a/javax/swing/DefaultCellEditor.java
+++ b/javax/swing/DefaultCellEditor.java
@@ -1,5 +1,5 @@
/* DefaultCellEditor.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -129,7 +129,7 @@ public class DefaultCellEditor
*
* @param event the event to check
*
- * @returns true if the passed event is the mouse event and false otherwise
+ * @return true if the passed event is the mouse event and false otherwise.
*/
public boolean isCellEditable(EventObject event)
{
@@ -147,7 +147,7 @@ public class DefaultCellEditor
*
* @param event unused in default method
*
- * @returns true always
+ * @return true always
*/
public boolean shouldSelectCell(EventObject event)
{
@@ -160,7 +160,7 @@ public class DefaultCellEditor
* cell editor listeners (including the table) that the editing has been
* stopped.
*
- * @returns boolean
+ * @return boolean
*/
public boolean stopCellEditing()
{
@@ -185,7 +185,9 @@ public class DefaultCellEditor
* The default method returns true without action but may be overridden
* in derived classes for more specific behavior.
*
- * @returns true, always
+ * @param event the event.
+ *
+ * @return true, always
*/
public boolean startCellEditing(EventObject event)
{
@@ -417,7 +419,7 @@ public class DefaultCellEditor
* Get the component that performs the editing sessions. It is the same
* component that was passed in constructor.
*
- * @returns the component, performing the editing sessions.
+ * @return the component, performing the editing sessions.
*/
public Component getComponent()
{
@@ -427,7 +429,7 @@ public class DefaultCellEditor
/**
* Get the number of mouse clicks, required to start the editing session.
*
- * @returns int the number of mouse clicks, required to start the session
+ * @return int the number of mouse clicks, required to start the session
*/
public int getClickCountToStart()
{
@@ -448,7 +450,7 @@ public class DefaultCellEditor
* Get the value, currently being displayed by the editor component. The
* call is forwarded to the {@link #delegate}.
*
- * @returns Object the value (class depends on the editor component)
+ * @return Object the value (class depends on the editor component)
*/
public Object getCellEditorValue()
{
@@ -460,7 +462,7 @@ public class DefaultCellEditor
*
* @param event forwarded to the delegate.
*
- * @returns boolean returned by delegate
+ * @return boolean returned by delegate
*/
public boolean isCellEditable(EventObject event)
{
@@ -472,7 +474,7 @@ public class DefaultCellEditor
*
* @param event forwarded to the delegate.
*
- * @returns boolean returned by delegate
+ * @return boolean returned by delegate
*/
public boolean shouldSelectCell(EventObject event)
{
@@ -482,7 +484,7 @@ public class DefaultCellEditor
/**
* Forwards call to the {@link #delegate}.
*
- * @returns boolean returned by delegate
+ * @return boolean returned by delegate
*/
public boolean stopCellEditing()
{
@@ -514,7 +516,7 @@ public class DefaultCellEditor
* @param leaf - true if the node is a leaf node
* @param row - the row index of the node being edited
*
- * @returns Component the component for editing
+ * @return Component the component for editing
*/
public Component getTreeCellEditorComponent(JTree tree, Object value,
boolean isSelected,
@@ -537,7 +539,7 @@ public class DefaultCellEditor
* @param row the row of the cell being edited
* @param column the column of the cell being edited
*
- * @returns Component the component that will perform the editing session
+ * @return Component the component that will perform the editing session
*/
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row,
diff --git a/javax/swing/DefaultListSelectionModel.java b/javax/swing/DefaultListSelectionModel.java
index 5729e1837..ccca487f1 100644
--- a/javax/swing/DefaultListSelectionModel.java
+++ b/javax/swing/DefaultListSelectionModel.java
@@ -447,6 +447,9 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public void addSelectionInterval(int index0, int index1)
{
+ if (index0 == -1 || index1 == -1)
+ return;
+
int lo = Math.min(index0, index1);
int hi = Math.max(index0, index1);
oldSel = sel.clone();
@@ -508,6 +511,9 @@ public class DefaultListSelectionModel implements Cloneable,
public void removeSelectionInterval(int index0,
int index1)
{
+ if (index0 == -1 || index1 == -1)
+ return;
+
oldSel = sel.clone();
int lo = Math.min(index0, index1);
int hi = Math.max(index0, index1);
@@ -551,6 +557,9 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public void setSelectionInterval(int index0, int index1)
{
+ if (index0 == -1 || index1 == -1)
+ return;
+
oldSel = sel.clone();
sel.clear();
if (selectionMode == SINGLE_SELECTION)
diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java
index 7ba643090..d78e8ae19 100644
--- a/javax/swing/JComponent.java
+++ b/javax/swing/JComponent.java
@@ -554,7 +554,7 @@ public abstract class JComponent extends Container implements Serializable
* so that it doesn't get modified in another context within the same
* method call chain.
*/
- private transient Rectangle rectCache;
+ private static transient Rectangle rectCache;
/**
* The default locale of the component.
@@ -1389,16 +1389,15 @@ public abstract class JComponent extends Container implements Serializable
* Return the component's visible rectangle in a new {@link Rectangle},
* rather than via a return slot.
*
- * @return The component's visible rectangle
+ * @return the component's visible rectangle
*
* @see #computeVisibleRect(Rectangle)
*/
public Rectangle getVisibleRect()
{
- if (rectCache == null)
- rectCache = new Rectangle();
- computeVisibleRect(rectCache);
- return rectCache;
+ Rectangle r = new Rectangle();
+ computeVisibleRect(r);
+ return r;
}
/**
@@ -2204,12 +2203,8 @@ public abstract class JComponent extends Container implements Serializable
*/
public void repaint(long tm, int x, int y, int width, int height)
{
- // TODO: Maybe add this visibleRect stuff to RepaintManager.
- Rectangle r = getVisibleRect();
- Rectangle dirty = SwingUtilities.computeIntersection(x, y, width, height, r);
- RepaintManager.currentManager(this).addDirtyRegion(this, dirty.x, dirty.y,
- dirty.width,
- dirty.height);
+ RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width,
+ height);
}
/**
@@ -2221,7 +2216,8 @@ public abstract class JComponent extends Container implements Serializable
*/
public void repaint(Rectangle r)
{
- repaint(0, r.x, r.y, r.width, r.height);
+ RepaintManager.currentManager(this).addDirtyRegion(this, r.x, r.y, r.width,
+ r.height);
}
/**
diff --git a/javax/swing/JEditorPane.java b/javax/swing/JEditorPane.java
index 9264c8dd8..73b775738 100644
--- a/javax/swing/JEditorPane.java
+++ b/javax/swing/JEditorPane.java
@@ -926,7 +926,7 @@ public class JEditorPane extends JTextComponent
// Remove the current content.
Document doc = getDocument();
doc.remove(0, doc.getLength());
- if (t == null || t == "")
+ if (t == null || t.equals(""))
return;
// Let the EditorKit read the text into the Document.
diff --git a/javax/swing/JInternalFrame.java b/javax/swing/JInternalFrame.java
index 1e4fad767..5bd6f781c 100644
--- a/javax/swing/JInternalFrame.java
+++ b/javax/swing/JInternalFrame.java
@@ -559,6 +559,8 @@ public class JInternalFrame extends JComponent implements Accessible,
this.iconable = iconifiable;
storedBounds = new Rectangle();
setRootPane(createRootPane());
+ // JInternalFrames are invisible by default.
+ setVisible(false);
updateUI();
setRootPaneCheckingEnabled(true); // Done the init stage, now adds go to content pane.
}
@@ -1629,27 +1631,27 @@ public class JInternalFrame extends JComponent implements Accessible,
{
if (! isVisible())
{
- super.show();
-
- JDesktopPane pane = getDesktopPane();
- if (pane != null)
- pane.setSelectedFrame(this);
- else
- {
- try
- {
- setSelected(true);
- }
- catch (PropertyVetoException e)
- {
- // Do nothing. if they don't want to be selected.
- }
- }
- if (isFirstTimeVisible)
- {
- isFirstTimeVisible = false;
- fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
- }
+ super.show();
+
+ JDesktopPane pane = getDesktopPane();
+ if (pane != null)
+ pane.setSelectedFrame(this);
+ else
+ {
+ try
+ {
+ setSelected(true);
+ }
+ catch (PropertyVetoException e)
+ {
+ // Do nothing. if they don't want to be selected.
+ }
+ }
+ if (isFirstTimeVisible)
+ {
+ isFirstTimeVisible = false;
+ fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
+ }
}
}
diff --git a/javax/swing/JTabbedPane.java b/javax/swing/JTabbedPane.java
index 1619874b0..3c91a5ea3 100644
--- a/javax/swing/JTabbedPane.java
+++ b/javax/swing/JTabbedPane.java
@@ -1165,7 +1165,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void remove(int index)
{
- remove(getComponentAt(index));
+ super.remove(index);
removeTabAt(index);
}
diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java
index 38b2d89f9..4c50501b8 100644
--- a/javax/swing/JTable.java
+++ b/javax/swing/JTable.java
@@ -1416,7 +1416,7 @@ public class JTable
protected boolean rowSelectionAllowed;
/**
- * @deprecated Use {@link #rowSelectionAllowed}, {@link
+ * Obsolete. Use {@link #rowSelectionAllowed}, {@link
* #getColumnSelectionAllowed}, or the combined methods {@link
* #getCellSelectionEnabled} and {@link #setCellSelectionEnabled(boolean)}.
*/
@@ -3092,7 +3092,9 @@ public class JTable
private void distributeSpillResizing(TableColumn[] cols, int spill,
TableColumn resizeIt)
{
- int average = spill / (cols.length-1);
+ int average = 0;
+ if (cols.length != 1)
+ average = spill / (cols.length-1);
for (int i = 0; i < cols.length; i++)
{
if (cols[i] != null && !cols[i].equals(resizeIt))
diff --git a/javax/swing/JViewport.java b/javax/swing/JViewport.java
index fad940f13..2b5d1cd5a 100644
--- a/javax/swing/JViewport.java
+++ b/javax/swing/JViewport.java
@@ -48,6 +48,7 @@ import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.io.Serializable;
@@ -265,7 +266,7 @@ public class JViewport extends JComponent implements Accessible
{
String scrollModeProp =
SystemProperties.getProperty("gnu.javax.swing.JViewport.scrollMode",
- "BACKINGSTORE");
+ "BLIT");
if (scrollModeProp.equalsIgnoreCase("simple"))
defaultScrollMode = SIMPLE_SCROLL_MODE;
else if (scrollModeProp.equalsIgnoreCase("backingstore"))
@@ -808,6 +809,8 @@ public class JViewport extends JComponent implements Accessible
Point pos = getViewPosition();
Component view = getView();
+ Shape oldClip = g.getClip();
+ g.clipRect(0, 0, getWidth(), getHeight());
boolean translated = false;
try
{
@@ -819,6 +822,7 @@ public class JViewport extends JComponent implements Accessible
{
if (translated)
g.translate (pos.x, pos.y);
+ g.setClip(oldClip);
}
}
@@ -914,16 +918,22 @@ public class JViewport extends JComponent implements Accessible
cachedBlitTo.x - cachedBlitFrom.x,
cachedBlitTo.y - cachedBlitFrom.y);
// Now paint the part that becomes newly visible.
- g.setClip(cachedBlitPaint.x, cachedBlitPaint.y,
+ Shape oldClip = g.getClip();
+ g.clipRect(cachedBlitPaint.x, cachedBlitPaint.y,
cachedBlitPaint.width, cachedBlitPaint.height);
- paintSimple(g);
+ try
+ {
+ paintSimple(g);
+ }
+ finally
+ {
+ g.setClip(oldClip);
+ }
}
// If blitting is not possible for some reason, fall back to repainting
// everything.
else
- {
- paintSimple(g);
- }
+ paintSimple(g);
lastPaintPosition.setLocation(getViewPosition());
}
diff --git a/javax/swing/RepaintManager.java b/javax/swing/RepaintManager.java
index 33a42cd1b..8a025ece5 100644
--- a/javax/swing/RepaintManager.java
+++ b/javax/swing/RepaintManager.java
@@ -43,6 +43,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
+import java.awt.Window;
import java.awt.image.VolatileImage;
import java.util.ArrayList;
import java.util.Collections;
@@ -73,8 +74,13 @@ public class RepaintManager
/**
* The current repaint managers, indexed by their ThreadGroups.
*/
- static WeakHashMap currentRepaintManagers;
-
+ private static WeakHashMap currentRepaintManagers;
+
+ /**
+ * A rectangle object to be reused in damaged regions calculation.
+ */
+ private static Rectangle rectCache = new Rectangle();
+
/**
* <p>A helper class which is placed into the system event queue at
* various times in order to facilitate repainting and layout. There is
@@ -409,19 +415,30 @@ public class RepaintManager
if (w <= 0 || h <= 0 || !component.isShowing())
return;
- Rectangle r = new Rectangle(x, y, w, h);
- if (dirtyComponents.containsKey(component))
- r = r.union((Rectangle) dirtyComponents.get(component));
+ component.computeVisibleRect(rectCache);
+ SwingUtilities.computeIntersection(x, y, w, h, rectCache);
- synchronized (dirtyComponents)
+ if (! rectCache.isEmpty())
{
- dirtyComponents.put(component, r);
- }
+ if (dirtyComponents.containsKey(component))
+ {
+ SwingUtilities.computeUnion(rectCache.x, rectCache.y,
+ rectCache.width, rectCache.height,
+ (Rectangle) dirtyComponents.get(component));
+ }
+ else
+ {
+ synchronized (dirtyComponents)
+ {
+ dirtyComponents.put(component, rectCache.getBounds());
+ }
+ }
- if (! repaintWorker.isLive())
- {
- repaintWorker.setLive(true);
- SwingUtilities.invokeLater(repaintWorker);
+ if (! repaintWorker.isLive())
+ {
+ repaintWorker.setLive(true);
+ SwingUtilities.invokeLater(repaintWorker);
+ }
}
}
@@ -583,12 +600,14 @@ public class RepaintManager
Component root = SwingUtilities.getRoot(component);
Image buffer = (Image) offscreenBuffers.get(root);
if (buffer == null
- || ((buffer.getWidth(null) < proposedWidth
- || buffer.getHeight(null) < proposedHeight)
- && proposedWidth < doubleBufferMaximumSize.width
- && proposedHeight < doubleBufferMaximumSize.height))
+ || buffer.getWidth(null) < proposedWidth
+ || buffer.getHeight(null) < proposedHeight)
{
- buffer = component.createImage(proposedWidth, proposedHeight);
+ int width = Math.max(proposedWidth, root.getWidth());
+ width = Math.min(doubleBufferMaximumSize.width, width);
+ int height = Math.max(proposedHeight, root.getHeight());
+ height = Math.min(doubleBufferMaximumSize.height, height);
+ buffer = component.createImage(width, height);
offscreenBuffers.put(root, buffer);
}
return buffer;
@@ -617,27 +636,47 @@ public class RepaintManager
Graphics g = root.getGraphics();
Image buffer = (Image) offscreenBuffers.get(root);
Rectangle clip = g.getClipBounds();
- area = SwingUtilities.computeIntersection(clip.x, clip.y,
- clip.width, clip.height,
- area);
+ if (clip != null)
+ area = SwingUtilities.computeIntersection(clip.x, clip.y,
+ clip.width, clip.height,
+ area);
int dx1 = area.x;
int dy1 = area.y;
int dx2 = area.x + area.width;
int dy2 = area.y + area.height;
+ // Make sure we have a sane clip at this point.
+ g.clipRect(area.x, area.y, area.width, area.height);
+
+ // Make sure the coordinates are inside the buffer, everything else
+ // might lead to problems.
+ // TODO: This code should not really be necessary, however, in fact
+ // we have two issues here:
+ // 1. We shouldn't get repaint requests in areas outside the buffer
+ // region in the first place. This still happens for example
+ // when a component is inside a JViewport, and the component has
+ // a size that would reach beyond the window size.
+ // 2. Graphics.drawImage() should not behave strange when trying
+ // to draw regions outside the image.
+ int bufferWidth = buffer.getWidth(root);
+ int bufferHeight = buffer.getHeight(root);
+ dx1 = Math.min(bufferWidth, dx1);
+ dy1 = Math.min(bufferHeight, dy1);
+ dx2 = Math.min(bufferWidth, dx2);
+ dy2 = Math.min(bufferHeight, dy2);
g.drawImage(buffer, dx1, dy1, dx2, dy2,
- dx1, dy1, dx2, dy2, root);
+ dx1, dy1, dx2, dy2, root);
g.dispose();
}
// Otherwise queue this request up, until all the RepaintManager work
// is done.
else
{
- Rectangle commitArea;
if (commitRequests.containsKey(root))
- commitArea = area.union((Rectangle) commitRequests.get(root));
+ SwingUtilities.computeUnion(area.x, area.y, area.width,
+ area.height,
+ (Rectangle) commitRequests.get(root));
else
- commitArea = area;
- commitRequests.put(root, commitArea);
+ commitRequests.put(root, area);
}
}
}
diff --git a/javax/swing/Spring.java b/javax/swing/Spring.java
index 8f7105d49..b9890c714 100644
--- a/javax/swing/Spring.java
+++ b/javax/swing/Spring.java
@@ -37,6 +37,9 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Component;
+import java.awt.Dimension;
+
/**
* Calculates the space between component edges, that are layed out by
* {@link SpringLayout}.
@@ -168,6 +171,139 @@ public abstract class Spring
}
/**
+ * Return a new Spring which computes its values by scaling
+ * the values of another spring by a constant factor. If the
+ * factor is negative, the minimum and maximum values of
+ * the argument spring will be interchanged.
+ * @param spring the spring to track
+ * @param factor the factor by which to scale
+ * @return a new multiplicative Spring
+ * @since 1.5
+ */
+ public static Spring scale(final Spring spring, final float factor)
+ {
+ if (spring == null)
+ throw new NullPointerException("spring argument is null");
+ return new Spring()
+ {
+ public int getMaximumValue()
+ {
+ return (int) ((factor < 0 ? spring.getMinimumValue()
+ : spring.getMaximumValue())
+ * factor);
+ }
+
+ public int getMinimumValue()
+ {
+ return (int) ((factor < 0 ? spring.getMaximumValue()
+ : spring.getMinimumValue())
+ * factor);
+ }
+
+ public int getPreferredValue()
+ {
+ return (int) (spring.getPreferredValue() * factor);
+ }
+
+ public int getValue()
+ {
+ return (int) (spring.getValue() * factor);
+ }
+
+ public void setValue(int value)
+ {
+ spring.setValue((int) (value / factor));
+ }
+ };
+ }
+
+ /**
+ * Return a new Spring which takes its values from the specified
+ * Component. In particular, the maximum value is taken from
+ * the maximumSize, the minimum value is taken from the minimumSize,
+ * the preferred value is taken from the preferredSize, and the
+ * value is taken from the component's current size. These values
+ * change as the component changes size.
+ * @param component the component
+ * @return a new Spring which tracks the component's width
+ * @since 1.5
+ */
+ public static Spring width(final Component component)
+ {
+ return new Spring()
+ {
+ public int getMaximumValue()
+ {
+ return component.getMaximumSize().width;
+ }
+
+ public int getMinimumValue()
+ {
+ return component.getMinimumSize().width;
+ }
+
+ public int getPreferredValue()
+ {
+ return component.getPreferredSize().width;
+ }
+
+ public int getValue()
+ {
+ return component.getSize().width;
+ }
+
+ public void setValue(int value)
+ {
+ Dimension d = component.getSize();
+ component.setSize(value, d.height);
+ }
+ };
+ }
+
+ /**
+ * Return a new Spring which takes its values from the specified
+ * Component. In particular, the maximum value is taken from
+ * the maximumSize, the minimum value is taken from the minimumSize,
+ * the preferred value is taken from the preferredSize, and the
+ * value is taken from the component's current size. These values
+ * change as the component changes size.
+ * @param component the component
+ * @return a new Spring which tracks the component's height
+ * @since 1.5
+ */
+ public static Spring height(final Component component)
+ {
+ return new Spring()
+ {
+ public int getMaximumValue()
+ {
+ return component.getMaximumSize().height;
+ }
+
+ public int getMinimumValue()
+ {
+ return component.getMinimumSize().height;
+ }
+
+ public int getPreferredValue()
+ {
+ return component.getPreferredSize().height;
+ }
+
+ public int getValue()
+ {
+ return component.getSize().height;
+ }
+
+ public void setValue(int value)
+ {
+ Dimension d = component.getSize();
+ component.setSize(d.width, value);
+ }
+ };
+ }
+
+ /**
* A simple Spring, that holds constant values for min, pref and max.
*
* @author Roman Kennke (roman@ontographics.com)
diff --git a/javax/swing/SpringLayout.java b/javax/swing/SpringLayout.java
index 592cc0e02..8d46a736a 100644
--- a/javax/swing/SpringLayout.java
+++ b/javax/swing/SpringLayout.java
@@ -1,5 +1,5 @@
/* SpringLayout.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -150,6 +150,25 @@ public class SpringLayout implements LayoutManager2
}
/**
+ * Create a new Constraints object which tracks the indicated
+ * component. The x and y positions for this Constraints object
+ * are constant Springs created with the component's location at
+ * the time this constructor is called. The width and height
+ * of this Constraints are Springs created using
+ * {@link Spring#width(Component)} and {@link Spring#height(Component)},
+ * respectively.
+ * @param component the component to track
+ * @since 1.5
+ */
+ public Constraints(Component component)
+ {
+ this(Spring.constant(component.getX()),
+ Spring.constant(component.getY()),
+ Spring.width(component),
+ Spring.height(component));
+ }
+
+ /**
* Returns the constraint for the edge with the <code>edgeName</code>.
* This is expected to be one of
* {@link #EAST}, {@link #WEST}, {@link #NORTH} or {@link #SOUTH}.
@@ -343,8 +362,8 @@ public class SpringLayout implements LayoutManager2
/**
* Adds a layout component and a constraint object to this layout.
- * This method is usually only called by a {@java.awt.Container}s add
- * Method.
+ * This method is usually only called by a {@link java.awt.Container}s add
+ * method.
*
* @param component the component to be added.
* @param constraint the constraint to be set.
@@ -357,8 +376,8 @@ public class SpringLayout implements LayoutManager2
/**
* Adds a layout component and a constraint object to this layout.
- * This method is usually only called by a {@java.awt.Container}s add
- * Method. This method does nothing, since SpringLayout does not manage
+ * This method is usually only called by a {@link java.awt.Container}s add
+ * method. This method does nothing, since SpringLayout does not manage
* String-indexed components.
*
* @param name the name.
diff --git a/javax/swing/SwingUtilities.java b/javax/swing/SwingUtilities.java
index b58e5e0d8..7c7263f17 100644
--- a/javax/swing/SwingUtilities.java
+++ b/javax/swing/SwingUtilities.java
@@ -811,6 +811,7 @@ public class SwingUtilities
if (icon == null)
{
+ textIconGap = 0;
iconR.width = 0;
iconR.height = 0;
}
@@ -1246,26 +1247,31 @@ public class SwingUtilities
}
/**
- * Calculates the intersection of two rectangles.
+ * Calculates the intersection of two rectangles. The result is stored
+ * in <code>rect</code>. This is basically the same
+ * like {@link Rectangle#intersection(Rectangle)}, only that it does not
+ * create new Rectangle instances. The tradeoff is that you loose any data in
+ * <code>rect</code>.
*
* @param x upper-left x coodinate of first rectangle
* @param y upper-left y coodinate of first rectangle
* @param w width of first rectangle
* @param h height of first rectangle
* @param rect a Rectangle object of the second rectangle
- * @throws NullPointerException if rect is null.
+ *
+ * @throws NullPointerException if rect is null
*
* @return a rectangle corresponding to the intersection of the
- * two rectangles. A zero rectangle is returned if the rectangles
- * do not overlap.
+ * two rectangles. An empty rectangle is returned if the rectangles
+ * do not overlap
*/
public static Rectangle computeIntersection(int x, int y, int w, int h,
Rectangle rect)
{
- int x2 = (int) rect.getX();
- int y2 = (int) rect.getY();
- int w2 = (int) rect.getWidth();
- int h2 = (int) rect.getHeight();
+ int x2 = (int) rect.x;
+ int y2 = (int) rect.y;
+ int w2 = (int) rect.width;
+ int h2 = (int) rect.height;
int dx = (x > x2) ? x : x2;
int dy = (y > y2) ? y : y2;
@@ -1273,9 +1279,11 @@ public class SwingUtilities
int dh = (y + h < y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
if (dw >= 0 && dh >= 0)
- return new Rectangle(dx, dy, dw, dh);
+ rect.setBounds(dx, dy, dw, dh);
+ else
+ rect.setBounds(0, 0, 0, 0);
- return new Rectangle(0, 0, 0, 0);
+ return rect;
}
/**
@@ -1292,26 +1300,31 @@ public class SwingUtilities
}
/**
- * Calculates the union of two rectangles.
+ * Calculates the union of two rectangles. The result is stored in
+ * <code>rect</code>. This is basically the same as
+ * {@link Rectangle#union(Rectangle)} except that it avoids creation of new
+ * Rectangle objects. The tradeoff is that you loose any data in
+ * <code>rect</code>.
*
* @param x upper-left x coodinate of first rectangle
* @param y upper-left y coodinate of first rectangle
* @param w width of first rectangle
* @param h height of first rectangle
* @param rect a Rectangle object of the second rectangle
- * @throws NullPointerException if rect is null.
+ *
+ * @throws NullPointerException if rect is null
*
* @return a rectangle corresponding to the union of the
- * two rectangles. A rectangle encompassing both is returned if the
- * rectangles do not overlap.
+ * two rectangles; a rectangle encompassing both is returned if the
+ * rectangles do not overlap
*/
public static Rectangle computeUnion(int x, int y, int w, int h,
Rectangle rect)
{
- int x2 = (int) rect.getX();
- int y2 = (int) rect.getY();
- int w2 = (int) rect.getWidth();
- int h2 = (int) rect.getHeight();
+ int x2 = (int) rect.x;
+ int y2 = (int) rect.y;
+ int w2 = (int) rect.width;
+ int h2 = (int) rect.height;
int dx = (x < x2) ? x : x2;
int dy = (y < y2) ? y : y2;
@@ -1319,9 +1332,10 @@ public class SwingUtilities
int dh = (y + h > y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
if (dw >= 0 && dh >= 0)
- return new Rectangle(dx, dy, dw, dh);
-
- return new Rectangle(0, 0, 0, 0);
+ rect.setBounds(dx, dy, dw, dh);
+ else
+ rect.setBounds(0, 0, 0, 0);
+ return rect;
}
/**
diff --git a/javax/swing/UnsupportedLookAndFeelException.java b/javax/swing/UnsupportedLookAndFeelException.java
index f99c0ac19..b65119a00 100644
--- a/javax/swing/UnsupportedLookAndFeelException.java
+++ b/javax/swing/UnsupportedLookAndFeelException.java
@@ -1,5 +1,5 @@
/* UnsupportedLookAndFeelException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,11 +37,21 @@ exception statement from your version. */
package javax.swing;
-
+/**
+ * Thrown by the {@link UIManager#setLookAndFeel(LookAndFeel)} method when the
+ * specified look and feel is not supported on the current platform.
+ *
+ * @see LookAndFeel#isSupportedLookAndFeel()
+ */
public class UnsupportedLookAndFeelException extends Exception
{
- public UnsupportedLookAndFeelException(String a)
+ /**
+ * Creates a new exception instance with the specified message.
+ *
+ * @param s the exception message.
+ */
+ public UnsupportedLookAndFeelException(String s)
{
- super(a);
+ super(s);
}
}
diff --git a/javax/swing/ViewportLayout.java b/javax/swing/ViewportLayout.java
index f935f71bb..674de959f 100644
--- a/javax/swing/ViewportLayout.java
+++ b/javax/swing/ViewportLayout.java
@@ -1,5 +1,5 @@
/* ViewportLayout.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,9 +46,16 @@ import java.awt.Rectangle;
import java.io.Serializable;
/**
- * ViewportLayout
- * @author Andrew Selkirk
- * @author Graydon Hoare
+ * The default layout for {@link JViewport}. The viewport makes its view the
+ * same size as itself, but not smaller than its minimum size.
+ *
+ * If the port extends extends into space <em>past</em> the edge of the view,
+ * this layout manager moves the port up or to the left, in view space, by the
+ * amount of empty space (keep the lower and right edges lined up).
+ *
+ * @author Andrew Selkirk
+ * @author Graydon Hoare
+ * @author Audrius Meskauskas (audriusa@Bioinformatics.org)
*/
public class ViewportLayout implements LayoutManager, Serializable
{
@@ -58,17 +65,31 @@ public class ViewportLayout implements LayoutManager, Serializable
{
// Nothing to do here.
}
-
+
+ /**
+ * The method is not used with this manager.
+ */
public void addLayoutComponent(String name, Component c)
{
// Nothing to do here.
}
+ /**
+ * The method is not used with this manager.
+ */
public void removeLayoutComponent(Component c)
{
// Nothing to do here.
}
-
+
+ /**
+ * Get the preferred layout size. If the view implements
+ * {@link Scrollable}, this method returns
+ * {@link Scrollable#getPreferredScrollableViewportSize}.
+ * Otherwise, it returns {@link Component#getPreferredSize()}.
+ *
+ * @return the preferred layout size, as described about.
+ */
public Dimension preferredLayoutSize(Container parent)
{
JViewport vp = (JViewport)parent;
@@ -84,10 +105,13 @@ public class ViewportLayout implements LayoutManager, Serializable
}
/**
- * Return the minimumSize for the <code>JViewport</code> that is laid out
- * by this layout manager.
+ * Get the minimum layout size. Normally this method returns the value,
+ * returned by the view method {@link Component#getMinimumSize()}.
+ *
+ * If the view is not set, the zero size is returned.
*
* @param parent the viewport
+ * @return the minimum layout size.
*/
public Dimension minimumLayoutSize(Container parent)
{
@@ -103,15 +127,13 @@ public class ViewportLayout implements LayoutManager, Serializable
*
* <ol>
*
- * <li>If the port is larger than the view's minimum size, put the port
- * at view position <code>(0,0)</code> and make the view's size equal to
- * the port's.</li>
- *
* <li>If the port is smaller than the view, leave the view at its
- * minimum size. also, do not move the port, <em>unless</em> the port
+ * current size. Also, do not move the port, <em>unless</em> the port
* extends into space <em>past</em> the edge of the view. If so, move the
* port up or to the left, in view space, by the amount of empty space
* (keep the lower and right edges lined up)</li>
+ * <li>In {@link JViewport#setViewSize(Dimension)}, the view size is never
+ * set smaller that its minimum size.</li>
*
* </ol>
*
@@ -120,7 +142,6 @@ public class ViewportLayout implements LayoutManager, Serializable
* @see JViewport#getViewPosition
* @see JViewport#setViewPosition
*/
-
public void layoutContainer(Container parent)
{
// The way to interpret this function is basically to ignore the names
@@ -143,23 +164,22 @@ public class ViewportLayout implements LayoutManager, Serializable
Rectangle portBounds = port.getViewRect();
Dimension viewPref = view.getPreferredSize();
Dimension viewMinimum = view.getMinimumSize();
+
Point portLowerRight = new Point(portBounds.x + portBounds.width,
portBounds.y + portBounds.height);
+ int overextension;
// vertical implementation of the above rules
if ((! (view instanceof Scrollable) && viewPref.height < portBounds.height
|| (view instanceof Scrollable
&& ((Scrollable) view).getScrollableTracksViewportHeight())))
viewPref.height = portBounds.height;
-
- if (portBounds.height >= viewMinimum.height)
- portBounds.y = 0;
- else
- {
- int overextension = portLowerRight.y - viewPref.height;
- if (overextension > 0)
- portBounds.y -= overextension;
- }
+
+ // If the view is larger than the port, and port is partly outside
+ // the view, it is moved fully into the view area.
+ overextension = portLowerRight.y - viewPref.height;
+ if (overextension > 0)
+ portBounds.y -= overextension;
// horizontal implementation of the above rules
if ((! (view instanceof Scrollable) && viewPref.width < portBounds.width
@@ -167,16 +187,13 @@ public class ViewportLayout implements LayoutManager, Serializable
&& ((Scrollable) view).getScrollableTracksViewportWidth())))
viewPref.width = portBounds.width;
- if (portBounds.width >= viewMinimum.width)
- portBounds.x = 0;
- else
- {
- int overextension = portLowerRight.x - viewPref.width;
- if (overextension > 0)
- portBounds.x -= overextension;
- }
+ // If the view is larger than the port, and port is partly outside
+ // the view, it is moved fully into the view area.
+ overextension = portLowerRight.x - viewPref.width;
+ if (overextension > 0)
+ portBounds.x -= overextension;
- port.setViewPosition(portBounds.getLocation());
port.setViewSize(viewPref);
+ port.setViewPosition(portBounds.getLocation());
}
}
diff --git a/javax/swing/event/CaretEvent.java b/javax/swing/event/CaretEvent.java
index c4870a800..7de05a81b 100644
--- a/javax/swing/event/CaretEvent.java
+++ b/javax/swing/event/CaretEvent.java
@@ -1,5 +1,5 @@
/* CaretEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,43 +37,34 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventObject;
/**
* CaretEvent
* @author Andrew Selkirk
*/
-public abstract class CaretEvent extends EventObject {
+public abstract class CaretEvent extends EventObject
+{
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * CaretEvent constructor
- * @param source Source object
- */
- public CaretEvent(Object source) {
- super(source);
- } // CaretEvent()
+ /**
+ * CaretEvent constructor
+ * @param source Source object
+ */
+ public CaretEvent(Object source)
+ {
+ super(source);
+ }
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Get caret location
- * @returns the dot
- */
- public abstract int getDot();
+ /**
+ * Get caret location
+ * @return the dot
+ */
+ public abstract int getDot();
- /**
- * Get mark
- * @returns the mark
- */
- public abstract int getMark();
+ /**
+ * Get mark
+ * @return the mark
+ */
+ public abstract int getMark();
-
-} // CaretEvent
+}
diff --git a/javax/swing/event/DocumentEvent.java b/javax/swing/event/DocumentEvent.java
index c17b24254..822304925 100644
--- a/javax/swing/event/DocumentEvent.java
+++ b/javax/swing/event/DocumentEvent.java
@@ -1,5 +1,5 @@
/* DocumentEvent.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,25 +54,25 @@ public interface DocumentEvent
{
/**
* getIndex
- * @returns int
+ * @return int
*/
int getIndex();
/**
* getElement
- * @returns Element
+ * @return Element
*/
Element getElement();
/**
* getChildrenRemoved
- * @returns Element[]
+ * @return Element[]
*/
Element[] getChildrenRemoved();
/**
* getChildrenAdded
- * @returns Element[]
+ * @return Element[]
*/
Element[] getChildrenAdded();
@@ -114,7 +114,7 @@ public interface DocumentEvent
/**
* toString
- * @returns String
+ * @return String
*/
public String toString()
{
@@ -124,32 +124,32 @@ public interface DocumentEvent
/**
* getType
- * @returns EventType
+ * @return EventType
*/
EventType getType();
/**
* getOffset
- * @returns int
+ * @return int
*/
int getOffset();
/**
* getLength
- * @returns int
+ * @return int
*/
int getLength();
/**
* getDocument
- * @returns Document
+ * @return Document
*/
Document getDocument();
/**
* getChange
* @param element TODO
- * @returns ElementChange
+ * @return ElementChange
*/
ElementChange getChange(Element element);
diff --git a/javax/swing/event/EventListenerList.java b/javax/swing/event/EventListenerList.java
index 332aeba95..7be32036c 100644
--- a/javax/swing/event/EventListenerList.java
+++ b/javax/swing/event/EventListenerList.java
@@ -188,7 +188,7 @@ public class EventListenerList
/**
* Get a list of listenerType/listener pairs
- * @returns Listener list
+ * @return Listener list
*/
public Object[] getListenerList()
{
@@ -214,7 +214,7 @@ public class EventListenerList
* @throws NullPointerException if <code>c</code> is
* <code>null</code>.
*
- * @returns an array of <code>c</code> whose elements are the
+ * @return an array of <code>c</code> whose elements are the
* currently subscribed listeners of the specified type. If there
* are no such listeners, an empty array is returned.
*
diff --git a/javax/swing/event/ListSelectionEvent.java b/javax/swing/event/ListSelectionEvent.java
index e5e4c33ba..d79cbfa50 100644
--- a/javax/swing/event/ListSelectionEvent.java
+++ b/javax/swing/event/ListSelectionEvent.java
@@ -1,5 +1,5 @@
/* ListSelectionEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,90 +37,99 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventObject;
+import javax.swing.ListSelectionModel;
+
/**
- * ListSelectionEvent
+ * An event that indicates a change to a list selection, including the source
+ * of the change (a {@link ListSelectionModel}) and the range of items in the
+ * list that have potentially changed their selection status.
+ *
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public class ListSelectionEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * firstIndex
- */
- private int firstIndex = 0;
-
- /**
- * lastIndex
- */
- private int lastIndex = 0;
-
- /**
- * isAdjusting
- */
- private boolean isAdjusting = false;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ListSelectionEvent
- * @param source Source
- * @param firstIndex First index
- * @param lastIndex Last index
- * @param isAdjusting Is Adjusting?
- */
- public ListSelectionEvent(Object source, int firstIndex,
- int lastIndex, boolean isAdjusting) {
- super(source);
- this.firstIndex = firstIndex;
- this.lastIndex = lastIndex;
- this.isAdjusting = isAdjusting;
- } // ListSelectionEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getFirstIndex
- * @returns firstIndex
- */
- public int getFirstIndex() {
- return firstIndex;
- } // getFirstIndex()
-
- /**
- * getLastIndex
- * @returns lastIndex
- */
- public int getLastIndex() {
- return lastIndex;
- } // getLastIndex()
-
- /**
- * getValueIsAdjusting
- * @returns isAdjusting
- */
- public boolean getValueIsAdjusting() {
- return isAdjusting;
- } // getValueIsAdjusting()
-
- /**
- * String representation
- * @returns String representation
- */
- public String toString() {
- return null; // TODO
- } // toString()
-
-
-} // ListSelectionEvent
+public class ListSelectionEvent extends EventObject
+{
+
+ /**
+ * The index of the first list item in the range of items that has
+ * potentially had its selection status modified.
+ */
+ private int firstIndex = 0;
+
+ /**
+ * The index of the last list item in the range of items that has
+ * potentially had its selection status modified.
+ */
+ private int lastIndex = 0;
+
+ /** A flag that indicates that this event is one in a series of events. */
+ private boolean isAdjusting = false;
+
+ /**
+ * Creates a new <code>ListSelectionEvent</code>.
+ *
+ * @param source the event source (<code>null</code> not permitted).
+ * @param firstIndex the first index.
+ * @param lastIndex the last index.
+ * @param isAdjusting a flag indicating that this event is one in a series
+ * of events updating a selection.
+ *
+ * @throws IllegalArgumentException if <code>source</code> is
+ * <code>null</code>.
+ */
+ public ListSelectionEvent(Object source, int firstIndex,
+ int lastIndex, boolean isAdjusting)
+ {
+ super(source);
+ this.firstIndex = firstIndex;
+ this.lastIndex = lastIndex;
+ this.isAdjusting = isAdjusting;
+ }
+
+ /**
+ * Returns the first index.
+ *
+ * @return The first index.
+ */
+ public int getFirstIndex()
+ {
+ return firstIndex;
+ }
+
+ /**
+ * Returns the last index.
+ *
+ * @return The last index.
+ */
+ public int getLastIndex()
+ {
+ return lastIndex;
+ }
+
+ /**
+ * Returns the flag that indicates that this event is one in a series of
+ * events updating a selection.
+ *
+ * @return A boolean.
+ */
+ public boolean getValueIsAdjusting()
+ {
+ return isAdjusting;
+ }
+
+ /**
+ * Returns a string representation of the event, typically used for debugging
+ * purposes.
+ *
+ * @return A string representation of the event.
+ */
+ public String toString()
+ {
+ return this.getClass().toString() + "[ source=" + source.toString()
+ + " firstIndex= " + firstIndex + " lastIndex= " + lastIndex
+ + " isAdjusting= " + isAdjusting + " ]";
+ }
+
+}
diff --git a/javax/swing/event/ListSelectionListener.java b/javax/swing/event/ListSelectionListener.java
index 4ebf58304..a21dc7365 100644
--- a/javax/swing/event/ListSelectionListener.java
+++ b/javax/swing/event/ListSelectionListener.java
@@ -1,5 +1,5 @@
/* ListSelectionListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,21 +37,25 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventListener;
+import javax.swing.ListSelectionModel;
+
/**
- * ListSelectionListener public interface
+ * A listener that receives {@link ListSelectionEvent} notifications,
+ * typically from a {@link ListSelectionModel} when it is modified.
+ *
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public interface ListSelectionListener extends EventListener {
-
- /**
- * Value changed
- * @param event List Selection Event
- */
- void valueChanged(ListSelectionEvent event);
+public interface ListSelectionListener extends EventListener
+{
+ /**
+ * Receives notification of a {@link ListSelectionEvent}.
+ *
+ * @param event the event.
+ */
+ void valueChanged(ListSelectionEvent event);
-} // ListSelectionListener
+} \ No newline at end of file
diff --git a/javax/swing/event/MenuDragMouseEvent.java b/javax/swing/event/MenuDragMouseEvent.java
index 997616706..6be11bcca 100644
--- a/javax/swing/event/MenuDragMouseEvent.java
+++ b/javax/swing/event/MenuDragMouseEvent.java
@@ -1,5 +1,5 @@
/* MenuDragMouseEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,68 +48,57 @@ import javax.swing.MenuSelectionManager;
* MenuDragMouseEvent
* @author Andrew Selkirk
*/
-public class MenuDragMouseEvent extends MouseEvent {
+public class MenuDragMouseEvent extends MouseEvent
+{
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * path
- */
- private MenuElement[] path = null;
+ /**
+ * path
+ */
+ private MenuElement[] path = null;
- /**
- * manager
- */
- private MenuSelectionManager manager = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor MenuDragMouseEvent
- * @param source Source
- * @param id MouseEvent type
- * @param when Time
- * @param modifiers Key modifiers
- * @param x Horizontal position
- * @param y Vertical position
- * @param clickCount Click count
- * @param popupTrigger Popup trigger?
- * @param path Path
- * @param manager MenuSelectionManager
- */
- public MenuDragMouseEvent(Component source, int id, long when, int modifiers,
- int x, int y, int clickCount, boolean popupTrigger,
- MenuElement[] path, MenuSelectionManager manager) {
- super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
- this.path = path;
- this.manager = manager;
- } // MenuDragMouseEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Get path
- * @returns path
- */
- public MenuElement[] getPath() {
- return path;
- } // getPath()
-
- /**
- * Get menu selection manager
- * @returns manager
- */
- public MenuSelectionManager getMenuSelectionManager() {
- return manager;
- } // getMenuSelectionManager()
-
-
-} // MenuDragMouseEvent
+ /**
+ * manager
+ */
+ private MenuSelectionManager manager = null;
+
+ /**
+ * Constructor MenuDragMouseEvent
+ * @param source Source
+ * @param id MouseEvent type
+ * @param when Time
+ * @param modifiers Key modifiers
+ * @param x Horizontal position
+ * @param y Vertical position
+ * @param clickCount Click count
+ * @param popupTrigger Popup trigger?
+ * @param path Path
+ * @param manager MenuSelectionManager
+ */
+ public MenuDragMouseEvent(Component source, int id, long when, int modifiers,
+ int x, int y, int clickCount, boolean popupTrigger,
+ MenuElement[] path, MenuSelectionManager manager)
+ {
+ super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
+ this.path = path;
+ this.manager = manager;
+ }
+
+ /**
+ * Get path
+ * @return path
+ */
+ public MenuElement[] getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Get menu selection manager
+ * @return manager
+ */
+ public MenuSelectionManager getMenuSelectionManager()
+ {
+ return manager;
+ }
+
+}
diff --git a/javax/swing/event/MenuKeyEvent.java b/javax/swing/event/MenuKeyEvent.java
index 511cb2254..3335850bc 100644
--- a/javax/swing/event/MenuKeyEvent.java
+++ b/javax/swing/event/MenuKeyEvent.java
@@ -1,5 +1,5 @@
/* MenuKeyEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,66 +48,55 @@ import javax.swing.MenuSelectionManager;
* MenuKeyEvent
* @author Andrew Selkirk
*/
-public class MenuKeyEvent extends KeyEvent {
+public class MenuKeyEvent extends KeyEvent
+{
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * path
- */
- private MenuElement[] path = null;
+ /**
+ * path
+ */
+ private MenuElement[] path = null;
- /**
- * manager
- */
- private MenuSelectionManager manager = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor MenuKeyEvent
- * @param source Source
- * @param id KeyEvent ID
- * @param when Time
- * @param modifiers Modifier keys
- * @param keyCode Key code
- * @param keyChar Key char
- * @param path Path
- * @param manager MenuSelectionManager
- */
- public MenuKeyEvent(Component source, int id, long when, int modifiers,
- int keyCode, char keyChar, MenuElement[] path,
- MenuSelectionManager manager) {
- super(source, id, when, modifiers, keyCode, keyChar);
- this.path = path;
- this.manager = manager;
- } // MenuKeyEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getPath
- * @returns path
- */
- public MenuElement[] getPath() {
- return path;
- } // getPath()
-
- /**
- * getMenuSelectionManager
- * @returns MenuSelectionManager
- */
- public MenuSelectionManager getMenuSelectionManager() {
- return manager;
- } // getMenuSelectionManager()
-
-
-} // MenuKeyEvent
+ /**
+ * manager
+ */
+ private MenuSelectionManager manager = null;
+
+ /**
+ * Constructor MenuKeyEvent
+ * @param source Source
+ * @param id KeyEvent ID
+ * @param when Time
+ * @param modifiers Modifier keys
+ * @param keyCode Key code
+ * @param keyChar Key char
+ * @param path Path
+ * @param manager MenuSelectionManager
+ */
+ public MenuKeyEvent(Component source, int id, long when, int modifiers,
+ int keyCode, char keyChar, MenuElement[] path,
+ MenuSelectionManager manager)
+ {
+ super(source, id, when, modifiers, keyCode, keyChar);
+ this.path = path;
+ this.manager = manager;
+ }
+
+ /**
+ * getPath
+ * @return path
+ */
+ public MenuElement[] getPath()
+ {
+ return path;
+ }
+
+ /**
+ * getMenuSelectionManager
+ * @return MenuSelectionManager
+ */
+ public MenuSelectionManager getMenuSelectionManager()
+ {
+ return manager;
+ }
+
+}
diff --git a/javax/swing/event/TableColumnModelEvent.java b/javax/swing/event/TableColumnModelEvent.java
index 2ca4148aa..cff49130e 100644
--- a/javax/swing/event/TableColumnModelEvent.java
+++ b/javax/swing/event/TableColumnModelEvent.java
@@ -1,5 +1,5 @@
/* TableColumnModelEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,60 +46,48 @@ import javax.swing.table.TableColumnModel;
* TableColumnModelEvent
* @author Andrew Selkirk
*/
-public class TableColumnModelEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * fromIndex
- */
- protected int fromIndex = 0;
-
- /**
- * toIndex
- */
- protected int toIndex = 0;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor TableColumnModelEvent
- * @param source Source TableColumnModel
- * @param from From index
- * @param to To index
- */
- public TableColumnModelEvent(TableColumnModel source,
- int from, int to) {
- super(source);
- fromIndex = from;
- toIndex = to;
- } // TableColumnModelEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getFromIndex.
- * @returns From index
- */
- public int getFromIndex() {
- return fromIndex;
- } // getFromIndex()
-
- /**
- * getToIndex.
- * @returns To index
- */
- public int getToIndex() {
- return toIndex;
- } // getToIndex()
-
-
-} // TableColumnModelEvent
+public class TableColumnModelEvent extends EventObject
+{
+
+ /**
+ * fromIndex
+ */
+ protected int fromIndex = 0;
+
+ /**
+ * toIndex
+ */
+ protected int toIndex = 0;
+
+ /**
+ * Constructor TableColumnModelEvent
+ * @param source Source TableColumnModel
+ * @param from From index
+ * @param to To index
+ */
+ public TableColumnModelEvent(TableColumnModel source, int from, int to)
+ {
+ super(source);
+ fromIndex = from;
+ toIndex = to;
+ }
+
+ /**
+ * getFromIndex.
+ * @return From index
+ */
+ public int getFromIndex()
+ {
+ return fromIndex;
+ }
+
+ /**
+ * getToIndex.
+ * @return To index
+ */
+ public int getToIndex()
+ {
+ return toIndex;
+ }
+
+} \ No newline at end of file
diff --git a/javax/swing/event/TableModelListener.java b/javax/swing/event/TableModelListener.java
index c8d6e8f8d..21e5ea047 100644
--- a/javax/swing/event/TableModelListener.java
+++ b/javax/swing/event/TableModelListener.java
@@ -1,5 +1,5 @@
/* TableModelListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,16 +40,21 @@ package javax.swing.event;
import java.util.EventListener;
/**
- * TableModelListener public interface
+ * A <code>TableModelListener</code> can register with a
+ * {@link javax.swing.table.TableModel} and receive notification of updates to
+ * the model.
+ *
* @author Andrew Selkirk
*/
-public interface TableModelListener extends EventListener {
-
- /**
- * Table changed
- * @param event Table Model Event
- */
- void tableChanged(TableModelEvent event);
-
-
-} // TableModelListener
+public interface TableModelListener extends EventListener
+{
+
+ /**
+ * Called to notify the listener that the
+ * {@link javax.swing.table.TableModel} has been updated.
+ *
+ * @param event contains details of the update.
+ */
+ void tableChanged(TableModelEvent event);
+
+}
diff --git a/javax/swing/event/TreeExpansionEvent.java b/javax/swing/event/TreeExpansionEvent.java
index c4b331346..5820b3391 100644
--- a/javax/swing/event/TreeExpansionEvent.java
+++ b/javax/swing/event/TreeExpansionEvent.java
@@ -1,5 +1,5 @@
/* TreeExpansionEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,44 +46,32 @@ import javax.swing.tree.TreePath;
* TreeExpansionEvent
* @author Andrew Selkirk
*/
-public class TreeExpansionEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * path
- */
- protected TreePath path = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor TreeExpansionEvent
- * @param source Source object
- * @param path Path
- */
- public TreeExpansionEvent(Object source, TreePath path) {
- super(source);
- this.path = path;
- } // TreeExpansionEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getPath
- * @returns Tree path
- */
- public TreePath getPath() {
- return path;
- } // getPath()
-
-
-} // TreeExpansionEvent
+public class TreeExpansionEvent extends EventObject
+{
+
+ /**
+ * path
+ */
+ protected TreePath path = null;
+
+ /**
+ * Constructor TreeExpansionEvent
+ * @param source Source object
+ * @param path Path
+ */
+ public TreeExpansionEvent(Object source, TreePath path)
+ {
+ super(source);
+ this.path = path;
+ }
+
+ /**
+ * getPath
+ * @return Tree path
+ */
+ public TreePath getPath()
+ {
+ return path;
+ }
+
+}
diff --git a/javax/swing/event/TreeModelEvent.java b/javax/swing/event/TreeModelEvent.java
index 8fa28a7ea..2d562a5c4 100644
--- a/javax/swing/event/TreeModelEvent.java
+++ b/javax/swing/event/TreeModelEvent.java
@@ -1,5 +1,5 @@
/* TreeModelEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,128 +46,123 @@ import javax.swing.tree.TreePath;
* TreeModelEvent
* @author Andrew Selkirk
*/
-public class TreeModelEvent extends EventObject {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * childIndices
- */
- protected int[] childIndices = null;
-
- /**
- * children
- */
- protected Object[] children = null;
-
- /**
- * path
- */
- protected TreePath path = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
+public class TreeModelEvent extends EventObject
+{
+
+ /**
+ * childIndices
+ */
+ protected int[] childIndices = null;
+
+ /**
+ * children
+ */
+ protected Object[] children = null;
+
+ /**
+ * path
+ */
+ protected TreePath path = null;
- /**
- * Constructor TreeModelEvent
- * @param source Source object
- * @param path
- */
- public TreeModelEvent(Object source, Object[] path) {
- super(source);
- this.path = new TreePath(path);
- } // TreeModelEvent()
-
- /**
- * Constructor TreeModelEvent
- * @param source Source object
- * @param path path
- * @param childIndices Child indices
- * @param children Children
- */
- public TreeModelEvent(Object source, Object[] path,
- int[] childIndices, Object[] children) {
- super(source);
- this.path = new TreePath(path);
- this.childIndices = childIndices;
- this.children = children;
- } // TreeModelEvent()
-
- /**
- * Constructor TreeModelEvent
- * @param source Source object
- * @param path Path
- */
- public TreeModelEvent(Object source, TreePath path) {
- super(source);
- this.path = path;
- } // TreeModelEvent()
-
- /**
- * Constructor TreeModelEvent
- * @param source Source object
- * @param path Path
- * @param childIndices Child indices
- * @param children Children
- */
- public TreeModelEvent(Object source, TreePath path,
- int[] childIndices, Object[] children) {
- super(source);
- this.path = path;
- this.childIndices = childIndices;
- this.children = children;
- } // TreeModelEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getChildIndices
- * @returns child indices
- */
- public int[] getChildIndices() {
- return childIndices;
- } // getChildIndices()
-
- /**
- * getChildren
- * @returns children
- */
- public Object[] getChildren() {
- return children;
- } // getChildren()
-
- /**
- * getPath
- * @returns path
- */
- public Object[] getPath() {
- return path.getPath();
- } // getPath()
-
- /**
- * getTreePath
- * @returns TreePath
- */
- public TreePath getTreePath() {
- return path;
- } // getTreePath()
-
- /**
- * String representation
- * @returns String representation
- */
- public String toString() {
- return getClass() + " [Source: " + getSource() + ", TreePath: " + getTreePath() +
- ", Child Indicies: " + getChildIndices() + ", Children: " + getChildren() +
- ", Path: " + getPath() +"]";
- } // toString()
-
-
-} // TreeModelEvent
+ /**
+ * Constructor TreeModelEvent
+ * @param source Source object
+ * @param path
+ */
+ public TreeModelEvent(Object source, Object[] path)
+ {
+ super(source);
+ this.path = new TreePath(path);
+ }
+
+ /**
+ * Constructor TreeModelEvent
+ * @param source Source object
+ * @param path path
+ * @param childIndices Child indices
+ * @param children Children
+ */
+ public TreeModelEvent(Object source, Object[] path,
+ int[] childIndices, Object[] children)
+ {
+ super(source);
+ this.path = new TreePath(path);
+ this.childIndices = childIndices;
+ this.children = children;
+ }
+
+ /**
+ * Constructor TreeModelEvent
+ * @param source Source object
+ * @param path Path
+ */
+ public TreeModelEvent(Object source, TreePath path)
+ {
+ super(source);
+ this.path = path;
+ }
+
+ /**
+ * Constructor TreeModelEvent
+ * @param source Source object
+ * @param path Path
+ * @param childIndices Child indices
+ * @param children Children
+ */
+ public TreeModelEvent(Object source, TreePath path,
+ int[] childIndices, Object[] children)
+ {
+ super(source);
+ this.path = path;
+ this.childIndices = childIndices;
+ this.children = children;
+ }
+
+ /**
+ * getChildIndices
+ * @return child indices
+ */
+ public int[] getChildIndices()
+ {
+ return childIndices;
+ }
+
+ /**
+ * getChildren
+ * @return children
+ */
+ public Object[] getChildren()
+ {
+ return children;
+ }
+
+ /**
+ * getPath
+ * @return path
+ */
+ public Object[] getPath()
+ {
+ return path.getPath();
+ }
+
+ /**
+ * getTreePath
+ * @return TreePath
+ */
+ public TreePath getTreePath()
+ {
+ return path;
+ }
+
+ /**
+ * String representation
+ * @return String representation
+ */
+ public String toString()
+ {
+ return getClass() + " [Source: " + getSource() + ", TreePath: "
+ + getTreePath() + ", Child Indicies: " + getChildIndices()
+ + ", Children: " + getChildren() + ", Path: " + getPath() +"]";
+ }
+
+}
diff --git a/javax/swing/event/TreeSelectionEvent.java b/javax/swing/event/TreeSelectionEvent.java
index 9b87667a3..1930677af 100644
--- a/javax/swing/event/TreeSelectionEvent.java
+++ b/javax/swing/event/TreeSelectionEvent.java
@@ -1,5 +1,5 @@
/* TreeSelectionEvent.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,10 +49,6 @@ import javax.swing.tree.TreePath;
*/
public class TreeSelectionEvent extends EventObject {
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
/**
* paths
*/
@@ -73,11 +69,6 @@ public class TreeSelectionEvent extends EventObject {
*/
protected TreePath newLeadSelectionPath;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor TreeSelectionEvent
* @param source TODO
@@ -95,7 +86,7 @@ public class TreeSelectionEvent extends EventObject {
this.areNew = areNew;
this.oldLeadSelectionPath = oldLeadSelectionPath;
this.newLeadSelectionPath = newLeadSelectionPath;
- } // TreeSelectionEvent()
+ }
/**
* Constructor TreeSelectionEvent
@@ -114,29 +105,24 @@ public class TreeSelectionEvent extends EventObject {
this.areNew = new boolean[]{isNew};
this.oldLeadSelectionPath = oldLeadSelectionPath;
this.newLeadSelectionPath = newLeadSelectionPath;
- } // TreeSelectionEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ }
/**
- * @returns the first path element
+ * @return the first path element
*/
public TreePath getPath()
{
return paths[0];
- } // getPath()
+ }
/**
*
- * @returns the paths with selection changed
+ * @return the paths with selection changed
*/
public TreePath[] getPaths()
{
return (TreePath[]) paths.clone();
- } // getPaths()
+ }
/**
* @return true if the first path is added to the selection, false otherwise
@@ -144,7 +130,7 @@ public class TreeSelectionEvent extends EventObject {
public boolean isAddedPath()
{
return areNew[0];
- } // isAddedPath()
+ }
/**
* @param path the path to check
@@ -157,7 +143,7 @@ public class TreeSelectionEvent extends EventObject {
return areNew[i];
return false;
- } // isAddedPath()
+ }
/**
* @param index the index'th path
@@ -166,7 +152,7 @@ public class TreeSelectionEvent extends EventObject {
public boolean isAddedPath(int index)
{
return areNew[index];
- } // isAddedPath()
+ }
/**
* @return the previous lead selection path
@@ -174,15 +160,15 @@ public class TreeSelectionEvent extends EventObject {
public TreePath getOldLeadSelectionPath()
{
return oldLeadSelectionPath;
- } // getOldLeadSelectionPath()
+ }
/**
- * @returns the current lead selection path
+ * @return the current lead selection path
*/
public TreePath getNewLeadSelectionPath()
{
return newLeadSelectionPath;
- } // getNewLeadSelectionPath()
+ }
/**
* @param source the new event source
@@ -193,7 +179,6 @@ public class TreeSelectionEvent extends EventObject {
return new TreeSelectionEvent (source, paths, areNew,
oldLeadSelectionPath,
newLeadSelectionPath);
- } // cloneWithSource()
-
+ }
-} // TreeSelectionEvent
+}
diff --git a/javax/swing/event/UndoableEditEvent.java b/javax/swing/event/UndoableEditEvent.java
index 147c2e5b1..b59ceadc9 100644
--- a/javax/swing/event/UndoableEditEvent.java
+++ b/javax/swing/event/UndoableEditEvent.java
@@ -1,5 +1,5 @@
/* UndoableEditEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,46 +47,34 @@ import javax.swing.undo.UndoableEdit;
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public class UndoableEditEvent extends EventObject {
+public class UndoableEditEvent extends EventObject
+{
private static final long serialVersionUID = 4418044561759134484L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * edit
- */
- private UndoableEdit edit;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor UndoableEditEvent
- * @param source TODO
- * @param edit TODO
- */
- public UndoableEditEvent(Object source, UndoableEdit edit) {
- super(source);
- this.edit = edit;
- } // UndoableEditEvent()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getEdit
- * @returns UndoableEdit
- */
- public UndoableEdit getEdit() {
- return edit;
- } // getEdit()
-
-
-} // UndoableEditEvent
+ /**
+ * edit
+ */
+ private UndoableEdit edit;
+
+ /**
+ * Constructor UndoableEditEvent
+ * @param source TODO
+ * @param edit TODO
+ */
+ public UndoableEditEvent(Object source, UndoableEdit edit)
+ {
+ super(source);
+ this.edit = edit;
+ }
+
+ /**
+ * getEdit
+ * @return UndoableEdit
+ */
+ public UndoableEdit getEdit()
+ {
+ return edit;
+ }
+
+}
diff --git a/javax/swing/plaf/basic/BasicHTML.java b/javax/swing/plaf/basic/BasicHTML.java
index ff7a7cdaf..98c9cb277 100644
--- a/javax/swing/plaf/basic/BasicHTML.java
+++ b/javax/swing/plaf/basic/BasicHTML.java
@@ -38,12 +38,21 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
import java.io.IOException;
import java.io.StringReader;
import javax.swing.JComponent;
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.EditorKit;
import javax.swing.text.Element;
+import javax.swing.text.Position;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import javax.swing.text.html.HTMLDocument;
@@ -59,6 +68,287 @@ public class BasicHTML
{
/**
+ * This class serves as the root view for HTML rendering components.
+ * Its purpose and implementation is similar to the BasicTextUI.RootView
+ * class, only that is implements some stuff differently due to the nature
+ * of not beeing inside a JTextComponent.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private static class HTMLRootView extends View
+ {
+ /**
+ * The real root view.
+ */
+ private View view;
+
+ /**
+ * The component on which to render the view.
+ */
+ private JComponent component;
+
+ /**
+ * The EditorKit.
+ */
+ private EditorKit editorKit;
+
+ /**
+ * The document to use.
+ */
+ private Document document;
+
+ /**
+ * Creates a new RootView.
+ */
+ public HTMLRootView(JComponent c, View view, EditorKit kit, Document doc)
+ {
+ super(null);
+ component = c;
+ editorKit = kit;
+ document = doc;
+ setView(view);
+ }
+
+ /**
+ * Returns the ViewFactory for this RootView. If the current EditorKit
+ * provides a ViewFactory, this is used. Otherwise the TextUI itself
+ * is returned as a ViewFactory.
+ *
+ * @return the ViewFactory for this RootView
+ */
+ public ViewFactory getViewFactory()
+ {
+ return editorKit.getViewFactory();
+ }
+
+ /**
+ * Indicates that the preferences of one of the child view has changed.
+ * This calls revalidate on the text component.
+ *
+ * @param v the child view which's preference has changed
+ * @param width <code>true</code> if the width preference has changed
+ * @param height <code>true</code> if the height preference has changed
+ */
+ public void preferenceChanged(View v, boolean width, boolean height)
+ {
+ component.revalidate();
+ }
+
+ /**
+ * Sets the real root view.
+ *
+ * @param v the root view to set
+ */
+ public void setView(View v)
+ {
+ if (view != null)
+ view.setParent(null);
+
+ if (v != null)
+ v.setParent(this);
+
+ view = v;
+ }
+
+ /**
+ * Returns the real root view, regardless of the index.
+ *
+ * @param index not used here
+ *
+ * @return the real root view, regardless of the index.
+ */
+ public View getView(int index)
+ {
+ return view;
+ }
+
+ /**
+ * Returns <code>1</code> since the RootView always contains one
+ * child, that is the real root of the View hierarchy.
+ *
+ * @return <code>1</code> since the RootView always contains one
+ * child, that is the real root of the View hierarchy
+ */
+ public int getViewCount()
+ {
+ int count = 0;
+ if (view != null)
+ count = 1;
+ return count;
+ }
+
+ /**
+ * Returns the <code>Container</code> that contains this view. This
+ * normally will be the text component that is managed by this TextUI.
+ *
+ * @return the <code>Container</code> that contains this view
+ */
+ public Container getContainer()
+ {
+ return component;
+ }
+
+ /**
+ * Returns the preferred span along the specified <code>axis</code>.
+ * This is delegated to the real root view.
+ *
+ * @param axis the axis for which the preferred span is queried
+ *
+ * @return the preferred span along the axis
+ */
+ public float getPreferredSpan(int axis)
+ {
+ if (view != null)
+ return view.getPreferredSpan(axis);
+
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * Paints the view. This is delegated to the real root view.
+ *
+ * @param g the <code>Graphics</code> context to paint to
+ * @param s the allocation for the View
+ */
+ public void paint(Graphics g, Shape s)
+ {
+ if (view != null)
+ {
+ Rectangle b = s.getBounds();
+ view.setSize(b.width, b.height);
+ view.paint(g, s);
+ }
+ }
+
+
+ /**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * This is delegated to the real root view.
+ *
+ * @param position the position of the character in the model
+ * @param a the area that is occupied by the view
+ * @param bias either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
+ * direction bias. If <code>null</code> this defaults to
+ * <code>Position.Bias.Forward</code>
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ * @throws IllegalArgumentException if b is not one of the above listed
+ * valid values
+ */
+ public Shape modelToView(int position, Shape a, Position.Bias bias)
+ throws BadLocationException
+ {
+ return view.modelToView(position, a, bias);
+ }
+
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ * @param b the bias to use
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ */
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ return view.viewToModel(x, y, a, b);
+ }
+
+ /**
+ * Notification about text insertions. These are forwarded to the
+ * real root view.
+ *
+ * @param ev the DocumentEvent describing the change
+ * @param shape the current allocation of the view's display
+ * @param vf the ViewFactory to use for creating new Views
+ */
+ public void insertUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ view.insertUpdate(ev, shape, vf);
+ }
+
+ /**
+ * Notification about text removals. These are forwarded to the
+ * real root view.
+ *
+ * @param ev the DocumentEvent describing the change
+ * @param shape the current allocation of the view's display
+ * @param vf the ViewFactory to use for creating new Views
+ */
+ public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ view.removeUpdate(ev, shape, vf);
+ }
+
+ /**
+ * Notification about text changes. These are forwarded to the
+ * real root view.
+ *
+ * @param ev the DocumentEvent describing the change
+ * @param shape the current allocation of the view's display
+ * @param vf the ViewFactory to use for creating new Views
+ */
+ public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
+ {
+ view.changedUpdate(ev, shape, vf);
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param a the allocation for the view
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
+ int d, Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ return view.getNextVisualPositionFrom(pos, b, a, d, biasRet);
+ }
+
+ public int getStartOffset()
+ {
+ return 0;
+ }
+
+ public int getEndOffset()
+ {
+ return getDocument().getLength();
+ }
+
+ public Document getDocument()
+ {
+ return document;
+ }
+ }
+
+ /**
* The key that is used to store a HTML view in a JComponent's client
* properties.
*/
@@ -116,7 +406,8 @@ public class BasicHTML
ViewFactory vf = kit.getViewFactory();
Element root = doc.getDefaultRootElement();
View view = vf.create(root);
- return view;
+ HTMLRootView rootView = new HTMLRootView(c, view, kit, doc);
+ return rootView;
}
/**
@@ -132,7 +423,7 @@ public class BasicHTML
{
// We consider a string to be HTML if it contains both the '<' and '>'
// character at least once.
- return s.contains("<") && s.contains(">");
+ return (s != null) && s.contains("<") && s.contains(">");
}
/**
diff --git a/javax/swing/plaf/basic/BasicInternalFrameUI.java b/javax/swing/plaf/basic/BasicInternalFrameUI.java
index 9fc442c3a..f6cbeec88 100644
--- a/javax/swing/plaf/basic/BasicInternalFrameUI.java
+++ b/javax/swing/plaf/basic/BasicInternalFrameUI.java
@@ -92,7 +92,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public void internalFrameActivated(InternalFrameEvent e)
{
- // FIXME: Implement.
+ frame.getGlassPane().setVisible(false);
}
/**
@@ -122,7 +122,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public void internalFrameDeactivated(InternalFrameEvent e)
{
- // FIXME: Implement.
+ frame.getGlassPane().setVisible(true);
}
/**
@@ -462,8 +462,6 @@ public class BasicInternalFrameUI extends InternalFrameUI
dims.width -= insets.left + insets.right;
dims.height -= insets.top + insets.bottom;
- frame.getRootPane().getGlassPane().setBounds(0, 0, dims.width,
- dims.height);
int nh = 0;
int sh = 0;
int ew = 0;
@@ -524,18 +522,6 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method returns the maximum layout size.
- *
- * @param c
- * The Container to find a maximum layout size for.
- * @return The maximum dimensions for the JInternalFrame.
- */
- public Dimension maximumLayoutSize(Container c)
- {
- return preferredLayoutSize(c);
- }
-
- /**
* Th8is method returns the preferred layout size.
*
* @param c
@@ -1128,14 +1114,15 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
frame = (JInternalFrame) c;
- ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false);
- frame.getRootPane().getGlassPane().setVisible(true);
-
installDefaults();
installListeners();
installComponents();
installKeyboardActions();
+ ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false);
+ if (! frame.isSelected())
+ frame.getRootPane().getGlassPane().setVisible(true);
+
frame.setOpaque(true);
frame.invalidate();
}
@@ -1168,8 +1155,6 @@ public class BasicInternalFrameUI extends InternalFrameUI
frame.setLayout(internalFrameLayout);
LookAndFeel.installBorder(frame, "InternalFrame.border");
frame.setFrameIcon(UIManager.getIcon("InternalFrame.icon"));
- // InternalFrames are invisible by default.
- frame.setVisible(false);
}
/**
diff --git a/javax/swing/plaf/basic/BasicLabelUI.java b/javax/swing/plaf/basic/BasicLabelUI.java
index fd4cff568..d0964f473 100644
--- a/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/javax/swing/plaf/basic/BasicLabelUI.java
@@ -53,6 +53,7 @@ import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
+import javax.swing.text.View;
/**
* This is the Basic Look and Feel class for the JLabel. One BasicLabelUI
@@ -64,11 +65,22 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
protected static BasicLabelUI labelUI;
/**
+ * These fields hold the rectangles for the whole label,
+ * the icon and the text.
+ */
+ private Rectangle vr;
+ private Rectangle ir;
+ private Rectangle tr;
+
+ /**
* Creates a new BasicLabelUI object.
*/
public BasicLabelUI()
{
super();
+ vr = new Rectangle();
+ ir = new Rectangle();
+ tr = new Rectangle();
}
/**
@@ -99,13 +111,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
public Dimension getPreferredSize(JComponent c)
{
JLabel lab = (JLabel) c;
- Rectangle vr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle tr = new Rectangle();
Insets insets = lab.getInsets();
FontMetrics fm = lab.getFontMetrics(lab.getFont());
layoutCL(lab, fm, lab.getText(), lab.getIcon(), vr, ir, tr);
- Rectangle cr = tr.union(ir);
+ Rectangle cr = SwingUtilities.computeUnion(tr.x, tr.y, tr.width, tr.height,
+ ir);
return new Dimension(insets.left + cr.width + insets.right, insets.top
+ cr.height + insets.bottom);
@@ -148,11 +158,6 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
public void paint(Graphics g, JComponent c)
{
JLabel b = (JLabel) c;
-
- Rectangle tr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle vr = new Rectangle();
-
FontMetrics fm = g.getFontMetrics();
vr = SwingUtilities.calculateInnerArea(c, vr);
@@ -168,13 +173,21 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
if (icon != null)
icon.paintIcon(b, g, ir.x, ir.y);
- if (text != null && !text.equals(""))
- {
- if (b.isEnabled())
- paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
- else
- paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
- }
+ Object htmlRenderer = b.getClientProperty(BasicHTML.propertyKey);
+ if (htmlRenderer == null)
+ {
+ if (text != null && !text.equals(""))
+ {
+ if (b.isEnabled())
+ paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+ else
+ paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent());
+ }
+ }
+ else
+ {
+ ((View) htmlRenderer).paint(g, tr);
+ }
}
/**
@@ -312,7 +325,7 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
*/
protected void installComponents(JLabel c)
{
- //FIXME: fix javadoc + implement.
+ BasicHTML.updateRenderer(c, c.getText());
}
/**
@@ -322,7 +335,8 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
*/
protected void uninstallComponents(JLabel c)
{
- //FIXME: fix javadoc + implement.
+ c.putClientProperty(BasicHTML.propertyKey, null);
+ c.putClientProperty(BasicHTML.documentBaseKey, null);
}
/**
@@ -402,6 +416,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
*/
public void propertyChange(PropertyChangeEvent e)
{
- // What to do here?
+ if (e.getPropertyName().equals("text"))
+ {
+ String text = (String) e.getNewValue();
+ JLabel l = (JLabel) e.getSource();
+ BasicHTML.updateRenderer(l, text);
+ }
}
}
diff --git a/javax/swing/plaf/basic/BasicListUI.java b/javax/swing/plaf/basic/BasicListUI.java
index 9771db270..f9fca190c 100644
--- a/javax/swing/plaf/basic/BasicListUI.java
+++ b/javax/swing/plaf/basic/BasicListUI.java
@@ -64,6 +64,7 @@ import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
@@ -739,9 +740,8 @@ public class BasicListUI extends ListUI
for (int i = minIndex + 1; i <= maxIndex; i++)
{
Point hiLoc = indexToLocation(list, i);
- Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, width,
- getCellHeight(i));
- bounds = bounds.union(hibounds);
+ bounds = SwingUtilities.computeUnion(hiLoc.x, hiLoc.y, width,
+ getCellHeight(i), bounds);
}
return bounds;
diff --git a/javax/swing/plaf/basic/BasicScrollBarUI.java b/javax/swing/plaf/basic/BasicScrollBarUI.java
index a2f5b82db..c8713c934 100644
--- a/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -653,19 +653,17 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
{
- width += incrButton.getPreferredSize().getWidth();
- width += decrButton.getPreferredSize().getWidth();
-
- width += (scrollbar.getMaximum() - scrollbar.getMinimum());
- height = UIManager.getInt("ScrollBar.width");
+ width += incrButton.getPreferredSize().getWidth();
+ width += decrButton.getPreferredSize().getWidth();
+ width += 16;
+ height = UIManager.getInt("ScrollBar.width");
}
else
{
- height += incrButton.getPreferredSize().getHeight();
- height += decrButton.getPreferredSize().getHeight();
-
- height += (scrollbar.getMaximum() - scrollbar.getMinimum());
- width = UIManager.getInt("ScrollBar.width");
+ height += incrButton.getPreferredSize().getHeight();
+ height += decrButton.getPreferredSize().getHeight();
+ height += 16;
+ width = UIManager.getInt("ScrollBar.width");
}
Insets insets = scrollbar.getInsets();
@@ -721,18 +719,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void installComponents()
{
- if (incrButton != null)
- scrollbar.add(incrButton);
- if (decrButton != null)
- scrollbar.add(decrButton);
- }
-
- /**
- * This method installs the defaults for the scrollbar specified by the
- * Basic Look and Feel.
- */
- protected void installDefaults()
- {
int orientation = scrollbar.getOrientation();
switch (orientation)
{
@@ -746,6 +732,18 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
break;
}
+ if (incrButton != null)
+ scrollbar.add(incrButton);
+ if (decrButton != null)
+ scrollbar.add(decrButton);
+ }
+
+ /**
+ * This method installs the defaults for the scrollbar specified by the
+ * Basic Look and Feel.
+ */
+ protected void installDefaults()
+ {
LookAndFeel.installColors(scrollbar, "ScrollBar.background",
"ScrollBar.foreground");
LookAndFeel.installBorder(scrollbar, "ScrollBar.border");
diff --git a/javax/swing/plaf/basic/BasicTextUI.java b/javax/swing/plaf/basic/BasicTextUI.java
index 516049838..beb1a6dfe 100644
--- a/javax/swing/plaf/basic/BasicTextUI.java
+++ b/javax/swing/plaf/basic/BasicTextUI.java
@@ -365,6 +365,38 @@ public abstract class BasicTextUI extends TextUI
{
return view.getNextVisualPositionFrom(pos, b, a, d, biasRet);
}
+
+ /**
+ * Returns the startOffset of this view, which is always the beginning
+ * of the document.
+ *
+ * @return the startOffset of this view
+ */
+ public int getStartOffset()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the endOffset of this view, which is always the end
+ * of the document.
+ *
+ * @return the endOffset of this view
+ */
+ public int getEndOffset()
+ {
+ return getDocument().getLength();
+ }
+
+ /**
+ * Returns the document associated with this view.
+ *
+ * @return the document associated with this view
+ */
+ public Document getDocument()
+ {
+ return textComponent.getDocument();
+ }
}
/**
diff --git a/javax/swing/plaf/metal/MetalFileChooserUI.java b/javax/swing/plaf/metal/MetalFileChooserUI.java
index 76f92f515..cb94c87b8 100644
--- a/javax/swing/plaf/metal/MetalFileChooserUI.java
+++ b/javax/swing/plaf/metal/MetalFileChooserUI.java
@@ -1555,7 +1555,10 @@ public class MetalFileChooserUI
scrollPane.getViewport().setView(fileList);
}
fileListPanel.add(scrollPane);
-
+ // This size was determined using BeanShell and dumping the JFileChooser
+ // component hierarchy. Sun has an internal FilePane class in there, but
+ // that probably doesn't matter atm.
+ fileListPanel.setPreferredSize(new Dimension(405, 135));
return fileListPanel;
}
diff --git a/javax/swing/plaf/metal/MetalScrollBarUI.java b/javax/swing/plaf/metal/MetalScrollBarUI.java
index 0ff501f89..155bb8146 100644
--- a/javax/swing/plaf/metal/MetalScrollBarUI.java
+++ b/javax/swing/plaf/metal/MetalScrollBarUI.java
@@ -41,6 +41,7 @@ package javax.swing.plaf.metal;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Rectangle;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -48,6 +49,7 @@ import java.beans.PropertyChangeListener;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
+import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollBarUI;
@@ -465,11 +467,60 @@ public class MetalScrollBarUI extends BasicScrollBarUI
*/
protected Dimension getMinimumThumbSize()
{
- if (isFreeStanding)
- return MIN_THUMB_SIZE_FREE_STANDING;
+ Dimension retVal;
+ if (scrollbar != null)
+ {
+ if (isFreeStanding)
+ retVal = MIN_THUMB_SIZE_FREE_STANDING;
+ else
+ retVal = MIN_THUMB_SIZE;
+ }
else
- return MIN_THUMB_SIZE;
+ retVal = new Dimension(0, 0);
+ return retVal;
}
-
+
+ /**
+ * Returns the <code>preferredSize</code> for the specified scroll bar.
+ * For a vertical scrollbar the height is the sum of the preferred heights
+ * of the buttons plus <code>30</code>. The width is fetched from the
+ * <code>UIManager</code> property <code>ScrollBar.width</code>.
+ *
+ * For horizontal scrollbars the width is the sum of the preferred widths
+ * of the buttons plus <code>30</code>. The height is fetched from the
+ * <code>UIManager</code> property <code>ScrollBar.height</code>.
+ *
+ * @param c the scrollbar for which to calculate the preferred size
+ *
+ * @return the <code>preferredSize</code> for the specified scroll bar
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ int height;
+ int width;
+ height = width = 0;
+
+ if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
+ {
+ width += incrButton.getPreferredSize().getWidth();
+ width += decrButton.getPreferredSize().getWidth();
+ width += 30;
+ height = UIManager.getInt("ScrollBar.width");
+ }
+ else
+ {
+ height += incrButton.getPreferredSize().getHeight();
+ height += decrButton.getPreferredSize().getHeight();
+ height += 30;
+ width = UIManager.getInt("ScrollBar.width");
+ }
+
+ Insets insets = scrollbar.getInsets();
+
+ height += insets.top + insets.bottom;
+ width += insets.left + insets.right;
+
+ return new Dimension(width, height);
+ }
}
diff --git a/javax/swing/plaf/metal/MetalUtils.java b/javax/swing/plaf/metal/MetalUtils.java
index 50112ce21..b9d5ea764 100644
--- a/javax/swing/plaf/metal/MetalUtils.java
+++ b/javax/swing/plaf/metal/MetalUtils.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import gnu.classpath.SystemProperties;
+
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
@@ -88,7 +90,8 @@ class MetalUtils
static void fillMetalPattern(Component c, Graphics g, int x, int y, int w, int h,
Color light, Color dark)
{
- if (g instanceof Graphics2D)
+ if (g instanceof Graphics2D
+ && SystemProperties.getProperty("gnu.javax.swing.noGraphics2D") != null)
fillMetalPattern2D((Graphics2D) g, x, y, w, h, light, dark);
else
{
diff --git a/javax/swing/text/AbstractDocument.java b/javax/swing/text/AbstractDocument.java
index be6134974..0e5d37cd1 100644
--- a/javax/swing/text/AbstractDocument.java
+++ b/javax/swing/text/AbstractDocument.java
@@ -1586,6 +1586,18 @@ public abstract class AbstractDocument implements Document, Serializable
private Element[] children = new Element[0];
/**
+ * The cached startOffset value. This is used in the case when a
+ * BranchElement (temporarily) has no child elements.
+ */
+ private int startOffset;
+
+ /**
+ * The cached endOffset value. This is used in the case when a
+ * BranchElement (temporarily) has no child elements.
+ */
+ private int endOffset;
+
+ /**
* Creates a new <code>BranchElement</code> with the specified
* parent and attributes.
*
@@ -1596,6 +1608,8 @@ public abstract class AbstractDocument implements Document, Serializable
public BranchElement(Element parent, AttributeSet attributes)
{
super(parent, attributes);
+ startOffset = -1;
+ endOffset = -1;
}
/**
@@ -1668,7 +1682,7 @@ public abstract class AbstractDocument implements Document, Serializable
// return 0
if (offset < getStartOffset())
return 0;
-
+
// XXX: There is surely a better algorithm
// as beginning from first element each time.
for (int index = 0; index < children.length - 1; ++index)
@@ -1708,12 +1722,15 @@ public abstract class AbstractDocument implements Document, Serializable
*/
public int getEndOffset()
{
- int end = 0;
- if (getElementCount() == 0)
- end = getLength(); // FIXME: That ain't correct, fix it.
+ if (children.length == 0)
+ {
+ if (endOffset == -1)
+ throw new NullPointerException("BranchElement has no children.");
+ }
else
- end = children[children.length - 1].getEndOffset();
- return end;
+ endOffset = children[children.length - 1].getEndOffset();
+
+ return endOffset;
}
/**
@@ -1734,16 +1751,20 @@ public abstract class AbstractDocument implements Document, Serializable
*
* @return the start offset of this element inside the document model
*
- * @throws NullPointerException if this branch element has no children
+ * @throws NullPointerException if this branch element has no children and
+ * no startOffset value has been cached
*/
public int getStartOffset()
{
- int start = 0;
- if (getElementCount() == 0)
- start = 0; // FIXME: That ain't correct, fix it.
+ if (children.length == 0)
+ {
+ if (startOffset == -1)
+ throw new NullPointerException("BranchElement has no children.");
+ }
else
- start = children[0].getStartOffset();
- return start;
+ startOffset = children[0].getStartOffset();
+
+ return startOffset;
}
/**
@@ -2041,13 +2062,29 @@ public abstract class AbstractDocument implements Document, Serializable
/** The serialization UID (compatible with JDK1.5). */
private static final long serialVersionUID = -8906306331347768017L;
- /** Manages the start offset of this element. */
- Position startPos;
+ /**
+ * Manages the start offset of this element.
+ */
+ private Position startPos;
+
+ /**
+ * Manages the end offset of this element.
+ */
+ private Position endPos;
- /** Manages the end offset of this element. */
- Position endPos;
+ /**
+ * This gets possible added to the startOffset when a startOffset
+ * outside the document range is requested.
+ */
+ private int startDelta;
/**
+ * This gets possible added to the endOffset when a endOffset
+ * outside the document range is requested.
+ */
+ private int endDelta;
+
+ /**
* Creates a new <code>LeafElement</code>.
*
* @param parent the parent of this <code>LeafElement</code>
@@ -2059,20 +2096,18 @@ public abstract class AbstractDocument implements Document, Serializable
int end)
{
super(parent, attributes);
- {
- try
+ int len = content.length();
+ startDelta = 0;
+ if (start > len)
+ startDelta = start - len;
+ endDelta = 0;
+ if (end > len)
+ endDelta = end - len;
+ try
{
- if (parent != null)
- {
- startPos = parent.getDocument().createPosition(start);
- endPos = parent.getDocument().createPosition(end);
- }
- else
- {
- startPos = createPosition(start);
- endPos = createPosition(end);
+ startPos = createPosition(start - startDelta);
+ endPos = createPosition(end - endDelta);
}
- }
catch (BadLocationException ex)
{
AssertionError as;
@@ -2083,7 +2118,6 @@ public abstract class AbstractDocument implements Document, Serializable
as.initCause(ex);
throw as;
}
- }
}
/**
@@ -2155,7 +2189,7 @@ public abstract class AbstractDocument implements Document, Serializable
*/
public int getEndOffset()
{
- return endPos.getOffset();
+ return endPos.getOffset() + endDelta;
}
/**
@@ -2181,7 +2215,7 @@ public abstract class AbstractDocument implements Document, Serializable
*/
public int getStartOffset()
{
- return startPos.getOffset();
+ return startPos.getOffset() + startDelta;
}
/**
diff --git a/javax/swing/text/CompositeView.java b/javax/swing/text/CompositeView.java
index 49abbb2c8..a10aca7e6 100644
--- a/javax/swing/text/CompositeView.java
+++ b/javax/swing/text/CompositeView.java
@@ -373,7 +373,8 @@ public abstract class CompositeView
*/
public int getViewIndex(int pos, Position.Bias b)
{
- // FIXME: Handle bias somehow.
+ if (b == Position.Bias.Backward && pos != 0)
+ pos -= 1;
return getViewIndexAtPosition(pos);
}
diff --git a/javax/swing/text/DefaultCaret.java b/javax/swing/text/DefaultCaret.java
index 5a5bb429e..e1ddddda3 100644
--- a/javax/swing/text/DefaultCaret.java
+++ b/javax/swing/text/DefaultCaret.java
@@ -693,7 +693,10 @@ public class DefaultCaret extends Rectangle
if (comp == null)
return;
- int dot = getDot();
+ // Make sure the dot has a sane position.
+ dot = Math.min(dot, textComponent.getDocument().getLength());
+ dot = Math.max(dot, 0);
+
Rectangle rect = null;
try
@@ -702,10 +705,10 @@ public class DefaultCaret extends Rectangle
}
catch (BadLocationException e)
{
- AssertionError ae;
- ae = new AssertionError("Unexpected bad caret location: " + dot);
- ae.initCause(e);
- throw ae;
+ AssertionError ae;
+ ae = new AssertionError("Unexpected bad caret location: " + dot);
+ ae.initCause(e);
+ throw ae;
}
if (rect == null)
diff --git a/javax/swing/text/DefaultFormatter.java b/javax/swing/text/DefaultFormatter.java
index ec8969615..19994e21b 100644
--- a/javax/swing/text/DefaultFormatter.java
+++ b/javax/swing/text/DefaultFormatter.java
@@ -367,7 +367,11 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
Object value = string;
Class valueClass = getValueClass();
if (valueClass == null)
- valueClass = getFormattedTextField().getValue().getClass();
+ {
+ JFormattedTextField jft = getFormattedTextField();
+ if (jft != null)
+ valueClass = jft.getValue().getClass();
+ }
if (valueClass != null)
try
{
diff --git a/javax/swing/text/DefaultStyledDocument.java b/javax/swing/text/DefaultStyledDocument.java
index e774b4e07..9ce0a7805 100644
--- a/javax/swing/text/DefaultStyledDocument.java
+++ b/javax/swing/text/DefaultStyledDocument.java
@@ -367,7 +367,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
* Returns a String representation of this <code>ElementSpec</code>
* describing the type, direction and length of this
* <code>ElementSpec</code>.
- *
+ *
* @return a String representation of this <code>ElementSpec</code>
*/
public String toString()
@@ -703,7 +703,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
{
if (length == 0)
return;
-
+
this.offset = offset;
this.pos = offset;
this.endOffset = offset + length;
@@ -715,7 +715,6 @@ public class DefaultStyledDocument extends AbstractDocument implements
lastFractured = null;
fracNotCreated = false;
insertUpdate(data);
-
// This for loop applies all the changes that were made and updates the
// DocumentEvent.
int size = edits.size();
@@ -815,7 +814,9 @@ public class DefaultStyledDocument extends AbstractDocument implements
if (data.length > i + 1)
{
// leaves will be added to paragraph later
- int x = paragraph.getElementIndex(pos) + 1;
+ int x = 0;
+ if (paragraph.getElementCount() > 0)
+ x = paragraph.getElementIndex(pos) + 1;
Edit e = getEditForParagraphAndIndex(paragraph, x);
br = (BranchElement) createBranchElement(paragraph,
data[i].getAttributes());
@@ -838,7 +839,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
}
}
}
-
+
/**
* Inserts a new paragraph.
*
@@ -910,12 +911,11 @@ public class DefaultStyledDocument extends AbstractDocument implements
{
ElementSpec first = data[0];
BranchElement paragraph = (BranchElement) elementStack.peek();
- int index = paragraph.getElementIndex(offset);
+ int index = paragraph.getElementIndex(pos);
Element current = paragraph.getElement(index);
- int newEndOffset = offset + first.length;
+ int newEndOffset = pos + first.length;
boolean onlyContent = data.length == 1;
Edit edit = getEditForParagraphAndIndex(paragraph, index);
-
switch (first.getDirection())
{
case ElementSpec.JoinPreviousDirection:
@@ -931,23 +931,23 @@ public class DefaultStyledDocument extends AbstractDocument implements
}
break;
case ElementSpec.JoinNextDirection:
- if (offset != 0)
+ if (pos != 0)
{
Element newEl1 = createLeafElement(paragraph,
current.getAttributes(),
current.getStartOffset(),
- offset);
+ pos);
edit.addAddedElement(newEl1);
Element next = paragraph.getElement(index + 1);
if (onlyContent)
newEl1 = createLeafElement(paragraph, next.getAttributes(),
- offset, next.getEndOffset());
+ pos, next.getEndOffset());
else
{
newEl1 = createLeafElement(paragraph, next.getAttributes(),
- offset, newEndOffset);
- offset = newEndOffset;
+ pos, newEndOffset);
+ pos = newEndOffset;
}
edit.addAddedElement(newEl1);
edit.addRemovedElement(current);
@@ -955,26 +955,26 @@ public class DefaultStyledDocument extends AbstractDocument implements
}
break;
default:
- if (current.getStartOffset() != offset)
+ if (current.getStartOffset() != pos)
{
Element newEl = createLeafElement(paragraph,
current.getAttributes(),
current.getStartOffset(),
- offset);
+ pos);
edit.addAddedElement(newEl);
}
edit.addRemovedElement(current);
Element newEl1 = createLeafElement(paragraph, first.getAttributes(),
- offset, newEndOffset);
+ pos, newEndOffset);
edit.addAddedElement(newEl1);
if (current.getEndOffset() != endOffset)
- recreateLeaves(newEndOffset, paragraph, onlyContent);
+ recreateLeaves(newEndOffset, paragraph, onlyContent);
else
offset = newEndOffset;
break;
}
}
-
+
/**
* Inserts a content element into the document structure.
*
@@ -1068,7 +1068,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
pos += len;
}
-
+
/**
* This method fractures the child at offset.
*
@@ -1081,7 +1081,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
int index = paragraph.getElementIndex(offset);
Element child = paragraph.getElement(index);
Edit edit = getEditForParagraphAndIndex(paragraph, index);
- AttributeSet atts = data[0].getAttributes();
+ AttributeSet atts = child.getAttributes();
if (offset != 0)
{
@@ -1131,7 +1131,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
newBranch.replace(1, 0, added);
lastFractured = newLeaf;
- offset = newBranch.getEndOffset();
+ pos = newBranch.getEndOffset();
}
else
{
@@ -1231,7 +1231,6 @@ public class DefaultStyledDocument extends AbstractDocument implements
BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(),
el.getAttributes());
-
newPar.replace(0, 0, removed);
res = new Element[] { null, newPar };
}
@@ -1260,26 +1259,25 @@ public class DefaultStyledDocument extends AbstractDocument implements
{
// insert the fracture at offset.
BranchElement parent = (BranchElement) elementStack.peek();
- int parentIndex = parent.getElementIndex(offset);
+ int parentIndex = parent.getElementIndex(pos);
AttributeSet parentAtts = parent.getAttributes();
Element toFracture = parent.getElement(parentIndex);
int parSize = parent.getElementCount();
Edit edit = getEditForParagraphAndIndex(parent, parentIndex);
-
Element frac = toFracture;
int leftIns = 0;
- int indexOfFrac = toFracture.getElementIndex(offset);
+ int indexOfFrac = toFracture.getElementIndex(pos);
int size = toFracture.getElementCount();
// gets the leaf that falls along the fracture
frac = toFracture.getElement(indexOfFrac);
while (!frac.isLeaf())
- frac = frac.getElement(frac.getElementIndex(offset));
+ frac = frac.getElement(frac.getElementIndex(pos));
AttributeSet atts = frac.getAttributes();
int fracStart = frac.getStartOffset();
int fracEnd = frac.getEndOffset();
- if (offset > fracStart && offset < fracEnd)
+ if (pos >= fracStart && pos < fracEnd)
{
// recreate left-side of branch and all its children before offset
// add the fractured leaves to the right branch
@@ -1304,11 +1302,15 @@ public class DefaultStyledDocument extends AbstractDocument implements
added = new Element[] { leftBranch, rightBranch };
// add fracture to leftBranch
- Element leftFracturedLeaf = createLeafElement(leftBranch, atts,
- fracStart, offset);
- leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf });
+ if (fracStart != pos)
+ {
+ Element leftFracturedLeaf =
+ createLeafElement(leftBranch, atts, fracStart, pos);
+ leftBranch.replace(leftIns, 0,
+ new Element[] { leftFracturedLeaf });
+ }
}
-
+
if (!toFracture.isLeaf())
{
// add all non-fracture elements to the branches
@@ -1346,7 +1348,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
}
Element rightFracturedLeaf = createLeafElement(rightBranch, atts,
- offset, end);
+ pos, end);
rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf });
// recreate those elements after parentIndex and add/remove all
@@ -1628,7 +1630,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
/**
* Returns the name of the element. This method always returns
* &quot;section&quot;.
- *
+ *
* @return the name of the element
*/
public String getName()
@@ -1640,18 +1642,18 @@ public class DefaultStyledDocument extends AbstractDocument implements
/**
* Receives notification when any of the document's style changes and calls
* {@link DefaultStyledDocument#styleChanged(Style)}.
- *
+ *
* @author Roman Kennke (kennke@aicas.com)
*/
- private class StyleChangeListener
- implements ChangeListener
+ private class StyleChangeListener implements ChangeListener
{
/**
* Receives notification when any of the document's style changes and calls
* {@link DefaultStyledDocument#styleChanged(Style)}.
- *
- * @param event the change event
+ *
+ * @param event
+ * the change event
*/
public void stateChanged(ChangeEvent event)
{
@@ -1751,7 +1753,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
/**
* Create the default root element for this kind of <code>Document</code>.
- *
+ *
* @return the default root element for this kind of <code>Document</code>
*/
protected AbstractDocument.AbstractElement createDefaultRoot()
@@ -1759,13 +1761,12 @@ public class DefaultStyledDocument extends AbstractDocument implements
Element[] tmp;
SectionElement section = new SectionElement();
- BranchElement paragraph =
- (BranchElement) createBranchElement(section, null);
+ BranchElement paragraph = new BranchElement(section, null);
tmp = new Element[1];
tmp[0] = paragraph;
section.replace(0, 0, tmp);
- Element leaf = createLeafElement(paragraph, null, 0, 1);
+ Element leaf = new LeafElement(paragraph, null, 0, 1);
tmp = new Element[1];
tmp[0] = leaf;
paragraph.replace(0, 0, tmp);
@@ -2173,7 +2174,7 @@ public class DefaultStyledDocument extends AbstractDocument implements
// If we are inserting after a newline then this value comes from
// handleInsertAfterNewline.
if (finalStartTag != null)
- {
+ {
if (prevCharWasNewline)
finalStartTag.setDirection(finalStartDirection);
else if (prevParagraph.getEndOffset() != endOffset)
@@ -2189,19 +2190,18 @@ public class DefaultStyledDocument extends AbstractDocument implements
finalStartTag.setDirection(ElementSpec.JoinNextDirection);
}
}
-
+
// If we are at the last index, then check if we could probably be
// joined with the next element.
// This means:
- // - we must be a ContentTag
- // - if there is a next Element, we must have the same attributes
- // - if there is no next Element, but one will be created,
- // we must have the same attributes as the higher-level run.
+ // - we must be a ContentTag
+ // - if there is a next Element, we must have the same attributes
+ // - if there is no next Element, but one will be created,
+ // we must have the same attributes as the higher-level run.
ElementSpec last = (ElementSpec) specs.lastElement();
if (last.getType() == ElementSpec.ContentType)
{
- Element currentRun =
- prevParagraph.getElement(prevParagraph.getElementIndex(offset));
+ Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset));
if (currentRun.getEndOffset() == endOffset)
{
if (endOffset < getLength() && next.getAttributes().isEqual(attr)
@@ -2211,43 +2211,41 @@ public class DefaultStyledDocument extends AbstractDocument implements
else
{
if (finalStartTag != null
- && finalStartTag.getDirection() ==
- ElementSpec.JoinFractureDirection
+ && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection
&& currentRun.getAttributes().isEqual(attr))
{
last.setDirection(ElementSpec.JoinNextDirection);
}
}
}
-
+
// If we are at the first new element, then check if it could be
// joined with the previous element.
ElementSpec first = (ElementSpec) specs.firstElement();
if (prev.getAttributes().isEqual(attr)
&& first.getType() == ElementSpec.ContentType)
first.setDirection(ElementSpec.JoinPreviousDirection);
-
- ElementSpec[] elSpecs =
- (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]);
+ ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]);
buffer.insert(offset, length, elSpecs, ev);
}
/**
- * A helper method to set up the ElementSpec buffer for the special
- * case of an insertion occurring immediately after a newline.
- *
- * @param specs the ElementSpec buffer to initialize.
+ * A helper method to set up the ElementSpec buffer for the special case of an
+ * insertion occurring immediately after a newline.
+ *
+ * @param specs
+ * the ElementSpec buffer to initialize.
*/
short handleInsertAfterNewline(Vector specs, int offset, int endOffset,
- Element prevParagraph, Element paragraph,
- AttributeSet a)
+ Element prevParagraph, Element paragraph,
+ AttributeSet a)
{
if (prevParagraph.getParentElement() == paragraph.getParentElement())
{
specs.add(new ElementSpec(a, ElementSpec.EndTagType));
specs.add(new ElementSpec(a, ElementSpec.StartTagType));
- if (prevParagraph.getEndOffset() != endOffset)
+ if (paragraph.getStartOffset() != endOffset)
return ElementSpec.JoinFractureDirection;
// If there is an Element after this one, use JoinNextDirection.
Element parent = paragraph.getParentElement();
@@ -2285,8 +2283,9 @@ public class DefaultStyledDocument extends AbstractDocument implements
/**
* Called when any of this document's styles changes.
- *
- * @param style the style that changed
+ *
+ * @param style
+ * the style that changed
*/
protected void styleChanged(Style style)
{
@@ -2295,22 +2294,24 @@ public class DefaultStyledDocument extends AbstractDocument implements
/**
* Inserts a bulk of structured content at once.
- *
- * @param offset the offset at which the content should be inserted
- * @param data the actual content spec to be inserted
+ *
+ * @param offset
+ * the offset at which the content should be inserted
+ * @param data
+ * the actual content spec to be inserted
*/
protected void insert(int offset, ElementSpec[] data)
- throws BadLocationException
+ throws BadLocationException
{
if (data == null || data.length == 0)
return;
try
{
// writeLock() and writeUnlock() should always be in a try/finally
- // block so that locking balance is guaranteed even if some
+ // block so that locking balance is guaranteed even if some
// exception is thrown.
writeLock();
-
+
// First we collect the content to be inserted.
StringBuffer contentBuffer = new StringBuffer();
for (int i = 0; i < data.length; i++)
@@ -2328,15 +2329,14 @@ public class DefaultStyledDocument extends AbstractDocument implements
// If there was no content inserted then exit early.
if (length == 0)
return;
-
+
UndoableEdit edit = content.insertString(offset,
contentBuffer.toString());
// Create the DocumentEvent with the ElementEdit added
- DefaultDocumentEvent ev =
- new DefaultDocumentEvent(offset,
- length,
- DocumentEvent.EventType.INSERT);
+ DefaultDocumentEvent ev = new DefaultDocumentEvent(offset,
+ length,
+ DocumentEvent.EventType.INSERT);
ev.addEdit(edit);
// Finally we must update the document structure and fire the insert
diff --git a/javax/swing/text/FlowView.java b/javax/swing/text/FlowView.java
index 219ab8ebe..8be8f41e9 100644
--- a/javax/swing/text/FlowView.java
+++ b/javax/swing/text/FlowView.java
@@ -127,7 +127,7 @@ public abstract class FlowView extends BoxView
*
* @return the logical view of the managed <code>FlowView</code>
*/
- public View getLogicalView(FlowView fv)
+ protected View getLogicalView(FlowView fv)
{
return fv.layoutPool;
}
@@ -210,7 +210,10 @@ public abstract class FlowView extends BoxView
int flowSpan = fv.getFlowSpan(axis);
adjustRow(fv, rowIndex, flowSpan, flowStart);
int rowViewCount = row.getViewCount();
- offset = row.getView(rowViewCount - 1).getEndOffset();
+ if (rowViewCount > 0)
+ offset = row.getView(rowViewCount - 1).getEndOffset();
+ else
+ offset = -1;
}
return offset != pos ? offset : -1;
}
diff --git a/javax/swing/text/GapContent.java b/javax/swing/text/GapContent.java
index fb67ebd2a..f5ab7f2b2 100644
--- a/javax/swing/text/GapContent.java
+++ b/javax/swing/text/GapContent.java
@@ -607,7 +607,7 @@ public class GapContent
*
* @return the allocated buffer array
*/
- protected Object getArray()
+ protected final Object getArray()
{
return buffer;
}
diff --git a/javax/swing/text/JTextComponent.java b/javax/swing/text/JTextComponent.java
index b23c53413..6b8348cea 100644
--- a/javax/swing/text/JTextComponent.java
+++ b/javax/swing/text/JTextComponent.java
@@ -1614,7 +1614,7 @@ public abstract class JTextComponent extends JComponent
public boolean getScrollableTracksViewportHeight()
{
if (getParent() instanceof JViewport)
- return ((JViewport) getParent()).getHeight() > getPreferredSize().height;
+ return getParent().getHeight() > getPreferredSize().height;
return false;
}
@@ -1622,7 +1622,7 @@ public abstract class JTextComponent extends JComponent
public boolean getScrollableTracksViewportWidth()
{
if (getParent() instanceof JViewport)
- return ((JViewport) getParent()).getWidth() > getPreferredSize().width;
+ return getParent().getWidth() > getPreferredSize().width;
return false;
}
diff --git a/javax/swing/text/PlainView.java b/javax/swing/text/PlainView.java
index 2eec7af54..4bb3a8eda 100644
--- a/javax/swing/text/PlainView.java
+++ b/javax/swing/text/PlainView.java
@@ -46,6 +46,7 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
+import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentEvent.ElementChange;
@@ -570,7 +571,9 @@ public class PlainView extends View implements TabExpander
host.repaint();
else
{
- Rectangle repaintRec = rec0.union(rec1);
+ Rectangle repaintRec = SwingUtilities.computeUnion(rec0.x, rec0.y,
+ rec0.width,
+ rec0.height, rec1);
host.repaint(repaintRec.x, repaintRec.y, repaintRec.width,
repaintRec.height);
}
diff --git a/javax/swing/text/Segment.java b/javax/swing/text/Segment.java
index 6ae291bd1..875d9966c 100644
--- a/javax/swing/text/Segment.java
+++ b/javax/swing/text/Segment.java
@@ -243,7 +243,9 @@ public class Segment implements Cloneable, CharacterIterator
{
if (position < getBeginIndex()
|| position > getEndIndex())
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("position: " + position
+ + ", beginIndex: " + getBeginIndex()
+ + ", endIndex: " + getEndIndex());
current = position;
diff --git a/javax/swing/text/StyleConstants.java b/javax/swing/text/StyleConstants.java
index bd870ad70..c7906b8ad 100644
--- a/javax/swing/text/StyleConstants.java
+++ b/javax/swing/text/StyleConstants.java
@@ -877,7 +877,8 @@ public class StyleConstants
*
* @see #getTabSet(AttributeSet)
*/
- public static void setTabSet(MutableAttributeSet a, javax.swing.text.TabSet tabs)
+ public static void setTabSet(MutableAttributeSet a,
+ javax.swing.text.TabSet tabs)
{
a.addAttribute(StyleConstants.TabSet, tabs);
}
@@ -918,43 +919,46 @@ public class StyleConstants
}
/** An alias for {@link ColorConstants#Background}. */
- public static Object Background = ColorConstants.Background;
+ public static final Object Background = ColorConstants.Background;
/** A key for the bidi level character attribute. */
- public static Object BidiLevel = new CharacterConstants("bidiLevel");
+ public static final Object BidiLevel = new CharacterConstants("bidiLevel");
/** An alias for {@link FontConstants#Bold}. */
- public static Object Bold = FontConstants.Bold;
+ public static final Object Bold = FontConstants.Bold;
/** A key for the component character attribute. */
- public static Object ComponentAttribute = new CharacterConstants("component");
+ public static final Object ComponentAttribute
+ = new CharacterConstants("component");
/** An alias for {@link FontConstants#Family}. */
- public static Object Family = FontConstants.Family;
+ public static final Object Family = FontConstants.Family;
/** An alias for {@link FontConstants#Size}. */
- public static Object Size = FontConstants.Size;
+ public static final Object Size = FontConstants.Size;
/** An alias for {@link ColorConstants#Foreground}. */
- public static Object Foreground = ColorConstants.Foreground;
+ public static final Object Foreground = ColorConstants.Foreground;
/** A key for the icon character attribute. */
- public static Object IconAttribute = new CharacterConstants("icon");
+ public static final Object IconAttribute = new CharacterConstants("icon");
/** A key for the italic character attribute. */
- public static Object Italic = FontConstants.Italic;
+ public static final Object Italic = FontConstants.Italic;
/** A key for the strike through character attribute. */
- public static Object StrikeThrough = new CharacterConstants("strikethrough");
+ public static final Object StrikeThrough
+ = new CharacterConstants("strikethrough");
/** A key for the subscript character attribute. */
- public static Object Subscript = new CharacterConstants("subscript");
+ public static final Object Subscript = new CharacterConstants("subscript");
/** A key for the superscript character attribute. */
- public static Object Superscript = new CharacterConstants("superscript");
+ public static final Object Superscript
+ = new CharacterConstants("superscript");
/** A key for the underline character attribute. */
- public static Object Underline = new CharacterConstants("underline");
+ public static final Object Underline = new CharacterConstants("underline");
}
@@ -976,10 +980,10 @@ public class StyleConstants
}
/** A key for the foreground color attribute. */
- public static Object Foreground = new ColorConstants("foreground");
+ public static final Object Foreground = new ColorConstants("foreground");
/** A key for the background color attribute. */
- public static Object Background = new ColorConstants("background");
+ public static final Object Background = new ColorConstants("background");
}
/**
@@ -1000,16 +1004,16 @@ public class StyleConstants
}
/** A key for the bold font attribute. */
- public static Object Bold = new FontConstants("bold");
+ public static final Object Bold = new FontConstants("bold");
/** A key for the family font attribute. */
- public static Object Family = new FontConstants("family");
+ public static final Object Family = new FontConstants("family");
/** A key for the italic font attribute. */
- public static Object Italic = new FontConstants("italic");
+ public static final Object Italic = new FontConstants("italic");
/** A key for the size font attribute. */
- public static Object Size = new FontConstants("size");
+ public static final Object Size = new FontConstants("size");
}
/**
@@ -1030,32 +1034,38 @@ public class StyleConstants
}
/** A key for the alignment paragraph attribute. */
- public static Object Alignment = new ParagraphConstants("Alignment");
+ public static final Object Alignment = new ParagraphConstants("Alignment");
/** A key for the first line indentation paragraph attribute. */
- public static Object FirstLineIndent
+ public static final Object FirstLineIndent
= new ParagraphConstants("FirstLineIndent");
/** A key for the left indentation paragraph attribute. */
- public static Object LeftIndent = new ParagraphConstants("LeftIndent");
+ public static final Object LeftIndent
+ = new ParagraphConstants("LeftIndent");
/** A key for the line spacing paragraph attribute. */
- public static Object LineSpacing = new ParagraphConstants("LineSpacing");
+ public static final Object LineSpacing
+ = new ParagraphConstants("LineSpacing");
/** A key for the orientation paragraph attribute. */
- public static Object Orientation = new ParagraphConstants("Orientation");
+ public static final Object Orientation
+ = new ParagraphConstants("Orientation");
/** A key for the right indentation paragraph attribute. */
- public static Object RightIndent = new ParagraphConstants("RightIndent");
+ public static final Object RightIndent
+ = new ParagraphConstants("RightIndent");
/** A key for the 'space above' paragraph attribute. */
- public static Object SpaceAbove = new ParagraphConstants("SpaceAbove");
+ public static final Object SpaceAbove
+ = new ParagraphConstants("SpaceAbove");
/** A key for the 'space below' paragraph attribute. */
- public static Object SpaceBelow = new ParagraphConstants("SpaceBelow");
+ public static final Object SpaceBelow
+ = new ParagraphConstants("SpaceBelow");
/** A key for the tabset paragraph attribute. */
- public static Object TabSet = new ParagraphConstants("TabSet");
+ public static final Object TabSet = new ParagraphConstants("TabSet");
}
diff --git a/javax/swing/text/TableView.java b/javax/swing/text/TableView.java
index d3113b82b..2dcb9ebf7 100644
--- a/javax/swing/text/TableView.java
+++ b/javax/swing/text/TableView.java
@@ -54,7 +54,7 @@ import javax.swing.event.DocumentEvent;
*
* @author Roman Kennke (kennke@aicas.com)
*/
-public class TableView
+public abstract class TableView
extends BoxView
{
@@ -90,6 +90,18 @@ public class TableView
public void replace(int offset, int length, View[] views)
{
super.replace(offset, length, views);
+ int viewCount = getViewCount();
+ if (columnRequirements == null
+ || viewCount > columnRequirements.length)
+ {
+ columnRequirements = new SizeRequirements[viewCount];
+ for (int i = 0; i < columnRequirements.length; i++)
+ columnRequirements[i] = new SizeRequirements();
+ }
+ if (columnOffsets == null || columnOffsets.length < viewCount)
+ columnOffsets = new int[viewCount];
+ if (columnSpans == null || columnSpans.length < viewCount)
+ columnSpans = new int[viewCount];
layoutChanged(X_AXIS);
}
@@ -108,8 +120,6 @@ public class TableView
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,
int[] spans)
{
- // TODO: Maybe prepare columnSpans and columnOffsets.
-
// Some sanity checks. If these preconditions are not met, then the
// following code will not work. Also, there must be something
// seriously wrong then.
@@ -140,7 +150,7 @@ public class TableView
{
// FIXME: Figure out how to fetch the row heights from the TableView's
// element.
- super.layoutMajorAxis(targetSpan, axis, offsets, spans);
+ super.layoutMinorAxis(targetSpan, axis, offsets, spans);
}
/**
@@ -303,7 +313,7 @@ public class TableView
/**
* The size requirements of the columns.
*/
- private SizeRequirements[] columnRequirements;
+ SizeRequirements[] columnRequirements = new SizeRequirements[0];
/**
* Creates a new instance of <code>TableView</code>.
@@ -313,15 +323,6 @@ public class TableView
public TableView(Element el)
{
super(el, Y_AXIS);
- int numChildren = el.getElementCount();
- View[] rows = new View[numChildren];
- for (int i = 0; i < numChildren; ++i)
- {
- Element rowEl = el.getElement(i);
- TableRow rowView = createTableRow(rowEl);
- rows[i] = rowView;
- }
- replace(0, 0, rows);
}
/**
@@ -385,7 +386,10 @@ public class TableView
protected void layoutColumns(int targetSpan, int[] offsets, int spans[],
SizeRequirements[] reqs)
{
- // TODO: Figure out what exactly to do here.
+ updateColumnRequirements();
+ SizeRequirements r = calculateMinorAxisRequirements(X_AXIS, null);
+ SizeRequirements.calculateTiledPositions(targetSpan, r, columnRequirements,
+ offsets, spans);
}
/**
@@ -462,4 +466,26 @@ public class TableView
// and look for a range that contains the given position.
return super.getViewAtPosition(pos, a);
}
+
+ /**
+ * Updates the column requirements.
+ */
+ private void updateColumnRequirements()
+ {
+ int rowCount = getViewCount();
+ for (int r = 0; r < rowCount; ++r)
+ {
+ TableRow row = (TableRow) getView(r);
+ int columnCount = row.getViewCount();
+ for (int c = 0; c < columnCount; ++c)
+ {
+ View cell = row.getView(c);
+ SizeRequirements cr = columnRequirements[c];
+ cr.minimum = Math.max(cr.minimum, (int) cell.getMinimumSpan(X_AXIS));
+ cr.preferred = Math.max(cr.preferred,
+ (int) cell.getPreferredSpan(X_AXIS));
+ cr.maximum = Math.max(cr.maximum, (int) cell.getMaximumSpan(X_AXIS));
+ }
+ }
+ }
}
diff --git a/javax/swing/text/Utilities.java b/javax/swing/text/Utilities.java
index e3437d33c..d109a4a95 100644
--- a/javax/swing/text/Utilities.java
+++ b/javax/swing/text/Utilities.java
@@ -515,7 +515,7 @@ public class Utilities
breaker.setText(s);
// If mark is equal to the end of the string, just use that position
- if (mark == s.count)
+ if (mark == s.count + s.offset)
return mark;
// Try to find a word boundary previous to the mark at which we
diff --git a/javax/swing/text/View.java b/javax/swing/text/View.java
index b4bdeb4de..2feaf29a4 100644
--- a/javax/swing/text/View.java
+++ b/javax/swing/text/View.java
@@ -40,9 +40,11 @@ package javax.swing.text;
import java.awt.Container;
import java.awt.Graphics;
+import java.awt.Rectangle;
import java.awt.Shape;
import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
public abstract class View implements SwingConstants
@@ -493,8 +495,7 @@ public abstract class View implements SwingConstants
{
int startOffset = ev.getOffset();
int endOffset = startOffset + ev.getLength();
- // FIXME: What about this bias stuff?
- int startIndex = getViewIndex(startOffset, Position.Bias.Forward);
+ int startIndex = getViewIndex(startOffset, Position.Bias.Backward);
int endIndex = getViewIndex(endOffset, Position.Bias.Forward);
int index = -1;
int addLength = -1;
@@ -610,9 +611,9 @@ public abstract class View implements SwingConstants
if (b2 != Position.Bias.Forward && b2 != Position.Bias.Backward)
throw new IllegalArgumentException
("b2 must be either Position.Bias.Forward or Position.Bias.Backward");
- Shape s1 = modelToView(p1, a, b1);
- Shape s2 = modelToView(p2, a, b2);
- return s1.getBounds().union(s2.getBounds());
+ Rectangle s1 = (Rectangle) modelToView(p1, a, b1);
+ Rectangle s2 = (Rectangle) modelToView(p2, a, b2);
+ return SwingUtilities.computeUnion(s1.x, s1.y, s1.width, s1.height, s2);
}
/**
@@ -677,7 +678,7 @@ public abstract class View implements SwingConstants
* Dumps the complete View hierarchy. This method can be used for debugging
* purposes.
*/
- void dump()
+ protected void dump()
{
// Climb up the hierarchy to the parent.
View parent = getParent();
@@ -697,7 +698,7 @@ public abstract class View implements SwingConstants
{
for (int i = 0; i < indent; ++i)
System.out.print('.');
- System.out.println(this);
+ System.out.println(this + "(" + getStartOffset() + "," + getEndOffset() + ": " + getElement());
int count = getViewCount();
for (int i = 0; i < count; ++i)
diff --git a/javax/swing/text/html/HTMLDocument.java b/javax/swing/text/html/HTMLDocument.java
index 92c9ccc79..97c51e06c 100644
--- a/javax/swing/text/html/HTMLDocument.java
+++ b/javax/swing/text/html/HTMLDocument.java
@@ -136,7 +136,7 @@ public class HTMLDocument extends DefaultStyledDocument
*
* @param data - the date that replaces the content of the document
*/
- protected void create(ElementSpec[] data)
+ protected void create(DefaultStyledDocument.ElementSpec[] data)
{
// Once the super behaviour is properly implemented it should be sufficient
// to simply call super.create(data).
@@ -563,7 +563,13 @@ public class HTMLDocument extends DefaultStyledDocument
/** A stack for character attribute sets **/
Stack charAttrStack = new Stack();
-
+
+ /**
+ * The parse stack. This stack holds HTML.Tag objects that reflect the
+ * current position in the parsing process.
+ */
+ private Stack parseStack = new Stack();
+
/** A mapping between HTML.Tag objects and the actions that handle them **/
HashMap tagToAction;
@@ -1286,6 +1292,18 @@ public class HTMLDocument extends DefaultStyledDocument
{
printBuffer();
DefaultStyledDocument.ElementSpec element;
+
+ // If the previous tag is content and the parent is p-implied, then
+ // we must also close the p-implied.
+ if (parseStack.size() > 0 && parseStack.peek() == HTML.Tag.IMPLIED)
+ {
+ element = new DefaultStyledDocument.ElementSpec(null,
+ DefaultStyledDocument.ElementSpec.EndTagType);
+ parseBuffer.addElement(element);
+ parseStack.pop();
+ }
+
+ parseStack.push(t);
AbstractDocument.AttributeContext ctx = getAttributeContext();
AttributeSet copy = attr.copyAttributes();
copy = ctx.addAttribute(copy, StyleConstants.NameAttribute, t);
@@ -1305,10 +1323,40 @@ public class HTMLDocument extends DefaultStyledDocument
{
printBuffer();
DefaultStyledDocument.ElementSpec element;
+
+ // If the previous tag is a start tag then we insert a synthetic
+ // content tag.
+ DefaultStyledDocument.ElementSpec prev;
+ prev = (DefaultStyledDocument.ElementSpec)
+ parseBuffer.get(parseBuffer.size() - 1);
+ if (prev.getType() == DefaultStyledDocument.ElementSpec.StartTagType)
+ {
+ AbstractDocument.AttributeContext ctx = getAttributeContext();
+ AttributeSet attributes = ctx.getEmptySet();
+ attributes = ctx.addAttribute(attributes, StyleConstants.NameAttribute,
+ HTML.Tag.CONTENT);
+ element = new DefaultStyledDocument.ElementSpec(attributes,
+ DefaultStyledDocument.ElementSpec.ContentType,
+ new char[0], 0, 0);
+ parseBuffer.add(element);
+ }
+ // If the previous tag is content and the parent is p-implied, then
+ // we must also close the p-implied.
+ else if (parseStack.peek() == HTML.Tag.IMPLIED)
+ {
+ element = new DefaultStyledDocument.ElementSpec(null,
+ DefaultStyledDocument.ElementSpec.EndTagType);
+ parseBuffer.addElement(element);
+ if (parseStack.size() > 0)
+ parseStack.pop();
+ }
+
element = new DefaultStyledDocument.ElementSpec(null,
DefaultStyledDocument.ElementSpec.EndTagType);
parseBuffer.addElement(element);
printBuffer();
+ if (parseStack.size() > 0)
+ parseStack.pop();
}
/**
@@ -1337,17 +1385,39 @@ public class HTMLDocument extends DefaultStyledDocument
protected void addContent(char[] data, int offs, int length,
boolean generateImpliedPIfNecessary)
{
- // Copy the attribute set, don't use the same object because
- // it may change
AbstractDocument.AttributeContext ctx = getAttributeContext();
+ DefaultStyledDocument.ElementSpec element;
AttributeSet attributes = null;
+
+ // Content must always be embedded inside a paragraph element,
+ // so we create this if the previous element is not one of
+ // <p>, <h1> .. <h6>.
+ boolean createImpliedParagraph = false;
+ HTML.Tag parent = (HTML.Tag) parseStack.peek();
+ if (parent != HTML.Tag.P && parent != HTML.Tag.H1
+ && parent != HTML.Tag.H2
+ && parent != HTML.Tag.H3 && parent != HTML.Tag.H4
+ && parent != HTML.Tag.H5 && parent != HTML.Tag.H6
+ && parent != HTML.Tag.TD)
+ {
+ attributes = ctx.getEmptySet();
+ attributes = ctx.addAttribute(attributes,
+ StyleConstants.NameAttribute,
+ HTML.Tag.IMPLIED);
+ element = new DefaultStyledDocument.ElementSpec(attributes,
+ DefaultStyledDocument.ElementSpec.StartTagType);
+ parseBuffer.add(element);
+ parseStack.push(HTML.Tag.IMPLIED);
+ }
+
+ // Copy the attribute set, don't use the same object because
+ // it may change
if (charAttr != null)
attributes = charAttr.copyAttributes();
else
attributes = ctx.getEmptySet();
attributes = ctx.addAttribute(attributes, StyleConstants.NameAttribute,
HTML.Tag.CONTENT);
- DefaultStyledDocument.ElementSpec element;
element = new DefaultStyledDocument.ElementSpec(attributes,
DefaultStyledDocument.ElementSpec.ContentType,
data, offs, length);
diff --git a/javax/swing/text/html/HTMLEditorKit.java b/javax/swing/text/html/HTMLEditorKit.java
index 93e635525..629a3c6ec 100644
--- a/javax/swing/text/html/HTMLEditorKit.java
+++ b/javax/swing/text/html/HTMLEditorKit.java
@@ -551,6 +551,10 @@ public class HTMLEditorKit
view = new InlineView(element);
else if (tag == HTML.Tag.HEAD)
view = new NullView(element);
+ else if (tag.equals(HTML.Tag.TABLE))
+ view = new HTMLTableView(element);
+ else if (tag.equals(HTML.Tag.TD))
+ view = new ParagraphView(element);
/*
else if (tag.equals(HTML.Tag.MENU) || tag.equals(HTML.Tag.DIR)
@@ -562,8 +566,6 @@ public class HTMLEditorKit
view = new HRuleView(element);
else if (tag.equals(HTML.Tag.BR))
view = new BRView(element);
- else if (tag.equals(HTML.Tag.TABLE))
- view = new TableView(element);
else if (tag.equals(HTML.Tag.INPUT) || tag.equals(HTML.Tag.SELECT)
|| tag.equals(HTML.Tag.TEXTAREA))
view = new FormView(element);
@@ -573,7 +575,12 @@ public class HTMLEditorKit
view = new FrameSetView(element);
else if (tag.equals(HTML.Tag.FRAME))
view = new FrameView(element); */
- }
+ }
+ if (view == null)
+ {
+ System.err.println("missing tag->view mapping for: " + element);
+ view = new NullView(element);
+ }
return view;
}
}
@@ -941,7 +948,8 @@ public class HTMLEditorKit
throw new IOException("Parser is null.");
HTMLDocument hd = ((HTMLDocument) doc);
- hd.setBase(editorPane.getPage());
+ if (editorPane != null)
+ hd.setBase(editorPane.getPage());
ParserCallback pc = hd.getReader(pos);
// FIXME: What should ignoreCharSet be set to?
diff --git a/javax/xml/stream/XMLIterator.java b/javax/swing/text/html/HTMLTableView.java
index e12bffafd..cac44d8dc 100644
--- a/javax/xml/stream/XMLIterator.java
+++ b/javax/swing/text/html/HTMLTableView.java
@@ -1,5 +1,5 @@
-/* XMLIterator.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+/* HTMLTableView.java -- A table view for HTML tables
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,27 +35,48 @@ 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 javax.xml.stream;
-import javax.xml.stream.events.XMLEvent;
+package javax.swing.text.html;
+
+import javax.swing.text.Element;
+import javax.swing.text.TableView;
+import javax.swing.text.View;
+import javax.swing.text.ViewFactory;
/**
- * Simple iterator for XML events.
+ * A conrete implementation of TableView that renders HTML tables.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
*/
-public interface XMLIterator
+class HTMLTableView
+ extends TableView
{
/**
- * Returns the next XML event.
+ * Creates a new HTMLTableView for the specified element.
+ *
+ * @param el the element for the table view
*/
- XMLEvent next()
- throws XMLStreamException;
+ public HTMLTableView(Element el)
+ {
+ super(el);
+ }
/**
- * Indicates whether there are more XML events to be read.
+ * Loads the children of the Table. This completely bypasses the ViewFactory
+ * and creates instances of TableRow instead.
+ *
+ * @param vf ignored
*/
- boolean hasNext()
- throws XMLStreamException;
-
+ protected void loadChildren(ViewFactory vf)
+ {
+ Element el = getElement();
+ int numChildren = el.getElementCount();
+ View[] rows = new View[numChildren];
+ for (int i = 0; i < numChildren; ++i)
+ {
+ rows[i] = createTableRow(el.getElement(i));
+ }
+ replace(0, getViewCount(), rows);
+ }
}
-
diff --git a/javax/swing/text/package.html b/javax/swing/text/package.html
index 50043b6c4..5db555d88 100644
--- a/javax/swing/text/package.html
+++ b/javax/swing/text/package.html
@@ -40,7 +40,7 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.swing.text</title></head>
<body>
-<p></p>
-
+<p>Provides core text classes and interfaces representing models and views
+used by the text components for display and editing of text.</p>
</body>
</html>
diff --git a/javax/xml/stream/EventFilter.java b/javax/xml/stream/EventFilter.java
index 288c7411d..6d0cb6552 100644
--- a/javax/xml/stream/EventFilter.java
+++ b/javax/xml/stream/EventFilter.java
@@ -1,5 +1,5 @@
/* EventFilter.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,6 @@ import javax.xml.stream.events.XMLEvent;
* Simple filter interface for XML events.
*/
public interface EventFilter
- extends XMLFilter
{
/**
diff --git a/javax/xml/stream/Location.java b/javax/xml/stream/Location.java
index d043ba254..8f9f807e0 100644
--- a/javax/xml/stream/Location.java
+++ b/javax/xml/stream/Location.java
@@ -63,9 +63,14 @@ public interface Location
int getCharacterOffset();
/**
+ * Returns the public identifier for this location, if any.
+ */
+ String getPublicId();
+
+ /**
* Returns the system identifier for the underlying source.
*/
- String getLocationURI();
+ String getSystemId();
}
diff --git a/javax/xml/stream/StreamFilter.java b/javax/xml/stream/StreamFilter.java
index 77fbfc7f5..376bd940a 100644
--- a/javax/xml/stream/StreamFilter.java
+++ b/javax/xml/stream/StreamFilter.java
@@ -1,5 +1,5 @@
/* StreamFilter.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,6 @@ package javax.xml.stream;
* Simple filter interface for XMLStreamReaders.
*/
public interface StreamFilter
- extends XMLFilter
{
/**
diff --git a/javax/xml/stream/XMLEventFactory.java b/javax/xml/stream/XMLEventFactory.java
index 456414d61..ee47af2a9 100644
--- a/javax/xml/stream/XMLEventFactory.java
+++ b/javax/xml/stream/XMLEventFactory.java
@@ -1,5 +1,5 @@
/* XMLEventFactory.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -320,10 +320,8 @@ public abstract class XMLEventFactory
/**
* Create an entity reference event.
*/
- //public abstract EntityReference createEntityReference(String name,
- // EntityDeclaration declaration);
public abstract EntityReference createEntityReference(String name,
- String replacementText);
+ EntityDeclaration declaration);
/**
* Create a comment event.
diff --git a/javax/xml/stream/XMLEventReader.java b/javax/xml/stream/XMLEventReader.java
index 5d4c17000..35ad5696e 100644
--- a/javax/xml/stream/XMLEventReader.java
+++ b/javax/xml/stream/XMLEventReader.java
@@ -1,5 +1,5 @@
/* XMLEventReader.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,10 +44,21 @@ import javax.xml.stream.events.XMLEvent;
* An XML parser.
*/
public interface XMLEventReader
- extends XMLIterator
+ extends Iterator
{
/**
+ * Returns the next XML event.
+ */
+ XMLEvent nextEvent()
+ throws XMLStreamException;
+
+ /**
+ * Indicates whether there are more XML events to be read.
+ */
+ boolean hasNext();
+
+ /**
* Looks at the next XML event without advancing the cursor in the stream.
* Returns <code>null</code> if there are no more events to read.
*/
@@ -80,5 +91,12 @@ public interface XMLEventReader
Object getProperty(String name)
throws IllegalArgumentException;
+ /**
+ * Free any resources associated with this parser.
+ * This method will not close the underlying input source.
+ */
+ void close()
+ throws XMLStreamException;
+
}
diff --git a/javax/xml/stream/XMLEventWriter.java b/javax/xml/stream/XMLEventWriter.java
index 60b18f977..fe85f236e 100644
--- a/javax/xml/stream/XMLEventWriter.java
+++ b/javax/xml/stream/XMLEventWriter.java
@@ -1,5 +1,5 @@
/* XMLEventWriter.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/javax/xml/stream/XMLFilter.java b/javax/xml/stream/XMLFilter.java
deleted file mode 100644
index 7e7698df1..000000000
--- a/javax/xml/stream/XMLFilter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* XMLFilter.java --
- Copyright (C) 2005 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 javax.xml.stream;
-
-/**
- * Marker interface for stream and event filters.
- */
-public interface XMLFilter
-{
-}
-
diff --git a/javax/xml/stream/XMLInputFactory.java b/javax/xml/stream/XMLInputFactory.java
index 4c904a62f..4dfd1203a 100644
--- a/javax/xml/stream/XMLInputFactory.java
+++ b/javax/xml/stream/XMLInputFactory.java
@@ -1,5 +1,5 @@
/* XMLInputFactory.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -324,17 +324,17 @@ public abstract class XMLInputFactory
/**
* Creates a new stream reader.
- *
+ */
public abstract XMLStreamReader createXMLStreamReader(String systemId,
InputStream stream)
- throws XMLStreamException;*/
+ throws XMLStreamException;
/**
* Creates a new stream reader.
- *
+ */
public abstract XMLStreamReader createXMLStreamReader(String systemId,
Reader reader)
- throws XMLStreamException;*/
+ throws XMLStreamException;
/**
* Creates a new event reader.
@@ -344,10 +344,10 @@ public abstract class XMLInputFactory
/**
* Creates a new event reader.
- *
+ */
public abstract XMLEventReader createXMLEventReader(String systemId,
Reader reader)
- throws XMLStreamException;*/
+ throws XMLStreamException;
/**
* Creates a new event reader.
@@ -376,10 +376,10 @@ public abstract class XMLInputFactory
/**
* Creates a new event reader.
- *
+ */
public abstract XMLEventReader createXMLEventReader(String systemId,
InputStream stream)
- throws XMLStreamException;*/
+ throws XMLStreamException;
/**
* Create a new filtered reader.
@@ -444,15 +444,5 @@ public abstract class XMLInputFactory
*/
public abstract XMLEventAllocator getEventAllocator();
- /**
- * Sets whether text will be coalesced.
- */
- public abstract void setCoalescing(boolean coalescing);
-
- /**
- * Indicates whether text will be coalesced.
- */
- public abstract boolean isCoalescing();
-
}
diff --git a/javax/xml/stream/XMLOutputFactory.java b/javax/xml/stream/XMLOutputFactory.java
index cf31f02a5..e4c9dd40d 100644
--- a/javax/xml/stream/XMLOutputFactory.java
+++ b/javax/xml/stream/XMLOutputFactory.java
@@ -1,5 +1,5 @@
/* XMLOutputFactory.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Properties;
-//import javax.xml.transform.Result;
+import javax.xml.transform.Result;
/**
* Factory for obtaining XML stream and event writers for various kinds of
@@ -77,8 +77,8 @@ public abstract class XMLOutputFactory
* If true, the writer will create a namespace declaration for any
* attribute that doesn't have a namespace declaration in scope.
*/
- public static final java.lang.String IS_PREFIX_DEFAULTING =
- "javax.xml.stream.isPrefixDefaulting";
+ public static final java.lang.String IS_REPAIRING_NAMESPACES =
+ "javax.xml.stream.isRepairingNamespaces";
protected XMLOutputFactory()
{
@@ -219,16 +219,16 @@ public abstract class XMLOutputFactory
* @exception UnsupportedOperationException if this method is not
* supported
*/
- //public abstract XMLStreamWriter createXMLStreamWriter(Result result)
- // throws XMLStreamException;
+ public abstract XMLStreamWriter createXMLStreamWriter(Result result)
+ throws XMLStreamException;
/**
* Creates a new event writer.
* @exception UnsupportedOperationException if this method is not
* supported
*/
- //public abstract XMLEventWriter createXMLEventWriter(Result result)
- // throws XMLStreamException;
+ public abstract XMLEventWriter createXMLEventWriter(Result result)
+ throws XMLStreamException;
/**
* Creates a new event writer.
@@ -264,23 +264,9 @@ public abstract class XMLOutputFactory
throws IllegalArgumentException;
/**
- * Indicates whether writers created by this factory will perform prefix
- * defaulting.
- * @see #IS_PREFIX_DEFAULTING
- */
- public abstract boolean isPrefixDefaulting();
-
- /**
* Indicates whether the specified property is supported.
*/
public abstract boolean isPropertySupported(String name);
- /**
- * Sets whether writers created by this factory will perform prefix
- * defaulting.
- * @see #IS_PREFIX_DEFAULTING
- */
- public abstract void setPrefixDefaulting(boolean value);
-
}
diff --git a/javax/xml/stream/XMLReporter.java b/javax/xml/stream/XMLReporter.java
index bdf0b8acc..d54565681 100644
--- a/javax/xml/stream/XMLReporter.java
+++ b/javax/xml/stream/XMLReporter.java
@@ -1,5 +1,5 @@
/* XMLReporter.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/javax/xml/stream/XMLResolver.java b/javax/xml/stream/XMLResolver.java
index 148afc6f1..2dabaeea4 100644
--- a/javax/xml/stream/XMLResolver.java
+++ b/javax/xml/stream/XMLResolver.java
@@ -1,5 +1,5 @@
/* XMLResolver.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,8 +37,6 @@ exception statement from your version. */
package javax.xml.stream;
-import java.io.InputStream;
-
/**
* Interface used to resolve XML external entities during parsing.
*/
@@ -59,28 +57,10 @@ public interface XMLResolver
* @param systemID the system ID of the external entity
* @param baseURI the absolute base URI of the referring entity
* @param namespace the namespace of the external entity
- *
+ */
Object resolveEntity(String publicID, String systemID,
String baseURI, String namespace)
- throws XMLStreamException;*/
-
- /**
- * Retrieves a resource from the specified URI.
- */
- XMLEventReader resolveAsXMLEventReader(String uri)
throws XMLStreamException;
- /**
- * Retrieves a resource from the specified URI.
- */
- XMLStreamReader resolveAsXMLStreamReader(String uri)
- throws XMLStreamException;
-
- /**
- * Retrieves a resource from the specified URI.
- */
- InputStream resolve(String uri)
- throws XMLStreamException;
-
}
diff --git a/javax/xml/stream/XMLStreamConstants.java b/javax/xml/stream/XMLStreamConstants.java
index 1f0d2ef33..e41627dd6 100644
--- a/javax/xml/stream/XMLStreamConstants.java
+++ b/javax/xml/stream/XMLStreamConstants.java
@@ -1,5 +1,5 @@
/* XMLStreamConstants.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -109,24 +109,14 @@ public interface XMLStreamConstants
static final int NAMESPACE = 13;
/**
- * A start-entity event.
- */
- static final int START_ENTITY = 14;
-
- /**
- * An end-entity event.
- */
- static final int END_ENTITY = 15;
-
- /**
* A notation declaration event.
*/
- static final int NOTATION_DECLARATION = 16;
+ static final int NOTATION_DECLARATION = 14;
/**
* An entity declaration event.
*/
- static final int ENTITY_DECLARATION = 17;
+ static final int ENTITY_DECLARATION = 15;
}
diff --git a/javax/xml/stream/XMLStreamReader.java b/javax/xml/stream/XMLStreamReader.java
index e598fabb6..f8648b1ad 100644
--- a/javax/xml/stream/XMLStreamReader.java
+++ b/javax/xml/stream/XMLStreamReader.java
@@ -1,5 +1,5 @@
/* XMLStreamReader.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -136,7 +136,7 @@ public interface XMLStreamReader
/**
* Returns the QName of the attribute at the given index.
*/
- QName getAttributeQName(int index);
+ QName getAttributeName(int index);
/**
* Returns the namespace URI of the attribute at the given index.
@@ -146,7 +146,7 @@ public interface XMLStreamReader
/**
* Returns the local-name of the attribute at the given index.
*/
- String getAttributeName(int index);
+ String getAttributeLocalName(int index);
/**
* Returns the namespace prefix of the attribute at the given index.
diff --git a/javax/xml/stream/events/EndEntity.java b/javax/xml/stream/events/EndEntity.java
deleted file mode 100644
index b5c32d716..000000000
--- a/javax/xml/stream/events/EndEntity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* EndEntity.java --
- Copyright (C) 2005 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 javax.xml.stream.events;
-
-/**
- * An end-entity event.
- */
-public interface EndEntity
- extends XMLEvent
-{
-
- /**
- * Returns the entity name.
- */
- String getName();
-
-}
-
diff --git a/javax/xml/stream/events/EntityDeclaration.java b/javax/xml/stream/events/EntityDeclaration.java
index a319f098c..a0120ddb0 100644
--- a/javax/xml/stream/events/EntityDeclaration.java
+++ b/javax/xml/stream/events/EntityDeclaration.java
@@ -1,5 +1,5 @@
/* EntityDeclaration.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,12 +67,12 @@ public interface EntityDeclaration
/**
* Returns the replacement text for the entity.
*/
- //String getReplacementText();
+ String getReplacementText();
/**
* Returns the base URI for the entity.
*/
- //String getBaseURI();
+ String getBaseURI();
}
diff --git a/javax/xml/stream/events/EntityReference.java b/javax/xml/stream/events/EntityReference.java
index 72447096b..460433c16 100644
--- a/javax/xml/stream/events/EntityReference.java
+++ b/javax/xml/stream/events/EntityReference.java
@@ -1,5 +1,5 @@
/* EntityReference.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,34 +45,14 @@ public interface EntityReference
{
/**
- * Returns the base URI for the entity.
- */
- String getBaseUri();
-
- /**
- * Returns the public identifier for the entity.
- */
- String getPublicId();
-
- /**
- * Returns the system identifierfor the entity.
- */
- String getSystemId();
-
- /**
* Returns the declaration of this reference.
*/
- //EntityDeclaration getDeclaration();
+ EntityDeclaration getDeclaration();
/**
* Returns the entity name.
*/
String getName();
- /**
- * Returns the replacement text for the entity.
- */
- String getReplacementText();
-
}
diff --git a/javax/xml/stream/events/StartEntity.java b/javax/xml/stream/events/StartEntity.java
deleted file mode 100644
index d41e0db7a..000000000
--- a/javax/xml/stream/events/StartEntity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* StartEntity.java --
- Copyright (C) 2005 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 javax.xml.stream.events;
-
-/**
- * An start-entity event.
- */
-public interface StartEntity
- extends XMLEvent
-{
-
- /**
- * Returns the entity name.
- */
- String getName();
-
-}
-
diff --git a/javax/xml/stream/events/XMLEvent.java b/javax/xml/stream/events/XMLEvent.java
index 54e9516f6..7c427da87 100644
--- a/javax/xml/stream/events/XMLEvent.java
+++ b/javax/xml/stream/events/XMLEvent.java
@@ -1,5 +1,5 @@
/* XMLEvent.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -106,16 +106,6 @@ public interface XMLEvent
boolean isEndDocument();
/**
- * Indicates whether this event is a start-entity event.
- */
- boolean isStartEntity();
-
- /**
- * Indicates whether this event is an end-entity event.
- */
- boolean isEndEntity();
-
- /**
* Returns this event as a start-element event.
*/
StartElement asStartElement();
diff --git a/javax/xml/stream/util/EventReaderDelegate.java b/javax/xml/stream/util/EventReaderDelegate.java
index f6d1585b7..be943e465 100644
--- a/javax/xml/stream/util/EventReaderDelegate.java
+++ b/javax/xml/stream/util/EventReaderDelegate.java
@@ -1,5 +1,5 @@
/* EventReaderDelegate.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -82,16 +82,22 @@ public class EventReaderDelegate
return parent;
}
- public XMLEvent next()
+ public XMLEvent nextEvent()
throws XMLStreamException
{
if (parent != null)
+ return parent.nextEvent();
+ throw new NoSuchElementException();
+ }
+
+ public Object next()
+ {
+ if (parent != null)
return parent.next();
throw new NoSuchElementException();
}
public boolean hasNext()
- throws XMLStreamException
{
if (parent != null)
return parent.hasNext();
@@ -130,5 +136,17 @@ public class EventReaderDelegate
throw new IllegalArgumentException(name);
}
+ public void close()
+ throws XMLStreamException
+ {
+ if (parent != null)
+ parent.close();
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/javax/xml/stream/util/ReaderDelegate.java b/javax/xml/stream/util/ReaderDelegate.java
index ef7017563..d502866fb 100644
--- a/javax/xml/stream/util/ReaderDelegate.java
+++ b/javax/xml/stream/util/ReaderDelegate.java
@@ -1,5 +1,5 @@
/* ReaderDelegate.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -186,10 +186,10 @@ public class ReaderDelegate
return 0;
}
- public QName getAttributeQName(int index)
+ public QName getAttributeName(int index)
{
if (parent != null)
- return parent.getAttributeQName(index);
+ return parent.getAttributeName(index);
return null;
}
@@ -207,10 +207,10 @@ public class ReaderDelegate
return null;
}
- public String getAttributeName(int index)
+ public String getAttributeLocalName(int index)
{
if (parent != null)
- return parent.getAttributeName(index);
+ return parent.getAttributeLocalName(index);
return null;
}
diff --git a/javax/xml/validation/SchemaFactory.java b/javax/xml/validation/SchemaFactory.java
index 35bf20564..f33c1c629 100644
--- a/javax/xml/validation/SchemaFactory.java
+++ b/javax/xml/validation/SchemaFactory.java
@@ -39,6 +39,7 @@ package javax.xml.validation;
import java.io.File;
import java.net.URL;
+import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.ls.LSResourceResolver;
@@ -50,7 +51,7 @@ import org.xml.sax.SAXNotSupportedException;
/**
* Factory for obtaining schemata.
*
- * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ * @author Chris Burdess (dog@gnu.org)
* @since 1.3
*/
public abstract class SchemaFactory
@@ -70,7 +71,10 @@ public abstract class SchemaFactory
*/
public static final SchemaFactory newInstance(String schemaLanguage)
{
- // TODO
+ if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schemaLanguage))
+ return new gnu.xml.validation.xmlschema.XMLSchemaSchemaFactory();
+ if (XMLConstants.RELAXNG_NS_URI.equals(schemaLanguage))
+ return new gnu.xml.validation.relaxng.RELAXNGSchemaFactory();
throw new IllegalArgumentException(schemaLanguage);
}