code: @Override
  	protected void afterPaint(final RenderContext renderContext) {
  		super.afterPaint(renderContext);
  		// Close all menu items (except for tree). Menus are opened on each AJAX request as needed.
  		if (getType() != MenuType.TREE) {
  			for (MenuItem item : getMenuItems(true)) {
  				if (item instanceof WSubMenu) {
  					((WSubMenu) item).setOpen(false);
  				}
  			}
  		}
  	}
docs: {@inheritDoc}