Package com.ponysdk.ui.server.form

Examples of com.ponysdk.ui.server.form.FormField


        for (int i = 0; i < 30; i++)
            ageListBoxRenderer.addItem(i + " year", i);

        // ageSearchField = new FormField(ageListBoxRenderer);
        // nameSearchField = new FormField(new TextBoxBaseFormFieldRenderer("Name"));
        ageSearchField = new FormField();
        nameSearchField = new FormField();

        raceSearchFormFieldRenderer = new ListBoxFormFieldRenderer();
        raceSearchFormField = new FormField(raceSearchFormFieldRenderer);

        final List<ListColumnDescriptor<Pony, ?>> listColumnDescriptors = new ArrayList<ListColumnDescriptor<Pony, ?>>();

        final ListColumnDescriptor<Pony, String> nameColumnDescriptor = new ListColumnDescriptor<Pony, String>();
        nameColumnDescriptor.setValueProvider(new BeanValueProvider<Pony, String>("name"));
View Full Code Here


    private void buildCreatePonyActivity() {

        createPonyActivityPanel = new PSimplePanel();
        createPonyActivity = new FormActivity(new DefaultFormView("Create a Pony"));
        nameFormField = new FormField(new TextBoxFormFieldRenderer("Name"));
        ageFormField = new FormField(new TextBoxFormFieldRenderer("Age"));
        raceFormField = new FormField(new TextBoxFormFieldRenderer("Race"));

        nameFormField.addValidator(new NotEmptyFieldValidator());
        raceFormField.addValidator(new NotEmptyFieldValidator());
        ageFormField.addValidator(new NotEmptyFieldValidator());
        ageFormField.addValidator(new IntegerFieldValidator());
View Full Code Here

        final FormView formView = new DefaultFormView();
        final FormConfiguration formConfiguration = new FormConfiguration();
        formConfiguration.setName("Form");
        final FormActivity formActivity = new FormActivity(formConfiguration, formView);

        final FormField field1 = new FormField("field1");
        formActivity.addFormField(field1);
        field1.addValidator(new NotEmptyFieldValidator());
        field1.addValidator(new DoubleFieldValidator());

        final FormFieldRenderer field2Renderer = new TextBoxFormFieldRenderer("field2");
        final FormField field2 = new FormField(field2Renderer);
        formActivity.addFormField(field2);

        final ListBoxFormFieldRenderer field3Renderer = new ListBoxFormFieldRenderer("field3");
        field3Renderer.addItem("Choice 1", 1);
        field3Renderer.addItem("Choice 2", 2);
        field3Renderer.addItem("Choice 3", 3);
        field3Renderer.addItem("Choice 4", 4);
        final FormField field3 = new FormField(field3Renderer);
        formActivity.addFormField(field3);

        final FormFieldRenderer field4Renderer = new DateBoxFormFieldRenderer("field4");
        final FormField field4 = new FormField(field4Renderer);
        formActivity.addFormField(field4);

        final FormFieldRenderer field5Renderer = new TextAreaFormFieldRenderer("field5");
        final FormField field5 = new FormField(field5Renderer);
        formActivity.addFormField(field5);

        final TwinListBoxFormFieldRenderer<String> field6Renderer = new TwinListBoxFormFieldRenderer<String>("field6");
        final FormField field6 = new FormField(field6Renderer);
        formActivity.addFormField(field6);

        field6Renderer.addItem("Choice 1");
        field6Renderer.addItem("Choice 2");
        field6Renderer.addItem("Choice 3");
View Full Code Here

    private SortableHeader sortableHeader;

    private PWidget header;

    public ComplexHeaderCellRenderer(final String caption, final String pojoPropertyKey) {
        this(caption, new FormField(), pojoPropertyKey);
    }
View Full Code Here

    }

    @Override
    public void start(final PAcceptsOneWidget world) {
        super.start(world);
        captionFormField = new FormField("Caption");
        captionFormField.addValidator(new NotEmptyFieldValidator());
        addFormField(captionFormField);
        addHandlerToFormField(captionFormField);

        fieldPathFormField = new FormField("Field Path");
        fieldPathFormField.addValidator(new NotEmptyFieldValidator());
        addFormField(fieldPathFormField);
        addHandlerToFormField(fieldPathFormField);

        final ListBoxFormFieldRenderer typeRenderer = new ListBoxFormFieldRenderer("Field Type");
        typeRenderer.addItem(String.class.getSimpleName(), String.class);
        typeRenderer.addItem(Integer.class.getSimpleName(), Integer.class);
        typeRenderer.addItem(Long.class.getSimpleName(), Long.class);
        typeRenderer.addItem(Double.class.getSimpleName(), Double.class);
        typeRenderer.addItem(Date.class.getSimpleName(), Date.class);
        typeRenderer.addItem(Boolean.class.getSimpleName(), Boolean.class);
        fieldTypeFormField = new FormField(typeRenderer);
        fieldTypeFormField.addValidator(new NotEmptyFieldValidator());
        addFormField(fieldTypeFormField);
        addHandlerToFormField(fieldTypeFormField);

    }
