Package com.ponysdk.ui.server.basic

Examples of com.ponysdk.ui.server.basic.PDisclosurePanel


    protected void onFirstShowPage() {
        super.onFirstShowPage();

        PVerticalPanel panel = new PVerticalPanel();

        final PDisclosurePanel disclosurePanel = new PDisclosurePanel("View details");
        disclosurePanel.setContent(getDisclosurePanelContent());
        disclosurePanel.setWidth("200px");

        panel.setSpacing(10);
        panel.add(disclosurePanel);

        examplePanel.setWidget(panel);
View Full Code Here


        // creation
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PDisclosurePanel disclosurePanel1 = new PDisclosurePanel("A disclosure panel");
                disclosurePanel1.ensureDebugId("disclosurePanel1");
                PRootPanel.get().add(disclosurePanel1);
                register(disclosurePanel1);
            }
        });

        WebElement disclosure = findElementById("disclosurePanel1");
        Assert.assertTrue(disclosure.getAttribute("class").contains("gwt-DisclosurePanel-closed"));
        final PDisclosurePanel disclosurePanel1 = get("disclosurePanel1");
        Assert.assertEquals(false, disclosurePanel1.isOpen());

        WebElement disclosureHeader = findElementById("disclosurePanel1-header");
        Assert.assertEquals("A disclosure panel", disclosureHeader.getText());

        // set content
        // open / close
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PDisclosurePanel disclosurePanel1 = get("disclosurePanel1");
                final PLabel label = new PLabel("Text");
                label.ensureDebugId("label1");
                disclosurePanel1.setContent(label);
                disclosurePanel1.addOpenHandler(eventsListener);
                disclosurePanel1.addCloseHandler(eventsListener);
                register(disclosurePanel1);
            }
        });

        disclosureHeader = findElementById("disclosurePanel1-header");
        disclosureHeader.click();
        final POpenEvent e2 = eventsListener.poll();
        Assert.assertNotNull(e2);
        Assert.assertTrue(disclosurePanel1.isOpen());

        disclosure = findElementById("disclosurePanel1");
        final WebElement content = findElementById(disclosure, "label1");
        Assert.assertEquals("Text", content.getText());

        disclosureHeader.click();
        final PCloseEvent e1 = eventsListener.poll();
        Assert.assertNotNull(e1);
        Assert.assertTrue(!disclosurePanel1.isOpen());

        // server side open
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PDisclosurePanel disclosurePanel1 = get("disclosurePanel1");
                disclosurePanel1.setOpen(true);
            }
        });

        disclosure = findElementById("disclosurePanel1");
        Assert.assertTrue(disclosure.getAttribute("class").contains("gwt-DisclosurePanel-open"));

        // server side close
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PDisclosurePanel disclosurePanel1 = get("disclosurePanel1");
                disclosurePanel1.setOpen(false);
            }
        });

        disclosure = findElementById("disclosurePanel1");
        Assert.assertTrue(disclosure.getAttribute("class").contains("gwt-DisclosurePanel-closed"));
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.basic.PDisclosurePanel

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.