public void removeChild(final UIMenuItem _menuItem,
                            final AjaxRequestTarget _target)
    {
        final UIMenuItem selectedItem = (UIMenuItem) getSelected().getDefaultModelObject();

        final UIMenuItem ancestor = _menuItem.getAncestor();
        boolean nested = false;
        if (selectedItem.isChild(_menuItem) || selectedItem.equals(_menuItem)) {
            nested = true;
        }
        ancestor.getChildren().remove(_menuItem);
        if (nested) {
            expand(ancestor);
            ancestor.setSelected(true);
            visitChildren(MenuItem.class, (_comp,
             _visit) -> {
                if (_comp.getDefaultModelObject().equals(ancestor)) {
                    setSelected(_comp);
                    _visit.stop();
                }
            });
        } else {
            expand(ancestor);
        }
    }
public void removeChild ( final UIMenuItem _menuItem , final AjaxRequestTarget _target ) { final UIMenuItem selectedItem = ( UIMenuItem ) getSelected ( ) . getDefaultModelObject ( ) ; final UIMenuItem ancestor = _menuItem . getAncestor ( ) ; boolean nested = false ; if ( selectedItem . isChild ( _menuItem ) || selectedItem . equals ( _menuItem ) ) { nested = true ; } ancestor . getChildren ( ) . remove ( _menuItem ) ; if ( nested ) { expand ( ancestor ) ; ancestor . setSelected ( true ) ; visitChildren ( MenuItem . class , ( _comp , _visit ) -> { if ( _comp . getDefaultModelObject ( ) . equals ( ancestor ) ) { setSelected ( _comp ) ; _visit . stop ( ) ; } } ) ; } else { expand ( ancestor ) ; } }
@param _menuItem child to be removed
@param _target Ajaxtarget