6749920: Cleanup AWT peer interfaces
authorrkennke
Mon, 29 Sep 2008 20:16:42 +0200
changeset 1964 934568dfe859
parent 1963 16c7a0981e65
child 1965 726a2bc97146
6749920: Cleanup AWT peer interfaces Summary: Remove duplicate and obsolete methods in the AWT peer interfaces. Reviewed-by: art, dav
jdk/src/share/classes/java/awt/Choice.java
jdk/src/share/classes/java/awt/Component.java
jdk/src/share/classes/java/awt/Container.java
jdk/src/share/classes/java/awt/Dialog.java
jdk/src/share/classes/java/awt/List.java
jdk/src/share/classes/java/awt/MenuItem.java
jdk/src/share/classes/java/awt/TextArea.java
jdk/src/share/classes/java/awt/TextField.java
jdk/src/share/classes/java/awt/peer/ChoicePeer.java
jdk/src/share/classes/java/awt/peer/ComponentPeer.java
jdk/src/share/classes/java/awt/peer/ContainerPeer.java
jdk/src/share/classes/java/awt/peer/ListPeer.java
jdk/src/share/classes/java/awt/peer/MenuItemPeer.java
jdk/src/share/classes/java/awt/peer/TextAreaPeer.java
jdk/src/share/classes/java/awt/peer/TextComponentPeer.java
jdk/src/share/classes/java/awt/peer/TextFieldPeer.java
jdk/src/share/classes/java/awt/peer/WindowPeer.java
--- a/jdk/src/share/classes/java/awt/Choice.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Choice.java	Mon Sep 29 20:16:42 2008 +0200
@@ -228,7 +228,7 @@
         pItems.insertElementAt(item, index);
         ChoicePeer peer = (ChoicePeer)this.peer;
         if (peer != null) {
-            peer.addItem(item, index);
+            peer.add(item, index);
         }
         // no selection or selection shifted up
         if (selectedIndex < 0 || selectedIndex >= index) {
--- a/jdk/src/share/classes/java/awt/Component.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Component.java	Mon Sep 29 20:16:42 2008 +0200
@@ -1306,7 +1306,7 @@
                 enabled = true;
                 ComponentPeer peer = this.peer;
                 if (peer != null) {
-                    peer.enable();
+                    peer.setEnabled(true);
                     if (visible) {
                         updateCursorImmediately();
                     }
@@ -1355,7 +1355,7 @@
                 }
                 ComponentPeer peer = this.peer;
                 if (peer != null) {
-                    peer.disable();
+                    peer.setEnabled(false);
                     if (visible) {
                         updateCursorImmediately();
                     }
@@ -1447,7 +1447,7 @@
                 mixOnShowing();
                 ComponentPeer peer = this.peer;
                 if (peer != null) {
-                    peer.show();
+                    peer.setVisible(true);
                     createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED,
                                           this, parent,
                                           HierarchyEvent.SHOWING_CHANGED,
@@ -1517,7 +1517,7 @@
                 }
                 ComponentPeer peer = this.peer;
                 if (peer != null) {
-                    peer.hide();
+                    peer.setVisible(false);
                     createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED,
                                           this, parent,
                                           HierarchyEvent.SHOWING_CHANGED,
@@ -2414,7 +2414,7 @@
         if (dim == null || !(isPreferredSizeSet() || isValid())) {
             synchronized (getTreeLock()) {
                 prefSize = (peer != null) ?
-                    peer.preferredSize() :
+                    peer.getPreferredSize() :
                     getMinimumSize();
                 dim = prefSize;
             }
@@ -2484,7 +2484,7 @@
         if (dim == null || !(isMinimumSizeSet() || isValid())) {
             synchronized (getTreeLock()) {
                 minSize = (peer != null) ?
-                    peer.minimumSize() :
+                    peer.getMinimumSize() :
                     size();
                 dim = minSize;
             }
@@ -3171,7 +3171,7 @@
     private Insets getInsets_NoClientCode() {
         ComponentPeer peer = this.peer;
         if (peer instanceof ContainerPeer) {
-            return (Insets)((ContainerPeer)peer).insets().clone();
+            return (Insets)((ContainerPeer)peer).getInsets().clone();
         }
         return new Insets(0, 0, 0, 0);
     }
@@ -6722,7 +6722,7 @@
 
                 // Hide peer first to stop system events such as cursor moves.
                 if (visible) {
-                    p.hide();
+                    p.setVisible(false);
                 }
 
                 peer = null; // Stop peer updates.
--- a/jdk/src/share/classes/java/awt/Container.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Container.java	Mon Sep 29 20:16:42 2008 +0200
@@ -343,7 +343,7 @@
         ComponentPeer peer = this.peer;
         if (peer instanceof ContainerPeer) {
             ContainerPeer cpeer = (ContainerPeer)peer;
-            return (Insets)cpeer.insets().clone();
+            return (Insets)cpeer.getInsets().clone();
         }
         return new Insets(0, 0, 0, 0);
     }
@@ -3931,7 +3931,7 @@
                 if (comp.isVisible()) {
                     ComponentPeer peer = comp.getPeer();
                     if (peer != null) {
-                        peer.show();
+                        peer.setVisible(true);
                     }
                 }
             }
@@ -3952,7 +3952,7 @@
                 if (comp.isVisible()) {
                     ComponentPeer peer = comp.getPeer();
                     if (peer != null) {
-                        peer.hide();
+                        peer.setVisible(false);
                     }
                 }
             }
--- a/jdk/src/share/classes/java/awt/Dialog.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Mon Sep 29 20:16:42 2008 +0200
@@ -941,7 +941,7 @@
                 // does not invoke the super.show(). So wried... :(
                 mixOnShowing();
 
-                peer.show(); // now guaranteed never to block
+                peer.setVisible(true); // now guaranteed never to block
                 if (isModalBlocked()) {
                     modalBlocker.toFront();
                 }
--- a/jdk/src/share/classes/java/awt/List.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/List.java	Mon Sep 29 20:16:42 2008 +0200
@@ -378,7 +378,7 @@
 
         ListPeer peer = (ListPeer)this.peer;
         if (peer != null) {
-            peer.addItem(item, index);
+            peer.add(item, index);
         }
     }
 
@@ -413,7 +413,7 @@
     public synchronized void clear() {
         ListPeer peer = (ListPeer)this.peer;
         if (peer != null) {
-            peer.clear();
+            peer.removeAll();
         }
         items = new Vector();
         selected = new int[0];
@@ -718,7 +718,7 @@
             multipleMode = b;
             ListPeer peer = (ListPeer)this.peer;
             if (peer != null) {
-                peer.setMultipleSelections(b);
+                peer.setMultipleMode(b);
             }
         }
     }
