harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r441863 [5/5] - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/ test/api/java/common/java/awt/
Date Sat, 09 Sep 2006 21:56:50 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
Sat Sep  9 14:56:46 2006
@@ -51,12 +51,12 @@
     NativeEventThread nativeThread;
     private final AWTEventsManager awtEventsManager;
     /* key = nativeWindow, value = Component, should be Map<NativeWindow, Component>
*/
-    private final Map windowComponentMap = new HashMap();
+    private final Map<NativeWindow, Object> windowComponentMap = new HashMap<NativeWindow,
Object>();
     /* key = nativeWindow, value = MenuComponent */
 
-    private final Map windowPopupMap = new HashMap();
+    private final Map<NativeWindow, Object> windowPopupMap = new HashMap<NativeWindow,
Object>();
 
-    private final Map windowFocusProxyMap = new HashMap();
+    private final Map<NativeWindow, Window> windowFocusProxyMap = new HashMap<NativeWindow,
Window>();
 
     final Object awtTreeLock = new Object();
     private final Synchronizer synchronizer = ContextStorage.getSynchronizer();
@@ -80,9 +80,9 @@
     /**
      * The set of desktop properties that user set directly.
      */
-    private final HashSet userPropSet = new HashSet();
+    private final HashSet<String> userPropSet = new HashSet<String>();
 
-    protected final Map desktopProperties;
+    protected final Map<String, Object> desktopProperties;
 
     protected final PropertyChangeSupport desktopPropsSupport;
 
@@ -102,6 +102,7 @@
 
     private final class ComponentInternalsImpl extends ComponentInternals {
 
+        @Override
         public NativeWindow getNativeWindow(Component component) {
             lockAWT();
             try {
@@ -111,6 +112,7 @@
             }
         }
 
+        @Override
         public void startMouseGrab(Window grabWindow, Runnable whenCanceled) {
             lockAWT();
             try {
@@ -120,6 +122,7 @@
             }
         }
 
+        @Override
         public void endMouseGrab() {
             lockAWT();
             try {
@@ -129,6 +132,7 @@
             }
         }
 
+        @Override
         public Window attachNativeWindow(long nativeWindowId) {
             lockAWT();
             try {
@@ -141,6 +145,7 @@
             }
         }
 
+        @Override
         public void makePopup(Window window) {
             lockAWT();
             try {
@@ -150,6 +155,7 @@
             }
         }
 
+        @Override
         public void onDrawImage(Component comp, Image image, Point destLocation,
                 Dimension destSize, Rectangle source) {
             lockAWT();
@@ -160,15 +166,18 @@
             }
         }
 
+        @Override
         public void setCaretPos(Component c, int x, int y) {
             c.setCaretPos(x, y);
         }
 
+        @Override
         public void unsafeInvokeAndWait(Runnable runnable)
                 throws InterruptedException, InvocationTargetException {
             Toolkit.this.unsafeInvokeAndWait(runnable);
         }
 
+        @Override
         public TextKit getTextKit(Component comp) {
             lockAWT();
             try {
@@ -178,6 +187,7 @@
             }
         }
 
+        @Override
         public void setTextKit(Component comp, TextKit kit) {
             lockAWT();
             try {
@@ -187,6 +197,7 @@
             }
         }
 
+        @Override
         public TextFieldKit getTextFieldKit(Component comp)  {
             lockAWT();
             try {
@@ -196,6 +207,7 @@
             }
         }
 
+        @Override
         public void setTextFieldKit(Component comp, TextFieldKit kit) {
             lockAWT();
             try {
@@ -205,10 +217,12 @@
             }
         }
 
+        @Override
         public void shutdown() {
             dispatchThread.shutdown();
         }
 
+        @Override
         public void setMouseEventPreprocessor(
                 MouseEventPreprocessor preprocessor) {
             lockAWT();
@@ -219,10 +233,12 @@
             }
         }
 
+        @Override
         public Choice createCustomChoice(ChoiceStyle style) {
             return new Choice(style);
         }
 
+        @Override
         public Insets getNativeInsets(Window w) {
             lockAWT();
             try {
@@ -232,10 +248,12 @@
             }
         }
 
+        @Override
         public MultiRectArea getRepaintRegion(Component c) {
             return c.repaintRegion;
         }
 
