final JCommandToggleMenuButton toggleButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showIconAction);
showIconAction.setSelected();
toggleButton.getActionModel().setSelected(showIconAction.isSelected());
popupmenu.addMenuButton(toggleButton);
JCommandMenuButton button = new JCommandMenuButton(TextUtils.removeTranslateComment(TextUtils.getText("note_window_location")), null);
button.setDisplayState(CommandButtonDisplayState.MEDIUM);
button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
button.setPopupCallback(new PopupPanelCallback() {
public JPopupPanel getPopupPanel(JCommandButton commandButton) {
JCommandPopupMenu popupmenu = new JCommandPopupMenu();
final SetNoteWindowPosition posTopAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.top");
final JCommandToggleMenuButton posTopButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posTopAction);
popupmenu.addMenuButton(posTopButton);
posTopAction.setSelected();
posTopButton.getActionModel().setSelected(posTopAction.isSelected());
final SetNoteWindowPosition posLeftAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.left");
final JCommandToggleMenuButton posLeftButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posLeftAction);
popupmenu.addMenuButton(posLeftButton);
posLeftAction.setSelected();
posLeftButton.getActionModel().setSelected(posLeftAction.isSelected());
final SetNoteWindowPosition posRightAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.right");
final JCommandToggleMenuButton posRightButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posRightAction);
popupmenu.addMenuButton(posRightButton);
posRightAction.setSelected();
posRightButton.getActionModel().setSelected(posRightAction.isSelected());
final SetNoteWindowPosition posBottomAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.bottom");
final JCommandToggleMenuButton posBottomButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posBottomAction);
popupmenu.addMenuButton(posBottomButton);
posBottomAction.setSelected();
posBottomButton.getActionModel().setSelected(posBottomAction.isSelected());
return popupmenu;
}
});
popupmenu.addMenuButton(button);
return popupmenu;
}
});
band.addCommandButton(displayNotesButton, RibbonElementPriority.MEDIUM);
}
private void createAttributeViewMenu(final RibbonBuildContext context, JRibbonBand band) {
JCommandButton button = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_displayAttributes")));
button.setDisplayState(CommandButtonDisplayState.MEDIUM);
button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
button.setPopupCallback(new PopupPanelCallback() {
public JPopupPanel getPopupPanel(JCommandButton commandButton) {
JCommandPopupMenu popupmenu = new JCommandPopupMenu();
final AttributeViewTypeAction showSelectedAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("ShowSelectedAttributesAction");
final JCommandToggleMenuButton showSelectedAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showSelectedAttributesAction);
popupmenu.addMenuButton(showSelectedAttributesButton);
showSelectedAttributesAction.setSelected();
showSelectedAttributesButton.getActionModel().setSelected(showSelectedAttributesAction.isSelected());
final AttributeViewTypeAction showAllAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("ShowAllAttributesAction");
final JCommandToggleMenuButton showAllAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showAllAttributesAction);
popupmenu.addMenuButton(showAllAttributesButton);
showAllAttributesAction.setSelected();
showAllAttributesButton.getActionModel().setSelected(showAllAttributesAction.isSelected());
final AttributeViewTypeAction hideAllAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("HideAllAttributesAction");
final JCommandToggleMenuButton hideAllAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(hideAllAttributesAction);
popupmenu.addMenuButton(hideAllAttributesButton);
hideAllAttributesAction.setSelected();
hideAllAttributesButton.getActionModel().setSelected(hideAllAttributesAction.isSelected());
final SetBooleanMapPropertyAction showIconAction = (SetBooleanMapPropertyAction) context.getBuilder().getMode().getAction("SetBooleanMapPropertyAction.show_icon_for_attributes");
final JCommandToggleMenuButton toggleButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showIconAction);
showIconAction.setSelected();
toggleButton.getActionModel().setSelected(showIconAction.isSelected());
popupmenu.addMenuButton(toggleButton);
context.getBuilder().getMapChangeAdapter().addListener(new IChangeObserver() {
public void updateState(CurrentState state) {
showSelectedAttributesAction.setSelected();
showSelectedAttributesButton.getActionModel().setSelected(showSelectedAttributesAction.isSelected());
showAllAttributesAction.setSelected();
showAllAttributesButton.getActionModel().setSelected(showAllAttributesAction.isSelected());
hideAllAttributesAction.setSelected();
hideAllAttributesButton.getActionModel().setSelected(hideAllAttributesAction.isSelected());
showIconAction.setSelected();
toggleButton.getActionModel().setSelected(showIconAction.isSelected());
}
});
JCommandMenuButton button = RibbonActionContributorFactory.createCommandMenuButton(context.getBuilder().getMode().getAction("ShowAttributeDialogAction"));
popupmenu.addMenuButton(button);
return popupmenu;
}
});