src/solaris/classes/sun/awt/X11/XComponentPeer.java

Print this page
rev 9830 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by: darcy, prr


 219             focusLog.fine("{0}", e);
 220         }
 221         bHasFocus = true;
 222     }
 223 
 224     /**
 225      * Called when component loses focus
 226      */
 227     public void focusLost(FocusEvent e) {
 228         if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
 229             focusLog.fine("{0}", e);
 230         }
 231         bHasFocus = false;
 232     }
 233 
 234     public boolean isFocusable() {
 235         /* should be implemented by other sub-classes */
 236         return false;
 237     }
 238 
 239     private static Class seClass;
 240     private static Constructor seCtor;
 241 
 242     final static AWTEvent wrapInSequenced(AWTEvent event) {
 243         try {
 244             if (seClass == null) {
 245                 seClass = Class.forName("java.awt.SequencedEvent");
 246             }
 247 
 248             if (seCtor == null) {
 249                 seCtor = (Constructor) AccessController.doPrivileged(new PrivilegedExceptionAction() {
 250                         public Object run() throws Exception {
 251                             Constructor ctor = seClass.getConstructor(new Class[] { AWTEvent.class });


 252                             ctor.setAccessible(true);
 253                             return ctor;
 254                         }
 255                     });
 256             }
 257 
 258             return (AWTEvent) seCtor.newInstance(new Object[] { event });
 259         }
 260         catch (ClassNotFoundException e) {
 261             throw new NoClassDefFoundError("java.awt.SequencedEvent.");
 262         }
 263         catch (PrivilegedActionException ex) {
 264             throw new NoClassDefFoundError("java.awt.SequencedEvent.");
 265         }
 266         catch (InstantiationException e) {
 267             assert false;
 268         }
 269         catch (IllegalAccessException e) {
 270             assert false;
 271         }


1305           case SET_BOUNDS:
1306               return "SET_BOUNDS";
1307         }
1308     }
1309 
1310     /**
1311      * Lowers this component at the bottom of the above HW peer. If the above parameter
1312      * is null then the method places this component at the top of the Z-order.
1313      */
1314     public void setZOrder(ComponentPeer above) {
1315         long aboveWindow = (above != null) ? ((XComponentPeer)above).getWindow() : 0;
1316 
1317         XToolkit.awtLock();
1318         try{
1319             XlibWrapper.SetZOrder(XToolkit.getDisplay(), getWindow(), aboveWindow);
1320         }finally{
1321             XToolkit.awtUnlock();
1322         }
1323     }
1324 
1325     private void addTree(Collection order, Set set, Container cont) {
1326         for (int i = 0; i < cont.getComponentCount(); i++) {
1327             Component comp = cont.getComponent(i);
1328             ComponentPeer peer = comp.getPeer();
1329             if (peer instanceof XComponentPeer) {
1330                 Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
1331                 if (!set.contains(window)) {
1332                     set.add(window);
1333                     order.add(window);
1334                 }
1335             } else if (comp instanceof Container) {
1336                 // It is lightweight container, it might contain heavyweight components attached to this
1337                 // peer
1338                 addTree(order, set, (Container)comp);
1339             }
1340         }
1341     }
1342 
1343     /****** DropTargetPeer implementation ********************/
1344 
1345     public void addDropTarget(DropTarget dt) {




 219             focusLog.fine("{0}", e);
 220         }
 221         bHasFocus = true;
 222     }
 223 
 224     /**
 225      * Called when component loses focus
 226      */
 227     public void focusLost(FocusEvent e) {
 228         if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
 229             focusLog.fine("{0}", e);
 230         }
 231         bHasFocus = false;
 232     }
 233 
 234     public boolean isFocusable() {
 235         /* should be implemented by other sub-classes */
 236         return false;
 237     }
 238 
 239     private static Class<?> seClass;
 240     private static Constructor<?> seCtor;
 241 
 242     final static AWTEvent wrapInSequenced(AWTEvent event) {
 243         try {
 244             if (seClass == null) {
 245                 seClass = Class.forName("java.awt.SequencedEvent");
 246             }
 247 
 248             if (seCtor == null) {
 249                 seCtor = AccessController.doPrivileged(new
 250                     PrivilegedExceptionAction<Constructor<?>>() {
 251                         public Constructor<?> run() throws Exception {
 252                             Constructor<?> ctor = seClass.getConstructor(
 253                                 new Class<?>[] { AWTEvent.class });
 254                             ctor.setAccessible(true);
 255                             return ctor;
 256                         }
 257                     });
 258             }
 259 
 260             return (AWTEvent) seCtor.newInstance(new Object[] { event });
 261         }
 262         catch (ClassNotFoundException e) {
 263             throw new NoClassDefFoundError("java.awt.SequencedEvent.");
 264         }
 265         catch (PrivilegedActionException ex) {
 266             throw new NoClassDefFoundError("java.awt.SequencedEvent.");
 267         }
 268         catch (InstantiationException e) {
 269             assert false;
 270         }
 271         catch (IllegalAccessException e) {
 272             assert false;
 273         }


1307           case SET_BOUNDS:
1308               return "SET_BOUNDS";
1309         }
1310     }
1311 
1312     /**
1313      * Lowers this component at the bottom of the above HW peer. If the above parameter
1314      * is null then the method places this component at the top of the Z-order.
1315      */
1316     public void setZOrder(ComponentPeer above) {
1317         long aboveWindow = (above != null) ? ((XComponentPeer)above).getWindow() : 0;
1318 
1319         XToolkit.awtLock();
1320         try{
1321             XlibWrapper.SetZOrder(XToolkit.getDisplay(), getWindow(), aboveWindow);
1322         }finally{
1323             XToolkit.awtUnlock();
1324         }
1325     }
1326 
1327     private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
1328         for (int i = 0; i < cont.getComponentCount(); i++) {
1329             Component comp = cont.getComponent(i);
1330             ComponentPeer peer = comp.getPeer();
1331             if (peer instanceof XComponentPeer) {
1332                 Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
1333                 if (!set.contains(window)) {
1334                     set.add(window);
1335                     order.add(window);
1336                 }
1337             } else if (comp instanceof Container) {
1338                 // It is lightweight container, it might contain heavyweight components attached to this
1339                 // peer
1340                 addTree(order, set, (Container)comp);
1341             }
1342         }
1343     }
1344 
1345     /****** DropTargetPeer implementation ********************/
1346 
1347     public void addDropTarget(DropTarget dt) {