Package com.ponysdk.ui.server.basic

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


        view.addActionWidget(createUserAccountMenu(user));
        return view;
    }

    private PWidget createUserAccountMenu(final User userLogged) {
        final PAnchor optionsAnchor = new PAnchor(userLogged.getLogin());
        optionsAnchor.ensureDebugId("options_anchor");
        optionsAnchor.addStyleName(PonySDKTheme.HEADER_ACCOUNT_MENU);

        popup = new PPopupPanel();
        popup.addStyleName(PonySDKTheme.HEADER_ACCOUNT_MENU_POPUP);

        final PVerticalPanel panel = new PVerticalPanel();
        final PLabel userName = new PLabel(userLogged.getName());
        userName.addStyleName(PonySDKTheme.HEADER_ACCOUNT_MENU_POPUP_USER_NAME);
        panel.add(userName);

        final PLabel userLogin = new PLabel(userLogged.getLogin());
        userLogin.addStyleName(PonySDKTheme.HEADER_ACCOUNT_MENU_POPUP_USER_LOGIN);
        panel.add(userLogin);

        final PAnchor signOutAnchor = new PAnchor("Sign out");

        panel.add(signOutAnchor);
        popup.setWidget(panel);

        signOutAnchor.ensureDebugId("sign_out_anchor");
        signOutAnchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                optionsAnchor.removeStyleName(PonySDKTheme.HEADER_ACCOUNT_MENU_SELECTED);
                popup.hide();
View Full Code Here


    public void restart(final UIContext session) {
        doStart(session);
    }

    private void doStart(final UIContext session) {
        final PAnchor test = new PAnchor("Go to next test");
        test.ensureDebugId("startingpoint");
        test.addClickHandler(nextTestClickHandler);

        PRootPanel.get().add(test);
    }
View Full Code Here

        super.onFirstShowPage();

        final PVerticalPanel verticalPanel = new PVerticalPanel();
        verticalPanel.setSpacing(10);

        final PAnchor anchor = new PAnchor("And a link");
        anchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                PNotificationManager.showTrayNotification("Link clicked");
            }
View Full Code Here

    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

    public DateRangeHeaderCellRenderer(final String caption, final FormField from, final FormField to, final String pojoProperty) {
        super(caption, pojoProperty);

        final PAnchor anchor = new PAnchor("");
        anchor.addStyleName(PonySDKTheme.COMPLEXLIST_HEADERCELLRENDERER_DATERANGE);

        mainformFieldRenderer = (TextBoxFormFieldRenderer) formField.getFormFieldRenderer();
        mainformFieldRenderer.addClickHandler(this);
        mainformFieldRenderer.setEnabled(false);

        this.from = from;
        this.to = to;

        popupContent = new PVerticalPanel();
        popupContent.add(new PLabel("from"));
        popupContent.add(from.render().asWidget());
        popupContent.add(new PLabel("to"));
        popupContent.add(to.render().asWidget());
        final PKeyUpFilterHandler handler = new PKeyUpFilterHandler(PKeyCodes.ENTER) {

            @Override
            public void onKeyUp(final PKeyUpEvent keyUpEvent) {
                final RefreshListEvent refreshListEvent = new RefreshListEvent(this, from);
                eventBus.fireEvent(refreshListEvent);
            }
        };

        from.addResetHandler(new ResetHandler() {

            @Override
            public void onReset() {
                updateMainFormField();
            }
        });

        to.addResetHandler(new ResetHandler() {

            @Override
            public void onReset() {
                updateMainFormField();
            }
        });

        from.addDomHandler(handler, PKeyUpEvent.TYPE);
        to.addDomHandler(handler, PKeyUpEvent.TYPE);

        final DateBoxFormFieldRenderer fromRenderer = (DateBoxFormFieldRenderer) from.getFormFieldRenderer();
        fromRenderer.addValueChangeHandler(new PValueChangeHandler<Date>() {

            @Override
            public void onValueChange(final PValueChangeEvent<Date> event) {
                updateMainFormField();
            }

        });

        final DateBoxFormFieldRenderer toRenderer = (DateBoxFormFieldRenderer) to.getFormFieldRenderer();
        toRenderer.addValueChangeHandler(new PValueChangeHandler<Date>() {

            @Override
            public void onValueChange(final PValueChangeEvent<Date> event) {
                updateMainFormField();
            }
        });

        anchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent arg0) {
                showPopup();
            }
View Full Code Here

public class AnchorCellRenderer<T> extends AbstractCellRenderer<T, String> {

