Package org.apache.tapestry5.dom

Examples of org.apache.tapestry5.dom.Element$Attribute


        // Not an html document, don't add anything.
        if (!rootElementName.equals("html"))
            return;

        Element head = findOrCreateElement(root, "head", true);

        Element existing = findExistingElement(head, "link");

        // Create a temporary container element.
        Element container = head.element("stylesheet-link-container");

        for (int i = 0; i < count; i++)
            stylesheets.get(i).add(container);

        if (existing != null)
            container.moveBefore(existing);

        container.pop();
    }
View Full Code Here


    {
        for (Node n : container.getChildren())
        {
            if (n instanceof Element)
            {
                Element e = (Element) n;

                if (e.getName().equalsIgnoreCase(elementName))
                    return e;
            }
        }

        return null;
View Full Code Here

    @Test
    public void testNewUserSignup() {
        doc = tester.renderPage("Signup");

        Element form = doc.getElementById("form");
        assertNotNull("form exists", form);

        fieldValues.put("username", "self-registered");
        fieldValues.put("password", "Password1");
        fieldValues.put("confirmPassword", "Password1");
View Full Code Here

    @Test
    public void testExistingUserSignup() {
        doc = tester.renderPage("Signup");

        Element form = doc.getElementById("form");
        assertNotNull("form exists", form);

        fieldValues.put("username", "user");
        fieldValues.put("password", "Password1");
        fieldValues.put("confirmPassword", "Password1");
View Full Code Here

public class UserEditTest extends BasePageTestCase {

    @Test
    public void testCancel() throws Exception {
        doc = tester.renderPage("admin/UserList");
        Element table = doc.getElementById("userList");
        List<Node> rows = table.find("tbody").getChildren();
        String username = "";

        username = ((Element) rows.get(0)).find("td/a").getChildMarkup().trim();

        Element idLink = table.getElementById("user-" + username);
        doc = tester.clickLink(idLink);


        Element cancelButton = doc.getElementById("cancel");

        doc = tester.clickLink(cancelButton);

        // force locale=en (APF-1324)
        ResourceBundle rb = ResourceBundle.getBundle(MESSAGES, new Locale("en"));
View Full Code Here

    @Test
    public void testSave() throws Exception {

        doc = tester.renderPage("admin/UserList");
        Element addLink = doc.getElementById("add");

        doc = tester.clickLink(addLink);

        Element form = doc.getElementById("form");
        assertNotNull(form);

        fieldValues.put("username", "tapestry");
        fieldValues.put("password", "isfun");
        fieldValues.put("confirmPassword", "isfun");
        fieldValues.put("passwordHint", "funstuff");
        fieldValues.put("firstName", "Tapestry");
        fieldValues.put("lastName", "5");
        fieldValues.put("email", "tapestry@appfuse.org");
        fieldValues.put("website", "http://tapestry.apache.org");
        fieldValues.put("city", "Portland");
        fieldValues.put("state", "OR");
        fieldValues.put("postalCode", "97303");
        fieldValues.put("country", "US");

        // start SMTP Server
        Wiser wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();

        doc = tester.submitForm(form, fieldValues);

        Element errors = doc.getElementById("errorMessages");

        if (errors != null) {
            log.error(errors);
        }

        assertNull(doc.getElementById("errorMessages"));

        // verify an account information e-mail was sent
        assertEquals(1, wiser.getMessages().size());
        wiser.stop();

        //Element successMessages = doc.getElementById("successMessages");
        //assertNotNull(successMessages);
        //assertTrue(successMessages.toString().contains("added successfully"));
        assertTrue(doc.toString().contains("added successfully"));
        Element table = doc.getElementById("userList");
        assertTrue(table.toString().contains("tapestry"));
    }
View Full Code Here

    }

    @Test
    public void testRemove() throws Exception {
        doc = tester.renderPage("admin/UserList");
        Element table = doc.getElementById("userList");
        List<Node> rows = table.find("tbody").getChildren();
        String username = "";

        username = ((Element) rows.get(1)).find("td/a").getChildMarkup().trim();

        Element idLink = table.getElementById("user-" + username);
        doc = tester.clickLink(idLink);

        Element deleteButton = doc.getElementById("delete");

        doc = tester.clickLink(deleteButton);
        assertTrue(doc.toString().contains("deleted successfully"));
    }
View Full Code Here

        UserManager userManager = (UserManager) applicationContext.getBean("userManager");
        userManager.reindex();

        doc = tester.renderPage("admin/userList");

        Element form = doc.getElementById("searchForm");
        assertNotNull(form);

        fieldValues.put("q", "admin");
        doc = tester.submitForm(form, fieldValues);
        assertTrue(doc.getElementById("userList").find("tbody").getChildren().size() == 1);
View Full Code Here

    @Test
    public void element_nesting()
    {
        MarkupWriter w = new MarkupWriterImpl();

        Element root = w.element("root");

        w.attributes("foo", "bar");

        w.write("before child");

        assertNotSame(w.element("nested"), root);

        w.write("inner text");

        assertSame(w.end(), root);

        w.write("after child");

        root.attribute("gnip", "gnop");

        assertEquals(w.toString(),
                     "<root foo=\"bar\" gnip=\"gnop\">before child<nested>inner text</nested>after child</root>");
    }
View Full Code Here

    @Test
    public void namespaced_elements_and_attributes()
    {
        MarkupWriter w = new MarkupWriterImpl(new XMLMarkupModel());

        Element root = w.elementNS("fredns", "root");

        assertSame(root.defineNamespace("fredns", "fred"), root);

        root.defineNamespace("barneyns", "barney");

        assertSame(w.attributeNS("fredns", "foo", "bar"), root);

        Element child = w.elementNS("barneyns", "child");

        assertSame(child.getParent(), root);

        w.end(); // child
        w.end(); // root

        assertEquals(w.toString(),
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.dom.Element$Attribute

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.