Package com.ponysdk.ui.server.basic

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


        items.put(pageIndex, button);
    }

    @Override
    public void setSelectedPage(final int pageIndex) {
        final PWidget item = items.get(pageIndex).asWidget();
        item.setStyleName("selected");
        if (selectedItem != null) selectedItem.asWidget().setStyleName("unselected");
        selectedItem = item;
    }
View Full Code Here


        items.put(pageIndex, item);
    }

    @Override
    public void setSelectedPage(int pageIndex) {
        final PWidget item = items.get(pageIndex).asWidget();
        item.setStyleProperty("fontWeight", "bold");
        if (selectedItem != null) selectedItem.asWidget().setStyleName("unselected");
        selectedItem = item;
    }
View Full Code Here

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

        final PVerticalPanel verticalPanel = new PVerticalPanel();

        final PWidget box1 = buildBox("Box 1");
        final PWidget box2 = buildBox("Box 2");
        final PWidget box3 = buildBox("Box 3");
        final PWidget box4 = buildBox("Box 4");
        boxContainer.add(box1);
        boxContainer.add(box2);
        boxContainer.add(box3);
        boxContainer.add(box4);
View Full Code Here

        box.addDomHandler(new PDropHandler() {

            @Override
            public void onDrop(final PDropEvent event) {
                box.removeStyleName("dragenter");
                final PWidget source = event.getDragSource();
                if (source != null && source != box) {
                    final int dropIndex = boxContainer.getWidgetIndex(box);
                    boxContainer.remove(source);
                    boxContainer.insert(source, dropIndex);
                }
View Full Code Here

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

        final PWidget fill = buildComponent("Fill panel", "#75ffdc");
        final PWidget leftPane = buildComponent("Left panel top/left 50.50 200x100", "#b879fc");
        final PWidget rightPane = buildComponent("Right panel bottom/right 50.50 200x100", "#e8b6ea");

        layoutPanel.add(fill);
        layoutPanel.add(leftPane);
        layoutPanel.add(rightPane);

        layoutPanel.setWidgetLeftRight(fill, 0, 0, PUnit.PX);
        layoutPanel.setWidgetTopBottom(fill, 0, 0, PUnit.PX);

        layoutPanel.setWidgetLeftWidth(leftPane, 50, 200, PUnit.PX);
        layoutPanel.setWidgetTopHeight(leftPane, 50, 100, PUnit.PX);

        layoutPanel.setWidgetRightWidth(rightPane, 50, 200, PUnit.PX);
        layoutPanel.setWidgetBottomHeight(rightPane, 50, 100, PUnit.PX);

        // test animation
        leftPane.addDomHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                // permute left/right
                layoutPanel.setWidgetLeftWidth(rightPane, 50, 200, PUnit.PX);
                layoutPanel.setWidgetTopHeight(rightPane, 50, 100, PUnit.PX);
                layoutPanel.setWidgetRightWidth(leftPane, 50, 200, PUnit.PX);
                layoutPanel.setWidgetBottomHeight(leftPane, 50, 100, PUnit.PX);
                layoutPanel.animate(2000);
            }
        }, PClickEvent.TYPE);

        rightPane.addDomHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                // restore
                layoutPanel.setWidgetLeftWidth(leftPane, 50, 200, PUnit.PX);
View Full Code Here

        box.addDomHandler(new PDropHandler() {

            @Override
            public void onDrop(final PDropEvent event) {
                box.removeStyleName("dragenter");
                final PWidget source = event.getDragSource();
                if (source != null && source != box) {
                    final int dropIndex = boxContainer.getWidgetIndex(box);
                    boxContainer.remove(source);
                    boxContainer.insert(source, dropIndex);
                }
View Full Code Here

        checkRowBound(index);
        checkRowBound(beforeIndex);

        final PElement parentElement = (index == 0) ? thead : tbody;

        final PWidget source = parentElement.getWidget(index - (index == 0 ? 0 : 1));
        parentElement.insert(source, beforeIndex - (beforeIndex == 0 ? 0 : 1));
    }
View Full Code Here

        for (final String item : items) {
            unselected.addItem(item);
        }
        panel.setTitle("caption");
        final PWidget unselectedWidget = unselected.asWidget();
        panel.add(unselectedWidget);
        switchButton = new PButton("<>");
        formFieldComponent.setCaption(caption);
        switchButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                selectValues.clear();
                for (int i = 1; i < unselected.getItemCount(); i++) {
                    if (unselected.isItemSelected(i)) {
                        selectValues.add(unselected.getItem(i));
                    }
                }

                for (int i = 1; i < selected.getItemCount(); i++) {
                    if (!selected.isItemSelected(i)) {
                        selectValues.add(selected.getItem(i));
                    }
                }
                refresh();
            }
        });
        final PWidget button = switchButton.asWidget();
        panel.add(button);
        final PWidget selectedWidget = selected.asWidget();
        panel.add(selectedWidget);
        panel.setCellVerticalAlignment(selectedWidget, PVerticalAlignment.ALIGN_TOP);
        panel.setCellHeight(selectedWidget, "100%");
        panel.setCellHeight(unselectedWidget, "100%");
        panel.setCellVerticalAlignment(button, PVerticalAlignment.ALIGN_TOP);
View Full Code Here

        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PHorizontalPanel horizontal1 = get("horizontal1");
                final PWidget cell1 = horizontal1.getWidget(1);
                horizontal1.setCellHeight(cell1, "30px");
                horizontal1.setCellWidth(cell1, "100px");
                horizontal1.setCellHorizontalAlignment(cell1, PHorizontalAlignment.ALIGN_RIGHT);
                horizontal1.setCellVerticalAlignment(cell1, PVerticalAlignment.ALIGN_BOTTOM);
            }
        });

        grid1 = findElementById("horizontal1");
        rows = grid1.findElements(By.tagName("tr"));
        cells = rows.get(0).findElements(By.tagName("td"));

        final WebElement cell1 = cells.get(1);
        Assert.assertEquals("100px", cell1.getAttribute("width"));
        Assert.assertEquals("30px", cell1.getAttribute("height"));
        Assert.assertEquals("right", cell1.getAttribute("align"));
        Assert.assertTrue(cell1.getAttribute("style").contains("vertical-align: bottom"));
    }
View Full Code Here

        objectIDByReferences.put(weakReference, objectID);

        if (log.isDebugEnabled()) log.debug("Registering object: " + value);

        if (value instanceof PWidget) {
            final PWidget widget = (PWidget) value;
            if (widget.getParent() != null) {
                if (log.isDebugEnabled()) log.debug("Attaching object #" + objectID + " to parent: " + widget);
                parentObjectIDByReferences.put(weakReference, widget.getParent().getID());
            }
        }

        return value;
    }
View Full Code Here

TOP

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

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.