Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Scout/Concepts/Menu"
m (+class name) |
(→Table menus: Access the column context in a menu) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{ScoutPage|cat= | + | {{ScoutPage|cat=Component Model}} |
The menu component include all links, functionalities, etc... available within the application. | The menu component include all links, functionalities, etc... available within the application. | ||
Line 8: | Line 8: | ||
== Description == | == Description == | ||
{{note|TODO|Add a description}} | {{note|TODO|Add a description}} | ||
+ | |||
+ | [[Image:HG_Menu.png]] | ||
== Screenshot == | == Screenshot == | ||
− | + | [[Image:Scout ContextMenu SWT.png]] | |
− | + | A context menu rendered in SWT. | |
== Properties == | == Properties == | ||
Line 25: | Line 27: | ||
{{note|TODO|Add a description of important events. The idea is not to recreate the JavaDoc of the execXxxxxx() methods but to provide explanations, best practice, example... Group the events by domain.}} | {{note|TODO|Add a description of important events. The idea is not to recreate the JavaDoc of the execXxxxxx() methods but to provide explanations, best practice, example... Group the events by domain.}} | ||
+ | == Advanced topics == | ||
+ | |||
+ | === Table menus: Access the column context in a menu === | ||
+ | In some cases a menu should change its behavior depending on the table column where the menu gets requested. | ||
+ | |||
+ | Do the following steps to get there: | ||
+ | # <code>AbstractMenu.execInitAciton</code>: add a property listener to the <code>CONTEXT_COLUMN</code> property of the table. | ||
+ | # set the context column relative properties in the <code>propertyChange</code> method. | ||
+ | |||
+ | '''Example''' | ||
+ | |||
+ | <source lang="java"> | ||
+ | @Order(30.0) | ||
+ | public class ColumnContextSenitiveMenu extends AbstractExtensibleMenu { | ||
+ | |||
+ | @Override | ||
+ | protected void execInitAction() throws ProcessingException { | ||
+ | // add a property listener to the tables property CONTEXT_COLUMN. | ||
+ | getTable().addPropertyChangeListener(ITable.PROP_CONTEXT_COLUMN, new PropertyChangeListener() { | ||
+ | |||
+ | @Override | ||
+ | public void propertyChange(PropertyChangeEvent evt) { | ||
+ | // set here the column relative properties | ||
+ | // e.g. disable menu if the context menu is not opened over the tables name column | ||
+ | setEnabled(CompareUtility.equals(getTable().getNameColumn(), evt.getNewValue())); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredText() { | ||
+ | return TEXTS.get("ContextSenitive"); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
== See Also == | == See Also == | ||
* {{ScoutLink|Concepts|Client Plug-In|Client Plug-In}} | * {{ScoutLink|Concepts|Client Plug-In|Client Plug-In}} |
Revision as of 11:30, 4 September 2014
The Scout documentation has been moved to https://eclipsescout.github.io/.
The menu component include all links, functionalities, etc... available within the application.
- implements: The Scout documentation has been moved to https://eclipsescout.github.io/.
- extends: The Scout documentation has been moved to https://eclipsescout.github.io/.
Contents
Description
Screenshot
A context menu rendered in SWT.
Properties
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
Events
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
Advanced topics
In some cases a menu should change its behavior depending on the table column where the menu gets requested.
Do the following steps to get there:
-
AbstractMenu.execInitAciton
: add a property listener to theCONTEXT_COLUMN
property of the table. - set the context column relative properties in the
propertyChange
method.
Example
@Order(30.0) public class ColumnContextSenitiveMenu extends AbstractExtensibleMenu { @Override protected void execInitAction() throws ProcessingException { // add a property listener to the tables property CONTEXT_COLUMN. getTable().addPropertyChangeListener(ITable.PROP_CONTEXT_COLUMN, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { // set here the column relative properties // e.g. disable menu if the context menu is not opened over the tables name column setEnabled(CompareUtility.equals(getTable().getNameColumn(), evt.getNewValue())); } }); } @Override protected String getConfiguredText() { return TEXTS.get("ContextSenitive"); } }
See Also
- The Scout documentation has been moved to https://eclipsescout.github.io/.