Index: javax/swing/plaf/basic/BasicTextUI.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicTextUI.java,v retrieving revision 1.4.16.17 diff -u -r1.4.16.17 BasicTextUI.java --- javax/swing/plaf/basic/BasicTextUI.java 11 Nov 2004 07:57:09 -0000 1.4.16.17 +++ javax/swing/plaf/basic/BasicTextUI.java 24 Jan 2005 18:47:03 -0000 @@ -1,5 +1,5 @@ -/* BasicTextUI.java - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* BasicTextUI.java -- + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -104,6 +104,8 @@ super(null); } + // View methods. + public ViewFactory getViewFactory() { // FIXME: Handle EditorKit somehow. @@ -140,9 +142,12 @@ view.paint(g, s); } - protected Rectangle modelToView(int position, Shape a, Position.Bias bias) + public Shape modelToView(int position, Shape a, Position.Bias bias) throws BadLocationException { + if (view == null) + return null; + return ((PlainView) view).modelToView(position, a, bias).getBounds(); } } @@ -327,11 +332,12 @@ rootView.setView(null); textComponent.removePropertyChangeListener(updateHandler); - textComponent = null; uninstallDefaults(); uninstallListeners(); uninstallKeyboardActions(); + + textComponent = null; } protected void uninstallDefaults() @@ -442,13 +448,13 @@ public View create(Element elem) { - // subclasses have to implement this to get this functionality + // Subclasses have to implement this to get this functionality. return null; } public View create(Element elem, int p0, int p1) { - // subclasses have to implement this to get this functionality + // Subclasses have to implement this to get this functionality. return null; } Index: javax/swing/text/View.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/javax/swing/text/View.java,v retrieving revision 1.2.8.6 diff -u -r1.2.8.6 View.java --- javax/swing/text/View.java 22 Oct 2004 12:41:29 -0000 1.2.8.6 +++ javax/swing/text/View.java 24 Jan 2005 18:47:03 -0000 @@ -1,5 +1,5 @@ /* View.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,6 +35,7 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.text; import java.awt.Container; @@ -69,9 +70,9 @@ public abstract void paint(Graphics g, Shape s); - public void setParent(View a) + public void setParent(View parent) { - parent = a; + this.parent = parent; } public View getParent() @@ -87,6 +88,7 @@ public Container getContainer() { + View parent = getParent(); return parent != null ? parent.getContainer() : null; } @@ -101,6 +103,32 @@ } public abstract float getPreferredSpan(int axis); + + public int getResizeWeight(int axis) + { + return 0; + } + + public float getMaximumSpan(int axis) + { + if (getResizeWeight(axis) <= 0) + return getPreferredSpan(axis); + + return Integer.MAX_VALUE; + } + + public float getMinimumSpan(int axis) + { + if (getResizeWeight(axis) <= 0) + return getPreferredSpan(axis); + + return Integer.MAX_VALUE; + } + + public void setSize(float width, float height) + { + // The default implementation does nothing. + } public float getAlignment(int axis) { @@ -109,7 +137,7 @@ public AttributeSet getAttributes() { - return elt.getAttributes(); + return getElement().getAttributes(); } public boolean isVisible() @@ -129,6 +157,7 @@ public ViewFactory getViewFactory() { + View parent = getParent(); return parent != null ? parent.getViewFactory() : null; } @@ -167,12 +196,12 @@ public int getStartOffset() { - return elt.getStartOffset(); + return getElement().getStartOffset(); } public int getEndOffset() { - return elt.getEndOffset(); + return getElement().getEndOffset(); } public Shape getChildAllocation(int index, Shape a) @@ -205,5 +234,13 @@ return null; } + + /** + * @since 1.3 + */ + public Graphics getGraphics() + { + return getContainer().getGraphics(); + } }