package sun.lwawt.macosx;
import java.awt.AWTError;
import java.awt.CheckboxMenuItem;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.EventQueue;
import java.awt.FileDialog;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.RenderingHints;
import java.awt.Robot;
import java.awt.SystemTray;
import java.awt.Taskbar;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.Window;
import java.awt.datatransfer.Clipboard;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragGestureRecognizer;
import java.awt.dnd.DragSource;
import java.awt.dnd.DropTarget;
import java.awt.dnd.InvalidDnDOperationException;
import java.awt.dnd.MouseDragGestureRecognizer;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.awt.event.InputEvent;
import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent;
import java.awt.font.TextAttribute;
import java.awt.im.InputMethodHighlight;
import java.awt.im.spi.InputMethodDescriptor;
import java.awt.peer.CheckboxMenuItemPeer;
import java.awt.peer.DesktopPeer;
import java.awt.peer.DialogPeer;
import java.awt.peer.FileDialogPeer;
import java.awt.peer.FontPeer;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuItemPeer;
import java.awt.peer.MenuPeer;
import java.awt.peer.PopupMenuPeer;
import java.awt.peer.RobotPeer;
import java.awt.peer.SystemTrayPeer;
import java.awt.peer.TaskbarPeer;
import java.awt.peer.TrayIconPeer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Objects;
import java.util.ResourceBundle;
import java.util.concurrent.Callable;
import javax.swing.UIManager;
import com.apple.laf.AquaMenuBarUI;
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.CGraphicsConfig;
import sun.awt.CGraphicsDevice;
import sun.awt.LightweightFrame;
import sun.awt.PlatformGraphicsInfo;
import sun.awt.SunToolkit;
import sun.awt.datatransfer.DataTransferer;
import sun.awt.util.ThreadGroupUtils;
import sun.java2d.opengl.OGLRenderQueue;
import sun.lwawt.LWComponentPeer;
import sun.lwawt.LWCursorManager;
import sun.lwawt.LWToolkit;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.LWWindowPeer.PeerType;
import sun.lwawt.PlatformComponent;
import sun.lwawt.PlatformDropTarget;
import sun.lwawt.PlatformWindow;
import sun.lwawt.SecurityWarningWindow;
import sun.security.action.GetBooleanAction;
@SuppressWarnings("serial")
final class NamedCursor extends Cursor {
NamedCursor(String name) {
super(name);
}
}
public final class LWCToolkit extends LWToolkit {
private static final int BUTTONS = 5;
private static native void initIDs();
private static native void initAppkit(ThreadGroup appKitThreadGroup, boolean headless);
private static CInputMethodDescriptor sInputMethodDescriptor;
static {
System.err.flush();
ResourceBundle platformResources = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<ResourceBundle>() {
@Override
public ResourceBundle run() {
ResourceBundle platformResources = null;
try {
platformResources = ResourceBundle.getBundle("sun.awt.resources.awtosx");
} catch (MissingResourceException e) {
}
System.loadLibrary("awt");
System.loadLibrary("fontmanager");
return platformResources;
}
});
if (!GraphicsEnvironment.isHeadless() &&
!PlatformGraphicsInfo.isInAquaSession())
{
throw new AWTError("WindowServer is not available");
}
AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources);
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", "false"));
}
});
}
private static final boolean inAWT;
public LWCToolkit() {
final String extraButtons = "sun.awt.enableExtraMouseButtons";
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
areExtraMouseButtonsEnabled =
Boolean.parseBoolean(System.getProperty(extraButtons, "true"));
System.setProperty(extraButtons, ""+areExtraMouseButtonsEnabled);
initAppkit(ThreadGroupUtils.getRootThreadGroup(),
GraphicsEnvironment.isHeadless());
return null;
});
}
private static final int NUM_APPLE_COLORS = 3;
public static final int KEYBOARD_FOCUS_COLOR = 0;
public static final int INACTIVE_SELECTION_BACKGROUND_COLOR = 1;
public static final int INACTIVE_SELECTION_FOREGROUND_COLOR = 2;
private static int[] appleColors = {
0xFF808080,
0xFFC0C0C0,
0xFF303030,
};
private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
@Override
protected void loadSystemColors(final int[] systemColors) {
if (systemColors == null) return;
loadNativeColors(systemColors, appleColors);
}
@SuppressWarnings("serial")
private static class AppleSpecificColor extends Color {
private final int index;
AppleSpecificColor(int index) {
super(appleColors[index]);
this.index = index;
}
@Override
public int getRGB() {
return appleColors[index];
}
}
public static Color getAppleColor(int color) {
return new AppleSpecificColor(color);
}
static void systemColorsChanged() {
EventQueue.invokeLater(() -> {
AccessController.doPrivileged( (PrivilegedAction<Object>) () -> {
AWTAccessor.getSystemColorAccessor().updateSystemColors();
return null;
});
});
}
public static LWCToolkit getLWCToolkit() {
return (LWCToolkit)Toolkit.getDefaultToolkit();
}
@Override
protected PlatformWindow createPlatformWindow(PeerType peerType) {
if (peerType == PeerType.EMBEDDED_FRAME) {
return new CPlatformEmbeddedFrame();
} else if (peerType == PeerType.VIEW_EMBEDDED_FRAME) {
return new CViewPlatformEmbeddedFrame();
} else if (peerType == PeerType.LW_FRAME) {
return new CPlatformLWWindow();
} else {
assert (peerType == PeerType.SIMPLEWINDOW
|| peerType == PeerType.DIALOG
|| peerType == PeerType.FRAME);
return new CPlatformWindow();
}
}
LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.EMBEDDED_FRAME);
}
LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.VIEW_EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.VIEW_EMBEDDED_FRAME);
}
private CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public DialogPeer createDialog(Dialog target) {
if (target instanceof CPrinterDialog) {
return createCPrinterDialog((CPrinterDialog)target);
}
return super.createDialog(target);
}
@Override
protected SecurityWarningWindow createSecurityWarning(Window ownerWindow,
LWWindowPeer ownerPeer) {
return new CWarningWindow(ownerWindow, ownerPeer);
}
@Override
protected PlatformComponent createPlatformComponent() {
return new CPlatformComponent();
}
@Override
protected PlatformComponent createLwPlatformComponent() {
return new CPlatformLWComponent();
}
@Override
protected FileDialogPeer createFileDialogPeer(FileDialog target) {
return new CFileDialog(target);
}
@Override
public MenuPeer (Menu target) {
MenuPeer peer = new CMenu(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public MenuBarPeer (MenuBar target) {
MenuBarPeer peer = new CMenuBar(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public MenuItemPeer (MenuItem target) {
MenuItemPeer peer = new CMenuItem(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public CheckboxMenuItemPeer (CheckboxMenuItem target) {
CheckboxMenuItemPeer peer = new CCheckboxMenuItem(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public PopupMenuPeer (PopupMenu target) {
PopupMenuPeer peer = new CPopupMenu(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public SystemTrayPeer createSystemTray(SystemTray target) {
return new CSystemTray();
}
@Override
public TrayIconPeer createTrayIcon(TrayIcon target) {
TrayIconPeer peer = new CTrayIcon(target);
targetCreatedPeer(target, peer);
return peer;
}
@Override
public DesktopPeer createDesktopPeer(Desktop target) {
return new CDesktopPeer();
}
@Override
public TaskbarPeer createTaskbarPeer(Taskbar target) {
return new CTaskbarPeer();
}
@Override
public LWCursorManager getCursorManager() {
return CCursorManager.getInstance();
}
@Override
public Cursor createCustomCursor(final Image cursor, final Point hotSpot,
final String name)
throws IndexOutOfBoundsException, HeadlessException {
return new CCustomCursor(cursor, hotSpot, name);
}
@Override
public Dimension getBestCursorSize(final int preferredWidth,
final int preferredHeight)
throws HeadlessException {
return CCustomCursor.getBestCursorSize(preferredWidth, preferredHeight);
}
@Override
protected void platformCleanup() {
}
@Override
protected void platformInit() {
}
@Override
protected void platformRunMessage() {
}
@Override
protected void platformShutdown() {
}
class OSXPlatformFont extends sun.awt.PlatformFont
{
OSXPlatformFont(String name, int style)
{
super(name, style);
}
@Override
protected char getMissingGlyphCharacter()
{
return (char)0xfff8;
}
}
@Override
public FontPeer getFontPeer(String name, int style) {
return new OSXPlatformFont(name, style);
}
@Override
protected void initializeDesktopProperties() {
super.initializeDesktopProperties();
Map <Object, Object> fontHints = new HashMap<>();
fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
desktopProperties.put("awt.mouse.numButtons", BUTTONS);
desktopProperties.put("awt.multiClickInterval", getMultiClickTime());
desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE);
desktopProperties.put("DnD.Cursor.CopyDrop", new NamedCursor("DnD.Cursor.CopyDrop"));
desktopProperties.put("DnD.Cursor.MoveDrop", new NamedCursor("DnD.Cursor.MoveDrop"));
desktopProperties.put("DnD.Cursor.LinkDrop", new NamedCursor("DnD.Cursor.LinkDrop"));
desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
}
@Override
protected boolean syncNativeQueue(long timeout) {
return nativeSyncQueue(timeout);
}
@Override
public native void beep();
@Override
public int getScreenResolution() throws HeadlessException {
return (int) ((CGraphicsDevice) GraphicsEnvironment
.getLocalGraphicsEnvironment().getDefaultScreenDevice())
.getXResolution();
}
@Override
public Insets getScreenInsets(final GraphicsConfiguration gc) {
return ((CGraphicsConfig) gc).getDevice().getScreenInsets();
}
@Override
public void sync() {
OGLRenderQueue.sync();
flushNativeSelectors();
}
@Override
public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
return new CRobot(target, (CGraphicsDevice)screen);
}
private native boolean isCapsLockOn();
@Override
public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
switch (keyCode) {
case KeyEvent.VK_NUM_LOCK:
case KeyEvent.VK_SCROLL_LOCK:
case KeyEvent.VK_KANA_LOCK:
throw new UnsupportedOperationException("Toolkit.getLockingKeyState");
case KeyEvent.VK_CAPS_LOCK:
return isCapsLockOn();
default:
throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState");
}
}
private static boolean = true;
@Override
public boolean () throws HeadlessException {
return areExtraMouseButtonsEnabled;
}
@Override
public int getNumberOfButtons(){
return BUTTONS;
}
private static native int getMultiClickTime();
@Override
public boolean isTraySupported() {
return true;
}
@Override
public DataTransferer getDataTransferer() {
return CDataTransferer.getInstanceImpl();
}
@Override
public boolean isAlwaysOnTopSupported() {
return true;
}
private static final String APPKIT_THREAD_NAME = "AppKit Thread";
private static void installToolkitThreadInJava() {
Thread.currentThread().setName(APPKIT_THREAD_NAME);
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
Thread.currentThread().setContextClassLoader(null);
return null;
});
}
@Override
public boolean isWindowOpacitySupported() {
return true;
}
@Override
public boolean isFrameStateSupported(int state) throws HeadlessException {
switch (state) {
case Frame.NORMAL:
case Frame.ICONIFIED:
case Frame.MAXIMIZED_BOTH:
return true;
default:
return false;
}
}
@Override
@Deprecated(since = "10")
public int () {
return Event.META_MASK;
}
@Override
public int () {
return InputEvent.META_DOWN_MASK;
}
@Override
public Image getImage(final String filename) {
final Image nsImage = checkForNSImage(filename);
if (nsImage != null) {
return nsImage;
}
if (imageCached(filename)) {
return super.getImage(filename);
}
String filename2x = getScaledImageName(filename);
return (imageExists(filename2x))
? getImageWithResolutionVariant(filename, filename2x)
: super.getImage(filename);
}
@Override
public Image getImage(URL url) {
if (imageCached(url)) {
return super.getImage(url);
}
URL url2x = getScaledImageURL(url);
return (imageExists(url2x))
? getImageWithResolutionVariant(url, url2x) : super.getImage(url);
}
private static final String nsImagePrefix = "NSImage://";
private Image checkForNSImage(final String imageName) {
if (imageName == null) return null;
if (!imageName.startsWith(nsImagePrefix)) return null;
return CImage.getCreator().createImageFromName(imageName.substring(nsImagePrefix.length()));
}
public static boolean doEquals(final Object a, final Object b, Component c) {
if (a == b) return true;
final boolean[] ret = new boolean[1];
try { invokeAndWait(new Runnable() { @Override
public void run() { synchronized(ret) {
ret[0] = a.equals(b);
}}}, c); } catch (Exception e) { e.printStackTrace(); }
synchronized(ret) { return ret[0]; }
}
public static <T> T invokeAndWait(final Callable<T> callable,
Component component) throws Exception {
final CallableWrapper<T> wrapper = new CallableWrapper<>(callable);
invokeAndWait(wrapper, component);
return wrapper.getResult();
}
static final class CallableWrapper<T> implements Runnable {
final Callable<T> callable;
T object;
Exception e;
CallableWrapper(final Callable<T> callable) {
this.callable = callable;
}
@Override
public void run() {
try {
object = callable.call();
} catch (final Exception e) {
this.e = e;
}
}
public T getResult() throws Exception {
if (e != null) throw e;
return object;
}
}
public static void invokeAndWait(Runnable runnable, Component component)
throws InvocationTargetException {
Objects.requireNonNull(component, "Null component provided to invokeAndWait");
long mediator = createAWTRunLoopMediator();
InvocationEvent invocationEvent =
new InvocationEvent(component,
runnable,
() -> {
if (mediator != 0) {
stopAWTRunLoop(mediator);
}
},
true);
AppContext appContext = SunToolkit.targetToAppContext(component);
SunToolkit.postEvent(appContext, invocationEvent);
SunToolkit.flushPendingEvents(appContext);
doAWTRunLoop(mediator, false);
checkException(invocationEvent);
}
public static void invokeLater(Runnable event, Component component)
throws InvocationTargetException {
Objects.requireNonNull(component, "Null component provided to invokeLater");
InvocationEvent invocationEvent = new InvocationEvent(component, event);
AppContext appContext = SunToolkit.targetToAppContext(component);
SunToolkit.postEvent(SunToolkit.targetToAppContext(component), invocationEvent);
SunToolkit.flushPendingEvents(appContext);
checkException(invocationEvent);
}
private static void checkException(InvocationEvent event) throws InvocationTargetException {
Throwable eventException = event.getException();
if (eventException == null) return;
if (eventException instanceof UndeclaredThrowableException) {
eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
}
throw new InvocationTargetException(eventException);
}
static native void performOnMainThreadAfterDelay(Runnable r, long delay);
@Override
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
@Override
@SuppressWarnings("unchecked")
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
Class<T> abstractRecognizerClass, DragSource ds, Component c,
int srcActions, DragGestureListener dgl) {
final LightweightFrame f = SunToolkit.getLightweightFrame(c);
if (f != null) {
return f.createDragGestureRecognizer(abstractRecognizerClass, ds, c, srcActions, dgl);
}
DragGestureRecognizer dgr = null;
if (MouseDragGestureRecognizer.class.equals(abstractRecognizerClass))
dgr = new CMouseDragGestureRecognizer(ds, c, srcActions, dgl);
return (T)dgr;
}
@Override
protected PlatformDropTarget createDropTarget(DropTarget dropTarget,
Component component,
LWComponentPeer<?, ?> peer) {
return new CDropTarget(dropTarget, component, peer);
}
@Override
public Locale getDefaultKeyboardLocale() {
Locale locale = CInputMethod.getNativeLocale();
if (locale == null) {
return super.getDefaultKeyboardLocale();
}
return locale;
}
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
if (sInputMethodDescriptor == null)
sInputMethodDescriptor = new CInputMethodDescriptor();
return sInputMethodDescriptor;
}
@Override
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
return CInputMethod.mapInputMethodHighlight(highlight);
}
@Override
@SuppressWarnings("deprecation")
public int getFocusAcceleratorKeyMask() {
return InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
}
@Override
@SuppressWarnings("deprecation")
public boolean isPrintableCharacterModifiersMask(int mods) {
return ((mods & (InputEvent.META_MASK | InputEvent.CTRL_MASK)) == 0);
}
@Override
public boolean () {
return false;
}
private static Boolean sunAwtDisableCALayers = null;
public static synchronized boolean getSunAwtDisableCALayers() {
if (sunAwtDisableCALayers == null) {
sunAwtDisableCALayers = AccessController.doPrivileged(
new GetBooleanAction("sun.awt.disableCALayers"));
}
return sunAwtDisableCALayers;
}
native boolean isApplicationActive();
public static native boolean isEmbedded();
public native void activateApplicationIgnoringOtherApps();
static native long createAWTRunLoopMediator();
static void doAWTRunLoop(long mediator, boolean processEvents) {
doAWTRunLoopImpl(mediator, processEvents, inAWT);
}
private static native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
static native void stopAWTRunLoop(long mediator);
private native boolean nativeSyncQueue(long timeout);
static native void flushNativeSelectors();
@Override
public Clipboard createPlatformClipboard() {
return new CClipboard("System");
}
@Override
public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
return (exclusionType == null) ||
(exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE) ||
(exclusionType == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) ||
(exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
return (modalityType == null) ||
(modalityType == Dialog.ModalityType.MODELESS) ||
(modalityType == Dialog.ModalityType.DOCUMENT_MODAL) ||
(modalityType == Dialog.ModalityType.APPLICATION_MODAL) ||
(modalityType == Dialog.ModalityType.TOOLKIT_MODAL);
}
@Override
public boolean isWindowShapingSupported() {
return true;
}
@Override
public boolean isWindowTranslucencySupported() {
return true;
}
@Override
public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
return true;
}
@Override
public boolean isSwingBackbufferTranslucencySupported() {
return true;
}
@Override
public boolean enableInputMethodsForTextComponent() {
return true;
}
private static URL getScaledImageURL(URL url) {
try {
String scaledImagePath = getScaledImageName(url.getPath());
return scaledImagePath == null ? null : new URL(url.getProtocol(),
url.getHost(), url.getPort(), scaledImagePath);
} catch (MalformedURLException e) {
return null;
}
}
private static String getScaledImageName(String path) {
if (!isValidPath(path)) {
return null;
}
int slash = path.lastIndexOf('/');
String name = (slash < 0) ? path : path.substring(slash + 1);
if (name.contains("@2x")) {
return null;
}
int dot = name.lastIndexOf('.');
String name2x = (dot < 0) ? name + "@2x"
: name.substring(0, dot) + "@2x" + name.substring(dot);
return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x;
}
private static boolean isValidPath(String path) {
return path != null &&
!path.isEmpty() &&
!path.endsWith("/") &&
!path.endsWith(".");
}
@Override
protected PlatformWindow getPlatformWindowUnderMouse() {
return CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse();
}
@Override
public void () {
if (AquaMenuBarUI.getScreenMenuBarProperty()) {
UIManager.put("MenuBarUI", "com.apple.laf.AquaMenuBarUI");
} else {
UIManager.put("MenuBarUI", null);
}
}
}