Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
applications:replace_menu [2018/02/07 07:12] admin |
applications:replace_menu [2020/07/03 12:44] cduncan Edited for English grammar (capitalization, punctuation, correct verb conjugation) |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTRANS~~ | ~~NOTRANS~~ | ||
- | ~~Title: Replace standard application menu~~ | + | ~~Title: Replace Standard Application Menu~~ |
- | The standard menu creates and configures the menu and toolbar automatically. It adds default menus like //File//, //Edit//, //Help// and default menu items like //Login/Logout//, //Exit//, //About//. All application work-screens will be added by the application to the menu. Every work-screen has its own menu item and/or toolbar button. | + | The standard menu creates and configures the menu and toolbar automatically. It adds default menus like //File//, //Edit//, //Help// and default menu items like //Login/Logout//, //Exit//, //About//. All application workscreens will be added by the application to the menu. Every workscreen has its own menu item and/or toolbar button. |
- | The menu forwards most actions to the application because the application is responsible for the security and work-screen management. | + | The menu forwards most actions to the application because the application is responsible for the security and workscreen management. |
If you don't like the standard menu handling or layout, it's very easy to replace the standard menu with your own implementation. | If you don't like the standard menu handling or layout, it's very easy to replace the standard menu with your own implementation. | ||
Line 10: | Line 10: | ||
==== Extending the Menu ==== | ==== Extending the Menu ==== | ||
- | The Menu class defines default methods which are used by the application. So it's important to extend the class. The class has a constructor with the application as parameter. The constructor delegates the configuration to the method | + | The menu class defines default methods that are used by the application, so it's important to extend the class. The class has a constructor with the application as parameter. The constructor delegates the configuration to the method. |
<file java> | <file java> | ||
Line 16: | Line 16: | ||
</file> | </file> | ||
- | Override this method if your application should get a custom style. The default implementation sets an UIBorderLayout for the Application Pane and adds the Content Pane to the Application Pane with CENTER constraint. | + | Override this method if your application should get a custom style. The default implementation sets an UIBorderLayout for the application pane and adds the content pane to the application pane with CENTER constraint. |
- | It's possible to add the Content Pane to your hierarchy (e.g. a Tabset) and use a different layout for the Application Pane. Ther aren't any limits. | + | It's possible to add the content pane to your hierarchy (e.g., a tabset) and use a different layout for the application pane. There aren't any limits. |
- | The Menu class will be created by ProjX via | + | The menu class will be created by ProjX via |
<file java> | <file java> | ||
Line 26: | Line 26: | ||
</file> | </file> | ||
- | This method checks the Menu class parameter (see [[applications:customize_application|Customize an Application]]) and creates a default Menu instance if no user-defined class was set. | + | This method checks the menu class parameter (see [[applications:customize_application|Customize an Application]]) and creates a default menu instance if no user-defined class was set. |
- | ==== Useful methods ==== | + | ==== Useful Methods ==== |
The menu has some relevant methods: | The menu has some relevant methods: | ||
Line 38: | Line 38: | ||
</file> | </file> | ||
- | The createStandardMenu method will be called by the application after Menu creation. It re-creates the whole menu and adds only standard items. It doesn't add any work-screens. The standard menu contains File, Edit and About menus and toolbar buttons. The standard toolbar contains Exit, Login/Logout and Save, Reload (if connected). | + | The createStandardMenu method will be called by the application after menu creation. It recreates the whole menu and adds only standard items. It doesn't add any workscreens. The standard menu contains File, Edit and About menus and toolbar buttons. The standard toolbar contains Exit, Login/Logout and Save, Reload (if connected). |
The method delegates the creation of the menubar to the method: | The method delegates the creation of the menubar to the method: | ||
Line 54: | Line 54: | ||
Simply override createStandardToolBar and don't call the parent method to hide the toolbar. | Simply override createStandardToolBar and don't call the parent method to hide the toolbar. | ||
\\ | \\ | ||
- | The work-screen items will be added by the application, after successful login. The method: | + | The workscreen items will be added by the application after successful login. The method: |
<file java> | <file java> | ||
Line 60: | Line 60: | ||
</file> | </file> | ||
- | will be called for every work-screen. It delegates item creation to | + | will be called for every workscreen. It delegates item creation to |
<file java> | <file java> | ||
Line 72: | Line 72: | ||
</file> | </file> | ||
\\ | \\ | ||
- | But there are more useful methods for you. All methods that start with **create**, are helper methods e.g. | + | But there are more useful methods for you. All methods that start with **create**, are helper methods, e.g., |
<file java> | <file java> | ||
Line 89: | Line 89: | ||
Sometimes it's enough to override the configure methods instead of create methods because every create method calls a configure method. | Sometimes it's enough to override the configure methods instead of create methods because every create method calls a configure method. | ||
- | ==== Access with ID ==== | + | ==== Access With ID ==== |
- | Every item should have an id because the item access is managed with ids. There are a lot of default ids, e.g. //Menu.FILE//, //Menu.FILE_LOGIN//. | + | Every item should have an ID because the item access is managed with IDs. There are a lot of default IDs, e.g., //Menu.FILE//, //Menu.FILE_LOGIN//. |
If you need access to an item, simply use | If you need access to an item, simply use | ||
Line 99: | Line 99: | ||
</file> | </file> | ||
- | The method returns all mapped items for the given id. Sometimes an ID mapps multiple items because one item is the menu item and another one is the toolbar button. | + | The method returns all mapped items for the given ID. Sometimes an ID maps multiple items because one item is the menu item and another one is the toolbar button. |
If you add custom items to the menu, simply map them with | If you add custom items to the menu, simply map them with | ||
Line 107: | Line 107: | ||
</file> | </file> | ||
\\ | \\ | ||
- | The Menu class has methods for item control: | + | The menu class has methods for item control: |
<file java> | <file java> |