Package com.ponysdk.ui.server.basic

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


    private void init(final Collection<ListColumnDescriptor<?, ?>> captions) {
        labelPanel.getRowFormatter().addStyleName(0, "pony-ComplexList-ColumnHeader");
        for (final ListColumnDescriptor<?, ?> caption : captions) {
            if (caption == null) continue;
            final SelectableLabel label = new SelectableLabel(caption.getCaption());
            final PCheckBox checkBox = new PCheckBox();
            label.checkBox = checkBox;
            label.viewable = caption.isViewable();
            label.custom = caption.isCustom();
            checkBox.addValueChangeHandler(new PValueChangeHandler<Boolean>() {

                @Override
                public void onValueChange(final PValueChangeEvent<Boolean> event) {
                    final ShowColumnDescriptorEvent refreshListEvent = new ShowColumnDescriptorEvent(PreferenceForm.this, caption.getCaption(), event.getValue(), tableName);
                    eventBus.fireEvent(refreshListEvent);
                    label.viewable = event.getValue();
                    refreshLabels();
                }
            });
            checkBox.setValue(caption.isViewable());
            labels.add(label);
        }
        refreshLabels();
    }
View Full Code Here


        listColumnDescriptor.setHeaderCellRenderer(new HeaderCellRenderer() {

            @Override
            public IsPWidget render() {
                mainCheckBox = new PCheckBox();
                mainCheckBox.addStyleName(PonySDKTheme.COMPLEXLIST_HEADERCELLRENDERER_MAINCHECKBOX);
                mainCheckBox.addValueChangeHandler(new PValueChangeHandler<Boolean>() {

                    @Override
                    public void onValueChange(final PValueChangeEvent<Boolean> event) {
View Full Code Here

        // creation
        updateUI(new RequestHandler() {

            @Override
            public void onRequest() {
                final PCheckBox checkbox1 = new PCheckBox("A checkbox");
                checkbox1.ensureDebugId("checkbox1");
                PRootPanel.get().add(checkbox1);
                checkbox1.addValueChangeHandler(eventsListener);
                register(checkbox1);
            }
        });

        WebElement element = findElementById("checkbox1-label");
        Assert.assertEquals("A checkbox", element.getText());
        element = findElementById("checkbox1-input");
        element.click();

        // check event
        final PValueChangeEvent<Boolean> e1 = eventsListener.poll();
        Assert.assertEquals(Boolean.TRUE, e1.getValue());

        // check server-side value
        final PCheckBox checkbox1 = get("checkbox1");
        Assert.assertEquals(Boolean.TRUE, checkbox1.getValue());

        // toggle
        element.click();

        // check event
        final PValueChangeEvent<Boolean> e2 = eventsListener.poll();
        Assert.assertEquals(Boolean.FALSE, e2.getValue());

        // check server-side value
        Assert.assertEquals(Boolean.FALSE, checkbox1.getValue());
    }
View Full Code Here

TOP

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

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.