Some cleanup for javax.swing.text. 2005-10-19 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/text/AbstractDocument.java * javax/swing/text/AttributeSet.java * javax/swing/text/ComponentView.java * javax/swing/text/DefaultCaret.java * javax/swing/text/DefaultEditorKit.java * javax/swing/text/DefaultHighlighter.java * javax/swing/text/EditorKit.java * javax/swing/text/FieldView.java * javax/swing/text/FlowView.java * javax/swing/text/GlyphView.java * javax/swing/text/JTextComponent.java * javax/swing/text/LayoutQueue.java * javax/swing/text/PlainView.java * javax/swing/text/Segment.java * javax/swing/text/StyledDocument.java * javax/swing/text/html/HTMLEditorKit.java * javax/swing/text/html/HTMLFrameHyperlinkEvent.java * javax/swing/text/html/parser/DocumentParser.java Reformatted slightly. Filled emtpy blocks with comments. Fixed some slight API doc errors. Removed some unneeded imports. /Roman
Index: javax/swing/text/AbstractDocument.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v retrieving revision 1.34 diff -u -r1.34 AbstractDocument.java --- javax/swing/text/AbstractDocument.java 12 Oct 2005 18:05:41 -0000 1.34 +++ javax/swing/text/AbstractDocument.java 19 Oct 2005 14:55:09 -0000 @@ -867,6 +867,7 @@ */ public void setAsynchronousLoadPriority(int p) { + // TODO: Implement this properly. } /** Index: javax/swing/text/AttributeSet.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/AttributeSet.java,v retrieving revision 1.11 diff -u -r1.11 AttributeSet.java --- javax/swing/text/AttributeSet.java 3 Aug 2005 08:55:43 -0000 1.11 +++ javax/swing/text/AttributeSet.java 19 Oct 2005 14:55:09 -0000 @@ -58,6 +58,7 @@ */ static interface CharacterAttribute { + // This interface is a marker interface and has no methods. } /** @@ -65,6 +66,7 @@ */ static interface ColorAttribute { + // This interface is a marker interface and has no methods. } /** @@ -72,6 +74,7 @@ */ static interface FontAttribute { + // This interface is a marker interface and has no methods. } /** @@ -79,6 +82,7 @@ */ static interface ParagraphAttribute { + // This interface is a marker interface and has no methods. } /** @@ -99,7 +103,7 @@ * <code>false</code> otherwise. * * @param name the name of the requested attribute - * @param the value of the requested attribute + * @param value the value of the requested attribute * * @return <code>true</code> if this <code>AttributeSet</code> contains * an attribute with the specified <code>name</code> and Index: javax/swing/text/ComponentView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/ComponentView.java,v retrieving revision 1.10 diff -u -r1.10 ComponentView.java --- javax/swing/text/ComponentView.java 14 Sep 2005 20:20:13 -0000 1.10 +++ javax/swing/text/ComponentView.java 19 Oct 2005 14:55:09 -0000 @@ -43,7 +43,7 @@ /** * A [EMAIL PROTECTED] View} implementation that is able to render arbitrary - * [EMAIL PROTECTED] Components}. This uses the attribute + * [EMAIL PROTECTED] Component}s. This uses the attribute * [EMAIL PROTECTED] StyleConstants#ComponentAttribute} to determine the * <code>Component</code> that should be rendered. This <code>Component</code> * becomes a direct child of the <code>JTextComponent</code> that contains @@ -53,6 +53,7 @@ * @author original author unknown * @author Roman Kennke ([EMAIL PROTECTED]) */ +// FIXME: This class is a complete stub and needs to be implemented properly. public class ComponentView extends View { /** @@ -118,38 +119,45 @@ return 0; } - public float getMinimumSpan(int axis) - { - return 0; - } - - public float getPreferredSpan(int axis) - { - return 0; - } - - public Shape modelToView(int pos, Shape a, Position.Bias b) - throws BadLocationException - { - return null; - } - - public void paint(Graphics g, Shape a) - { - } + public float getMinimumSpan(int axis) + { + // TODO: Implement this properly. + return 0; + } + + public float getPreferredSpan(int axis) + { + // TODO: Implement this properly. + return 0; + } + + public Shape modelToView(int pos, Shape a, Position.Bias b) + throws BadLocationException + { + // TODO: Implement this properly. + return null; + } - public void setParent(View p) - { - } + public void paint(Graphics g, Shape a) + { + // TODO: Implement this properly. + } + + public void setParent(View p) + { + // TODO: Implement this properly. + } - public void setSize(float width, float height) - { - } + public void setSize(float width, float height) + { + // TODO: Implement this properly. + } - public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) - { - return 0; - } + public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) + { + // TODO: Implement this properly. + return 0; + } /** * Maps coordinates from the <code>View</code>'s space into a position Index: javax/swing/text/DefaultCaret.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultCaret.java,v retrieving revision 1.18 diff -u -r1.18 DefaultCaret.java --- javax/swing/text/DefaultCaret.java 14 Oct 2005 17:21:21 -0000 1.18 +++ javax/swing/text/DefaultCaret.java 19 Oct 2005 14:55:09 -0000 @@ -344,6 +344,7 @@ */ public void mouseExited(MouseEvent event) { + // TODO: What to do here, if anything? } /** @@ -380,6 +381,7 @@ */ public void focusGained(FocusEvent event) { + // TODO: Implement this properly. } /** @@ -389,6 +391,7 @@ */ public void focusLost(FocusEvent event) { + // TODO: Implement this properly. } /** Index: javax/swing/text/DefaultEditorKit.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v retrieving revision 1.22 diff -u -r1.22 DefaultEditorKit.java --- javax/swing/text/DefaultEditorKit.java 30 Sep 2005 19:54:18 -0000 1.22 +++ javax/swing/text/DefaultEditorKit.java 19 Oct 2005 14:55:10 -0000 @@ -283,6 +283,8 @@ */ public void actionPerformed(ActionEvent event) { + // FIXME: Figure out what this Action is supposed to do. Obviously text + // that is entered by the user is inserted through DefaultKeyTypedAction. } } @@ -689,6 +691,7 @@ */ public DefaultEditorKit() { + // Nothing to do here. } /** Index: javax/swing/text/DefaultHighlighter.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultHighlighter.java,v retrieving revision 1.5 diff -u -r1.5 DefaultHighlighter.java --- javax/swing/text/DefaultHighlighter.java 2 Jul 2005 20:32:51 -0000 1.5 +++ javax/swing/text/DefaultHighlighter.java 19 Oct 2005 14:55:10 -0000 @@ -168,6 +168,7 @@ public DefaultHighlighter() { + // Nothing to do here. } public boolean getDrawsLayeredHighlights() @@ -238,6 +239,7 @@ Shape viewBounds, JTextComponent editor, View view) { + // TODO: Implement this properly. } public void paint(Graphics g) Index: javax/swing/text/EditorKit.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/EditorKit.java,v retrieving revision 1.7 diff -u -r1.7 EditorKit.java --- javax/swing/text/EditorKit.java 2 Jul 2005 20:32:51 -0000 1.7 +++ javax/swing/text/EditorKit.java 19 Oct 2005 14:55:10 -0000 @@ -48,24 +48,24 @@ import javax.swing.Action; import javax.swing.JEditorPane; -public abstract class EditorKit - implements Cloneable, Serializable +public abstract class EditorKit implements Cloneable, Serializable { private static final long serialVersionUID = -5044124649345887822L; public EditorKit() { + // Nothing to do here. } public Object clone() { try { - return super.clone(); + return super.clone(); } catch (CloneNotSupportedException e) { - return null; + return null; } } @@ -74,10 +74,12 @@ */ public void deinstall(JEditorPane c) { + // This default implementation does nothing. } public void install(JEditorPane c) { + // This default implementation does nothing. } public abstract Caret createCaret(); Index: javax/swing/text/FieldView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/FieldView.java,v retrieving revision 1.6 diff -u -r1.6 FieldView.java --- javax/swing/text/FieldView.java 17 Aug 2005 19:59:35 -0000 1.6 +++ javax/swing/text/FieldView.java 19 Oct 2005 14:55:10 -0000 @@ -159,18 +159,21 @@ { Shape newAlloc = adjustAllocation(shape); super.insertUpdate(ev, newAlloc, vf); + getContainer().repaint(); } public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { Shape newAlloc = adjustAllocation(shape); super.removeUpdate(ev, newAlloc, vf); + getContainer().repaint(); } public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { Shape newAlloc = adjustAllocation(shape); super.removeUpdate(ev, newAlloc, vf); + getContainer().repaint(); } public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) Index: javax/swing/text/FlowView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/FlowView.java,v retrieving revision 1.3 diff -u -r1.3 FlowView.java --- javax/swing/text/FlowView.java 6 Oct 2005 20:16:32 -0000 1.3 +++ javax/swing/text/FlowView.java 19 Oct 2005 14:55:10 -0000 @@ -72,6 +72,7 @@ */ public FlowStrategy() { + // Nothing to do here. } /** @@ -138,7 +139,7 @@ * Performs the layout for the whole view. By default this rebuilds * all the physical views from the logical views of the managed FlowView. * - * This is called by [EMAIL PROTECTED] FlowLayout#layout} to update the layout of + * This is called by [EMAIL PROTECTED] FlowView#layout} to update the layout of * the view. * * @param fv the flow view for which we perform the layout @@ -211,7 +212,7 @@ * not fit in the available span and also cannot be broken down). * * @param fv the flow view - * @param startOffset the start offset for the view to be created + * @param offset the start offset for the view to be created * @param spanLeft the available span * @param rowIndex the index of the row * @@ -499,7 +500,7 @@ * The real children are created at layout time and each represent one * row. * - * This method is called by [EMAIL PROTECTED] #setParent} in order to initialize + * This method is called by [EMAIL PROTECTED] View#setParent} in order to initialize * the view. * * @param vf the view factory to use for creating the child views @@ -523,7 +524,7 @@ /** * Performs the layout of this view. If the span along the flow axis changed, - * this first calls [EMAIL PROTECTED] FlowStrategy.layout} in order to rebuild the + * this first calls [EMAIL PROTECTED] FlowStrategy#layout} in order to rebuild the * rows of this view. Then the superclass's behaviour is called to arrange * the rows within the box. * Index: javax/swing/text/GlyphView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/GlyphView.java,v retrieving revision 1.8 diff -u -r1.8 GlyphView.java --- javax/swing/text/GlyphView.java 6 Oct 2005 20:16:32 -0000 1.8 +++ javax/swing/text/GlyphView.java 19 Oct 2005 14:55:10 -0000 @@ -72,6 +72,7 @@ */ public GlyphPainter() { + // Nothing to do here. } /** Index: javax/swing/text/JTextComponent.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/JTextComponent.java,v retrieving revision 1.42 diff -u -r1.42 JTextComponent.java --- javax/swing/text/JTextComponent.java 13 Oct 2005 12:50:59 -0000 1.42 +++ javax/swing/text/JTextComponent.java 19 Oct 2005 14:55:11 -0000 @@ -90,6 +90,7 @@ /** * AccessibleJTextComponent */ + // FIXME: This inner class is a complete stub and needs to be implemented. public class AccessibleJTextComponent extends AccessibleJComponent implements AccessibleText, CaretListener, DocumentListener { @@ -100,6 +101,7 @@ */ public AccessibleJTextComponent() { + // Nothing to do here. } /** Index: javax/swing/text/LayoutQueue.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/LayoutQueue.java,v retrieving revision 1.3 diff -u -r1.3 LayoutQueue.java --- javax/swing/text/LayoutQueue.java 22 Aug 2005 19:04:21 -0000 1.3 +++ javax/swing/text/LayoutQueue.java 19 Oct 2005 14:55:11 -0000 @@ -57,6 +57,7 @@ */ public LayoutQueue() { + // Nothing to do here. } /** Index: javax/swing/text/PlainView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/PlainView.java,v retrieving revision 1.26 diff -u -r1.26 PlainView.java --- javax/swing/text/PlainView.java 14 Oct 2005 19:54:13 -0000 1.26 +++ javax/swing/text/PlainView.java 19 Oct 2005 14:55:11 -0000 @@ -49,8 +49,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent.ElementChange; -public class PlainView extends View - implements TabExpander +public class PlainView extends View implements TabExpander { Color selectedColor; Color unselectedColor; @@ -256,6 +255,7 @@ } catch (BadLocationException ex) { + assert false : "BadLocationException should not be thrown here."; } if (seg == null || seg.array == null || seg.count == 0) @@ -416,6 +416,7 @@ } catch (BadLocationException ex) { + assert false : "BadLocationException should not be thrown here."; } if (seg == null || seg.array == null || seg.count == 0) @@ -503,8 +504,7 @@ else { Rectangle repaintRec = rec0.union(rec1); - host.repaint(0, repaintRec.y, host.getWidth(), - repaintRec.height); + host.repaint(); } } Index: javax/swing/text/Segment.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/Segment.java,v retrieving revision 1.7 diff -u -r1.7 Segment.java --- javax/swing/text/Segment.java 2 Jul 2005 20:32:51 -0000 1.7 +++ javax/swing/text/Segment.java 19 Oct 2005 14:55:11 -0000 @@ -39,8 +39,7 @@ import java.text.CharacterIterator; -public class Segment - implements Cloneable, CharacterIterator +public class Segment implements Cloneable, CharacterIterator { private boolean partialReturn; private int current; @@ -51,6 +50,7 @@ public Segment() { + // Nothing to do here. } public Segment(char[] array, int offset, int count) Index: javax/swing/text/StyledDocument.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyledDocument.java,v retrieving revision 1.4 diff -u -r1.4 StyledDocument.java --- javax/swing/text/StyledDocument.java 2 Jul 2005 20:32:51 -0000 1.4 +++ javax/swing/text/StyledDocument.java 19 Oct 2005 14:55:11 -0000 @@ -45,101 +45,96 @@ * @author Andrew Selkirk * @version 1.0 */ -public interface StyledDocument extends Document { +public interface StyledDocument extends Document +{ + /** + * addStyle + * @param nm TODO + * @param parent TODO + * @returns Style + */ + Style addStyle(String nm, Style parent); + + /** + * removeStyle + * @param nm TODO + */ + void removeStyle(String nm); + + /** + * getStyle + * @param nm TODO + * @returns Style + */ + Style getStyle(String nm); + + /** + * setCharacterAttributes + * @param offset TODO + * @param length TODO + * @param set TODO + * @param replace TODO + */ + void setCharacterAttributes(int offset, int length, AttributeSet set, + boolean replace); + + /** + * setParagraphAttributes + * @param offset TODO + * @param length TODO + * @param set TODO + * @param replace TODO + */ + void setParagraphAttributes(int offset, int length, AttributeSet set, + boolean replace); + + /** + * getLogicalStyle + * @param position TODO + * @returns Style + */ + Style getLogicalStyle(int position); + + /** + * setLogicalStyle + * @param position TODO + * @param style TODO + */ + void setLogicalStyle(int position, Style style); + + /** + * getParagraphElement + * @param position TODO + * @returns Element + */ + Element getParagraphElement(int position); + + /** + * getCharacterElement + * @param position TODO + * @returns Element + */ + Element getCharacterElement(int position); + + /** + * getForeground + * @param set TODO + * @returns Color + */ + Color getForeground(AttributeSet set); + + /** + * getBackground + * @param set TODO + * @returns Color + */ + Color getBackground(AttributeSet set); + + /** + * getFont + * @param set TODO + * @returns Font + */ + Font getFont(AttributeSet set); - //------------------------------------------------------------- - // Methods ---------------------------------------------------- - //------------------------------------------------------------- - - /** - * addStyle - * @param nm TODO - * @param rent TODO - * @returns Style - */ - Style addStyle(String nm, Style parent); - - /** - * removeStyle - * @param nm TODO - */ - void removeStyle(String nm); - - /** - * getStyle - * @param nm TODO - * @returns Style - */ - Style getStyle(String nm); - - /** - * setCharacterAttributes - * @param offset TODO - * @param length TODO - * @param set TODO - * @param replace TODO - */ - void setCharacterAttributes(int offset, int length, - AttributeSet set, boolean replace); - - /** - * setParagraphAttributes - * @param offset TODO - * @param length TODO - * @param set TODO - * @param replace TODO - */ - void setParagraphAttributes(int offset, int length, - AttributeSet set, boolean replace); - - /** - * getLogicalStyle - * @param position TODO - * @returns Style - */ - Style getLogicalStyle(int position); - - /** - * setLogicalStyle - * @param position TODO - * @param style TODO - */ - void setLogicalStyle(int position, Style style); - - /** - * getParagraphElement - * @param position TODO - * @returns Element - */ - Element getParagraphElement(int position); - - /** - * getCharacterElement - * @param position TODO - * @returns Element - */ - Element getCharacterElement(int position); - - /** - * getForeground - * @param set TODO - * @returns Color - */ - Color getForeground(AttributeSet set); - - /** - * getBackground - * @param set TODO - * @returns Color - */ - Color getBackground(AttributeSet set); - - /** - * getFont - * @param set TODO - * @returns Font - */ - Font getFont(AttributeSet set); - - -} // StyledDocument +} Index: javax/swing/text/html/HTMLEditorKit.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLEditorKit.java,v retrieving revision 1.5 diff -u -r1.5 HTMLEditorKit.java --- javax/swing/text/html/HTMLEditorKit.java 20 Sep 2005 19:22:14 -0000 1.5 +++ javax/swing/text/html/HTMLEditorKit.java 19 Oct 2005 14:55:11 -0000 @@ -97,9 +97,9 @@ /** * The parser calls this method after it finishes parsing the document. */ - public void flush() - throws BadLocationException + public void flush() throws BadLocationException { + // TODO: What to do here, if anything? } /** @@ -109,6 +109,7 @@ */ public void handleComment(char[] comment, int position) { + // TODO: What to do here, if anything? } /** @@ -119,6 +120,7 @@ */ public void handleEndOfLineString(String end_of_line) { + // TODO: What to do here, if anything? } /** @@ -130,6 +132,7 @@ */ public void handleEndTag(HTML.Tag tag, int position) { + // TODO: What to do here, if anything? } /** @@ -140,6 +143,7 @@ */ public void handleError(String message, int position) { + // TODO: What to do here, if anything? } /** @@ -150,9 +154,9 @@ * @param position The tag position in the text being parsed. */ public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, - int position - ) + int position) { + // TODO: What to do here, if anything? } /** @@ -166,6 +170,7 @@ int position ) { + // TODO: What to do here, if anything? } /** @@ -175,6 +180,7 @@ */ public void handleText(char[] text, int position) { + // TODO: What to do here, if anything? } } Index: javax/swing/text/html/HTMLFrameHyperlinkEvent.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java,v retrieving revision 1.3 diff -u -r1.3 HTMLFrameHyperlinkEvent.java --- javax/swing/text/html/HTMLFrameHyperlinkEvent.java 2 Jul 2005 20:32:51 -0000 1.3 +++ javax/swing/text/html/HTMLFrameHyperlinkEvent.java 19 Oct 2005 14:55:11 -0000 @@ -41,7 +41,6 @@ import java.net.URL; import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkEvent.EventType; import javax.swing.text.Element; /** @@ -50,8 +49,7 @@ * * @author Audrius Meskauskas, Lithuania ([EMAIL PROTECTED]) */ -public class HTMLFrameHyperlinkEvent - extends HyperlinkEvent +public class HTMLFrameHyperlinkEvent extends HyperlinkEvent { private final String target_frame; Index: javax/swing/text/html/parser/DocumentParser.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/parser/DocumentParser.java,v retrieving revision 1.8 diff -u -r1.8 DocumentParser.java --- javax/swing/text/html/parser/DocumentParser.java 19 Oct 2005 14:34:17 -0000 1.8 +++ javax/swing/text/html/parser/DocumentParser.java 19 Oct 2005 14:55:11 -0000 @@ -167,7 +167,7 @@ * to get a default DTD; you must either refer to the implementation - * specific packages, write your own DTD or obtain the working instance * of parser in other way, for example, by calling - * [EMAIL PROTECTED] javax.swing.text.html.HTMLEditorKit#getParser}. + * [EMAIL PROTECTED] javax.swing.text.html.HTMLEditorKit#getParser()}. * * @param a_dtd a DTD to use. */
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches