Package com.ponysdk.ui.server.basic

Examples of com.ponysdk.ui.server.basic.PListBox$ListGroupItem


        panel.add(suggestBox);

        panel.add(new PHTML("<br><br>"));

        panel.add(new PLabel("Manipulate the suggest box:"));
        final PListBox operation = new PListBox(true);
        operation.addItem("Select \"Friesian horse\"", 0);
        operation.addItem("Get textbox value", 1);
        operation.addItem("Enable/Disable textbox", 2);
        operation.addItem("Clear", 3);
        operation.addItem("Add items", 4);
        operation.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final Integer item = (Integer) operation.getSelectedValue();
                if (item == null) return;

                if (item.equals(0)) {
                    suggestBox.setText("Friesian horse");
                } else if (item.equals(1)) {
View Full Code Here


    private PWidget buildThemeSelectorPanel() {
        final PHorizontalPanel panel = new PHorizontalPanel();
        panel.setSpacing(10);

        final PListBox styleListBox = new PListBox(false, false);

        styleListBox.addItem(PonySDKTheme.BUTTON_WHITE);
        styleListBox.addItem(PonySDKTheme.BUTTON_BLACK);
        styleListBox.addItem(PonySDKTheme.BUTTON_BLUE);
        styleListBox.addItem(PonySDKTheme.BUTTON_GRAY);
        styleListBox.addItem(PonySDKTheme.BUTTON_GREEN);
        styleListBox.addItem(PonySDKTheme.BUTTON_ORANGE);
        styleListBox.addItem(PonySDKTheme.BUTTON_PINK);
        styleListBox.addItem(PonySDKTheme.BUTTON_ROSY);
        styleListBox.addItem("pony-PButton accent");

        styleListBox.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final String styleName = styleListBox.getSelectedItem();

                normalButton.setStyleName(styleName);
                disabledOnRequestButton.setStyleName(styleName);
                showLoadingOnRequestButton.setStyleName(styleName);
                comboOnRequestButton.setStyleName(styleName);
View Full Code Here

        nameColumnDescriptor.setCellRenderer(new LabelCellRenderer<String>());
        nameColumnDescriptor.setSubCellRenderer(new LabelCellRenderer<String>());

        nameColumnDescriptor.setSubCellRenderer(new LabelCellRenderer<String>());

        final PListBox ageListBox = new PListBox(true);
        for (int i = 0; i < 30; i++)
            ageListBox.addItem(i + " year", i);

        final DataGridColumnDescriptor<Pony, String> ageColumnDescriptor = new DataGridColumnDescriptor<Pony, String>();
        ageColumnDescriptor.setValueProvider(new BeanValueProvider<Pony, String>("age"));
        final ComplexHeaderCellRenderer ageHeaderCellRender = new ComplexHeaderCellRenderer("Age", new ListBoxFormField<Integer>(ageListBox), "age");
        ageHeaderCellRender.addFilterListener(dataProvider);
View Full Code Here

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

        final PFlexTable table = new PFlexTable();

        final PListBox listBoxCategory = new PListBox();
        listBoxCategory.addItem("Test1");
        listBoxCategory.addItem("Test2");
        listBoxCategory.addItem("Test3");
        listBoxCategory.addItem("Test2");
        listBoxCategory.addItem("Test2");
        listBoxCategory.addItem("Test2");
        listBoxCategory.addItem("Test2");
        listBoxCategory.addItem("Test2");
        listBoxCategory.addItem("Test2");

        table.setWidth("100%");
        table.setWidget(0, 0, listBoxCategory);

        final PListBox roleListBox = new PListBox(false, true);
        roleListBox.setVisibleItemCount(5);
        for (int i = 0; i < 10; i++) {
            roleListBox.addItem("Role" + i, i);
        }

        final PButton selectedRole = new PButton("Selected roles [1,2]");
        selectedRole.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                roleListBox.setSelectedValue(1);
                roleListBox.setSelectedValue(2);

                PNotificationManager.showHumanizedNotification("Selected items " + roleListBox.getSelectedItems());
            }
        });
        final PButton unSelectedRole = new PButton("Selected roles [1,2]");
        unSelectedRole.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent event) {
                roleListBox.setSelectedValue(1, false);
                roleListBox.setSelectedValue(2, false);
                PNotificationManager.showHumanizedNotification("Unselected items " + roleListBox.getSelectedItems());
            }
        });
        table.setWidget(1, 0, roleListBox);
        table.setWidget(1, 1, selectedRole);
        table.setWidget(1, 2, unSelectedRole);
View Full Code Here

        this(caption, emptySelection, false);
    }

    @Override
    public IsPWidget render(final FormField formField) {
        final PListBox listBox = new PListBox(emptySelection, multipleSelect);
        if (debugID != null) {
            listBox.ensureDebugId(debugID);
        }
        final FormFieldComponent<PListBox> formFieldComponent = new FormFieldComponent<PListBox>(listBox);
        formFieldComponent.getInput().addChangeHandler(this);
        formFieldComponent.setCaption(caption);
View Full Code Here

    @Override
    public void onChange(final PChangeEvent event) {

        // Propagate to all listbox first
        for (final FormFieldComponent<PListBox> field : fields) {
            final PListBox listBox = field.getInput();
            if (!listBox.equals(event.getSource())) { // avoid call again the selected value update
                final PListBox source = (PListBox) event.getSource();
                listBox.setSelectedIndex(source.getSelectedIndex());
            }
        }

        // Then pick up the value
        if (!fields.isEmpty()) {
View Full Code Here

        });

        layout.add(formLayout);
        layout.add(validateButton);

        final PListBox themesSelector = new PListBox();
        themesSelector.addItem(STANDARD);
        themesSelector.addItem(DARK);
        themesSelector.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final String selectedItem = themesSelector.getSelectedItem();
                setTheme(selectedItem);
            }
        });

        layout.add(new PHTML("<br><br><br>"));
View Full Code Here

        addListener(dateFieldComponent.getInput());

        final PHorizontalPanel horizontalPanel = new PHorizontalPanel();
        horizontalPanel.add(dateFieldComponent.asWidget());

        hours = new PListBox(false, false);

        for (int i = 0; i < 24; i++) {
            hours.addItem(i + "", i);
        }

        minutes = new PListBox(false, false);

        for (int i = 0; i < 60; i++) {
            minutes.addItem(i + "", i);
        }

        seconds = new PListBox(false, false);
        for (int i = 0; i < 60; i++) {
            seconds.addItem(i + "", i);
        }

        hours.addChangeHandler(new PChangeHandler() {
View Full Code Here

        final FormField<String> field4 = new StringTextBoxFormField();
        field4.setValidator(new CompositeFieldValidator(new NotEmptyFieldValidator(), new EmailFieldValidator()));
        final FormField<Boolean> field5 = new CheckBoxFormField();
        field5.setValidator(new UncheckedFieldValidator());

        final PListBox listBox = new PListBox(true);
        listBox.addItem("Item 1");
        listBox.addItem("Item 2");
        listBox.addItem("Item 3");
        listBox.addItem("Item 4");
        listBox.addItem("Item 5");
        listBox.addItem("Item 6");

        final FormField<String> field6 = new StringListBoxFormField(listBox);
        field6.setValidator(new NotEmptyFieldValidator());

        final FormField<Date> field7 = new DateBoxFormField();
        field7.setValidator(new NotEmptyFieldValidator());

        final FormField<Date> field8 = new DateBoxFormField();
        field7.setValidator(new NotEmptyFieldValidator());

        final FormField<String> field9 = new StringTextBoxFormField();
        field9.setValidator(new NotEmptyFieldValidator());

        final FormField<String> field10 = new StringTextBoxFormField();
        field10.setValidator(new TwinFieldValidator("Field doesn't match", field9));

        form.addFormField(field1);
        form.addFormField(field2);
        form.addFormField(field3);
        form.addFormField(field4);
        form.addFormField(field5);
        form.addFormField(field6);
        form.addFormField(field7);
        form.addFormField(field8);
        form.addFormField(field9);
        form.addFormField(field10);

        final FormFieldComponent formFieldComponent1 = new FormFieldComponent("field1", field1);
        final FormFieldComponent formFieldComponent2 = new FormFieldComponent("field2", field2);
        final FormFieldComponent formFieldComponent3 = new FormFieldComponent("field3", field3);
        final FormFieldComponent formFieldComponent4 = new FormFieldComponent("field4", field4);
        final FormFieldComponent formFieldComponent5 = new FormFieldComponent("field5", field5);
        final FormFieldComponent formFieldComponent6 = new FormFieldComponent("field6", field6);
        final FormFieldComponent formFieldComponent7 = new FormFieldComponent("field7", field7);
        final FormFieldComponent formFieldComponent8 = new FormFieldComponent("field8", field8);
        final FormFieldComponent formFieldComponent9 = new FormFieldComponent("field9", field9);
        final FormFieldComponent formFieldComponent10 = new FormFieldComponent("field10", field10);

        final PFlexTable formLayout = new PFlexTable();
        formLayout.addStyleName("cell-top");
        formLayout.setWidget(0, 0, formFieldComponent1);
        formLayout.setWidget(0, 1, formFieldComponent2);
        formLayout.setWidget(1, 0, formFieldComponent3);
        formLayout.setWidget(1, 1, formFieldComponent4);
        formLayout.setWidget(2, 0, formFieldComponent5);
        formLayout.setWidget(2, 1, formFieldComponent6);
        formLayout.setWidget(3, 0, formFieldComponent7);
        formLayout.setWidget(3, 1, formFieldComponent8);
        formLayout.setWidget(4, 0, formFieldComponent9);
        formLayout.setWidget(4, 1, formFieldComponent10);

        final PButton validateButton = new PButton("Validate");
        validateButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final boolean isValid = form.isValid();
                PNotificationManager.showTrayNotification("The form is valid? " + (isValid ? "YES" : "NO"));
            }
        });

        final PButton resetButton = new PButton("Reset");
        resetButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                form.reset();
                PNotificationManager.showHumanizedNotification("The form has been reseted");
            }
        });

        final PListBox captionOriantationList = new PListBox(true);
        for (final CaptionOrientation captionOriantation : CaptionOrientation.values()) {
            captionOriantationList.addItem(captionOriantation.name(), captionOriantation);
        }
        captionOriantationList.addChangeHandler(new PChangeHandler() {

            @Override
            public void onChange(final PChangeEvent event) {
                final CaptionOrientation captionOriantation = (CaptionOrientation) captionOriantationList.getSelectedValue();

                formFieldComponent1.setCaptionOrientation(captionOriantation);
                formFieldComponent2.setCaptionOrientation(captionOriantation);
                formFieldComponent3.setCaptionOrientation(captionOriantation);
                formFieldComponent4.setCaptionOrientation(captionOriantation);
View Full Code Here

        this.caption = caption;
    }

    @Override
    public IsPWidget render(final FormField formField) {
        selected = new PListBox(true, true);
        unselected = new PListBox(true, true);
        final PHorizontalPanel panel = new PHorizontalPanel();
        formFieldComponent = new FormFieldComponent<PHorizontalPanel>(panel);
        panel.setVerticalAlignment(PVerticalAlignment.ALIGN_MIDDLE);
        selected.addChangeHandler(this);
        unselected.addChangeHandler(this);
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.basic.PListBox$ListGroupItem

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.