Dynamic menu items in menu bar [message #1479620] |
Wed, 19 November 2014 15:37 |
Thomas Schär Messages: 4 Registered: February 2014 |
Junior Member |
|
|
Hi!
For the effect of dynamic menu items in the menubar (visible if certain TablePage is active) we have added a tree listener onto our outline which sets the visibility of the EntityCopyMenu, defined in our Desktop or DesktopExtension:
@Order(20.0)
public class ToolsMenu extends AbstractMenu {
...
@Order(10.0)
public class CustomerCopyMenu extends AbstractMenu {
...
@Override
protected void execInitAction() throws ProcessingException {
List<IOutline> availableOutlines = getAvailableOutlines();
availableOutlines.get(0).addTreeListener(new TreeListener() {
@Override
public void treeChanged(TreeEvent e) {
if (e.getType() == TreeEvent.TYPE_NODE_CLICK) {
setVisible(getOutline().getActivePage() instanceof CustomerTablePage);
setEnabled(true);
}
}
@Override
public void treeChangedBatch(List<? extends TreeEvent> batch) {
}
});
}
}
}
This used to work perfectly in Scout Kepler (3.9) , but with Scout Luna the following occurs: The treeChanged() method is called on a switch to another TablePage, so are also the setVisible() and setEnabled() methods on the CustomerCopyMenu, but the menu item is still visible, even if CustomerTablePage is not the active page. The menu item can be clicked and the event comes from SWT, but no action is executed on the scout side, because the scout menu item's visibility property is set to false.
The menu item doesn't disappear even if another element in the tree is selected. It does disappear, though, if the table of any TablePage is clicked.
Is this a bug or is there any other way of having dynamic menu items in the menu bar?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03981 seconds