src/main/java/org/efaps/ui/wicket/components/gridx/GridXComponent.java
protected CharSequence getSubMenu(final AbstractMenu _menu,
                                      final String _parent)
        throws EFapsException
    {
        final String var = RandomUtil.randomAlphabetic(4);
        final StringBuilder js = new StringBuilder();
        js.append("var ").append(var).append(" = new DropDownMenu({});\n");
        final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
        for (final AbstractCommand child : _menu.getCommands()) {
            if (child.hasAccess(uiGrid.getCommand().getTargetMode(), uiGrid.getInstance())) {
                if (child instanceof AbstractMenu) {
                    js.append(getSubMenu((AbstractMenu) child, var));
                } else {
                    js.append(var).append(".addChild(")
                        .append(getMenuItem(child, false))
                        .append(");\n");
                }
            }
        }
        js.append(_parent).append(".addChild(new PopupMenuBarItem({\n")
            .append("label: \"").append(StringEscapeUtils.escapeEcmaScript(_menu.getLabelProperty())).append("\",\n")
            .append(" popup: ").append(var).append("\n")
            .append(" }));\n");
        return js;
    }
protected CharSequence getSubMenu(final AbstractMenu _menu,
                                      final String _parent)
        throws EFapsException
    {
        final String var = RandomUtil.randomAlphabetic(4);
        final StringBuilder js = new StringBuilder();
        js.append("var ").append(var).append(" = new DropDownMenu({});\n");
        final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
        for (final AbstractCommand child : _menu.getCommands()) {
            if (child.hasAccess(uiGrid.getCommand().getTargetMode(), uiGrid.getInstance())) {
                if (child instanceof AbstractMenu) {
                    js.append(getSubMenu((AbstractMenu) child, var));
                } else {
                    js.append(var).append(".addChild(")
                        .append(getMenuItem(child, false))
                        .append(");\n");
                }
            }
        }
        js.append(_parent).append(".addChild(new PopupMenuBarItem({\n")
            .append("label: \"").append(StringEscapeUtils.escapeEcmaScript(_menu.getLabelProperty())).append("\",\n")
            .append(" popup: ").append(var).append("\n")
            .append(" }));\n");
        return js;
    }
protected CharSequence getSubMenu ( final AbstractMenu _menu , final String _parent ) throws EFapsException { final String var = RandomUtil . randomAlphabetic ( 4 ) ; final StringBuilder js = new StringBuilder ( ) ; js . append ( "var " ) . append ( var ) . append ( " = new DropDownMenu({});\n" ) ; final UIGrid uiGrid = ( UIGrid ) getDefaultModelObject ( ) ; for ( final AbstractCommand child : _menu . getCommands ( ) ) { if ( child . hasAccess ( uiGrid . getCommand ( ) . getTargetMode ( ) , uiGrid . getInstance ( ) ) ) { if ( child instanceof AbstractMenu ) { js . append ( getSubMenu ( ( AbstractMenu ) child , var ) ) ; } else { js . append ( var ) . append ( ".addChild(" ) . append ( getMenuItem ( child , false ) ) . append ( ");\n" ) ; } } } js . append ( _parent ) . append ( ".addChild(new PopupMenuBarItem({\n" ) . append ( "label: \"" ) . append ( StringEscapeUtils . escapeEcmaScript ( _menu . getLabelProperty ( ) ) ) . append ( "\",\n" ) . append ( " popup: " ) . append ( var ) . append ( "\n" ) . append ( " }));\n" ) ; return js ; }
Gets the sub menu.

@param _menu the menu
@param _parent the parent
@return the sub menu
@throws EFapsException on error
Gets the sub menu .