提交 a010af2d 编写于 作者: R rkennke

6749920: Cleanup AWT peer interfaces

Summary: Remove duplicate and obsolete methods in the AWT peer interfaces.
Reviewed-by: art, dav
上级 e633935a
...@@ -228,7 +228,7 @@ public class Choice extends Component implements ItemSelectable, Accessible { ...@@ -228,7 +228,7 @@ public class Choice extends Component implements ItemSelectable, Accessible {
pItems.insertElementAt(item, index); pItems.insertElementAt(item, index);
ChoicePeer peer = (ChoicePeer)this.peer; ChoicePeer peer = (ChoicePeer)this.peer;
if (peer != null) { if (peer != null) {
peer.addItem(item, index); peer.add(item, index);
} }
// no selection or selection shifted up // no selection or selection shifted up
if (selectedIndex < 0 || selectedIndex >= index) { if (selectedIndex < 0 || selectedIndex >= index) {
......
...@@ -1306,7 +1306,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -1306,7 +1306,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
enabled = true; enabled = true;
ComponentPeer peer = this.peer; ComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
peer.enable(); peer.setEnabled(true);
if (visible) { if (visible) {
updateCursorImmediately(); updateCursorImmediately();
} }
...@@ -1355,7 +1355,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -1355,7 +1355,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
ComponentPeer peer = this.peer; ComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
peer.disable(); peer.setEnabled(false);
if (visible) { if (visible) {
updateCursorImmediately(); updateCursorImmediately();
} }
...@@ -1447,7 +1447,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -1447,7 +1447,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
mixOnShowing(); mixOnShowing();
ComponentPeer peer = this.peer; ComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
peer.show(); peer.setVisible(true);
createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED, createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED,
this, parent, this, parent,
HierarchyEvent.SHOWING_CHANGED, HierarchyEvent.SHOWING_CHANGED,
...@@ -1517,7 +1517,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -1517,7 +1517,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
ComponentPeer peer = this.peer; ComponentPeer peer = this.peer;
if (peer != null) { if (peer != null) {
peer.hide(); peer.setVisible(false);
createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED, createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED,
this, parent, this, parent,
HierarchyEvent.SHOWING_CHANGED, HierarchyEvent.SHOWING_CHANGED,
...@@ -2414,7 +2414,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -2414,7 +2414,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (dim == null || !(isPreferredSizeSet() || isValid())) { if (dim == null || !(isPreferredSizeSet() || isValid())) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
prefSize = (peer != null) ? prefSize = (peer != null) ?
peer.preferredSize() : peer.getPreferredSize() :
getMinimumSize(); getMinimumSize();
dim = prefSize; dim = prefSize;
} }
...@@ -2484,7 +2484,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -2484,7 +2484,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (dim == null || !(isMinimumSizeSet() || isValid())) { if (dim == null || !(isMinimumSizeSet() || isValid())) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
minSize = (peer != null) ? minSize = (peer != null) ?
peer.minimumSize() : peer.getMinimumSize() :
size(); size();
dim = minSize; dim = minSize;
} }
...@@ -3171,7 +3171,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -3171,7 +3171,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
private Insets getInsets_NoClientCode() { private Insets getInsets_NoClientCode() {
ComponentPeer peer = this.peer; ComponentPeer peer = this.peer;
if (peer instanceof ContainerPeer) { if (peer instanceof ContainerPeer) {
return (Insets)((ContainerPeer)peer).insets().clone(); return (Insets)((ContainerPeer)peer).getInsets().clone();
} }
return new Insets(0, 0, 0, 0); return new Insets(0, 0, 0, 0);
} }
...@@ -6722,7 +6722,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -6722,7 +6722,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// Hide peer first to stop system events such as cursor moves. // Hide peer first to stop system events such as cursor moves.
if (visible) { if (visible) {
p.hide(); p.setVisible(false);
} }
peer = null; // Stop peer updates. peer = null; // Stop peer updates.
......
...@@ -343,7 +343,7 @@ public class Container extends Component { ...@@ -343,7 +343,7 @@ public class Container extends Component {
ComponentPeer peer = this.peer; ComponentPeer peer = this.peer;
if (peer instanceof ContainerPeer) { if (peer instanceof ContainerPeer) {
ContainerPeer cpeer = (ContainerPeer)peer; ContainerPeer cpeer = (ContainerPeer)peer;
return (Insets)cpeer.insets().clone(); return (Insets)cpeer.getInsets().clone();
} }
return new Insets(0, 0, 0, 0); return new Insets(0, 0, 0, 0);
} }
...@@ -3931,7 +3931,7 @@ public class Container extends Component { ...@@ -3931,7 +3931,7 @@ public class Container extends Component {
if (comp.isVisible()) { if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = comp.getPeer();
if (peer != null) { if (peer != null) {
peer.show(); peer.setVisible(true);
} }
} }
} }
...@@ -3952,7 +3952,7 @@ public class Container extends Component { ...@@ -3952,7 +3952,7 @@ public class Container extends Component {
if (comp.isVisible()) { if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer(); ComponentPeer peer = comp.getPeer();
if (peer != null) { if (peer != null) {
peer.hide(); peer.setVisible(false);
} }
} }
} }
......
...@@ -941,7 +941,7 @@ public class Dialog extends Window { ...@@ -941,7 +941,7 @@ public class Dialog extends Window {
// does not invoke the super.show(). So wried... :( // does not invoke the super.show(). So wried... :(
mixOnShowing(); mixOnShowing();
peer.show(); // now guaranteed never to block peer.setVisible(true); // now guaranteed never to block
if (isModalBlocked()) { if (isModalBlocked()) {
modalBlocker.toFront(); modalBlocker.toFront();
} }
......
...@@ -378,7 +378,7 @@ public class List extends Component implements ItemSelectable, Accessible { ...@@ -378,7 +378,7 @@ public class List extends Component implements ItemSelectable, Accessible {
ListPeer peer = (ListPeer)this.peer; ListPeer peer = (ListPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.addItem(item, index); peer.add(item, index);
} }
} }
...@@ -413,7 +413,7 @@ public class List extends Component implements ItemSelectable, Accessible { ...@@ -413,7 +413,7 @@ public class List extends Component implements ItemSelectable, Accessible {
public synchronized void clear() { public synchronized void clear() {
ListPeer peer = (ListPeer)this.peer; ListPeer peer = (ListPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.clear(); peer.removeAll();
} }
items = new Vector(); items = new Vector();
selected = new int[0]; selected = new int[0];
...@@ -718,7 +718,7 @@ public class List extends Component implements ItemSelectable, Accessible { ...@@ -718,7 +718,7 @@ public class List extends Component implements ItemSelectable, Accessible {
multipleMode = b; multipleMode = b;
ListPeer peer = (ListPeer)this.peer; ListPeer peer = (ListPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.setMultipleSelections(b); peer.setMultipleMode(b);
} }
} }
} }
...@@ -768,7 +768,7 @@ public class List extends Component implements ItemSelectable, Accessible { ...@@ -768,7 +768,7 @@ public class List extends Component implements ItemSelectable, Accessible {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
ListPeer peer = (ListPeer)this.peer; ListPeer peer = (ListPeer)this.peer;
return (peer != null) ? return (peer != null) ?
peer.preferredSize(rows) : peer.getPreferredSize(rows) :
super.preferredSize(); super.preferredSize();
} }
} }
...@@ -818,7 +818,7 @@ public class List extends Component implements ItemSelectable, Accessible { ...@@ -818,7 +818,7 @@ public class List extends Component implements ItemSelectable, Accessible {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
ListPeer peer = (ListPeer)this.peer; ListPeer peer = (ListPeer)this.peer;
return (peer != null) ? return (peer != null) ?
peer.minimumSize(rows) : peer.getMinimumSize(rows) :
super.minimumSize(); super.minimumSize();
} }
} }
......
...@@ -268,7 +268,7 @@ public class MenuItem extends MenuComponent implements Accessible { ...@@ -268,7 +268,7 @@ public class MenuItem extends MenuComponent implements Accessible {
enabled = true; enabled = true;
MenuItemPeer peer = (MenuItemPeer)this.peer; MenuItemPeer peer = (MenuItemPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.enable(); peer.setEnabled(true);
} }
} }
...@@ -294,7 +294,7 @@ public class MenuItem extends MenuComponent implements Accessible { ...@@ -294,7 +294,7 @@ public class MenuItem extends MenuComponent implements Accessible {
enabled = false; enabled = false;
MenuItemPeer peer = (MenuItemPeer)this.peer; MenuItemPeer peer = (MenuItemPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.disable(); peer.setEnabled(false);
} }
} }
......
...@@ -321,7 +321,7 @@ public class TextArea extends TextComponent { ...@@ -321,7 +321,7 @@ public class TextArea extends TextComponent {
public synchronized void insertText(String str, int pos) { public synchronized void insertText(String str, int pos) {
TextAreaPeer peer = (TextAreaPeer)this.peer; TextAreaPeer peer = (TextAreaPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.insertText(str, pos); peer.insert(str, pos);
} else { } else {
text = text.substring(0, pos) + str + text.substring(pos); text = text.substring(0, pos) + str + text.substring(pos);
} }
...@@ -385,7 +385,7 @@ public class TextArea extends TextComponent { ...@@ -385,7 +385,7 @@ public class TextArea extends TextComponent {
public synchronized void replaceText(String str, int start, int end) { public synchronized void replaceText(String str, int start, int end) {
TextAreaPeer peer = (TextAreaPeer)this.peer; TextAreaPeer peer = (TextAreaPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.replaceText(str, start, end); peer.replaceRange(str, start, end);
} else { } else {
text = text.substring(0, start) + str + text.substring(end); text = text.substring(0, start) + str + text.substring(end);
} }
...@@ -500,7 +500,7 @@ public class TextArea extends TextComponent { ...@@ -500,7 +500,7 @@ public class TextArea extends TextComponent {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
TextAreaPeer peer = (TextAreaPeer)this.peer; TextAreaPeer peer = (TextAreaPeer)this.peer;
return (peer != null) ? return (peer != null) ?
peer.preferredSize(rows, columns) : peer.getPreferredSize(rows, columns) :
super.preferredSize(); super.preferredSize();
} }
} }
...@@ -552,7 +552,7 @@ public class TextArea extends TextComponent { ...@@ -552,7 +552,7 @@ public class TextArea extends TextComponent {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
TextAreaPeer peer = (TextAreaPeer)this.peer; TextAreaPeer peer = (TextAreaPeer)this.peer;
return (peer != null) ? return (peer != null) ?
peer.minimumSize(rows, columns) : peer.getMinimumSize(rows, columns) :
super.minimumSize(); super.minimumSize();
} }
} }
......
...@@ -281,7 +281,7 @@ public class TextField extends TextComponent { ...@@ -281,7 +281,7 @@ public class TextField extends TextComponent {
echoChar = c; echoChar = c;
TextFieldPeer peer = (TextFieldPeer)this.peer; TextFieldPeer peer = (TextFieldPeer)this.peer;
if (peer != null) { if (peer != null) {
peer.setEchoCharacter(c); peer.setEchoChar(c);
} }
} }
} }
...@@ -376,7 +376,7 @@ public class TextField extends TextComponent { ...@@ -376,7 +376,7 @@ public class TextField extends TextComponent {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
TextFieldPeer peer = (TextFieldPeer)this.peer; TextFieldPeer peer = (TextFieldPeer)this.peer;
return (peer != null) ? return (peer != null) ?
peer.preferredSize(columns) : peer.getPreferredSize(columns) :
super.preferredSize(); super.preferredSize();
} }
} }
...@@ -424,7 +424,7 @@ public class TextField extends TextComponent { ...@@ -424,7 +424,7 @@ public class TextField extends TextComponent {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
TextFieldPeer peer = (TextFieldPeer)this.peer; TextFieldPeer peer = (TextFieldPeer)this.peer;
return (peer != null) ? return (peer != null) ?
peer.minimumSize(columns) : peer.getMinimumSize(columns) :
super.minimumSize(); super.minimumSize();
} }
} }
......
...@@ -37,8 +37,4 @@ public interface ChoicePeer extends ComponentPeer { ...@@ -37,8 +37,4 @@ public interface ChoicePeer extends ComponentPeer {
void removeAll(); void removeAll();
void select(int index); void select(int index);
/*
* DEPRECATED: Replaced by add(String, int).
*/
void addItem(String item, int index);
} }
...@@ -56,7 +56,6 @@ public interface ComponentPeer { ...@@ -56,7 +56,6 @@ public interface ComponentPeer {
void setVisible(boolean b); void setVisible(boolean b);
void setEnabled(boolean b); void setEnabled(boolean b);
void paint(Graphics g); void paint(Graphics g);
void repaint(long tm, int x, int y, int width, int height);
void print(Graphics g); void print(Graphics g);
void setBounds(int x, int y, int width, int height, int op); void setBounds(int x, int y, int width, int height, int op);
void handleEvent(AWTEvent e); void handleEvent(AWTEvent e);
...@@ -112,47 +111,10 @@ public interface ComponentPeer { ...@@ -112,47 +111,10 @@ public interface ComponentPeer {
*/ */
void layout(); void layout();
Rectangle getBounds();
/** /**
* Applies the shape to the native component window. * Applies the shape to the native component window.
* @since 1.7 * @since 1.7
*/ */
void applyShape(Region shape); 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);
} }
...@@ -39,7 +39,6 @@ public interface ContainerPeer extends ComponentPeer { ...@@ -39,7 +39,6 @@ public interface ContainerPeer extends ComponentPeer {
void endValidate(); void endValidate();
void beginLayout(); void beginLayout();
void endLayout(); void endLayout();
boolean isPaintPending();
/** /**
* Restacks native windows - children of this native window - according to Java container order * Restacks native windows - children of this native window - according to Java container order
...@@ -53,11 +52,4 @@ public interface ContainerPeer extends ComponentPeer { ...@@ -53,11 +52,4 @@ public interface ContainerPeer extends ComponentPeer {
* @since 1.5 * @since 1.5
*/ */
boolean isRestackSupported(); boolean isRestackSupported();
/**
* DEPRECATED: Replaced by getInsets().
*/
Insets insets();
} }
...@@ -45,28 +45,4 @@ public interface ListPeer extends ComponentPeer { ...@@ -45,28 +45,4 @@ public interface ListPeer extends ComponentPeer {
Dimension getPreferredSize(int rows); Dimension getPreferredSize(int rows);
Dimension getMinimumSize(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);
} }
...@@ -35,13 +35,4 @@ public interface MenuItemPeer extends MenuComponentPeer { ...@@ -35,13 +35,4 @@ public interface MenuItemPeer extends MenuComponentPeer {
void setLabel(String label); void setLabel(String label);
void setEnabled(boolean b); void setEnabled(boolean b);
/**
* DEPRECATED: Replaced by setEnabled(boolean).
*/
void enable();
/**
* DEPRECATED: Replaced by setEnabled(boolean).
*/
void disable();
} }
...@@ -39,23 +39,4 @@ public interface TextAreaPeer extends TextComponentPeer { ...@@ -39,23 +39,4 @@ public interface TextAreaPeer extends TextComponentPeer {
Dimension getPreferredSize(int rows, int columns); Dimension getPreferredSize(int rows, int columns);
Dimension getMinimumSize(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);
} }
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
*/ */
package java.awt.peer; package java.awt.peer;
import java.awt.Rectangle;
import java.awt.im.InputMethodRequests; import java.awt.im.InputMethodRequests;
/** /**
...@@ -43,8 +42,5 @@ public interface TextComponentPeer extends ComponentPeer { ...@@ -43,8 +42,5 @@ public interface TextComponentPeer extends ComponentPeer {
void select(int selStart, int selEnd); void select(int selStart, int selEnd);
void setCaretPosition(int pos); void setCaretPosition(int pos);
int getCaretPosition(); int getCaretPosition();
int getIndexAtPoint(int x, int y);
Rectangle getCharacterBounds(int i);
long filterEvents(long mask);
InputMethodRequests getInputMethodRequests(); InputMethodRequests getInputMethodRequests();
} }
...@@ -38,18 +38,4 @@ public interface TextFieldPeer extends TextComponentPeer { ...@@ -38,18 +38,4 @@ public interface TextFieldPeer extends TextComponentPeer {
Dimension getPreferredSize(int columns); Dimension getPreferredSize(int columns);
Dimension getMinimumSize(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);
} }
...@@ -39,7 +39,6 @@ public interface WindowPeer extends ContainerPeer { ...@@ -39,7 +39,6 @@ public interface WindowPeer extends ContainerPeer {
void toBack(); void toBack();
void setAlwaysOnTop(boolean alwaysOnTop); void setAlwaysOnTop(boolean alwaysOnTop);
void updateFocusableWindowState(); void updateFocusableWindowState();
boolean requestWindowFocus();
void setModalBlocked(Dialog blocker, boolean blocked); void setModalBlocked(Dialog blocker, boolean blocked);
void updateMinimumSize(); void updateMinimumSize();
void updateIconImages(); void updateIconImages();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册