+        @Override
         public MultiRectArea subtractPendingRepaintRegion(Component c, MultiRectArea mra)
{
             lockAWT();
             try {
@@ -249,6 +267,7 @@
             }
         }
 
+        @Override
         public boolean wasPainted(Window w) {
             lockAWT();
             try {
@@ -258,22 +277,27 @@
             }
         }
 
+        @Override
         public MultiRectArea getObscuredRegion(Component c) {
             return c.getObscuredRegion(null);
         }
 
+        @Override
         public void setDesktopProperty(String name, Object value) {
             Toolkit.this.setDesktopProperty(name, value);            
         }
 
+        @Override
         public void runModalLoop(Dialog dlg) {
             dlg.runModalLoop();
         }
 
+        @Override
         public void endModalLoop(Dialog dlg) {
             dlg.endModalLoop();            
         }
 
+        @Override
         public void setVisibleFlag(Component comp, boolean visible) {
             comp.visible = visible;            
         }
@@ -305,10 +329,10 @@
         ContextStorage.getSynchronizer().unlock();
     }
 
-    /*
+    /**
      * InvokeAndWait under AWT lock. W/o this method system can hang up.
      * Added to support modality (Dialog.show() & PopupMenu.show()) from
-     * not event dispatch thread. Use in other cases is not recomended.
+     * not event dispatch thread. Use in other cases is not recommended.
      *
      * Still can be called only for whole API methods that
      * cannot be called from other classes API methods.
@@ -366,16 +390,17 @@
             Toolkit defToolkit = ContextStorage.getDefaultToolkit();
             if (defToolkit != null) {
                 return defToolkit;
-            } else {
-                staticLockAWT();
-                try {
-                    defToolkit = new ToolkitImpl();
-                    ContextStorage.setDefaultToolkit(defToolkit);
-                    return defToolkit;
-                } finally {
-                    staticUnlockAWT();
-                }
             }
+            staticLockAWT();
+            try {
+                defToolkit = new ToolkitImpl();
+                ContextStorage.setDefaultToolkit(defToolkit);
+                return defToolkit;
+            } finally {
+                staticUnlockAWT();
+            }
+            
+            
         //TODO: read system property named awt.toolkit
         //and create an instance of the specified class,
         //by default use ToolkitImpl
@@ -424,7 +449,7 @@
         if(id == 0) {
             return null;
         }
-        return (Window) windowFocusProxyMap.get(getWindowFactory().getWindowById(id));
+        return windowFocusProxyMap.get(getWindowFactory().getWindowById(id));
     }
 
     final WindowFactory getWindowFactory() {
@@ -439,11 +464,11 @@
         lockAWT();
         try {
             ComponentInternals.setComponentInternals(new ComponentInternalsImpl());
-            EventQueue eq = new EventQueue(this);
+            // EventQueue eq = new EventQueue(this);
             dispatcher = new Dispatcher(this);
             final String className = getWTKClassName();
 
-            desktopProperties = new HashMap();
+            desktopProperties = new HashMap<String, Object>();
             desktopPropsSupport = new PropertyChangeSupport(this);
 
             awtEventsManager = new AWTEventsManager();
@@ -551,12 +576,12 @@
 
     protected abstract EventQueue getSystemEventQueueImpl();
 
-    public abstract Map mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException;
+    public abstract Map<?, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
throws HeadlessException;
 
-    Map mapInputMethodHighlightImpl(InputMethodHighlight highlight)
+    Map<?, ?> mapInputMethodHighlightImpl(InputMethodHighlight highlight)
             throws HeadlessException {
         checkHeadless();
-        HashMap map = new HashMap();
+        HashMap<?, ?> map = new HashMap<Object, Object>();
         wtk.getSystemProperties().mapInputMethodHighlight(highlight, map);
         return Collections.unmodifiableMap(map);
     }
@@ -570,7 +595,7 @@
         } finally {
             unlockAWT();
         }
-        if (l != null) { // there is no garantee that null listener will not be added
+        if (l != null) { // there is no guarantee that null listener will not be added
             desktopPropsSupport.addPropertyChangeListener(propName, l);
         }
     }
@@ -585,7 +610,9 @@
         } finally {
             unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return null;
     }
 
@@ -631,7 +658,7 @@
     }
 
     public DragGestureRecognizer createDragGestureRecognizer(
-            Class recognizerAbstractClass, 
+            Class<?> recognizerAbstractClass, 
             DragSource ds, 
             Component c, 
             int srcActions, 
@@ -687,7 +714,9 @@
             unlockAWT();
         }
 
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return true;
     }
 
@@ -705,7 +734,7 @@
         lockAWT();
         try {
             checkHeadless();
-            return KeyEvent.CTRL_MASK;
+            return InputEvent.CTRL_MASK;
         } finally {
             unlockAWT();
         }
@@ -718,7 +747,9 @@
             unlockAWT();
         }
 
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return null;
     }
 
@@ -859,7 +890,9 @@
             unlockAWT();
         }
 
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return;
     }
 
@@ -873,7 +906,7 @@
             }
             shutdownWatchdog.setWindowListEmpty(true);
         } else {
-            for (Iterator i = windows.iterator(); i.hasNext();) {
+            for (Iterator<?> i = windows.iterator(); i.hasNext();) {
                 ((Window) i.next()).redrawAll();
             }
         }
@@ -898,7 +931,7 @@
      *
      * This is done this way because on Windows the native window gets a series of native
      * events before windowFactory.CreateWindow() returns, and the WinWindow object should
be created
-     * to process them. The WM_CREATE message is garanteed to be first in the series, so
that the
+     * to process them. The WM_CREATE message is guaranteed to be first in the series, so
that the
      * the WM_CREATE handler creates the WinWindow object and calls nativeWindowCreated()
      * for it.
      *
@@ -985,12 +1018,15 @@
                 cp.iconified = (state & Frame.ICONIFIED) != 0;
 
                 cp.maximizedState = 0;
-                if ( (state & Frame.MAXIMIZED_BOTH) != 0)
+                if ( (state & Frame.MAXIMIZED_BOTH) != 0) {
                     cp.maximizedState |= cp.MAXIMIZED;
-                if ( (state & Frame.MAXIMIZED_HORIZ) != 0)
+                }
+                if ( (state & Frame.MAXIMIZED_HORIZ) != 0) {
                     cp.maximizedState |= cp.MAXIMIZED_HORIZ;
-                if ( (state & Frame.MAXIMIZED_VERT) != 0)
+                }
+                if ( (state & Frame.MAXIMIZED_VERT) != 0) {
                     cp.maximizedState |= cp.MAXIMIZED_VERT;
+                }
 
                 cp.decorType = CreationParams.DECOR_TYPE_FRAME;
 
@@ -1008,7 +1044,7 @@
             parent = c.getHWAncestor();
             cp.name = c.getName();
 
-            //set location relative to the nearest heavyweight ancestor
+            //set location relative to the nearest heavy weight ancestor
             location = MouseDispatcher.convertPoint(c, 0, 0, parent);
         }
 
@@ -1218,12 +1254,12 @@
         String osName = System.getProperty("os.name").toLowerCase();
         String packageBase = "org.apache.harmony.awt.theme", win = "windows", lin = "linux";
 
-        PrivilegedAction action = new PrivilegedAction() {
-            public Object run() {
+        PrivilegedAction<String> action = new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty("awt.theme");
             }};
 
-        String className = (String)AccessController.doPrivileged(action);
+        String className = AccessController.doPrivileged(action);
 
         if (className == null) {
             if (osName.startsWith(lin)) {
@@ -1257,7 +1293,7 @@
 
         void removeAWTEventListener(AWTEventListener listener) {
             if (listener != null) {
-                for (Iterator i = listeners.getUserIterator(); i.hasNext();) {
+                for (Iterator<?> i = listeners.getUserIterator(); i.hasNext();) {
                     AWTEventListenerProxy proxy = (AWTEventListenerProxy) i.next();
 
                     if (listener == proxy.getListener()) {
@@ -1270,19 +1306,19 @@
         }
 
         AWTEventListener[] getAWTEventListeners() {
-            HashSet listenersSet = new HashSet();
+            HashSet<EventListener> listenersSet = new HashSet<EventListener>();
 
-            for (Iterator i = listeners.getUserIterator(); i.hasNext();) {
+            for (Iterator<?> i = listeners.getUserIterator(); i.hasNext();) {
                 listenersSet.add(((AWTEventListenerProxy) i.next()).getListener());
             }
 
-            return (AWTEventListener[]) listenersSet.toArray(new AWTEventListener[0]);
+            return listenersSet.toArray(new AWTEventListener[0]);
         }
 
         AWTEventListener[] getAWTEventListeners(long eventMask) {
-            HashSet listenersSet = new HashSet();
+            HashSet<EventListener> listenersSet = new HashSet<EventListener>();
 
-            for (Iterator i = listeners.getUserIterator(); i.hasNext();) {
+            for (Iterator<?> i = listeners.getUserIterator(); i.hasNext();) {
                 AWTEventListenerProxy listenerProxy = (AWTEventListenerProxy) i.next();
 
                 if ((listenerProxy.getEventMask() & eventMask) == eventMask) {
@@ -1290,7 +1326,7 @@
                 }
             }
 
-            return (AWTEventListener[]) listenersSet.toArray(new AWTEventListener[0]);
+            return listenersSet.toArray(new AWTEventListener[0]);
         }
 
         void dispatchAWTEvent(AWTEvent event) {
@@ -1300,7 +1336,7 @@
                 return;
             }
 
-            for (Iterator i = listeners.getUserIterator(); i.hasNext();) {
+            for (Iterator<?> i = listeners.getUserIterator(); i.hasNext();) {
                 AWTEventListenerProxy listenerProxy = (AWTEventListenerProxy) i.next();
 
                 if ((listenerProxy.getEventMask() & descriptor.eventMask) != 0) {
@@ -1341,32 +1377,34 @@
          * this set it is replaced to avoid the possible conflict
          * with concurrently running lock-free iterator loop
          */
