Icon for the Administration and Help menu

I want to assign some icons to the Administration and Help menu, but these are not left editable, is there any way? Or should you overwrite these options?

Hi Nelson,

There are two ways to set icons to Administrative and Help menu items:

  1. Create your own web-menu.xml config, adjust icons there and specify it without “+” in the cuba.menuConfig property (web-app.properties):

cuba.menuConfig = com/iis/izzy/web-menu.xml
  1. Or you can add icons programmatically in the controller of extended mainWindow:

public class ExtAppMainWindow extends AbstractMainWindow {
    @Inject
    private FtsField ftsField;

    @Inject
private SideMenu sideMenu;

    @Override
    public void init(Map<String, Object> params) {
        super.init(params);
        initFtsField(ftsField);
        sideMenu.getMenuItem("administration").setIcon("branding/app-icon-login.png");
        sideMenu.getMenuItem("help").setIcon("branding/app-icon-menu.png");
    }
}
1 Like

In this example, what is the path to use to get Font Awesome icons available? I would prefer not to have to redeclare the administration and help menus in the web-menu.xml file. I only want to assign a FA icon to them in the controller file of the extended Main Screen.

I’ve tried:

public class ExtMainScreen extends MainScreen {
    @Inject
    private SideMenu sideMenu;

    @Subscribe
    public void onInit(InitEvent event) {
        sideMenu.getMenuItem("administration").setIcon("font-awesome5-solid-icon:USER");
    }
}

However, this only produces this as a result:
image

Thanks in advance for any help!

Adam

Try this:

import com.haulmont.cuba.gui.icons.CubaIcon;

xxx.setIcon(CubaIcon.USER.source());

It’s mentioned in the documentation: Icon Sets - CUBA Platform. Developer’s Manual

Perfect, Alexander. Thank you for the direction!

Adam