This cleans up the BasicTextUI a little (remove ECJ warnings, etc).
2006-02-07 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicTextUI.java
(RootView.preferenceChange): Changed view parameter to view so
that it doesn't hide a field of that class.
(RootView.getViewCount): Rewritten to clean up ECJ warning.
(RootView.modelToView): Removed unnecessary cast from View to
View.
(PropertyChangeHandler): Made inner class private.
(updateHandler): Made field private.
(getVisibleEditorRect): Removed unneeded local variable that
shadowed a field with the same name and purpose.
/Roman
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.64
diff -u -r1.64 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java 1 Feb 2006 14:38:16 -0000 1.64
+++ javax/swing/plaf/basic/BasicTextUI.java 7 Feb 2006 11:50:22 -0000
@@ -46,15 +46,11 @@
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.InputMap;
@@ -161,11 +157,11 @@
* Indicates that the preferences of one of the child view has changed.
* This calls revalidate on the text component.
*
- * @param view the child view which's preference has changed
+ * @param v the child view which's preference has changed
* @param width <code>true</code> if the width preference has changed
* @param height <code>true</code> if the height preference has changed
*/
- public void preferenceChanged(View view, boolean width, boolean height)
+ public void preferenceChanged(View v, boolean width, boolean height)
{
textComponent.revalidate();
}
@@ -207,10 +203,10 @@
*/
public int getViewCount()
{
+ int count = 0;
if (view != null)
- return 1;
- else
- return 0;
+ count = 1;
+ return count;
}
/**
@@ -277,7 +273,7 @@
public Shape modelToView(int position, Shape a, Position.Bias bias)
throws BadLocationException
{
- return ((View) view).modelToView(position, a, bias);
+ return view.modelToView(position, a, bias);
}
/**
@@ -368,7 +364,7 @@
/**
* Receives notifications when properties of the text component change.
*/
- class PropertyChangeHandler implements PropertyChangeListener
+ private class PropertyChangeHandler implements PropertyChangeListener
{
/**
* Notifies when a property of the text component changes.
@@ -448,7 +444,7 @@
/**
* Receives notification when the model changes.
*/
- PropertyChangeHandler updateHandler = new PropertyChangeHandler();
+ private PropertyChangeHandler updateHandler = new PropertyChangeHandler();
/** The DocumentEvent handler. */
DocumentHandler documentHandler = new DocumentHandler();
@@ -522,7 +518,6 @@
doc = getEditorKit(textComponent).createDefaultDocument();
textComponent.setDocument(doc);
}
-
textComponent.addPropertyChangeListener(updateHandler);
modelChanged();
@@ -1065,7 +1060,6 @@
*/
protected Rectangle getVisibleEditorRect()
{
- JTextComponent textComponent = getComponent();
int width = textComponent.getWidth();
int height = textComponent.getHeight();