Package

Examples of Form


        dialogBox.center();
    }

    private void buildCreatePonyActivity() {

        createPony = new Form();
        nameFormField = new StringTextBoxFormField();
        ageFormField = new IntegerTextBoxFormField();
        raceFormField = new StringTextBoxFormField();

        nameFormField.setValidator(new NotEmptyFieldValidator());
View Full Code Here


        final PFlowPanel layout = new PFlowPanel();
        layout.add(new PLabel("Pony SDK styling use Less CSS. It's really easy to customize your styling with the use of a few variable."));
        layout.add(new PLabel("Customize the sample by changing this variables :"));

        final Form form = new Form();

        final PSimplePanel headerPreview = new PSimplePanel();
        final PSimplePanel headerTextColorPreview = new PSimplePanel();
        final PSimplePanel footerPreview = new PSimplePanel();
        final PSimplePanel footerTextColorPreview = new PSimplePanel();
        final PSimplePanel highlightPreview = new PSimplePanel();

        final PSimplePanel blackPreview = new PSimplePanel();
        final PSimplePanel grayDarkerPreview = new PSimplePanel();
        final PSimplePanel grayDarkPreview = new PSimplePanel();
        final PSimplePanel grayPreview = new PSimplePanel();
        final PSimplePanel grayLightPreview = new PSimplePanel();
        final PSimplePanel grayLighterPreview = new PSimplePanel();
        final PSimplePanel whitePreview = new PSimplePanel();

        header = buildColorFormField("498BF4", headerPreview);
        headerTextColor = buildColorFormField("EDEDED", headerTextColorPreview);
        footer = buildColorFormField("498BF4", footerPreview);
        footerTextColor = buildColorFormField("EDEDED", footerTextColorPreview);
        highlight = buildColorFormField("498BF4", highlightPreview);

        black = buildColorFormField("000000", blackPreview);
        grayDarker = buildColorFormField("222222", grayDarkerPreview);
        grayDark = buildColorFormField("333333", grayDarkPreview);
        gray = buildColorFormField("555555", grayPreview);
        grayLight = buildColorFormField("999999", grayLightPreview);
        grayLighter = buildColorFormField("eeeeee", grayLighterPreview);
        white = buildColorFormField("ffffff", whitePreview);

        form.addFormField(header.formField);
        form.addFormField(headerTextColor.formField);
        form.addFormField(footer.formField);
        form.addFormField(footerTextColor.formField);
        form.addFormField(highlight.formField);

        form.addFormField(black.formField);
        form.addFormField(grayDarker.formField);
        form.addFormField(grayDark.formField);
        form.addFormField(gray.formField);
        form.addFormField(grayLight.formField);
        form.addFormField(grayLighter.formField);
        form.addFormField(white.formField);

        final PFlexTable formLayout = new PFlexTable();
        formLayout.setWidget(0, 0, new FormFieldComponent("header", header.formField));
        formLayout.setWidget(1, 0, new FormFieldComponent("headerTextColor", headerTextColor.formField));
        formLayout.setWidget(2, 0, new FormFieldComponent("footer", footer.formField));
        formLayout.setWidget(3, 0, new FormFieldComponent("footerTextColor", footerTextColor.formField));
        formLayout.setWidget(5, 0, new FormFieldComponent("highlight", highlight.formField));

        formLayout.setWidget(0, 1, headerPreview);
        formLayout.setWidget(1, 1, headerTextColorPreview);
        formLayout.setWidget(2, 1, footerPreview);
        formLayout.setWidget(3, 1, footerTextColorPreview);
        formLayout.setWidget(5, 1, highlightPreview);

        formLayout.setWidget(0, 2, new FormFieldComponent("black", black.formField));
        formLayout.setWidget(1, 2, new FormFieldComponent("grayDarker", grayDarker.formField));
        formLayout.setWidget(2, 2, new FormFieldComponent("grayDark", grayDark.formField));
        formLayout.setWidget(3, 2, new FormFieldComponent("gray", gray.formField));
        formLayout.setWidget(4, 2, new FormFieldComponent("grayLight", grayLight.formField));
        formLayout.setWidget(5, 2, new FormFieldComponent("grayLighter", grayLighter.formField));
        formLayout.setWidget(6, 2, new FormFieldComponent("white", white.formField));

        formLayout.setWidget(0, 3, blackPreview);
        formLayout.setWidget(1, 3, grayDarkerPreview);
        formLayout.setWidget(2, 3, grayDarkPreview);
        formLayout.setWidget(3, 3, grayPreview);
        formLayout.setWidget(4, 3, grayLightPreview);
        formLayout.setWidget(5, 3, grayLighterPreview);
        formLayout.setWidget(6, 3, whitePreview);

        final PButton validateButton = new PButton("Validate");
        validateButton.setStyleName("pony-PButton accent");
        validateButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final boolean isValid = form.isValid();
                if (isValid) {
                    updateClientColorAndRefreshLess();
                }
            }
View Full Code Here

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

        final PFlexTable panel = new PFlexTable();

        final Form form = new Form();

        final FormField<String> field1 = new StringTextBoxFormField();
        field1.setValidator(new NotEmptyFieldValidator());
        final FormField<String> field2 = new StringTextBoxFormField();
        field2.setValidator(new DoubleFieldValidator());
        final FormField<String> field3 = new StringTextBoxFormField();
        field3.setValidator(new CompositeFieldValidator(new NotEmptyFieldValidator(), new DoubleFieldValidator()));
        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);
View Full Code Here

TOP

Related Classes of Form

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.