Package com.vaadin.ui

Examples of com.vaadin.ui.PopupDateField


                        + "Then try to set DateField's value using the first button. It sets the value "
                        + "correctly (as we can see from the Label) but the client-side is not updated.<br/>"
                        + "Using second button updates value correctly on the client-side too.",
                ContentMode.XML));

        final PopupDateField df = new PopupDateField(dateProperty);
        df.setLocale(new Locale("en", "US"));
        df.setImmediate(true);
        df.setResolution(DateField.RESOLUTION_DAY);
        addComponent(df);

        Label valueLabel = new Label(df.getPropertyDataSource());
        valueLabel.setCaption("DateField's value");
        addComponent(valueLabel);

        final Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2010);
        cal.set(Calendar.MONTH, 11);
        cal.set(Calendar.DAY_OF_MONTH, 14);
        Button setDateButton1 = new Button(
                "Set value to 12/14/10 using property", new ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        dateProperty.setValue(cal.getTime());
                    }

                });
        addComponent(setDateButton1);

        Button setDateButton2 = new Button(
                "Set value to 12/14/10 using setValue", new ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        df.setValue(cal.getTime());
                    }

                });
        addComponent(setDateButton2);
    }
View Full Code Here


    protected void setup() {
        final Label result = new Label();

        final Form form = new Form();

        PopupDateField datefield = new PopupDateField();
        datefield.setResolution(PopupDateField.RESOLUTION_DAY);
        datefield.setDateFormat("dd/MM/yyyy");

        form.addField("datefield", datefield);

        Button button = new Button("Validate");
View Full Code Here

        return 14565;
    }

    private static PopupDateField createPopupDateField(final boolean enabled,
            final boolean textFieldEnabled) {
        final PopupDateField popupDatefield = new PopupDateField();

        Calendar cal = GregorianCalendar.getInstance();
        cal.set(Calendar.DATE, 3);
        cal.set(Calendar.MONTH, Calendar.SEPTEMBER);
        cal.set(Calendar.YEAR, 2014);
        cal.set(Calendar.HOUR_OF_DAY, 8);
        final Date currentDate = cal.getTime();

        popupDatefield.setValue(currentDate);
        popupDatefield.setCaption("Enabled: " + enabled
                + ", Text field enabled: " + textFieldEnabled);
        popupDatefield.setEnabled(enabled);
        popupDatefield.setTextFieldEnabled(textFieldEnabled);
        return popupDatefield;
    }
View Full Code Here

    @Override
    protected void initializeComponents() {

        for (Locale locale : LOCALES) {
            PopupDateField pd = createPopupDateField("Undefined width", "-1",
                    locale);
            pd.setId("Locale-" + locale.toString() + "-undefined-wide");
            addTestComponent(pd);
            pd = createPopupDateField("500px width", "500px", locale);
            pd.setId("Locale-" + locale.toString() + "-500px-wide");
            addTestComponent(pd);
            pd = createPopupDateField("Initially empty", "", locale);
            pd.setValue(null);
            pd.setId("Locale-" + locale.toString() + "-initially-empty");
            addTestComponent(pd);
        }

    }
View Full Code Here

    }

    private PopupDateField createPopupDateField(String caption, String width,
            Locale locale) {
        PopupDateField pd = new PopupDateField(caption + "("
                + locale.toString() + ")");
        pd.setWidth(width);
        pd.setValue(new Date(12312312313L));
        pd.setLocale(locale);
        pd.setResolution(Resolution.YEAR);

        return pd;
    }
View Full Code Here

    private Long l = null;
    private ObjectProperty<Long> property;

    @Override
    protected void createFields() {
        PopupDateField pdf = new PopupDateField("DateField");
        addComponent(pdf);
        property = new ObjectProperty<Long>(l, Long.class);
        pdf.setPropertyDataSource(property);

        property.setValue(new Date(2011 - 1900, 4, 6).getTime());

        addComponent(new Button("Set property value to 10000L",
                new Button.ClickListener() {
View Full Code Here

    private static final String ENABLED = "DateField text box enabled";
    private static final String DISABLED = "DateField text box disabled";

    @Override
    public void setup() {
        final PopupDateField field = new PopupDateField();
        final CheckBox box = new CheckBox(ENABLED, true);
        box.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                field.setTextFieldEnabled((Boolean) event.getProperty()
                        .getValue());
                if (field.isTextFieldEnabled()) {
                    box.setCaption(ENABLED);
                } else {
                    box.setCaption(DISABLED);
                }
            }
View Full Code Here

    private final Object DATE = "Date";

    @Override
    public void setup() {
        PopupDateField df = new PopupDateField();
        df.setWidth("100%");

        Table t = new Table();
        t.setWidth("100px");
        t.addContainerProperty(DATE, Component.class, null);
        t.addItem(new Object[] { df }, "1");
View Full Code Here

        setLocale(Locale.ENGLISH);
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        final PopupDateField df = new PopupDateField();
        df.setValue(new Date(2012 - 1900, 5 - 1, 12));
        setRange(df, 5);
        layout.addComponent(df);

        final InlineDateField df2 = new InlineDateField();
        df2.setValue(new Date(2012 - 1900, 11 - 1, 16));
View Full Code Here

        cal.set(Calendar.HOUR_OF_DAY, 1);
        cal.set(Calendar.MINUTE, 1);
        cal.set(Calendar.SECOND, 1);
        cal.set(Calendar.MILLISECOND, 1);

        PopupDateField pdf = new PopupDateField();
        pdf.setLocale(Locale.US);
        pdf.setValue(cal.getTime());
        pdf.setImmediate(true);
        pdf.setResolution(DateField.RESOLUTION_SEC);
        addComponent(pdf);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.PopupDateField

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.