Package com.vaadin.ui

Examples of com.vaadin.ui.DateField


    public void createNewView() {
        main.removeAllComponents();
        main.addComponent(new Label("DateField"));

        df = new DateField();
        main.addComponent(df);

        final ErrorMessage errorMsg = new UserError("User error " + df);
        df.setCaption("DateField caption " + df);
        df.setDescription("DateField description " + df);
        df.setComponentError(errorMsg);
        df.setImmediate(true);
        // FIXME: bug #1138 this makes datefield to render with unknown
        // component (UIDL tree debug)
        df.addStyleName("thisShouldBeHarmless");

        // Another test: locale
        final DateField df1 = new DateField("US locale");
        main.addComponent(df1);
        df1.setLocale(new Locale("en", "US"));

        final DateField df2 = new DateField("DE locale");
        main.addComponent(df2);
        df2.setLocale(new Locale("de", "DE"));

        final DateField df3 = new DateField("RU locale");
        main.addComponent(df3);
        df3.setLocale(new Locale("ru", "RU"));

        final DateField df4 = new DateField("FI locale");
        main.addComponent(df4);
        df4.setLocale(new Locale("fi", "FI"));
    }
View Full Code Here


    private DateField datefield;

    @Override
    public void setUp() {
        date = new ObjectProperty<Long>(0L);
        datefield = new DateField();
        datefield.setBuffered(false);
        datefield.setConverter(new Converter<Date, Long>() {

            @Override
            public Long convertToModel(Date value,
View Full Code Here

        final Button b2 = new Button("Left");
        final Button b3 = new Button("Bottom");
        final Button b4 = new Button("Top");
        final TextField t1 = new TextField("Right aligned");
        final TextField t2 = new TextField("Bottom aligned");
        final DateField d1 = new DateField("Center aligned");
        final DateField d2 = new DateField("Center aligned");

        final VerticalLayout vert = new VerticalLayout();
        vert.addComponent(b1);
        vert.addComponent(b2);
        vert.addComponent(t1);
View Full Code Here

        final Button button = new Button("Button " + count++);
        test(layout, button);
        button.addListener(this);

        final DateField df = new DateField("DateField " + count++);
        test(layout, df);

        final CheckBox cb = new CheckBox("Checkbox " + count++);
        test(layout, cb);
View Full Code Here

        LegacyWindow mainWindow = new LegacyWindow(getClass().getName());

        GridLayout mainLayout = new GridLayout(3, 3);
        mainLayout.setSizeFull();

        DateField df;

        df = createDateField();
        mainLayout.addComponent(df, 2, 0);
        mainLayout.setComponentAlignment(df, Alignment.TOP_RIGHT);
View Full Code Here

        mainWindow.setContent(mainLayout);
        setMainWindow(mainWindow);
    }

    private DateField createDateField() {
        DateField df = new DateField();
        df.setLocale(new Locale("fi"));
        df.setResolution(Resolution.SECOND);
        df.setDescription("This is a long, multiline tooltip.<br/>It should always be on screen so it can be read.");
        df.setValue(new Date(1000000L));
        return df;
    }
View Full Code Here

            }
        };

        // not required
        Property<Date> dateProperty1 = new ObjectProperty<Date>(date);
        DateField dateField1 = new DateField("Not required", dateProperty1);
        dateField1.setLocale(new Locale("fi", "FI"));
        dateField1.setResolution(DateField.RESOLUTION_DAY);
        dateField1.setId("_DF1");
        dateField1.setImmediate(true);
        dateField1.addValidator(dateValidator);
        addComponent(dateField1);

        // required
        Property<Date> dateProperty2 = new ObjectProperty<Date>(date);
        DateField dateField2 = new DateField("Required", dateProperty2);
        dateField2.setLocale(new Locale("fi", "FI"));
        dateField2.setResolution(DateField.RESOLUTION_DAY);
        dateField2.setId("_DF2");
        dateField2.setRequired(true);
        dateField2.setImmediate(true);
        dateField2.addValidator(dateValidator);
        addComponent(dateField2);
    }
View Full Code Here

        f = new Button();

        addFocusableTest(f);
        addFocusableTest(new ComboBox());
        addFocusableTest(new TextField());
        addFocusableTest(new DateField());
        addFocusableTest(new NativeSelect());
        addFocusableTest(new ListSelect());
        addFocusableTest(new OptionGroup());
        OptionGroup optionGroup = new OptionGroup();
        optionGroup.setMultiSelect(true);
View Full Code Here

public class PopupClosingWithEsc extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        DateField df0 = new DateField("Minute");
        df0.setId("minute");
        df0.setResolution(Resolution.MINUTE);

        DateField df1 = new DateField("Day");
        df1.setId("day");
        df1.setResolution(Resolution.DAY);

        DateField df2 = new DateField("Month");
        df2.setId("month");
        df2.setResolution(Resolution.MONTH);

        DateField df3 = new DateField("Year");
        df3.setId("year");
        df3.setResolution(Resolution.YEAR);

        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.addComponents(df0, df1, df2, df3);
View Full Code Here

    private String pattern = "dd/MM/yy";
    private SimpleDateFormat format = new SimpleDateFormat(pattern);

    @Override
    protected void setup(VaadinRequest request) {
        final DateField dateField = new DateField("Insert Date: ");
        dateField.setImmediate(true);
        dateField.setDateFormat(pattern);

        dateField.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                log("valueChange: value: " + format(dateField.getValue())
                        + ", is valid: " + dateField.isValid());
            }
        });
        addComponent(dateField);
        addButton("check dateField", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                log("buttonClick: value: " + format(dateField.getValue())
                        + ", is valid: " + dateField.isValid());
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.DateField

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.