Package org.springframework.roo.support.util

Examples of org.springframework.roo.support.util.XmlElementBuilder


                "mvc:view-controller", webConfig);
        Validate.notNull(viewController,
                "Could not find mvc:view-controller in %s", webConfig);
        viewController.getParentNode()
                .insertBefore(
                        new XmlElementBuilder("mvc:view-controller",
                                webConfigDocument).addAttribute("path",
                                "/login").build(), viewController);
        fileManager.createOrUpdateTextFileIfRequired(webConfigPath,
                XmlUtils.nodeToString(webConfigDocument), false);
    }
View Full Code Here


        if (url.contains("youtube")) {
            mediaPlayer = MediaPlayer.FLASH;
        }

        final Element paraElement = new XmlElementBuilder("p", document)
                .build();
        Element mediaElement;
        if (mediaPlayer == null) {
            mediaElement = new XmlElementBuilder("p:media", document)
                    .addAttribute("value", url).build();
        }
        else {
            mediaElement = new XmlElementBuilder("p:media", document)
                    .addAttribute("value", url)
                    .addAttribute("player",
                            StringUtils.lowerCase(mediaPlayer.name())).build();
        }
        paraElement.appendChild(mediaElement);
View Full Code Here

                        boolean anyVars = false;
                        for (final String optionKey : optionKeys) {
                            anyVars = true;
                            final String help = optionDetails.get(optionKey);
                            variableListElement
                                    .appendChild(new XmlElementBuilder(
                                            "varlistentry", document)
                                            .addChild(
                                                    new XmlElementBuilder(
                                                            "term", document)
                                                            .setText(optionKey)
                                                            .build())
                                            .addChild(
                                                    new XmlElementBuilder(
                                                            "listitem",
                                                            document)
                                                            .addChild(
                                                                    new XmlElementBuilder(
                                                                            "para",
                                                                            document)
                                                                            .setText(
                                                                                    help)
                                                                            .build())
                                                            .build()).build());
                        }

                        if (!anyVars) {
                            variableListElement = new XmlElementBuilder("para",
                                    document)
                                    .setText(
                                            "This command does not accept any options.")
                                    .build();
                        }

                        // Now we've figured out the options, store this
                        // individual command
                        final CDATASection progList = document
                                .createCDATASection(cmdSyntax.toString());
                        final String safeName = cmd.value()[0]
                                .replace("\\", "BCK").replace("/", "FWD")
                                .replace("*", "ASX");
                        final Element element = new XmlElementBuilder(
                                "section", document)
                                .addAttribute(
                                        "xml:id",
                                        "command-index-"
                                                + safeName.toLowerCase()
                                                        .replace(' ', '-'))
                                .addChild(
                                        new XmlElementBuilder("title", document)
                                                .setText(cmd.value()[0])
                                                .build())
                                .addChild(
                                        new XmlElementBuilder("para", document)
                                                .setText(cmd.help()).build())
                                .addChild(
                                        new XmlElementBuilder("programlisting",
                                                document).addChild(progList)
                                                .build())
                                .addChild(variableListElement).build();

                        individualCommands.put(cmdSyntax.toString(), element);
                    }
                }

                final Element topSection = document.createElement("section");
                topSection.setAttribute("xml:id", "command-index-"
                        + section.toLowerCase().replace(' ', '-'));
                topSection.appendChild(new XmlElementBuilder("title", document)
                        .setText(section).build());
                topSection.appendChild(new XmlElementBuilder("para", document)
                        .setText(
                                section + " are contained in "
                                        + target.getClass().getName() + ".")
                        .build());

                for (final Element value : individualCommands.values()) {
                    topSection.appendChild(value);
                }

                builtSections.add(topSection);
            }

            final Element appendix = document.createElement("appendix");
            appendix.setAttribute("xmlns", "http://docbook.org/ns/docbook");
            appendix.setAttribute("version", "5.0");
            appendix.setAttribute("xml:id", "command-index");
            appendix.appendChild(new XmlElementBuilder("title", document)
                    .setText("Command Index").build());
            appendix.appendChild(new XmlElementBuilder("para", document)
                    .setText(
                            "This appendix was automatically built from Roo "
                                    + AbstractShell.versionInfo() + ".")
                    .build());
            appendix.appendChild(new XmlElementBuilder("para", document)
                    .setText(
                            "Commands are listed in alphabetic order, and are shown in monospaced font with any mandatory options you must specify when using the command. Most commands accept a large number of options, and all of the possible options for each command are presented in this appendix.")
                    .build());

            for (final Element section : builtSections) {
View Full Code Here

     * @param tagName the name of the element to create (required)
     * @return a non-<code>null</code> element
     * @since 1.2.0
     */
    public Element getElement(final Document document, final String tagName) {
        final Element repositoryElement = new XmlElementBuilder(tagName,
                document)
                .addChild(
                        new XmlElementBuilder("id", document).setText(id)
                                .build())
                .addChild(
                        new XmlElementBuilder("url", document).setText(url)
                                .build()).build();
        if (name != null) {
            repositoryElement.appendChild(new XmlElementBuilder("name",
                    document).setText(name).build());
        }
        if (enableSnapshots) {
            repositoryElement.appendChild(new XmlElementBuilder("snapshots",
                    document).addChild(
                    new XmlElementBuilder("enabled", document).setText("true")
                            .build()).build());
        }
        return repositoryElement;
    }
View Full Code Here

        final String gaeProjectnatureName = "com.google.appengine.eclipse.core.gaeNature";
        Element gaeProjectnatureElement = XmlUtils.findFirstElement(
                "projectnature[text() = '" + gaeProjectnatureName + "']",
                additionalProjectnaturesElement);
        if (addGaeSettingsToPlugin && gaeProjectnatureElement == null) {
            gaeProjectnatureElement = new XmlElementBuilder("projectnature",
                    document).setText(gaeProjectnatureName).build();
            additionalProjectnaturesElement
                    .appendChild(gaeProjectnatureElement);
            changes.add("added GAE projectnature to maven-eclipse-plugin");
        }
View Full Code Here

        String descriptionOfChange = "";
        Element mappingExcludesElement = XmlUtils.findFirstElement(
                "mappingExcludes", configurationElement);
        if (addToPlugin && mappingExcludesElement == null) {
            mappingExcludesElement = new XmlElementBuilder("mappingExcludes",
                    document)
                    .setText(
                            "**/CustomRequestFactoryServlet.class, **/GaeAuthFilter.class")
                    .build();
            configurationElement.appendChild(mappingExcludesElement);
View Full Code Here

        if (osgiImports != null && osgiImports.length() > 0) {
            final Element config = XmlUtils
                    .findRequiredElement(
                            "/project/build/plugins/plugin[artifactId = 'maven-bundle-plugin']/configuration/instructions",
                            root);
            config.appendChild(new XmlElementBuilder("Import-Package", pom)
                    .setText(osgiImports).build());
        }
        if (description != null && description.length() > 0) {
            final Element descriptionE = XmlUtils.findRequiredElement(
                    "/project/description", root);
View Full Code Here

                Path.SRC_MAIN_WEBAPP, "WEB-INF/views/embed/" + viewName
                        + ".jspx");
        final Document document = contentElement.getOwnerDocument();
        if (!fileManager.exists(jspx)) {
            // Add document namespaces
            final Element div = new XmlElementBuilder("div", document)
                    .addAttribute("xmlns:util",
                            "urn:jsptagdir:/WEB-INF/tags/util")
                    .addAttribute("xmlns:embed",
                            "urn:jsptagdir:/WEB-INF/tags/embed")
                    .addAttribute("xmlns:jsp", "http://java.sun.com/JSP/Page")
                    .addAttribute("version", "2.0")
                    .addChild(
                            new XmlElementBuilder("jsp:output", document)
                                    .addAttribute("omit-xml-declaration", "yes")
                                    .build()).build();
            document.appendChild(div);

            div.appendChild(new XmlElementBuilder("util:panel", document)
                    .addAttribute("id", "title").addAttribute("title", title)
                    .addChild(contentElement).build());

            jspOperations
                    .installView("/embed", viewName, title, "Embedded",
View Full Code Here

        final String id = options.get("id");
        if (StringUtils.isBlank(id)) {
            return false;
        }
        installTagx("video");
        final Element video = new XmlElementBuilder("embed:video", XmlUtils
                .getDocumentBuilder().newDocument())
                .addAttribute("id", "video_" + id).addAttribute("videoId", id)
                .addAttribute("provider", provider.toLowerCase()).build();
        video.setAttribute("z", XmlRoundTripUtils.calculateUniqueKeyFor(video));
        installJspx(getViewName(viewName, provider.toLowerCase()), null, video);
View Full Code Here

            return false;
        }
        final String userId = options.get("userId");
        final String albumId = options.get("albumId");
        installTagx("photos");
        final Element photos = new XmlElementBuilder("embed:photos", XmlUtils
                .getDocumentBuilder().newDocument())
                .addAttribute("id", "photos_" + userId + "_" + albumId)
                .addAttribute("albumId", albumId)
                .addAttribute("userId", userId)
                .addAttribute("provider", provider.toLowerCase()).build();
View Full Code Here

TOP

Related Classes of org.springframework.roo.support.util.XmlElementBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.