How to make the Menu bar not disappear after Menu item is Clicked

Hello Everyone,

I am stuck in one problem and I have been researching for long time.But all my searching went in vain. Any help is much apperciated!

Problem:
The menu bar disappears after clicking a menu Item. If the menuItem is declared in this way:

private Command chartElement;
chartElement = new Command()
{
private static final long serialVersionUID = 4483012525105015694L;

      public void menuSelected(MenuItem selectedItem) 
       {
 
            if (selectedItem.getText().equalsIgnoreCase("PRIMARY HORIZONTAL")) 
            {
               //do Something

            } 
        }

};

MenuItem horaxisMenu = elementMenu.addItem(“PRIMARY HORIZONTAL”,
new ThemeResource(“icons/analytics/axis_vertical.png”), chartElement);

The menu bar disappears when “PRIMARY HORIZONTAL” is clicked. But I want the menubar to stay even after clicking menu item. How can I achieve that?

Thank you.

I’m not using Menu Bar, but if i need to implement other behaviour of component i always override client side code or override the whole client class and implement my own logic.

So if you don’t find way how to fix it on server side you can contact me or look for overriding client side
(example: https://vaadin.com/forum#!/thread/3672427)