code: private WSubMenu getSubMenuByText(final String text, final WComponent node) {
  
  		if (node instanceof WSubMenu) {
  			WSubMenu subMenu = (WSubMenu) node;
  			if (text.equals(subMenu.getText())) {
  				return subMenu;
  			}
  			for (MenuItem item : subMenu.getMenuItems()) {
  				WSubMenu result = getSubMenuByText(text, item);
  				if (result != null) {
  					return result;
  				}
  			}
  		} else if (node instanceof WMenu) {
  			WMenu menu = (WMenu) node;
  			for (MenuItem item : menu.getMenuItems()) {
  				WSubMenu result = getSubMenuByText(text, item);
  				if (result != null) {
  					return result;
  				}
  			}
  		}
  
  		return null;
  	}
docs: Retrieves a sub menu by its text.
  
  @param text the text to search for.
  @param node the current node in the WComponent tree.
  @return the sub menu with the given text, or null if not found.