提交 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 {
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) {
......
......@@ -1306,7 +1306,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
enabled = true;
ComponentPeer peer = this.peer;
if (peer != null) {
peer.enable();
peer.setEnabled(true);
if (visible) {
updateCursorImmediately();
}
......@@ -1355,7 +1355,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
ComponentPeer peer = this.peer;
if (peer != null) {
peer.disable();
peer.setEnabled(false);
if (visible) {
updateCursorImmediately();
}
......@@ -1447,7 +1447,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (dim == null || !(isPreferredSizeSet() || isValid())) {
synchronized (getTreeLock()) {
prefSize = (peer != null) ?
peer.preferredSize() :
peer.getPreferredSize() :
getMinimumSize();
dim = prefSize;
}
......@@ -2484,7 +2484,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (dim == null || !(isMinimumSizeSet() || isValid())) {
synchronized (getTreeLock()) {
minSize = (peer != null) ?
peer.minimumSize() :
peer.getMinimumSize() :
size();
dim = minSize;
}
......@@ -3171,7 +3171,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
// Hide peer first to stop system events such as cursor moves.
if (visible) {
p.hide();
p.setVisible(false);
}
peer = null; // Stop peer updates.
......
......@@ -343,7 +343,7 @@ public class Container extends Component {
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 @@ public class Container extends Component {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
if (peer != null) {
peer.show();
peer.setVisible(true);
}
}
}
......@@ -3952,7 +3952,7 @@ public class Container extends Component {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
if (peer != null) {
peer.hide();
peer.setVisible(false);
}
}
}
......
......@@ -941,7 +941,7 @@ public class Dialog extends Window {
// 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();
}
......
......@@ -378,7 +378,7 @@ public class List extends Component implements ItemSelectable, Accessible {
ListPeer peer = (ListPeer)this.peer;
if (peer != null) {
peer.addItem(item, index);
peer.add(item, index);
}
}
......@@ -413,7 +413,7 @@ public class List extends Component implements ItemSelectable, Accessible {
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 @@ public class List extends Component implements ItemSelectable, Accessible {
multipleMode = b;
ListPeer peer = (ListPeer)this.peer;
if (peer != null) {
peer.setMultipleSelections(b);
peer.setMultipleMode(b);
}
}
}
......@@ -768,7 +768,7 @@ public class List extends Component implements ItemSelectable, Accessible {
synchronized (getTreeLock()) {
ListPeer peer = (ListPeer)this.peer;
return (peer != null) ?
peer.preferredSize(rows) :
peer.getPreferredSize(rows) :
super.preferredSize();
}
}
......@@ -818,7 +818,7 @@ public class List extends Component implements ItemSelectable, Accessible {
synchronized (getTreeLock()) {
ListPeer peer = (ListPeer)this.peer;
return (peer != null) ?
peer.minimumSize(rows) :
peer.getMinimumSize(rows) :
super.minimumSize();
}
}
......
......@@ -268,7 +268,7 @@ public class MenuItem extends MenuComponent implements Accessible {
enabled = true;
MenuItemPeer peer = (MenuItemPeer)this.peer;
if (peer != null) {
peer.enable();
peer.setEnabled(true);
}
}
......@@ -294,7 +294,7 @@ public class MenuItem extends MenuComponent implements Accessible {
enabled = false;
MenuItemPeer peer = (MenuItemPeer)this.peer;
if (peer != null) {
peer.disable();
peer.setEnabled(false);
}
}
......
......@@ -321,7 +321,7 @@ public class TextArea extends TextComponent {
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 class TextArea extends TextComponent {
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 @@ public class TextArea extends TextComponent {
synchronized (getTreeLock()) {
TextAreaPeer peer = (TextAreaPeer)this.peer;
return (peer != null) ?
peer.preferredSize(rows, columns) :
peer.getPreferredSize(rows, columns) :
super.preferredSize();
}
}
......@@ -552,7 +552,7 @@ public class TextArea extends TextComponent {
synchronized (getTreeLock()) {
TextAreaPeer peer = (TextAreaPeer)this.peer;
return (peer != null) ?
peer.minimumSize(rows, columns) :
peer.getMinimumSize(rows, columns) :
super.minimumSize();
}
}
......
......@@ -281,7 +281,7 @@ public class TextField extends TextComponent {
echoChar = c;
TextFieldPeer peer = (TextFieldPeer)this.peer;
if (peer != null) {
peer.setEchoCharacter(c);
peer.setEchoChar(c);
}
}
}
......@@ -376,7 +376,7 @@ public class TextField extends TextComponent {
synchronized (getTreeLock()) {
TextFieldPeer peer = (TextFieldPeer)this.peer;
return (peer != null) ?
peer.preferredSize(columns) :
peer.getPreferredSize(columns) :
super.preferredSize();
}
}
......@@ -424,7 +424,7 @@ public class TextField extends TextComponent {
synchronized (getTreeLock()) {
TextFieldPeer peer = (TextFieldPeer)this.peer;
return (peer != null) ?
peer.minimumSize(columns) :
peer.getMinimumSize(columns) :
super.minimumSize();
}
}
......
......@@ -37,8 +37,4 @@ public interface ChoicePeer extends ComponentPeer {
void removeAll();
void select(int index);
/*
* DEPRECATED: Replaced by add(String, int).
*/
void addItem(String item, int index);
}
......@@ -56,7 +56,6 @@ public interface ComponentPeer {
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 @@ public interface ComponentPeer {
*/
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);
}
......@@ -39,7 +39,6 @@ public interface ContainerPeer extends ComponentPeer {
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 @@ public interface ContainerPeer extends ComponentPeer {
* @since 1.5
*/
boolean isRestackSupported();
/**
* DEPRECATED: Replaced by getInsets().
*/
Insets insets();
}
......@@ -45,28 +45,4 @@ public interface ListPeer extends ComponentPeer {
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);
}
......@@ -35,13 +35,4 @@ public interface MenuItemPeer extends MenuComponentPeer {
void setLabel(String label);
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 {
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);
}
......@@ -24,7 +24,6 @@
*/
package java.awt.peer;
import java.awt.Rectangle;
import java.awt.im.InputMethodRequests;
/**
......@@ -43,8 +42,5 @@ public interface TextComponentPeer extends ComponentPeer {
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();
}
......@@ -38,18 +38,4 @@ public interface TextFieldPeer extends TextComponentPeer {
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);
}
......@@ -39,7 +39,6 @@ public interface WindowPeer extends ContainerPeer {
void toBack();
void setAlwaysOnTop(boolean alwaysOnTop);
void updateFocusableWindowState();
boolean requestWindowFocus();
void setModalBlocked(Dialog blocker, boolean blocked);
void updateMinimumSize();
void updateIconImages();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册