-        private LinkedHashSet windows = new LinkedHashSet();
+        private LinkedHashSet<Component> windows = new LinkedHashSet<Component>();
         private final Object lock = new Object();
 
+        @SuppressWarnings("unchecked")
         void add(Component w) {
             synchronized (lock) {
                 if (isDispatchThread()) {
                     windows.add(w);
                 } else {
-                    windows = (LinkedHashSet)windows.clone();
+                    windows = (LinkedHashSet<Component>)windows.clone();
                     windows.add(w);
                 }
             }
         }
 
+        @SuppressWarnings("unchecked")
         void remove(Component w) {
             synchronized (lock) {
                 if (isDispatchThread()) {
                     windows.remove(w);
                 } else {
-                    windows = (LinkedHashSet)windows.clone();
+                    windows = (LinkedHashSet<Component>)windows.clone();
                     windows.remove(w);
                 }
             }
         }
 
-        Iterator iterator() {
+        Iterator<?> iterator() {
             synchronized (lock) {
                 return new ReadOnlyIterator(windows.iterator());
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java
Sat Sep  9 14:56:46 2006
@@ -28,6 +28,7 @@
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
 import java.awt.peer.*;
+import java.io.Serializable;
 import java.net.URL;
 import java.util.Hashtable;
 import java.util.Map;
@@ -40,8 +41,9 @@
 
 class ToolkitImpl extends Toolkit {
 
-    static final Hashtable imageCache = new Hashtable();
+    static final Hashtable<Serializable, Image> imageCache = new Hashtable<Serializable,
Image>();
 
+    @Override
     public void sync() {
         lockAWT();
         try {
@@ -50,6 +52,7 @@
         }
     }
 
+    @Override
     protected TextAreaPeer createTextArea(TextArea a0) throws HeadlessException {
         lockAWT();
         try {
@@ -60,6 +63,7 @@
         }
     }
 
+    @Override
     public int checkImage(Image image, int width, int height, ImageObserver observer) {
         lockAWT();
         try {
@@ -76,6 +80,7 @@
         }
     }
 
+    @Override
     public Image createImage(ImageProducer producer) {
         lockAWT();
         try {
@@ -85,6 +90,7 @@
         }
     }
 
+    @Override
     public Image createImage(byte[] imagedata, int imageoffset, int imagelength) {
         lockAWT();
         try {
@@ -95,6 +101,7 @@
         }
     }
 
+    @Override
     public Image createImage(URL url) {
         lockAWT();
         try {
@@ -104,6 +111,7 @@
         }
     }
 
+    @Override
     public Image createImage(String filename) {
         lockAWT();
         try {
@@ -113,6 +121,7 @@
         }
     }
 
+    @Override
     public ColorModel getColorModel() throws HeadlessException {
         lockAWT();
         try {
@@ -124,6 +133,7 @@
         }
     }
 
+    @Override
     public FontMetrics getFontMetrics(Font font) {
         lockAWT();
         try {
@@ -133,6 +143,7 @@
         }
     }
 
+    @Override
     public boolean prepareImage(Image image, int width, int height, ImageObserver observer)
{
         lockAWT();
         try {
@@ -149,6 +160,7 @@
         }
     }
 
+    @Override
     public void beep() {
         lockAWT();
         try {
@@ -157,6 +169,7 @@
         }
     }
 
+    @Override
     protected ButtonPeer createButton(Button a0) throws HeadlessException {
         lockAWT();
         try {
@@ -167,6 +180,7 @@
         }
     }
 
+    @Override
     protected CanvasPeer createCanvas(Canvas a0) {
         lockAWT();
         try {
@@ -176,6 +190,7 @@
         }
     }
 
+    @Override
     protected CheckboxPeer createCheckbox(Checkbox a0) throws HeadlessException {
         lockAWT();
         try {
@@ -186,6 +201,7 @@
         }
     }
 
+    @Override
     protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem a0)
             throws HeadlessException
     {
@@ -198,6 +214,7 @@
         }
     }
 
+    @Override
     protected ChoicePeer createChoice(Choice a0) throws HeadlessException {
         lockAWT();
         try {
@@ -208,6 +225,7 @@
         }
     }
 
+    @Override
     protected DialogPeer createDialog(Dialog a0) throws HeadlessException {
         lockAWT();
         try {
@@ -218,11 +236,13 @@
         }
     }
 
+    @Override
     public DragSourceContextPeer createDragSourceContextPeer(
             DragGestureEvent dge) throws InvalidDnDOperationException {
         return dtk.createDragSourceContextPeer(dge);
     }
 
+    @Override
     protected FileDialogPeer createFileDialog(FileDialog a0)
             throws HeadlessException
     {
@@ -235,6 +255,7 @@
         }
     }
 
+    @Override
     protected FramePeer createFrame(Frame a0) throws HeadlessException {
         lockAWT();
         try {
@@ -245,6 +266,7 @@
         }
     }
 
+    @Override
     protected LabelPeer createLabel(Label a0) throws HeadlessException {
         lockAWT();
         try {
@@ -255,6 +277,7 @@
         }
     }
 
+    @Override
     protected ListPeer createList(List a0) throws HeadlessException {
         lockAWT();
         try {
@@ -265,6 +288,7 @@
         }
     }
 
+    @Override
     protected MenuPeer createMenu(Menu a0) throws HeadlessException {
         lockAWT();
         try {
@@ -275,6 +299,7 @@
         }
     }
 
+    @Override
     protected MenuBarPeer createMenuBar(MenuBar a0) throws HeadlessException {
         lockAWT();
         try {
@@ -285,6 +310,7 @@
         }
     }
 
+    @Override
     protected MenuItemPeer createMenuItem(MenuItem a0) throws HeadlessException {
         lockAWT();
         try {
@@ -295,6 +321,7 @@
         }
     }
 
+    @Override
     protected PanelPeer createPanel(Panel a0) {
         lockAWT();
         try {
@@ -304,6 +331,7 @@
         }
     }
 
+    @Override
     protected PopupMenuPeer createPopupMenu(PopupMenu a0)
             throws HeadlessException
     {
@@ -316,6 +344,7 @@
         }
     }
 
