src/main/java/org/efaps/ui/wicket/components/menu/SlideIn.java
private CharSequence getSubMenuItem(final UIMenuItem _menuItem,
                                        final String _parentNode,
                                        final String _titleNode)
    {
        final StringBuilder js = new StringBuilder();
        final String node1 = RandomUtil.randomAlphabetic(4);

        if (_menuItem.getChildren().isEmpty()) {
            js.append(" on(").append(_titleNode).append(", \"click\", function(evt) {\n")
                .append(getEventJs(_menuItem))
                .append("});\n");
        } else {
            js.append("var ").append(node1).append(" = domConstruct.create(\"div\",")
                .append("{ class: \"nested\", style: \"display:none\"}, ")
                .append(_parentNode).append(");\n")
                .append(" on(").append(_titleNode).append(", \"click\", function(evt) {\n")
                .append("if (domStyle.get(").append(node1).append(", \"display\") !== \"none\") {\n")
                .append(" domClass.replace(evt.currentTarget, \"closed\", \"open\"); \n")
                .append("fx.wipeOut({\n")
                .append("node: ").append(node1).append("\n")
                .append("}).play();\n")
                .append("} else {\n")
                .append(" domClass.replace(evt.currentTarget, \"open\", \"closed\"); \n")
                .append("fx.wipeIn({\n")
                .append("node: ").append(node1).append("\n")
                .append("}).play();\n")
                .append("}\n")
                .append("});\n");
        }
        for (final UIMenuItem childItem : _menuItem.getChildren()) {
            final String node2 = RandomUtil.randomAlphabetic(4);
            final String node3 = RandomUtil.randomAlphabetic(4);
            js.append("var ").append(node2).append(" = domConstruct.create(\"div\",")
                .append("{ class: \"menueentry\"}, ").append(node1).append(");\n")
                .append("var ").append(node3).append(" = domConstruct.create(\"div\", { class: \"title");
            if (!childItem.getChildren().isEmpty()) {
                js.append(" closed");
            }
            js.append("\"},").append(node2).append(");\n")
                .append(getImage(childItem, node3))
                .append("domConstruct.create(\"span\", { class: \"menutitle\", innerHTML: \"")
                .append(StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(childItem.getLabel())))
                .append("\"} , ").append(node3).append("); \n")
                .append(getSubMenuItem(childItem, node2, node3));
        }
        return js;
    }
private CharSequence getSubMenuItem(final UIMenuItem _menuItem,
                                        final String _parentNode,
                                        final String _titleNode)
    {
        final StringBuilder js = new StringBuilder();
        final String node1 = RandomUtil.randomAlphabetic(4);

        if (_menuItem.getChildren().isEmpty()) {
            js.append(" on(").append(_titleNode).append(", \"click\", function(evt) {\n")
                .append(getEventJs(_menuItem))
                .append("});\n");
        } else {
            js.append("var ").append(node1).append(" = domConstruct.create(\"div\",")
                .append("{ class: \"nested\", style: \"display:none\"}, ")
                .append(_parentNode).append(");\n")
                .append(" on(").append(_titleNode).append(", \"click\", function(evt) {\n")
                .append("if (domStyle.get(").append(node1).append(", \"display\") !== \"none\") {\n")
                .append(" domClass.replace(evt.currentTarget, \"closed\", \"open\"); \n")
                .append("fx.wipeOut({\n")
                .append("node: ").append(node1).append("\n")
                .append("}).play();\n")
                .append("} else {\n")
                .append(" domClass.replace(evt.currentTarget, \"open\", \"closed\"); \n")
                .append("fx.wipeIn({\n")
                .append("node: ").append(node1).append("\n")
                .append("}).play();\n")
                .append("}\n")
                .append("});\n");
        }
        for (final UIMenuItem childItem : _menuItem.getChildren()) {
            final String node2 = RandomUtil.randomAlphabetic(4);
            final String node3 = RandomUtil.randomAlphabetic(4);
            js.append("var ").append(node2).append(" = domConstruct.create(\"div\",")
                .append("{ class: \"menueentry\"}, ").append(node1).append(");\n")
                .append("var ").append(node3).append(" = domConstruct.create(\"div\", { class: \"title");
            if (!childItem.getChildren().isEmpty()) {
                js.append(" closed");
            }
            js.append("\"},").append(node2).append(");\n")
                .append(getImage(childItem, node3))
                .append("domConstruct.create(\"span\", { class: \"menutitle\", innerHTML: \"")
                .append(StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(childItem.getLabel())))
                .append("\"} , ").append(node3).append("); \n")
                .append(getSubMenuItem(childItem, node2, node3));
        }
        return js;
    }
Gets the sub menu item.

@param _menuItem the menu item
@param _parentNode the parent node
@param _titleNode the title node
@return the sub menu item