One of the frequently asked questions while showing RAP is "how can I hide the window"? Personally, I also find the window-in-a-window metaphor (shown above) somewhat confusing and unusual for a browser based application. Fortunately it is really easy to take care of that by configuring the Shell widget associated with that window, as explained in the rest of the article.
Maximized Window with No Title
- we use the style-bit SWT.NO_TRIM before creating the Shell. This will remove the title-bar, the minimize/maximize/close buttons and the ability for manually resizing the window.
- we overwrite the WorkbenchWindowAdvisor.postWindowCreate() method. Here we set the state of the Shell to maximized.
- optional: depending on the requirements and complexity of our application it may be desirable to hide the menu bar by calling getWindowConfigurer().setShowMenuBar( false ). This is usually a good choice for small applications where the menu bar may not be needed.
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
// ...
public void preWindowOpen() {
// ...
getWindowConfigurer().setShellStyle( SWT.NO_TRIM );
getWindowConfigurer().setShowMenuBar( false );
}
public void postWindowCreate() {
Shell shell = getWindowConfigurer().getWindow().getShell();
shell.setMaximized( true );
}
}
Maximized Window with Plain Title
|
Note that is it possible to customize the font and colors in the title bar using the RAP Theming extension point (org.eclipse.rap.ui.themes). So if you don't like the blue background you can change it. Theming will be a topic in a future blog post.
2 comments:
Nice, I recommend augmenting the RAP PDE templates to include an option to "fullscreen" an application.
Hi Chris,
great idea; see Bug 209677.
Elias.
Post a Comment