+    @Override
     protected ScrollPanePeer createScrollPane(ScrollPane a0)
             throws HeadlessException
     {
@@ -328,6 +357,7 @@
         }
     }
 
+    @Override
     protected ScrollbarPeer createScrollbar(Scrollbar a0)
             throws HeadlessException
     {
@@ -340,6 +370,7 @@
         }
     }
 
+    @Override
     protected TextFieldPeer createTextField(TextField a0)
             throws HeadlessException
     {
@@ -352,6 +383,7 @@
         }
     }
 
+    @Override
     protected WindowPeer createWindow(Window a0) throws HeadlessException {
         lockAWT();
         try {
@@ -362,6 +394,7 @@
         }
     }
 
+    @Override
     public String[] getFontList() {
         lockAWT();
         try {
@@ -371,6 +404,7 @@
         return null;
     }
 
+    @Override
     protected FontPeer getFontPeer(String a0, int a1) {
         lockAWT();
         try {
@@ -380,13 +414,14 @@
         }
     }
 
+    @Override
     public Image getImage(String filename) {
         return getImage(filename, this);
     }
 
     static Image getImage(String filename, Toolkit toolkit){
         synchronized(imageCache) {
-            Image im = (Image)imageCache.get(filename);
+            Image im = imageCache.get(filename);
             if(im == null){
                 try{
                     im = toolkit.createImage(filename);
@@ -399,13 +434,14 @@
         }
     }
 
+    @Override
     public Image getImage(URL url) {
         return getImage(url, this);
     }
 
     static Image getImage(URL url, Toolkit toolkit) {
         synchronized(imageCache) {
-            Image im = (Image)imageCache.get(url);
+            Image im = imageCache.get(url);
             if(im == null){
                 try{
                     im = toolkit.createImage(url);
@@ -418,6 +454,7 @@
         }
     }
 
+    @Override
     public PrintJob getPrintJob(Frame a0, String a1, Properties a2) {
         lockAWT();
         try {
@@ -427,6 +464,7 @@
         return null;
     }
 
+    @Override
     public int getScreenResolution() throws HeadlessException {
         lockAWT();
         try {
@@ -437,6 +475,7 @@
         }
     }
 
+    @Override
     public Dimension getScreenSize() throws HeadlessException {
         lockAWT();
         try {
@@ -448,6 +487,7 @@
         }
     }
 
+    @Override
     public Clipboard getSystemClipboard() throws HeadlessException {
         lockAWT();
         try {
@@ -469,7 +509,8 @@
         }
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+    @Override
+    public Map<?, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
             throws HeadlessException {
         lockAWT();
         try {
@@ -479,6 +520,7 @@
         }
     }
 
+    @Override
     protected EventQueue getSystemEventQueueImpl() {
         return getSystemEventQueueCore().getActiveEventQueue();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
Sat Sep  9 14:56:46 2006
@@ -56,7 +56,7 @@
     private final AWTListenerList windowFocusListeners = new AWTListenerList(this);
     private final AWTListenerList windowListeners = new AWTListenerList(this);
     private final AWTListenerList windowStateListeners = new AWTListenerList(this);
-    private ArrayList ownedWindows = new ArrayList();
+    private ArrayList<Window> ownedWindows = new ArrayList<Window>();
     private transient Component focusOwner;
     private boolean focusableWindowState = true;//By default, all Windows have a focusable
Window state of true
 
@@ -100,6 +100,7 @@
 
         private static final long serialVersionUID = 4215068635060671780L;
 
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
             toolkit.lockAWT();
             try {
@@ -116,6 +117,7 @@
             }
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             toolkit.lockAWT();
             try {
@@ -192,10 +194,12 @@
         }
     }
 
+    @Override
     protected void finalize() throws Throwable {
         // do nothing
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -207,6 +211,7 @@
         }
     }
 
+    @Override
     public void removeNotify() {
         toolkit.lockAWT();
         try {
@@ -218,6 +223,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -227,10 +233,12 @@
         }
     }
 
+    @Override
     public Toolkit getToolkit() {
         return toolkit;
     }
 
+    @Override
     public void setCursor(Cursor cursor) {
         toolkit.lockAWT();
         try {
@@ -242,6 +250,7 @@
         }
     }
 
+    @Override
     public void addPropertyChangeListener(PropertyChangeListener listener) {
         toolkit.lockAWT();
         try {
@@ -251,6 +260,7 @@
         }
     }
 
+    @Override
     public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
{
         toolkit.lockAWT();
         try {
@@ -266,7 +276,9 @@
         } finally {
             toolkit.unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented");
+        if (true) {
+            throw new RuntimeException("Method is not implemented");
+        }
         return;
     }
 
@@ -276,7 +288,9 @@
         } finally {
             toolkit.unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return;
     }
 
@@ -327,7 +341,7 @@
      */
     private void disposeOwnedWindows() {
         for (int i=0; i < ownedWindows.size(); i++) {
-            Window win = (Window) ownedWindows.get(i);
+            Window win = ownedWindows.get(i);
             if (win != null) {
                 win.dispose();
             }
@@ -341,10 +355,13 @@
         } finally {
             toolkit.unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return null;
     }
 
+    @Override
     public final Container getFocusCycleRootAncestor() {
         toolkit.lockAWT();
         try {
@@ -364,7 +381,8 @@
         }
     }
 
-    public Set getFocusTraversalKeys(int id) {
+    @Override
+    public Set<?> getFocusTraversalKeys(int id) {
         //why override?
         toolkit.lockAWT();
         try {
@@ -374,6 +392,7 @@
         }
     }
 
+    @Override
     public GraphicsConfiguration getGraphicsConfiguration() {
         toolkit.lockAWT();
         try {
@@ -391,6 +410,7 @@
         }
     }
 
+    @Override
     public InputContext getInputContext() {
         toolkit.lockAWT();
         try {
@@ -403,6 +423,7 @@
         }
     }
 
+    @Override
     public Locale getLocale() {
         toolkit.lockAWT();
         try {
@@ -412,6 +433,8 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
+    @Override
     public void hide() {
         toolkit.lockAWT();
         try {
@@ -419,7 +442,7 @@
             painted = false;
             // hide all owned windows explicitly:
             for (int i = 0; i < ownedWindows.size(); i++) {
-                Window w = (Window) ownedWindows.get(i);
+                Window w = ownedWindows.get(i);
                 if (w != null) {
                     w.hide();
                 }
@@ -430,6 +453,7 @@
         }
     }
 
+    @Override
     public final boolean isFocusCycleRoot() {
         toolkit.lockAWT();
         try {
@@ -472,6 +496,7 @@
         }
     }
 
+    @Override
     public boolean isShowing() {
         toolkit.lockAWT();
         try {
@@ -484,6 +509,9 @@
     /**
      * @deprecated
      */
+    @SuppressWarnings("deprecation")
+    @Deprecated
+    @Override
     public boolean postEvent(Event evt) {
         toolkit.lockAWT();
         try {
@@ -494,6 +522,8 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
+    @Override
     public void show() {
         toolkit.lockAWT();
         try {
@@ -532,6 +562,7 @@
         focusOwner = owner;
     }
 
+    @Override
     public final void setFocusCycleRoot(boolean value) {
         toolkit.lockAWT();
         try {
@@ -557,6 +588,8 @@
     /**
      * @deprecated
      */
+    @SuppressWarnings("deprecation")
+    @Deprecated
     public void applyResourceBundle(ResourceBundle rb) {
         toolkit.lockAWT();
         try {
@@ -569,6 +602,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void applyResourceBundle(String rbName) {
         toolkit.lockAWT();
         try {
@@ -590,7 +624,7 @@
     public Window[] getOwnedWindows() {
         toolkit.lockAWT();
         try {
-            return (Window[]) ownedWindows.toArray(new Window[0]);
+            return ownedWindows.toArray(new Window[0]);
         } finally {
             toolkit.unlockAWT();
         }
@@ -619,12 +653,12 @@
             return null;
         }
 
-        PrivilegedAction action = new PrivilegedAction() {
-            public Object run() {
+        PrivilegedAction<String> action = new PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty("awt.appletWarning", "Warning: Java window");
             }};
 
-        return (String)AccessController.doPrivileged(action);
+        return AccessController.doPrivileged(action);
     }
 
     public boolean isActive() {
@@ -718,10 +752,12 @@
         // do nothing, override in Frame to do useful work
     }
 
+    @Override
     Insets getNativeInsets() {
         return (Insets)nativeInsets.clone();
     }
 
+    @Override
     void setBounds(int x, int y, int w, int h, int bMask, boolean updateBehavior) {
         boolean resized = ((w != this.w) || (h != this.h));
         super.setBounds(x, y, w, h, bMask, updateBehavior);
@@ -731,6 +767,7 @@
         }
     }
 
+    @Override
     public void setBounds(int x, int y, int width, int height) {
         locationByPlatform = false;
         super.setBounds(x, y, width, height);
@@ -902,8 +939,9 @@
         if (this.undecorated == undecorated) {
             return;
         }
-        if(isDisplayable())
+        if(isDisplayable()) {
             throw new IllegalComponentStateException("Cannot change the decorations while
the window is visible");
+        }
 
         this.undecorated = undecorated;
     }
@@ -913,8 +951,9 @@
     }
 
     void setPopup(boolean popup) {
-        if(isDisplayable())
+        if(isDisplayable()) {
             throw new IllegalComponentStateException("Cannot change the decorations while
the window is visible");
+        }
         this.popup = popup;
     }
 
@@ -943,6 +982,7 @@
         firePropertyChange("title", oldTitle, title);
     }
 
+    @Override
     RedrawManager getRedrawManager() {
         return redrawManager;
     }
@@ -962,6 +1002,7 @@
         return requestedFocus;
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTWindow();
     }
@@ -972,10 +1013,12 @@
      * @return actual Cursor to be displayed
      * @see Component.getRealCursor()
      */
+    @Override
     Cursor getRealCursor() {
        return isEnabled() ? getCursor() : Cursor.getDefaultCursor();
     }
 
+    @Override
     String autoName() {
         int number = toolkit.autoNumber.nextWindow++;
         return "window" + Integer.toString(number);
@@ -1019,7 +1062,8 @@
         windowStateListeners.removeUserListener(l);
     }
 
-    public EventListener[] getListeners(Class listenerType) {
+    @Override
+    public EventListener[] getListeners(Class<?> listenerType) {
         if (WindowFocusListener.class.isAssignableFrom(listenerType)) {
             return getWindowFocusListeners();
         } else if (WindowStateListener.class.isAssignableFrom(listenerType)) {
@@ -1031,6 +1075,7 @@
         }
     }
 
+    @Override
     protected void processEvent(AWTEvent e) {
         long eventMask = toolkit.eventTypeLookup.getEventMask(e);
 
@@ -1046,7 +1091,7 @@
     }
 
     protected void processWindowEvent(WindowEvent e) {
-        for (Iterator i = windowListeners.getUserIterator(); i.hasNext();) {
+        for (Iterator<?> i = windowListeners.getUserIterator(); i.hasNext();) {
             WindowListener listener = (WindowListener) i.next();
 
             switch (e.getID()) {
@@ -1076,7 +1121,7 @@
     }
 
     protected void processWindowFocusEvent(WindowEvent e) {
-        for (Iterator i = windowFocusListeners.getUserIterator(); i.hasNext();) {
+        for (Iterator<?> i = windowFocusListeners.getUserIterator(); i.hasNext();)
{
             WindowFocusListener listener = (WindowFocusListener) i.next();
 
             switch (e.getID()) {
@@ -1091,7 +1136,7 @@
     }
 
     protected void processWindowStateEvent(WindowEvent e) {
-        for (Iterator i = windowStateListeners.getUserIterator(); i.hasNext();) {
+        for (Iterator<?> i = windowStateListeners.getUserIterator(); i.hasNext();)
{
             WindowStateListener listener = (WindowStateListener) i.next();
 
             switch (e.getID()) {
@@ -1102,6 +1147,7 @@
         }
     }
 
+    @Override
     void moveFocusOnHide() {
         // let native system move focus itself
         // if native focused window is the same as
@@ -1111,6 +1157,7 @@
         }
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
@@ -1133,18 +1180,22 @@
         return gc;
     }
 
+    @Override
     Color getDefaultBackground() {
         return SystemColor.window;
     }
 
+    @Override
     Color getDefaultForeground() {
         return SystemColor.windowText;
     }
 
+    @Override
     boolean isPrepainter() {
         return true;
     }
 
+    @Override
     void prepaint(Graphics g) {
         Color back = getBackground();
         if (back == null) {
@@ -1161,6 +1212,7 @@
      * & properties to make them correspond to Java
      * Window state/properties
      */
+    @Override
     void nativeWindowCreated(NativeWindow win) {
         win.setFocusable(getFocusableWindowState());
         nativeInsets = win.getInsets();
@@ -1186,6 +1238,7 @@
         }
     }
 
+    @Override
     MultiRectArea getObscuredRegion(Rectangle part) {
         if (!visible || behaviour.getNativeWindow() == null) {
             return null;
@@ -1214,6 +1267,7 @@
         redrawManager = new RedrawManager(this);
     }
     
+    @Override
     void notifyInputMethod(Rectangle bounds) {
         InputContext ic = getInputContext();
         if (ic instanceof InputMethodContext) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java
Sat Sep  9 14:56:46 2006
@@ -20,6 +20,8 @@
 package java.awt;
 
 
+import java.util.Set;
+
 import junit.framework.TestCase;
 
 
@@ -29,7 +31,7 @@
     public final void testSetFocusTraversalKeys() {
         try {
         Button btn = new Button();
-        btn.setFocusTraversalKeys(KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, new Container().getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
+        btn.setFocusTraversalKeys(KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, (Set<AWTKeyStroke>)new
Container().getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
         fail("IllegalArgumentException expected");
     }catch (IllegalArgumentException e) {
     }



Mime
View raw message