<AWT Dev> [PATCH] Cleanup AWT peer interfaces
Roman Kennke
roman.kennke at aicas.com
Tue Sep 16 02:02:27 PDT 2008
Hello,
The peer interfaces have a lot of duplicate methods, where one is
deprecated and 'replaced' by a new one (for example, preferredSize() and
getPreferredSize() ). I see that this makes sense for public API
_classes_ to maintain backward compatibility, but it does _not_ make
sense for interfaces. It only confuses those who have to implement those
interfaces (which method should I implement? Which one is called, and
which should call which?), and adds no value at all. Also: the new
interface methods are not used (i.e. called by AWT) at all. As part of
the Caciocavallo project I went through this stuff and removed the
duplicates, leaving the new methods in the interfaces and made AWT call
the new methods instead. There were also a couple of methods that are
never called from AWT (like ComponentPeer.repaint() ), which I also
removed (some of such methods are used, but only in the interface
implementation, so it is not required to have them in the public
interface). What do you think? Should this be merged into main JDK7?
Cheers, Roman
--
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
-------------- next part --------------
# HG changeset patch
# User Mario Torre <mario.torre at aicas.com>
# Date 1217450571 -7200
# Node ID 87fd234ed5ab0bac1ffa8731e80ded5830aa1684
# Parent 9af1670d56ecb4d3e49a21c9389c390e4c9e003f
imported patch RepaintManager.patch
diff -r 9af1670d56ec -r 87fd234ed5ab src/share/classes/javax/swing/RepaintManager.java
--- a/src/share/classes/javax/swing/RepaintManager.java Wed Jul 30 22:42:51 2008 +0200
+++ b/src/share/classes/javax/swing/RepaintManager.java Wed Jul 30 22:42:51 2008 +0200
@@ -1261,9 +1261,12 @@
if (doubleBufferingEnabled && !nativeDoubleBuffering) {
switch (bufferStrategyType) {
case BUFFER_STRATEGY_NOT_SPECIFIED:
- if (((SunToolkit)Toolkit.getDefaultToolkit()).
- useBufferPerWindow()) {
- paintManager = new BufferStrategyPaintManager();
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ if (tk instanceof SunToolkit) {
+ SunToolkit stk = (SunToolkit) tk;
+ if (stk.useBufferPerWindow()) {
+ paintManager = new BufferStrategyPaintManager();
+ }
}
break;
case BUFFER_STRATEGY_SPECIFIED_ON:
@@ -1285,9 +1288,16 @@
private void scheduleProcessingRunnable(AppContext context) {
if (processingRunnable.markPending()) {
- SunToolkit.getSystemEventQueueImplPP(context).
- postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(),
- processingRunnable));
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ if (tk instanceof SunToolkit) {
+ SunToolkit.getSystemEventQueueImplPP(context).
+ postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(),
+ processingRunnable));
+ } else {
+ Toolkit.getDefaultToolkit().getSystemEventQueue().
+ postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(),
+ processingRunnable));
+ }
}
}
More information about the awt-dev
mailing list