protected CharSequence getMenuItem(final AbstractCommand _cmd,
                                       final boolean _menuBar)
    {
        final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
        final String rid = uiGrid.getRandom4ID(_cmd.getId());
        final StringBuilder js = new StringBuilder();
        if (_menuBar) {
            js.append("new MenuBarItem({\n");
        } else {
            js.append("new MenuItem({\n");
        }
        js.append(" label: \"")
                .append(StringEscapeUtils.escapeEcmaScript(_cmd.getLabelProperty())).append("\",\n")
                .append("onClick: function(event) {\n")
                .append("var rid = \"").append(rid).append("\";\n");

        if (Target.MODAL.equals(_cmd.getTarget())) {
            if (_cmd.isSubmit()) {
                js.append(getBehavior(SubmitModalBehavior.class).getCallbackFunctionBody(
                                CallbackParameter.explicit("rid")));
            } else {
                js.append(getBehavior(OpenModalBehavior.class).getCallbackFunctionBody(
                                CallbackParameter.explicit("rid")));
            }
        } else if (_cmd.isSubmit()) {
            js.append(getBehavior(SubmitBehavior.class).getCallbackFunctionBody(CallbackParameter.explicit("rid")));
        }
        js.append("}\n").append("})\n");
        return js;
    }
protected CharSequence getMenuItem(final AbstractCommand _cmd,
                                       final boolean _menuBar)
    {
        final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
        final String rid = uiGrid.getRandom4ID(_cmd.getId());
        final StringBuilder js = new StringBuilder();
        if (_menuBar) {
            js.append("new MenuBarItem({\n");
        } else {
            js.append("new MenuItem({\n");
        }
        js.append(" label: \"")
                .append(StringEscapeUtils.escapeEcmaScript(_cmd.getLabelProperty())).append("\",\n")
                .append("onClick: function(event) {\n")
                .append("var rid = \"").append(rid).append("\";\n");

        if (Target.MODAL.equals(_cmd.getTarget())) {
            if (_cmd.isSubmit()) {
                js.append(getBehavior(SubmitModalBehavior.class).getCallbackFunctionBody(
                                CallbackParameter.explicit("rid")));
            } else {
                js.append(getBehavior(OpenModalBehavior.class).getCallbackFunctionBody(
                                CallbackParameter.explicit("rid")));
            }
        } else if (_cmd.isSubmit()) {
            js.append(getBehavior(SubmitBehavior.class).getCallbackFunctionBody(CallbackParameter.explicit("rid")));
        }
        js.append("}\n").append("})\n");
        return js;
    }
protected CharSequence getMenuItem ( final AbstractCommand _cmd , final boolean _menuBar ) { final UIGrid uiGrid = ( UIGrid ) getDefaultModelObject ( ) ; final String rid = uiGrid . getRandom4ID ( _cmd . getId ( ) ) ; final StringBuilder js = new StringBuilder ( ) ; if ( _menuBar ) { js . append ( "new MenuBarItem({\n" ) ; } else { js . append ( "new MenuItem({\n" ) ; } js . append ( " label: \"" ) . append ( StringEscapeUtils . escapeEcmaScript ( _cmd . getLabelProperty ( ) ) ) . append ( "\",\n" ) . append ( "onClick: function(event) {\n" ) . append ( "var rid = \"" ) . append ( rid ) . append ( "\";\n" ) ; if ( Target . MODAL . equals ( _cmd . getTarget ( ) ) ) { if ( _cmd . isSubmit ( ) ) { js . append ( getBehavior ( SubmitModalBehavior . class ) . getCallbackFunctionBody ( CallbackParameter . explicit ( "rid" ) ) ) ; } else { js . append ( getBehavior ( OpenModalBehavior . class ) . getCallbackFunctionBody ( CallbackParameter . explicit ( "rid" ) ) ) ; } } else if ( _cmd . isSubmit ( ) ) { js . append ( getBehavior ( SubmitBehavior . class ) . getCallbackFunctionBody ( CallbackParameter . explicit ( "rid" ) ) ) ; } js . append ( "}\n" ) . append ( "})\n" ) ; return js ; }
Gets the menu item.

@param _cmd the cmd
@param _menuBar the menu bar
@return the menu item
Gets the menu item .