@@ -768,7 +768,7 @@
         synchronized (getTreeLock()) {
             ListPeer peer = (ListPeer)this.peer;
             return (peer != null) ?
-                       peer.preferredSize(rows) :
+                       peer.getPreferredSize(rows) :
                        super.preferredSize();
         }
     }
@@ -818,7 +818,7 @@
         synchronized (getTreeLock()) {
             ListPeer peer = (ListPeer)this.peer;
             return (peer != null) ?
-                       peer.minimumSize(rows) :
+                       peer.getMinimumSize(rows) :
                        super.minimumSize();
         }
     }
--- a/jdk/src/share/classes/java/awt/MenuItem.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/MenuItem.java	Mon Sep 29 20:16:42 2008 +0200
@@ -268,7 +268,7 @@
         enabled = true;
         MenuItemPeer peer = (MenuItemPeer)this.peer;
         if (peer != null) {
-            peer.enable();
+            peer.setEnabled(true);
         }
     }
 
@@ -294,7 +294,7 @@
         enabled = false;
         MenuItemPeer peer = (MenuItemPeer)this.peer;
         if (peer != null) {
-            peer.disable();
+            peer.setEnabled(false);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/TextArea.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/TextArea.java	Mon Sep 29 20:16:42 2008 +0200
@@ -321,7 +321,7 @@
     public synchronized void insertText(String str, int pos) {
         TextAreaPeer peer = (TextAreaPeer)this.peer;
         if (peer != null) {
-            peer.insertText(str, pos);
+            peer.insert(str, pos);
         } else {
             text = text.substring(0, pos) + str + text.substring(pos);
         }
@@ -385,7 +385,7 @@
     public synchronized void replaceText(String str, int start, int end) {
         TextAreaPeer peer = (TextAreaPeer)this.peer;
         if (peer != null) {
-            peer.replaceText(str, start, end);
+            peer.replaceRange(str, start, end);
         } else {
             text = text.substring(0, start) + str + text.substring(end);
         }
@@ -500,7 +500,7 @@
         synchronized (getTreeLock()) {
             TextAreaPeer peer = (TextAreaPeer)this.peer;
             return (peer != null) ?
-                       peer.preferredSize(rows, columns) :
+                       peer.getPreferredSize(rows, columns) :
                        super.preferredSize();
         }
     }
@@ -552,7 +552,7 @@
         synchronized (getTreeLock()) {
             TextAreaPeer peer = (TextAreaPeer)this.peer;
             return (peer != null) ?
-                       peer.minimumSize(rows, columns) :
+                       peer.getMinimumSize(rows, columns) :
                        super.minimumSize();
         }
     }
--- a/jdk/src/share/classes/java/awt/TextField.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/TextField.java	Mon Sep 29 20:16:42 2008 +0200
@@ -281,7 +281,7 @@
             echoChar = c;
             TextFieldPeer peer = (TextFieldPeer)this.peer;
             if (peer != null) {
-                peer.setEchoCharacter(c);
+                peer.setEchoChar(c);
             }
         }
     }
