diff options
Diffstat (limited to 'libjava/classpath/javax/swing/text')
80 files changed, 2345 insertions, 2352 deletions
diff --git a/libjava/classpath/javax/swing/text/AbstractDocument.java b/libjava/classpath/javax/swing/text/AbstractDocument.java index 29b20b321fb..25915bb5a23 100644 --- a/libjava/classpath/javax/swing/text/AbstractDocument.java +++ b/libjava/classpath/javax/swing/text/AbstractDocument.java @@ -149,22 +149,22 @@ public abstract class AbstractDocument implements Document, Serializable * Manages event listeners for this <code>Document</code>. */ protected EventListenerList listenerList = new EventListenerList(); - + /** * Stores the current writer thread. Used for locking. - */ + */ private Thread currentWriter = null; - + /** * The number of readers. Used for locking. */ private int numReaders = 0; - + /** * The number of current writers. If this is > 1 then the same thread entered * the write lock more than once. */ - private int numWriters = 0; + private int numWriters = 0; /** An instance of a DocumentFilter.FilterBypass which allows calling * the insert, remove and replace method without checking for an installed @@ -234,17 +234,17 @@ public abstract class AbstractDocument implements Document, Serializable writeUnlock(); } } - + /** Returns the DocumentFilter.FilterBypass instance for this * document and create it if it does not exist yet. - * + * * @return This document's DocumentFilter.FilterBypass instance. */ private DocumentFilter.FilterBypass getBypass() { if (bypass == null) bypass = new Bypass(); - + return bypass; } @@ -283,7 +283,7 @@ public abstract class AbstractDocument implements Document, Serializable * @see BranchElement */ protected Element createBranchElement(Element parent, - AttributeSet attributes) + AttributeSet attributes) { return new BranchElement(parent, attributes); } @@ -303,7 +303,7 @@ public abstract class AbstractDocument implements Document, Serializable * @see LeafElement */ protected Element createLeafElement(Element parent, AttributeSet attributes, - int start, int end) + int start, int end) { return new LeafElement(parent, attributes, start, end); } @@ -413,7 +413,7 @@ public abstract class AbstractDocument implements Document, Serializable Object val = getProperty(AsyncLoadPriority); int prio = -1; if (val != null) - prio = ((Integer) val).intValue(); + prio = ((Integer) val).intValue(); return prio; } @@ -621,13 +621,13 @@ public abstract class AbstractDocument implements Document, Serializable /** * Inserts a String into this <code>Document</code> at the specified * position and assigning the specified attributes to it. - * + * * <p>If a {@link DocumentFilter} is installed in this document, the * corresponding method of the filter object is called.</p> - * + * * <p>The method has no effect when <code>text</code> is <code>null</code> * or has a length of zero.</p> - * + * * * @param offset the location at which the string should be inserted * @param text the content to be inserted @@ -665,7 +665,7 @@ public abstract class AbstractDocument implements Document, Serializable return; DefaultDocumentEvent event = new DefaultDocumentEvent(offset, text.length(), - DocumentEvent.EventType.INSERT); + DocumentEvent.EventType.INSERT); UndoableEdit undo = content.insertString(offset, text); if (undo != null) @@ -1078,14 +1078,14 @@ public abstract class AbstractDocument implements Document, Serializable // balance by using a finally block: // readLock() // try - // { - // doSomethingHere + // { + // doSomethingHere // } // finally // { // readUnlock(); // } - + // All that the JDK seems to check for is that you don't call unlock // more times than you've previously called lock, but it doesn't make // sure that the threads calling unlock were the same ones that called lock @@ -1096,13 +1096,13 @@ public abstract class AbstractDocument implements Document, Serializable if (currentWriter == Thread.currentThread()) return; - // FIXME: the reference implementation throws a + // FIXME: the reference implementation throws a // javax.swing.text.StateInvariantError here if (numReaders <= 0) throw new IllegalStateException("document lock failure"); - - // If currentWriter is not null, the application code probably had a - // writeLock and then tried to obtain a readLock, in which case + + // If currentWriter is not null, the application code probably had a + // writeLock and then tried to obtain a readLock, in which case // numReaders wasn't incremented numReaders--; notify(); @@ -1110,16 +1110,16 @@ public abstract class AbstractDocument implements Document, Serializable /** * Removes a piece of content from this <code>Document</code>. - * + * * <p>If a {@link DocumentFilter} is installed in this document, the * corresponding method of the filter object is called. The * <code>DocumentFilter</code> is called even if <code>length</code> * is zero. This is different from {@link #replace}.</p> - * + * * <p>Note: When <code>length</code> is zero or below the call is not * forwarded to the underlying {@link AbstractDocument.Content} instance * of this document and no exception is thrown.</p> - * + * * @param offset the start offset of the fragment to be removed * @param length the length of the fragment to be removed * @@ -1159,8 +1159,8 @@ public abstract class AbstractDocument implements Document, Serializable DefaultDocumentEvent event = new DefaultDocumentEvent(offset, length, DocumentEvent.EventType.REMOVE); - - // The order of the operations below is critical! + + // The order of the operations below is critical! removeUpdate(event); UndoableEdit temp = content.remove(offset, length); @@ -1172,10 +1172,10 @@ public abstract class AbstractDocument implements Document, Serializable /** * Replaces a piece of content in this <code>Document</code> with * another piece of content. - * + * * <p>If a {@link DocumentFilter} is installed in this document, the * corresponding method of the filter object is called.</p> - * + * * <p>The method has no effect if <code>length</code> is zero (and * only zero) and, at the same time, <code>text</code> is * <code>null</code> or has zero length.</p> @@ -1196,7 +1196,7 @@ public abstract class AbstractDocument implements Document, Serializable throws BadLocationException { // Bail out if we have a bogus replacement (Behavior observed in RI). - if (length == 0 + if (length == 0 && (text == null || text.length() == 0)) return; @@ -1222,9 +1222,9 @@ public abstract class AbstractDocument implements Document, Serializable writeUnlock(); } } - + void replaceImpl(int offset, int length, String text, - AttributeSet attributes) + AttributeSet attributes) throws BadLocationException { removeImpl(offset, length); @@ -1356,7 +1356,7 @@ public abstract class AbstractDocument implements Document, Serializable } /** - * Blocks until a write lock can be obtained. Must wait if there are + * Blocks until a write lock can be obtained. Must wait if there are * readers currently reading or another thread is currently writing. */ protected synchronized final void writeLock() @@ -1882,7 +1882,7 @@ public abstract class AbstractDocument implements Document, Serializable /** * Returns the resolve parent of this element. * This is taken from the AttributeSet, but if this is null, - * this method instead returns the Element's parent's + * this method instead returns the Element's parent's * AttributeSet * * @return the resolve parent of this element @@ -1919,7 +1919,7 @@ public abstract class AbstractDocument implements Document, Serializable * is equal to this element's <code>AttributeSet</code>, * <code>false</code> otherwise */ - public boolean isEqual(AttributeSet attrs) + public boolean isEqual(AttributeSet attrs) { return attributes.isEqual(attrs); } @@ -2066,7 +2066,7 @@ public abstract class AbstractDocument implements Document, Serializable + "must not be thrown " + "here."); err.initCause(ex); - throw err; + throw err; } b.append("]\n"); } @@ -2137,7 +2137,7 @@ public abstract class AbstractDocument implements Document, Serializable for (int index = 0; index < numChildren; ++index) tmp.add(children[index]); - + return tmp.elements(); } @@ -2337,11 +2337,11 @@ public abstract class AbstractDocument implements Document, Serializable // as beginning from first element each time. for (int index = 0; index < numChildren; ++index) { - Element elem = children[index]; + Element elem = children[index]; - if ((elem.getStartOffset() <= position) - && (position < elem.getEndOffset())) - return elem; + if ((elem.getStartOffset() <= position) + && (position < elem.getEndOffset())) + return elem; } return null; @@ -2359,7 +2359,7 @@ public abstract class AbstractDocument implements Document, Serializable int delta = elements.length - length; int copyFrom = offset + length; // From where to copy. int copyTo = copyFrom + delta; // Where to copy to. - int numMove = numChildren - copyFrom; // How many elements are moved. + int numMove = numChildren - copyFrom; // How many elements are moved. if (numChildren + delta > children.length) { // Gotta grow the array. @@ -2386,7 +2386,7 @@ public abstract class AbstractDocument implements Document, Serializable public String toString() { return ("BranchElement(" + getName() + ") " - + getStartOffset() + "," + getEndOffset() + "\n"); + + getStartOffset() + "," + getEndOffset() + "\n"); } } @@ -2403,7 +2403,7 @@ public abstract class AbstractDocument implements Document, Serializable * The threshold that indicates when we switch to using a Hashtable. */ private static final int THRESHOLD = 10; - + /** The starting offset of the change. */ private int offset; @@ -2417,7 +2417,7 @@ public abstract class AbstractDocument implements Document, Serializable * Maps <code>Element</code> to their change records. This is only * used when the changes array gets too big. We can use an * (unsync'ed) HashMap here, since changes to this are (should) always - * be performed inside a write lock. + * be performed inside a write lock. */ private HashMap changes; @@ -2435,7 +2435,7 @@ public abstract class AbstractDocument implements Document, Serializable * @param type the type of change */ public DefaultDocumentEvent(int offset, int length, - DocumentEvent.EventType type) + DocumentEvent.EventType type) { this.offset = offset; this.length = length; @@ -2548,7 +2548,7 @@ public abstract class AbstractDocument implements Document, Serializable } return change; } - + /** * Returns a String description of the change event. This returns the * toString method of the Vector of edits. @@ -2558,7 +2558,7 @@ public abstract class AbstractDocument implements Document, Serializable return edits.toString(); } } - + /** * An implementation of {@link DocumentEvent.ElementChange} to be added * to {@link DefaultDocumentEvent}s. @@ -2588,7 +2588,7 @@ public abstract class AbstractDocument implements Document, Serializable * The added elements. */ private Element[] added; - + /** * Creates a new <code>ElementEdit</code>. * @@ -2598,7 +2598,7 @@ public abstract class AbstractDocument implements Document, Serializable * @param added the added elements */ public ElementEdit(Element elem, int index, - Element[] removed, Element[] added) + Element[] removed, Element[] added) { this.elem = elem; this.index = index; @@ -2811,7 +2811,7 @@ public abstract class AbstractDocument implements Document, Serializable public String toString() { return ("LeafElement(" + getName() + ") " - + getStartOffset() + "," + getEndOffset() + "\n"); + + getStartOffset() + "," + getEndOffset() + "\n"); } } @@ -2900,7 +2900,7 @@ public abstract class AbstractDocument implements Document, Serializable { AbstractDocument.this.replaceImpl(offset, length, string, attrs); } - + } - + } diff --git a/libjava/classpath/javax/swing/text/AbstractWriter.java b/libjava/classpath/javax/swing/text/AbstractWriter.java index 8d5a6075df4..e7df26e9e09 100644 --- a/libjava/classpath/javax/swing/text/AbstractWriter.java +++ b/libjava/classpath/javax/swing/text/AbstractWriter.java @@ -7,7 +7,7 @@ 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 @@ -66,7 +66,7 @@ public abstract class AbstractWriter // Number of characters we have currently written. private int lineLength; // True if we can apply line wrapping. - private boolean canWrapLines; // FIXME default? + private boolean canWrapLines; // FIXME default? // The number of spaces per indentation level. private int indentSpace = 2; // The current indentation level. @@ -167,7 +167,7 @@ public abstract class AbstractWriter /** * This method must be overridden by a concrete subclass. It is * responsible for iterating over the Elements of the Document and - * writing them out. + * writing them out. */ protected abstract void write() throws IOException, BadLocationException; @@ -182,9 +182,9 @@ public abstract class AbstractWriter { if (! elt.isLeaf()) throw new BadLocationException("Element is not a leaf", - elt.getStartOffset()); - return document.getText(elt.getStartOffset(), - elt.getEndOffset() - elt.getStartOffset()); + elt.getStartOffset()); + return document.getText(elt.getStartOffset(), + elt.getEndOffset() - elt.getStartOffset()); } /** @@ -239,37 +239,37 @@ public abstract class AbstractWriter { if (getCanWrapLines()) { - // FIXME: should we be handling newlines specially here? - for (int i = 0; i < len; ) - { - int start_i = i; - // Find next space. - while (i < len && data[start + i] != ' ') - ++i; - if (i < len && lineLength + i - start_i >= maxLineLength) - writeLineSeparator(); - else if (i < len) - { - // Write the trailing space. - ++i; - } - // Write out the text. - output(data, start + start_i, start + i - start_i); - } + // FIXME: should we be handling newlines specially here? + for (int i = 0; i < len; ) + { + int start_i = i; + // Find next space. + while (i < len && data[start + i] != ' ') + ++i; + if (i < len && lineLength + i - start_i >= maxLineLength) + writeLineSeparator(); + else if (i < len) + { + // Write the trailing space. + ++i; + } + // Write out the text. + output(data, start + start_i, start + i - start_i); + } } else { - int saved_i = start; - for (int i = start; i < start + len; ++i) - { - if (data[i] == NEWLINE) - { - output(data, saved_i, i - saved_i); - writeLineSeparator(); - } - } - if (saved_i < start + len - 1) - output(data, saved_i, start + len - saved_i); + int saved_i = start; + for (int i = start; i < start + len; ++i) + { + if (data[i] == NEWLINE) + { + output(data, saved_i, i - saved_i); + writeLineSeparator(); + } + } + if (saved_i < start + len - 1) + output(data, saved_i, start + len - saved_i); } } @@ -284,9 +284,9 @@ public abstract class AbstractWriter int spaces = indentLevel * indentSpace; if (spaces > 0) { - char[] v = new char[spaces]; - Arrays.fill(v, ' '); - write(v, 0, v.length); + char[] v = new char[spaces]; + Arrays.fill(v, ' '); + write(v, 0, v.length); } indented = true; } @@ -318,7 +318,7 @@ public abstract class AbstractWriter int eltStart = elt.getStartOffset(); int eltEnd = elt.getEndOffset(); return ((eltStart >= startOffset && eltStart < endOffset) - || (eltEnd >= startOffset && eltEnd < endOffset)); + || (eltEnd >= startOffset && eltEnd < endOffset)); } /** @@ -472,10 +472,10 @@ public abstract class AbstractWriter Enumeration e = attrs.getAttributeNames(); while (e.hasMoreElements()) { - Object name = e.nextElement(); - Object val = attrs.getAttribute(name); - write(name + "=" + val); - writeLineSeparator(); + Object name = e.nextElement(); + Object val = attrs.getAttribute(name); + write(name + "=" + val); + writeLineSeparator(); } } } diff --git a/libjava/classpath/javax/swing/text/AsyncBoxView.java b/libjava/classpath/javax/swing/text/AsyncBoxView.java index 327c2b895d9..aca77aa3ba1 100644 --- a/libjava/classpath/javax/swing/text/AsyncBoxView.java +++ b/libjava/classpath/javax/swing/text/AsyncBoxView.java @@ -160,7 +160,7 @@ public class AsyncBoxView * * @param index the index of the child view * @param a the current allocation of this view - * + * * @return the current allocation for a child view */ public synchronized Shape getChildAllocation(int index, Shape a) @@ -216,7 +216,7 @@ public class AsyncBoxView /** * Returns the current allocation of the child view with the specified * index. Note that this will <em>not</em> update any location information. - * + * * @param index the index of the requested child view * * @return the current allocation of the child view with the specified @@ -428,7 +428,7 @@ public class AsyncBoxView * Returns the child view for which this <code>ChildState</code> represents * the layout state. * - * @return the child view for this child state object + * @return the child view for this child state object */ public View getChildView() { @@ -1002,7 +1002,7 @@ public class AsyncBoxView replace(0, 0, added); } } - + /** * Returns the span along an axis that is taken up by the insets. * @@ -1355,14 +1355,14 @@ public class AsyncBoxView return; } } - int index = getViewIndexAtPosition(view.getStartOffset(), + int index = getViewIndexAtPosition(view.getStartOffset(), Position.Bias.Forward); ChildState cs = getChildState(index); cs.preferenceChanged(width, height); LayoutQueue q = getLayoutQueue(); q.addTask(cs); q.addTask(flushTask); - } + } } /** @@ -1375,7 +1375,7 @@ public class AsyncBoxView * @param e the document event * @param a the current allocation of this view */ - protected void updateLayout(DocumentEvent.ElementChange ec, + protected void updateLayout(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a) { if (ec != null) @@ -1385,8 +1385,8 @@ public class AsyncBoxView locator.childChanged(cs); } } - - + + /** * Returns the <code>ChildState</code> object associated with the child view * at the specified <code>index</code>. @@ -1416,7 +1416,7 @@ public class AsyncBoxView /** * Returns the child view index of the view that represents the specified * position in the document model. - * + * * @param pos the position in the model * @param b the bias * diff --git a/libjava/classpath/javax/swing/text/AttributeSet.java b/libjava/classpath/javax/swing/text/AttributeSet.java index 2d39881c28b..a596cd4c33b 100644 --- a/libjava/classpath/javax/swing/text/AttributeSet.java +++ b/libjava/classpath/javax/swing/text/AttributeSet.java @@ -1,4 +1,4 @@ -/* AttributeSet.java -- +/* AttributeSet.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -52,7 +52,7 @@ import java.util.Enumeration; * @author Roman Kennke (roman@kennke.org) */ public interface AttributeSet -{ +{ /** * Used as keys to identify character-run attributes. */ @@ -191,5 +191,5 @@ public interface AttributeSet * are equal to the attributes in this <code>AttributeSet</code>, * <code>false</code> otherwise */ - boolean isEqual(AttributeSet attr); + boolean isEqual(AttributeSet attr); } diff --git a/libjava/classpath/javax/swing/text/BoxView.java b/libjava/classpath/javax/swing/text/BoxView.java index 0754d9b9b8b..325364d2b9a 100644 --- a/libjava/classpath/javax/swing/text/BoxView.java +++ b/libjava/classpath/javax/swing/text/BoxView.java @@ -155,8 +155,8 @@ public class BoxView * automatically when any of the child view changes its preferences * via {@link #preferenceChanged(View, boolean, boolean)}. * - * The layout will be updated the next time when - * {@link #setSize(float, float)} is called, typically from within the + * The layout will be updated the next time when + * {@link #setSize(float, float)} is called, typically from within the * {@link #paint(Graphics, Shape)} method. * * Valid values for the axis are {@link View#X_AXIS} and @@ -387,7 +387,7 @@ public class BoxView int totalDescentMin = 0; int totalDescentPref = 0; int totalDescentMax = 0; - + int count = getViewCount(); for (int i = 0; i < count; i++) { @@ -578,7 +578,7 @@ public class BoxView return res; } - + /** * Returns <code>true</code> if the specified point lies before the @@ -699,7 +699,7 @@ public class BoxView * Computes the allocation for a child <code>View</code>. The parameter * <code>a</code> stores the allocation of this <code>CompositeView</code> * and is then adjusted to hold the allocation of the child view. - * + * * @param index * the index of the child <code>View</code> * @param a @@ -957,13 +957,13 @@ public class BoxView updateRequirements(axis); return requirements[axis].alignment; } - + /** * Called by a child View when its preferred span has changed. - * + * * @param width indicates that the preferred width of the child changed. * @param height indicates that the preferred height of the child changed. - * @param child the child View. + * @param child the child View. */ public void preferenceChanged(View child, boolean width, boolean height) { @@ -979,7 +979,7 @@ public class BoxView } super.preferenceChanged(child, width, height); } - + /** * Maps the document model position <code>pos</code> to a Shape * in the view coordinate space. This method overrides CompositeView's diff --git a/libjava/classpath/javax/swing/text/Caret.java b/libjava/classpath/javax/swing/text/Caret.java index d6411905dda..06972f904f0 100644 --- a/libjava/classpath/javax/swing/text/Caret.java +++ b/libjava/classpath/javax/swing/text/Caret.java @@ -1,4 +1,4 @@ -/* Caret.java -- +/* Caret.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -77,7 +77,7 @@ public interface Caret * @param c the text component to install this caret to */ void install(JTextComponent c); - + /** * Deinstalls this <code>Caret</code> from the specified text component. * This usually involves removing listeners from the text component. @@ -105,7 +105,7 @@ public interface Caret * @param rate the new blink rate to set */ void setBlinkRate(int rate); - + /** * Returns the current position of this <code>Caret</code> within the * <code>Document</code>. @@ -125,7 +125,7 @@ public interface Caret * @see #moveDot(int) */ void setDot(int dot); - + /** * Moves the <code>dot</code> location without touching the * <code>mark</code>. This is used when making a selection. @@ -135,7 +135,7 @@ public interface Caret * @see #setDot(int) */ void moveDot(int dot); - + /** * Returns the current position of the <code>mark</code>. The * <code>mark</code> marks the location in the <code>Document</code> that @@ -145,7 +145,7 @@ public interface Caret * @return the current position of the mark */ int getMark(); - + /** * Returns the current visual position of this <code>Caret</code>. * @@ -194,7 +194,7 @@ public interface Caret * <code>Caret</code>, <code>false</code> hides it. * * @param v the visibility to set - */ + */ void setVisible(boolean v); /** @@ -203,5 +203,5 @@ public interface Caret * * @param g the graphics context to render to */ - void paint(Graphics g); + void paint(Graphics g); } diff --git a/libjava/classpath/javax/swing/text/ComponentView.java b/libjava/classpath/javax/swing/text/ComponentView.java index 8de4de60fa3..3680b424561 100644 --- a/libjava/classpath/javax/swing/text/ComponentView.java +++ b/libjava/classpath/javax/swing/text/ComponentView.java @@ -1,4 +1,4 @@ -/* ComponentView.java -- +/* ComponentView.java -- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -459,7 +459,7 @@ public class ComponentView extends View } } } - + /** * Maps coordinates from the <code>View</code>'s space into a position * in the document model. diff --git a/libjava/classpath/javax/swing/text/CompositeView.java b/libjava/classpath/javax/swing/text/CompositeView.java index 570fc955c88..ae3c79d2f71 100644 --- a/libjava/classpath/javax/swing/text/CompositeView.java +++ b/libjava/classpath/javax/swing/text/CompositeView.java @@ -309,7 +309,7 @@ public abstract class CompositeView * listed valid values */ public Shape modelToView(int p1, Position.Bias b1, - int p2, Position.Bias b2, Shape a) + int p2, Position.Bias b2, Shape a) throws BadLocationException { // TODO: This is most likely not 100% ok, figure out what else is to @@ -346,7 +346,7 @@ public abstract class CompositeView * of the caret when navigating around the document with the arrow keys. This * is a convenience method for {@link #getNextNorthSouthVisualPositionFrom} * and {@link #getNextEastWestVisualPositionFrom}. - * + * * @param pos * the model position to start search from * @param b @@ -662,7 +662,7 @@ public abstract class CompositeView // This limitation is described as PR 27345. int index = getViewIndex(pos, b); View v = null; - + if (index == -1) return pos; @@ -673,7 +673,7 @@ public abstract class CompositeView // provided. if (index <= 0) return pos; - + v = getView(index - 1); break; case SOUTH: @@ -681,13 +681,13 @@ public abstract class CompositeView // provided. if (index >= getViewCount() - 1) return pos; - + v = getView(index + 1); break; default: throw new IllegalArgumentException(); } - + return v.getNextVisualPositionFrom(pos, b, a, direction, biasRet); } @@ -738,9 +738,9 @@ public abstract class CompositeView // // This limitation is described as PR 27346. int index; - + View v = null; - + switch (direction) { case EAST: @@ -749,7 +749,7 @@ public abstract class CompositeView // provided. if (index == -1) return pos; - + v = getView(index); break; case WEST: @@ -758,13 +758,13 @@ public abstract class CompositeView // provided. if (index == -1) return pos; - + v = getView(index); break; default: throw new IllegalArgumentException(); } - + return v.getNextVisualPositionFrom(pos, b, a, diff --git a/libjava/classpath/javax/swing/text/DefaultCaret.java b/libjava/classpath/javax/swing/text/DefaultCaret.java index c4c2580c398..acfcdb36825 100644 --- a/libjava/classpath/javax/swing/text/DefaultCaret.java +++ b/libjava/classpath/javax/swing/text/DefaultCaret.java @@ -70,15 +70,15 @@ import javax.swing.text.Position.Bias; public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener { - + /** A text component in the current VM which currently has a * text selection or <code>null</code>. - */ + */ static JTextComponent componentWithSelection; /** An implementation of NavigationFilter.FilterBypass which delegates - * to the corresponding methods of the <code>DefaultCaret</code>. - * + * to the corresponding methods of the <code>DefaultCaret</code>. + * * @author Robert Schuster (robertschuster@fsfe.org) */ class Bypass extends NavigationFilter.FilterBypass @@ -98,9 +98,9 @@ public class DefaultCaret extends Rectangle { DefaultCaret.this.setDotImpl(dot); } - + } - + /** * Controls the blinking of the caret. * @@ -116,11 +116,11 @@ public class DefaultCaret extends Rectangle * the caret visible one iteration longer. */ boolean ignoreNextEvent; - + /** * Receives notification when the blink timer fires and updates the visible * state of the caret. - * + * * @param event the action event */ public void actionPerformed(ActionEvent event) @@ -138,7 +138,7 @@ public class DefaultCaret extends Rectangle /** * Listens for changes in the text component's document and updates the * caret accordingly. - * + * * @author Roman Kennke (kennke@aicas.com) */ private class DocumentHandler implements DocumentListener @@ -162,10 +162,10 @@ public class DefaultCaret extends Rectangle */ public void insertUpdate(DocumentEvent event) { - if (policy == ALWAYS_UPDATE || - (SwingUtilities.isEventDispatchThread() && + if (policy == ALWAYS_UPDATE || + (SwingUtilities.isEventDispatchThread() && policy == UPDATE_WHEN_ON_EDT)) - { + { int dot = getDot(); setDot(dot + event.getLength()); } @@ -216,14 +216,14 @@ public class DefaultCaret extends Rectangle */ public void propertyChange(PropertyChangeEvent e) { - String name = e.getPropertyName(); - + String name = e.getPropertyName(); + if (name.equals("document")) { Document oldDoc = (Document) e.getOldValue(); if (oldDoc != null) oldDoc.removeDocumentListener(documentListener); - + Document newDoc = (Document) e.getNewValue(); if (newDoc != null) newDoc.addDocumentListener(documentListener); @@ -238,19 +238,19 @@ public class DefaultCaret extends Rectangle active = (((Boolean) e.getNewValue()).booleanValue() && textComponent.isEditable()); } - + } - + } /** The serialization UID (compatible with JDK1.5). */ private static final long serialVersionUID = 4325555698756477346L; - + /** * Indicates the Caret position should always be updated after Document * changes even if the updates are not performed on the Event Dispatching * thread. - * + * * @since 1.5 */ public static final int ALWAYS_UPDATE = 2; @@ -259,22 +259,22 @@ public class DefaultCaret extends Rectangle * Indicates the Caret position should not be changed unless the Document * length becomes less than the Caret position, in which case the Caret * is moved to the end of the Document. - * + * * @since 1.5 */ public static final int NEVER_UPDATE = 1; - - /** + + /** * Indicates the Caret position should be updated only if Document changes * are made on the Event Dispatcher thread. - * + * * @since 1.5 */ public static final int UPDATE_WHEN_ON_EDT = 0; - + /** Keeps track of the current update policy **/ int policy = UPDATE_WHEN_ON_EDT; - + /** * The <code>ChangeEvent</code> that is fired by {@link #fireStateChanged()}. */ @@ -297,7 +297,7 @@ public class DefaultCaret extends Rectangle /** * The text component in which this caret is installed. - * + * * (Package private to avoid synthetic accessor method.) */ JTextComponent textComponent; @@ -332,11 +332,11 @@ public class DefaultCaret extends Rectangle * package private to avoid an accessor method. */ boolean visible = false; - + /** Indicates whether the text component where the caret is installed is * editable and enabled. If either of these properties is <code>false</code> * the caret is not drawn. - */ + */ boolean active = true; /** @@ -345,7 +345,7 @@ public class DefaultCaret extends Rectangle private Object highlightEntry; private Timer blinkTimer; - + private BlinkTimerListener blinkListener; /** @@ -362,10 +362,10 @@ public class DefaultCaret extends Rectangle { // Nothing to do here. } - + /** Returns the caret's <code>NavigationFilter.FilterBypass</code> instance * and creates it if it does not yet exist. - * + * * @return The caret's <code>NavigationFilter.FilterBypass</code> instance. */ private NavigationFilter.FilterBypass getBypass() @@ -375,17 +375,17 @@ public class DefaultCaret extends Rectangle /** * Sets the Caret update policy. - * + * * @param policy the new policy. Valid values are: * ALWAYS_UPDATE: always update the Caret position, even when Document * updates don't occur on the Event Dispatcher thread. * NEVER_UPDATE: don't update the Caret position unless the Document * length becomes less than the Caret position (then update the * Caret to the end of the Document). - * UPDATE_WHEN_ON_EDT: update the Caret position when the - * Document updates occur on the Event Dispatcher thread. This is the + * UPDATE_WHEN_ON_EDT: update the Caret position when the + * Document updates occur on the Event Dispatcher thread. This is the * default. - * + * * @since 1.5 * @throws IllegalArgumentException if policy is not one of the above. */ @@ -393,15 +393,15 @@ public class DefaultCaret extends Rectangle { if (policy != ALWAYS_UPDATE && policy != NEVER_UPDATE && policy != UPDATE_WHEN_ON_EDT) - throw new + throw new IllegalArgumentException ("policy must be ALWAYS_UPDATE, NEVER__UPDATE, or UPDATE_WHEN_ON_EDT"); this.policy = policy; } - + /** * Gets the caret update policy. - * + * * @return the caret update policy. * @since 1.5 */ @@ -409,11 +409,11 @@ public class DefaultCaret extends Rectangle { return policy; } - + /** * Moves the caret position when the mouse is dragged over the text * component, modifying the selectiony. - * + * * <p>When the text component where the caret is installed is disabled, * the selection is not change but you can still scroll the text and * update the caret's location.</p> @@ -462,9 +462,9 @@ public class DefaultCaret extends Rectangle // Do not modify selection if component is disabled. if (!textComponent.isEnabled()) return; - + int count = event.getClickCount(); - + if (event.getButton() == MouseEvent.BUTTON1 && count >= 2) { int newDot = getComponent().viewToModel(event.getPoint()); @@ -480,7 +480,7 @@ public class DefaultCaret extends Rectangle else { int wordStart = Utilities.getWordStart(t, newDot); - + // When the mouse points at the offset of the first character // in a word Utilities().getPreviousWord will not return that // word but we want to select that. We have to use @@ -495,7 +495,7 @@ public class DefaultCaret extends Rectangle int nextWord = Utilities.getNextWord(t, newDot); int previousWord = Utilities.getPreviousWord(t, newDot); int previousWordEnd = Utilities.getWordEnd(t, previousWord); - + // If the user clicked in the space between two words, // then select the space. if (newDot >= previousWordEnd && newDot <= nextWord) @@ -517,7 +517,7 @@ public class DefaultCaret extends Rectangle // TODO: Swallowing ok here? } } - + } /** @@ -552,7 +552,7 @@ public class DefaultCaret extends Rectangle */ public void mousePressed(MouseEvent event) { - + // The implementation assumes that consuming the event makes the AWT event // mechanism forget about this event instance and not transfer focus. // By observing how the RI reacts the following behavior has been @@ -617,14 +617,14 @@ public class DefaultCaret extends Rectangle { if (textComponent.isEditable()) { - setVisible(true); + setVisible(true); updateTimerStatus(); } } /** * Sets the caret to <code>invisible</code>. - * + * * @param event the <code>FocusEvent</code> */ public void focusLost(FocusEvent event) @@ -632,13 +632,13 @@ public class DefaultCaret extends Rectangle if (textComponent.isEditable() && event.isTemporary() == false) { setVisible(false); - + // Stop the blinker, if running. if (blinkTimer != null && blinkTimer.isRunning()) blinkTimer.stop(); } } - + /** * Install (if not present) and start the timer, if the caret must blink. The * caret does not blink if it is invisible, or the component is disabled or @@ -724,11 +724,11 @@ public class DefaultCaret extends Rectangle propertyChangeListener = new PropertyChangeHandler(); textComponent.addPropertyChangeListener(propertyChangeListener); documentListener = new DocumentHandler(); - + Document doc = textComponent.getDocument(); if (doc != null) doc.addDocumentListener(documentListener); - + active = textComponent.isEditable() && textComponent.isEnabled(); repaint(); @@ -769,21 +769,21 @@ public class DefaultCaret extends Rectangle { return mark; } - + private void clearHighlight() { Highlighter highlighter = textComponent.getHighlighter(); - + if (highlighter == null) return; - + if (selectionVisible) { try { if (highlightEntry != null) highlighter.changeHighlight(highlightEntry, 0, 0); - + // Free the global variable which stores the text component with an active // selection. if (componentWithSelection == textComponent) @@ -808,22 +808,22 @@ public class DefaultCaret extends Rectangle private void handleHighlight() { Highlighter highlighter = textComponent.getHighlighter(); - + if (highlighter == null) return; - + int p0 = Math.min(dot, mark); int p1 = Math.max(dot, mark); - + if (selectionVisible) { - try - { - if (highlightEntry == null) - highlightEntry = highlighter.addHighlight(p0, p1, getSelectionPainter()); - else - highlighter.changeHighlight(highlightEntry, p0, p1); - + try + { + if (highlightEntry == null) + highlightEntry = highlighter.addHighlight(p0, p1, getSelectionPainter()); + else + highlighter.changeHighlight(highlightEntry, p0, p1); + // If another component currently has a text selection clear that selection // first. if (componentWithSelection != null) @@ -833,21 +833,21 @@ public class DefaultCaret extends Rectangle c.setDot(c.getDot()); } componentWithSelection = textComponent; - - } - catch (BadLocationException e) - { - // This should never happen. - throw new InternalError(); - } + + } + catch (BadLocationException e) + { + // This should never happen. + throw new InternalError(); + } } else { - if (highlightEntry != null) - { - highlighter.removeHighlight(highlightEntry); - highlightEntry = null; - } + if (highlightEntry != null) + { + highlighter.removeHighlight(highlightEntry); + highlightEntry = null; + } } } @@ -861,7 +861,7 @@ public class DefaultCaret extends Rectangle { if (selectionVisible == v) return; - + selectionVisible = v; handleHighlight(); repaint(); @@ -1049,7 +1049,7 @@ public class DefaultCaret extends Rectangle * * <p>If the underlying text component has a {@link NavigationFilter} * installed the caret will call the corresponding method of that object.</p> - * + * * @param dot the location where to move the dot * * @see #setDot(int) @@ -1062,7 +1062,7 @@ public class DefaultCaret extends Rectangle else moveDotImpl(dot); } - + void moveDotImpl(int dot) { if (dot >= 0) @@ -1071,7 +1071,7 @@ public class DefaultCaret extends Rectangle if (doc != null) this.dot = Math.min(dot, doc.getLength()); this.dot = Math.max(this.dot, 0); - + handleHighlight(); appear(); @@ -1082,10 +1082,10 @@ public class DefaultCaret extends Rectangle * Sets the current position of this <code>Caret</code> within the * <code>Document</code>. This also sets the <code>mark</code> to the new * location. - * + * * <p>If the underlying text component has a {@link NavigationFilter} * installed the caret will call the corresponding method of that object.</p> - * + * * @param dot * the new position to be set * @see #moveDot(int) @@ -1098,27 +1098,27 @@ public class DefaultCaret extends Rectangle else setDotImpl(dot); } - + void setDotImpl(int dot) { if (dot >= 0) - { + { Document doc = textComponent.getDocument(); if (doc != null) this.dot = Math.min(dot, doc.getLength()); this.dot = Math.max(this.dot, 0); this.mark = this.dot; - + clearHighlight(); - + appear(); } } - + /** * Show the caret (may be hidden due blinking) and adjust the timer not to * hide it (possibly immediately). - * + * * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ void appear() @@ -1137,7 +1137,7 @@ public class DefaultCaret extends Rectangle visible = true; Rectangle area = null; - int dot = getDot(); + int dot = getDot(); try { area = getComponent().modelToView(dot); @@ -1158,7 +1158,7 @@ public class DefaultCaret extends Rectangle } } repaint(); - } + } /** * Returns <code>true</code> if this <code>Caret</code> is blinking, @@ -1195,7 +1195,7 @@ public class DefaultCaret extends Rectangle * <code>Caret</code>, <code>false</code> hides it. * * @param v the visibility to set - */ + */ public void setVisible(boolean v) { if (v != visible) @@ -1203,17 +1203,17 @@ public class DefaultCaret extends Rectangle visible = v; updateTimerStatus(); Rectangle area = null; - int dot = getDot(); + int dot = getDot(); try - { + { area = getComponent().modelToView(dot); } 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 (area != null) damage(area); @@ -1258,7 +1258,7 @@ public class DefaultCaret extends Rectangle // Should not happen. throw new InternalError("Caret location not within document range."); } - + repaint(); } @@ -1283,5 +1283,5 @@ public class DefaultCaret extends Rectangle blinkTimer = new Timer(getBlinkRate(), blinkListener); blinkTimer.setRepeats(true); } - + } diff --git a/libjava/classpath/javax/swing/text/DefaultEditorKit.java b/libjava/classpath/javax/swing/text/DefaultEditorKit.java index 0d999a38096..b3b7e6077ef 100644 --- a/libjava/classpath/javax/swing/text/DefaultEditorKit.java +++ b/libjava/classpath/javax/swing/text/DefaultEditorKit.java @@ -79,11 +79,11 @@ public class DefaultEditorKit extends EditorKit try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getPreviousWord(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.moveDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -109,11 +109,11 @@ public class DefaultEditorKit extends EditorKit try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getNextWord(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.moveDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -132,17 +132,17 @@ public class DefaultEditorKit extends EditorKit { super(selectionBeginWordAction); } - + public void actionPerformed(ActionEvent event) { try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getWordStart(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.moveDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -154,24 +154,24 @@ public class DefaultEditorKit extends EditorKit } } } - + static class SelectionEndWordAction extends TextAction { SelectionEndWordAction() { super(selectionEndWordAction); } - + public void actionPerformed(ActionEvent event) { try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getWordEnd(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.moveDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -183,24 +183,24 @@ public class DefaultEditorKit extends EditorKit } } } - + static class BeginWordAction extends TextAction { BeginWordAction() { super(beginWordAction); } - + public void actionPerformed(ActionEvent event) { try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getWordStart(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.setDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -212,24 +212,24 @@ public class DefaultEditorKit extends EditorKit } } } - + static class EndWordAction extends TextAction { EndWordAction() { super(endWordAction); } - + public void actionPerformed(ActionEvent event) { try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getWordEnd(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.setDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -255,11 +255,11 @@ public class DefaultEditorKit extends EditorKit try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getPreviousWord(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.setDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -285,11 +285,11 @@ public class DefaultEditorKit extends EditorKit try { JTextComponent t = getTextComponent(event); - + if (t != null) { int offs = Utilities.getNextWord(t, t.getCaretPosition()); - + Caret c = t.getCaret(); c.setDot(offs); c.setMagicCaretPosition(t.modelToView(offs).getLocation()); @@ -320,7 +320,7 @@ public class DefaultEditorKit extends EditorKit c.setDot(0); c.moveDot(offs); try - { + { c.setMagicCaretPosition(t.modelToView(offs).getLocation()); } catch(BadLocationException ble) @@ -347,7 +347,7 @@ public class DefaultEditorKit extends EditorKit Caret c = t.getCaret(); c.moveDot(0); try - { + { c.setMagicCaretPosition(t.modelToView(0).getLocation()); } catch(BadLocationException ble) @@ -375,7 +375,7 @@ public class DefaultEditorKit extends EditorKit Caret c = t.getCaret(); c.moveDot(offs); try - { + { c.setMagicCaretPosition(t.modelToView(offs).getLocation()); } catch(BadLocationException ble) @@ -385,11 +385,11 @@ public class DefaultEditorKit extends EditorKit } } } - + static class SelectionBeginLineAction extends TextAction { - + SelectionBeginLineAction() { super(selectionBeginLineAction); @@ -440,14 +440,14 @@ public class DefaultEditorKit extends EditorKit } } } - + static class SelectLineAction extends TextAction { SelectLineAction() { super(selectLineAction); } - + public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); @@ -469,14 +469,14 @@ public class DefaultEditorKit extends EditorKit } } } - + static class SelectWordAction extends TextAction { SelectWordAction() { super(selectWordAction); } - + public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); @@ -497,11 +497,11 @@ public class DefaultEditorKit extends EditorKit else { // Current cursor position is not on the first character - // in a word. + // in a word. int nextWord = Utilities.getNextWord(t, dot); int previousWord = Utilities.getPreviousWord(t, dot); int previousWordEnd = Utilities.getWordEnd(t, previousWord); - + // Cursor position is in the space between two words. In such a // situation just select the space. if (dot >= previousWordEnd && dot <= nextWord) @@ -542,7 +542,7 @@ public class DefaultEditorKit extends EditorKit { c.moveDot(offs); } - + } static class SelectionUpAction @@ -614,7 +614,7 @@ public class DefaultEditorKit extends EditorKit { c.setDot(offs); } - + } static class ForwardAction @@ -629,7 +629,7 @@ public class DefaultEditorKit extends EditorKit { c.setDot(offs); } - + } static class BackwardAction @@ -644,7 +644,7 @@ public class DefaultEditorKit extends EditorKit { c.setDot(offs); } - + } static class DeletePrevCharAction @@ -664,7 +664,7 @@ public class DefaultEditorKit extends EditorKit { int pos = t.getSelectionStart(); int len = t.getSelectionEnd() - pos; - + if (len > 0) t.getDocument().remove(pos, len); else if (pos > 0) @@ -701,12 +701,12 @@ public class DefaultEditorKit extends EditorKit { int pos = t.getSelectionStart(); int len = t.getSelectionEnd() - pos; - + if (len > 0) t.getDocument().remove(pos, len); else if (pos < t.getDocument().getLength()) t.getDocument().remove(pos, 1); - + Caret c = t.getCaret(); c.setDot(pos); c.setMagicCaretPosition(t.modelToView(pos).getLocation()); @@ -783,7 +783,7 @@ public class DefaultEditorKit extends EditorKit static class BeginAction extends TextAction { - + BeginAction() { super(beginAction); @@ -810,7 +810,7 @@ public class DefaultEditorKit extends EditorKit static class EndAction extends TextAction { - + EndAction() { super(endAction); @@ -825,7 +825,7 @@ public class DefaultEditorKit extends EditorKit Caret c = t.getCaret(); c.setDot(offs); try - { + { c.setMagicCaretPosition(t.modelToView(offs).getLocation()); } catch(BadLocationException ble) @@ -835,7 +835,7 @@ public class DefaultEditorKit extends EditorKit } } } - + /** * Creates a beep on the PC speaker. * @@ -962,12 +962,12 @@ public class DefaultEditorKit extends EditorKit * event is received and no keymap entry exists for that. The purpose * of this action is to filter out a couple of characters. This includes * the control characters and characters with the ALT-modifier. - * + * * If an event does not get filtered, it is inserted into the document * of the text component. If there is some text selected in the text * component, this text will be replaced. */ - public static class DefaultKeyTypedAction + public static class DefaultKeyTypedAction extends TextAction { @@ -1008,7 +1008,7 @@ public class DefaultEditorKit extends EditorKit } } } - } + } } /** @@ -1481,9 +1481,9 @@ public class DefaultEditorKit extends EditorKit * The <code>Action</code>s that are supported by the * <code>DefaultEditorKit</code>. */ - private static Action[] defaultActions = + private static Action[] defaultActions = new Action[] { - // These classes are public because they are so in the RI. + // These classes are public because they are so in the RI. new BeepAction(), new CopyAction(), new CutAction(), @@ -1492,29 +1492,29 @@ public class DefaultEditorKit extends EditorKit new InsertContentAction(), new InsertTabAction(), new PasteAction(), - + // These are (package-)private inner classes. new DeleteNextCharAction(), new DeletePrevCharAction(), new BeginLineAction(), new SelectionBeginLineAction(), - + new EndLineAction(), new SelectionEndLineAction(), - + new BackwardAction(), new SelectionBackwardAction(), new ForwardAction(), new SelectionForwardAction(), - + new UpAction(), new SelectionUpAction(), new DownAction(), new SelectionDownAction(), - + new NextWordAction(), new SelectionNextWordAction(), @@ -1523,16 +1523,16 @@ public class DefaultEditorKit extends EditorKit new BeginAction(), new SelectionBeginAction(), - + new EndAction(), new SelectionEndAction(), - + new BeginWordAction(), new SelectionBeginWordAction(), - + new EndWordAction(), new SelectionEndWordAction(), - + new SelectAllAction(), new SelectLineAction(), new SelectWordAction() @@ -1640,12 +1640,12 @@ public class DefaultEditorKit extends EditorKit while ((line = reader.readLine()) != null) { - content.append(line); - content.append("\n"); + content.append(line); + content.append("\n"); } - + document.insertString(offset, content.substring(0, content.length() - 1), - SimpleAttributeSet.EMPTY); + SimpleAttributeSet.EMPTY); } /** @@ -1680,7 +1680,7 @@ public class DefaultEditorKit extends EditorKit * @param offset the beginning offset from where to write * @param len the length of the fragment to write * - * @throws BadLocationException if <code>offset</code> is an + * @throws BadLocationException if <code>offset</code> is an * invalid location inside <code>document</code>. * @throws IOException if something goes wrong while writing to * <code>out</code> diff --git a/libjava/classpath/javax/swing/text/DefaultFormatter.java b/libjava/classpath/javax/swing/text/DefaultFormatter.java index bf7c02a004d..cd9829d11bc 100644 --- a/libjava/classpath/javax/swing/text/DefaultFormatter.java +++ b/libjava/classpath/javax/swing/text/DefaultFormatter.java @@ -54,7 +54,7 @@ import javax.swing.JFormattedTextField; * a value, the value class must provide a single argument constructor that * takes a String object as argument value. If no such constructor is found, * the String itself is passed back by #stringToValue. - * + * * @author Roman Kennke (roman@kennke.org) */ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter @@ -89,7 +89,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter checkValidInput(); commitIfAllowed(); } - + /** * Invoked when text is inserted into a text component. * @@ -115,7 +115,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter /** * Invoked when text is replaced in a text component. - * + * * @param bypass the FilterBypass to use to mutate the document * @param offset the start position of the modification * @param length the length of the removed text @@ -176,9 +176,9 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter { // if that happens, something serious must be wrong AssertionError ae; - ae = new AssertionError("values must be parseable"); - ae.initCause(pe); - throw ae; + ae = new AssertionError("values must be parseable"); + ae.initCause(pe); + throw ae; } } } @@ -238,7 +238,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter * one of the mentioned methods in order to customize behaviour. * * @param ftf the {@link JFormattedTextField} in which this formatter - * is installed + * is installed */ public void install(JFormattedTextField ftf) { @@ -287,7 +287,7 @@ public class DefaultFormatter extends JFormattedTextField.AbstractFormatter /** * Sets the value of the <code>overwriteMode</code> property. - * + * * If that is set to <code>true</code> then newly inserted characters * overwrite existing values, otherwise the characters are inserted like * normal. The default is <code>true</code>. diff --git a/libjava/classpath/javax/swing/text/DefaultFormatterFactory.java b/libjava/classpath/javax/swing/text/DefaultFormatterFactory.java index 84a1676d2dc..a6a9defafcd 100644 --- a/libjava/classpath/javax/swing/text/DefaultFormatterFactory.java +++ b/libjava/classpath/javax/swing/text/DefaultFormatterFactory.java @@ -45,19 +45,19 @@ import javax.swing.JFormattedTextField.AbstractFormatter; import javax.swing.JFormattedTextField.AbstractFormatterFactory; /** - * This class is Swing's only concrete implementation of + * This class is Swing's only concrete implementation of * JFormattedTextField.AbstractFormatterFactory. It holds several - * formatters and determines the best one to be used based on the + * formatters and determines the best one to be used based on the * passed-in value from the text field. - * + * * @author Anthony Balkissoon abalkiss at redhat dot com * @since 1.4 */ public class DefaultFormatterFactory extends AbstractFormatterFactory implements Serializable { - /** - * The default formatter. + /** + * The default formatter. **/ AbstractFormatter defaultFormatter; @@ -69,14 +69,14 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements AbstractFormatter editFormatter; /** - * The formatter to use when the JFormattedTextField doesn't havefocus and - * either the value isn't null or the value is null but no + * The formatter to use when the JFormattedTextField doesn't havefocus and + * either the value isn't null or the value is null but no * <code>nullFormatter</code> has been specified. */ AbstractFormatter displayFormatter; /** - * The formatter to use when the value of the JFormattedTextField is null. + * The formatter to use when the value of the JFormattedTextField is null. */ AbstractFormatter nullFormatter; @@ -102,7 +102,7 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements * Creates a new DefaultFormatterFactory with the specified formatters. * @param defaultFormat the formatter to use if no other appropriate non-null * formatted can be found. - * @param displayFormat the formatter to use if the JFormattedTextField + * @param displayFormat the formatter to use if the JFormattedTextField * doesn't have focus and either the value is not null or the value is null * but no <code>nullFormatter</code> has been specified. */ @@ -117,7 +117,7 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements * Creates a new DefaultFormatterFactory with the specified formatters. * @param defaultFormat the formatter to use if no other appropriate non-null * formatted can be found. - * @param displayFormat the formatter to use if the JFormattedTextField + * @param displayFormat the formatter to use if the JFormattedTextField * doesn't have focus and either the value is not null or the value is null * but no <code>nullFormatter</code> has been specified. * @param editFormat the formatter to use if the JFormattedTextField has @@ -137,13 +137,13 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements * Creates a new DefaultFormatterFactory with the specified formatters. * @param defaultFormat the formatter to use if no other appropriate non-null * formatted can be found. - * @param displayFormat the formatter to use if the JFormattedTextField + * @param displayFormat the formatter to use if the JFormattedTextField * doesn't have focus and either the value is not null or the value is null * but no <code>nullFormatter</code> has been specified. * @param editFormat the formatter to use if the JFormattedTextField has * focus and either the value is not null or the value is null but not * <code>nullFormatter</code> has been specified. - * @param nullFormat the formatter to use when the value of the + * @param nullFormat the formatter to use when the value of the * JFormattedTextField is null. */ public DefaultFormatterFactory(AbstractFormatter defaultFormat, @@ -158,9 +158,9 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements } /** - * Returns the formatted to be used if no other appropriate non-null + * Returns the formatted to be used if no other appropriate non-null * formatter can be found. - * @return the formatted to be used if no other appropriate non-null + * @return the formatted to be used if no other appropriate non-null * formatter can be found. */ public AbstractFormatter getDefaultFormatter() @@ -169,7 +169,7 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements } /** - * Sets the formatted to be used if no other appropriate non-null formatter + * Sets the formatted to be used if no other appropriate non-null formatter * can be found. * @param defaultFormatter the formatted to be used if no other appropriate * non-null formatter can be found. @@ -180,13 +180,13 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements } /** - * Gets the <code>displayFormatter</code>. This is the formatter to use if - * the JFormattedTextField is not being edited and either the value is not - * null or the value is null and no <code>nullFormatter<code> has been + * Gets the <code>displayFormatter</code>. This is the formatter to use if + * the JFormattedTextField is not being edited and either the value is not + * null or the value is null and no <code>nullFormatter<code> has been * specified. - * @return the formatter to use if - * the JFormattedTextField is not being edited and either the value is not - * null or the value is null and no <code>nullFormatter<code> has been + * @return the formatter to use if + * the JFormattedTextField is not being edited and either the value is not + * null or the value is null and no <code>nullFormatter<code> has been * specified. */ public AbstractFormatter getDisplayFormatter() @@ -195,9 +195,9 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements } /** - * Sets the <code>displayFormatter</code>. This is the formatter to use if - * the JFormattedTextField is not being edited and either the value is not - * null or the value is null and no <code>nullFormatter<code> has been + * Sets the <code>displayFormatter</code>. This is the formatter to use if + * the JFormattedTextField is not being edited and either the value is not + * null or the value is null and no <code>nullFormatter<code> has been * specified. * @param displayFormatter the formatter to use. */ @@ -208,10 +208,10 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements /** * Gets the <code>editFormatter</code>. This is the formatter to use if the - * JFormattedTextField is being edited and either the value is not null or + * JFormattedTextField is being edited and either the value is not null or * the value is null and no <code>nullFormatter<code> has been specified. * @return the formatter to use if the JFormattedTextField is being edited - * and the value is not null or the value is null but no nullFormatted has + * and the value is not null or the value is null but no nullFormatted has * been specified. */ public AbstractFormatter getEditFormatter() @@ -221,7 +221,7 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements /** * Sets the <code>editFormatter</code>. This is the formatter to use if the - * JFormattedTextField is being edited and either the value is not null or + * JFormattedTextField is being edited and either the value is not null or * the value is null and no <code>nullFormatter<code> has been specified. * @param editFormatter the formatter to use. */ @@ -250,11 +250,11 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements } /** - * Returns the appropriate formatter based on the state of + * Returns the appropriate formatter based on the state of * <code>tf</code>. If <code>tf<code> is null we return null, otherwise * we return one of the following: - * 1. Returns <code>nullFormatter</code> if <code>tf.getValue()</code> is - * null and <code>nullFormatter</code> is not. + * 1. Returns <code>nullFormatter</code> if <code>tf.getValue()</code> is + * null and <code>nullFormatter</code> is not. * 2. Returns <code>editFormatter</code> if <code>tf.hasFocus()</code> is * true and <code>editFormatter</code> is not null. * 3. Returns <code>displayFormatter</code> if <code>tf.hasFocus()</code> is @@ -265,7 +265,7 @@ public class DefaultFormatterFactory extends AbstractFormatterFactory implements { if (tf == null) return null; - + if (tf.getValue() == null && nullFormatter != null) return nullFormatter; diff --git a/libjava/classpath/javax/swing/text/DefaultHighlighter.java b/libjava/classpath/javax/swing/text/DefaultHighlighter.java index 69563e473ac..a4264d31a0d 100644 --- a/libjava/classpath/javax/swing/text/DefaultHighlighter.java +++ b/libjava/classpath/javax/swing/text/DefaultHighlighter.java @@ -51,7 +51,7 @@ import javax.swing.plaf.TextUI; /** * The default highlight for Swing text components. It highlights text - * by filling the background with a rectangle. + * by filling the background with a rectangle. */ public class DefaultHighlighter extends LayeredHighlighter { @@ -59,7 +59,7 @@ public class DefaultHighlighter extends LayeredHighlighter extends LayerPainter { private Color color; - + public DefaultHighlightPainter(Color c) { super(); @@ -72,11 +72,11 @@ public class DefaultHighlighter extends LayeredHighlighter } public void paint(Graphics g, int p0, int p1, Shape bounds, - JTextComponent t) + JTextComponent t) { if (p0 == p1) return; - + Rectangle rect = bounds.getBounds(); Color col = getColor(); @@ -85,13 +85,13 @@ public class DefaultHighlighter extends LayeredHighlighter g.setColor(col); TextUI ui = t.getUI(); - + try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); - + // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. @@ -101,8 +101,8 @@ public class DefaultHighlighter extends LayeredHighlighter // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, - rect.height, l1); - + rect.height, l1); + g.fillRect(l1.x, l1.y, l1.width, l1.height); } else @@ -115,62 +115,62 @@ public class DefaultHighlighter extends LayeredHighlighter // 3. The final line is painted from the left border to the // position of p1. - int firstLineWidth = rect.x + rect.width - l0.x; - g.fillRect(l0.x, l0.y, firstLineWidth, l0.height); - if (l0.y + l0.height != l1.y) - { - g.fillRect(rect.x, l0.y + l0.height, rect.width, - l1.y - l0.y - l0.height); - } - g.fillRect(rect.x, l1.y, l1.x - rect.x, l1.height); - } + int firstLineWidth = rect.x + rect.width - l0.x; + g.fillRect(l0.x, l0.y, firstLineWidth, l0.height); + if (l0.y + l0.height != l1.y) + { + g.fillRect(rect.x, l0.y + l0.height, rect.width, + l1.y - l0.y - l0.height); + } + g.fillRect(rect.x, l1.y, l1.x - rect.x, l1.height); + } } catch (BadLocationException ex) { - // Can't render. Comment out for debugging. - // ex.printStackTrace(); + // Can't render. Comment out for debugging. + // ex.printStackTrace(); } } public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds, - JTextComponent c, View view) + JTextComponent c, View view) { Color col = getColor(); if (col == null) - col = c.getSelectionColor(); + col = c.getSelectionColor(); g.setColor(col); Rectangle rect = null; if (p0 == view.getStartOffset() && p1 == view.getEndOffset()) - { - // Paint complete bounds region. + { + // Paint complete bounds region. rect = bounds instanceof Rectangle ? (Rectangle) bounds - : bounds.getBounds(); - } + : bounds.getBounds(); + } else - { - // Only partly inside the view. + { + // Only partly inside the view. try - { + { Shape s = view.modelToView(p0, Position.Bias.Forward, - p1, Position.Bias.Backward, - bounds); - rect = s instanceof Rectangle ? (Rectangle) s : s.getBounds(); - } - catch (BadLocationException ex) - { - // Can't render the highlight. - } - } + p1, Position.Bias.Backward, + bounds); + rect = s instanceof Rectangle ? (Rectangle) s : s.getBounds(); + } + catch (BadLocationException ex) + { + // Can't render the highlight. + } + } if (rect != null) - { + { g.fillRect(rect.x, rect.y, rect.width, rect.height); - } + } return rect; } } - + private class HighlightEntry implements Highlighter.Highlight { Position p0; @@ -228,28 +228,28 @@ public class DefaultHighlighter extends LayeredHighlighter * and manages the paint rectangle. */ void paintLayeredHighlight(Graphics g, int p0, int p1, Shape bounds, - JTextComponent tc, View view) + JTextComponent tc, View view) { p0 = Math.max(getStartOffset(), p0); p1 = Math.min(getEndOffset(), p1); Highlighter.HighlightPainter painter = getPainter(); if (painter instanceof LayerPainter) - { - LayerPainter layerPainter = (LayerPainter) painter; - Shape area = layerPainter.paintLayer(g, p0, p1, bounds, tc, view); - Rectangle rect; - if (area instanceof Rectangle && paintRect != null) - rect = (Rectangle) area; - else - rect = area.getBounds(); - - if (paintRect.width == 0 || paintRect.height == 0) - paintRect = rect.getBounds(); - else - paintRect = SwingUtilities.computeUnion(rect.x, rect.y, rect.width, - rect.height, paintRect); - } + { + LayerPainter layerPainter = (LayerPainter) painter; + Shape area = layerPainter.paintLayer(g, p0, p1, bounds, tc, view); + Rectangle rect; + if (area instanceof Rectangle && paintRect != null) + rect = (Rectangle) area; + else + rect = area.getBounds(); + + if (paintRect.width == 0 || paintRect.height == 0) + paintRect = rect.getBounds(); + else + paintRect = SwingUtilities.computeUnion(rect.x, rect.y, rect.width, + rect.height, paintRect); + } } } @@ -258,11 +258,11 @@ public class DefaultHighlighter extends LayeredHighlighter */ public static final LayeredHighlighter.LayerPainter DefaultPainter = new DefaultHighlightPainter(null); - + private JTextComponent textComponent; private ArrayList highlights = new ArrayList(); private boolean drawsLayeredHighlights = true; - + public DefaultHighlighter() { // Nothing to do here. @@ -277,13 +277,13 @@ public class DefaultHighlighter extends LayeredHighlighter { drawsLayeredHighlights = newValue; } - + private void checkPositions(int p0, int p1) throws BadLocationException { if (p0 < 0) throw new BadLocationException("DefaultHighlighter", p0); - + if (p1 < p0) throw new BadLocationException("DefaultHighlighter", p1); } @@ -313,9 +313,9 @@ public class DefaultHighlighter extends LayeredHighlighter else entry = new HighlightEntry(pos0, pos1, painter); highlights.add(entry); - + textComponent.getUI().damageRange(textComponent, p0, p1); - + return entry; } @@ -324,16 +324,16 @@ public class DefaultHighlighter extends LayeredHighlighter HighlightEntry entry = (HighlightEntry) tag; if (entry instanceof LayerHighlightEntry) { - LayerHighlightEntry lEntry = (LayerHighlightEntry) entry; - Rectangle paintRect = lEntry.paintRect; - textComponent.repaint(paintRect.x, paintRect.y, paintRect.width, - paintRect.height); + LayerHighlightEntry lEntry = (LayerHighlightEntry) entry; + Rectangle paintRect = lEntry.paintRect; + textComponent.repaint(paintRect.x, paintRect.y, paintRect.width, + paintRect.height); } else { - textComponent.getUI().damageRange(textComponent, - entry.getStartOffset(), - entry.getEndOffset()); + textComponent.getUI().damageRange(textComponent, + entry.getStartOffset(), + entry.getEndOffset()); } highlights.remove(tag); @@ -380,14 +380,14 @@ public class DefaultHighlighter extends LayeredHighlighter TextUI ui = textComponent.getUI(); ui.damageRange(textComponent, p0, p1); } - + } highlights.clear(); } public Highlighter.Highlight[] getHighlights() { - return (Highlighter.Highlight[]) + return (Highlighter.Highlight[]) highlights.toArray(new Highlighter.Highlight[highlights.size()]); } @@ -439,22 +439,22 @@ public class DefaultHighlighter extends LayeredHighlighter { for (Iterator i = highlights.iterator(); i.hasNext();) { - Object o = i.next(); - if (o instanceof LayerHighlightEntry) - { - LayerHighlightEntry entry = (LayerHighlightEntry) o; - int start = entry.getStartOffset(); - int end = entry.getEndOffset(); - if ((p0 < start && p1 > start) || (p0 >= start && p0 < end)) - entry.paintLayeredHighlight(g, p0, p1, viewBounds, editor, view); - } + Object o = i.next(); + if (o instanceof LayerHighlightEntry) + { + LayerHighlightEntry entry = (LayerHighlightEntry) o; + int start = entry.getStartOffset(); + int end = entry.getEndOffset(); + if ((p0 < start && p1 > start) || (p0 >= start && p0 < end)) + entry.paintLayeredHighlight(g, p0, p1, viewBounds, editor, view); + } } } public void paint(Graphics g) { int size = highlights.size(); - + // Check if there are any highlights. if (size == 0) return; @@ -466,11 +466,11 @@ public class DefaultHighlighter extends LayeredHighlighter insets.top, textComponent.getWidth() - insets.left - insets.right, textComponent.getHeight() - insets.top - insets.bottom); - + for (int index = 0; index < size; ++index) { - HighlightEntry entry = (HighlightEntry) highlights.get(index); - if (! (entry instanceof LayerHighlightEntry)) + HighlightEntry entry = (HighlightEntry) highlights.get(index); + if (! (entry instanceof LayerHighlightEntry)) entry.painter.paint(g, entry.getStartOffset(), entry.getEndOffset(), bounds, textComponent); } diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java index 8c70a8a3bfd..9021a199039 100644 --- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java +++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java @@ -62,7 +62,7 @@ import javax.swing.undo.UndoableEdit; * single root, which has one or more {@link AbstractDocument.BranchElement}s * as paragraph nodes and each paragraph node having one or more * {@link AbstractDocument.LeafElement}s as content nodes. - * + * * @author Michael Koch (konqueror@gmx.de) * @author Roman Kennke (roman@kennke.org) */ @@ -72,7 +72,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * An {@link UndoableEdit} that can undo attribute changes to an element. - * + * * @author Roman Kennke (kennke@aicas.com) */ public static class AttributeUndoableEdit extends AbstractUndoableEdit @@ -100,7 +100,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Creates a new <code>AttributeUndoableEdit</code>. - * + * * @param el * the element that changes attributes * @param newAtts @@ -233,7 +233,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Creates a new <code>ElementSpec</code> with no content, length or * offset. This is most useful for start and end tags. - * + * * @param a * the attributes for the element to be created * @param type @@ -248,7 +248,7 @@ public class DefaultStyledDocument extends AbstractDocument implements * Creates a new <code>ElementSpec</code> that specifies the length but * not the offset of an element. Such <code>ElementSpec</code>s are * processed sequentially from a known starting point. - * + * * @param a * the attributes for the element to be created * @param type @@ -263,7 +263,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Creates a new <code>ElementSpec</code> with document content. - * + * * @param a * the attributes for the element to be created * @param type @@ -287,7 +287,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Sets the type of the element. - * + * * @param type * the type of the element to be set */ @@ -298,7 +298,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the type of the element. - * + * * @return the type of the element */ public short getType() @@ -308,7 +308,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Sets the direction of the element. - * + * * @param dir * the direction of the element to be set */ @@ -319,7 +319,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the direction of the element. - * + * * @return the direction of the element */ public short getDirection() @@ -329,7 +329,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the attributes of the element. - * + * * @return the attributes of the element */ public AttributeSet getAttributes() @@ -339,7 +339,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the actual content of the element. - * + * * @return the actual content of the element */ public char[] getArray() @@ -349,7 +349,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the offset of the content. - * + * * @return the offset of the content */ public int getOffset() @@ -359,7 +359,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the length of the content. - * + * * @return the length of the content */ public int getLength() @@ -371,7 +371,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() @@ -534,7 +534,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Creates a new <code>ElementBuffer</code> for the specified * <code>root</code> element. - * + * * @param root * the root element for this <code>ElementBuffer</code> */ @@ -545,7 +545,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the root element of this <code>ElementBuffer</code>. - * + * * @return the root element of this <code>ElementBuffer</code> */ public Element getRootElement() @@ -556,7 +556,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Removes the content. This method sets some internal parameters and * delegates the work to {@link #removeUpdate}. - * + * * @param offs * the offset from which content is remove * @param len @@ -583,7 +583,7 @@ public class DefaultStyledDocument extends AbstractDocument implements private boolean removeElements(Element elem, int rmOffs0, int rmOffs1) { - boolean ret = false; + boolean ret = false; if (! elem.isLeaf()) { // Update stack for changes. @@ -874,7 +874,7 @@ public class DefaultStyledDocument extends AbstractDocument implements * created as necessary. This also updates the * <code>DefaultDocumentEvent</code> to reflect the structural changes. * The bulk work is delegated to {@link #changeUpdate()}. - * + * * @param offset * the start index of the interval to be changed * @param length @@ -967,7 +967,7 @@ public class DefaultStyledDocument extends AbstractDocument implements * Inserts new <code>Element</code> in the document at the specified * position. Most of the work is done by {@link #insertUpdate}, after some * fields have been prepared for it. - * + * * @param offset * the location in the document at which the content is inserted * @param length @@ -982,11 +982,11 @@ public class DefaultStyledDocument extends AbstractDocument implements DefaultDocumentEvent ev) { if (length > 0) - { - prepareEdit(offset, length); - insertUpdate(data); - finishEdit(ev); - } + { + prepareEdit(offset, length); + insertUpdate(data); + finishEdit(ev); + } } /** @@ -1003,14 +1003,14 @@ public class DefaultStyledDocument extends AbstractDocument implements this.length = length; if (edits == null) - edits = new ArrayList(); + edits = new ArrayList(); else - edits.clear(); + edits.clear(); if (elementStack == null) - elementStack = new Stack(); + elementStack = new Stack(); else - elementStack.clear(); + elementStack.clear(); fracturedParent = null; fracturedChild = null; @@ -1029,7 +1029,7 @@ public class DefaultStyledDocument extends AbstractDocument implements // This for loop applies all the changes that were made and updates the // DocumentEvent. for (Iterator i = edits.iterator(); i.hasNext();) - { + { Edit edits = (Edit) i.next(); Element[] removed = new Element[edits.removed.size()]; removed = (Element[]) edits.removed.toArray(removed); @@ -1040,14 +1040,14 @@ public class DefaultStyledDocument extends AbstractDocument implements parent.replace(index, removed.length, added); ElementEdit ee = new ElementEdit(parent, index, removed, added); ev.addEdit(ee); - } + } edits.clear(); elementStack.clear(); } /** * Inserts new content. - * + * * @param data the element specifications for the elements to be inserted */ protected void insertUpdate(ElementSpec[] data) @@ -1130,7 +1130,7 @@ public class DefaultStyledDocument extends AbstractDocument implements p < data.length && data[p].getType() == ElementSpec.EndTagType; p++) ; - + Edit edit = insertPath[insertPath.length - p - 1]; edit.index--; edit.removed.add(0, edit.e.getElement(edit.index)); @@ -1162,7 +1162,7 @@ public class DefaultStyledDocument extends AbstractDocument implements { if (elementStack.isEmpty()) return; - + Edit edit = (Edit) elementStack.peek(); switch (spec.getType()) { @@ -1223,7 +1223,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Inserts the first tag into the document. - * + * * @param data - * the data to be inserted. */ @@ -1301,7 +1301,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Inserts a content element into the document structure. - * + * * @param tag - * the element spec */ @@ -1342,7 +1342,7 @@ public class DefaultStyledDocument extends AbstractDocument implements edit.removed.add(first); } } - else + else { Element leaf = createLeafElement(edit.e, tag.getAttributes(), pos, pos + len); @@ -1350,13 +1350,13 @@ public class DefaultStyledDocument extends AbstractDocument implements } pos += len; - + } /** * This method fractures bottomost leaf in the elementStack. This * happens when the first inserted tag is not content. - * + * * @param data * the ElementSpecs used for the entire insertion */ @@ -1644,12 +1644,12 @@ public class DefaultStyledDocument extends AbstractDocument implements ec.added.add(e); e = createLeafElement(ec.e, child.getAttributes(), pos, child.getEndOffset()); - + ec.added.add(e); } } return splitEnd; - + } } @@ -1672,7 +1672,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the name of the element. This method always returns * "section". - * + * * @return the name of the element */ public String getName() @@ -1684,7 +1684,7 @@ 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 @@ -1693,7 +1693,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Receives notification when any of the document's style changes and calls * {@link DefaultStyledDocument#styleChanged(Style)}. - * + * * @param event * the change event */ @@ -1734,7 +1734,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Creates a new <code>DefaultStyledDocument</code> that uses the specified * {@link StyleContext}. - * + * * @param context * the <code>StyleContext</code> to use */ @@ -1746,7 +1746,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Creates a new <code>DefaultStyledDocument</code> that uses the specified * {@link StyleContext} and {@link Content} buffer. - * + * * @param content * the <code>Content</code> buffer to use * @param context @@ -1790,7 +1790,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() @@ -1814,7 +1814,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the <code>Element</code> that corresponds to the character at the * specified position. - * + * * @param position * the position of which we query the corresponding * <code>Element</code> @@ -1836,7 +1836,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Extracts a background color from a set of attributes. - * + * * @param attributes * the attributes from which to get a background color * @return the background color that correspond to the attributes @@ -1849,7 +1849,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the default root element. - * + * * @return the default root element */ public Element getDefaultRootElement() @@ -1859,7 +1859,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Extracts a font from a set of attributes. - * + * * @param attributes * the attributes from which to get a font * @return the font that correspond to the attributes @@ -1872,7 +1872,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Extracts a foreground color from a set of attributes. - * + * * @param attributes * the attributes from which to get a foreground color * @return the foreground color that correspond to the attributes @@ -1885,7 +1885,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns the logical <code>Style</code> for the specified position. - * + * * @param position * the position from which to query to logical style * @return the logical <code>Style</code> for the specified position @@ -1907,7 +1907,7 @@ public class DefaultStyledDocument extends AbstractDocument implements * element is returned. That is the last paragraph if * <code>position >= endIndex</code> or the first paragraph if * <code>position < startIndex</code>. - * + * * @param position * the position for which to query the paragraph element * @return the paragraph element for the specified position @@ -1925,7 +1925,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Looks up and returns a named <code>Style</code>. - * + * * @param nm * the name of the <code>Style</code> * @return the found <code>Style</code> of <code>null</code> if no such @@ -1939,7 +1939,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Removes a named <code>Style</code> from the style hierarchy. - * + * * @param nm * the name of the <code>Style</code> to be removed */ @@ -1952,7 +1952,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Sets text attributes for the fragment specified by <code>offset</code> * and <code>length</code>. - * + * * @param offset * the start offset of the fragment * @param length @@ -2015,7 +2015,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Sets the logical style for the paragraph at the specified position. - * + * * @param position * the position at which the logical style is added * @param style @@ -2056,7 +2056,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Sets text attributes for the paragraph at the specified fragment. - * + * * @param offset * the beginning of the fragment * @param length @@ -2115,7 +2115,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Called in response to content insert actions. This is used to update the * element structure. - * + * * @param ev * the <code>DocumentEvent</code> describing the change * @param attr @@ -2310,7 +2310,7 @@ public class DefaultStyledDocument extends AbstractDocument implements } if (e != null) - + { // e is now the common parent. // Insert the end tags. @@ -2342,7 +2342,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * 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. */ @@ -2369,7 +2369,7 @@ public class DefaultStyledDocument extends AbstractDocument implements * forwarded to the {@link ElementBuffer} of this document. Any changes to the * document structure are added to the specified document event and sent to * registered listeners. - * + * * @param ev * the document event that records the changes to the document */ @@ -2381,7 +2381,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Returns an enumeration of all style names. - * + * * @return an enumeration of all style names */ public Enumeration<?> getStyleNames() @@ -2392,7 +2392,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Called when any of this document's styles changes. - * + * * @param style * the style that changed */ @@ -2403,7 +2403,7 @@ 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 @@ -2469,7 +2469,7 @@ public class DefaultStyledDocument extends AbstractDocument implements /** * Initializes the <code>DefaultStyledDocument</code> with the specified * data. - * + * * @param data * the specification of the content with which the document is * initialized diff --git a/libjava/classpath/javax/swing/text/DocumentFilter.java b/libjava/classpath/javax/swing/text/DocumentFilter.java index f86f41ca6c0..1f7e8a68917 100644 --- a/libjava/classpath/javax/swing/text/DocumentFilter.java +++ b/libjava/classpath/javax/swing/text/DocumentFilter.java @@ -48,21 +48,21 @@ public class DocumentFilter } public abstract Document getDocument(); - + public abstract void insertString(int offset, String string, - AttributeSet attr) + AttributeSet attr) throws BadLocationException; - + public abstract void remove(int offset, int length) throws BadLocationException; - + public abstract void replace(int offset, int length, String string, - AttributeSet attrs) + AttributeSet attrs) throws BadLocationException; } - + public void insertString(DocumentFilter.FilterBypass fb, int offset, - String string, AttributeSet attr) + String string, AttributeSet attr) throws BadLocationException { fb.insertString(offset, string, attr); @@ -75,7 +75,7 @@ public class DocumentFilter } public void replace(DocumentFilter.FilterBypass fb, int offset, int length, - String text, AttributeSet attr) + String text, AttributeSet attr) throws BadLocationException { fb.replace(offset, length, text, attr); diff --git a/libjava/classpath/javax/swing/text/EditorKit.java b/libjava/classpath/javax/swing/text/EditorKit.java index 8719aee595f..62b4a64862c 100644 --- a/libjava/classpath/javax/swing/text/EditorKit.java +++ b/libjava/classpath/javax/swing/text/EditorKit.java @@ -51,7 +51,7 @@ import javax.swing.JEditorPane; public abstract class EditorKit implements Cloneable, Serializable { private static final long serialVersionUID = -5044124649345887822L; - + public EditorKit() { // Nothing to do here. diff --git a/libjava/classpath/javax/swing/text/Element.java b/libjava/classpath/javax/swing/text/Element.java index eb53ee9d3e1..83d88356571 100644 --- a/libjava/classpath/javax/swing/text/Element.java +++ b/libjava/classpath/javax/swing/text/Element.java @@ -1,4 +1,4 @@ -/* Element.java -- +/* Element.java -- Copyright (C) 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/text/ElementIterator.java b/libjava/classpath/javax/swing/text/ElementIterator.java index 112d55e96d0..141137e2ce7 100644 --- a/libjava/classpath/javax/swing/text/ElementIterator.java +++ b/libjava/classpath/javax/swing/text/ElementIterator.java @@ -7,7 +7,7 @@ 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 @@ -49,7 +49,7 @@ import java.util.Stack; public class ElementIterator implements Cloneable { /** - * Uses to track the iteration on the stack. + * Uses to track the iteration on the stack. */ private class ElementRef { @@ -110,12 +110,12 @@ public class ElementIterator implements Cloneable { try { - return super.clone(); + return super.clone(); } catch (CloneNotSupportedException _) { - // Can't happen. - return null; + // Can't happen. + return null; } } diff --git a/libjava/classpath/javax/swing/text/EmptyAttributeSet.java b/libjava/classpath/javax/swing/text/EmptyAttributeSet.java index 98fb8828c89..92263bc1a55 100644 --- a/libjava/classpath/javax/swing/text/EmptyAttributeSet.java +++ b/libjava/classpath/javax/swing/text/EmptyAttributeSet.java @@ -108,7 +108,7 @@ final class EmptyAttributeSet { throw new NoSuchElementException("No more elements"); } - + }; } diff --git a/libjava/classpath/javax/swing/text/FieldView.java b/libjava/classpath/javax/swing/text/FieldView.java index e357a1e056b..c47bef9f7b6 100644 --- a/libjava/classpath/javax/swing/text/FieldView.java +++ b/libjava/classpath/javax/swing/text/FieldView.java @@ -1,4 +1,4 @@ -/* FieldView.java -- +/* FieldView.java -- Copyright (C) 2004, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,36 +56,36 @@ import javax.swing.event.DocumentEvent; public class FieldView extends PlainView { BoundedRangeModel horizontalVisibility; - + /** Caches the preferred span of the X axis. It is invalidated by * setting it to -1f. This is done when text in the document * is inserted, removed or changed. The value is corrected as - * soon as calculateHorizontalSpan() is called. + * soon as calculateHorizontalSpan() is called. */ float cachedSpan = -1f; public FieldView(Element elem) { super(elem); - + } - + /** Checks whether the given container is a JTextField. If so * it retrieves the textfield's horizontalVisibility instance. - * + * * <p>This method should be only called when the view's container * is valid. Naturally that would be the setParent() method however * that method is not overridden in the RI and that is why we chose * paint() instead.</p> - */ + */ private void checkContainer() { Container c = getContainer(); - + if (c instanceof JTextField) { horizontalVisibility = ((JTextField) c).getHorizontalVisibility(); - + // Provokes a repaint when the BoundedRangeModel's values change // (which is what the RI does). horizontalVisibility.addChangeListener(new ChangeListener(){ @@ -98,25 +98,25 @@ public class FieldView extends PlainView // and needs to be recalculated (e.g. a different font setting is // not taken into account). calculateHorizontalSpan(); - + // Initializes the BoundedRangeModel properly. updateVisibility(); } - + } - + private void updateVisibility() { JTextField tf = (JTextField) getContainer(); Insets insets = tf.getInsets(); int width = tf.getWidth() - insets.left - insets.right; - + horizontalVisibility.setMaximum(Math.max((int) ((cachedSpan != -1f) ? cachedSpan : calculateHorizontalSpan()), width)); - + horizontalVisibility.setExtent(width - 1); } @@ -140,7 +140,7 @@ public class FieldView extends PlainView // Return null when the original allocation is null (like the RI). if (shape == null) return null; - + Rectangle rectIn = shape.getBounds(); // vertical adjustment int height = (int) getPreferredSpan(Y_AXIS); @@ -177,7 +177,7 @@ public class FieldView extends PlainView x = rectIn.x; break; } - + return new Rectangle(x, y, width, height); } @@ -192,13 +192,13 @@ public class FieldView extends PlainView if (cachedSpan != -1f) return cachedSpan; - + return calculateHorizontalSpan(); } - + /** Calculates and sets the horizontal span and stores the value * in cachedSpan. - */ + */ private float calculateHorizontalSpan() { Segment s = getLineBuffer(); @@ -209,15 +209,15 @@ public class FieldView extends PlainView elem.getDocument().getText(elem.getStartOffset(), elem.getEndOffset() - 1, s); - + return cachedSpan = Utilities.getTabbedTextWidth(s, getFontMetrics(), 0, this, s.offset); } catch (BadLocationException e) { - // Should never happen - AssertionError ae = new AssertionError(); - ae.initCause(e); - throw ae; + // Should never happen + AssertionError ae = new AssertionError(); + ae.initCause(e); + throw ae; } } @@ -225,21 +225,21 @@ public class FieldView extends PlainView { return axis == X_AXIS ? 1 : 0; } - + public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { Shape newAlloc = adjustAllocation(a); return super.modelToView(pos, newAlloc, bias); } - + public void paint(Graphics g, Shape s) { if (horizontalVisibility == null) checkContainer(); Shape newAlloc = adjustAllocation(s); - + Shape clip = g.getClip(); if (clip != null) { @@ -262,18 +262,18 @@ public class FieldView extends PlainView super.paint(g, newAlloc); g.setClip(clip); - + } public void insertUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { cachedSpan = -1f; - + if (horizontalVisibility != null) updateVisibility(); - + Shape newAlloc = adjustAllocation(shape); - + super.insertUpdate(ev, newAlloc, vf); getContainer().repaint(); } @@ -281,7 +281,7 @@ public class FieldView extends PlainView public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { cachedSpan = -1f; - + if (horizontalVisibility != null) updateVisibility(); @@ -293,7 +293,7 @@ public class FieldView extends PlainView public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { cachedSpan = -1f; - + if (horizontalVisibility != null) updateVisibility(); @@ -306,5 +306,5 @@ public class FieldView extends PlainView { return super.viewToModel(fx, fy, adjustAllocation(a), bias); } - + } diff --git a/libjava/classpath/javax/swing/text/FlowView.java b/libjava/classpath/javax/swing/text/FlowView.java index c2bed399f3a..a9a80833a3b 100644 --- a/libjava/classpath/javax/swing/text/FlowView.java +++ b/libjava/classpath/javax/swing/text/FlowView.java @@ -216,7 +216,7 @@ public abstract class FlowView extends BoxView * the logical view. If the available space is exhausted, * {@link #adjustRow(FlowView, int, int, int)} is called to fit the row into * the available span. - * + * * @param fv the flow view for which we perform the layout * @param rowIndex the index of the row * @param pos the model position for the beginning of the row @@ -616,7 +616,7 @@ public abstract class FlowView extends BoxView { int axis = getAxis(); int flowAxis; - + if (axis == X_AXIS) flowAxis = Y_AXIS; else @@ -697,7 +697,7 @@ public abstract class FlowView extends BoxView protected void layout(int width, int height) { int flowAxis = getFlowAxis(); - int span; + int span; if (flowAxis == X_AXIS) span = (int) width; else diff --git a/libjava/classpath/javax/swing/text/GapContent.java b/libjava/classpath/javax/swing/text/GapContent.java index 08a318d8bb4..2e68fb5fefa 100644 --- a/libjava/classpath/javax/swing/text/GapContent.java +++ b/libjava/classpath/javax/swing/text/GapContent.java @@ -64,7 +64,7 @@ import javax.swing.undo.UndoableEdit; public class GapContent implements AbstractDocument.Content, Serializable { - + /** * A {@link Position} implementation for <code>GapContent</code>. */ @@ -80,7 +80,7 @@ public class GapContent /** * Returns the current offset of this Position within the content. - * + * * @return the current offset of this Position within the content. */ public int getOffset() @@ -94,7 +94,7 @@ public class GapContent * the actual offset of the position. This is pulled out of the * GapContentPosition object so that the mark and position can be handled * independently, and most important, so that the GapContentPosition can - * be garbage collected while we still hold a reference to the Mark object. + * be garbage collected while we still hold a reference to the Mark object. */ private class Mark extends WeakReference @@ -149,7 +149,7 @@ public class GapContent /** * Stores a reference to a mark that can be resetted to the original value - * after a mark has been moved. This is used for undoing actions. + * after a mark has been moved. This is used for undoing actions. */ private class UndoPosRef { @@ -213,7 +213,7 @@ public class GapContent throw new CannotUndoException(); } } - + public void redo () throws CannotUndoException { super.redo(); @@ -231,9 +231,9 @@ public class GapContent throw new CannotRedoException(); } } - + } - + private class UndoRemove extends AbstractUndoableEdit { public int where; @@ -265,7 +265,7 @@ public class GapContent throw new CannotUndoException(); } } - + public void redo () throws CannotUndoException { super.redo(); @@ -280,7 +280,7 @@ public class GapContent throw new CannotRedoException(); } } - + } /** The serialization UID (compatible with JDK1.5). */ @@ -348,7 +348,7 @@ public class GapContent /** * Creates a new GapContent object with a specified initial size. - * + * * @param size the initial size of the buffer */ public GapContent(int size) @@ -365,9 +365,9 @@ public class GapContent /** * Allocates an array of the specified length that can then be used as * buffer. - * + * * @param size the size of the array to be allocated - * + * * @return the allocated array */ protected Object allocateArray(int size) @@ -377,7 +377,7 @@ public class GapContent /** * Returns the length of the allocated buffer array. - * + * * @return the length of the allocated buffer array */ protected int getArrayLength() @@ -387,7 +387,7 @@ public class GapContent /** * Returns the length of the content. - * + * * @return the length of the content */ public int length() @@ -397,12 +397,12 @@ public class GapContent /** * Inserts a string at the specified position. - * + * * @param where the position where the string is inserted * @param str the string that is to be inserted - * + * * @return an UndoableEdit object - * + * * @throws BadLocationException if <code>where</code> is not a valid * location in the buffer */ @@ -429,12 +429,12 @@ public class GapContent /** * Removes a piece of content at th specified position. - * + * * @param where the position where the content is to be removed * @param nitems number of characters to be removed - * + * * @return an UndoableEdit object - * + * * @throws BadLocationException if <code>where</code> is not a valid * location in the buffer */ @@ -442,11 +442,11 @@ public class GapContent { // check arguments int length = length(); - + if ((where + nitems) >= length) throw new BadLocationException("where + nitems cannot be greater" + " than the content length", where + nitems); - + String removedText = getString(where, nitems); UndoRemove undoRemove = new UndoRemove(where, removedText); replace(where, nitems, null, 0); @@ -456,10 +456,10 @@ public class GapContent /** * Returns a piece of content as String. - * + * * @param where the start location of the fragment * @param len the length of the fragment - * + * * @throws BadLocationException if <code>where</code> or * <code>where + len</code> are no valid locations in the buffer */ @@ -487,15 +487,15 @@ public class GapContent /** * Fetches a piece of content and stores it in a {@link Segment} object. - * + * * If the requested piece of text spans the gap, the content is copied into a * new array. If it doesn't then it is contiguous and the actual content * store is returned. - * + * * @param where the start location of the fragment * @param len the length of the fragment * @param txt the Segment object to store the fragment in - * + * * @throws BadLocationException if <code>where</code> or * <code>where + len</code> are no valid locations in the buffer */ @@ -515,7 +515,7 @@ public class GapContent if (len < 0) throw new BadLocationException("negative length not allowed: ", len); - // Optimized to copy only when really needed. + // Optimized to copy only when really needed. if (where + len <= gapStart) { // Simple case: completely before gap. @@ -556,11 +556,11 @@ public class GapContent /** * Creates and returns a mark at the specified position. - * + * * @param offset the position at which to create the mark - * + * * @return the create Position object for the mark - * + * * @throws BadLocationException if the offset is not a valid position in the * buffer */ @@ -597,7 +597,7 @@ public class GapContent marks.add(insertIndex, m); } // Otherwise use the found position. - + return pos; } @@ -606,7 +606,7 @@ public class GapContent * segment before the gap as it is and the segment after the gap at the end * of the new buffer array. This does change the gapEnd mark but not the * gapStart mark. - * + * * @param newSize the new size of the gap */ protected void shiftEnd(int newSize) @@ -641,7 +641,7 @@ public class GapContent /** * Shifts the gap to the specified position. - * + * * @param newGapStart the new start position of the gap */ protected void shiftGap(int newGapStart) @@ -746,14 +746,14 @@ public class GapContent m.mark = newGapEnd; } - + gapEnd = newGapEnd; resetMarksAtZero(); } /** * Returns the allocated buffer array. - * + * * @return the allocated buffer array */ protected final Object getArray() @@ -763,7 +763,7 @@ public class GapContent /** * Replaces a portion of the storage with the specified items. - * + * * @param position the position at which to remove items * @param rmSize the number of items to remove * @param addItems the items to add at location @@ -915,7 +915,7 @@ public class GapContent } return v; } - + /** * Resets all <code>Position</code> that have an offset of <code>0</code>, * to also have an array index of <code>0</code>. This might be necessary diff --git a/libjava/classpath/javax/swing/text/GlyphView.java b/libjava/classpath/javax/swing/text/GlyphView.java index 6bc2a382c52..3f4ccf9c269 100644 --- a/libjava/classpath/javax/swing/text/GlyphView.java +++ b/libjava/classpath/javax/swing/text/GlyphView.java @@ -110,7 +110,7 @@ public class GlyphView extends View implements TabableView, Cloneable /** * Determines the model offset, so that the text between <code>p0</code> * and this offset fits within the span starting at <code>x</code> with - * the length of <code>len</code>. + * the length of <code>len</code>. * * @param v the glyph view * @param p0 the starting offset in the model @@ -403,7 +403,7 @@ public class GlyphView extends View implements TabableView, Cloneable : Position.Bias.Backward; return pos + v.getStartOffset(); } - + } /** @@ -424,7 +424,7 @@ public class GlyphView extends View implements TabableView, Cloneable float height = fontMetrics.getHeight(); return height; } - + /** * Paints the glyphs. * @@ -562,7 +562,7 @@ public class GlyphView extends View implements TabableView, Cloneable /** * Determines the model offset, so that the text between <code>p0</code> * and this offset fits within the span starting at <code>x</code> with - * the length of <code>len</code>. + * the length of <code>len</code>. * * @param v the glyph view * @param p0 the starting offset in the model @@ -739,7 +739,7 @@ public class GlyphView extends View implements TabableView, Cloneable g.fillRect(r.x, r.y, r.width, r.height); } - + // Paint layered highlights if there are any. if (tc != null) { @@ -972,11 +972,11 @@ public class GlyphView extends View implements TabableView, Cloneable } catch (BadLocationException ex) { - AssertionError ae; + AssertionError ae; ae = new AssertionError("BadLocationException should not be " - + "thrown here. p0 = " + p0 + ", p1 = " + p1); - ae.initCause(ex); - throw ae; + + "thrown here. p0 = " + p0 + ", p1 = " + p1); + ae.initCause(ex); + throw ae; } return cached; diff --git a/libjava/classpath/javax/swing/text/Highlighter.java b/libjava/classpath/javax/swing/text/Highlighter.java index 91f3b7903d0..b4b671ac4f6 100644 --- a/libjava/classpath/javax/swing/text/Highlighter.java +++ b/libjava/classpath/javax/swing/text/Highlighter.java @@ -57,7 +57,7 @@ public interface Highlighter { void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c); } - + void install(JTextComponent c); void deinstall(JTextComponent c); @@ -76,4 +76,3 @@ public interface Highlighter void paint(Graphics g); } - diff --git a/libjava/classpath/javax/swing/text/InternationalFormatter.java b/libjava/classpath/javax/swing/text/InternationalFormatter.java index 1de5ca27126..8dcd03a3f84 100644 --- a/libjava/classpath/javax/swing/text/InternationalFormatter.java +++ b/libjava/classpath/javax/swing/text/InternationalFormatter.java @@ -206,7 +206,7 @@ public class InternationalFormatter * one of the mentioned methods in order to customize behaviour. * * @param ftf the {@link JFormattedTextField} in which this formatter - * is installed + * is installed */ public void install(JFormattedTextField ftf) { diff --git a/libjava/classpath/javax/swing/text/JTextComponent.java b/libjava/classpath/javax/swing/text/JTextComponent.java index 24035e35ac2..a118cf86df6 100644 --- a/libjava/classpath/javax/swing/text/JTextComponent.java +++ b/libjava/classpath/javax/swing/text/JTextComponent.java @@ -246,7 +246,7 @@ public abstract class JTextComponent extends JComponent { return this; } - + /** * Handle a text insertion event and fire an * AccessibleContext.ACCESSIBLE_TEXT_PROPERTY property change @@ -313,7 +313,7 @@ public abstract class JTextComponent extends JComponent public Rectangle getCharacterBounds(int index) { // This is basically the same as BasicTextUI.modelToView(). - + Rectangle bounds = null; if (index >= 0 && index < doc.getLength() - 1) { @@ -368,12 +368,12 @@ public abstract class JTextComponent extends JComponent return JTextComponent.this.getText().length(); } - /** + /** * Gets the character attributes of the character at index. If * the index is out of bounds, null is returned. * * @param index - index of the character - * + * * @return the character's attributes */ public AttributeSet getCharacterAttribute(int index) @@ -402,24 +402,24 @@ public abstract class JTextComponent extends JComponent /** * Gets the text located at index. null is returned if the index * or part is invalid. - * + * * @param part - {@link #CHARACTER}, {@link #WORD}, or {@link #SENTENCE} * @param index - index of the part - * + * * @return the part of text at that index, or null */ public String getAtIndex(int part, int index) { return getAtIndexImpl(part, index, 0); } - + /** * Gets the text located after index. null is returned if the index * or part is invalid. - * + * * @param part - {@link #CHARACTER}, {@link #WORD}, or {@link #SENTENCE} * @param index - index after the part - * + * * @return the part of text after that index, or null */ public String getAfterIndex(int part, int index) @@ -430,10 +430,10 @@ public abstract class JTextComponent extends JComponent /** * Gets the text located before index. null is returned if the index * or part is invalid. - * + * * @param part - {@link #CHARACTER}, {@link #WORD}, or {@link #SENTENCE} * @param index - index before the part - * + * * @return the part of text before that index, or null */ public String getBeforeIndex(int part, int index) @@ -518,20 +518,20 @@ public abstract class JTextComponent extends JComponent /** * Returns the number of actions for this object. The zero-th * object represents the default action. - * + * * @return the number of actions (0-based). */ public int getAccessibleActionCount() { return getActions().length; } - + /** * Returns the description of the i-th action. Null is returned if * i is out of bounds. - * + * * @param i - the action to get the description for - * + * * @return description of the i-th action */ public String getAccessibleActionDescription(int i) @@ -542,13 +542,13 @@ public abstract class JTextComponent extends JComponent desc = (String) actions[i].getValue(Action.NAME); return desc; } - + /** - * Performs the i-th action. Nothing happens if i is + * Performs the i-th action. Nothing happens if i is * out of bounds. * * @param i - the action to perform - * + * * @return true if the action was performed successfully */ public boolean doAccessibleAction(int i) @@ -564,7 +564,7 @@ public abstract class JTextComponent extends JComponent } return ret; } - + /** * Sets the text contents. * @@ -727,7 +727,7 @@ public abstract class JTextComponent extends JComponent * objects, by delegation to the underlying {@link Keymap}.</li> * * <li>KeymapActionMap extends {@link ActionMap} also holds a reference to - * the underlying {@link Keymap} but only appears to use it for listing + * the underlying {@link Keymap} but only appears to use it for listing * its keys. </li> * * <li>KeymapActionMap maps all {@link Action} objects to @@ -774,7 +774,7 @@ public abstract class JTextComponent extends JComponent public KeyStroke[] keys() { KeyStroke[] superKeys = super.keys(); - KeyStroke[] mapKeys = map.getBoundKeyStrokes(); + KeyStroke[] mapKeys = map.getBoundKeyStrokes(); KeyStroke[] bothKeys = new KeyStroke[superKeys.length + mapKeys.length]; for (int i = 0; i < superKeys.length; ++i) bothKeys[i] = superKeys[i]; @@ -824,22 +824,22 @@ public abstract class JTextComponent extends JComponent return map.getBoundKeyStrokes().length + super.size(); } - public Object[] keys() + public Object[] keys() { Object[] superKeys = super.keys(); - Object[] mapKeys = map.getBoundKeyStrokes(); + Object[] mapKeys = map.getBoundKeyStrokes(); Object[] bothKeys = new Object[superKeys.length + mapKeys.length]; for (int i = 0; i < superKeys.length; ++i) bothKeys[i] = superKeys[i]; for (int i = 0; i < mapKeys.length; ++i) bothKeys[i + superKeys.length] = mapKeys[i]; - return bothKeys; + return bothKeys; } public Object[] allKeys() { Object[] superKeys = super.allKeys(); - Object[] mapKeys = map.getBoundKeyStrokes(); + Object[] mapKeys = map.getBoundKeyStrokes(); Object[] bothKeys = new Object[superKeys.length + mapKeys.length]; for (int i = 0; i < superKeys.length; ++i) bothKeys[i] = superKeys[i]; @@ -929,10 +929,10 @@ public abstract class JTextComponent extends JComponent i = 0; e = map.keys(); while (e.hasMoreElements()) - { + { KeyStroke k = (KeyStroke) e.nextElement(); if (map.get(k).equals(a)) - ret[i++] = k; + ret[i++] = k; } return ret; } @@ -978,21 +978,21 @@ public abstract class JTextComponent extends JComponent public boolean canImport(JComponent component, DataFlavor[] flavors) { JTextComponent textComponent = (JTextComponent) component; - + if (! (textComponent.isEnabled() - && textComponent.isEditable() - && flavors != null)) + && textComponent.isEditable() + && flavors != null)) return false; for (int i = 0; i < flavors.length; ++i) - if (flavors[i].equals(DataFlavor.stringFlavor)) - return true; + if (flavors[i].equals(DataFlavor.stringFlavor)) + return true; return false; } - + public void exportToClipboard(JComponent component, Clipboard clipboard, - int action) + int action) { JTextComponent textComponent = (JTextComponent) component; int start = textComponent.getSelectionStart(); @@ -1017,7 +1017,7 @@ public abstract class JTextComponent extends JComponent // Ignore this and do nothing. } } - + public int getSourceActions() { return NONE; @@ -1034,7 +1034,7 @@ public abstract class JTextComponent extends JComponent for (int i = 0; i < flavors.length; ++i) if (flavors[i].equals(DataFlavor.stringFlavor)) flavor = flavors[i]; - + if (flavor == null) return false; @@ -1059,10 +1059,10 @@ public abstract class JTextComponent extends JComponent } private static final long serialVersionUID = -8796518220218978795L; - + public static final String DEFAULT_KEYMAP = "default"; public static final String FOCUS_ACCELERATOR_KEY = "focusAcceleratorKey"; - + private static DefaultTransferHandler defaultTransferHandler; private static Hashtable keymaps = new Hashtable(); private Keymap keymap; @@ -1096,7 +1096,7 @@ public abstract class JTextComponent extends JComponent * @see #addKeymap * @see #getKeymap() * @see #keymaps - */ + */ public static Keymap removeKeymap(String n) { Keymap km = (Keymap) keymaps.get(n); @@ -1110,7 +1110,7 @@ public abstract class JTextComponent extends JComponent * in which case the new Keymap will <em>not</em> be added to the global * Keymap table. The parent may also be <code>null</code>, which is * harmless. - * + * * @param n The name of the new Keymap, or <code>null</code> * @param parent The parent of the new Keymap, or <code>null</code> * @@ -1137,7 +1137,7 @@ public abstract class JTextComponent extends JComponent * @see #setKeymap * @see #keymap */ - public Keymap getKeymap() + public Keymap getKeymap() { return keymap; } @@ -1151,26 +1151,26 @@ public abstract class JTextComponent extends JComponent * @see #getKeymap() * @see #keymap */ - public void setKeymap(Keymap k) + public void setKeymap(Keymap k) { // phase 1: replace the KeymapWrapper entry in the InputMap chain. // the goal here is to always maintain the following ordering: // // [InputMap]? -> [KeymapWrapper]? -> [InputMapUIResource]* - // + // // that is to say, component-specific InputMaps need to remain children // of Keymaps, and Keymaps need to remain children of UI-installed // InputMaps (and the order of each group needs to be preserved, of // course). - + KeymapWrapper kw = (k == null ? null : new KeymapWrapper(k)); InputMap childInputMap = getInputMap(JComponent.WHEN_FOCUSED); if (childInputMap == null) setInputMap(JComponent.WHEN_FOCUSED, kw); else { - while (childInputMap.getParent() != null + while (childInputMap.getParent() != null && !(childInputMap.getParent() instanceof KeymapWrapper) && !(childInputMap.getParent() instanceof InputMapUIResource)) childInputMap = childInputMap.getParent(); @@ -1178,7 +1178,7 @@ public abstract class JTextComponent extends JComponent // option 1: there is nobody to replace at the end of the chain if (childInputMap.getParent() == null) childInputMap.setParent(kw); - + // option 2: there is already a KeymapWrapper in the chain which // needs replacing (possibly with its own parents, possibly without) else if (childInputMap.getParent() instanceof KeymapWrapper) @@ -1212,7 +1212,7 @@ public abstract class JTextComponent extends JComponent setActionMap(kam); else { - while (childActionMap.getParent() != null + while (childActionMap.getParent() != null && !(childActionMap.getParent() instanceof KeymapActionMap) && !(childActionMap.getParent() instanceof ActionMapUIResource)) childActionMap = childActionMap.getParent(); @@ -1220,7 +1220,7 @@ public abstract class JTextComponent extends JComponent // option 1: there is nobody to replace at the end of the chain if (childActionMap.getParent() == null) childActionMap.setParent(kam); - + // option 2: there is already a KeymapActionMap in the chain which // needs replacing (possibly with its own parents, possibly without) else if (childActionMap.getParent() instanceof KeymapActionMap) @@ -1269,8 +1269,8 @@ public abstract class JTextComponent extends JComponent * @see Action#getValue * @see KeyBinding#actionName */ - public static void loadKeymap(Keymap map, - JTextComponent.KeyBinding[] bindings, + public static void loadKeymap(Keymap map, + JTextComponent.KeyBinding[] bindings, Action[] actions) { Hashtable acts = new Hashtable(actions.length); @@ -1298,12 +1298,12 @@ public abstract class JTextComponent extends JComponent { return getUI().getEditorKit(this).getActions(); } - + // These are package-private to avoid an accessor method. Document doc; Caret caret; boolean editable; - + private Highlighter highlighter; private Color caretColor; private Color disabledTextColor; @@ -1445,10 +1445,10 @@ public abstract class JTextComponent extends JComponent { int start = getSelectionStart(); int offset = getSelectionEnd() - start; - + if (offset <= 0) return null; - + try { return doc.getText(start, offset); @@ -1565,7 +1565,7 @@ public abstract class JTextComponent extends JComponent { if (editable == newValue) return; - + boolean oldValue = editable; editable = newValue; firePropertyChange("editable", oldValue, newValue); @@ -1590,13 +1590,13 @@ public abstract class JTextComponent extends JComponent { if (caret != null) caret.deinstall(this); - + Caret oldCaret = caret; caret = newCaret; if (caret != null) caret.install(this); - + firePropertyChange("caret", oldCaret, newCaret); } @@ -1698,13 +1698,13 @@ public abstract class JTextComponent extends JComponent { if (highlighter != null) highlighter.deinstall(this); - + Highlighter oldHighlighter = highlighter; highlighter = newHighlighter; if (highlighter != null) highlighter.install(this); - + firePropertyChange("highlighter", oldHighlighter, newHighlighter); } @@ -1757,7 +1757,7 @@ public abstract class JTextComponent extends JComponent public void select(int start, int end) { int length = doc.getLength(); - + start = Math.max(start, 0); start = Math.min(start, length); @@ -1803,7 +1803,7 @@ public abstract class JTextComponent extends JComponent // Set dot to new position, dot = start + content.length(); setCaretPosition(dot); - + // and update it's magic position. caret.setMagicCaretPosition(modelToView(dot).getLocation()); } @@ -1969,7 +1969,7 @@ public abstract class JTextComponent extends JComponent focusAccelerator = newKey; firePropertyChange(FOCUS_ACCELERATOR_KEY, oldKey, newKey); } - + public char getFocusAccelerator() { return focusAccelerator; @@ -1990,7 +1990,7 @@ public abstract class JTextComponent extends JComponent { navigationFilter = filter; } - + /** * Read and set the content this component. If not overridden, the * method reads the component content as a plain text. diff --git a/libjava/classpath/javax/swing/text/Keymap.java b/libjava/classpath/javax/swing/text/Keymap.java index c3f61d88e07..e1b305f5fa1 100644 --- a/libjava/classpath/javax/swing/text/Keymap.java +++ b/libjava/classpath/javax/swing/text/Keymap.java @@ -1,4 +1,4 @@ -/* Keymap.java -- +/* Keymap.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,19 +42,17 @@ import javax.swing.KeyStroke; public interface Keymap { - void addActionForKeyStroke(KeyStroke key, Action a); - Action getAction(KeyStroke key); - Action[] getBoundActions(); - KeyStroke[] getBoundKeyStrokes(); - Action getDefaultAction(); - KeyStroke[] getKeyStrokesForAction(Action a); - String getName(); - Keymap getResolveParent(); - boolean isLocallyDefined(KeyStroke key); - void removeBindings(); - void removeKeyStrokeBinding(KeyStroke keys); - void setDefaultAction(Action a); + void addActionForKeyStroke(KeyStroke key, Action a); + Action getAction(KeyStroke key); + Action[] getBoundActions(); + KeyStroke[] getBoundKeyStrokes(); + Action getDefaultAction(); + KeyStroke[] getKeyStrokesForAction(Action a); + String getName(); + Keymap getResolveParent(); + boolean isLocallyDefined(KeyStroke key); + void removeBindings(); + void removeKeyStrokeBinding(KeyStroke keys); + void setDefaultAction(Action a); void setResolveParent(Keymap parent); } - - diff --git a/libjava/classpath/javax/swing/text/LayeredHighlighter.java b/libjava/classpath/javax/swing/text/LayeredHighlighter.java index dcaf1c504c6..3eac26b38e2 100644 --- a/libjava/classpath/javax/swing/text/LayeredHighlighter.java +++ b/libjava/classpath/javax/swing/text/LayeredHighlighter.java @@ -47,10 +47,10 @@ public abstract class LayeredHighlighter implements Highlighter.HighlightPainter { public abstract Shape paintLayer(Graphics g, int p0, int p1, - Shape viewBounds, JTextComponent editor, - View view); + Shape viewBounds, JTextComponent editor, + View view); } - + public abstract void paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view); diff --git a/libjava/classpath/javax/swing/text/LayoutQueue.java b/libjava/classpath/javax/swing/text/LayoutQueue.java index b0c84b972b2..10fadd55e13 100644 --- a/libjava/classpath/javax/swing/text/LayoutQueue.java +++ b/libjava/classpath/javax/swing/text/LayoutQueue.java @@ -67,8 +67,8 @@ public class LayoutQueue { synchronized (list) { - list.addLast(task); - list.notify(); + list.addLast(task); + list.notify(); } } @@ -81,20 +81,20 @@ public class LayoutQueue { synchronized (list) { - while (list.size() == 0) - { - try - { - list.wait(); - } - catch (InterruptedException _) - { - // This seemed like a good idea, but it has not been - // tested on the JDK. - return null; - } - } - return (Runnable) list.removeFirst(); + while (list.size() == 0) + { + try + { + list.wait(); + } + catch (InterruptedException _) + { + // This seemed like a good idea, but it has not been + // tested on the JDK. + return null; + } + } + return (Runnable) list.removeFirst(); } } diff --git a/libjava/classpath/javax/swing/text/MaskFormatter.java b/libjava/classpath/javax/swing/text/MaskFormatter.java index 4ebf65b9332..c8f631ae3e5 100644 --- a/libjava/classpath/javax/swing/text/MaskFormatter.java +++ b/libjava/classpath/javax/swing/text/MaskFormatter.java @@ -1,4 +1,4 @@ -/* MaskFormatter.java -- +/* MaskFormatter.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -59,53 +59,53 @@ public class MaskFormatter extends DefaultFormatter private static final char LETTER_CHAR = '?'; private static final char ANYTHING_CHAR = '*'; private static final char HEX_CHAR = 'H'; - + /** The mask for this MaskFormatter **/ private String mask; - - /** - * A String made up of the characters that are not valid for input for - * this MaskFormatter. + + /** + * A String made up of the characters that are not valid for input for + * this MaskFormatter. */ private String invalidChars; - - /** - * A String made up of the characters that are valid for input for - * this MaskFormatter. + + /** + * A String made up of the characters that are valid for input for + * this MaskFormatter. */ private String validChars; - - /** A String used in place of missing chracters if the value does not + + /** A String used in place of missing chracters if the value does not * completely fill in the spaces in the mask. */ private String placeHolder; - - /** A character used in place of missing characters if the value does + + /** A character used in place of missing characters if the value does * not completely fill in the spaces in the mask. */ private char placeHolderChar = ' '; - + /** * Whether or not stringToValue should return literal characters in the mask. */ private boolean valueContainsLiteralCharacters = true; - + /** A String used for easy access to valid HEX characters **/ private static String hexString = "0123456789abcdefABCDEF"; - + /** An int to hold the length of the mask, accounting for escaped characters **/ int maskLength = 0; - + public MaskFormatter () { // Override super's default behaviour, in MaskFormatter the default // is not to allow invalid values setAllowsInvalid(false); } - + /** * Creates a MaskFormatter with the specified mask. - * @specnote doesn't actually throw a ParseException although it + * @specnote doesn't actually throw a ParseException although it * is declared to do so * @param mask * @throws java.text.ParseException @@ -115,7 +115,7 @@ public class MaskFormatter extends DefaultFormatter this(); setMask (mask); } - + /** * Returns the mask used in this MaskFormatter. * @return the mask used in this MaskFormatter. @@ -124,7 +124,7 @@ public class MaskFormatter extends DefaultFormatter { return mask; } - + /** * Returns a String containing the characters that are not valid for input * for this MaskFormatter. @@ -134,19 +134,19 @@ public class MaskFormatter extends DefaultFormatter { return invalidChars; } - + /** * Sets characters that are not valid for input. If * <code>invalidCharacters</code> is non-null then no characters contained * in it will be allowed to be input. - * + * * @param invalidCharacters the String specifying invalid characters. */ public void setInvalidCharacters (String invalidCharacters) { this.invalidChars = invalidCharacters; } - + /** * Returns a String containing the characters that are valid for input * for this MaskFormatter. @@ -156,12 +156,12 @@ public class MaskFormatter extends DefaultFormatter { return validChars; } - + /** * Sets characters that are valid for input. If * <code>validCharacters</code> is non-null then no characters that are * not contained in it will be allowed to be input. - * + * * @param validCharacters the String specifying valid characters. */ public void setValidCharacters (String validCharacters) @@ -170,7 +170,7 @@ public class MaskFormatter extends DefaultFormatter } /** - * Returns the place holder String that is used in place of missing + * Returns the place holder String that is used in place of missing * characters when the value doesn't completely fill in the spaces * in the mask. * @return the place holder String. @@ -179,18 +179,18 @@ public class MaskFormatter extends DefaultFormatter { return placeHolder; } - + /** * Sets the string to use if the value does not completely fill in the mask. * If this is null, the place holder character will be used instead. - * @param placeholder the String to use if the value doesn't completely + * @param placeholder the String to use if the value doesn't completely * fill in the mask. */ public void setPlaceholder (String placeholder) { this.placeHolder = placeholder; } - + /** * Returns the character used in place of missing characters when the * value doesn't completely fill the mask. @@ -200,42 +200,42 @@ public class MaskFormatter extends DefaultFormatter { return placeHolderChar; } - + /** * Sets the char to use if the value does not completely fill in the mask. - * This is only used if the place holder String has not been set or does + * This is only used if the place holder String has not been set or does * not completely fill in the mask. - * @param placeholder the char to use if the value doesn't completely + * @param placeholder the char to use if the value doesn't completely * fill in the mask. */ public void setPlaceholderCharacter (char placeholder) { this.placeHolderChar = placeholder; } - + /** - * Returns true if stringToValue should return the literal + * Returns true if stringToValue should return the literal * characters in the mask. - * @return true if stringToValue should return the literal + * @return true if stringToValue should return the literal * characters in the mask */ public boolean getValueContainsLiteralCharacters() { return valueContainsLiteralCharacters; } - + /** * Determines whether stringToValue will return literal characters or not. - * @param containsLiteralChars if true, stringToValue will return the + * @param containsLiteralChars if true, stringToValue will return the * literal characters in the mask, otherwise it will not. */ public void setValueContainsLiteralCharacters (boolean containsLiteralChars) { this.valueContainsLiteralCharacters = containsLiteralChars; } - + /** - * Sets the mask for this MaskFormatter. + * Sets the mask for this MaskFormatter. * @specnote doesn't actually throw a ParseException even though it is * declared to do so * @param mask the new mask for this MaskFormatter @@ -247,14 +247,14 @@ public class MaskFormatter extends DefaultFormatter // Update the cached maskLength. int end = mask.length() - 1; - maskLength = 0; + maskLength = 0; for (int i = 0; i <= end; i++) { // Handle escape characters properly - they don't add to the maskLength // but 2 escape characters in a row is really one escape character and // one literal single quote, so that does add 1 to the maskLength. if (mask.charAt(i) == '\'') - { + { // Escape characters at the end of the mask don't do anything. if (i != end) maskLength++; @@ -264,14 +264,14 @@ public class MaskFormatter extends DefaultFormatter maskLength++; } } - + /** * Installs this MaskFormatter on the JFormattedTextField. - * Invokes valueToString to convert the current value from the + * Invokes valueToString to convert the current value from the * JFormattedTextField to a String, then installs the Actions from - * getActions, the DocumentFilter from getDocumentFilter, and the + * getActions, the DocumentFilter from getDocumentFilter, and the * NavigationFilter from getNavigationFilter. - * + * * If valueToString throws a ParseException, this method sets the text * to an empty String and marks the JFormattedTextField as invalid. */ @@ -293,14 +293,14 @@ public class MaskFormatter extends DefaultFormatter } } } - + /** * Parses the text using the mask, valid characters, and invalid characters * to determine the appropriate Object to return. This strips the literal * characters if necessary and invokes super.stringToValue. If the paramter - * is invalid for the current mask and valid/invalid character sets this + * is invalid for the current mask and valid/invalid character sets this * method will throw a ParseException. - * + * * @param value the String to parse * @throws ParseException if value doesn't match the mask and valid/invalid * character sets @@ -309,7 +309,7 @@ public class MaskFormatter extends DefaultFormatter { return super.stringToValue(convertStringToValue(value)); } - + private String convertStringToValue(String value) throws ParseException { @@ -347,7 +347,7 @@ public class MaskFormatter extends DefaultFormatter valueChar = placeHolderChar; } - // This switch block on the mask character checks that the character + // This switch block on the mask character checks that the character // within <code>value</code> at that point is valid according to the // mask and also converts to upper/lowercase as needed. switch (maskChar) @@ -393,7 +393,7 @@ public class MaskFormatter extends DefaultFormatter i++; break; case ESCAPE_CHAR: - // Escape character, check the next character to make sure that + // Escape character, check the next character to make sure that // the literals match j++; if (j < length) @@ -427,7 +427,7 @@ public class MaskFormatter extends DefaultFormatter /** * Returns a String representation of the Object value based on the mask. - * + * * @param value the value to convert * @throws ParseException if value is invalid for this mask and valid/invalid * character sets @@ -437,7 +437,7 @@ public class MaskFormatter extends DefaultFormatter String string = value != null ? value.toString() : ""; return convertValueToString(string); } - + /** * This method takes in a String and runs it through the mask to make * sure that it is valid. If <code>convert</code> is true, it also @@ -483,7 +483,7 @@ public class MaskFormatter extends DefaultFormatter valueChar = placeHolderChar; } - // This switch block on the mask character checks that the character + // This switch block on the mask character checks that the character // within <code>value</code> at that point is valid according to the // mask and also converts to upper/lowercase as needed. switch (maskChar) @@ -529,7 +529,7 @@ public class MaskFormatter extends DefaultFormatter i++; break; case ESCAPE_CHAR: - // Escape character, check the next character to make sure that + // Escape character, check the next character to make sure that // the literals match j++; if (j < length) diff --git a/libjava/classpath/javax/swing/text/MutableAttributeSet.java b/libjava/classpath/javax/swing/text/MutableAttributeSet.java index 5dd2406a3a9..eb52be5c8bc 100644 --- a/libjava/classpath/javax/swing/text/MutableAttributeSet.java +++ b/libjava/classpath/javax/swing/text/MutableAttributeSet.java @@ -40,10 +40,10 @@ package javax.swing.text; import java.util.Enumeration; /** - * An {@link AttributeSet} that supports modification of the stored + * An {@link AttributeSet} that supports modification of the stored * attributes. - * - * @author Andrew Selkirk + * + * @author Andrew Selkirk * @since 1.2 */ public interface MutableAttributeSet extends AttributeSet @@ -52,54 +52,54 @@ public interface MutableAttributeSet extends AttributeSet * Adds an attribute with the given <code>name</code> and <code>value</code> * to the set. If the set already contains an attribute with the given * <code>name</code>, the attribute value is updated. - * + * * @param name the attribute name (<code>null</code> not permitted). * @param value the value (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. */ void addAttribute(Object name, Object value); /** * Adds all the attributes from <code>attributes</code> to this set. - * + * * @param attributes the set of attributes to add (<code>null</code> not * permitted). - * - * @throws NullPointerException if <code>attributes</code> is + * + * @throws NullPointerException if <code>attributes</code> is * <code>null</code>. */ void addAttributes(AttributeSet attributes); /** - * Removes the attribute with the specified <code>name</code>, if this + * Removes the attribute with the specified <code>name</code>, if this * attribute is defined. This method will only remove an attribute from * this set, not from the resolving parent. - * + * * @param name the attribute name (<code>null</code> not permitted). - * + * * @throws NullPointerException if <code>name</code> is <code>null</code>. */ void removeAttribute(Object name); /** * Removes the attributes listed in <code>names</code>. - * + * * @param names the attribute names (<code>null</code> not permitted). - * - * @throws NullPointerException if <code>names</code> is <code>null</code> + * + * @throws NullPointerException if <code>names</code> is <code>null</code> * or contains any <code>null</code> values. */ void removeAttributes(Enumeration<?> names); /** - * Removes attributes from this set if they are found in the + * Removes attributes from this set if they are found in the * given set. Only attributes whose key AND value are removed. - * Removes attributes only from this set, not from the resolving parent. - * Since the resolving parent is stored as an attribute, if + * Removes attributes only from this set, not from the resolving parent. + * Since the resolving parent is stored as an attribute, if * <code>attributes</code> has the same resolving parent as this set, the * parent will be removed from this set. - * + * * @param attributes the attributes (<code>null</code> not permitted). */ void removeAttributes(AttributeSet attributes); @@ -107,10 +107,10 @@ public interface MutableAttributeSet extends AttributeSet /** * Sets the reolving parent for this set. When looking up an attribute, if * it is not found in this set, then the resolving parent is also used for - * the lookup. - * + * the lookup. + * * @param parent the parent attribute set (<code>null</code> not permitted). - * + * * @throws NullPointerException if <code>parent</code> is <code>null</code>. */ void setResolveParent(AttributeSet parent); diff --git a/libjava/classpath/javax/swing/text/NavigationFilter.java b/libjava/classpath/javax/swing/text/NavigationFilter.java index ea9b29db837..647ac70bf92 100644 --- a/libjava/classpath/javax/swing/text/NavigationFilter.java +++ b/libjava/classpath/javax/swing/text/NavigationFilter.java @@ -51,20 +51,20 @@ public class NavigationFilter public abstract void moveDot(int dot, Position.Bias bias); public abstract void setDot(int dot, Position.Bias bias); } - + public NavigationFilter() { // Do nothing here. } public void moveDot(NavigationFilter.FilterBypass fb, int dot, - Position.Bias bias) + Position.Bias bias) { fb.moveDot(dot, bias); } public void setDot(NavigationFilter.FilterBypass fb, int dot, - Position.Bias bias) + Position.Bias bias) { fb.setDot(dot, bias); } diff --git a/libjava/classpath/javax/swing/text/NumberFormatter.java b/libjava/classpath/javax/swing/text/NumberFormatter.java index a858ff4961a..ce5eef99073 100644 --- a/libjava/classpath/javax/swing/text/NumberFormatter.java +++ b/libjava/classpath/javax/swing/text/NumberFormatter.java @@ -1,4 +1,4 @@ -/* NumberFormatter.java -- +/* NumberFormatter.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,22 +45,22 @@ import java.text.NumberFormat; * <code>NumberFormatter</code> is an {@link InternationalFormatter} * that implements value to string and string to value conversion via * an instance of {@link NumberFormat}. - * + * * @author Anthony Balkissoon abalkiss at redhat dot com * @since 1.4 */ public class NumberFormatter extends InternationalFormatter { - + /** - * Creates a NumberFormatter with the default NumberFormat from - * NumberFormat.getNumberInstance(). + * Creates a NumberFormatter with the default NumberFormat from + * NumberFormat.getNumberInstance(). */ public NumberFormatter () { this (NumberFormat.getNumberInstance()); } - + /** * Creates a NumberFormatter with the specified NumberFormat. * @param format the NumberFormat to use for this NumberFormatter. @@ -70,11 +70,11 @@ public class NumberFormatter extends InternationalFormatter super(format); setFormat(format); } - + /** * Sets the NumberFormat that this NumberFormatter will use to determine * legal values for editing and displaying. - * + * * @param format the Format to use to determine legal values. */ public void setFormat (Format format) diff --git a/libjava/classpath/javax/swing/text/ParagraphView.java b/libjava/classpath/javax/swing/text/ParagraphView.java index f2795e2c38a..4d4c7a044eb 100644 --- a/libjava/classpath/javax/swing/text/ParagraphView.java +++ b/libjava/classpath/javax/swing/text/ParagraphView.java @@ -297,7 +297,7 @@ public class ParagraphView extends FlowView implements TabExpander /** * Sets the justification of the paragraph. * - * @param j the justification to set + * @param j the justification to set */ protected void setJustification(int j) { diff --git a/libjava/classpath/javax/swing/text/PasswordView.java b/libjava/classpath/javax/swing/text/PasswordView.java index 9d4c86a8388..62b1419320c 100644 --- a/libjava/classpath/javax/swing/text/PasswordView.java +++ b/libjava/classpath/javax/swing/text/PasswordView.java @@ -1,4 +1,4 @@ -/* PasswordView.java -- +/* PasswordView.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -155,7 +155,7 @@ public class PasswordView /** * Determines the preferred span for this view along an axis. - * + * * @param axis to get the preferred span of * @return the preferred span of the axis */ @@ -196,7 +196,7 @@ public class PasswordView * @param a - the allocated region to render into * @param b - typesafe enumeration to indicate bias to a position in the model. * @return the bounding box of the given position - * @throws BadLocationException if the given position does not + * @throws BadLocationException if the given position does not * represent a valid location in the associated document */ public Shape modelToView(int pos, Shape a, Position.Bias b) @@ -206,7 +206,7 @@ public class PasswordView // Ensure metrics are up-to-date. updateMetrics(); - + // Get rectangle of the line containing position. int lineIndex = getElement().getElementIndex(pos); Rectangle rect = lineToRect(newAlloc, lineIndex); @@ -234,16 +234,16 @@ public class PasswordView } /** - * Provides a mapping from the view coordinate space to the logical + * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. - * + * * @param fx - the X coordinate >= 0.0f * @param fy - the Y coordinate >= 0.0f - * @param a - the allocated region to render into + * @param a - the allocated region to render into * @param bias - typesafe enumeration to indicate bias to a position in the model. - * @return the location within the model that best represents + * @return the location within the model that best represents * the given point in the view - * + * */ public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) { diff --git a/libjava/classpath/javax/swing/text/PlainDocument.java b/libjava/classpath/javax/swing/text/PlainDocument.java index 730a619da9f..070c760c077 100644 --- a/libjava/classpath/javax/swing/text/PlainDocument.java +++ b/libjava/classpath/javax/swing/text/PlainDocument.java @@ -52,7 +52,7 @@ import java.util.ArrayList; public class PlainDocument extends AbstractDocument { private static final long serialVersionUID = 4758290289196893664L; - + public static final String lineLimitAttribute = "lineLimit"; public static final String tabSizeAttribute = "tabSize"; @@ -62,7 +62,7 @@ public class PlainDocument extends AbstractDocument * createDefaultRoot() (when overridden by a subclass). */ private Element rootElement; - + public PlainDocument() { this(new GapContent()); @@ -80,7 +80,7 @@ public class PlainDocument extends AbstractDocument private void reindex() { Element[] lines; - try + try { String str = content.getString(0, content.length()); @@ -91,10 +91,10 @@ public class PlainDocument extends AbstractDocument elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY, j, i + 1)); j = i + 1; } - + if (j < content.length()) elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY, j, content.length())); - + lines = new Element[elts.size()]; for (int i = 0; i < elts.size(); ++i) lines[i] = (Element) elts.get(i); @@ -116,7 +116,7 @@ public class PlainDocument extends AbstractDocument Element[] array = new Element[1]; array[0] = createLeafElement(root, null, 0, 1); root.replace(0, 0, array); - + return root; } @@ -239,9 +239,9 @@ public class PlainDocument extends AbstractDocument removed = new Element [i2 - i1 + 1]; for (int i = i1; i <= i2; i++) removed[i-i1] = rootElement.getElement(i); - + int start = rootElement.getElement(i1).getStartOffset(); - int end = rootElement.getElement(i2).getEndOffset(); + int end = rootElement.getElement(i2).getEndOffset(); added[0] = createLeafElement(rootElement, SimpleAttributeSet.EMPTY, start, end); diff --git a/libjava/classpath/javax/swing/text/PlainView.java b/libjava/classpath/javax/swing/text/PlainView.java index e048d5f7168..16112fdb1eb 100644 --- a/libjava/classpath/javax/swing/text/PlainView.java +++ b/libjava/classpath/javax/swing/text/PlainView.java @@ -1,4 +1,4 @@ -/* PlainView.java -- +/* PlainView.java -- Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -59,7 +59,7 @@ public class PlainView extends View implements TabExpander * The color that is used to draw disabled text fields. */ Color disabledColor; - + /** * While painting this is the textcomponent's current start index * of the selection. @@ -73,13 +73,13 @@ public class PlainView extends View implements TabExpander int selectionEnd; Font font; - + /** The length of the longest line in the Document **/ float maxLineLength = -1; - + /** The longest line in the Document **/ Element longestLine = null; - + protected FontMetrics metrics; /** @@ -112,12 +112,12 @@ public class PlainView extends View implements TabExpander if (this.font != font) { - this.font = font; - metrics = component.getFontMetrics(font); + this.font = font; + metrics = component.getFontMetrics(font); tabSize = getTabSize() * metrics.charWidth('m'); } } - + /** * @since 1.4 */ @@ -125,11 +125,11 @@ public class PlainView extends View implements TabExpander { // Ensure metrics are up-to-date. updateMetrics(); - + Rectangle rect = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); int fontHeight = metrics.getHeight(); return new Rectangle(rect.x, rect.y + (line * fontHeight), - rect.width, fontHeight); + rect.width, fontHeight); } public Shape modelToView(int position, Shape a, Position.Bias b) @@ -137,7 +137,7 @@ public class PlainView extends View implements TabExpander { // Ensure metrics are up-to-date. updateMetrics(); - + Document document = getDocument(); // Get rectangle of the line containing position. @@ -151,7 +151,7 @@ public class PlainView extends View implements TabExpander Segment segment = getLineBuffer(); document.getText(lineStart, position - lineStart, segment); int xoffset = Utilities.getTabbedTextWidth(segment, metrics, tabBase, - this, lineStart); + this, lineStart); // Calc the real rectangle. rect.x += xoffset; @@ -160,7 +160,7 @@ public class PlainView extends View implements TabExpander return rect; } - + /** * Draws a line of text. The X and Y coordinates specify the start of * the <em>baseline</em> of the line. @@ -177,7 +177,7 @@ public class PlainView extends View implements TabExpander Element line = getElement().getElement(lineIndex); int startOffset = line.getStartOffset(); int endOffset = line.getEndOffset() - 1; - + if (selectionStart <= startOffset) // Selection starts before the line ... if (selectionEnd <= startOffset) @@ -265,7 +265,7 @@ public class PlainView extends View implements TabExpander { // Ensure metrics are up-to-date. updateMetrics(); - + JTextComponent textComponent = (JTextComponent) getContainer(); selectedColor = textComponent.getSelectedTextColor(); @@ -324,7 +324,7 @@ public class PlainView extends View implements TabExpander * Returns the tab size of a tab. Checks the Document's * properties for PlainDocument.tabSizeAttribute and returns it if it is * defined, otherwise returns 8. - * + * * @return the tab size. */ protected int getTabSize() @@ -339,7 +339,7 @@ public class PlainView extends View implements TabExpander * Returns the next tab stop position after a given reference position. * * This implementation ignores the <code>tabStop</code> argument. - * + * * @param x the current x position in pixels * @param tabStop the position within the text stream that the tab occured at */ @@ -351,7 +351,7 @@ public class PlainView extends View implements TabExpander int numTabs = (((int) x) - tabBase) / tabSize; next = tabBase + (numTabs + 1) * tabSize; } - return next; + return next; } /** @@ -363,7 +363,7 @@ public class PlainView extends View implements TabExpander // if the longest line is cached, return the cached value if (maxLineLength != -1) return maxLineLength; - + // otherwise we have to go through all the lines and find it Element el = getElement(); Segment seg = getLineBuffer(); @@ -380,13 +380,13 @@ public class PlainView extends View implements TabExpander catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); - ae.initCause(ex); - throw ae; + ae.initCause(ex); + throw ae; } - + if (seg == null || seg.array == null || seg.count == 0) continue; - + int width = metrics.charsWidth(seg.array, seg.offset, seg.count); if (width > span) { @@ -397,7 +397,7 @@ public class PlainView extends View implements TabExpander maxLineLength = span; return maxLineLength; } - + public float getPreferredSpan(int axis) { if (axis != X_AXIS && axis != Y_AXIS) @@ -419,7 +419,7 @@ public class PlainView extends View implements TabExpander span = metrics.getHeight() * el.getElementCount(); break; } - + return span; } @@ -483,14 +483,14 @@ public class PlainView extends View implements TabExpander pos = -1; } } - + } } // Bias is always forward. b[0] = Position.Bias.Forward; return pos; - } - + } + /** * Since insertUpdate and removeUpdate each deal with children * Elements being both added and removed, they both have to perform @@ -592,7 +592,7 @@ public class PlainView extends View implements TabExpander /** * This method is called when something is inserted into the Document * that this View is displaying. - * + * * @param changes the DocumentEvent for the changes. * @param a the allocation of the View * @param f the ViewFactory used to rebuild @@ -605,7 +605,7 @@ public class PlainView extends View implements TabExpander /** * This method is called when something is removed from the Document * that this View is displaying. - * + * * @param changes the DocumentEvent for the changes. * @param a the allocation of the View * @param f the ViewFactory used to rebuild @@ -614,28 +614,28 @@ public class PlainView extends View implements TabExpander { updateDamage(changes, a, f); } - + /** - * This method is called when attributes were changed in the + * This method is called when attributes were changed in the * Document in a location that this view is responsible for. */ public void changedUpdate (DocumentEvent changes, Shape a, ViewFactory f) { updateDamage(changes, a, f); } - + /** * Repaint the given line range. This is called from insertUpdate, - * changedUpdate, and removeUpdate when no new lines were added - * and no lines were removed, to repaint the line that was + * changedUpdate, and removeUpdate when no new lines were added + * and no lines were removed, to repaint the line that was * modified. - * + * * @param line0 the start of the range * @param line1 the end of the range * @param a the rendering region of the host * @param host the Component that uses this View (used to call repaint * on that Component) - * + * * @since 1.4 */ protected void damageLineRange (int line0, int line1, Shape a, Component host) @@ -656,7 +656,7 @@ public class PlainView extends View implements TabExpander rec0.height, rec1); host.repaint(repaintRec.x, repaintRec.y, repaintRec.width, repaintRec.height); - } + } } /** @@ -722,4 +722,3 @@ public class PlainView extends View implements TabExpander lineEl.getStartOffset()); } } - diff --git a/libjava/classpath/javax/swing/text/Position.java b/libjava/classpath/javax/swing/text/Position.java index d02eb834dd9..56c8b6e68e7 100644 --- a/libjava/classpath/javax/swing/text/Position.java +++ b/libjava/classpath/javax/swing/text/Position.java @@ -1,4 +1,4 @@ -/* Position.java -- +/* Position.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,7 +46,7 @@ public interface Position public static final Bias Forward = new Bias("Forward"); private String name; - + private Bias(String n) { name = n; @@ -57,6 +57,6 @@ public interface Position return name; } } - + int getOffset(); } diff --git a/libjava/classpath/javax/swing/text/Segment.java b/libjava/classpath/javax/swing/text/Segment.java index 63c5fa09dbc..7486ab33810 100644 --- a/libjava/classpath/javax/swing/text/Segment.java +++ b/libjava/classpath/javax/swing/text/Segment.java @@ -45,16 +45,16 @@ import java.text.CharacterIterator; public class Segment implements Cloneable, CharacterIterator { private boolean partialReturn; - + /** The current index. */ private int current; - + /** Storage for the characters (may contain additional characters). */ public char[] array; - + /** The number of characters in the segment. */ public int count; - + /** The offset of the first character in the segment. */ public int offset; @@ -68,7 +68,7 @@ public class Segment implements Cloneable, CharacterIterator /** * Creates a new <code>Segment</code>. - * + * * @param array the underlying character data. * @param offset the offset of the first character in the segment. * @param count the number of characters in the segment. @@ -79,38 +79,38 @@ public class Segment implements Cloneable, CharacterIterator this.offset = offset; this.count = count; } - + /** * Clones the segment (note that the underlying character array is not cloned, * just the reference to it). - * + * * @return A clone of the segment. */ public Object clone() { try { - return super.clone(); + return super.clone(); } catch (CloneNotSupportedException e) { - return null; + return null; } } /** * Returns the character at the current index. If the segment consists of - * zero characters, or the current index has passed the end of the + * zero characters, or the current index has passed the end of the * characters in the segment, this method returns {@link #DONE}. - * + * * @return The character at the current index. */ public char current() { if (count == 0 - || current >= getEndIndex()) + || current >= getEndIndex()) return DONE; - + return array[current]; } @@ -118,8 +118,8 @@ public class Segment implements Cloneable, CharacterIterator * Sets the current index to the first character in the segment and returns * that character. If the segment contains zero characters, this method * returns {@link #DONE}. - * - * @return The first character in the segment, or {@link #DONE} if the + * + * @return The first character in the segment, or {@link #DONE} if the * segment contains zero characters. */ public char first() @@ -133,7 +133,7 @@ public class Segment implements Cloneable, CharacterIterator /** * Returns the index of the first character in the segment. - * + * * @return The index of the first character. */ public int getBeginIndex() @@ -142,10 +142,10 @@ public class Segment implements Cloneable, CharacterIterator } /** - * Returns the end index for the segment (one position beyond the last - * character in the segment - note that this can be outside the range of the + * Returns the end index for the segment (one position beyond the last + * character in the segment - note that this can be outside the range of the * underlying character array). - * + * * @return The end index for the segment. */ public int getEndIndex() @@ -155,7 +155,7 @@ public class Segment implements Cloneable, CharacterIterator /** * Returns the index of the current character in the segment. - * + * * @return The index of the current character. */ public int getIndex() @@ -164,12 +164,12 @@ public class Segment implements Cloneable, CharacterIterator } /** - * Sets the current index to point to the last character in the segment and - * returns that character. If the segment contains zero characters, the - * current index is set to {@link #getEndIndex()} and this method returns + * Sets the current index to point to the last character in the segment and + * returns that character. If the segment contains zero characters, the + * current index is set to {@link #getEndIndex()} and this method returns * {@link #DONE}. - * - * @return The last character in the segment, or {@link #DONE} if the + * + * @return The last character in the segment, or {@link #DONE} if the * segment contains zero characters. */ public char last() @@ -179,20 +179,20 @@ public class Segment implements Cloneable, CharacterIterator current = getEndIndex(); return DONE; } - + current = getEndIndex() - 1; return array[current]; } /** - * Sets the current index to point to the next character in the segment and + * Sets the current index to point to the next character in the segment and * returns that character. If the next character position is past the end of * the segment, the index is set to {@link #getEndIndex()} and the method - * returns {@link #DONE}. If the segment contains zero characters, this + * returns {@link #DONE}. If the segment contains zero characters, this * method returns {@link #DONE}. - * + * * @return The next character in the segment or {@link #DONE} (if the next - * character position is past the end of the segment or if the + * character position is past the end of the segment or if the * segment contains zero characters). */ public char next() @@ -202,30 +202,30 @@ public class Segment implements Cloneable, CharacterIterator if ((current + 1) >= getEndIndex()) { - current = getEndIndex(); - return DONE; + current = getEndIndex(); + return DONE; } - + current++; return array[current]; } /** - * Sets the current index to point to the previous character in the segment - * and returns that character. If the current index is equal to - * {@link #getBeginIndex()}, or if the segment contains zero characters, this + * Sets the current index to point to the previous character in the segment + * and returns that character. If the current index is equal to + * {@link #getBeginIndex()}, or if the segment contains zero characters, this * method returns {@link #DONE}. - * - * @return The previous character in the segment or {@link #DONE} (if the - * current character position is at the beginning of the segment or + * + * @return The previous character in the segment or {@link #DONE} (if the + * current character position is at the beginning of the segment or * if the segment contains zero characters). */ public char previous() { if (count == 0 - || current == getBeginIndex()) + || current == getBeginIndex()) return DONE; - + current--; return array[current]; } @@ -233,20 +233,20 @@ public class Segment implements Cloneable, CharacterIterator /** * Sets the current index and returns the character at that position (or * {@link #DONE} if the index is equal to {@link #getEndIndex()}. - * + * * @param position the current position. - * + * * @return The character at the specified <code>position</code>, or - * {@link #DONE} if <code>position</code> is equal to + * {@link #DONE} if <code>position</code> is equal to * {@link #getEndIndex()}. - * + * * @throws IllegalArgumentException if <code>position</code> is not in the * range {@link #getBeginIndex()} to {@link #getEndIndex()}. */ public char setIndex(int position) { if (position < getBeginIndex() - || position > getEndIndex()) + || position > getEndIndex()) throw new IllegalArgumentException("position: " + position + ", beginIndex: " + getBeginIndex() + ", endIndex: " + getEndIndex() @@ -256,15 +256,15 @@ public class Segment implements Cloneable, CharacterIterator if (position == getEndIndex()) return DONE; - + return array[current]; } /** - * Returns a <code>String</code> containing the same characters as this + * Returns a <code>String</code> containing the same characters as this * <code>Segment</code>. - * - * @return A <code>String</code> containing the same characters as this + * + * @return A <code>String</code> containing the same characters as this * <code>Segment</code>. */ public String toString() @@ -274,19 +274,19 @@ public class Segment implements Cloneable, CharacterIterator /** * Sets the partial return flag. - * + * * @param p the new value of the flag. - * + * * @since 1.4 */ public void setPartialReturn(boolean p) { partialReturn = p; } - + /** * Returns the partial return flag. - * + * * @return The partial return flag. * @since 1.4 */ diff --git a/libjava/classpath/javax/swing/text/SimpleAttributeSet.java b/libjava/classpath/javax/swing/text/SimpleAttributeSet.java index 701fa8a7c90..02299019b63 100644 --- a/libjava/classpath/javax/swing/text/SimpleAttributeSet.java +++ b/libjava/classpath/javax/swing/text/SimpleAttributeSet.java @@ -66,13 +66,13 @@ public class SimpleAttributeSet { tab = new Hashtable(); } - + /** * Creates a new <code>SimpleAttributeSet</code> with the same attributes * and resolve parent as the specified set. - * + * * @param a the attributes (<code>null</code> not permitted). - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. */ public SimpleAttributeSet(AttributeSet a) @@ -85,10 +85,10 @@ public class SimpleAttributeSet * Adds an attribute with the given <code>name</code> and <code>value</code> * to the set. If the set already contains an attribute with the given * <code>name</code>, the attribute value is updated. - * + * * @param name the attribute name (<code>null</code> not permitted). * @param value the value (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. */ public void addAttribute(Object name, Object value) @@ -98,11 +98,11 @@ public class SimpleAttributeSet /** * Adds all the attributes from <code>attributes</code> to this set. - * + * * @param attributes the set of attributes to add (<code>null</code> not * permitted). - * - * @throws NullPointerException if <code>attributes</code> is + * + * @throws NullPointerException if <code>attributes</code> is * <code>null</code>. */ public void addAttributes(AttributeSet attributes) @@ -118,7 +118,7 @@ public class SimpleAttributeSet /** * Returns a clone of the attribute set. - * + * * @return A clone of the attribute set. */ public Object clone() @@ -159,7 +159,7 @@ public class SimpleAttributeSet return false; } } - + /** * Returns true if the given name and value are found in this AttributeSet. * Does not check the resolve parent. @@ -169,7 +169,7 @@ public class SimpleAttributeSet */ boolean containsAttributeLocally(Object name, Object value) { - return tab.containsKey(name) + return tab.containsKey(name) && tab.get(name).equals(value); } @@ -190,7 +190,7 @@ public class SimpleAttributeSet Object name = e.nextElement(); Object val = attributes.getAttribute(name); if (! containsAttribute(name, val)) - return false; + return false; } return true; } @@ -207,33 +207,33 @@ public class SimpleAttributeSet /** * Checks this set for equality with an arbitrary object. - * + * * @param obj the object (<code>null</code> permitted). - * + * * @return <code>true</code> if this set is equal to <code>obj</code>, and - * <code>false</code> otherwise. + * <code>false</code> otherwise. */ public boolean equals(Object obj) { - return + return (obj instanceof AttributeSet) && this.isEqual((AttributeSet) obj); } /** - * Returns the value of the specified attribute, or <code>null</code> if + * Returns the value of the specified attribute, or <code>null</code> if * there is no attribute with that name. If the attribute is not defined * directly in this set, the parent hierarchy (if there is one) will be * used. - * + * * @param name the attribute (<code>null</code> not permitted). - * + * * @throws NullPointerException if <code>name</code> is <code>null</code>. */ public Object getAttribute(Object name) { Object val = tab.get(name); - if (val != null) + if (val != null) return val; AttributeSet p = getResolveParent(); @@ -245,10 +245,10 @@ public class SimpleAttributeSet /** * Returns the number of attributes stored in this set, plus 1 if a parent - * has been specified (the reference to the parent is stored as a special + * has been specified (the reference to the parent is stored as a special * attribute). The attributes stored in the parent do NOT contribute * to the count. - * + * * @return The attribute count. */ public int getAttributeCount() @@ -258,7 +258,7 @@ public class SimpleAttributeSet /** * Returns an enumeration of the attribute names. - * + * * @return An enumeration of the attribute names. */ public Enumeration<?> getAttributeNames() @@ -268,9 +268,9 @@ public class SimpleAttributeSet /** * Returns the resolving parent. - * + * * @return The resolving parent (possibly <code>null</code>). - * + * * @see #setResolveParent(AttributeSet) */ public AttributeSet getResolveParent() @@ -280,7 +280,7 @@ public class SimpleAttributeSet /** * Returns a hash code for this instance. - * + * * @return A hash code. */ public int hashCode() @@ -292,7 +292,7 @@ public class SimpleAttributeSet * Returns <code>true</code> if the given attribute is defined in this set, * and <code>false</code> otherwise. The parent attribute set is not * checked. - * + * * @param attrName the attribute name (<code>null</code> not permitted). */ public boolean isDefined(Object attrName) @@ -301,28 +301,28 @@ public class SimpleAttributeSet } /** - * Returns <code>true</code> if the set contains no attributes, and - * <code>false</code> otherwise. Note that the resolving parent is - * stored as an attribute, so this method will return <code>false</code> if + * Returns <code>true</code> if the set contains no attributes, and + * <code>false</code> otherwise. Note that the resolving parent is + * stored as an attribute, so this method will return <code>false</code> if * a resolving parent is set. - * - * @return <code>true</code> if the set contains no attributes, and + * + * @return <code>true</code> if the set contains no attributes, and * <code>false</code> otherwise. */ public boolean isEmpty() { - return tab.isEmpty(); + return tab.isEmpty(); } /** * Returns true if the given set has the same number of attributes * as this set and <code>containsAttributes(attr)</code> returns * <code>true</code>. - * + * * @param attr the attribute set (<code>null</code> not permitted). - * + * * @return A boolean. - * + * * @throws NullPointerException if <code>attr</code> is <code>null</code>. */ public boolean isEqual(AttributeSet attr) @@ -330,14 +330,14 @@ public class SimpleAttributeSet return getAttributeCount() == attr.getAttributeCount() && this.containsAttributes(attr); } - + /** - * Removes the attribute with the specified <code>name</code>, if this + * Removes the attribute with the specified <code>name</code>, if this * attribute is defined. This method will only remove an attribute from * this set, not from the resolving parent. - * + * * @param name the attribute name (<code>null</code> not permitted). - * + * * @throws NullPointerException if <code>name</code> is <code>null</code>. */ public void removeAttribute(Object name) @@ -346,13 +346,13 @@ public class SimpleAttributeSet } /** - * Removes attributes from this set if they are found in the + * Removes attributes from this set if they are found in the * given set. Only attributes whose key AND value are removed. - * Removes attributes only from this set, not from the resolving parent. - * Since the resolving parent is stored as an attribute, if + * Removes attributes only from this set, not from the resolving parent. + * Since the resolving parent is stored as an attribute, if * <code>attributes</code> has the same resolving parent as this set, the * parent will be removed from this set. - * + * * @param attributes the attributes (<code>null</code> not permitted). */ public void removeAttributes(AttributeSet attributes) @@ -363,16 +363,16 @@ public class SimpleAttributeSet Object name = e.nextElement(); Object val = attributes.getAttribute(name); if (containsAttributeLocally(name, val)) - removeAttribute(name); + removeAttribute(name); } } /** * Removes the attributes listed in <code>names</code>. - * + * * @param names the attribute names (<code>null</code> not permitted). - * - * @throws NullPointerException if <code>names</code> is <code>null</code> + * + * @throws NullPointerException if <code>names</code> is <code>null</code> * or contains any <code>null</code> values. */ public void removeAttributes(Enumeration<?> names) @@ -380,7 +380,7 @@ public class SimpleAttributeSet while (names.hasMoreElements()) { removeAttribute(names.nextElement()); - } + } } /** @@ -388,28 +388,28 @@ public class SimpleAttributeSet * it is not found in this set, then the resolving parent is also used for * the lookup. * <p> - * Note that the parent is stored as an attribute, and will contribute 1 to - * the count returned by {@link #getAttributeCount()}. - * + * Note that the parent is stored as an attribute, and will contribute 1 to + * the count returned by {@link #getAttributeCount()}. + * * @param parent the parent attribute set (<code>null</code> not permitted). - * + * * @throws NullPointerException if <code>parent</code> is <code>null</code>. - * + * * @see #setResolveParent(AttributeSet) */ public void setResolveParent(AttributeSet parent) { addAttribute(ResolveAttribute, parent); } - + /** * Returns a string representation of this instance, typically used for * debugging purposes. - * + * * @return A string representation of this instance. */ public String toString() { return tab.toString(); - } + } } diff --git a/libjava/classpath/javax/swing/text/StringContent.java b/libjava/classpath/javax/swing/text/StringContent.java index 4a3f9d75222..a017de1c910 100644 --- a/libjava/classpath/javax/swing/text/StringContent.java +++ b/libjava/classpath/javax/swing/text/StringContent.java @@ -54,15 +54,15 @@ import javax.swing.undo.UndoableEdit; * An implementation of the <code>AbstractDocument.Content</code> * interface useful for small documents or debugging. The character * content is a simple character array. It's not really efficient. - * + * * <p>Do not use this class for large size.</p> */ -public final class StringContent +public final class StringContent implements AbstractDocument.Content, Serializable { /** * Stores a reference to a mark that can be resetted to the original value - * after a mark has been moved. This is used for undoing actions. + * after a mark has been moved. This is used for undoing actions. */ private class UndoPosRef { @@ -102,7 +102,7 @@ public final class StringContent * the actual offset of the position. This is pulled out of the * GapContentPosition object so that the mark and position can be handled * independently, and most important, so that the StickyPosition can - * be garbage collected while we still hold a reference to the Mark object. + * be garbage collected while we still hold a reference to the Mark object. */ private class Mark { @@ -148,7 +148,7 @@ public final class StringContent private class InsertUndo extends AbstractUndoableEdit { private int start; - + private int length; private String redoContent; @@ -177,7 +177,7 @@ public final class StringContent throw new CannotUndoException(); } } - + public void redo() { super.redo(); @@ -303,8 +303,8 @@ public final class StringContent /** * Creates a new instance containing the string "\n". - * - * @param initialLength the initial length of the underlying character + * + * @param initialLength the initial length of the underlying character * array used to store the content. */ public StringContent(int initialLength) @@ -337,10 +337,10 @@ public final class StringContent * Creates a position reference for the character at the given offset. The * position offset will be automatically updated when new characters are * inserted into or removed from the content. - * + * * @param offset the character offset. - * - * @throws BadLocationException if offset is outside the bounds of the + * + * @throws BadLocationException if offset is outside the bounds of the * content. */ public Position createPosition(int offset) throws BadLocationException @@ -351,26 +351,26 @@ public final class StringContent StickyPosition sp = new StickyPosition(offset); return sp; } - + /** * Returns the length of the string content, including the '\n' character at * the end. - * + * * @return The length of the string content. */ public int length() { return count; } - + /** - * Inserts <code>str</code> at the given position and returns an + * Inserts <code>str</code> at the given position and returns an * {@link UndoableEdit} that enables undo/redo support. - * - * @param where the insertion point (must be less than + * + * @param where the insertion point (must be less than * <code>length()</code>). * @param str the string to insert (<code>null</code> not permitted). - * + * * @return An object that can undo the insertion. */ public UndoableEdit insertString(int where, String str) @@ -402,23 +402,23 @@ public final class StringContent InsertUndo iundo = new InsertUndo(where, insert.length); return iundo; } - + /** - * Removes the specified range of characters and returns an + * Removes the specified range of characters and returns an * {@link UndoableEdit} that enables undo/redo support. - * + * * @param where the starting index. * @param nitems the number of characters. - * + * * @return An object that can undo the removal. - * + * * @throws BadLocationException if the character range extends outside the * bounds of the content OR includes the last character. */ public UndoableEdit remove(int where, int nitems) throws BadLocationException { checkLocation(where, nitems + 1); - RemoveUndo rundo = new RemoveUndo(where, new String(this.content, where, + RemoveUndo rundo = new RemoveUndo(where, new String(this.content, where, nitems)); replace(where, nitems, EMPTY); @@ -464,15 +464,15 @@ public final class StringContent } /** - * Returns a new <code>String</code> containing the characters in the + * Returns a new <code>String</code> containing the characters in the * specified range. - * + * * @param where the start index. * @param len the number of characters. - * + * * @return A string. - * - * @throws BadLocationException if the requested range of characters extends + * + * @throws BadLocationException if the requested range of characters extends * outside the bounds of the content. */ public String getString(int where, int len) throws BadLocationException @@ -482,21 +482,21 @@ public final class StringContent checkLocation(where, len); return new String(this.content, where, len); } - + /** - * Updates <code>txt</code> to contain a direct reference to the underlying + * Updates <code>txt</code> to contain a direct reference to the underlying * character array. - * + * * @param where the index of the first character. * @param len the number of characters. - * @param txt a carrier for the return result (<code>null</code> not + * @param txt a carrier for the return result (<code>null</code> not * permitted). - * - * @throws BadLocationException if the requested character range is not + * + * @throws BadLocationException if the requested character range is not * within the bounds of the content. * @throws NullPointerException if <code>txt</code> is <code>null</code>. */ - public void getChars(int where, int len, Segment txt) + public void getChars(int where, int len, Segment txt) throws BadLocationException { if (where + len > count) @@ -523,13 +523,13 @@ public final class StringContent } } - /** + /** * A utility method that checks the validity of the specified character * range. - * + * * @param where the first character in the range. * @param len the number of characters in the range. - * + * * @throws BadLocationException if the specified range is not within the * bounds of the content. */ @@ -567,4 +567,3 @@ public final class StringContent } } } - diff --git a/libjava/classpath/javax/swing/text/Style.java b/libjava/classpath/javax/swing/text/Style.java index 851ac021947..80108287447 100644 --- a/libjava/classpath/javax/swing/text/Style.java +++ b/libjava/classpath/javax/swing/text/Style.java @@ -1,4 +1,4 @@ -/* Style.java -- +/* Style.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/text/StyleConstants.java b/libjava/classpath/javax/swing/text/StyleConstants.java index 4e5005c6bb2..bdc63719d33 100644 --- a/libjava/classpath/javax/swing/text/StyleConstants.java +++ b/libjava/classpath/javax/swing/text/StyleConstants.java @@ -45,35 +45,35 @@ import java.util.ArrayList; import javax.swing.Icon; /** - * Represents standard attribute keys. This class also contains a set of - * useful static utility methods for querying and populating an + * Represents standard attribute keys. This class also contains a set of + * useful static utility methods for querying and populating an * {@link AttributeSet}. - * + * * @since 1.2 */ public class StyleConstants { - /** - * A value representing left alignment for the - * {@link ParagraphConstants#Alignment} attribute. + /** + * A value representing left alignment for the + * {@link ParagraphConstants#Alignment} attribute. */ public static final int ALIGN_LEFT = 0; - /** - * A value representing center alignment for the - * {@link ParagraphConstants#Alignment} attribute. + /** + * A value representing center alignment for the + * {@link ParagraphConstants#Alignment} attribute. */ public static final int ALIGN_CENTER = 1; - /** - * A value representing right alignment for the - * {@link ParagraphConstants#Alignment} attribute. + /** + * A value representing right alignment for the + * {@link ParagraphConstants#Alignment} attribute. */ public static final int ALIGN_RIGHT = 2; - /** - * A value representing ful justification for the - * {@link ParagraphConstants#Alignment} attribute. + /** + * A value representing ful justification for the + * {@link ParagraphConstants#Alignment} attribute. */ public static final int ALIGN_JUSTIFIED = 3; @@ -82,72 +82,72 @@ public class StyleConstants /** An alias for {@link CharacterConstants#BidiLevel}. */ public static final Object BidiLevel = CharacterConstants.BidiLevel; - + /** An alias for {@link CharacterConstants#Bold}. */ public static final Object Bold = CharacterConstants.Bold; - + /** An alias for {@link CharacterConstants#ComponentAttribute}. */ - public static final Object ComponentAttribute + public static final Object ComponentAttribute = CharacterConstants.ComponentAttribute; - + /** An alias for {@link CharacterConstants#Family}. */ public static final Object Family = CharacterConstants.Family; - + /** An alias for {@link CharacterConstants#Family}. */ - public static final Object FontFamily = CharacterConstants.Family; - + public static final Object FontFamily = CharacterConstants.Family; + /** An alias for {@link CharacterConstants#Size}. */ public static final Object FontSize = CharacterConstants.Size; - + /** An alias for {@link CharacterConstants#Foreground}. */ public static final Object Foreground = CharacterConstants.Foreground; - + /** An alias for {@link CharacterConstants#IconAttribute}. */ public static final Object IconAttribute = CharacterConstants.IconAttribute; - + /** An alias for {@link CharacterConstants#Italic}. */ public static final Object Italic = CharacterConstants.Italic; - + /** An alias for {@link CharacterConstants#Size}. */ public static final Object Size = CharacterConstants.Size; - + /** An alias for {@link CharacterConstants#StrikeThrough}. */ public static final Object StrikeThrough = CharacterConstants.StrikeThrough; - + /** An alias for {@link CharacterConstants#Subscript}. */ public static final Object Subscript = CharacterConstants.Subscript; - + /** An alias for {@link CharacterConstants#Superscript}. */ public static final Object Superscript = CharacterConstants.Superscript; - + /** An alias for {@link CharacterConstants#Underline}. */ public static final Object Underline = CharacterConstants.Underline; /** An alias for {@link ParagraphConstants#Alignment}. */ public static final Object Alignment = ParagraphConstants.Alignment; - + /** An alias for {@link ParagraphConstants#FirstLineIndent}. */ - public static final Object FirstLineIndent + public static final Object FirstLineIndent = ParagraphConstants.FirstLineIndent; - + /** An alias for {@link ParagraphConstants#LeftIndent}. */ public static final Object LeftIndent = ParagraphConstants.LeftIndent; - + /** An alias for {@link ParagraphConstants#LineSpacing}. */ public static final Object LineSpacing = ParagraphConstants.LineSpacing; - + /** An alias for {@link ParagraphConstants#Orientation}. */ public static final Object Orientation = ParagraphConstants.Orientation; - + /** An alias for {@link ParagraphConstants#RightIndent}. */ public static final Object RightIndent = ParagraphConstants.RightIndent; - + /** An alias for {@link ParagraphConstants#SpaceAbove}. */ public static final Object SpaceAbove = ParagraphConstants.SpaceAbove; - + /** An alias for {@link ParagraphConstants#SpaceBelow}. */ public static final Object SpaceBelow = ParagraphConstants.SpaceBelow; - + /** An alias for {@link ParagraphConstants#TabSet}. */ public static final Object TabSet = ParagraphConstants.TabSet; @@ -155,13 +155,13 @@ public class StyleConstants public static final String IconElementName = "icon"; - public static final Object ComposedTextAttribute + public static final Object ComposedTextAttribute = new StyleConstants("composed text"); - + public static final Object ModelAttribute = new StyleConstants("model"); - + public static final Object NameAttribute = new StyleConstants("name"); - + public static final Object ResolveAttribute = new StyleConstants("resolver"); /** @@ -174,7 +174,7 @@ public class StyleConstants // Package-private to avoid accessor constructor for use by // subclasses. - StyleConstants(String k) + StyleConstants(String k) { keyname = k; if (keys == null) @@ -184,7 +184,7 @@ public class StyleConstants /** * Returns a string representation of the attribute key. - * + * * @return A string representation of the attribute key. */ public String toString() @@ -193,15 +193,15 @@ public class StyleConstants } /** - * Returns the alignment specified in the given attributes, or + * Returns the alignment specified in the given attributes, or * {@link #ALIGN_LEFT} if no alignment is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * - * @return The alignment (typically one of {@link #ALIGN_LEFT}, - * {@link #ALIGN_RIGHT}, {@link #ALIGN_CENTER} or + * + * @return The alignment (typically one of {@link #ALIGN_LEFT}, + * {@link #ALIGN_RIGHT}, {@link #ALIGN_CENTER} or * {@link #ALIGN_JUSTIFIED}). - * + * * @see #setAlignment(MutableAttributeSet, int) */ public static int getAlignment(AttributeSet a) @@ -210,38 +210,38 @@ public class StyleConstants if (i != null) return i.intValue(); else - return ALIGN_LEFT; - } + return ALIGN_LEFT; + } /** * Returns the background color specified in the given attributes, or * {@link Color#BLACK} if no background color is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The background color. - * + * * @see #setBackground(MutableAttributeSet, Color) */ public static Color getBackground(AttributeSet a) { Color c = (Color) a.getAttribute(Background); - if (c != null) + if (c != null) return c; else return Color.BLACK; - } + } /** - * Returns the bidi level specified in the given attributes, or + * Returns the bidi level specified in the given attributes, or * <code>0</code> if no bidi level is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The bidi level. - * + * * @see #setBidiLevel(MutableAttributeSet, int) - */ + */ public static int getBidiLevel(AttributeSet a) { Integer i = (Integer) a.getAttribute(BidiLevel); @@ -249,18 +249,18 @@ public class StyleConstants return i.intValue(); else return 0; - } + } /** - * Returns the component specified in the given attributes, or + * Returns the component specified in the given attributes, or * <code>null</code> if no component is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The component (possibly <code>null</code>). - * + * * @see #setComponent(MutableAttributeSet, Component) - */ + */ public static Component getComponent(AttributeSet a) { Component c = (Component) a.getAttribute(ComponentAttribute); @@ -268,18 +268,18 @@ public class StyleConstants return c; else return null; - } + } /** - * Returns the indentation specified in the given attributes, or + * Returns the indentation specified in the given attributes, or * <code>0.0f</code> if no indentation is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The indentation. - * + * * @see #setFirstLineIndent(MutableAttributeSet, float) - */ + */ public static float getFirstLineIndent(AttributeSet a) { Float f = (Float) a.getAttribute(FirstLineIndent); @@ -287,18 +287,18 @@ public class StyleConstants return f.floatValue(); else return 0.0f; - } + } /** - * Returns the font family specified in the given attributes, or + * Returns the font family specified in the given attributes, or * <code>Monospaced</code> if no font family is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The font family. - * + * * @see #setFontFamily(MutableAttributeSet, String) - */ + */ public static String getFontFamily(AttributeSet a) { String ff = (String) a.getAttribute(FontFamily); @@ -306,18 +306,18 @@ public class StyleConstants return ff; else return "Monospaced"; - } + } /** - * Returns the font size specified in the given attributes, or + * Returns the font size specified in the given attributes, or * <code>12</code> if no font size is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The font size. - * + * * @see #setFontSize(MutableAttributeSet, int) - */ + */ public static int getFontSize(AttributeSet a) { Integer i = (Integer) a.getAttribute(FontSize); @@ -325,16 +325,16 @@ public class StyleConstants return i.intValue(); else return 12; - } + } /** * Returns the foreground color specified in the given attributes, or * {@link Color#BLACK} if no foreground color is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The foreground color. - * + * * @see #setForeground(MutableAttributeSet, Color) */ public static Color getForeground(AttributeSet a) @@ -344,33 +344,33 @@ public class StyleConstants return c; else return Color.BLACK; - } + } /** - * Returns the icon specified in the given attributes, or + * Returns the icon specified in the given attributes, or * <code>null</code> if no icon is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The icon (possibly <code>null</code>). - * + * * @see #setIcon(MutableAttributeSet, Icon) - */ + */ public static Icon getIcon(AttributeSet a) { return (Icon) a.getAttribute(IconAttribute); - } + } /** - * Returns the left indentation specified in the given attributes, or + * Returns the left indentation specified in the given attributes, or * <code>0.0f</code> if no left indentation is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The left indentation. - * + * * @see #setLeftIndent(MutableAttributeSet, float) - */ + */ public static float getLeftIndent(AttributeSet a) { Float f = (Float) a.getAttribute(LeftIndent); @@ -378,18 +378,18 @@ public class StyleConstants return f.floatValue(); else return 0.0f; - } + } /** - * Returns the line spacing specified in the given attributes, or + * Returns the line spacing specified in the given attributes, or * <code>0.0f</code> if no line spacing is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The line spacing. - * + * * @see #setLineSpacing(MutableAttributeSet, float) - */ + */ public static float getLineSpacing(AttributeSet a) { Float f = (Float) a.getAttribute(LineSpacing); @@ -397,18 +397,18 @@ public class StyleConstants return f.floatValue(); else return 0.0f; - } + } /** - * Returns the right indentation specified in the given attributes, or + * Returns the right indentation specified in the given attributes, or * <code>0.0f</code> if no right indentation is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The right indentation. - * + * * @see #setRightIndent(MutableAttributeSet, float) - */ + */ public static float getRightIndent(AttributeSet a) { Float f = (Float) a.getAttribute(RightIndent); @@ -416,37 +416,37 @@ public class StyleConstants return f.floatValue(); else return 0.0f; - } + } /** - * Returns the 'space above' specified in the given attributes, or + * Returns the 'space above' specified in the given attributes, or * <code>0.0f</code> if no 'space above' is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The 'space above'. - * + * * @see #setSpaceAbove(MutableAttributeSet, float) - */ + */ public static float getSpaceAbove(AttributeSet a) { Float f = (Float) a.getAttribute(SpaceAbove); if (f != null) return f.floatValue(); - else + else return 0.0f; - } + } /** - * Returns the 'space below' specified in the given attributes, or + * Returns the 'space below' specified in the given attributes, or * <code>0.0f</code> if no 'space below' is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The 'space below'. - * + * * @see #setSpaceBelow(MutableAttributeSet, float) - */ + */ public static float getSpaceBelow(AttributeSet a) { Float f = (Float) a.getAttribute(SpaceBelow); @@ -454,34 +454,34 @@ public class StyleConstants return f.floatValue(); else return 0.0f; - } + } /** - * Returns the tab set specified in the given attributes, or + * Returns the tab set specified in the given attributes, or * <code>null</code> if no tab set is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The tab set. - * + * * @see #setTabSet(MutableAttributeSet, javax.swing.text.TabSet) - */ + */ public static javax.swing.text.TabSet getTabSet(AttributeSet a) { // I'm guessing that the fully qualified class name is to differentiate // between the TabSet class and the TabSet (attribute) instance on some // compiler... return (javax.swing.text.TabSet) a.getAttribute(StyleConstants.TabSet); - } + } /** - * Returns the value of the bold flag in the given attributes, or + * Returns the value of the bold flag in the given attributes, or * <code>false</code> if no bold flag is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The bold flag. - * + * * @see #setBold(MutableAttributeSet, boolean) */ public static boolean isBold(AttributeSet a) @@ -491,16 +491,16 @@ public class StyleConstants return b.booleanValue(); else return false; - } + } /** - * Returns the value of the italic flag in the given attributes, or + * Returns the value of the italic flag in the given attributes, or * <code>false</code> if no italic flag is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The italic flag. - * + * * @see #setItalic(MutableAttributeSet, boolean) */ public static boolean isItalic(AttributeSet a) @@ -510,16 +510,16 @@ public class StyleConstants return b.booleanValue(); else return false; - } + } /** - * Returns the value of the strike-through flag in the given attributes, or + * Returns the value of the strike-through flag in the given attributes, or * <code>false</code> if no strike-through flag is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The strike-through flag. - * + * * @see #setStrikeThrough(MutableAttributeSet, boolean) */ public static boolean isStrikeThrough(AttributeSet a) @@ -529,16 +529,16 @@ public class StyleConstants return b.booleanValue(); else return false; - } + } /** - * Returns the value of the subscript flag in the given attributes, or + * Returns the value of the subscript flag in the given attributes, or * <code>false</code> if no subscript flag is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The subscript flag. - * + * * @see #setSubscript(MutableAttributeSet, boolean) */ public static boolean isSubscript(AttributeSet a) @@ -548,16 +548,16 @@ public class StyleConstants return b.booleanValue(); else return false; - } + } /** - * Returns the value of the superscript flag in the given attributes, or + * Returns the value of the superscript flag in the given attributes, or * <code>false</code> if no superscript flag is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The superscript flag. - * + * * @see #setSuperscript(MutableAttributeSet, boolean) */ public static boolean isSuperscript(AttributeSet a) @@ -565,18 +565,18 @@ public class StyleConstants Boolean b = (Boolean) a.getAttribute(Superscript); if (b != null) return b.booleanValue(); - else + else return false; - } + } /** - * Returns the value of the underline flag in the given attributes, or + * Returns the value of the underline flag in the given attributes, or * <code>false</code> if no underline flag is specified. - * + * * @param a the attribute set (<code>null</code> not permitted). - * + * * @return The underline flag. - * + * * @see #setUnderline(MutableAttributeSet, boolean) */ public static boolean isUnderline(AttributeSet a) @@ -586,140 +586,140 @@ public class StyleConstants return b.booleanValue(); else return false; - } + } /** * Adds an alignment attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). - * @param align the alignment (typically one of - * {@link StyleConstants#ALIGN_LEFT}, - * {@link StyleConstants#ALIGN_RIGHT}, - * {@link StyleConstants#ALIGN_CENTER} or + * @param align the alignment (typically one of + * {@link StyleConstants#ALIGN_LEFT}, + * {@link StyleConstants#ALIGN_RIGHT}, + * {@link StyleConstants#ALIGN_CENTER} or * {@link StyleConstants#ALIGN_JUSTIFIED}). - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getAlignment(AttributeSet) */ public static void setAlignment(MutableAttributeSet a, int align) { a.addAttribute(Alignment, new Integer(align)); - } + } /** * Adds a background attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param bg the background (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. - * + * * @see #getBackground(AttributeSet) */ public static void setBackground(MutableAttributeSet a, Color bg) { a.addAttribute(Background, bg); - } + } /** * Adds a bidi-level attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param lev the level. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getBidiLevel(AttributeSet) */ public static void setBidiLevel(MutableAttributeSet a, int lev) { a.addAttribute(BidiLevel, new Integer(lev)); - } + } /** * Adds a bold attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param b the new value of the bold attribute. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #isBold(AttributeSet) */ public static void setBold(MutableAttributeSet a, boolean b) { a.addAttribute(Bold, Boolean.valueOf(b)); - } - + } + /** * Adds a component attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param c the component (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. - * + * * @see #getComponent(AttributeSet) */ public static void setComponent(MutableAttributeSet a, Component c) { a.addAttribute(ComponentAttribute, c); - } + } /** * Adds a first line indentation attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param i the indentation. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getFirstLineIndent(AttributeSet) */ public static void setFirstLineIndent(MutableAttributeSet a, float i) { a.addAttribute(FirstLineIndent, new Float(i)); - } + } /** * Adds a font family attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param fam the font family name (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. - * + * * @see #getFontFamily(AttributeSet) */ public static void setFontFamily(MutableAttributeSet a, String fam) { a.addAttribute(FontFamily, fam); - } + } /** * Adds a font size attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param s the font size (in points). - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getFontSize(AttributeSet) */ public static void setFontSize(MutableAttributeSet a, int s) { a.addAttribute(FontSize, new Integer(s)); - } + } /** * Adds a foreground color attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param fg the foreground color (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. - * + * * @see #getForeground(AttributeSet) */ public static void setForeground(MutableAttributeSet a, Color fg) @@ -729,12 +729,12 @@ public class StyleConstants /** * Adds an icon attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param c the icon (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. - * + * * @see #getIcon(AttributeSet) */ public static void setIcon(MutableAttributeSet a, Icon c) @@ -742,174 +742,174 @@ public class StyleConstants a.addAttribute(AbstractDocument.ElementNameAttribute, IconElementName); a.addAttribute(IconAttribute, c); } - + /** * Adds an italic attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param b the new value of the italic attribute. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #isItalic(AttributeSet) */ public static void setItalic(MutableAttributeSet a, boolean b) { a.addAttribute(Italic, Boolean.valueOf(b)); } - + /** * Adds a left indentation attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param i the indentation. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getLeftIndent(AttributeSet) */ public static void setLeftIndent(MutableAttributeSet a, float i) { a.addAttribute(LeftIndent, new Float(i)); - } + } /** * Adds a line spacing attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param i the line spacing. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getLineSpacing(AttributeSet) */ public static void setLineSpacing(MutableAttributeSet a, float i) { a.addAttribute(LineSpacing, new Float(i)); - } + } /** * Adds a right indentation attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param i the right indentation. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getRightIndent(AttributeSet) */ public static void setRightIndent(MutableAttributeSet a, float i) { a.addAttribute(RightIndent, new Float(i)); - } + } /** * Adds a 'space above' attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param i the space above attribute value. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getSpaceAbove(AttributeSet) */ public static void setSpaceAbove(MutableAttributeSet a, float i) { a.addAttribute(SpaceAbove, new Float(i)); - } + } /** * Adds a 'space below' attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param i the space below attribute value. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #getSpaceBelow(AttributeSet) */ public static void setSpaceBelow(MutableAttributeSet a, float i) { a.addAttribute(SpaceBelow, new Float(i)); - } + } /** * Adds a strike-through attribue to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param b the strike-through attribute value. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #isStrikeThrough(AttributeSet) */ public static void setStrikeThrough(MutableAttributeSet a, boolean b) { a.addAttribute(StrikeThrough, Boolean.valueOf(b)); - } + } /** * Adds a subscript attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param b the subscript attribute value. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #isSubscript(AttributeSet) */ public static void setSubscript(MutableAttributeSet a, boolean b) { a.addAttribute(Subscript, Boolean.valueOf(b)); - } + } /** * Adds a superscript attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param b the superscript attribute value. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #isSuperscript(AttributeSet) */ public static void setSuperscript(MutableAttributeSet a, boolean b) { a.addAttribute(Superscript, Boolean.valueOf(b)); - } + } /** * Adds a {@link TabSet} attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param tabs the tab set (<code>null</code> not permitted). - * + * * @throws NullPointerException if either argument is <code>null</code>. - * + * * @see #getTabSet(AttributeSet) */ - public static void setTabSet(MutableAttributeSet a, + public static void setTabSet(MutableAttributeSet a, javax.swing.text.TabSet tabs) { a.addAttribute(StyleConstants.TabSet, tabs); - } + } /** * Adds an underline attribute to the specified set. - * + * * @param a the attribute set (<code>null</code> not permitted). * @param b the underline attribute value. - * + * * @throws NullPointerException if <code>a</code> is <code>null</code>. - * + * * @see #isUnderline(AttributeSet) */ public static void setUnderline(MutableAttributeSet a, boolean b) { a.addAttribute(Underline, Boolean.valueOf(b)); - } + } - // The remainder are so-called "typesafe enumerations" which + // The remainder are so-called "typesafe enumerations" which // alias subsets of the above constants. /** @@ -921,56 +921,56 @@ public class StyleConstants { /** * Private constructor prevents new instances being created. - * + * * @param k the key name. */ - private CharacterConstants(String k) + private CharacterConstants(String k) { super(k); } - + /** An alias for {@link ColorConstants#Background}. */ public static final Object Background = ColorConstants.Background; - + /** A key for the bidi level character attribute. */ public static final Object BidiLevel = new CharacterConstants("bidiLevel"); - + /** An alias for {@link FontConstants#Bold}. */ public static final Object Bold = FontConstants.Bold; - + /** A key for the component character attribute. */ - public static final Object ComponentAttribute + public static final Object ComponentAttribute = new CharacterConstants("component"); - + /** An alias for {@link FontConstants#Family}. */ public static final Object Family = FontConstants.Family; - + /** An alias for {@link FontConstants#Size}. */ public static final Object Size = FontConstants.Size; - + /** An alias for {@link ColorConstants#Foreground}. */ public static final Object Foreground = ColorConstants.Foreground; - + /** A key for the icon character attribute. */ public static final Object IconAttribute = new CharacterConstants("icon"); - + /** A key for the italic character attribute. */ public static final Object Italic = FontConstants.Italic; - + /** A key for the strike through character attribute. */ - public static final Object StrikeThrough + public static final Object StrikeThrough = new CharacterConstants("strikethrough"); - + /** A key for the subscript character attribute. */ public static final Object Subscript = new CharacterConstants("subscript"); - + /** A key for the superscript character attribute. */ - public static final Object Superscript + public static final Object Superscript = new CharacterConstants("superscript"); - + /** A key for the underline character attribute. */ public static final Object Underline = new CharacterConstants("underline"); - + } /** @@ -982,14 +982,14 @@ public class StyleConstants { /** * Private constructor prevents new instances being created. - * + * * @param k the key name. */ - private ColorConstants(String k) + private ColorConstants(String k) { super(k); } - + /** A key for the foreground color attribute. */ public static final Object Foreground = new ColorConstants("foreground"); @@ -1006,23 +1006,23 @@ public class StyleConstants { /** * Private constructor prevents new instances being created. - * + * * @param k the key name. */ - private FontConstants(String k) + private FontConstants(String k) { super(k); } - + /** A key for the bold font attribute. */ public static final Object Bold = new FontConstants("bold"); /** A key for the family font attribute. */ public static final Object Family = new FontConstants("family"); - + /** A key for the italic font attribute. */ public static final Object Italic = new FontConstants("italic"); - + /** A key for the size font attribute. */ public static final Object Size = new FontConstants("size"); } @@ -1036,48 +1036,48 @@ public class StyleConstants { /** * Private constructor prevents new instances being created. - * + * * @param k the key name. */ - private ParagraphConstants(String k) + private ParagraphConstants(String k) { super(k); } - + /** A key for the alignment paragraph attribute. */ public static final Object Alignment = new ParagraphConstants("Alignment"); /** A key for the first line indentation paragraph attribute. */ - public static final Object FirstLineIndent + public static final Object FirstLineIndent = new ParagraphConstants("FirstLineIndent"); - + /** A key for the left indentation paragraph attribute. */ - public static final Object LeftIndent + public static final Object LeftIndent = new ParagraphConstants("LeftIndent"); - + /** A key for the line spacing paragraph attribute. */ - public static final Object LineSpacing + public static final Object LineSpacing = new ParagraphConstants("LineSpacing"); - + /** A key for the orientation paragraph attribute. */ - public static final Object Orientation + public static final Object Orientation = new ParagraphConstants("Orientation"); - + /** A key for the right indentation paragraph attribute. */ - public static final Object RightIndent + public static final Object RightIndent = new ParagraphConstants("RightIndent"); - + /** A key for the 'space above' paragraph attribute. */ - public static final Object SpaceAbove + public static final Object SpaceAbove = new ParagraphConstants("SpaceAbove"); - + /** A key for the 'space below' paragraph attribute. */ - public static final Object SpaceBelow + public static final Object SpaceBelow = new ParagraphConstants("SpaceBelow"); - + /** A key for the tabset paragraph attribute. */ public static final Object TabSet = new ParagraphConstants("TabSet"); - + } } diff --git a/libjava/classpath/javax/swing/text/StyleContext.java b/libjava/classpath/javax/swing/text/StyleContext.java index 4dded0d0402..295398835dd 100644 --- a/libjava/classpath/javax/swing/text/StyleContext.java +++ b/libjava/classpath/javax/swing/text/StyleContext.java @@ -60,7 +60,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; -public class StyleContext +public class StyleContext implements Serializable, AbstractDocument.AttributeContext { /** The serialization UID (compatible with JDK1.5). */ @@ -74,7 +74,7 @@ public class StyleContext protected transient ChangeEvent changeEvent; protected EventListenerList listenerList; - + private transient AttributeSet attributes; public NamedStyle() @@ -115,12 +115,12 @@ public class StyleContext { listenerList.add(ChangeListener.class, l); } - + public void removeChangeListener(ChangeListener l) { listenerList.remove(ChangeListener.class, l); } - + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); @@ -159,7 +159,7 @@ public class StyleContext { return attributes.containsAttribute(name, value); } - + public boolean containsAttributes(AttributeSet attrs) { return attributes.containsAttributes(attrs); @@ -172,7 +172,7 @@ public class StyleContext copy.attributes = attributes.copyAttributes(); return copy; } - + public Object getAttribute(Object attrName) { return attributes.getAttribute(attrName); @@ -187,10 +187,10 @@ public class StyleContext { return attributes.getAttributeNames(); } - + public boolean isDefined(Object attrName) { - return attributes.isDefined(attrName); + return attributes.isDefined(attrName); } public boolean isEqual(AttributeSet attr) @@ -219,7 +219,7 @@ public class StyleContext public AttributeSet getResolveParent() { - return attributes.getResolveParent(); + return attributes.getResolveParent(); } public void setResolveParent(AttributeSet parent) @@ -229,7 +229,7 @@ public class StyleContext else removeAttribute(StyleConstants.ResolveAttribute); } - + public String toString() { return "NamedStyle:" + getName() + " " + attributes; @@ -250,7 +250,7 @@ public class StyleContext readAttributeSet(s, this); } } - + public class SmallAttributeSet implements AttributeSet { @@ -321,7 +321,7 @@ public class StyleContext } return eq; } - + public Object getAttribute(Object key) { Object att = null; @@ -334,7 +334,7 @@ public class StyleContext att = attrs[i + 1]; } - // Check the resolve parent, unless we're looking for the + // Check the resolve parent, unless we're looking for the // ResolveAttribute, which must not be looked up if (att == null) { @@ -342,7 +342,7 @@ public class StyleContext if (parent != null) att = parent.getAttribute(key); } - + return att; } @@ -352,18 +352,18 @@ public class StyleContext } public Enumeration<?> getAttributeNames() - { - return new Enumeration() + { + return new Enumeration() { int i = 0; - public boolean hasMoreElements() - { - return i < attrs.length; + public boolean hasMoreElements() + { + return i < attrs.length; } - public Object nextElement() - { - i += 2; - return attrs[i-2]; + public Object nextElement() + { + i += 2; + return attrs[i-2]; } }; } @@ -387,7 +387,7 @@ public class StyleContext } return false; } - + public boolean isEqual(AttributeSet attr) { boolean eq; @@ -400,7 +400,7 @@ public class StyleContext && this.containsAttributes(attr); return eq; } - + public String toString() { StringBuilder sb = new StringBuilder(); @@ -446,7 +446,7 @@ public class StyleContext * The name of the default style. */ public static final String DEFAULT_STYLE = "default"; - + static Hashtable sharedAttributeSets = new Hashtable(); static Hashtable sharedFonts = new Hashtable(); @@ -486,7 +486,7 @@ public class StyleContext { return new SmallAttributeSet(a); } - + protected MutableAttributeSet createLargeAttributeSet(AttributeSet a) { return new SimpleAttributeSet(a); @@ -506,7 +506,7 @@ public class StyleContext { return styles.getChangeListeners(); } - + public Style addStyle(String name, Style parent) { Style newStyle = new NamedStyle(name, parent); @@ -534,7 +534,7 @@ public class StyleContext { return (Style) styles.getAttribute(name); } - + /** * Get the names of the style. The returned enumeration always * contains at least one member, the default style. @@ -572,7 +572,7 @@ public class StyleContext // // We keep a static cache mapping SimpleFontSpecs to java.awt.Fonts, so // that we reuse Fonts between styles and style contexts. - // + // private static class SimpleFontSpec { @@ -600,7 +600,7 @@ public class StyleContext return family.hashCode() + style + size; } } - + public Font getFont(AttributeSet attr) { String family = StyleConstants.getFontFamily(attr); @@ -608,7 +608,7 @@ public class StyleContext if (StyleConstants.isBold(attr)) style += Font.BOLD; if (StyleConstants.isItalic(attr)) - style += Font.ITALIC; + style += Font.ITALIC; int size = StyleConstants.getFontSize(attr); return getFont(family, style, size); } @@ -625,7 +625,7 @@ public class StyleContext return tmp; } } - + public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); @@ -641,7 +641,7 @@ public class StyleContext return StyleConstants.getBackground(a); } - protected int getCompressionThreshold() + protected int getCompressionThreshold() { return compressionThreshold; } @@ -749,7 +749,7 @@ public class StyleContext } public synchronized AttributeSet removeAttributes(AttributeSet old, - Enumeration<?> names) + Enumeration<?> names) { AttributeSet ret; if (old.getAttributeCount() <= getCompressionThreshold()) @@ -771,7 +771,7 @@ public class StyleContext /** * Gets the object previously registered with registerStaticAttributeKey. - * + * * @param key - the key that was registered. * @return the object previously registered with registerStaticAttributeKey. */ @@ -781,11 +781,11 @@ public class StyleContext return null; return readAttributeKeys.get(key); } - + /** * Returns the String that key will be registered with * registerStaticAttributeKey. - * + * * @param key - the key that will be registered. * @return the string the key will be registered with. */ @@ -799,7 +799,7 @@ public class StyleContext * attempt to restore keys that were static objects by considering only the * keys that have were registered with registerStaticAttributeKey. The * attributes retrieved will be placed into the given set. - * + * * @param in - the stream to read from * @param a - the set of attributes * @throws ClassNotFoundException - may be encountered when reading from @@ -827,12 +827,12 @@ public class StyleContext a.addAttribute(key, val); } } - + /** * Serialize an attribute set in a way that is compatible with it * being read in again by {@link #readAttributeSet(ObjectInputStream, MutableAttributeSet)}. * In particular registered static keys are transformed properly. - * + * * @param out - stream to write to * @param a - the attribute set * @throws IOException - any I/O error @@ -872,9 +872,9 @@ public class StyleContext } /** - * Handles reading in the attributes. + * Handles reading in the attributes. * @see #readAttributeSet(ObjectInputStream, MutableAttributeSet) - * + * * @param in - the stream to read from * @param a - the set of attributes * @throws ClassNotFoundException - may be encountered when reading from stream @@ -889,7 +889,7 @@ public class StyleContext /** * Handles writing of the given attributes. * @see #writeAttributeSet(ObjectOutputStream, AttributeSet) - * + * * @param out - stream to write to * @param a - the attribute set * @throws IOException - any I/O error diff --git a/libjava/classpath/javax/swing/text/StyledDocument.java b/libjava/classpath/javax/swing/text/StyledDocument.java index 168e1b116f3..49e471c9ce1 100644 --- a/libjava/classpath/javax/swing/text/StyledDocument.java +++ b/libjava/classpath/javax/swing/text/StyledDocument.java @@ -42,8 +42,8 @@ import java.awt.Font; /** * StyledDocument - * @author Andrew Selkirk - * @version 1.0 + * @author Andrew Selkirk + * @version 1.0 */ public interface StyledDocument extends Document { diff --git a/libjava/classpath/javax/swing/text/StyledEditorKit.java b/libjava/classpath/javax/swing/text/StyledEditorKit.java index 568694387f3..744585f0852 100644 --- a/libjava/classpath/javax/swing/text/StyledEditorKit.java +++ b/libjava/classpath/javax/swing/text/StyledEditorKit.java @@ -364,8 +364,8 @@ public class StyledEditorKit extends DefaultEditorKit { Document doc = editor.getDocument(); if (!(doc instanceof StyledDocument)) - throw new AssertionError("The Document for StyledEditorKits is " - + "expected to be a StyledDocument."); + throw new AssertionError("The Document for StyledEditorKits is " + + "expected to be a StyledDocument."); return (StyledDocument) doc; } @@ -382,8 +382,8 @@ public class StyledEditorKit extends DefaultEditorKit { EditorKit kit = editor.getEditorKit(); if (!(kit instanceof StyledEditorKit)) - throw new AssertionError("The EditorKit for StyledDocuments is " - + "expected to be a StyledEditorKit."); + throw new AssertionError("The EditorKit for StyledDocuments is " + + "expected to be a StyledEditorKit."); return (StyledEditorKit) kit; } @@ -406,33 +406,33 @@ public class StyledEditorKit extends DefaultEditorKit { Document doc = editor.getDocument(); if (doc instanceof StyledDocument) - { - StyledDocument styleDoc = (StyledDocument) editor.getDocument(); - EditorKit kit = editor.getEditorKit(); - if (!(kit instanceof StyledEditorKit)) - { - StyledEditorKit styleKit = (StyledEditorKit) kit; - int start = editor.getSelectionStart(); - int end = editor.getSelectionEnd(); - int dot = editor.getCaret().getDot(); - if (start == dot && end == dot) - { - // If there is no selection, then we only update the - // input attributes. - MutableAttributeSet inputAttributes = - styleKit.getInputAttributes(); - inputAttributes.addAttributes(atts); - } - else - styleDoc.setParagraphAttributes(start, end, atts, replace); - } - else - throw new AssertionError("The EditorKit for StyledTextActions " - + "is expected to be a StyledEditorKit"); - } + { + StyledDocument styleDoc = (StyledDocument) editor.getDocument(); + EditorKit kit = editor.getEditorKit(); + if (!(kit instanceof StyledEditorKit)) + { + StyledEditorKit styleKit = (StyledEditorKit) kit; + int start = editor.getSelectionStart(); + int end = editor.getSelectionEnd(); + int dot = editor.getCaret().getDot(); + if (start == dot && end == dot) + { + // If there is no selection, then we only update the + // input attributes. + MutableAttributeSet inputAttributes = + styleKit.getInputAttributes(); + inputAttributes.addAttributes(atts); + } + else + styleDoc.setParagraphAttributes(start, end, atts, replace); + } + else + throw new AssertionError("The EditorKit for StyledTextActions " + + "is expected to be a StyledEditorKit"); + } else - throw new AssertionError("The Document for StyledTextActions is " - + "expected to be a StyledDocument."); + throw new AssertionError("The Document for StyledTextActions is " + + "expected to be a StyledDocument."); } } @@ -466,15 +466,15 @@ public class StyledEditorKit extends DefaultEditorKit String name = element.getName(); View view = null; if (name.equals(AbstractDocument.ContentElementName)) - view = new LabelView(element); + view = new LabelView(element); else if (name.equals(AbstractDocument.ParagraphElementName)) - view = new ParagraphView(element); + view = new ParagraphView(element); else if (name.equals(AbstractDocument.SectionElementName)) - view = new BoxView(element, View.Y_AXIS); + view = new BoxView(element, View.Y_AXIS); else if (name.equals(StyleConstants.ComponentElementName)) - view = new ComponentView(element); + view = new ComponentView(element); else if (name.equals(StyleConstants.IconElementName)) - view = new IconView(element); + view = new IconView(element); else throw new AssertionError("Unknown Element type: " + element.getClass().getName() + " : " @@ -499,14 +499,14 @@ public class StyledEditorKit extends DefaultEditorKit { Object source = ev.getSource(); if (!(source instanceof JTextComponent)) - throw new AssertionError("CaretEvents are expected to come from a" - + "JTextComponent."); + throw new AssertionError("CaretEvents are expected to come from a" + + "JTextComponent."); JTextComponent text = (JTextComponent) source; Document doc = text.getDocument(); if (!(doc instanceof StyledDocument)) - throw new AssertionError("The Document used by StyledEditorKits is" - + "expected to be a StyledDocument"); + throw new AssertionError("The Document used by StyledEditorKits is" + + "expected to be a StyledDocument"); StyledDocument styleDoc = (StyledDocument) doc; currentRun = styleDoc.getCharacterElement(ev.getDot()); @@ -571,7 +571,7 @@ public class StyledEditorKit extends DefaultEditorKit public Action[] getActions() { Action[] actions1 = super.getActions(); - Action[] myActions = new Action[] { + Action[] myActions = new Action[] { new FontSizeAction("font-size-8", 8), new FontSizeAction("font-size-10", 10), new FontSizeAction("font-size-12", 12), @@ -698,7 +698,7 @@ public class StyledEditorKit extends DefaultEditorKit * @param set the inputAttributes to copy the attributes to */ protected void createInputAttributes(Element element, - MutableAttributeSet set) + MutableAttributeSet set) { // FIXME: Filter out component, icon and element name attributes. set.removeAttributes(set); diff --git a/libjava/classpath/javax/swing/text/TabExpander.java b/libjava/classpath/javax/swing/text/TabExpander.java index d70dd4604e5..a1e4571cf67 100644 --- a/libjava/classpath/javax/swing/text/TabExpander.java +++ b/libjava/classpath/javax/swing/text/TabExpander.java @@ -40,4 +40,4 @@ package javax.swing.text; public interface TabExpander { float nextTabStop(float x, int tabOffset); -}
\ No newline at end of file +} diff --git a/libjava/classpath/javax/swing/text/TabSet.java b/libjava/classpath/javax/swing/text/TabSet.java index c08a650fb11..c32596536c4 100644 --- a/libjava/classpath/javax/swing/text/TabSet.java +++ b/libjava/classpath/javax/swing/text/TabSet.java @@ -54,28 +54,28 @@ public class TabSet implements Serializable /** * Creates a new <code>TabSet</code> containing the specified tab stops. - * + * * @param t the tab stops (<code>null</code> permitted). */ - public TabSet(TabStop[] t) + public TabSet(TabStop[] t) { if (t != null) tabs = (TabStop[]) t.clone(); - else + else tabs = new TabStop[0]; } - + /** * Returns the tab stop with the specified index. - * + * * @param i the index. - * + * * @return The tab stop. - * - * @throws IllegalArgumentException if <code>i</code> is not in the range + * + * @throws IllegalArgumentException if <code>i</code> is not in the range * <code>0</code> to <code>getTabCount() - 1</code>. */ - public TabStop getTab(int i) + public TabStop getTab(int i) { if (i < 0 || i >= tabs.length) throw new IllegalArgumentException("Index out of bounds."); @@ -84,38 +84,38 @@ public class TabSet implements Serializable /** * Returns the tab following the specified location. - * + * * @param location the location. - * + * * @return The tab following the specified location (or <code>null</code>). */ - public TabStop getTabAfter(float location) + public TabStop getTabAfter(float location) { int idx = getTabIndexAfter(location); if (idx == -1) return null; else - return tabs[idx]; + return tabs[idx]; } /** * Returns the number of tab stops in this tab set. - * + * * @return The number of tab stops in this tab set. */ - public int getTabCount() + public int getTabCount() { return tabs.length; } /** * Returns the index of the specified tab, or -1 if the tab is not found. - * + * * @param tab the tab (<code>null</code> permitted). - * + * * @return The index of the specified tab, or -1. */ - public int getTabIndex(TabStop tab) + public int getTabIndex(TabStop tab) { for (int i = 0; i < tabs.length; ++i) if (tabs[i] == tab) @@ -125,12 +125,12 @@ public class TabSet implements Serializable /** * Returns the index of the tab at or after the specified location. - * + * * @param location the tab location. - * + * * @return The index of the tab stop, or -1. */ - public int getTabIndexAfter(float location) + public int getTabIndexAfter(float location) { for (int i = 0; i < tabs.length; i++) { @@ -139,15 +139,15 @@ public class TabSet implements Serializable } return -1; } - + /** * Tests this <code>TabSet</code> for equality with an arbitrary object. - * + * * @param obj the object (<code>null</code> permitted). - * + * * @return <code>true</code> if this <code>TabSet</code> is equal to * <code>obj</code>, and <code>false</code> otherwise. - * + * * @since 1.5 */ public boolean equals(Object obj) @@ -167,15 +167,15 @@ public class TabSet implements Serializable } return true; } - + /** * Returns a hash code for this <code>TabSet</code>. - * + * * @return A hash code. - * + * * @since 1.5 */ - public int hashCode() + public int hashCode() { // this hash code won't match Sun's, but that shouldn't matter... int result = 193; @@ -191,7 +191,7 @@ public class TabSet implements Serializable /** * Returns a string representation of this <code>TabSet</code>. - * + * * @return A string representation of this <code>TabSet</code>. */ public String toString() diff --git a/libjava/classpath/javax/swing/text/TabStop.java b/libjava/classpath/javax/swing/text/TabStop.java index f4c3f851406..03a56116fc1 100644 --- a/libjava/classpath/javax/swing/text/TabStop.java +++ b/libjava/classpath/javax/swing/text/TabStop.java @@ -66,23 +66,23 @@ public class TabStop implements Serializable /** * Creates a new <code>TabStop</code> for the specified tab position. - * + * * @param pos the tab position. */ - public TabStop(float pos) + public TabStop(float pos) { this(pos, ALIGN_LEFT, LEAD_NONE); } - + /** * Creates a new <code>TabStop</code> with the specified attributes. - * + * * @param pos the tab position. - * @param align the alignment (one of {@link #ALIGN_LEFT}, - * {@link #ALIGN_CENTER}, {@link #ALIGN_RIGHT}, {@link #ALIGN_DECIMAL} + * @param align the alignment (one of {@link #ALIGN_LEFT}, + * {@link #ALIGN_CENTER}, {@link #ALIGN_RIGHT}, {@link #ALIGN_DECIMAL} * or {@link #ALIGN_BAR}). - * @param leader the leader (one of {@link #LEAD_NONE}, {@link #LEAD_DOTS}, - * {@link #LEAD_EQUALS}, {@link #LEAD_HYPHENS}, {@link #LEAD_THICKLINE} + * @param leader the leader (one of {@link #LEAD_NONE}, {@link #LEAD_DOTS}, + * {@link #LEAD_EQUALS}, {@link #LEAD_HYPHENS}, {@link #LEAD_THICKLINE} * or {@link #LEAD_UNDERLINE}). */ public TabStop(float pos, int align, int leader) @@ -91,16 +91,16 @@ public class TabStop implements Serializable this.align = align; this.leader = leader; } - + /** * Tests this <code>TabStop</code> for equality with an arbitrary object. - * + * * @param other the other object (<code>null</code> permitted). - * - * @return <code>true</code> if this <code>TabStop</code> is equal to + * + * @return <code>true</code> if this <code>TabStop</code> is equal to * the specified object, and <code>false</code> otherwise. */ - public boolean equals(Object other) + public boolean equals(Object other) { return (other != null) && (other instanceof TabStop) @@ -110,55 +110,55 @@ public class TabStop implements Serializable } /** - * Returns the tab alignment. This should be one of {@link #ALIGN_LEFT}, - * {@link #ALIGN_CENTER}, {@link #ALIGN_RIGHT}, {@link #ALIGN_DECIMAL} or + * Returns the tab alignment. This should be one of {@link #ALIGN_LEFT}, + * {@link #ALIGN_CENTER}, {@link #ALIGN_RIGHT}, {@link #ALIGN_DECIMAL} or * {@link #ALIGN_BAR}. - * + * * @return The tab alignment. */ - public int getAlignment() + public int getAlignment() { return align; } /** - * Returns the leader type. This should be one of {@link #LEAD_NONE}, - * {@link #LEAD_DOTS}, {@link #LEAD_EQUALS}, {@link #LEAD_HYPHENS}, + * Returns the leader type. This should be one of {@link #LEAD_NONE}, + * {@link #LEAD_DOTS}, {@link #LEAD_EQUALS}, {@link #LEAD_HYPHENS}, * {@link #LEAD_THICKLINE} or {@link #LEAD_UNDERLINE}. - * + * * @return The leader type. */ - public int getLeader() + public int getLeader() { return leader; } /** * Returns the tab position. - * + * * @return The tab position. */ - public float getPosition() + public float getPosition() { return pos; } /** * Returns a hash code for this <code>TabStop</code>. - * + * * @return A hash code. */ - public int hashCode() + public int hashCode() { return (int) pos + (int) leader + (int) align; } /** * Returns a string describing this <code>TabStop</code>. - * + * * @return A string describing this <code>TabStop</code>. */ - public String toString() + public String toString() { String prefix = ""; switch (align) @@ -174,7 +174,7 @@ public class TabStop implements Serializable case ALIGN_DECIMAL: prefix = "decimal "; break; - + case ALIGN_BAR: prefix = "bar "; break; @@ -182,8 +182,8 @@ public class TabStop implements Serializable default: break; } - - return prefix + "tab @" + pos + + return prefix + "tab @" + pos + ((leader == LEAD_NONE) ? "" : " (w/leaders)"); } diff --git a/libjava/classpath/javax/swing/text/TabableView.java b/libjava/classpath/javax/swing/text/TabableView.java index 2a96ea94d81..e50270bb6b9 100644 --- a/libjava/classpath/javax/swing/text/TabableView.java +++ b/libjava/classpath/javax/swing/text/TabableView.java @@ -1,4 +1,4 @@ -/* TabableView.java -- +/* TabableView.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/text/TableView.java b/libjava/classpath/javax/swing/text/TableView.java index 2dcb9ebf7b3..bdf5004a96b 100644 --- a/libjava/classpath/javax/swing/text/TableView.java +++ b/libjava/classpath/javax/swing/text/TableView.java @@ -51,7 +51,7 @@ import javax.swing.event.DocumentEvent; * horizontal boxes containing the actuall cells of the table. These cells * can be arbitrary view implementations and are fetched via the * {@link ViewFactory} returned by {@link View#getViewFactory}. - * + * * @author Roman Kennke (kennke@aicas.com) */ public abstract class TableView @@ -416,7 +416,7 @@ public abstract class TableView /** * Calculates the requirements of this view for the minor (== horizontal) * axis. - * + * * This is reimplemented to calculate the requirements as the sum of the * size requirements of the columns. * diff --git a/libjava/classpath/javax/swing/text/TextAction.java b/libjava/classpath/javax/swing/text/TextAction.java index 49c49cb9d7f..70e19ef1dfc 100644 --- a/libjava/classpath/javax/swing/text/TextAction.java +++ b/libjava/classpath/javax/swing/text/TextAction.java @@ -67,9 +67,9 @@ public abstract class TextAction extends AbstractAction * Returns the <code>JTextComponent</code> object associated with the given * <code>ActionEvent</code>. If the source of the event is not a * <code>JTextComponent</code> the currently focused text component is returned. - * + * * @param event the action event - * + * * @return the <code>JTextComponent</code> */ protected final JTextComponent getTextComponent(ActionEvent event) @@ -88,7 +88,7 @@ public abstract class TextAction extends AbstractAction /** * Creates a new array of <code>Action</code> containing both given arrays. - * + * * @param list1 the first action array * @param list2 the second action array * @@ -112,7 +112,7 @@ public abstract class TextAction extends AbstractAction actions.put(name != null ? name : "", a); } Action[] augmented = new Action[actions.size()]; - + int i = 0; for (Iterator<Action> it = actions.values().iterator(); it.hasNext(); i++) augmented[i] = it.next(); @@ -122,7 +122,7 @@ public abstract class TextAction extends AbstractAction /** * Returns the current focused <code>JTextComponent</code> object. - * + * * @return the <code>JTextComponent</code> */ protected final JTextComponent getFocusedComponent() @@ -135,21 +135,21 @@ public abstract class TextAction extends AbstractAction textComp = (JTextComponent) focused; return textComp; } - + /** Abstract helper class which implements everything needed for an * Action implementation in <code>DefaultEditorKit</code> which - * does horizontal movement (and selection). + * does horizontal movement (and selection). */ abstract static class HorizontalMovementAction extends TextAction { int dir; - + HorizontalMovementAction(String name, int direction) { super(name); dir = direction; } - + public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); @@ -161,34 +161,34 @@ public abstract class TextAction extends AbstractAction = Utilities.getNextVisualPositionFrom(t, t.getCaretPosition(), dir); - + Caret c = t.getCaret(); - + actionPerformedImpl(c, offs); - + c.setMagicCaretPosition(t.modelToView(offs).getLocation()); } } catch(BadLocationException ble) { - throw + throw (InternalError) new InternalError("Illegal offset").initCause(ble); } - + } - + protected abstract void actionPerformedImpl(Caret c, int offs) throws BadLocationException; } - + /** Abstract helper class which implements everything needed for an * Action implementation in <code>DefaultEditorKit</code> which * does vertical movement (and selection). - */ + */ abstract static class VerticalMovementAction extends TextAction { int dir; - + VerticalMovementAction(String name, int direction) { super(name); @@ -215,26 +215,26 @@ public abstract class TextAction extends AbstractAction } else pos = c.getDot(); - + pos = Utilities.getNextVisualPositionFrom(t, t.getCaretPosition(), dir); - + if (pos > -1) actionPerformedImpl(c, pos); } } - catch(BadLocationException ble) + catch(BadLocationException ble) { - throw + throw (InternalError) new InternalError("Illegal offset").initCause(ble); } } - + protected abstract void actionPerformedImpl(Caret c, int offs) throws BadLocationException; - + } - - + + } diff --git a/libjava/classpath/javax/swing/text/Utilities.java b/libjava/classpath/javax/swing/text/Utilities.java index d49d806cfa3..6221392321f 100644 --- a/libjava/classpath/javax/swing/text/Utilities.java +++ b/libjava/classpath/javax/swing/text/Utilities.java @@ -97,7 +97,7 @@ public class Utilities int pos = s.offset; int len = 0; - + int end = s.offset + s.count; for (int offset = s.offset; offset < end; ++offset) @@ -138,7 +138,7 @@ public class Utilities g.drawChars(buffer, pos, len, pixelX, y); pixelX += metrics.charsWidth(buffer, pos, len); } - + return pixelX; } @@ -171,21 +171,21 @@ public class Utilities int count = 0; for (int offset = s.offset; offset < end; offset++) { - switch (buffer[offset]) - { - case '\t': - // In case we have a tab, we just 'jump' over the tab. - // When we have no tab expander we just use the width of 'm'. - if (e != null) - pixelX = (int) e.nextTabStop(pixelX, - startOffset + offset - s.offset); - else - pixelX += metrics.charWidth(' '); - break; - case '\n': - // In case we have a newline, we must 'draw' - // the buffer and jump on the next line. - pixelX += metrics.charsWidth(buffer, offset - count, count); + switch (buffer[offset]) + { + case '\t': + // In case we have a tab, we just 'jump' over the tab. + // When we have no tab expander we just use the width of 'm'. + if (e != null) + pixelX = (int) e.nextTabStop(pixelX, + startOffset + offset - s.offset); + else + pixelX += metrics.charWidth(' '); + break; + case '\n': + // In case we have a newline, we must 'draw' + // the buffer and jump on the next line. + pixelX += metrics.charsWidth(buffer, offset - count, count); count = 0; break; default: @@ -234,12 +234,12 @@ public class Utilities int found = s.count; int currentX = x0; int nextX = currentX; - + int end = s.offset + s.count; for (int pos = s.offset; pos < end && found == s.count; pos++) { char nextChar = s.array[pos]; - + if (nextChar != '\t') nextX += fm.charWidth(nextChar); else @@ -249,7 +249,7 @@ public class Utilities else nextX += ((int) te.nextTabStop(nextX, p0 + pos - s.offset)); } - + if (x >= currentX && x < nextX) { // Found position. @@ -295,10 +295,10 @@ public class Utilities { return getTabbedTextOffset(s, fm, x0, x, te, p0, true); } - + /** * Finds the start of the next word for the given offset. - * + * * @param c * the text component * @param offs @@ -315,7 +315,7 @@ public class Utilities String text = c.getText(); BreakIterator wb = BreakIterator.getWordInstance(); wb.setText(text); - + int last = wb.following(offs); int current = wb.next(); int cp; @@ -325,7 +325,7 @@ public class Utilities for (int i = last; i < current; i++) { cp = text.codePointAt(i); - + // Return the last found bound if there is a letter at the current // location or is not whitespace (meaning it is a number or // punctuation). The first case means that 'last' denotes the @@ -338,13 +338,13 @@ public class Utilities last = current; current = wb.next(); } - + throw new BadLocationException("no more words", offs); } /** * Finds the start of the previous word for the given offset. - * + * * @param c * the text component * @param offs @@ -357,10 +357,10 @@ public class Utilities throws BadLocationException { String text = c.getText(); - + if (offs <= 0 || offs > text.length()) throw new BadLocationException("invalid offset specified", offs); - + BreakIterator wb = BreakIterator.getWordInstance(); wb.setText(text); int last = wb.preceding(offs); @@ -372,7 +372,7 @@ public class Utilities for (int i = last; i < offs; i++) { cp = text.codePointAt(i); - + // Return the last found bound if there is a letter at the current // location or is not whitespace (meaning it is a number or // punctuation). The first case means that 'last' denotes the @@ -385,10 +385,10 @@ public class Utilities last = current; current = wb.previous(); } - + return 0; } - + /** * Finds the start of a word for the given location. * @param c the text component @@ -400,10 +400,10 @@ public class Utilities throws BadLocationException { String text = c.getText(); - + if (offs < 0 || offs > text.length()) throw new BadLocationException("invalid offset specified", offs); - + BreakIterator wb = BreakIterator.getWordInstance(); wb.setText(text); @@ -412,7 +412,7 @@ public class Utilities return wb.preceding(offs); } - + /** * Finds the end of a word for the given location. * @param c the text component @@ -425,20 +425,20 @@ public class Utilities { if (offs < 0 || offs >= c.getText().length()) throw new BadLocationException("invalid offset specified", offs); - + String text = c.getText(); BreakIterator wb = BreakIterator.getWordInstance(); wb.setText(text); return wb.following(offs); } - + /** - * Get the model position of the end of the row that contains the + * Get the model position of the end of the row that contains the * specified model position. Return null if the given JTextComponent * does not have a size. * @param c the JTextComponent * @param offs the model position - * @return the model position of the end of the row containing the given + * @return the model position of the end of the row containing the given * offset * @throws BadLocationException if the offset is invalid */ @@ -473,12 +473,12 @@ public class Utilities } } } - + /** * Get the model position of the start of the row that contains the specified * model position. Return null if the given JTextComponent does not have a * size. - * + * * @param c the JTextComponent * @param offs the model position * @return the model position of the start of the row containing the given @@ -516,7 +516,7 @@ public class Utilities } } } - + /** * Determine where to break the text in the given Segment, attempting to find * a word boundary. @@ -612,23 +612,23 @@ public class Utilities throws BadLocationException { int offs = getRowStart(c, offset); - + if(offs == -1) return -1; // Effectively calculates the y value of the previous line. Point pt = c.modelToView(offs-1).getLocation(); - + pt.x = x; - + // Calculate a simple fitting offset. offs = c.viewToModel(pt); - + // Find out the real x positions of the calculated character and its // neighbour. int offsX = c.modelToView(offs).getLocation().x; int offsXNext = c.modelToView(offs+1).getLocation().x; - + // Chose the one which is nearer to us and return its offset. if (Math.abs(offsX-x) <= Math.abs(offsXNext-x)) return offs; @@ -653,12 +653,12 @@ public class Utilities throws BadLocationException { int offs = getRowEnd(c, offset); - + if(offs == -1) return -1; Point pt = null; - + // Note: Some views represent the position after the last // typed character others do not. Converting offset 3 in "a\nb" // in a PlainView will return a valid rectangle while in a @@ -673,12 +673,12 @@ public class Utilities { return offset; } - + pt.x = x; - + // Calculate a simple fitting offset. offs = c.viewToModel(pt); - + if (offs == c.getDocument().getLength()) return offs; @@ -686,29 +686,29 @@ public class Utilities // neighbour. int offsX = c.modelToView(offs).getLocation().x; int offsXNext = c.modelToView(offs+1).getLocation().x; - + // Chose the one which is nearer to us and return its offset. if (Math.abs(offsX-x) <= Math.abs(offsXNext-x)) return offs; else return offs+1; } - + /** This is an internal helper method which is used by the * <code>javax.swing.text</code> package. It simply delegates the * call to a method with the same name on the <code>NavigationFilter</code> * of the provided <code>JTextComponent</code> (if it has one) or its UI. - * + * * If the underlying method throws a <code>BadLocationException</code> it * will be swallowed and the initial offset is returned. */ static int getNextVisualPositionFrom(JTextComponent t, int offset, int direction) { NavigationFilter nf = t.getNavigationFilter(); - + try { - return (nf != null) + return (nf != null) ? nf.getNextVisualPositionFrom(t, offset, Bias.Forward, @@ -724,7 +724,7 @@ public class Utilities { return offset; } - + } - + } diff --git a/libjava/classpath/javax/swing/text/View.java b/libjava/classpath/javax/swing/text/View.java index c63ddbce776..e3c795735eb 100644 --- a/libjava/classpath/javax/swing/text/View.java +++ b/libjava/classpath/javax/swing/text/View.java @@ -1,4 +1,4 @@ -/* View.java -- +/* View.java -- Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,7 +56,7 @@ public abstract class View implements SwingConstants public static final int X_AXIS = 0; public static final int Y_AXIS = 1; - + private Element elt; private View parent; @@ -104,12 +104,12 @@ public abstract class View implements SwingConstants this.parent = parent; } - + public View getParent() { return parent; } - + public Container getContainer() { View parent = getParent(); @@ -118,12 +118,12 @@ public abstract class View implements SwingConstants else return parent.getContainer(); } - + public Document getDocument() { return getElement().getDocument(); } - + public Element getElement() { return elt; @@ -189,12 +189,12 @@ public abstract class View implements SwingConstants min = getPreferredSpan(axis); return min; } - + public void setSize(float width, float height) { // The default implementation does nothing. } - + /** * Returns the alignment of this view along the baseline of the parent view. * An alignment of <code>0.0</code> will align this view with the left edge @@ -218,7 +218,7 @@ public abstract class View implements SwingConstants { return getElement().getAttributes(); } - + public boolean isVisible() { return true; @@ -228,7 +228,7 @@ public abstract class View implements SwingConstants { return 0; } - + public View getView(int index) { return null; @@ -274,7 +274,7 @@ public abstract class View implements SwingConstants public void remove(int index) { - replace(index, 1, null); + replace(index, 1, null); } public View createFragment(int p0, int p1) @@ -297,7 +297,7 @@ public abstract class View implements SwingConstants { return null; } - + /** * @since 1.4 */ @@ -305,7 +305,7 @@ public abstract class View implements SwingConstants { return -1; } - + /** * @since 1.4 */ @@ -674,15 +674,15 @@ public abstract class View implements SwingConstants * listed valid values */ public Shape modelToView(int p1, Position.Bias b1, - int p2, Position.Bias b2, Shape a) + int p2, Position.Bias b2, Shape a) throws BadLocationException { if (b1 != Position.Bias.Forward && b1 != Position.Bias.Backward) throw new IllegalArgumentException - ("b1 must be either Position.Bias.Forward or Position.Bias.Backward"); + ("b1 must be either Position.Bias.Forward or Position.Bias.Backward"); if (b2 != Position.Bias.Forward && b2 != Position.Bias.Backward) throw new IllegalArgumentException - ("b2 must be either Position.Bias.Forward or Position.Bias.Backward"); + ("b2 must be either Position.Bias.Forward or Position.Bias.Backward"); Shape s1 = modelToView(p1, a, b1); // Special case for p2 == end index. @@ -867,7 +867,7 @@ public abstract class View implements SwingConstants ret = parent.viewToModel(r.x, r.y - 1, a, biasRet); break; case SOUTH: - // Try to find a suitable offset by examining the area below. + // Try to find a suitable offset by examining the area below. parent = getParent(); r = parent.modelToView(pos, a, b).getBounds(); ret = parent.viewToModel(r.x + r.width, r.y + r.height, a, biasRet); @@ -875,7 +875,7 @@ public abstract class View implements SwingConstants default: throw new IllegalArgumentException("Illegal value for d"); } - + return ret; } } diff --git a/libjava/classpath/javax/swing/text/ViewFactory.java b/libjava/classpath/javax/swing/text/ViewFactory.java index 079488017b6..cb57bd80184 100644 --- a/libjava/classpath/javax/swing/text/ViewFactory.java +++ b/libjava/classpath/javax/swing/text/ViewFactory.java @@ -1,4 +1,4 @@ -/* ViewFactory.java -- +/* ViewFactory.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/text/WrappedPlainView.java b/libjava/classpath/javax/swing/text/WrappedPlainView.java index 00e12b1129e..f2a6c92d888 100644 --- a/libjava/classpath/javax/swing/text/WrappedPlainView.java +++ b/libjava/classpath/javax/swing/text/WrappedPlainView.java @@ -1,4 +1,4 @@ -/* WrappedPlainView.java -- +/* WrappedPlainView.java -- Copyright (C) 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,31 +56,31 @@ public class WrappedPlainView extends BoxView implements TabExpander { /** The color for selected text **/ Color selectedColor; - + /** The color for unselected text **/ Color unselectedColor; - + /** The color for disabled components **/ Color disabledColor; - + /** * Stores the font metrics. This is package private to avoid synthetic * accessor method. */ FontMetrics metrics; - + /** Whether or not to wrap on word boundaries **/ boolean wordWrap; - + /** A ViewFactory that creates WrappedLines **/ ViewFactory viewFactory = new WrappedLineCreator(); - + /** The start of the selected text **/ int selectionStart; - + /** The end of the selected text **/ int selectionEnd; - + /** The height of the line (used while painting) **/ int lineHeight; @@ -98,18 +98,18 @@ public class WrappedPlainView extends BoxView implements TabExpander * The instance returned by {@link #getLineBuffer()}. */ private transient Segment lineBuffer; - + public WrappedPlainView (Element elem) { this (elem, false); } - + public WrappedPlainView (Element elem, boolean wordWrap) { super (elem, Y_AXIS); - this.wordWrap = wordWrap; - } - + this.wordWrap = wordWrap; + } + /** * Provides access to the Segment used for retrievals from the Document. * @return the Segment. @@ -120,12 +120,12 @@ public class WrappedPlainView extends BoxView implements TabExpander lineBuffer = new Segment(); return lineBuffer; } - + /** * Returns the next tab stop position after a given reference position. * * This implementation ignores the <code>tabStop</code> argument. - * + * * @param x the current x position in pixels * @param tabStop the position within the text stream that the tab occured at */ @@ -139,12 +139,12 @@ public class WrappedPlainView extends BoxView implements TabExpander } return next; } - + /** - * Returns the tab size for the Document based on + * Returns the tab size for the Document based on * PlainDocument.tabSizeAttribute, defaulting to 8 if this property is * not defined - * + * * @return the tab size. */ protected int getTabSize() @@ -154,7 +154,7 @@ public class WrappedPlainView extends BoxView implements TabExpander return 8; return ((Integer)tabSize).intValue(); } - + /** * Draws a line of text, suppressing white space at the end and expanding * tabs. Calls drawSelectedText and drawUnselectedText. @@ -175,37 +175,37 @@ public class WrappedPlainView extends BoxView implements TabExpander // - start of range is selected, end of range is unselected // - start of range is unselected, end of range is selected // - middle of range is selected, start and end of range is unselected - - // entire range unselected: - if ((selectionStart == selectionEnd) || + + // entire range unselected: + if ((selectionStart == selectionEnd) || (p0 > selectionEnd || p1 < selectionStart)) drawUnselectedText(g, x, y, p0, p1); - + // entire range selected else if (p0 >= selectionStart && p1 <= selectionEnd) drawSelectedText(g, x, y, p0, p1); - + // start of range selected, end of range unselected else if (p0 >= selectionStart) { x = drawSelectedText(g, x, y, p0, selectionEnd); drawUnselectedText(g, x, y, selectionEnd, p1); } - + // start of range unselected, end of range selected else if (selectionStart > p0 && selectionEnd > p1) { x = drawUnselectedText(g, x, y, p0, selectionStart); drawSelectedText(g, x, y, selectionStart, p1); } - + // middle of range selected else if (selectionStart > p0) { x = drawUnselectedText(g, x, y, p0, selectionStart); x = drawSelectedText(g, x, y, selectionStart, selectionEnd); drawUnselectedText(g, x, y, selectionEnd, p1); - } + } } catch (BadLocationException ble) { @@ -214,14 +214,14 @@ public class WrappedPlainView extends BoxView implements TabExpander } /** - * Renders the range of text as selected text. Just paints the text + * Renders the range of text as selected text. Just paints the text * in the color specified by the host component. Assumes the highlighter * will render the selected background. * @param g the graphics context * @param x the starting X coordinate * @param y the starting Y coordinate * @param p0 the starting model location - * @param p1 the ending model location + * @param p1 the ending model location * @return the X coordinate of the end of the text * @throws BadLocationException if the given range is invalid */ @@ -246,7 +246,7 @@ public class WrappedPlainView extends BoxView implements TabExpander */ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException - { + { JTextComponent textComponent = (JTextComponent) getContainer(); if (textComponent.isEnabled()) g.setColor(unselectedColor); @@ -256,8 +256,8 @@ public class WrappedPlainView extends BoxView implements TabExpander Segment segment = getLineBuffer(); getDocument().getText(p0, p1 - p0, segment); return Utilities.drawTabbedText(segment, x, y, g, this, p0); - } - + } + /** * Loads the children to initiate the view. Called by setParent. * Creates a WrappedLine for each child Element. @@ -268,17 +268,17 @@ public class WrappedPlainView extends BoxView implements TabExpander int numChildren = root.getElementCount(); if (numChildren == 0) return; - + View[] children = new View[numChildren]; for (int i = 0; i < numChildren; i++) children[i] = new WrappedLine(root.getElement(i)); replace(0, 0, children); } - + /** * Calculates the break position for the text between model positions * p0 and p1. Will break on word boundaries or character boundaries - * depending on the break argument given in construction of this + * depending on the break argument given in construction of this * WrappedPlainView. Used by the nested WrappedLine class to determine * when to start the next logical line. * @param p0 the start model position @@ -307,16 +307,16 @@ public class WrappedPlainView extends BoxView implements TabExpander false); return pos; } - + void updateMetrics() { Container component = getContainer(); metrics = component.getFontMetrics(component.getFont()); tabSize = getTabSize()* metrics.charWidth('m'); } - + /** - * Determines the preferred span along the given axis. Implemented to + * Determines the preferred span along the given axis. Implemented to * cache the font metrics and then call the super classes method. */ public float getPreferredSpan (int axis) @@ -324,9 +324,9 @@ public class WrappedPlainView extends BoxView implements TabExpander updateMetrics(); return super.getPreferredSpan(axis); } - + /** - * Determines the minimum span along the given axis. Implemented to + * Determines the minimum span along the given axis. Implemented to * cache the font metrics and then call the super classes method. */ public float getMinimumSpan (int axis) @@ -334,9 +334,9 @@ public class WrappedPlainView extends BoxView implements TabExpander updateMetrics(); return super.getMinimumSpan(axis); } - + /** - * Determines the maximum span along the given axis. Implemented to + * Determines the maximum span along the given axis. Implemented to * cache the font metrics and then call the super classes method. */ public float getMaximumSpan (int axis) @@ -344,7 +344,7 @@ public class WrappedPlainView extends BoxView implements TabExpander updateMetrics(); return super.getMaximumSpan(axis); } - + /** * Called when something was inserted. Overridden so that * the view factory creates WrappedLine views. @@ -361,7 +361,7 @@ public class WrappedPlainView extends BoxView implements TabExpander if (v != null) v.insertUpdate(e, r, f); } - + /** * Called when something is removed. Overridden so that * the view factory creates WrappedLine views. @@ -378,7 +378,7 @@ public class WrappedPlainView extends BoxView implements TabExpander if (v != null) v.removeUpdate(e, r, f); } - + /** * Called when the portion of the Document that this View is responsible * for changes. Overridden so that the view factory creates @@ -425,9 +425,9 @@ public class WrappedPlainView extends BoxView implements TabExpander public View create(Element elem) { return new WrappedLine(elem); - } + } } - + /** * Renders the <code>Element</code> that is associated with this * <code>View</code>. Caches the metrics and then calls @@ -444,7 +444,7 @@ public class WrappedPlainView extends BoxView implements TabExpander JTextComponent comp = (JTextComponent)getContainer(); // Ensure metrics are up-to-date. updateMetrics(); - + selectionStart = comp.getSelectionStart(); selectionEnd = comp.getSelectionEnd(); @@ -457,7 +457,7 @@ public class WrappedPlainView extends BoxView implements TabExpander super.paint(g, a); } - + /** * Sets the size of the View. Implemented to update the metrics * and then call super method. @@ -469,12 +469,12 @@ public class WrappedPlainView extends BoxView implements TabExpander preferenceChanged(null, true, true); super.setSize(width, height); } - + class WrappedLine extends View - { + { /** Used to cache the number of lines for this View **/ int numLines = 1; - + public WrappedLine(Element elem) { super(elem); @@ -518,26 +518,26 @@ public class WrappedPlainView extends BoxView implements TabExpander this); else lh.paintLayeredHighlights(g, currStart, currEnd, s, tc, this); - + } drawLine(currStart, currEnd, g, rect.x, rect.y + metrics.getAscent()); - - rect.y += lineHeight; + + rect.y += lineHeight; if (currEnd == currStart) currStart ++; else currStart = currEnd; - + count++; - + } - + if (count != numLines) { numLines = count; preferenceChanged(this, false, true); } - + } /** @@ -546,7 +546,7 @@ public class WrappedPlainView extends BoxView implements TabExpander * accordingly. */ private int determineNumLines() - { + { int nLines = 0; int end = getEndOffset(); for (int i = getStartOffset(); i < end;) @@ -555,7 +555,7 @@ public class WrappedPlainView extends BoxView implements TabExpander // careful: check that there's no off-by-one problem here // depending on which position calculateBreakPosition returns int breakPoint = calculateBreakPosition(i, end); - + if (breakPoint == i) i = breakPoint + 1; else @@ -563,12 +563,12 @@ public class WrappedPlainView extends BoxView implements TabExpander } return nLines; } - + /** * Determines the preferred span for this view along the given axis. - * + * * @param axis the axis (either X_AXIS or Y_AXIS) - * + * * @return the preferred span along the given axis. * @throws IllegalArgumentException if axis is not X_AXIS or Y_AXIS */ @@ -582,19 +582,19 @@ public class WrappedPlainView extends BoxView implements TabExpander updateMetrics(); return numLines * metrics.getHeight(); } - + throw new IllegalArgumentException("Invalid axis for getPreferredSpan: " + axis); } - + /** * Provides a mapping from model space to view space. - * + * * @param pos the position in the model * @param a the region into which the view is rendered * @param b the position bias (forward or backward) - * - * @return a box in view space that represents the given position + * + * @return a box in view space that represents the given position * in model space * @throws BadLocationException if the given model position is invalid */ @@ -602,26 +602,26 @@ public class WrappedPlainView extends BoxView implements TabExpander throws BadLocationException { Rectangle rect = a.getBounds(); - + // Throwing a BadLocationException is an observed behavior of the RI. if (rect.isEmpty()) throw new BadLocationException("Unable to calculate view coordinates " + "when allocation area is empty.", pos); - + Segment s = getLineBuffer(); int lineHeight = metrics.getHeight(); - - // Return a rectangle with width 1 and height equal to the height + + // Return a rectangle with width 1 and height equal to the height // of the text rect.height = lineHeight; rect.width = 1; int currLineStart = getStartOffset(); int end = getEndOffset(); - + if (pos < currLineStart || pos >= end) throw new BadLocationException("invalid offset", pos); - + while (true) { int currLineEnd = calculateBreakPosition(currLineStart, end); @@ -629,7 +629,7 @@ public class WrappedPlainView extends BoxView implements TabExpander // the width of the text from currLineStart to pos and add that // to rect.x if (pos >= currLineStart && pos < currLineEnd) - { + { try { getDocument().getText(currLineStart, pos - currLineStart, s); @@ -645,7 +645,7 @@ public class WrappedPlainView extends BoxView implements TabExpander } // Increment rect.y so we're checking the next logical line rect.y += lineHeight; - + // Increment currLineStart to the model position of the start // of the next logical line if (currLineEnd == currLineStart) @@ -658,12 +658,12 @@ public class WrappedPlainView extends BoxView implements TabExpander /** * Provides a mapping from view space to model space. - * + * * @param x the x coordinate in view space * @param y the y coordinate in view space * @param a the region into which the view is rendered * @param b the position bias (forward or backward) - * + * * @return the location in the model that best represents the * given point in view space */ @@ -672,19 +672,19 @@ public class WrappedPlainView extends BoxView implements TabExpander Segment s = getLineBuffer(); Rectangle rect = a.getBounds(); int currLineStart = getStartOffset(); - + // Although calling modelToView with the last possible offset will // cause a BadLocationException in CompositeView it is allowed // to return that offset in viewToModel. int end = getEndOffset(); - + int lineHeight = metrics.getHeight(); if (y < rect.y) return currLineStart; if (y > rect.y + rect.height) return end - 1; - + // Note: rect.x and rect.width do not represent the width of painted // text but the area where text *may* be painted. This means the width // is most of the time identical to the component's width. @@ -705,7 +705,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { // Shouldn't happen } - + int offset = Utilities.getTabbedTextOffset(s, metrics, rect.x, (int) x, WrappedPlainView.this, @@ -719,27 +719,27 @@ public class WrappedPlainView extends BoxView implements TabExpander } // Increment rect.y so we're checking the next logical line rect.y += lineHeight; - + // Increment currLineStart to the model position of the start // of the next logical line. currLineStart = currLineEnd; } - + return end; - } - + } + /** * <p>This method is called from insertUpdate and removeUpdate.</p> - * + * * <p>If the number of lines in the document has changed, just repaint - * the whole thing (note, could improve performance by not repainting - * anything above the changes). If the number of lines hasn't changed, + * the whole thing (note, could improve performance by not repainting + * anything above the changes). If the number of lines hasn't changed, * just repaint the given Rectangle.</p> - * + * * <p>Note that the <code>Rectangle</code> argument may be <code>null</code> - * when the allocation area is empty.</code> - * + * when the allocation area is empty.</code> + * * @param a the Rectangle to repaint if the number of lines hasn't changed */ void updateDamage (Rectangle a) @@ -754,11 +754,11 @@ public class WrappedPlainView extends BoxView implements TabExpander else if (a != null) getContainer().repaint(a.x, a.y, a.width, a.height); } - + /** * This method is called when something is inserted into the Document * that this View is displaying. - * + * * @param changes the DocumentEvent for the changes. * @param a the allocation of the View * @param f the ViewFactory used to rebuild @@ -766,13 +766,13 @@ public class WrappedPlainView extends BoxView implements TabExpander public void insertUpdate (DocumentEvent changes, Shape a, ViewFactory f) { Rectangle r = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); - updateDamage(r); + updateDamage(r); } - + /** * This method is called when something is removed from the Document * that this View is displaying. - * + * * @param changes the DocumentEvent for the changes. * @param a the allocation of the View * @param f the ViewFactory used to rebuild @@ -787,9 +787,9 @@ public class WrappedPlainView extends BoxView implements TabExpander // makes View.forwardUpdate() skip this method call. // However this seems to cause no trouble and as it reduces the // number of method calls it can stay this way. - + Rectangle r = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); - updateDamage(r); + updateDamage(r); } } } diff --git a/libjava/classpath/javax/swing/text/html/BRView.java b/libjava/classpath/javax/swing/text/html/BRView.java index 7d0d5164d49..6f465c9d170 100644 --- a/libjava/classpath/javax/swing/text/html/BRView.java +++ b/libjava/classpath/javax/swing/text/html/BRView.java @@ -48,14 +48,14 @@ class BRView { /** * Creates the new BR view. - * + * * @param elem the HTML element, representing the view. */ public BRView(Element elem) { super(elem); } - + /** * Always return ForcedBreakWeight for the X_AXIS, BadBreakWeight for the * Y_AXIS. diff --git a/libjava/classpath/javax/swing/text/html/BlockView.java b/libjava/classpath/javax/swing/text/html/BlockView.java index b05c983e922..1c3397126ed 100644 --- a/libjava/classpath/javax/swing/text/html/BlockView.java +++ b/libjava/classpath/javax/swing/text/html/BlockView.java @@ -1,4 +1,4 @@ -/* BlockView.java -- +/* BlockView.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -159,9 +159,9 @@ public class BlockView extends BoxView private HashMap positionInfo; /** - * Creates a new view that represents an html box. + * Creates a new view that represents an html box. * This can be used for a number of elements. - * + * * @param elem - the element to create a view for * @param axis - either View.X_AXIS or View.Y_AXIS */ @@ -176,26 +176,26 @@ public class BlockView extends BoxView * Creates the parent view for this. It is called before * any other methods, if the parent view is working properly. * Implemented to forward to the superclass and call - * setPropertiesFromAttributes to set the paragraph + * setPropertiesFromAttributes to set the paragraph * properties. - * + * * @param parent - the new parent, or null if the view - * is being removed from a parent it was added to. + * is being removed from a parent it was added to. */ public void setParent(View parent) { super.setParent(parent); - + if (parent != null) setPropertiesFromAttributes(); } - + /** * Calculates the requirements along the major axis. * This is implemented to call the superclass and then * adjust it if the CSS width or height attribute is specified * and applicable. - * + * * @param axis - the axis to check the requirements for. * @param r - the SizeRequirements. If null, one is created. * @return the new SizeRequirements object. @@ -205,7 +205,7 @@ public class BlockView extends BoxView { if (r == null) r = new SizeRequirements(); - + if (setCSSSpan(r, axis)) { // If we have set the span from CSS, then we need to adjust @@ -229,7 +229,7 @@ public class BlockView extends BoxView * This is implemented to call the superclass and then * adjust it if the CSS width or height attribute is specified * and applicable. - * + * * @param axis - the axis to check the requirements for. * @param r - the SizeRequirements. If null, one is created. * @return the new SizeRequirements object. @@ -239,7 +239,7 @@ public class BlockView extends BoxView { if (r == null) r = new SizeRequirements(); - + if (setCSSSpan(r, axis)) { // If we have set the span from CSS, then we need to adjust @@ -277,7 +277,7 @@ public class BlockView extends BoxView /** * Sets the span on the SizeRequirements object according to the * according CSS span value, when it is set. - * + * * @param r the size requirements * @param axis the axis * @@ -325,14 +325,14 @@ public class BlockView extends BoxView * perpendicular to the axis that it represents). The results * of the layout are placed in the given arrays which are * the allocations to the children along the minor axis. - * - * @param targetSpan - the total span given to the view, also + * + * @param targetSpan - the total span given to the view, also * used to layout the children. * @param axis - the minor axis * @param offsets - the offsets from the origin of the view for * all the child views. This is a return value and is filled in by this * function. - * @param spans - the span of each child view. This is a return value and is + * @param spans - the span of each child view. This is a return value and is * filled in by this function. */ protected void layoutMinorAxis(int targetSpan, int axis, @@ -469,7 +469,7 @@ public class BlockView extends BoxView * Paints using the given graphics configuration and shape. * This delegates to the css box painter to paint the * border and background prior to the interior. - * + * * @param g - Graphics configuration * @param a - the Shape to render into. */ @@ -487,7 +487,7 @@ public class BlockView extends BoxView /** * Fetches the attributes to use when painting. - * + * * @return the attributes of this model. */ public AttributeSet getAttributes() @@ -496,10 +496,10 @@ public class BlockView extends BoxView attributes = getStyleSheet().getViewAttributes(this); return attributes; } - + /** * Gets the resize weight. - * + * * @param axis - the axis to get the resize weight for. * @return the resize weight. * @throws IllegalArgumentException - for an invalid axis @@ -513,10 +513,10 @@ public class BlockView extends BoxView return 1; throw new IllegalArgumentException("Invalid Axis"); } - + /** * Gets the alignment. - * + * * @param axis - the axis to get the alignment for. * @return the alignment. */ @@ -537,11 +537,11 @@ public class BlockView extends BoxView } throw new IllegalArgumentException("Invalid Axis"); } - + /** * Gives notification from the document that attributes were * changed in a location that this view is responsible for. - * + * * @param ev - the change information * @param a - the current shape of the view * @param f - the factory to use to rebuild if the view has children. @@ -550,7 +550,7 @@ public class BlockView extends BoxView Shape a, ViewFactory f) { super.changedUpdate(ev, a, f); - + // If more elements were added, then need to set the properties for them int currPos = ev.getOffset(); if (currPos <= getStartOffset() @@ -560,10 +560,10 @@ public class BlockView extends BoxView /** * Determines the preferred span along the axis. - * + * * @param axis - the view to get the preferred span for. * @return the span the view would like to be painted into >=0/ - * The view is usually told to paint into the span that is returned, + * The view is usually told to paint into the span that is returned, * although the parent may choose to resize or break the view. * @throws IllegalArgumentException - for an invalid axis */ @@ -573,13 +573,13 @@ public class BlockView extends BoxView return super.getPreferredSpan(axis); throw new IllegalArgumentException("Invalid Axis"); } - + /** * Determines the minimum span along the axis. - * + * * @param axis - the axis to get the minimum span for. * @return the span the view would like to be painted into >=0/ - * The view is usually told to paint into the span that is returned, + * The view is usually told to paint into the span that is returned, * although the parent may choose to resize or break the view. * @throws IllegalArgumentException - for an invalid axis */ @@ -589,13 +589,13 @@ public class BlockView extends BoxView return super.getMinimumSpan(axis); throw new IllegalArgumentException("Invalid Axis"); } - + /** * Determines the maximum span along the axis. - * + * * @param axis - the axis to get the maximum span for. * @return the span the view would like to be painted into >=0/ - * The view is usually told to paint into the span that is returned, + * The view is usually told to paint into the span that is returned, * although the parent may choose to resize or break the view. * @throws IllegalArgumentException - for an invalid axis */ @@ -605,7 +605,7 @@ public class BlockView extends BoxView return super.getMaximumSpan(axis); throw new IllegalArgumentException("Invalid Axis"); } - + /** * Updates any cached values that come from attributes. */ @@ -640,7 +640,7 @@ public class BlockView extends BoxView /** * Gets the default style sheet. - * + * * @return the style sheet */ protected StyleSheet getStyleSheet() diff --git a/libjava/classpath/javax/swing/text/html/CSS.java b/libjava/classpath/javax/swing/text/html/CSS.java index 77f94a60878..0a77bdff916 100644 --- a/libjava/classpath/javax/swing/text/html/CSS.java +++ b/libjava/classpath/javax/swing/text/html/CSS.java @@ -455,7 +455,7 @@ public class CSS implements Serializable * * @param attr the attribute string * @param inherited if the attribute should be inherited or not - * @param def a default value; may be <code>null</code> + * @param def a default value; may be <code>null</code> */ Attribute(String attr, boolean inherited, String def) { @@ -463,7 +463,7 @@ public class CSS implements Serializable isInherited = inherited; defaultValue = def; if( attributeMap == null) - attributeMap = new HashMap(); + attributeMap = new HashMap(); attributeMap.put( attr, this ); } diff --git a/libjava/classpath/javax/swing/text/html/CSSBorder.java b/libjava/classpath/javax/swing/text/html/CSSBorder.java index fff6b01a170..23fcdccc6e6 100644 --- a/libjava/classpath/javax/swing/text/html/CSSBorder.java +++ b/libjava/classpath/javax/swing/text/html/CSSBorder.java @@ -308,7 +308,7 @@ class CSSBorder // Right border. paintBorderLine(g, x + width - right / 2, y, x + width - right / 2, y + height, topStyle, right, rightColor, true); - + } private void paintBorderLine(Graphics g, int x1, int y1, int x2, int y2, diff --git a/libjava/classpath/javax/swing/text/html/CSSParser.java b/libjava/classpath/javax/swing/text/html/CSSParser.java index d49ac3a6fc9..5024c7b595d 100644 --- a/libjava/classpath/javax/swing/text/html/CSSParser.java +++ b/libjava/classpath/javax/swing/text/html/CSSParser.java @@ -43,18 +43,18 @@ import java.io.*; /** * Parses a CSS document. This works by way of a delegate that implements the * CSSParserCallback interface. The delegate is notified of the following - * events: - * - Import statement: handleImport - * - Selectors handleSelector. This is invoked for each string. For example if - * the Reader contained p, bar , a {}, the delegate would be notified 4 times, - * for 'p,' 'bar' ',' and 'a'. - * - When a rule starts, startRule + * events: + * - Import statement: handleImport + * - Selectors handleSelector. This is invoked for each string. For example if + * the Reader contained p, bar , a {}, the delegate would be notified 4 times, + * for 'p,' 'bar' ',' and 'a'. + * - When a rule starts, startRule * - Properties in the rule via the handleProperty. This * is invoked one per property/value key, eg font size: foo;, would cause the - * delegate to be notified once with a value of 'font size'. - * - Values in the rule via the handleValue, this is notified for the total value. + * delegate to be notified once with a value of 'font size'. + * - Values in the rule via the handleValue, this is notified for the total value. * - When a rule ends, endRule - * + * * @author Lillian Angel (langel@redhat.com) */ class CSSParser @@ -68,7 +68,7 @@ class CSSParser { /** * Handles the import statment in the document. - * + * * @param imp - the import string */ public abstract void handleImport(String imp); @@ -85,21 +85,21 @@ class CSSParser /** * Handles the selector of a rule. - * + * * @param selector - the selector in the rule */ public abstract void handleSelector(String selector); /** * Handles the properties in the document. - * + * * @param property - the property in the document. */ public abstract void handleProperty(String property); /** * Handles the values in the document. - * + * * @param value - the value to handle. */ public abstract void handleValue(String value); @@ -212,7 +212,7 @@ class CSSParser /** * Appends a character to the token buffer. - * + * * @param c - the character to append */ private void append(char c) @@ -233,7 +233,7 @@ class CSSParser /** * Fetches the next token. - * + * * @param c - the character to fetch. * @return the location * @throws IOException - any i/o error encountered while reading @@ -276,7 +276,7 @@ class CSSParser /** * Reads a character from the stream. - * + * * @return the number of characters read or -1 if end of stream is reached. * @throws IOException - any i/o encountered while reading */ @@ -293,19 +293,19 @@ class CSSParser /** * Parses the the contents of the reader using the * callback. - * + * * @param reader - the reader to read from * @param callback - the callback instance * @param parsingDeclaration - true if parsing a declaration * @throws IOException - any i/o error from the reader */ - void parse(Reader reader, CSSParser.CSSParserCallback callback, + void parse(Reader reader, CSSParser.CSSParserCallback callback, boolean parsingDeclaration) throws IOException { this.reader = reader; this.callback = callback; - + try { if (!parsingDeclaration) @@ -322,7 +322,7 @@ class CSSParser /** * Skips any white space, returning the character after the white space. - * + * * @return the character after the whitespace * @throws IOException - any i/o error from the reader */ @@ -337,7 +337,7 @@ class CSSParser return next; next = tempNext; } - + // Its all whitespace return END; } @@ -345,7 +345,7 @@ class CSSParser /** * Gets the next statement, returning false if the end is reached. * A statement is either an At-rule, or a ruleset. - * + * * @return false if the end is reached * @throws IOException - any i/o error from the reader */ @@ -368,7 +368,7 @@ class CSSParser parseAtRule(); else parseRuleSet(); - break; + break; case END: return false; } @@ -377,28 +377,28 @@ class CSSParser /** * Parses an @ rule, stopping at a matching brace pair, or ;. - * + * * @throws IOException - any i/o error from the reader */ private void parseAtRule() throws IOException - { - // An At-Rule begins with the "@" character followed immediately by a keyword. - // Following the keyword separated by a space is an At-rule statement appropriate - // to the At-keyword used. If the At-Rule is a simple declarative statement - // (charset, import, fontdef), it is terminated by a semi-colon (";".) - // If the At-Rule is a conditional or informative statement (media, page, font-face), - // it is followed by optional arguments and then a style declaration block inside matching - // curly braces ("{", "}".) At-Rules are sometimes nestable, depending on the context. + { + // An At-Rule begins with the "@" character followed immediately by a keyword. + // Following the keyword separated by a space is an At-rule statement appropriate + // to the At-keyword used. If the At-Rule is a simple declarative statement + // (charset, import, fontdef), it is terminated by a semi-colon (";".) + // If the At-Rule is a conditional or informative statement (media, page, font-face), + // it is followed by optional arguments and then a style declaration block inside matching + // curly braces ("{", "}".) At-Rules are sometimes nestable, depending on the context. // If any part of an At-Rule is not understood, it should be ignored. - + // FIXME: Not Implemented - // call handleimport + // call handleimport } /** - * Parses the next rule set, which is a selector followed by a declaration + * Parses the next rule set, which is a selector followed by a declaration * block. - * + * * @throws IOException - any i/o error from the reader */ private void parseRuleSet() throws IOException @@ -411,9 +411,9 @@ class CSSParser } /** - * Parses a set of selectors, returning false if the end of the stream is + * Parses a set of selectors, returning false if the end of the stream is * reached. - * + * * @return false if the end of stream is reached * @throws IOException - any i/o error from the reader */ @@ -421,13 +421,13 @@ class CSSParser { // FIXME: Not Implemented // call handleselector - return false; + return false; } /** * Parses a declaration block. Which a number of declarations followed by a * })]. - * + * * @throws IOException - any i/o error from the reader */ private void parseDeclarationBlock() throws IOException @@ -439,7 +439,7 @@ class CSSParser /** * Parses a single declaration, which is an identifier a : and another identifier. * This returns the last token seen. - * + * * @returns the last token * @throws IOException - any i/o error from the reader */ @@ -447,13 +447,13 @@ class CSSParser { // call handleValue // FIXME: Not Implemented - return 0; + return 0; } /** * Parses identifiers until c is encountered, returning the ending token, * which will be IDENTIFIER if c is found. - * + * * @param c - the stop character * @param wantsBlocks - true if blocks are wanted * @return the ending token @@ -469,7 +469,7 @@ class CSSParser /** * Parses till a matching block close is encountered. This is only appropriate * to be called at the top level (no nesting). - * + * * @param i - FIXME * @throws IOException - any i/o error from the reader */ @@ -481,7 +481,7 @@ class CSSParser /** * Gets an identifier, returning true if the length of the string is greater * than 0, stopping when c, whitespace, or one of {}()[] is hit. - * + * * @param c - the stop character * @return returns true if the length of the string > 0 * @throws IOException - any i/o error from the reader @@ -494,7 +494,7 @@ class CSSParser /** * Reads till c is encountered, escaping characters as necessary. - * + * * @param c - the stop character * @throws IOException - any i/o error from the reader */ @@ -505,7 +505,7 @@ class CSSParser /** * Parses a comment block. - * + * * @throws IOException - any i/o error from the reader */ private void readComment() throws IOException @@ -516,7 +516,7 @@ class CSSParser /** * Called when a block start is encountered ({[. - * + * * @param start of block */ private void startBlock(int start) @@ -526,7 +526,7 @@ class CSSParser /** * Called when an end block is encountered )]} - * + * * @param end of block */ private void endBlock(int end) @@ -536,18 +536,18 @@ class CSSParser /** * Checks if currently in a block. - * + * * @return true if currently in a block. */ private boolean inBlock() { // FIXME: Not Implemented - return false; + return false; } /** * Supports one character look ahead, this will throw if called twice in a row. - * + * * @param c - the character to push. * @throws IOException - if called twice in a row */ @@ -559,5 +559,3 @@ class CSSParser pushedChar = c; } } - - diff --git a/libjava/classpath/javax/swing/text/html/FormView.java b/libjava/classpath/javax/swing/text/html/FormView.java index ef362bd3d9b..61c568f026a 100644 --- a/libjava/classpath/javax/swing/text/html/FormView.java +++ b/libjava/classpath/javax/swing/text/html/FormView.java @@ -96,7 +96,7 @@ import javax.swing.text.StyleConstants; * <td>JList in JScrollPane</td></tr> * <tr><td>select, size unspecified or == 1</td><td>JComboBox</td></tr> * <tr><td>textarea, text</td><td>JTextArea in JScrollPane</td></tr> - * <tr><td>input, file</td><td>JTextField</td></tr> + * <tr><td>input, file</td><td>JTextField</td></tr> * </table> * * @author Roman Kennke (kennke@aicas.com) @@ -352,7 +352,7 @@ public class FormView /** * If the value attribute of an <code><input type="submit">> * tag is not specified, then this string is used. - * + * * @deprecated As of JDK1.3 the value is fetched from the UIManager property * <code>FormView.submitButtonText</code>. */ @@ -362,7 +362,7 @@ public class FormView /** * If the value attribute of an <code><input type="reset">> * tag is not specified, then this string is used. - * + * * @deprecated As of JDK1.3 the value is fetched from the UIManager property * <code>FormView.resetButtonText</code>. */ @@ -638,7 +638,7 @@ public class FormView } else { - data = name + ".x=" + p.x + "&" + name + ".y=" + p.y; + data = name + ".x=" + p.x + "&" + name + ".y=" + p.y; } return data; } diff --git a/libjava/classpath/javax/swing/text/html/HRuleView.java b/libjava/classpath/javax/swing/text/html/HRuleView.java index 3bae5eb8e83..9be1efff3bd 100644 --- a/libjava/classpath/javax/swing/text/html/HRuleView.java +++ b/libjava/classpath/javax/swing/text/html/HRuleView.java @@ -55,15 +55,15 @@ class HRuleView extends InlineView { /** * The null view, indicating, that nothing should be painted ahead the - * breaking point. + * breaking point. */ View nullView; - + /** * The height of the horizontal dash area. */ static int HEIGHT = 4; - + /** * The imaginary invisible view that stays after end of line after the * breaking procedure. It occupies on character. @@ -74,7 +74,7 @@ class HRuleView extends InlineView * The break offset that becomes the views start offset. */ int breakOffset; - + /** * Return the end offset that is always one char after the break offset. */ @@ -82,7 +82,7 @@ class HRuleView extends InlineView { return breakOffset + 1; } - + /** * Return the start offset that has been passed in a constructor. */ @@ -90,10 +90,10 @@ class HRuleView extends InlineView { return breakOffset; } - + /** * Create the new instance of this view. - * + * * @param element the element (inherited from the HR view) * @param offset the position where the HR view has been broken */ @@ -103,7 +103,7 @@ class HRuleView extends InlineView breakOffset = offset; } } - + /** * Creates the new HR view. */ @@ -120,11 +120,11 @@ class HRuleView extends InlineView public int getBreakWeight(int axis, float pos, float len) { if (axis == X_AXIS && ((getEndOffset() - getStartOffset()) > 1)) - return ForcedBreakWeight; + return ForcedBreakWeight; else - return BadBreakWeight; + return BadBreakWeight; } - + /** * Draws the double line, upped black and the lower light gray. */ @@ -143,7 +143,7 @@ class HRuleView extends InlineView g.setColor(Color.black); g.drawLine(x, y++, w, h++); - g.setColor(Color.lightGray); + g.setColor(Color.lightGray); g.drawLine(x, y, w, h); } @@ -160,7 +160,7 @@ class HRuleView extends InlineView else return this; } - + /** * Returns the width of the container for the horizontal axis and the * thickness of the dash area for the vertical axis. @@ -176,7 +176,7 @@ class HRuleView extends InlineView return 640; } else - return HEIGHT; + return HEIGHT; } /** diff --git a/libjava/classpath/javax/swing/text/html/HTMLDocument.java b/libjava/classpath/javax/swing/text/html/HTMLDocument.java index f3d3ce3faaf..9545be4e8f3 100644 --- a/libjava/classpath/javax/swing/text/html/HTMLDocument.java +++ b/libjava/classpath/javax/swing/text/html/HTMLDocument.java @@ -76,7 +76,7 @@ import javax.swing.text.html.HTML.Tag; * data structure when it is needed to parse HTML and then obtain the content of * the certain types of tags. This class also has methods for modifying the HTML * content. - * + * * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) * @author Anthony Balkissoon (abalkiss@redhat.com) * @author Lillian Angel (langel@redhat.com) @@ -85,7 +85,7 @@ public class HTMLDocument extends DefaultStyledDocument { /** A key for document properies. The value for the key is * a Vector of Strings of comments not found in the body. - */ + */ public static final String AdditionalComments = "AdditionalComments"; URL baseURL = null; boolean preservesUnknownTags = true; @@ -110,22 +110,22 @@ public class HTMLDocument extends DefaultStyledDocument { this(new GapContent(BUFFER_SIZE_DEFAULT), new StyleSheet()); } - + /** - * Constructs an HTML document with the default content storage + * Constructs an HTML document with the default content storage * implementation and the specified style/attribute storage mechanism. - * + * * @param styles - the style sheet */ public HTMLDocument(StyleSheet styles) { this(new GapContent(BUFFER_SIZE_DEFAULT), styles); } - + /** - * Constructs an HTML document with the given content storage implementation + * Constructs an HTML document with the given content storage implementation * and the given style/attribute storage mechanism. - * + * * @param c - the document's content * @param styles - the style sheet */ @@ -133,21 +133,21 @@ public class HTMLDocument extends DefaultStyledDocument { super(c, styles); } - + /** - * Gets the style sheet with the document display rules (CSS) that were specified + * Gets the style sheet with the document display rules (CSS) that were specified * in the HTML document. - * + * * @return - the style sheet */ public StyleSheet getStyleSheet() { return (StyleSheet) getAttributeContext(); } - + /** * This method creates a root element for the new document. - * + * * @return the new default root */ protected AbstractElement createDefaultRoot() @@ -180,12 +180,12 @@ public class HTMLDocument extends DefaultStyledDocument return html; } - + /** * This method returns an HTMLDocument.RunElement object attached to - * parent representing a run of text from p0 to p1. The run has + * parent representing a run of text from p0 to p1. The run has * attributes described by a. - * + * * @param parent - the parent element * @param a - the attributes for the element * @param p0 - the beginning of the range >= 0 @@ -202,7 +202,7 @@ public class HTMLDocument extends DefaultStyledDocument /** * This method returns an HTMLDocument.BlockElement object representing the * attribute set a and attached to parent. - * + * * @param parent - the parent element * @param a - the attributes for the element * @@ -212,20 +212,20 @@ public class HTMLDocument extends DefaultStyledDocument { return new BlockElement(parent, a); } - + /** * Returns the parser used by this HTMLDocument to insert HTML. - * + * * @return the parser used by this HTMLDocument to insert HTML. */ public HTMLEditorKit.Parser getParser() { - return parser; + return parser; } - + /** * Sets the parser used by this HTMLDocument to insert HTML. - * + * * @param p the parser to use */ public void setParser (HTMLEditorKit.Parser p) @@ -235,25 +235,25 @@ public class HTMLDocument extends DefaultStyledDocument /** * Sets the number of tokens to buffer before trying to display the * Document. - * + * * @param n the number of tokens to buffer */ public void setTokenThreshold (int n) { tokenThreshold = n; } - + /** * Returns the number of tokens that are buffered before the document * is rendered. - * + * * @return the number of tokens buffered */ public int getTokenThreshold () { return tokenThreshold; } - + /** * Returns the location against which to resolve relative URLs. * This is the document's URL if the document was loaded from a URL. @@ -264,7 +264,7 @@ public class HTMLDocument extends DefaultStyledDocument { return baseURL; } - + /** * Sets the location against which to resolve relative URLs. * @param u the new base URL @@ -274,7 +274,7 @@ public class HTMLDocument extends DefaultStyledDocument baseURL = u; getStyleSheet().setBase(u); } - + /** * Returns whether or not the parser preserves unknown HTML tags. * @return true if the parser preserves unknown tags @@ -283,7 +283,7 @@ public class HTMLDocument extends DefaultStyledDocument { return preservesUnknownTags; } - + /** * Sets the behaviour of the parser when it encounters unknown HTML tags. * @param preservesTags true if the parser should preserve unknown tags. @@ -292,7 +292,7 @@ public class HTMLDocument extends DefaultStyledDocument { preservesUnknownTags = preservesTags; } - + /** * An iterator to iterate through LeafElements in the document. */ @@ -308,7 +308,7 @@ public class HTMLDocument extends DefaultStyledDocument tag = t; it = new ElementIterator(doc); } - + /** * Return the attributes for the tag associated with this iteartor * @return the AttributeSet @@ -464,7 +464,7 @@ public class HTMLDocument extends DefaultStyledDocument { int start = el.getStartOffset(); int end = el.getEndOffset(); - + StringBuilder html = new StringBuilder(); html.append("<frame"); if (url != null) @@ -499,7 +499,7 @@ public class HTMLDocument extends DefaultStyledDocument { return new HTMLDocument.LeafIterator(t, this); } - + /** * An iterator over a particular type of tag. */ @@ -510,26 +510,26 @@ public class HTMLDocument extends DefaultStyledDocument * @return the <code>AttributeSet</code> (null if none found). */ public abstract AttributeSet getAttributes(); - + /** * Get the end of the range for the current occurrence of the tag * being defined and having the same attributes. * @return the end of the range */ public abstract int getEndOffset(); - + /** * Get the start of the range for the current occurrence of the tag * being defined and having the same attributes. * @return the start of the range (-1 if it can't be found). */ public abstract int getStartOffset(); - + /** * Move the iterator forward. */ public abstract void next(); - + /** * Indicates whether or not the iterator currently represents an occurrence * of the tag. @@ -537,33 +537,33 @@ public class HTMLDocument extends DefaultStyledDocument * tag. */ public abstract boolean isValid(); - + /** * Type of tag this iterator represents. * @return the tag. */ public abstract HTML.Tag getTag(); } - + public class BlockElement extends AbstractDocument.BranchElement { public BlockElement (Element parent, AttributeSet a) { super(parent, a); } - + /** - * Gets the resolving parent. Since HTML attributes are not + * Gets the resolving parent. Since HTML attributes are not * inherited at the model level, this returns null. */ public AttributeSet getResolveParent() { return null; } - + /** * Gets the name of the element. - * + * * @return the name of the element if it exists, null otherwise. */ public String getName() @@ -579,29 +579,29 @@ public class HTMLDocument extends DefaultStyledDocument } /** - * RunElement represents a section of text that has a set of + * RunElement represents a section of text that has a set of * HTML character level attributes assigned to it. */ public class RunElement extends AbstractDocument.LeafElement { - + /** * Constructs an element that has no children. It represents content * within the document. - * + * * @param parent - parent of this * @param a - elements attributes * @param start - the start offset >= 0 - * @param end - the end offset + * @param end - the end offset */ public RunElement(Element parent, AttributeSet a, int start, int end) { super(parent, a, start, end); } - + /** * Gets the name of the element. - * + * * @return the name of the element if it exists, null otherwise. */ public String getName() @@ -614,11 +614,11 @@ public class HTMLDocument extends DefaultStyledDocument name = super.getName(); return name; } - + /** * Gets the resolving parent. HTML attributes do not inherit at the * model level, so this method returns null. - * + * * @return null */ public AttributeSet getResolveParent() @@ -626,10 +626,10 @@ public class HTMLDocument extends DefaultStyledDocument return null; } } - + /** * A reader to load an HTMLDocument with HTML structure. - * + * * @author Anthony Balkissoon abalkiss at redhat dot com */ public class HTMLReader extends HTMLEditorKit.ParserCallback @@ -648,51 +648,51 @@ public class HTMLDocument extends DefaultStyledDocument * Holds the current character attribute set * */ protected MutableAttributeSet charAttr = new SimpleAttributeSet(); - - protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>(); + + protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>(); /** * The parse stack. It holds the current element tree path. */ private Stack<HTML.Tag> parseStack = new Stack<HTML.Tag>(); - /** + /** * A stack for character attribute sets * */ Stack charAttrStack = new Stack(); - + /** A mapping between HTML.Tag objects and the actions that handle them **/ HashMap tagToAction; - + /** Tells us whether we've received the '</html>' tag yet **/ boolean endHTMLEncountered = false; - - /** - * Related to the constructor with explicit insertTag + + /** + * Related to the constructor with explicit insertTag */ int popDepth; - + /** * Related to the constructor with explicit insertTag - */ + */ int pushDepth; - - /** + + /** * Related to the constructor with explicit insertTag - */ + */ int offset; - + /** * The tag (inclusve), after that the insertion should start. */ HTML.Tag insertTag; - + /** * This variable becomes true after the insert tag has been encountered. */ boolean insertTagEncountered; - + /** A temporary variable that helps with the printing out of debug information **/ boolean debug = false; @@ -767,7 +767,7 @@ public class HTMLDocument extends DefaultStyledDocument { // Nothing to do here. } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. By default does nothing. @@ -779,7 +779,7 @@ public class HTMLDocument extends DefaultStyledDocument } public class BlockAction extends TagAction - { + { /** * This method is called when a start tag is seen for one of the types * of tags associated with this Action. @@ -789,7 +789,7 @@ public class HTMLDocument extends DefaultStyledDocument // Tell the parse buffer to open a new block for this tag. blockOpen(t, a); } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -800,7 +800,7 @@ public class HTMLDocument extends DefaultStyledDocument blockClose(t); } } - + public class CharacterAction extends TagAction { /** @@ -827,7 +827,7 @@ public class HTMLDocument extends DefaultStyledDocument public void end(HTML.Tag t) { popCharacterStyle(); - } + } } /** @@ -909,7 +909,7 @@ public class HTMLDocument extends DefaultStyledDocument super.start(t, a); } } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1012,7 +1012,7 @@ public class HTMLDocument extends DefaultStyledDocument { super.end(t); buttonGroups = null; - } + } } /** @@ -1035,7 +1035,7 @@ public class HTMLDocument extends DefaultStyledDocument { blockOpen(t, a); } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1043,7 +1043,7 @@ public class HTMLDocument extends DefaultStyledDocument public void end(HTML.Tag t) { blockClose(t); - } + } } /** @@ -1062,7 +1062,7 @@ public class HTMLDocument extends DefaultStyledDocument blockClose(HTML.Tag.IMPLIED); } } - + public class ParagraphAction extends BlockAction { /** @@ -1073,7 +1073,7 @@ public class HTMLDocument extends DefaultStyledDocument { super.start(t, a); } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1081,7 +1081,7 @@ public class HTMLDocument extends DefaultStyledDocument public void end(HTML.Tag t) { super.end(t); - } + } } /** @@ -1100,7 +1100,7 @@ public class HTMLDocument extends DefaultStyledDocument a.addAttribute(CSS.Attribute.WHITE_SPACE, "pre"); blockOpen(HTML.Tag.IMPLIED, a); } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1110,11 +1110,11 @@ public class HTMLDocument extends DefaultStyledDocument blockClose(HTML.Tag.IMPLIED); inPreTag = false; blockClose(t); - } + } } - + /** - * Inserts the elements that are represented by ths single tag with + * Inserts the elements that are represented by ths single tag with * attributes (only). The closing tag, even if present, mut follow * immediately after the starting tag without providing any additional * information. Hence the {@link TagAction#end} method need not be @@ -1130,7 +1130,7 @@ public class HTMLDocument extends DefaultStyledDocument addSpecialElement(t, a); } } - + class AreaAction extends TagAction { /** @@ -1142,7 +1142,7 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1151,7 +1151,7 @@ public class HTMLDocument extends DefaultStyledDocument throws NotImplementedException { // FIXME: Implement. - } + } } /** @@ -1200,7 +1200,7 @@ public class HTMLDocument extends DefaultStyledDocument baseTarget = (String) a.getAttribute(HTML.Attribute.TARGET); } } - + class HeadAction extends BlockAction { /** @@ -1213,7 +1213,7 @@ public class HTMLDocument extends DefaultStyledDocument // FIXME: Implement. super.start(t, a); } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1234,7 +1234,7 @@ public class HTMLDocument extends DefaultStyledDocument super.end(t); } } - + class LinkAction extends HiddenAction { /** @@ -1295,13 +1295,13 @@ public class HTMLDocument extends DefaultStyledDocument ex.printStackTrace(); } } - } + } } } } - + } - + class MapAction extends TagAction { /** @@ -1313,7 +1313,7 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1322,9 +1322,9 @@ public class HTMLDocument extends DefaultStyledDocument throws NotImplementedException { // FIXME: Implement. - } + } } - + class MetaAction extends TagAction { /** @@ -1336,7 +1336,7 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1345,7 +1345,7 @@ public class HTMLDocument extends DefaultStyledDocument throws NotImplementedException { // FIXME: Implement. - } + } } class StyleAction extends TagAction @@ -1358,7 +1358,7 @@ public class HTMLDocument extends DefaultStyledDocument { inStyleTag = true; } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1366,9 +1366,9 @@ public class HTMLDocument extends DefaultStyledDocument public void end(HTML.Tag t) { inStyleTag = false; - } + } } - + class TitleAction extends TagAction { /** @@ -1380,7 +1380,7 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. } - + /** * Called when an end tag is seen for one of the types of tags associated * with this Action. @@ -1389,14 +1389,14 @@ public class HTMLDocument extends DefaultStyledDocument throws NotImplementedException { // FIXME: Implement. - } - } - + } + } + public HTMLReader(int offset) { this (offset, 0, 0, null); } - + public HTMLReader(int offset, int popDepth, int pushDepth, HTML.Tag insertTag) { @@ -1407,7 +1407,7 @@ public class HTMLDocument extends DefaultStyledDocument threshold = getTokenThreshold(); initTags(); } - + void initTags() { tagToAction = new HashMap(72); @@ -1427,7 +1427,7 @@ public class HTMLDocument extends DefaultStyledDocument MetaAction metaAction = new MetaAction(); StyleAction styleAction = new StyleAction(); TitleAction titleAction = new TitleAction(); - + ConvertAction convertAction = new ConvertAction(); tagToAction.put(HTML.Tag.A, characterAction); tagToAction.put(HTML.Tag.ADDRESS, characterAction); @@ -1486,7 +1486,7 @@ public class HTMLDocument extends DefaultStyledDocument tagToAction.put(HTML.Tag.SELECT, formAction); tagToAction.put(HTML.Tag.SMALL, characterAction); tagToAction.put(HTML.Tag.STRIKE, characterAction); - tagToAction.put(HTML.Tag.S, characterAction); + tagToAction.put(HTML.Tag.S, characterAction); tagToAction.put(HTML.Tag.STRONG, characterAction); tagToAction.put(HTML.Tag.STYLE, styleAction); tagToAction.put(HTML.Tag.SUB, characterAction); @@ -1502,7 +1502,7 @@ public class HTMLDocument extends DefaultStyledDocument tagToAction.put(HTML.Tag.UL, blockAction); tagToAction.put(HTML.Tag.VAR, characterAction); } - + /** * Pushes the current character style onto the stack. * @@ -1511,9 +1511,9 @@ public class HTMLDocument extends DefaultStyledDocument { charAttrStack.push(charAttr.copyAttributes()); } - + /** - * Pops a character style off of the stack and uses it as the + * Pops a character style off of the stack and uses it as the * current character style. * */ @@ -1522,12 +1522,12 @@ public class HTMLDocument extends DefaultStyledDocument if (!charAttrStack.isEmpty()) charAttr = (MutableAttributeSet) charAttrStack.pop(); } - + /** * Registers a given tag with a given Action. All of the well-known tags * are registered by default, but this method can change their behaviour * or add support for custom or currently unsupported tags. - * + * * @param t the Tag to register * @param a the Action for the Tag */ @@ -1535,7 +1535,7 @@ public class HTMLDocument extends DefaultStyledDocument { tagToAction.put (t, a); } - + /** * This is the last method called on the HTMLReader, allowing any pending * changes to be flushed to the HTMLDocument. @@ -1565,9 +1565,9 @@ public class HTMLDocument extends DefaultStyledDocument } /** - * This method is called by the parser to indicate a block of + * This method is called by the parser to indicate a block of * text was encountered. Should insert the text appropriately. - * + * * @param data the text that was inserted * @param pos the position at which the text was inserted */ @@ -1589,15 +1589,15 @@ public class HTMLDocument extends DefaultStyledDocument } else addContent(data, 0, data.length); - + } } - + /** * Checks if the HTML tag should be inserted. The tags before insert tag (if * specified) are not inserted. Also, the tags after the end of the html are * not inserted. - * + * * @return true if the tag should be inserted, false otherwise. */ private boolean shouldInsert() @@ -1605,11 +1605,11 @@ public class HTMLDocument extends DefaultStyledDocument return ! endHTMLEncountered && (insertTagEncountered || insertTag == null); } - + /** * This method is called by the parser and should route the call to the * proper handler for the tag. - * + * * @param t the HTML.Tag * @param a the attribute set * @param pos the position at which the tag was encountered @@ -1626,10 +1626,10 @@ public class HTMLDocument extends DefaultStyledDocument action.start(t, a); } } - + /** * This method called by parser to handle a comment block. - * + * * @param data the comment * @param pos the position at which the comment was encountered */ @@ -1645,11 +1645,11 @@ public class HTMLDocument extends DefaultStyledDocument } } } - + /** * This method is called by the parser and should route the call to the * proper handler for the tag. - * + * * @param t the HTML.Tag * @param pos the position at which the tag was encountered */ @@ -1666,11 +1666,11 @@ public class HTMLDocument extends DefaultStyledDocument action.end(t); } } - + /** * This is a callback from the parser that should be routed to the * appropriate handler for the tag. - * + * * @param t the HTML.Tag that was encountered * @param a the attribute set * @param pos the position at which the tag was encountered @@ -1690,12 +1690,12 @@ public class HTMLDocument extends DefaultStyledDocument } } } - + /** * This is invoked after the stream has been parsed but before it has been * flushed. - * - * @param eol one of \n, \r, or \r\n, whichever was encountered the most in + * + * @param eol one of \n, \r, or \r\n, whichever was encountered the most in * parsing the stream * @since 1.3 */ @@ -1703,11 +1703,11 @@ public class HTMLDocument extends DefaultStyledDocument { // FIXME: Implement. } - + /** * Adds the given text to the textarea document. Called only when we are - * within a textarea. - * + * within a textarea. + * * @param data the text to add to the textarea */ protected void textAreaContent(char[] data) @@ -1726,7 +1726,7 @@ public class HTMLDocument extends DefaultStyledDocument assert false; } } - + /** * Adds the given text that was encountered in a <PRE> element. * This adds synthesized lines to hold the text runs. @@ -1754,11 +1754,11 @@ public class HTMLDocument extends DefaultStyledDocument addContent(data, start, data.length - start); } } - + /** - * Instructs the parse buffer to create a block element with the given + * Instructs the parse buffer to create a block element with the given * attributes. - * + * * @param t the tag that requires opening a new block * @param attr the attribute set for the new block */ @@ -1809,9 +1809,9 @@ public class HTMLDocument extends DefaultStyledDocument } /** - * Instructs the parse buffer to close the block element associated with + * Instructs the parse buffer to close the block element associated with * the given HTML.Tag - * + * * @param t the HTML.Tag that is closing its block */ protected void blockClose(HTML.Tag t) @@ -1837,14 +1837,14 @@ public class HTMLDocument extends DefaultStyledDocument } element = new DefaultStyledDocument.ElementSpec(null, - DefaultStyledDocument.ElementSpec.EndTagType); + DefaultStyledDocument.ElementSpec.EndTagType); parseBuffer.addElement(element); } - + /** * Adds text to the appropriate context using the current character * attribute set. - * + * * @param data the text to add * @param offs the offset at which to add it * @param length the length of the text to add @@ -1853,11 +1853,11 @@ public class HTMLDocument extends DefaultStyledDocument { addContent(data, offs, length, true); } - + /** * Adds text to the appropriate context using the current character * attribute set, and possibly generating an IMPLIED Tag if necessary. - * + * * @param data the text to add * @param offs the offset at which to add it * @param length the length of the text to add @@ -1876,7 +1876,7 @@ public class HTMLDocument extends DefaultStyledDocument DefaultStyledDocument.ElementSpec element; AttributeSet attributes = null; - // Copy the attribute set, don't use the same object because + // Copy the attribute set, don't use the same object because // it may change if (charAttr != null) attributes = charAttr.copyAttributes(); @@ -1887,7 +1887,7 @@ public class HTMLDocument extends DefaultStyledDocument element = new DefaultStyledDocument.ElementSpec(attributes, DefaultStyledDocument.ElementSpec.ContentType, data, offs, length); - + // Add the element to the buffer parseBuffer.addElement(element); @@ -1905,10 +1905,10 @@ public class HTMLDocument extends DefaultStyledDocument } } } - + /** * Adds content that is specified in the attribute set. - * + * * @param t the HTML.Tag * @param a the attribute set specifying the special content */ @@ -1920,37 +1920,37 @@ public class HTMLDocument extends DefaultStyledDocument } a.addAttribute(StyleConstants.NameAttribute, t); - + // The two spaces are required because some special elements like HR // must be broken. At least two characters are needed to break into the // two parts. DefaultStyledDocument.ElementSpec spec = new DefaultStyledDocument.ElementSpec(a.copyAttributes(), - DefaultStyledDocument.ElementSpec.ContentType, + DefaultStyledDocument.ElementSpec.ContentType, new char[] {' '}, 0, 1 ); parseBuffer.add(spec); } - + } - + /** - * Gets the reader for the parser to use when loading the document with HTML. - * + * Gets the reader for the parser to use when loading the document with HTML. + * * @param pos - the starting position * @return - the reader */ public HTMLEditorKit.ParserCallback getReader(int pos) { return new HTMLReader(pos); - } - + } + /** - * Gets the reader for the parser to use when loading the document with HTML. - * + * Gets the reader for the parser to use when loading the document with HTML. + * * @param pos - the starting position * @param popDepth - the number of EndTagTypes to generate before inserting - * @param pushDepth - the number of StartTagTypes with a direction - * of JoinNextDirection that should be generated before inserting, + * @param pushDepth - the number of StartTagTypes with a direction + * of JoinNextDirection that should be generated before inserting, * but after the end tags have been generated. * @param insertTag - the first tag to start inserting into document * @return - the reader @@ -1962,13 +1962,13 @@ public class HTMLDocument extends DefaultStyledDocument { return new HTMLReader(pos, popDepth, pushDepth, insertTag); } - + /** * Gets the reader for the parser to use when inserting the HTML fragment into * the document. Checks if the parser is present, sets the parent in the * element stack and removes any actions for BODY (it can be only one body in * a HTMLDocument). - * + * * @param pos - the starting position * @param popDepth - the number of EndTagTypes to generate before inserting * @param pushDepth - the number of StartTagTypes with a direction of @@ -2009,14 +2009,14 @@ public class HTMLDocument extends DefaultStyledDocument super.handleEndTag(t, pos); } }; - + return reader; - } - + } + /** * Gets the child element that contains the attribute with the value or null. * Not thread-safe. - * + * * @param e - the element to begin search at * @param attribute - the desired attribute * @param value - the desired value @@ -2029,14 +2029,14 @@ public class HTMLDocument extends DefaultStyledDocument { if (e.getAttributes().containsAttribute(attribute, value)) return e; - + int count = e.getElementCount(); for (int j = 0; j < count; j++) { Element child = e.getElement(j); if (child.getAttributes().containsAttribute(attribute, value)) return child; - + Element grandChild = getElement(child, attribute, value); if (grandChild != null) return grandChild; @@ -2044,13 +2044,13 @@ public class HTMLDocument extends DefaultStyledDocument } return null; } - + /** * Returns the element that has the given id Attribute (for instance, <p id * ='my paragraph >'). If it is not found, null is returned. The HTML tag, * having this attribute, is not checked by this method and can be any. The * method is not thread-safe. - * + * * @param attrId - the value of the attribute id to look for * @return the element that has the given id. */ @@ -2059,25 +2059,25 @@ public class HTMLDocument extends DefaultStyledDocument return getElement(getDefaultRootElement(), HTML.Attribute.ID, attrId); } - + /** * Replaces the children of the given element with the contents of * the string. The document must have an HTMLEditorKit.Parser set. * This will be seen as at least two events, n inserts followed by a remove. - * + * * @param elem - the brance element whose children will be replaced * @param htmlText - the string to be parsed and assigned to element. * @throws BadLocationException * @throws IOException - * @throws IllegalArgumentException - if elem is a leaf + * @throws IllegalArgumentException - if elem is a leaf * @throws IllegalStateException - if an HTMLEditorKit.Parser has not been set */ - public void setInnerHTML(Element elem, String htmlText) + public void setInnerHTML(Element elem, String htmlText) throws BadLocationException, IOException { if (elem.isLeaf()) throw new IllegalArgumentException("Element is a leaf"); - + int start = elem.getStartOffset(); int end = elem.getEndOffset(); @@ -2086,18 +2086,18 @@ public class HTMLDocument extends DefaultStyledDocument // TODO charset getParser().parse(new StringReader(htmlText), reader, true); - + // Remove the previous content remove(start, end - start); } - + /** * Replaces the given element in the parent with the string. When replacing a * leaf, this will attempt to make sure there is a newline present if one is * needed. This may result in an additional element being inserted. This will * be seen as at least two events, n inserts followed by a remove. The * HTMLEditorKit.Parser must be set. - * + * * @param elem - the branch element whose parent will be replaced * @param htmlText - the string to be parsed and assigned to elem * @throws BadLocationException @@ -2112,18 +2112,18 @@ public void setOuterHTML(Element elem, String htmlText) int end = elem.getEndOffset(); remove(start, end-start); - + HTMLEditorKit.ParserCallback reader = getInsertingReader( start, 0, 0, HTML.Tag.BODY, elem); // TODO charset getParser().parse(new StringReader(htmlText), reader, true); } - + /** * Inserts the string before the start of the given element. The parser must * be set. - * + * * @param elem - the element to be the root for the new text. * @param htmlText - the string to be parsed and assigned to elem * @throws BadLocationException @@ -2139,12 +2139,12 @@ public void setOuterHTML(Element elem, String htmlText) // TODO charset getParser().parse(new StringReader(htmlText), reader, true); } - + /** * Inserts the string at the end of the element. If elem's children are * leaves, and the character at elem.getEndOffset() - 1 is a newline, then it * will be inserted before the newline. The parser must be set. - * + * * @param elem - the element to be the root for the new text * @param htmlText - the text to insert * @throws BadLocationException @@ -2161,11 +2161,11 @@ public void setOuterHTML(Element elem, String htmlText) getParser().parse(new StringReader(htmlText), reader, true); } - + /** * Inserts the string after the end of the given element. * The parser must be set. - * + * * @param elem - the element to be the root for the new text * @param htmlText - the text to insert * @throws BadLocationException @@ -2181,11 +2181,11 @@ public void setOuterHTML(Element elem, String htmlText) // TODO charset getParser().parse(new StringReader(htmlText), reader, true); } - + /** * Inserts the string at the start of the element. * The parser must be set. - * + * * @param elem - the element to be the root for the new text * @param htmlText - the text to insert * @throws BadLocationException diff --git a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java index 45381d60e87..e3505d3c21f 100644 --- a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java +++ b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java @@ -89,7 +89,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Serializable, Cloneable, Accessible { - + /** * Fires the hyperlink events on the associated component * when needed. @@ -107,16 +107,16 @@ public class HTMLEditorKit /** * Constructor */ - public LinkController() + public LinkController() { super(); } - + /** * Dispatched when the mouse is clicked. If the component * is read-only, then the clicked event is used to drive an * attempt to follow the reference specified by a link - * + * * @param e - the mouse event */ public void mouseClicked(MouseEvent e) @@ -130,20 +130,20 @@ public class HTMLEditorKit activateLink(pos, editor, e.getX(), e.getY()); } } - + /** * Dispatched when the mouse is dragged on a component. - * + * * @param e - the mouse event. */ public void mouseDragged(MouseEvent e) { // Nothing to do here. } - + /** * Dispatched when the mouse cursor has moved into the component. - * + * * @param e - the mouse event. */ public void mouseMoved(MouseEvent e) @@ -248,7 +248,7 @@ public class HTMLEditorKit if (event != null) editor.fireHyperlinkUpdate(event); } - + } /** @@ -275,7 +275,7 @@ public class HTMLEditorKit { URL base = doc.getBase(); url = new URL(base, href); - + } catch (MalformedURLException ex) { @@ -303,11 +303,11 @@ public class HTMLEditorKit return ev; } } - + /** * This class is used to insert a string of HTML into an existing * document. At least 2 HTML.Tags need to be supplied. The first Tag (parentTag) - * identifies the parent in the document to add the elements to. The second, (addTag), + * identifies the parent in the document to add the elements to. The second, (addTag), * identifies that the first tag should be added to the document as seen in the string. * The parser will generate all appropriate (opening/closing tags_ even if they are not * in the HTML string passed in. @@ -315,28 +315,28 @@ public class HTMLEditorKit public static class InsertHTMLTextAction extends HTMLTextAction { - + /** * Tag in HTML to start adding tags from. */ protected HTML.Tag addTag; - + /** * Alternate tag in HTML to start adding tags from if parentTag is * not found and alternateParentTag is not found. - */ + */ protected HTML.Tag alternateAddTag; - + /** * Alternate tag to check if parentTag is not found. */ protected HTML.Tag alternateParentTag; - + /** * HTML to insert. */ protected String html; - + /** * Tag to check for in the document. */ @@ -344,21 +344,21 @@ public class HTMLEditorKit /** * Initializes all fields. - * + * * @param name - the name of the document. * @param html - the html to insert * @param parentTag - the parent tag to check for * @param addTag - the tag to start adding from */ - public InsertHTMLTextAction(String name, String html, + public InsertHTMLTextAction(String name, String html, HTML.Tag parentTag, HTML.Tag addTag) { this(name, html, parentTag, addTag, null, null); } - + /** * Initializes all fields and calls super - * + * * @param name - the name of the document. * @param html - the html to insert * @param parentTag - the parent tag to check for @@ -366,9 +366,9 @@ public class HTMLEditorKit * @param alternateParentTag - the alternate parent tag * @param alternateAddTag - the alternate add tag */ - public InsertHTMLTextAction(String name, String html, HTML.Tag parentTag, - HTML.Tag addTag, HTML.Tag alternateParentTag, - HTML.Tag alternateAddTag) + public InsertHTMLTextAction(String name, String html, HTML.Tag parentTag, + HTML.Tag addTag, HTML.Tag alternateParentTag, + HTML.Tag alternateAddTag) { super(name); // Fields are for easy access when the action is applied to an actual @@ -379,11 +379,11 @@ public class HTMLEditorKit this.alternateParentTag = alternateParentTag; this.alternateAddTag = alternateAddTag; } - + /** * HTMLEditorKit.insertHTML is called. If an exception is * thrown, it is wrapped in a RuntimeException and thrown. - * + * * @param editor - the editor to use to get the editorkit * @param doc - * the Document to insert the HTML into. @@ -419,12 +419,12 @@ public class HTMLEditorKit + offset).initCause(ex); } } - + /** * Invoked when inserting at a boundary. Determines the number of pops, * and then the number of pushes that need to be performed. The it calls * insertHTML. - * + * * @param editor - * the editor to use to get the editorkit * @param doc - @@ -449,12 +449,12 @@ public class HTMLEditorKit insertAtBoundry(editor, doc, offset, insertElement, html, parentTag, addTag); } - + /** - * Invoked when inserting at a boundary. Determines the number of pops, + * Invoked when inserting at a boundary. Determines the number of pops, * and then the number of pushes that need to be performed. The it calls * insertHTML. - * + * * @param editor - the editor to use to get the editorkit * @param doc - * the Document to insert the HTML into. @@ -464,7 +464,7 @@ public class HTMLEditorKit * @param html - the html to insert * @param parentTag - the parent tag * @param addTag - the first tag - * + * * @deprecated as of v1.3, use insertAtBoundary */ protected void insertAtBoundry(JEditorPane editor, @@ -518,10 +518,10 @@ public class HTMLEditorKit insertHTML(editor, doc, offset, html, pops, pushes, addTag); } } - + /** * Inserts the HTML. - * + * * @param ae - the action performed */ public void actionPerformed(ActionEvent ae) @@ -619,25 +619,25 @@ public class HTMLEditorKit } } } - + /** * Abstract Action class that helps inserting HTML into an existing document. */ public abstract static class HTMLTextAction extends StyledEditorKit.StyledTextAction { - + /** * Constructor */ - public HTMLTextAction(String name) + public HTMLTextAction(String name) { super(name); } - + /** * Gets the HTMLDocument from the JEditorPane. - * + * * @param e - the editor pane * @return the html document. */ @@ -648,25 +648,25 @@ public class HTMLEditorKit return (HTMLDocument) d; throw new IllegalArgumentException("Document is not a HTMLDocument."); } - + /** * Gets the HTMLEditorKit - * + * * @param e - the JEditorPane to get the HTMLEditorKit from. * @return the HTMLEditorKit */ - protected HTMLEditorKit getHTMLEditorKit(JEditorPane e) + protected HTMLEditorKit getHTMLEditorKit(JEditorPane e) { EditorKit d = e.getEditorKit(); if (d instanceof HTMLEditorKit) return (HTMLEditorKit) d; throw new IllegalArgumentException("EditorKit is not a HTMLEditorKit."); } - + /** * Returns an array of Elements that contain the offset. * The first elements corresponds to the roots of the doc. - * + * * @param doc - the document to get the Elements from. * @param offset - the offset the Elements must contain * @return an array of all the elements containing the offset. @@ -676,7 +676,7 @@ public class HTMLEditorKit { return getElementsAt(doc.getDefaultRootElement(), offset, 0); } - + /** * Helper function to get all elements using recursion. */ @@ -697,12 +697,12 @@ public class HTMLEditorKit } return elements; } - + /** * Returns the number of elements, starting at the deepest point, needed * to get an element representing tag. -1 if no elements are found, 0 if * the parent of the leaf at offset represents the tag. - * + * * @param doc - * the document to search * @param offset - @@ -718,7 +718,7 @@ public class HTMLEditorKit Element root = doc.getDefaultRootElement(); int num = -1; Element next = root.getElement(root.getElementIndex(offset)); - + while (!next.isLeaf()) { num++; @@ -729,11 +729,11 @@ public class HTMLEditorKit } return num; } - + /** * Gets the deepest element at offset with the * matching tag. - * + * * @param doc - the document to search * @param offset - the offset to check for * @param tag - the tag to match @@ -744,7 +744,7 @@ public class HTMLEditorKit { Element element = doc.getDefaultRootElement(); Element tagElement = null; - + while (element != null) { Object otag = element.getAttributes().getAttribute( @@ -753,11 +753,11 @@ public class HTMLEditorKit tagElement = element; element = element.getElement(element.getElementIndex(offset)); } - + return tagElement; } } - + /** * A {@link ViewFactory} that is able to create {@link View}s for * the <code>Element</code>s that are supported. @@ -765,7 +765,7 @@ public class HTMLEditorKit public static class HTMLFactory implements ViewFactory { - + /** * Constructor */ @@ -773,7 +773,7 @@ public class HTMLEditorKit { // Do Nothing here. } - + /** * Creates a {@link View} for the specified <code>Element</code>. * @@ -815,7 +815,7 @@ public class HTMLEditorKit view = new BlockView(element, View.X_AXIS); else if (tag == HTML.Tag.IMG) view = new ImageView(element); - + else if (tag == HTML.Tag.CONTENT) view = new InlineView(element); else if (tag == HTML.Tag.HEAD) @@ -847,7 +847,7 @@ public class HTMLEditorKit return view; } } - + /** * The abstract HTML parser declaration. */ @@ -888,7 +888,7 @@ public class HTMLEditorKit { // Nothing to do here. } - + /** * The parser calls this method after it finishes parsing the document. */ @@ -1048,9 +1048,9 @@ public class HTMLEditorKit * The "ident paragraph right" action. */ public static final String PARA_INDENT_RIGHT = "html-para-indent-right"; - + /** - * Actions for HTML + * Actions for HTML */ private static final Action[] defaultActions = { @@ -1083,43 +1083,43 @@ public class HTMLEditorKit "<pre></pre>", HTML.Tag.BODY, HTML.Tag.PRE) // TODO: The reference impl has an InsertHRAction too. }; - + /** * The current style sheet. */ private StyleSheet styleSheet; - + /** * The ViewFactory for HTMLFactory. */ HTMLFactory viewFactory; - + /** * The Cursor for links. */ Cursor linkCursor; - + /** * The default cursor. */ Cursor defaultCursor; - + /** * The parser. */ Parser parser; - + /** * The mouse listener used for links. */ private LinkController linkController; - + /** The content type */ String contentType = "text/html"; - + /** The input attributes defined by default.css */ MutableAttributeSet inputAttributes; - + /** The editor pane used. */ JEditorPane editorPane; @@ -1139,11 +1139,11 @@ public class HTMLEditorKit linkController = new LinkController(); autoFormSubmission = true; } - + /** - * Gets a factory suitable for producing views of any + * Gets a factory suitable for producing views of any * models that are produced by this kit. - * + * * @return the view factory suitable for producing views. */ public ViewFactory getViewFactory() @@ -1152,7 +1152,7 @@ public class HTMLEditorKit viewFactory = new HTMLFactory(); return viewFactory; } - + /** * Create a text storage model for this type of editor. * @@ -1175,7 +1175,7 @@ public class HTMLEditorKit /** * Get the parser that this editor kit uses for reading HTML streams. This * method can be overridden to use the alternative parser. - * + * * @return the HTML parser (by default, {@link ParserDelegator}). */ protected Parser getParser() @@ -1186,17 +1186,17 @@ public class HTMLEditorKit } return parser; } - + /** * Inserts HTML into an existing document. - * + * * @param doc - the Document to insert the HTML into. * @param offset - where to begin inserting the HTML. * @param html - the String to insert - * @param popDepth - the number of ElementSpec.EndTagTypes + * @param popDepth - the number of ElementSpec.EndTagTypes * to generate before inserting - * @param pushDepth - the number of ElementSpec.StartTagTypes - * with a direction of ElementSpec.JoinNextDirection that + * @param pushDepth - the number of ElementSpec.StartTagTypes + * with a direction of ElementSpec.JoinNextDirection that * should be generated before * @param insertTag - the first tag to start inserting into document * @throws IOException - on any I/O error @@ -1216,18 +1216,18 @@ public class HTMLEditorKit ParserCallback pc = doc.getReader(offset, popDepth, pushDepth, insertTag); // FIXME: What should ignoreCharSet be set to? - + // parser.parse inserts html into the buffer parser.parse(new StringReader(html), pc, false); pc.flush(); } - + /** - * Inserts content from the given stream. Inserting HTML into a non-empty - * document must be inside the body Element, if you do not insert into - * the body an exception will be thrown. When inserting into a non-empty + * Inserts content from the given stream. Inserting HTML into a non-empty + * document must be inside the body Element, if you do not insert into + * the body an exception will be thrown. When inserting into a non-empty * document all tags outside of the body (head, title) will be dropped. - * + * * @param in - the stream to read from * @param doc - the destination for the insertion * @param pos - the location in the document to place the content @@ -1245,14 +1245,14 @@ public class HTMLEditorKit throw new BadLocationException("Bad location", pos); if (parser == null) throw new IOException("Parser is null."); - + HTMLDocument hd = ((HTMLDocument) doc); if (editorPane != null) hd.setBase(editorPane.getPage()); ParserCallback pc = hd.getReader(pos); - + // FIXME: What should ignoreCharSet be set to? - + // parser.parse inserts html into the buffer parser.parse(in, pc, false); pc.flush(); @@ -1262,11 +1262,11 @@ public class HTMLEditorKit // the string is inserted in the document as usual. super.read(in, doc, pos); } - + /** - * Writes content from a document to the given stream in + * Writes content from a document to the given stream in * an appropriate format. - * + * * @param out - the stream to write to * @param doc - the source for the write * @param pos - the location in the document to get the content. @@ -1293,21 +1293,21 @@ public class HTMLEditorKit else super.write(out, doc, pos, len); } - + /** * Gets the content type that the kit supports. * This kit supports the type text/html. - * + * * @returns the content type supported. */ public String getContentType() { return contentType; - } - + } + /** * Creates a copy of the editor kit. - * + * * @return a copy of this. */ public Object clone() @@ -1317,12 +1317,12 @@ public class HTMLEditorKit copy.linkController = new LinkController(); return copy; } - + /** - * Copies the key/values in elements AttributeSet into set. + * Copies the key/values in elements AttributeSet into set. * This does not copy component, icon, or element names attributes. - * This is called anytime the caret moves over a different location. - * + * This is called anytime the caret moves over a different location. + * * @param element - the element to create the input attributes for. * @param set - the set to copy the values into. */ @@ -1333,10 +1333,10 @@ public class HTMLEditorKit set.addAttributes(element.getAttributes()); // FIXME: Not fully implemented. } - + /** * Called when this is installed into the JEditorPane. - * + * * @param c - the JEditorPane installed into. */ public void install(JEditorPane c) @@ -1346,11 +1346,11 @@ public class HTMLEditorKit c.addMouseMotionListener(linkController); editorPane = c; } - + /** * Called when the this is removed from the JEditorPane. * It unregisters any listeners. - * + * * @param c - the JEditorPane being removed from. */ public void deinstall(JEditorPane c) @@ -1360,35 +1360,35 @@ public class HTMLEditorKit c.removeMouseMotionListener(linkController); editorPane = null; } - + /** * Gets the AccessibleContext associated with this. - * + * * @return the AccessibleContext for this. */ public AccessibleContext getAccessibleContext() { - // FIXME: Should return an instance of + // FIXME: Should return an instance of // javax.swing.text.html.AccessibleHTML$RootHTMLAccessibleContext // Not implemented yet. return null; } - + /** * Gets the action list. This list is supported by the superclass * augmented by the collection of actions defined locally for style * operations. - * + * * @return an array of all the actions */ public Action[] getActions() { return TextAction.augmentList(super.getActions(), defaultActions); } - + /** * Returns the default cursor. - * + * * @return the default cursor */ public Cursor getDefaultCursor() @@ -1397,10 +1397,10 @@ public class HTMLEditorKit defaultCursor = Cursor.getDefaultCursor(); return defaultCursor; } - + /** * Returns the cursor for links. - * + * * @return the cursor for links. */ public Cursor getLinkCursor() @@ -1409,42 +1409,42 @@ public class HTMLEditorKit linkCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); return linkCursor; } - + /** * Sets the Cursor for links. - * + * * @param cursor - the new cursor for links. */ public void setLinkCursor(Cursor cursor) { linkCursor = cursor; } - + /** * Sets the default cursor. - * + * * @param cursor - the new default cursor. */ public void setDefaultCursor(Cursor cursor) { defaultCursor = cursor; } - + /** * Gets the input attributes used for the styled editing actions. - * + * * @return the attribute set */ public MutableAttributeSet getInputAttributes() { return inputAttributes; } - + /** - * Get the set of styles currently being used to render the HTML elements. - * By default the resource specified by DEFAULT_CSS gets loaded, and is + * Get the set of styles currently being used to render the HTML elements. + * By default the resource specified by DEFAULT_CSS gets loaded, and is * shared by all HTMLEditorKit instances. - * + * * @return the style sheet. */ public StyleSheet getStyleSheet() @@ -1467,14 +1467,14 @@ public class HTMLEditorKit } return styleSheet; } - + /** - * Set the set of styles to be used to render the various HTML elements. - * These styles are specified in terms of CSS specifications. Each document - * produced by the kit will have a copy of the sheet which it can add the - * document specific styles to. By default, the StyleSheet specified is shared - * by all HTMLEditorKit instances. - * + * Set the set of styles to be used to render the various HTML elements. + * These styles are specified in terms of CSS specifications. Each document + * produced by the kit will have a copy of the sheet which it can add the + * document specific styles to. By default, the StyleSheet specified is shared + * by all HTMLEditorKit instances. + * * @param s - the new style sheet */ public void setStyleSheet(StyleSheet s) @@ -1505,7 +1505,7 @@ public class HTMLEditorKit /** * Sets whether or not the editor kit should automatically submit forms. - * + * * @param auto <code>true</code> when the editor kit should handle form * submission, <code>false</code> otherwise * diff --git a/libjava/classpath/javax/swing/text/html/HTMLWriter.java b/libjava/classpath/javax/swing/text/html/HTMLWriter.java index 6a5e6ed58fe..55d25ccbb63 100644 --- a/libjava/classpath/javax/swing/text/html/HTMLWriter.java +++ b/libjava/classpath/javax/swing/text/html/HTMLWriter.java @@ -1,4 +1,4 @@ -/* HTMLWriter.java -- +/* HTMLWriter.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -76,7 +76,7 @@ public class HTMLWriter /** * We keep a reference of the HTMLDocument passed by the construct. */ - private HTMLDocument htmlDoc = null; + private HTMLDocument htmlDoc = null; /** * Used to keep track of which embedded has been written out. @@ -84,10 +84,10 @@ public class HTMLWriter private HashSet<HTML.Tag> openEmbeddedTagHashSet = null; private String new_line_str = "" + NEWLINE; - + private char[] html_entity_char_arr = {'<', '>', '&', '"'}; - private String[] html_entity_escape_str_arr = {"<", ">", "&", + private String[] html_entity_escape_str_arr = {"<", ">", "&", """}; // variables used to output Html Fragment @@ -137,7 +137,7 @@ public class HTMLWriter doc_len_remaining = len; htmlFragmentParentHashSet = new HashSet<Element>(); } // public HTMLWriter(Writer writer, HTMLDocument doc, int pos, int len) - + /** * Call this method to start outputing HTML. * @@ -155,7 +155,7 @@ public class HTMLWriter // Normal traversal. traverse(rootElem); } // if(doc_pos == -1 && doc_len == -1) - else + else { // Html fragment traversal. if (doc_pos == -1 || doc_len == -1) @@ -164,7 +164,7 @@ public class HTMLWriter startElem = htmlDoc.getCharacterElement(doc_pos); - int start_offset = startElem.getStartOffset(); + int start_offset = startElem.getStartOffset(); // Positions before start_offset will not be traversed, and thus // will not be counted. @@ -206,7 +206,7 @@ public class HTMLWriter } // for(int i = 0; i < tag_arr.length; i++) } // public void write() throws IOException, BadLocationException - + /** * Writes all the attributes in the attrSet, except for attrbutes with * keys of <code>javax.swing.text.html.HTML.Tag</code>, @@ -226,7 +226,7 @@ public class HTMLWriter { Object key = attrNameEnum.nextElement(); Object value = attrSet.getAttribute(key); - + // HTML.Attribute.ENDTAG is an instance, not a class. if (!((key instanceof HTML.Tag) || (key instanceof StyleConstants) || (key == HTML.Attribute.ENDTAG))) @@ -240,7 +240,7 @@ public class HTMLWriter } // if(!((key instanceof HTML.Tag) || (key instanceof // StyleConstants) || (key == HTML.Attribute.ENDTAG))) } // while(attrNameEnum.hasMoreElements()) - + } // protected void writeAttributes(AttributeSet attrSet) throws IOException /** @@ -266,10 +266,10 @@ public class HTMLWriter { writeRaw("</" + elem_name + ">"); } // if(isBlockTag(attrSet)) - + } // protected void emptyTag(Element paramElem) // throws IOException, BadLocationException - + /** * Determines if it is a block tag or not. * @@ -326,7 +326,7 @@ public class HTMLWriter writeAttributes(attrSet); writeRaw(">"); - Document tempDocument = + Document tempDocument = (Document) attrSet.getAttribute(StyleConstants.ModelAttribute); writeRaw(tempDocument.getText(0, tempDocument.getLength())); @@ -528,9 +528,9 @@ public class HTMLWriter /** * Closes out an unwanted embedded tag. The tags from the * openEmbededTagHashSet not found in attrSet will be written out. - * + * * @param attrSet the AttributeSet of the element to write out - * + * * @throws IOException on any I/O exceptions */ protected void closeOutUnwantedEmbeddedTags(AttributeSet attrSet) @@ -542,7 +542,7 @@ public class HTMLWriter for (int i = 0; i < tag_arr.length; i++) { HTML.Tag key = tag_arr[i]; - + if (!attrSet.isDefined(key)) { writeRaw("</" + key.toString() + ">"); @@ -592,10 +592,10 @@ public class HTMLWriter } // protected void output(char[] chars, int off, int len) // throws IOException - + //------------------------------------------------------------------------- // private methods - + /** * The main method used to traverse through the elements. * @@ -627,7 +627,7 @@ public class HTMLWriter else if (matchNameAttribute(attrSet, HTML.Tag.IMPLIED)) { int child_elem_count = currElem.getElementCount(); - + if (child_elem_count > 0) { for (int i = 0; i < child_elem_count; i++) @@ -665,7 +665,7 @@ public class HTMLWriter indent(); writeRaw("<title>"); - String title_str = + String title_str = (String) htmlDoc.getProperty(HTMLDocument.TitleProperty); if (title_str != null) @@ -726,7 +726,7 @@ public class HTMLWriter else { emptyTag(currElem); - } // else + } // else } // else } // else @@ -842,7 +842,7 @@ public class HTMLWriter } // else if(matchNameAttribute(attrSet, HTML.Tag.IMPLIED)) } // if(synthesizedElement(paramElem)) else - { + { // NOTE: 20061030 - fchoong - the isLeaf() condition seems to // generate the closest behavior to the RI. if (paramElem.isLeaf()) @@ -880,7 +880,7 @@ public class HTMLWriter indent(); writeRaw("<title>"); - String title_str = + String title_str = (String) htmlDoc.getProperty(HTMLDocument.TitleProperty); if (title_str != null) @@ -941,7 +941,7 @@ public class HTMLWriter else { emptyTag(currElem); - } // else + } // else } // else } // else diff --git a/libjava/classpath/javax/swing/text/html/ImageView.java b/libjava/classpath/javax/swing/text/html/ImageView.java index bb6af4f451f..bdbe9b3bb99 100644 --- a/libjava/classpath/javax/swing/text/html/ImageView.java +++ b/libjava/classpath/javax/swing/text/html/ImageView.java @@ -26,8 +26,8 @@ import javax.swing.text.html.HTML.Attribute; /** * A view, representing a single image, represented by the HTML IMG tag. - * - * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ public class ImageView extends View { @@ -51,7 +51,7 @@ public class ImageView extends View boolean ret = (flags & ALLBITS) != 0; return ret; } - + } /** @@ -64,7 +64,7 @@ public class ImageView extends View * The image icon, wrapping the image, */ Image image; - + /** * The image state. */ @@ -124,7 +124,7 @@ public class ImageView extends View /** * Creates the image view that represents the given element. - * + * * @param element the element, represented by this image view. */ public ImageView(Element element) @@ -136,7 +136,7 @@ public class ImageView extends View reloadImage = true; loadOnDemand = false; } - + /** * Load or reload the image. This method initiates the image reloading. After * the image is ready, the repaint event will be scheduled. The current image, @@ -161,13 +161,13 @@ public class ImageView extends View loading = false; } } - + /** * Get the image alignment. This method works handling standart alignment * attributes in the HTML IMG tag (align = top bottom middle left right). * Depending from the parameter, either horizontal or vertical alingment * information is returned. - * + * * @param axis - * either X_AXIS or Y_AXIS */ @@ -175,7 +175,7 @@ public class ImageView extends View { AttributeSet attrs = getAttributes(); Object al = attrs.getAttribute(Attribute.ALIGN); - + // Default is top left aligned. if (al == null) return 0.0f; @@ -207,7 +207,7 @@ public class ImageView extends View else throw new IllegalArgumentException("axis " + axis); } - + /** * Get the text that should be shown as the image replacement and also as the * image tool tip text. The method returns the value of the attribute, having @@ -229,7 +229,7 @@ public class ImageView extends View return u.getFile(); } } - + /** * Returns the combination of the document and the style sheet attributes. */ @@ -239,7 +239,7 @@ public class ImageView extends View attributes = getStyleSheet().getViewAttributes(this); return attributes; } - + /** * Get the image to render. May return null if the image is not yet loaded. */ @@ -248,13 +248,13 @@ public class ImageView extends View updateState(); return image; } - + /** * Get the URL location of the image to render. If this method returns null, * the "no image" icon is rendered instead. By defaul, url must be present as * the "src" property of the IMG tag. If it is missing, null is returned and * the "no image" icon is rendered. - * + * * @return the URL location of the image to render. */ public URL getImageURL() @@ -280,17 +280,17 @@ public class ImageView extends View /** * Get the icon that should be displayed while the image is loading and hence * not yet available. - * + * * @return an icon, showing a non broken sheet of paper with image. */ public Icon getLoadingImageIcon() { return ImageViewIconFactory.getLoadingImageIcon(); } - + /** * Get the image loading strategy. - * + * * @return false (default) if the image is loaded when the view is * constructed, true if the image is only loaded on demand when * rendering. @@ -302,21 +302,21 @@ public class ImageView extends View /** * Get the icon that should be displayed when the image is not available. - * + * * @return an icon, showing a broken sheet of paper with image. */ public Icon getNoImageIcon() { return ImageViewIconFactory.getNoImageIcon(); } - + /** * Get the preferred span of the image along the axis. The image size is first * requested to the attributes {@link Attribute#WIDTH} and * {@link Attribute#HEIGHT}. If they are missing, and the image is already * loaded, the image size is returned. If there are no attributes, and the * image is not loaded, zero is returned. - * + * * @param axis - * either X_AXIS or Y_AXIS * @return either width of height of the image, depending on the axis. @@ -346,10 +346,10 @@ public class ImageView extends View else throw new IllegalArgumentException("axis " + axis); } - + /** * Get the associated style sheet from the document. - * + * * @return the associated style sheet. */ protected StyleSheet getStyleSheet() @@ -361,7 +361,7 @@ public class ImageView extends View /** * Get the tool tip text. This is overridden to return the value of the * {@link #getAltText()}. The parameters are ignored. - * + * * @return that is returned by getAltText(). */ public String getToolTipText(float x, float y, Shape shape) @@ -373,7 +373,7 @@ public class ImageView extends View * Paints the image or one of the two image state icons. The image is resized * to the shape bounds. If there is no image available, the alternative text * is displayed besides the image state icon. - * + * * @param g * the Graphics, used for painting. * @param bounds @@ -407,7 +407,7 @@ public class ImageView extends View { loadOnDemand = load_on_demand; } - + /** * Update all cached properties from the attribute set, returned by the * {@link #getAttributes}. @@ -429,7 +429,7 @@ public class ImageView extends View spans[Y_AXIS].setFontBases(emBase, exBase); } } - + /** * Maps the picture co-ordinates into the image position in the model. As the * image is not divideable, this is currently implemented always to return the @@ -439,15 +439,15 @@ public class ImageView extends View { return getStartOffset(); } - + /** * This is currently implemented always to return the area of the image view, * as the image is not divideable by character positions. - * + * * @param pos character position * @param area of the image view * @param bias bias - * + * * @return the shape, where the given character position should be mapped. */ public Shape modelToView(int pos, Shape area, Bias bias) @@ -455,7 +455,7 @@ public class ImageView extends View { return area; } - + /** * Starts loading the image asynchronuosly. If the image must be loaded * synchronuosly instead, the {@link #setLoadsSynchronously} must be @@ -465,7 +465,7 @@ public class ImageView extends View { updateState(); // TODO: Implement this when we have an alt view for the alt=... attribute. - } + } /** * This makes sure that the image and properties have been loaded. @@ -504,7 +504,7 @@ public class ImageView extends View { Thread.interrupted(); } - + } } image = newImage; diff --git a/libjava/classpath/javax/swing/text/html/InlineView.java b/libjava/classpath/javax/swing/text/html/InlineView.java index 58edc738526..5376c6b9de2 100644 --- a/libjava/classpath/javax/swing/text/html/InlineView.java +++ b/libjava/classpath/javax/swing/text/html/InlineView.java @@ -158,7 +158,7 @@ public class InlineView return attributes; } - + public int getBreakWeight(int axis, float pos, float len) { int weight; diff --git a/libjava/classpath/javax/swing/text/html/ListView.java b/libjava/classpath/javax/swing/text/html/ListView.java index 3e809bbd209..f05051a4d52 100644 --- a/libjava/classpath/javax/swing/text/html/ListView.java +++ b/libjava/classpath/javax/swing/text/html/ListView.java @@ -1,4 +1,4 @@ -/* ListView.java -- +/* ListView.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java b/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java index 9f5f019fa37..3dddfc3deb3 100644 --- a/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java +++ b/libjava/classpath/javax/swing/text/html/MinimalHTMLWriter.java @@ -1,4 +1,4 @@ -/* MinimalHTMLWriter.java -- +/* MinimalHTMLWriter.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -59,7 +59,7 @@ import java.awt.Color; * * @author Sven de Marothy */ -public class MinimalHTMLWriter extends AbstractWriter +public class MinimalHTMLWriter extends AbstractWriter { private StyledDocument doc; private Deque<String> tagStack; @@ -114,7 +114,7 @@ public class MinimalHTMLWriter extends AbstractWriter * Ends a span tag. */ protected void endFontTag() throws IOException - { + { writeEndTag("</span>"); inFontTag = false; } @@ -153,7 +153,7 @@ public class MinimalHTMLWriter extends AbstractWriter /** * Write the HTML header. */ - protected void writeHeader() throws IOException + protected void writeHeader() throws IOException { writeStartTag("<head>"); writeStartTag("<style>"); @@ -168,7 +168,7 @@ public class MinimalHTMLWriter extends AbstractWriter * Write a paragraph start tag. */ protected void writeStartParagraph(Element elem) throws IOException - { + { indent(); write("<p class=default>"+NEWLINE); // FIXME: Class value = ? incrIndent(); @@ -185,7 +185,7 @@ public class MinimalHTMLWriter extends AbstractWriter /** * Writes the body of the HTML document. - */ + */ protected void writeBody() throws IOException, BadLocationException { writeStartTag("<body>"); @@ -195,27 +195,27 @@ public class MinimalHTMLWriter extends AbstractWriter boolean inParagraph = false; do { - if( e.isLeaf() ) - { - boolean hasNL = (getText(e).indexOf(NEWLINE) != -1); - if( !inParagraph && hasText( e ) ) - { - writeStartParagraph(e); - inParagraph = true; - } - - if( hasText( e ) ) - writeContent(e, true); - - if( hasNL && inParagraph ) - { - writeEndParagraph(); - inParagraph = false; - } - else - endOpenTags(); - } - } + if( e.isLeaf() ) + { + boolean hasNL = (getText(e).indexOf(NEWLINE) != -1); + if( !inParagraph && hasText( e ) ) + { + writeStartParagraph(e); + inParagraph = true; + } + + if( hasText( e ) ) + writeContent(e, true); + + if( hasNL && inParagraph ) + { + writeEndParagraph(); + inParagraph = false; + } + else + endOpenTags(); + } + } while((e = ei.next()) != null); writeEndTag("</body>"); @@ -233,28 +233,28 @@ public class MinimalHTMLWriter extends AbstractWriter { if(attr.getAttribute(StyleConstants.Bold) != null) if(((Boolean)attr.getAttribute(StyleConstants.Bold)).booleanValue()) - { - write("<b>"); - tagStack.push("</b>"); - } + { + write("<b>"); + tagStack.push("</b>"); + } if(attr.getAttribute(StyleConstants.Italic) != null) if(((Boolean)attr.getAttribute(StyleConstants.Italic)).booleanValue()) - { - write("<i>"); - tagStack.push("</i>"); - } + { + write("<i>"); + tagStack.push("</i>"); + } if(attr.getAttribute(StyleConstants.Underline) != null) if(((Boolean)attr.getAttribute(StyleConstants.Underline)).booleanValue()) - { - write("<u>"); - tagStack.push("</u>"); - } + { + write("<u>"); + tagStack.push("</u>"); + } } /** * Returns whether the element contains text or not. */ - protected boolean isText(Element elem) + protected boolean isText(Element elem) { return (elem.getEndOffset() != elem.getStartOffset()); } @@ -271,7 +271,7 @@ public class MinimalHTMLWriter extends AbstractWriter writeHTMLTags(elem.getAttributes()); if( isText(elem) ) text(elem); - else + else writeLeaf(elem); endOpenTags(); @@ -285,12 +285,12 @@ public class MinimalHTMLWriter extends AbstractWriter // NOTE: Haven't tested if this is correct. if(e.getName().equals(StyleConstants.IconElementName)) writeImage(e); - else + else writeComponent(e); } /** - * Write the HTML attributes which do not have tag equivalents, + * Write the HTML attributes which do not have tag equivalents, * e.g. attributes other than bold/italic/underlined. */ protected void writeNonHTMLAttributes(AttributeSet attr) throws IOException @@ -300,8 +300,8 @@ public class MinimalHTMLWriter extends AbstractWriter // Alignment? Background? if( StyleConstants.getForeground(attr) != null ) - style = style + "color: " + - getColor(StyleConstants.getForeground(attr)) + "; "; + style = style + "color: " + + getColor(StyleConstants.getForeground(attr)) + "; "; style = style + "font-size: "+StyleConstants.getFontSize(attr)+"pt; "; style = style + "font-family: "+StyleConstants.getFontFamily(attr); @@ -316,15 +316,15 @@ public class MinimalHTMLWriter extends AbstractWriter { if(doc instanceof DefaultStyledDocument) { - Enumeration<?> styles = ((DefaultStyledDocument)doc).getStyleNames(); - while(styles.hasMoreElements()) - writeStyle(doc.getStyle((String)styles.nextElement())); + Enumeration<?> styles = ((DefaultStyledDocument)doc).getStyleNames(); + while(styles.hasMoreElements()) + writeStyle(doc.getStyle((String)styles.nextElement())); } else { // What else to do here? - Style s = doc.getStyle("default"); - if(s != null) - writeStyle( s ); + Style s = doc.getStyle("default"); + if(s != null) + writeStyle( s ); } } @@ -336,28 +336,28 @@ public class MinimalHTMLWriter extends AbstractWriter Enumeration<?> attribs = attr.getAttributeNames(); while(attribs.hasMoreElements()) { - Object attribName = attribs.nextElement(); - String name = attribName.toString(); - String output = getAttribute(name, attr.getAttribute(attribName)); - if( output != null ) - { - indent(); - write( output + NEWLINE ); - } + Object attribName = attribs.nextElement(); + String name = attribName.toString(); + String output = getAttribute(name, attr.getAttribute(attribName)); + if( output != null ) + { + indent(); + write( output + NEWLINE ); + } } } /** * Deliberately unimplemented, handles component elements. - */ + */ protected void writeComponent(Element elem) throws IOException { } /** - * Deliberately unimplemented. + * Deliberately unimplemented. * Writes StyleConstants.IconElementName elements. - */ + */ protected void writeImage(Element elem) throws IOException { } @@ -381,24 +381,24 @@ public class MinimalHTMLWriter extends AbstractWriter return "family:" + a + ";"; if(name.equals("size")) { - int size = ((Integer)a).intValue(); - int htmlSize; - if( size > 24 ) - htmlSize = 7; - else if( size > 18 ) - htmlSize = 6; - else if( size > 14 ) - htmlSize = 5; - else if( size > 12 ) - htmlSize = 4; - else if( size > 10 ) - htmlSize = 3; - else if( size > 8 ) - htmlSize = 2; - else - htmlSize = 1; - - return "size:" + htmlSize + ";"; + int size = ((Integer)a).intValue(); + int htmlSize; + if( size > 24 ) + htmlSize = 7; + else if( size > 18 ) + htmlSize = 6; + else if( size > 14 ) + htmlSize = 5; + else if( size > 12 ) + htmlSize = 4; + else if( size > 10 ) + htmlSize = 3; + else if( size > 8 ) + htmlSize = 2; + else + htmlSize = 1; + + return "size:" + htmlSize + ";"; } return null; @@ -428,8 +428,8 @@ public class MinimalHTMLWriter extends AbstractWriter if( inFontTag() ) { - write(""+NEWLINE); - endFontTag(); + write(""+NEWLINE); + endFontTag(); } } diff --git a/libjava/classpath/javax/swing/text/html/MultiAttributeSet.java b/libjava/classpath/javax/swing/text/html/MultiAttributeSet.java index 296144460ac..e7fa9f373d9 100644 --- a/libjava/classpath/javax/swing/text/html/MultiAttributeSet.java +++ b/libjava/classpath/javax/swing/text/html/MultiAttributeSet.java @@ -97,7 +97,7 @@ class MultiAttributeSet } return current.nextElement(); } - + } /** diff --git a/libjava/classpath/javax/swing/text/html/MultiStyle.java b/libjava/classpath/javax/swing/text/html/MultiStyle.java index 2f43a19c282..eb62150350f 100644 --- a/libjava/classpath/javax/swing/text/html/MultiStyle.java +++ b/libjava/classpath/javax/swing/text/html/MultiStyle.java @@ -48,7 +48,7 @@ import javax.swing.text.Style; /** * A Style implementation that is able to multiplex between several other * Styles. This is used for CSS style resolving. - * + * * @author Roman Kennke (kennke@aicas.com) */ class MultiStyle diff --git a/libjava/classpath/javax/swing/text/html/ParagraphView.java b/libjava/classpath/javax/swing/text/html/ParagraphView.java index d149627ff1c..cab8edb28e0 100644 --- a/libjava/classpath/javax/swing/text/html/ParagraphView.java +++ b/libjava/classpath/javax/swing/text/html/ParagraphView.java @@ -208,7 +208,7 @@ public class ParagraphView /** * Sets the span on the SizeRequirements object according to the * according CSS span value, when it is set. - * + * * @param r the size requirements * @param axis the axis * diff --git a/libjava/classpath/javax/swing/text/html/StyleSheet.java b/libjava/classpath/javax/swing/text/html/StyleSheet.java index c4ddddb7395..5cf015bc520 100644 --- a/libjava/classpath/javax/swing/text/html/StyleSheet.java +++ b/libjava/classpath/javax/swing/text/html/StyleSheet.java @@ -1,4 +1,4 @@ -/* StyleSheet.java -- +/* StyleSheet.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -86,17 +86,17 @@ import javax.swing.text.View; /** * This class adds support for defining the visual characteristics of HTML views * being rendered. This enables views to be customized by a look-and-feel, mulitple - * views over the same model can be rendered differently. Each EditorPane has its + * views over the same model can be rendered differently. Each EditorPane has its * own StyleSheet, but by default one sheet will be shared by all of the HTMLEditorKit * instances. An HTMLDocument can also have a StyleSheet, which holds specific CSS - * specs. - * - * In order for Views to store less state and therefore be more lightweight, - * the StyleSheet can act as a factory for painters that handle some of the + * specs. + * + * In order for Views to store less state and therefore be more lightweight, + * the StyleSheet can act as a factory for painters that handle some of the * rendering tasks. Since the StyleSheet may be used by views over multiple * documents the HTML attributes don't effect the selector being used. - * - * The rules are stored as named styles, and other information is stored to + * + * The rules are stored as named styles, and other information is stored to * translate the context of an element to a rule. * * @author Lillian Angel (langel@redhat.com) @@ -234,15 +234,15 @@ public class StyleSheet extends StyleContext return other.precedence + other.selector.getSpecificity() - precedence - selector.getSpecificity(); } - + } /** The base URL */ URL base; - + /** Base font size (int) */ int baseFontSize; - + /** * The linked style sheets stored. */ @@ -273,7 +273,7 @@ public class StyleSheet extends StyleContext * Gets the style used to render the given tag. The element represents the tag * and can be used to determine the nesting, where the attributes will differ * if there is nesting inside of elements. - * + * * @param t - the tag to translate to visual attributes * @param e - the element representing the tag * @return the set of CSS attributes to use to render the tag. @@ -362,7 +362,7 @@ public class StyleSheet extends StyleContext * Fetches a resolved style. If there is no resolved style for the * specified selector, the resolve the style using * {@link #resolveStyle(String, List, HTML.Tag)}. - * + * * @param selector the selector for which to resolve the style * @param path the Element path, used in the resolving algorithm * @param tag the tag for which to resolve @@ -435,7 +435,7 @@ public class StyleSheet extends StyleContext * @return the resolved style */ private Style resolveStyle(String selector, String[] tags, - List<Map<String,String>> attributes) + List<Map<String,String>> attributes) { // FIXME: This style resolver is not correct. But it works good enough for // the default.css. @@ -471,9 +471,9 @@ public class StyleSheet extends StyleContext /** * Gets the rule that best matches the selector. selector is a space - * separated String of element names. The attributes of the returned + * separated String of element names. The attributes of the returned * Style will change as rules are added and removed. - * + * * @param selector - the element names separated by spaces * @return the set of CSS attributes to use to render */ @@ -488,11 +488,11 @@ public class StyleSheet extends StyleContext } return best; } - + /** * Adds a set of rules to the sheet. The rules are expected to be in valid * CSS format. This is called as a result of parsing a <style> tag - * + * * @param rule - the rule to add to the sheet */ public void addRule(String rule) @@ -514,11 +514,11 @@ public class StyleSheet extends StyleContext // on next stylesheet request. resolvedStyles.clear(); } - + /** * Translates a CSS declaration into an AttributeSet. This is called * as a result of encountering an HTML style attribute. - * + * * @param decl - the declaration to get * @return the AttributeSet representing the declaration */ @@ -527,13 +527,13 @@ public class StyleSheet extends StyleContext if (decl == null) return SimpleAttributeSet.EMPTY; // FIXME: Not implemented. - return null; + return null; } - + /** * Loads a set of rules that have been specified in terms of CSS grammar. * If there are any conflicts with existing rules, the new rule is added. - * + * * @param in - the stream to read the CSS grammar from. * @param ref - the reference URL. It is the location of the stream, it may * be null. All relative URLs specified in the stream will be based upon this @@ -549,11 +549,11 @@ public class StyleSheet extends StyleContext CSSParser parser = new CSSParser(in, cb); parser.parse(); } - + /** * Gets a set of attributes to use in the view. This is a set of * attributes that can be used for View.getAttributes - * + * * @param v - the view to get the set for * @return the AttributeSet to use in the view. */ @@ -561,10 +561,10 @@ public class StyleSheet extends StyleContext { return new ViewAttributeSet(v, this); } - + /** * Removes a style previously added. - * + * * @param nm - the name of the style to remove */ public void removeStyle(String nm) @@ -572,12 +572,12 @@ public class StyleSheet extends StyleContext // FIXME: Not implemented. super.removeStyle(nm); } - + /** * Adds the rules from ss to those of the receiver. ss's rules will * override the old rules. An added StyleSheet will never override the rules * of the receiving style sheet. - * + * * @param ss - the new StyleSheet. */ public void addStyleSheet(StyleSheet ss) @@ -586,10 +586,10 @@ public class StyleSheet extends StyleContext linked = new ArrayList<StyleSheet>(); linked.add(ss); } - + /** * Removes ss from those of the receiver - * + * * @param ss - the StyleSheet to remove. */ public void removeStyleSheet(StyleSheet ss) @@ -599,10 +599,10 @@ public class StyleSheet extends StyleContext linked.remove(ss); } } - + /** * Returns an array of the linked StyleSheets. May return null. - * + * * @return - An array of the linked StyleSheets. */ public StyleSheet[] getStyleSheets() @@ -619,12 +619,12 @@ public class StyleSheet extends StyleContext } return linkedSS; } - + /** * Imports a style sheet from the url. The rules are directly added to the * receiver. This is usually called when a <link> tag is resolved in an * HTML document. - * + * * @param url the URL to import the StyleSheet from */ public void importStyleSheet(URL url) @@ -643,11 +643,11 @@ public class StyleSheet extends StyleContext // We can't do anything about it I guess. } } - + /** * Sets the base url. All import statements that are relative, will be * relative to base. - * + * * @param base - * the base URL. */ @@ -655,20 +655,20 @@ public class StyleSheet extends StyleContext { this.base = base; } - + /** * Gets the base url. - * + * * @return - the base */ public URL getBase() { return base; } - + /** * Adds a CSS attribute to the given set. - * + * * @param attr - the attribute set * @param key - the attribute to add * @param value - the value of the key @@ -680,13 +680,13 @@ public class StyleSheet extends StyleContext CSS.addInternal(attr, key, value); attr.addAttribute(key, val); } - + /** * Adds a CSS attribute to the given set. - * This method parses the value argument from HTML based on key. - * Returns true if it finds a valid value for the given key, + * This method parses the value argument from HTML based on key. + * Returns true if it finds a valid value for the given key, * and false otherwise. - * + * * @param attr - the attribute set * @param key - the attribute to add * @param value - the value of the key @@ -699,10 +699,10 @@ public class StyleSheet extends StyleContext attr.addAttribute(key, value); return attr.containsAttribute(key, value); } - + /** * Converts a set of HTML attributes to an equivalent set of CSS attributes. - * + * * @param htmlAttrSet - the set containing the HTML attributes. * @return the set of CSS attributes */ @@ -772,7 +772,7 @@ public class StyleSheet extends StyleContext * Translates a HTML border attribute to a corresponding set of CSS * attributes. * - * @param cssAttr the original set of CSS attributes to add to + * @param cssAttr the original set of CSS attributes to add to * @param o the value of the border attribute * * @return the new set of CSS attributes @@ -799,24 +799,24 @@ public class StyleSheet extends StyleContext * to convert StyleConstants attributes to CSS before forwarding them to the superclass. * The StyleConstants attribute do not have corresponding CSS entry, the attribute * is stored (but will likely not be used). - * + * * @param old - the old set * @param key - the non-null attribute key * @param value - the attribute value - * @return the updated set + * @return the updated set */ public AttributeSet addAttribute(AttributeSet old, Object key, Object value) { // FIXME: Not implemented. - return super.addAttribute(old, key, value); + return super.addAttribute(old, key, value); } - + /** * Adds a set of attributes to the element. If any of these attributes are - * StyleConstants, they will be converted to CSS before forwarding to the + * StyleConstants, they will be converted to CSS before forwarding to the * superclass. - * + * * @param old - the old set * @param attr - the attributes to add * @return the updated attribute set @@ -824,44 +824,44 @@ public class StyleSheet extends StyleContext public AttributeSet addAttributes(AttributeSet old, AttributeSet attr) { // FIXME: Not implemented. - return super.addAttributes(old, attr); + return super.addAttributes(old, attr); } - + /** * Removes an attribute from the set. If the attribute is a - * StyleConstants, it will be converted to CSS before forwarding to the + * StyleConstants, it will be converted to CSS before forwarding to the * superclass. - * + * * @param old - the old set * @param key - the non-null attribute key - * @return the updated set + * @return the updated set */ public AttributeSet removeAttribute(AttributeSet old, Object key) { // FIXME: Not implemented. - return super.removeAttribute(old, key); + return super.removeAttribute(old, key); } - + /** * Removes an attribute from the set. If any of the attributes are - * StyleConstants, they will be converted to CSS before forwarding to the + * StyleConstants, they will be converted to CSS before forwarding to the * superclass. - * + * * @param old - the old set * @param attrs - the attributes to remove - * @return the updated set + * @return the updated set */ public AttributeSet removeAttributes(AttributeSet old, AttributeSet attrs) { // FIXME: Not implemented. - return super.removeAttributes(old, attrs); + return super.removeAttributes(old, attrs); } - + /** * Removes a set of attributes for the element. If any of the attributes is a - * StyleConstants, they will be converted to CSS before forwarding to the + * StyleConstants, they will be converted to CSS before forwarding to the * superclass. - * + * * @param old - the old attribute set * @param names - the attribute names * @return the update attribute set @@ -871,35 +871,35 @@ public class StyleSheet extends StyleContext // FIXME: Not implemented. return super.removeAttributes(old, names); } - + /** * Creates a compact set of attributes that might be shared. This is a hook * for subclasses that want to change the behaviour of SmallAttributeSet. - * + * * @param a - the set of attributes to be represented in the compact form. * @return the set of attributes created */ protected StyleContext.SmallAttributeSet createSmallAttributeSet(AttributeSet a) { - return super.createSmallAttributeSet(a); + return super.createSmallAttributeSet(a); } - + /** * Creates a large set of attributes. This set is not shared. This is a hook * for subclasses that want to change the behaviour of the larger attribute * storage format. - * + * * @param a - the set of attributes to be represented in the larger form. * @return the large set of attributes. */ protected MutableAttributeSet createLargeAttributeSet(AttributeSet a) { - return super.createLargeAttributeSet(a); + return super.createLargeAttributeSet(a); } - + /** * Gets the font to use for the given set. - * + * * @param a - the set to get the font for. * @return the font for the set */ @@ -978,7 +978,7 @@ public class StyleSheet extends StyleContext AttributeSet resolver = atts.getResolveParent(); if (resolver != null) parSize = getFontSize(resolver); - size = fs.getValue(parSize); + size = fs.getValue(parSize); } else { @@ -998,7 +998,7 @@ public class StyleSheet extends StyleContext * Takes a set of attributes and turns it into a foreground * color specification. This is used to specify things like, brigher, more hue * etc. - * + * * @param a - the set to get the foreground color for * @return the foreground color for the set */ @@ -1008,14 +1008,14 @@ public class StyleSheet extends StyleContext Color color = null; if (c != null) color = c.getValue(); - return color; + return color; } - + /** * Takes a set of attributes and turns it into a background * color specification. This is used to specify things like, brigher, more hue * etc. - * + * * @param a - the set to get the background color for * @return the background color for the set */ @@ -1025,34 +1025,34 @@ public class StyleSheet extends StyleContext Color color = null; if (c != null) color = c.getValue(); - return color; + return color; } - + /** * Gets the box formatter to use for the given set of CSS attributes. - * + * * @param a - the given set * @return the box formatter */ public BoxPainter getBoxPainter(AttributeSet a) { - return new BoxPainter(a, this); + return new BoxPainter(a, this); } - + /** * Gets the list formatter to use for the given set of CSS attributes. - * + * * @param a - the given set * @return the list formatter */ public ListPainter getListPainter(AttributeSet a) { - return new ListPainter(a, this); + return new ListPainter(a, this); } - + /** * Sets the base font size between 1 and 7. - * + * * @param sz - the new font size for the base. */ public void setBaseFontSize(int sz) @@ -1060,12 +1060,12 @@ public class StyleSheet extends StyleContext if (sz <= 7 && sz >= 1) baseFontSize = sz; } - + /** * Sets the base font size from the String. It can either identify * a specific font size (between 1 and 7) or identify a relative * font size such as +1 or -2. - * + * * @param size - the new font size as a String. */ public void setBaseFontSize(String size) @@ -1093,10 +1093,10 @@ public class StyleSheet extends StyleContext // Do nothing here } } - + /** * TODO - * + * * @param pt - TODO * @return TODO */ @@ -1105,35 +1105,35 @@ public class StyleSheet extends StyleContext // FIXME: Not implemented. return 0; } - + /** * Gets the point size, given a size index. - * + * * @param index - the size index * @return the point size. */ public float getPointSize(int index) { // FIXME: Not implemented. - return 0; + return 0; } - + /** * Given the string of the size, returns the point size value. - * + * * @param size - the string representation of the size. * @return - the point size value. */ public float getPointSize(String size) { // FIXME: Not implemented. - return 0; + return 0; } - + /** * Convert the color string represenation into java.awt.Color. The valid * values are like "aqua" , "#00FFFF" or "rgb(1,6,44)". - * + * * @param colorName the color to convert. * @return the matching java.awt.color */ @@ -1141,14 +1141,14 @@ public class StyleSheet extends StyleContext { return CSSColor.convertValue(colorName); } - + /** * This class carries out some of the duties of CSS formatting. This enables views * to present the CSS formatting while not knowing how the CSS values are cached. - * + * * This object is reponsible for the insets of a View and making sure * the background is maintained according to the CSS attributes. - * + * * @author Lillian Angel (langel@redhat.com) */ public static class BoxPainter extends Object implements Serializable @@ -1191,7 +1191,7 @@ public class StyleSheet extends StyleContext /** * Package-private constructor. - * + * * @param as - AttributeSet for painter */ BoxPainter(AttributeSet as, StyleSheet ss) @@ -1257,12 +1257,12 @@ public class StyleSheet extends StyleContext background = ss.getBackground(as); } - - + + /** * Gets the inset needed on a given side to account for the margin, border * and padding. - * + * * @param size - the size of the box to get the inset for. View.TOP, View.LEFT, * View.BOTTOM or View.RIGHT. * @param v - the view making the request. This is used to get the AttributeSet, @@ -1304,11 +1304,11 @@ public class StyleSheet extends StyleContext } return inset; } - + /** * Paints the CSS box according to the attributes given. This should * paint the border, padding and background. - * + * * @param g - the graphics configuration * @param x - the x coordinate * @param y - the y coordinate @@ -1333,12 +1333,12 @@ public class StyleSheet extends StyleContext } } } - + /** * This class carries out some of the CSS list formatting duties. Implementations * of this class enable views to present the CSS formatting while not knowing anything * about how the CSS values are being cached. - * + * * @author Lillian Angel (langel@redhat.com) */ public static class ListPainter implements Serializable @@ -1361,7 +1361,7 @@ public class StyleSheet extends StyleContext /** * Package-private constructor. - * + * * @param as - AttributeSet for painter */ ListPainter(AttributeSet as, StyleSheet ss) @@ -1378,7 +1378,7 @@ public class StyleSheet extends StyleContext /** * Paints the CSS list decoration according to the attributes given. - * + * * @param g - the graphics configuration * @param x - the x coordinate * @param y - the y coordinate @@ -1410,7 +1410,7 @@ public class StyleSheet extends StyleContext { View v1 = itemView.getView(0); if (v1 instanceof ParagraphView && v1.getViewCount() > 0) - { + { Shape a1 = itemView.getChildAllocation(0, tmpRect); Rectangle r1 = a1 instanceof Rectangle ? (Rectangle) a1 : a1.getBounds(); diff --git a/libjava/classpath/javax/swing/text/html/TableView.java b/libjava/classpath/javax/swing/text/html/TableView.java index 912240c28c4..2ad1b6d38b9 100644 --- a/libjava/classpath/javax/swing/text/html/TableView.java +++ b/libjava/classpath/javax/swing/text/html/TableView.java @@ -477,7 +477,7 @@ class TableView * Overridden to perform the table layout before calling the super * implementation. */ - protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, + protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { updateGrid(); diff --git a/libjava/classpath/javax/swing/text/html/ViewAttributeSet.java b/libjava/classpath/javax/swing/text/html/ViewAttributeSet.java index 8838646d5f5..fb57872ce3f 100644 --- a/libjava/classpath/javax/swing/text/html/ViewAttributeSet.java +++ b/libjava/classpath/javax/swing/text/html/ViewAttributeSet.java @@ -109,7 +109,7 @@ class ViewAttributeSet { HTML.Tag tag = (HTML.Tag) elAtts.getAttribute(StyleConstants.NameAttribute); - AttributeSet rule = styleSheet.getRule(tag, el); + AttributeSet rule = styleSheet.getRule(tag, el); if (rule != null) atts.add(rule); } diff --git a/libjava/classpath/javax/swing/text/html/parser/Entity.java b/libjava/classpath/javax/swing/text/html/parser/Entity.java index 1d59df237b8..d40fb94f3d4 100644 --- a/libjava/classpath/javax/swing/text/html/parser/Entity.java +++ b/libjava/classpath/javax/swing/text/html/parser/Entity.java @@ -170,14 +170,14 @@ public final class Entity return sdata; } - + /** * Get the entity type. * @return the value of the {@link #type}. */ - public int getType() + public int getType() { return type; - } - + } + } diff --git a/libjava/classpath/javax/swing/text/html/parser/Parser.java b/libjava/classpath/javax/swing/text/html/parser/Parser.java index a88e9ce1953..f3faa252433 100644 --- a/libjava/classpath/javax/swing/text/html/parser/Parser.java +++ b/libjava/classpath/javax/swing/text/html/parser/Parser.java @@ -73,7 +73,7 @@ import javax.swing.text.SimpleAttributeSet; * </p> * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) */ -public class Parser +public class Parser implements DTDConstants { /** diff --git a/libjava/classpath/javax/swing/text/rtf/RTFParser.java b/libjava/classpath/javax/swing/text/rtf/RTFParser.java index de1b1c6ff15..3306056ff0f 100644 --- a/libjava/classpath/javax/swing/text/rtf/RTFParser.java +++ b/libjava/classpath/javax/swing/text/rtf/RTFParser.java @@ -139,7 +139,7 @@ class RTFParser parseHeader(); parseDocument(); - + Token t2 = scanner.peekToken(); if (t2.type == Token.RCURLY) { diff --git a/libjava/classpath/javax/swing/text/rtf/RTFScanner.java b/libjava/classpath/javax/swing/text/rtf/RTFScanner.java index 060e087eb67..2eca159c49c 100644 --- a/libjava/classpath/javax/swing/text/rtf/RTFScanner.java +++ b/libjava/classpath/javax/swing/text/rtf/RTFScanner.java @@ -50,7 +50,7 @@ import java.io.Reader; * * This scanner is based upon the RTF specification 1.6 * available at: - * + * * <a * href="http://msdn.microsoft.com/library/en-us/dnrtfspec/html/rtfspec.asp"> * RTF specification at MSDN</a> |