equal
deleted
inserted
replaced
31 |
31 |
32 import sun.awt.*; |
32 import sun.awt.*; |
33 |
33 |
34 import java.util.ArrayList; |
34 import java.util.ArrayList; |
35 import java.util.Vector; |
35 import java.util.Vector; |
36 import java.util.logging.*; |
36 import sun.util.logging.PlatformLogger; |
37 import sun.java2d.SurfaceData; |
37 import sun.java2d.SurfaceData; |
38 import sun.java2d.SunGraphics2D; |
38 import sun.java2d.SunGraphics2D; |
39 |
39 |
40 /** |
40 /** |
41 * The abstract class XBaseMenuWindow is the superclass |
41 * The abstract class XBaseMenuWindow is the superclass |
47 * |
47 * |
48 * Data members |
48 * Data members |
49 * |
49 * |
50 ************************************************/ |
50 ************************************************/ |
51 |
51 |
52 private static Logger log = Logger.getLogger("sun.awt.X11.XBaseMenuWindow"); |
52 private static PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XBaseMenuWindow"); |
53 |
53 |
54 /* |
54 /* |
55 * Colors are calculated using MotifColorUtilities class |
55 * Colors are calculated using MotifColorUtilities class |
56 * from backgroundColor and are contained in these vars. |
56 * from backgroundColor and are contained in these vars. |
57 */ |
57 */ |
328 mp.setContainer(this); |
328 mp.setContainer(this); |
329 synchronized(getMenuTreeLock()) { |
329 synchronized(getMenuTreeLock()) { |
330 items.add(mp); |
330 items.add(mp); |
331 } |
331 } |
332 } else { |
332 } else { |
333 if (log.isLoggable(Level.FINE)) { |
333 if (log.isLoggable(PlatformLogger.FINE)) { |
334 log.fine("WARNING: Attempt to add menu item without a peer"); |
334 log.fine("WARNING: Attempt to add menu item without a peer"); |
335 } |
335 } |
336 } |
336 } |
337 updateSize(); |
337 updateSize(); |
338 } |
338 } |
349 selectedIndex--; |
349 selectedIndex--; |
350 } |
350 } |
351 if (index < items.size()) { |
351 if (index < items.size()) { |
352 items.remove(index); |
352 items.remove(index); |
353 } else { |
353 } else { |
354 if (log.isLoggable(Level.FINE)) { |
354 if (log.isLoggable(PlatformLogger.FINE)) { |
355 log.fine("WARNING: Attempt to remove non-existing menu item, index : " + index + ", item count : " + items.size()); |
355 log.fine("WARNING: Attempt to remove non-existing menu item, index : " + index + ", item count : " + items.size()); |
356 } |
356 } |
357 } |
357 } |
358 } |
358 } |
359 updateSize(); |
359 updateSize(); |
384 void selectItem(XMenuItemPeer item, boolean showWindowIfMenu) { |
384 void selectItem(XMenuItemPeer item, boolean showWindowIfMenu) { |
385 synchronized(getMenuTreeLock()) { |
385 synchronized(getMenuTreeLock()) { |
386 XMenuPeer showingSubmenu = getShowingSubmenu(); |
386 XMenuPeer showingSubmenu = getShowingSubmenu(); |
387 int newSelectedIndex = (item != null) ? items.indexOf(item) : -1; |
387 int newSelectedIndex = (item != null) ? items.indexOf(item) : -1; |
388 if (this.selectedIndex != newSelectedIndex) { |
388 if (this.selectedIndex != newSelectedIndex) { |
389 if (log.isLoggable(Level.FINEST)) { |
389 if (log.isLoggable(PlatformLogger.FINEST)) { |
390 log.finest("Selected index changed, was : " + this.selectedIndex + ", new : " + newSelectedIndex); |
390 log.finest("Selected index changed, was : " + this.selectedIndex + ", new : " + newSelectedIndex); |
391 } |
391 } |
392 this.selectedIndex = newSelectedIndex; |
392 this.selectedIndex = newSelectedIndex; |
393 postPaintEvent(); |
393 postPaintEvent(); |
394 } |
394 } |
424 } |
424 } |
425 XToolkit.awtLock(); |
425 XToolkit.awtLock(); |
426 try { |
426 try { |
427 synchronized(getMenuTreeLock()) { |
427 synchronized(getMenuTreeLock()) { |
428 if (showingSubmenu != submenuToShow) { |
428 if (showingSubmenu != submenuToShow) { |
429 if (log.isLoggable(Level.FINER)) { |
429 if (log.isLoggable(PlatformLogger.FINER)) { |
430 log.finest("Changing showing submenu"); |
430 log.finest("Changing showing submenu"); |
431 } |
431 } |
432 if (showingSubmenu != null) { |
432 if (showingSubmenu != null) { |
433 XMenuWindow showingSubmenuWindow = showingSubmenu.getMenuWindow(); |
433 XMenuWindow showingSubmenuWindow = showingSubmenu.getMenuWindow(); |
434 if (showingSubmenuWindow != null) { |
434 if (showingSubmenuWindow != null) { |
1120 * Note that this function should be invoked |
1120 * Note that this function should be invoked |
1121 * only from root of menu window's hierarchy |
1121 * only from root of menu window's hierarchy |
1122 * that grabs input focus |
1122 * that grabs input focus |
1123 */ |
1123 */ |
1124 void doHandleJavaKeyEvent(KeyEvent event) { |
1124 void doHandleJavaKeyEvent(KeyEvent event) { |
1125 if (log.isLoggable(Level.FINER)) log.finer(event.toString()); |
1125 if (log.isLoggable(PlatformLogger.FINER)) log.finer(event.toString()); |
1126 if (event.getID() != KeyEvent.KEY_PRESSED) { |
1126 if (event.getID() != KeyEvent.KEY_PRESSED) { |
1127 return; |
1127 return; |
1128 } |
1128 } |
1129 final int keyCode = event.getKeyCode(); |
1129 final int keyCode = event.getKeyCode(); |
1130 XBaseMenuWindow cwnd = getShowingLeaf(); |
1130 XBaseMenuWindow cwnd = getShowingLeaf(); |