    @Override
    public IsPWidget render0(int rowCount, T data, String value) {
        return new PAnchor(value);
    }
View Full Code Here

    @Override
    public IsPWidget render(int row, D data, V value) {
        PSimplePanel panel = new PSimplePanel();

        final PAnchor button = new PAnchor("");

        button.addStyleName(PonySDKTheme.COMPLEXLIST_DETAILS_PLUS);

        button.addClickHandler(new DetailsCellClickHandler(button, data, row));

        panel.setWidget(button);

        return panel;
    }
View Full Code Here

        panel.setStyleName("pony-ComplexList-OptionSelectionPanel");
        final PLabel label = new PLabel("All " + rowSelectors.size() + " items on this page are selected.");
        final int fullSize = findResult.getFullSize();
        panel.add(label);
        if (fullSize > complexListConfiguration.getPageSize()) {
            final PAnchor anchor = new PAnchor("Select all " + fullSize + " final items in Inbox");
            anchor.addClickHandler(new PClickHandler() {

                @Override
                public void onClick(final PClickEvent event) {
                    selectionMode = SelectionMode.FULL;
                    showClearSelectAllOption();
View Full Code Here

    protected void showClearSelectAllOption() {
        final PHorizontalPanel panel = new PHorizontalPanel();
        panel.setHorizontalAlignment(PHorizontalAlignment.ALIGN_CENTER);
        panel.setStyleName("pony-ComplexList-OptionSelectionPanel");
        final PLabel label = new PLabel("All " + findResult.getFullSize() + " items are selected.");
        final PAnchor anchor = new PAnchor("Clear selection");
        anchor.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                mainCheckboxChanged(false);
            }
View Full Code Here

        // creation
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PAnchor anchor = new PAnchor("An anchor");
                anchor.ensureDebugId("anchor1");
                PRootPanel.get().add(anchor);

                register(anchor);
            }
        });

        WebElement element = findElementById("anchor1");
        Assert.assertEquals("An anchor", element.getText());

        // update text
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PAnchor anchor = get("anchor1");
                anchor.setText("New text of the anchor");
            }
        });

        element = findElementById("anchor1");
        Assert.assertEquals("New text of the anchor", element.getText());

        // update html
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PAnchor anchor = get("anchor1");
                anchor.setHTML("Anchor <font color='red'>with pure html</font>");
            }
        });

        element = findElementById("anchor1");
        Assert.assertEquals("Anchor with pure html", element.getText());

        final WebElement font = element.findElement(By.tagName("font"));
        final String color = font.getAttribute("color");
        Assert.assertEquals("red", color);

        // check server fields
        final PAnchor anchor = get("anchor1");
        Assert.assertEquals("New text of the anchor", anchor.getText());
        Assert.assertEquals("Anchor <font color='red'>with pure html</font>", anchor.getHTML());
    }
View Full Code Here

        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PComplexPanel complexPanel1 = get("complexPanel1");
                complexPanel1.add(new PAnchor("child1"));
                complexPanel1.add(new PAnchor("child3"));
            }
        });

        element = findElementById("complexPanel1");
        List<WebElement> anchors = element.findElements(By.tagName("a"));
        Assert.assertEquals(2, anchors.size());
        Assert.assertEquals(2, complexPanel1.getWidgetCount());

        // insert child
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PVerticalPanel complexPanel1 = get("complexPanel1");
                final PAnchor child2 = new PAnchor("child2");
                child2.ensureDebugId("child2");
                complexPanel1.insert(child2, 1);
                register(child2);
            }
        });

        element = findElementById("complexPanel1");
        anchors = element.findElements(By.tagName("a"));
        Assert.assertEquals(3, anchors.size());
        Assert.assertEquals("child1", anchors.get(0).getText());
        Assert.assertEquals("child2", anchors.get(1).getText());
        Assert.assertEquals("child3", anchors.get(2).getText());

        Assert.assertEquals(3, complexPanel1.getWidgetCount());
        Assert.assertEquals("child1", ((PAnchor) complexPanel1.getWidget(0)).getText());
        Assert.assertEquals("child2", ((PAnchor) complexPanel1.getWidget(1)).getText());
        Assert.assertEquals("child3", ((PAnchor) complexPanel1.getWidget(2)).getText());

        // remove child
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PComplexPanel complexPanel1 = get("complexPanel1");
                final PAnchor child2 = get("child2");
                complexPanel1.remove(child2);
            }
        });

        element = findElementById("complexPanel1");
View Full Code Here

TOP

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

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.