Dynamic menuitems in partmenu does not show up [message #998686] |
Thu, 10 January 2013 14:02 |
Alexander Lampret Messages: 1 Registered: January 2013 |
Junior Member |
|
|
Hello everyone!
I try to add DirectMenuItems with radio type to a menu inside a part. The label and number of items are determined from a hashmap. The number and names of keys are represented by the menuitems. But the menuitems only show up at first try.
After the second "calculation" of menuitems, only the radio buttons are shown. The number of items is wrong too.
MInputPart input = (MInputPart) modelService.find(ImageEditor.EDITOR_TEMPLATE_ID, application);
MMenu menu = (MMenu) modelService.find(MENU_ID, input.getMenus().get(0));
menu.getChildren().clear();
ImagePlaneData data = getScan().getParallelData();
MDirectMenuItem newElement;
if (data.scanImageList.keySet().size() > 1) {
for (String key : data.scanImageList.keySet()) {
newElement = MMenuFactory.INSTANCE.createDirectMenuItem();
newElement.setLabel(key);
newElement.setTooltip(key);
newElement.setType(ItemType.RADIO);
if (key.equals(getScan().getCurrentGroup())) {
newElement.setSelected(true);
} else {
newElement.setSelected(false);
}
newElement.setContributionURI(CONTRIB_URI);
newElement.setVisible(true);
menu.getChildren().add(newElement);
}
}
Both, input and menu, are found.
Then all children (directmenuitems) should be cleared. If this is the second or higher run, the children are cleared if i take a look at menu in debug mode, but the menu and radio buttons are shown.
if more keys are available, at first run the labels and radios are shown and then only the radio buttons.
is there a function to "redraw" the menu or something like that?
Greetings,
Alex
[Updated on: Mon, 14 January 2013 10:30] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02781 seconds