Monday Jun 16, 2008

Limiting the NetBeans Window System in NetBeans Platform 6.5

If you're building your application on top of NetBeans Platform 6.5 M1 and above (or, since M1 isn't released yet, just get the very latest development build from netbeans.org), you'll be able to limit your window system's functionality. Your application's window system comes straight from the NetBeans Platform, but you've never been able to tweak it much. That's been something several people have asked for. They want to, for example, create a fixed layout for their application's user interface. Therefore, they don't want the end user to move the windows around (and/or to undock them, slide them into the sides of the application, etc).

Until a few days ago, there were several nasty hacks you could make use of in this situation. In the most extreme case, you'd want the window system to be frozen, while in less extreme cases you'd only want some of the functionality to be unavailable to the end user. Reading Window System API guru Stan Aubrecht's blog today, you'll quickly see that this will now no longer be a problem. On suites (i.e., either the container for modules or the NetBeans Platform Application project type itself), there'll be a new tab in the Project Properties file, as follows:

By default, all the checkboxes are selected, so all the powerful features of the window system are available by default. But, depending on which checkboxes you uncheck, one or more of the features will be removed. By the way, the Help button in the screenshot above currently returns no content because it needs to be added (by me).

If ALL the checkboxes are selected, a properties file with this content is generated in the "branding" folder (which is visible when you look in the Files window, for NetBeans Platform applications):

Editor.TopComponent.Closing.Enabled=false
Splitter.Respect.MinimumSize.Enabled=false
TopComponent.DragAndDrop.Enabled=false
TopComponent.Maximization.Enabled=false
TopComponent.Resizing.Enabled=false
TopComponent.Sliding.Enabled=false
TopComponent.Undocking.Enabled=false
View.TopComponent.Closing.Enabled=false

If all of the above are set, the small X in the tab of all the windows will not be there, so that the windows can't be closed, as well as all the other features being disabled. The above file is found (i.e., it is created for you when you select one/more of the checkboxes above) in the following location:

branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/Bundle.properties

You could create that file yourself and add the content above yourself, however, using the checkboxes in the new tab is obviously easier.

For further reading, go as always to the NetBeans API Changes document and there read the item Added a group of resource bundle properties for customization of window system behavior.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« June 2008 »
SunMonTueWedThuFriSat
1
6
13
19
26
28
29
     
       
Today