@@ -376,7 +376,7 @@
         synchronized (getTreeLock()) {
             TextFieldPeer peer = (TextFieldPeer)this.peer;
             return (peer != null) ?
-                       peer.preferredSize(columns) :
+                       peer.getPreferredSize(columns) :
                        super.preferredSize();
         }
     }
@@ -424,7 +424,7 @@
         synchronized (getTreeLock()) {
             TextFieldPeer peer = (TextFieldPeer)this.peer;
             return (peer != null) ?
-                       peer.minimumSize(columns) :
+                       peer.getMinimumSize(columns) :
                        super.minimumSize();
         }
     }
--- a/jdk/src/share/classes/java/awt/peer/ChoicePeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/ChoicePeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -37,8 +37,4 @@
     void removeAll();
     void select(int index);
 
-    /*
-     * DEPRECATED:  Replaced by add(String, int).
-     */
-    void addItem(String item, int index);
 }
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -56,7 +56,6 @@
     void                setVisible(boolean b);
     void                setEnabled(boolean b);
     void                paint(Graphics g);
-    void                repaint(long tm, int x, int y, int width, int height);
     void                print(Graphics g);
     void                setBounds(int x, int y, int width, int height, int op);
     void                handleEvent(AWTEvent e);
@@ -112,47 +111,10 @@
      */
     void        layout();
 
-
-        Rectangle getBounds();
-
     /**
      * Applies the shape to the native component window.
      * @since 1.7
      */
     void applyShape(Region shape);
 
-    /**
-     * DEPRECATED:  Replaced by getPreferredSize().
-     */
-    Dimension           preferredSize();
-
-    /**
-     * DEPRECATED:  Replaced by getMinimumSize().
-     */
-    Dimension           minimumSize();
-
-    /**
-     * DEPRECATED:  Replaced by setVisible(boolean).
-     */
-    void                show();
-
-    /**
-     * DEPRECATED:  Replaced by setVisible(boolean).
-     */
-    void                hide();
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    void                enable();
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    void                disable();
-
-    /**
-     * DEPRECATED:  Replaced by setBounds(int, int, int, int).
-     */
-    void                reshape(int x, int y, int width, int height);
 }
--- a/jdk/src/share/classes/java/awt/peer/ContainerPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/ContainerPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -39,7 +39,6 @@
     void endValidate();
     void beginLayout();
     void endLayout();
-    boolean isPaintPending();
 
     /**
      * Restacks native windows - children of this native window - according to Java container order
@@ -53,11 +52,4 @@
      * @since 1.5
      */
     boolean isRestackSupported();
-    /**
-
-
-
-     * DEPRECATED:  Replaced by getInsets().
-     */
-    Insets insets();
 }
--- a/jdk/src/share/classes/java/awt/peer/ListPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/ListPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -45,28 +45,4 @@
     Dimension getPreferredSize(int rows);
     Dimension getMinimumSize(int rows);
 
-    /**
-     * DEPRECATED:  Replaced by add(String, int).
-     */
-    void addItem(String item, int index);
-
-    /**
-     * DEPRECATED:  Replaced by removeAll().
-     */
-    void clear();
-
-    /**
-     * DEPRECATED:  Replaced by setMultipleMode(boolean).
-     */
-    void setMultipleSelections(boolean v);
-
-    /**
-     * DEPRECATED:  Replaced by getPreferredSize(int).
-     */
-    Dimension preferredSize(int v);
-
-    /**
-     * DEPRECATED:  Replaced by getMinimumSize(int).
-     */
-    Dimension minimumSize(int v);
 }
--- a/jdk/src/share/classes/java/awt/peer/MenuItemPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/MenuItemPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -35,13 +35,4 @@
     void setLabel(String label);
     void setEnabled(boolean b);
 
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    void enable();
-
-    /**
-     * DEPRECATED:  Replaced by setEnabled(boolean).
-     */
-    void disable();
 }
--- a/jdk/src/share/classes/java/awt/peer/TextAreaPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/TextAreaPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -39,23 +39,4 @@
     Dimension getPreferredSize(int rows, int columns);
     Dimension getMinimumSize(int rows, int columns);
 
-    /**
-     * DEPRECATED:  Replaced by insert(String, int).
-     */
-    void insertText(String txt, int pos);
-
-    /**
-     * DEPRECATED:  Replaced by ReplaceRange(String, int, int).
-     */
-    void replaceText(String txt, int start, int end);
-
-    /**
-     * DEPRECATED:  Replaced by getPreferredSize(int, int).
-     */
-    Dimension preferredSize(int rows, int cols);
-
-    /**
-     * DEPRECATED:  Replaced by getMinimumSize(int, int).
-     */
-    Dimension minimumSize(int rows, int cols);
 }
--- a/jdk/src/share/classes/java/awt/peer/TextComponentPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/TextComponentPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -24,7 +24,6 @@
  */
 package java.awt.peer;
 
-import java.awt.Rectangle;
 import java.awt.im.InputMethodRequests;
 
 /**
@@ -43,8 +42,5 @@
     void select(int selStart, int selEnd);
     void setCaretPosition(int pos);
     int getCaretPosition();
-    int getIndexAtPoint(int x, int y);
-    Rectangle getCharacterBounds(int i);
-    long filterEvents(long mask);
     InputMethodRequests getInputMethodRequests();
 }
--- a/jdk/src/share/classes/java/awt/peer/TextFieldPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/TextFieldPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -38,18 +38,4 @@
     Dimension getPreferredSize(int columns);
     Dimension getMinimumSize(int columns);
 
-    /**
-     * DEPRECATED:  Replaced by setEchoChar(char echoChar).
-     */
-    void setEchoCharacter(char c);
-
-    /**
-     * DEPRECATED:  Replaced by getPreferredSize(int).
-     */
-    Dimension preferredSize(int cols);
-
-    /**
-     * DEPRECATED:  Replaced by getMinimumSize(int).
-     */
-    Dimension minimumSize(int cols);
 }
--- a/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Mon Sep 29 14:54:55 2008 +0400
+++ b/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Mon Sep 29 20:16:42 2008 +0200
@@ -39,7 +39,6 @@
     void toBack();
     void setAlwaysOnTop(boolean alwaysOnTop);
     void updateFocusableWindowState();
-    boolean requestWindowFocus();
     void setModalBlocked(Dialog blocker, boolean blocked);
     void updateMinimumSize();
     void updateIconImages();