View Full Code Here

    }

    protected Query createQuery(final int page) {
        final List<Criterion> criteria = new ArrayList<Criterion>();
        for (final Entry<Criterion, FormField> entry : formFieldsByCriterionFields.entrySet()) {
            final FormField formField = entry.getValue();

            if (formField.getValue() != null) {
                final Criterion criterionField = entry.getKey();
                criterionField.setValue(formField.getValue());
                criteria.add(criterionField);
            }
        }

        if (currentSortingPojoPropertyKey != null) {
View Full Code Here

        return customDescriptorHolderByCaption;
    }

    @Override
    public void onAddCustomColumnDescriptor(final AddCustomColumnDescriptorEvent event) {
        FormField formField;
        final Class<?> fieldType = event.getDescriptorHolder().getFieldType();
        final String caption = event.getDescriptorHolder().getCaption();
        final String fieldPath = event.getDescriptorHolder().getFieldPath();
        if (fieldType.equals(Boolean.class)) {
            final ListBoxFormFieldRenderer formFieldRenderer = new ListBoxFormFieldRenderer();
            formFieldRenderer.addItem(Boolean.TRUE.toString(), Boolean.TRUE);
            formFieldRenderer.addItem(Boolean.FALSE.toString(), Boolean.FALSE);
            formField = new FormField(formFieldRenderer);
        } else if (fieldType.equals(Date.class)) {
            formField = new FormField(new DateBoxFormFieldRenderer());
        } else if (fieldType.equals(Integer.class)) {
            formField = new FormField() {

                @Override
                public Object getValue() {
                    if (super.getValue() != null) return getIntegerValue();
                    return null;
                }
            };
        } else if (fieldType.equals(Long.class)) {
            formField = new FormField() {

                @Override
                public Object getValue() {
                    if (super.getValue() != null) return getLongValue();
                    return null;
                }
            };
        } else if (fieldType.equals(Double.class)) {
            formField = new FormField() {

                @Override
                public Object getValue() {
                    if (super.getValue() != null) return getDoubleValue();
                    return null;
                }
            };
        } else formField = new FormField();
        final ComplexHeaderCellRenderer headerCellRenderer = new ComplexHeaderCellRenderer(caption, formField, fieldPath);
        final ListColumnDescriptor<D, Object> columnDescriptor = new ListColumnDescriptor<D, Object>();
        columnDescriptor.setHeaderCellRenderer(headerCellRenderer);
        columnDescriptor.setCustom(true);
        columnDescriptor.setValueProvider(new BeanValueProvider<D, Object>(fieldPath));
View Full Code Here

TOP

Related Classes of com.ponysdk.ui.server.form.FormField

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.