[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    API REVIEW request for RT-19857 Keeping menu in the Mac menu bar when there is no more stage
From:       richard.bair () oracle ! com (Richard Bair)
Date:       2012-04-30 20:02:39
Message-ID: 92E20C44-873E-466F-8295-C6944D9E7392 () oracle ! com
[Download RAW message or body]

I'm generally not a fan of static methods with static state. I assume this is to avoid putting the API in the natural place (on Stage) due to modularity? How are "shared" menu items handled? (where a single menu item like "cut" might be on every stage?). Why are we deprecating the useSystemMenuBar?

Thanks
Richard

On Apr 27, 2012, at 2:56 PM, Leif Samuelsson wrote:

> http://javafx-jira.kenai.com/browse/RT-19857
> 
> Two new static methods in javafx.scene.control.MenuBar:
> 
> /**
> * Use the system menu bar if the current platform supports it.
> *
> * Associates menuBar with stage, so that the menus are shown in the
> * system menu bar when the stage is focused.
> *
> * If stage is null, then menuBar will be used as the default for when there is
> * no stage focused, or when the currently focused Stage has no associated MenuBar
> * and is not owned by a Stage that has an associated MenuBar.
> *
> * If menuBar is null, then stage (or default if stage is also null) will
> * no longer be explicitly associated with a MenuBar.
> */
> public static void setSystemMenuBar(Stage stage, MenuBar menuBar);
> 
> /**
> * Returns the MenuBar associated with stage, the default MenuBar if stage is
> * null, or null if no MenuBar has been associated with stage.
> */
> public static MenuBar getSystemMenuBar(Stage stage);
> 
> 
> Notes:
> 
> These methods supersede the property useSystemMenuBar, which may be deprecated
> at some point from the public API.
> 
> The main difference is that the property useSystemMenuBar requires that the
> MenuBar is added to a scene graph in order for it to be associated with a Stage,
> but the new method setSystemMenuBar() does not require this. The new method also
> allows a MenuBar instance to be shared between multiple Stage instances as long
> as it is not also added to a Scene.
> 
> The initial implementation will link setSystemMenuBar() to affect the property
> and vice versa, so it is advised to only use one or the other in application
> code.
> 
> A MenuBar that is not added to a Scene will not get property values from CSS.
> This means that menus and items can not have icon images defined in a stylesheet
> or with setStyle().
> 
> Thanks,
> Leif
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic