Search in sources :

Example 6 with MenuItem

use of com.haulmont.cuba.gui.config.MenuItem in project cuba by cuba-platform.

the class SettingsWindow method initDefaultScreenField.

protected void initDefaultScreenField() {
    boolean screenSelectionEnabled = webConfig.getUserCanChooseDefaultScreen();
    if (!screenSelectionEnabled) {
        defaultScreenField.setEditable(false);
        defaultScreenField.setDescription(getMessage("defaultScreenSelectionDisabled"));
    }
    Map<String, String> map = new LinkedHashMap<>();
    for (MenuItem item : collectPermittedScreens(menuConfig.getRootItems())) {
        map.put(menuConfig.getItemCaption(item.getId()), item.getScreen());
    }
    defaultScreenField.setOptionsMap(map);
    String defaultScreen = userSettingService.loadSetting(ClientType.WEB, "userDefaultScreen");
    if (StringUtils.isEmpty(defaultScreen) || !screenSelectionEnabled) {
        defaultScreen = webConfig.getDefaultScreenId();
    }
    defaultScreenField.setValue(defaultScreen);
}
Also used : MenuItem(com.haulmont.cuba.gui.config.MenuItem)

Aggregations

MenuItem (com.haulmont.cuba.gui.config.MenuItem)6 Window (com.haulmont.cuba.gui.components.Window)2 AppMenu (com.haulmont.cuba.gui.components.mainwindow.AppMenu)1 SideMenu (com.haulmont.cuba.gui.components.mainwindow.SideMenu)1 ArrayList (java.util.ArrayList)1