Hi
Gleb has shared a very useful sidemenu with some additional functionality i.e. sidemenu drawer. With is, we have a few different menu options for the users.
However, currently, it is hard-code and not user-selectable style. That is, the developer will decide what type of menu styling the application have which will be common across all user - SideMenu, SideMenu with the toggle or traditional menu bar on the top.
How about we give all such options to the end users to choose from? Based on the user’s choice or even some time to be practical - based on screen size the same user may choose the mobile menu while using in an iPad or 14" screen computer.
The solution for this could be adding options in Help >> Settings where the user can select something below as circled in red:
Trying something like this in ExtSettingsWindow
screen but not sure where to save this setting data and how to retrieve and use it in ExtAppMainWindow
screen.
@Override
public void init(Map<String, Object> params) {
super.init(params);
Map<String, Object> map = new LinkedHashMap<>();
map.put("Side-Bar Menu", 1);
map.put("Side-overflow Menu", 2);
map.put("Top-down Menu", 3);
optionsgroupMenuType.setOptionsMap(map);
optionsgroupMenuType.setOrientation(OptionsGroup.Orientation.HORIZONTAL);
String menuOption = userSettingService.loadSetting("menuType");
if(menuOption !=null){
if (menuOption.equals(1)) {
optionsgroupMenuType.setValue(1);
}else if (menuOption.equals(2)) {
optionsgroupMenuType.setValue(2);
} else {
optionsgroupMenuType.setValue(3);
}
}
}
public void onOkBtnClick() {
userSettingService.saveSetting("menuType",optionsgroupMenuType.getValue());
close(COMMIT_ACTION_ID);
}
Would appreciate suggestions with a code snippet.
Moreover, I tried the following code to set the default sideMenu style in ExtAppMainWindow
init method but it’s not working:
if (sideMenu.getSidePanel().getStyleName().contains("c-sidemenu-responsive")) {
sideMenu.getSidePanel().removeStyleName("c-sidemenu-responsive");
sideMenu.getSidePanel().addStyleName("sidemenu-responsive");
sideMenu.getSidePanel().addStyleName("sidemenu-drawer");
}