Index: javax/swing/text/AbstractDocument.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.27
diff -u -r1.27 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java 4 Sep 2005 11:53:12 -0000 1.27
+++ javax/swing/text/AbstractDocument.java 13 Sep 2005 23:43:01 -0000
@@ -65,11 +65,10 @@
* @author original author unknown
* @author Roman Kennke (address@hidden)
*/
-public abstract class AbstractDocument
- implements Document, Serializable
+public abstract class AbstractDocument implements Document, Serializable
{
- /** The serial version UID for this class as of JDK1.4. */
- private static final long serialVersionUID = -116069779446114664L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 6842927725919637215L;
/**
* Standard error message to indicate a bad location.
@@ -332,7 +331,7 @@
* @see GapContent
* @see StringContent
*/
- protected Content getContent()
+ protected final Content getContent()
{
return content;
}
@@ -970,8 +969,8 @@
public abstract class AbstractElement
implements Element, MutableAttributeSet, TreeNode, Serializable
{
- /** The serial version UID for AbstractElement. */
- private static final long serialVersionUID = 1265312733007397733L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 1712240033321461704L;
/** The number of characters that this Element spans. */
int count;
@@ -1355,49 +1354,6 @@
public abstract int getStartOffset();
/**
- * Prints diagnostic information to the specified stream.
- *
- * @param stream the stream to dump to
- * @param indent the indentation level
- * @param element the element to be dumped
- */
- private void dumpElement(PrintStream stream, String indent,
- Element element)
- {
- // FIXME: Should the method be removed?
- System.out.println(indent + "<" + element.getName() +">");
-
- if (element.isLeaf())
- {
- int start = element.getStartOffset();
- int end = element.getEndOffset();
- String text = "";
- try
- {
- text = getContent().getString(start, end - start);
- }
- catch (BadLocationException e)
- {
- AssertionError error =
- new AssertionError("BadLocationException should not be "
- + "thrown here. start = " + start
- + ", end = " + end);
- error.initCause(e);
- throw error;
- }
- System.out.println(indent + " ["
- + start + ","
- + end + "]["
- + text + "]");
- }
- else
- {
- for (int i = 0; i < element.getElementCount(); ++i)
- dumpElement(stream, indent + " ", element.getElement(i));
- }
- }
-
- /**
* Prints diagnostic output to the specified stream.
*
* @param stream the stream to write to
@@ -1405,10 +1361,65 @@
*/
public void dump(PrintStream stream, int indent)
{
- String indentStr = "";
+ StringBuffer b = new StringBuffer();
for (int i = 0; i < indent; ++i)
- indentStr += " ";
- dumpElement(stream, indentStr, this);
+ b.append(' ');
+ b.append('<');
+ b.append(getName());
+ // Dump attributes if there are any.
+ if (getAttributeCount() > 0)
+ {
+ b.append('\n');
+ Enumeration attNames = getAttributeNames();
+ while (attNames.hasMoreElements())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ Object attName = attNames.nextElement();
+ b.append(attName);
+ b.append('=');
+ Object attribute = getAttribute(attName);
+ b.append(attribute);
+ b.append('\n');
+ }
+ }
+ b.append(">\n");
+
+ // Dump element content for leaf elements.
+ if (isLeaf())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ int start = getStartOffset();
+ int end = getEndOffset();
+ b.append('[');
+ b.append(start);
+ b.append(',');
+ b.append(end);
+ b.append("][");
+ try
+ {
+ b.append(getDocument().getText(start, end - start));
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("BadLocationException "
+ + "must not be thrown "
+ + "here.");
+ err.initCause(ex);
+ }
+ b.append("]\n");
+ }
+ stream.print(b.toString());
+
+ // Dump child elements if any.
+ int count = getElementCount();
+ for (int i = 0; i < count; ++i)
+ {
+ Element el = getElement(i);
+ if (el instanceof AbstractElement)
+ ((AbstractElement) el).dump(stream, indent + 2);
+ }
}
}
@@ -1418,8 +1429,8 @@
*/
public class BranchElement extends AbstractElement
{
- /** The serial version UID for BranchElement. */
- private static final long serialVersionUID = -8595176318868717313L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6037216547466333183L;
/** The child elements of this BranchElement. */
private Element[] children = new Element[0];
@@ -1642,8 +1653,8 @@
public class DefaultDocumentEvent extends CompoundEdit
implements DocumentEvent
{
- /** The serial version UID of DefaultDocumentEvent. */
- private static final long serialVersionUID = -7406103236022413522L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 5230037221564563284L;
/** The starting offset of the change. */
private int offset;
@@ -1843,8 +1854,8 @@
*/
public class LeafElement extends AbstractElement
{
- /** The serial version UID of LeafElement. */
- private static final long serialVersionUID = 5115368706941283802L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -8906306331347768017L;
/** Manages the start offset of this element. */
Position startPos;
Index: javax/swing/text/BoxView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/BoxView.java,v
retrieving revision 1.3
diff -u -r1.3 BoxView.java
--- javax/swing/text/BoxView.java 25 Aug 2005 18:55:28 -0000 1.3
+++ javax/swing/text/BoxView.java 13 Sep 2005 23:43:01 -0000
@@ -221,7 +221,6 @@
protected void paintChild(Graphics g, Rectangle alloc, int index)
{
View child = getView(index);
- childAllocation(index, alloc);
child.paint(g, alloc);
}
@@ -306,12 +305,8 @@
int count = getViewCount();
for (int i = 0; i < count; ++i)
{
- // TODO: Figure out if the parameter to paintChild is meant to
- // be the child allocation or the allocation of this BoxView.
- // I assume the second option here.
- // We pass this method a copy of the inside rectangle here because
- // it modifies the actual values.
copy.setBounds(inside);
+ childAllocation(i, copy);
paintChild(g, copy, i);
}
}
Index: javax/swing/text/ComponentView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/ComponentView.java,v
retrieving revision 1.8
diff -u -r1.8 ComponentView.java
--- javax/swing/text/ComponentView.java 2 Aug 2005 09:33:36 -0000 1.8
+++ javax/swing/text/ComponentView.java 13 Sep 2005 23:43:01 -0000
@@ -1,5 +1,5 @@
/* ComponentView.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,32 +41,82 @@
import java.awt.Graphics;
import java.awt.Shape;
+/**
+ * A address@hidden View} implementation that is able to render arbitrary
+ * address@hidden Components}. This uses the attribute
+ * address@hidden StyleConstants#ComponentAttribute} to determine the
+ * Component
that should be rendered. This Component
+ * becomes a direct child of the JTextComponent
that contains
+ * this ComponentView
, so this view must not be shared between
+ * multiple JTextComponent
s.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (address@hidden)
+ */
public class ComponentView extends View
{
- public ComponentView(Element elem)
- {
- super(elem);
- }
-
- protected Component createComponent()
- {
- return null;
- }
-
- public float getAlignment(int axis)
- {
- return 0;
- }
-
- public final Component getComponent()
- {
- return null;
- }
-
- public float getMaximumSpan(int axis)
- {
- return 0;
- }
+ /**
+ * Creates a new instance of ComponentView
for the specified
+ * Element
.
+ *
+ * @param elem the element that this View
is rendering
+ */
+ public ComponentView(Element elem)
+ {
+ super(elem);
+ }
+
+ /**
+ * Creates the Component
that this View
is
+ * rendering. The Component
is determined using
+ * the address@hidden StyleConstants#ComponentAttribute} of the associated
+ * Element
.
+ *
+ * @return the component that is rendered
+ */
+ protected Component createComponent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the alignment of this View
along the specified axis.
+ *
+ * @param axis either address@hidden View#X_AXIS} or address@hidden View#Y_AXIS}
+ *
+ * @return the alignment of this View
along the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the Component
that is rendered by this
+ * ComponentView
.
+ *
+ * @return the Component
that is rendered by this
+ * ComponentView
+ */
+ public final Component getComponent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the maximum span of this View
along the specified
+ * axis.
+ *
+ * This will return address@hidden Component#getMaximumSize()} for the specified
+ * axis.
+ *
+ * @return the maximum span of this View
along the specified
+ * axis
+ */
+ public float getMaximumSpan(int axis)
+ {
+ return 0;
+ }
public float getMinimumSpan(int axis)
{
Index: javax/swing/text/CompositeView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/CompositeView.java,v
retrieving revision 1.5
diff -u -r1.5 CompositeView.java
--- javax/swing/text/CompositeView.java 25 Aug 2005 19:04:35 -0000 1.5
+++ javax/swing/text/CompositeView.java 13 Sep 2005 23:43:01 -0000
@@ -314,6 +314,7 @@
*/
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
+ throws BadLocationException
{
int retVal = -1;
switch (direction)
@@ -594,6 +595,7 @@
protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
@@ -627,6 +629,7 @@
protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
Index: javax/swing/text/DefaultCaret.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v
retrieving revision 1.13
diff -u -r1.13 DefaultCaret.java
--- javax/swing/text/DefaultCaret.java 22 Aug 2005 11:35:23 -0000 1.13
+++ javax/swing/text/DefaultCaret.java 13 Sep 2005 23:43:02 -0000
@@ -60,10 +60,8 @@
public class DefaultCaret extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener
{
- /**
- * The serial version UID for DefaultCaret.
- */
- private static final long serialVersionUID = 228155774675466193L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4325555698756477346L;
/**
* The ChangeEvent
that is fired by address@hidden #fireStateChanged()}.
Index: javax/swing/text/DefaultEditorKit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v
retrieving revision 1.19
diff -u -r1.19 DefaultEditorKit.java
--- javax/swing/text/DefaultEditorKit.java 22 Aug 2005 11:35:23 -0000 1.19
+++ javax/swing/text/DefaultEditorKit.java 13 Sep 2005 23:43:02 -0000
@@ -66,8 +66,7 @@
*
* @see Toolkit#beep()
*/
- public static class BeepAction
- extends TextAction
+ public static class BeepAction extends TextAction
{
/**
* Creates a new BeepAction
.
@@ -95,8 +94,7 @@
* @see CutAction
* @see PasteAction
*/
- public static class CopyAction
- extends TextAction
+ public static class CopyAction extends TextAction
{
/**
@@ -128,8 +126,7 @@
* @see CopyAction
* @see PasteAction
*/
- public static class CutAction
- extends TextAction
+ public static class CutAction extends TextAction
{
/**
@@ -159,8 +156,7 @@
* @see CopyAction
* @see CutAction
*/
- public static class PasteAction
- extends TextAction
+ public static class PasteAction extends TextAction
{
/**
@@ -243,8 +239,7 @@
* of the text component. This is typically triggered by hitting
* ENTER on the keyboard.
*/
- public static class InsertBreakAction
- extends TextAction
+ public static class InsertBreakAction extends TextAction
{
/**
@@ -273,8 +268,7 @@
*/
// FIXME: Figure out what this Action is supposed to do. Obviously text
// that is entered by the user is inserted through DefaultKeyTypedAction.
- public static class InsertContentAction
- extends TextAction
+ public static class InsertContentAction extends TextAction
{
/**
@@ -298,8 +292,7 @@
/**
* Inserts a TAB character into the text editor.
*/
- public static class InsertTabAction
- extends TextAction
+ public static class InsertTabAction extends TextAction
{
/**
Index: javax/swing/text/DefaultFormatter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultFormatter.java,v
retrieving revision 1.3
diff -u -r1.3 DefaultFormatter.java
--- javax/swing/text/DefaultFormatter.java 2 Jul 2005 20:32:51 -0000 1.3
+++ javax/swing/text/DefaultFormatter.java 13 Sep 2005 23:43:02 -0000
@@ -57,8 +57,7 @@
*
* @author Roman Kennke (address@hidden)
*/
-public class DefaultFormatter
- extends JFormattedTextField.AbstractFormatter
+public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
implements Cloneable, Serializable
{
@@ -156,9 +155,6 @@
* Checks if the value in the input field is valid. If the
* property allowsInvalid is set to false
, then
* the string in the input field is not allowed to be entered.
- *
- * @param doc the document of the input field
- * @param value the current (old) value of the input field
*/
private void checkValidInput()
{
@@ -186,8 +182,8 @@
}
}
- /** The serialVersoinUID. */
- private static final long serialVersionUID = -7369196326612908900L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -355018354457785329L;
/**
* Indicates if the value should be committed after every
Index: javax/swing/text/DefaultStyledDocument.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultStyledDocument.java,v
retrieving revision 1.8
diff -u -r1.8 DefaultStyledDocument.java
--- javax/swing/text/DefaultStyledDocument.java 13 Sep 2005 10:42:03 -0000 1.8
+++ javax/swing/text/DefaultStyledDocument.java 13 Sep 2005 23:43:03 -0000
@@ -504,7 +504,6 @@
insertContentTag(data[i]);
break;
}
- BranchElement root = (BranchElement) getDefaultRootElement();
}
}
@@ -522,6 +521,7 @@
BranchElement newParagraph =
(BranchElement) createBranchElement(root, tag.getAttributes());
+ newParagraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
// Add new paragraph into document structure.
Element[] added = new Element[]{newParagraph};
@@ -796,7 +796,9 @@
// Use createBranchElement() and createLeafElement instead.
SectionElement section = new SectionElement();
- BranchElement paragraph = new BranchElement(section, null);
+ BranchElement paragraph =
+ (BranchElement) createBranchElement(section, null);
+ paragraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
tmp = new Element[1];
tmp[0] = paragraph;
section.replace(0, 0, tmp);
Index: javax/swing/text/InternationalFormatter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/InternationalFormatter.java,v
retrieving revision 1.4
diff -u -r1.4 InternationalFormatter.java
--- javax/swing/text/InternationalFormatter.java 26 Jul 2005 08:00:03 -0000 1.4
+++ javax/swing/text/InternationalFormatter.java 13 Sep 2005 23:43:03 -0000
@@ -57,9 +57,8 @@
public class InternationalFormatter
extends DefaultFormatter
{
-
- /** The serialVersoinUID. */
- private static final long serialVersionUID = 6941977820906408656L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2436068675711756856L;
/** The format that handles value to string conversion. */
Format format;
Index: javax/swing/text/JTextComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/JTextComponent.java,v
retrieving revision 1.36
diff -u -r1.36 JTextComponent.java
--- javax/swing/text/JTextComponent.java 26 Jul 2005 08:00:03 -0000 1.36
+++ javax/swing/text/JTextComponent.java 13 Sep 2005 23:43:03 -0000
@@ -303,9 +303,7 @@
/**
* The timer that lets the caret blink.
*/
- private class CaretBlinkTimer
- extends Timer
- implements ActionListener
+ private class CaretBlinkTimer extends Timer implements ActionListener
{
/**
* Creates a new CaretBlinkTimer object with a default delay of 1 second.
@@ -604,8 +602,7 @@
}
}
- class DefaultTransferHandler
- extends TransferHandler
+ class DefaultTransferHandler extends TransferHandler
{
public boolean canImport(JComponent component, DataFlavor[] flavors)
{
@@ -1105,7 +1102,8 @@
*/
protected String paramString()
{
- return "JTextComponent";
+ // TODO: Do something useful here.
+ return super.paramString();
}
/**
Index: javax/swing/text/SimpleAttributeSet.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/SimpleAttributeSet.java,v
retrieving revision 1.9
diff -u -r1.9 SimpleAttributeSet.java
--- javax/swing/text/SimpleAttributeSet.java 2 Jul 2005 20:32:51 -0000 1.9
+++ javax/swing/text/SimpleAttributeSet.java 13 Sep 2005 23:43:04 -0000
@@ -45,6 +45,9 @@
public class SimpleAttributeSet
implements MutableAttributeSet, Serializable, Cloneable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8267656273837665219L;
+
public static final AttributeSet EMPTY = new SimpleAttributeSet();
Hashtable tab;
@@ -89,7 +92,7 @@
return tab.containsKey(name)
&& tab.get(name).equals(value);
}
-
+
public boolean containsAttributes(AttributeSet attributes)
{
Enumeration e = attributes.getAttributeNames();
@@ -110,9 +113,9 @@
public boolean equals(Object obj)
{
- return (obj != null)
- && (obj instanceof SimpleAttributeSet)
- && ((SimpleAttributeSet)obj).tab.equals(this.tab);
+ return
+ (obj instanceof AttributeSet)
+ && this.isEqual((AttributeSet) obj);
}
public Object getAttribute(Object name)
@@ -160,7 +163,9 @@
public boolean isEqual(AttributeSet attr)
{
- return this.equals(attr);
+ return attr != null
+ && attr.containsAttributes(this)
+ && this.containsAttributes(attr);
}
public void removeAttribute(Object name)
Index: javax/swing/text/StringContent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/StringContent.java,v
retrieving revision 1.4
diff -u -r1.4 StringContent.java
--- javax/swing/text/StringContent.java 2 Jul 2005 20:32:51 -0000 1.4
+++ javax/swing/text/StringContent.java 13 Sep 2005 23:43:04 -0000
@@ -56,6 +56,9 @@
*/
public final class StringContent implements AbstractDocument.Content, Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4755994433709540381L;
+
// This is package-private to avoid an accessor method.
char[] content;
Index: javax/swing/text/StyleConstants.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyleConstants.java,v
retrieving revision 1.6
diff -u -r1.6 StyleConstants.java
--- javax/swing/text/StyleConstants.java 2 Jul 2005 20:32:51 -0000 1.6
+++ javax/swing/text/StyleConstants.java 13 Sep 2005 23:43:04 -0000
@@ -109,7 +109,7 @@
if (a.isDefined(Background))
return (Color) a.getAttribute(Background);
else
- return Color.BLACK;
+ return Color.WHITE;
}
public static int getBidiLevel(AttributeSet a)
Index: javax/swing/text/StyleContext.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyleContext.java,v
retrieving revision 1.5
diff -u -r1.5 StyleContext.java
--- javax/swing/text/StyleContext.java 5 Jul 2005 13:53:33 -0000 1.5
+++ javax/swing/text/StyleContext.java 13 Sep 2005 23:43:04 -0000
@@ -57,9 +57,15 @@
public class StyleContext
implements Serializable, AbstractDocument.AttributeContext
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8042858831190784241L;
+
public class NamedStyle
implements Serializable, Style
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6690628971806226374L;
+
protected ChangeEvent changeEvent;
protected EventListenerList listenerList;
@@ -288,7 +294,7 @@
public boolean equals(Object obj)
{
return
- (obj instanceof SmallAttributeSet)
+ (obj instanceof AttributeSet)
&& this.isEqual((AttributeSet)obj);
}
Index: javax/swing/text/StyledEditorKit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyledEditorKit.java,v
retrieving revision 1.13
diff -u -r1.13 StyledEditorKit.java
--- javax/swing/text/StyledEditorKit.java 25 Aug 2005 19:33:06 -0000 1.13
+++ javax/swing/text/StyledEditorKit.java 13 Sep 2005 23:43:04 -0000
@@ -40,13 +40,9 @@
import java.awt.Color;
import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
import javax.swing.Action;
import javax.swing.JEditorPane;
-import javax.swing.JTextPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
@@ -460,11 +456,11 @@
* StyledEditorKit
, namely the following types of Elements:
*
*
Element
s:
*
*