Example usage for com.vaadin.ui DateField DateField

List of usage examples for com.vaadin.ui DateField DateField

Introduction

In this page you can find the example usage for com.vaadin.ui DateField DateField.

Prototype

public DateField(ValueChangeListener<LocalDate> valueChangeListener) 

Source Link

Document

Constructs a new DateField with a value change listener.

Usage

From source file:com.yoncabt.ebr.ui.ReportWindow.java

private void showFields(ReportDefinition definition, final Window w, final FormLayout fl)
        throws AssertionError, JSONException {
    fl.removeAllComponents();/*from  w  w  w  . j  a  va  2  s  .co  m*/
    w.setCaption(definition.getCaption());
    for (ReportParam param : definition.getReportParams()) {
        AbstractField comp = null;
        if (param.getInputType() == InputType.COMBO) {
            ComboBox f = new ComboBox(param.getLabel());
            param.getLovData().forEach((k, v) -> {
                f.addItem(k);
                f.setItemCaption(k, (String) v);
            });
            comp = f;
        } else {
            switch (param.getFieldType()) {
            case STRING: {
                TextField f = new TextField(param.getLabel());
                comp = f;
                break;
            }
            case INTEGER: {
                TextField f = new TextField(param.getLabel());
                f.addValidator(new IntegerRangeValidator("Say kontrol", (Integer) param.getMin(),
                        (Integer) param.getMax()));
                comp = f;
                break;
            }
            case LONG: {
                TextField f = new TextField(param.getLabel());
                f.addValidator(new LongRangeValidator("Say kontrol", (Long) param.getMin(),
                        (Long) param.getMax()));
                comp = f;
                break;
            }
            case DOUBLE: {
                TextField f = new TextField(param.getLabel());
                f.addValidator(new DoubleRangeValidator("Say kontrol", (Double) param.getMin(),
                        (Double) param.getMax()));
                comp = f;
                break;
            }
            case DATE: {
                DateField f = new DateField(param.getLabel());
                f.setDateFormat(param.getFormat());
                comp = f;
                break;
            }
            default: {
                throw new AssertionError(param.getName() + " in tipi tannmyor :" + param.getJavaType());
            }
            }
        }
        if (param.getDefaultValue() != null) {
            comp.setValue(param.getDefaultValue());
        }
        comp.setImmediate(true);
        comp.setValidationVisible(false);
        comp.setId(param.getName());
        fl.addComponent(comp);

    }
    if (report instanceof SQLReport) {
        reportType.addItem(ReportOutputFormat.xls);
        reportType.setItemCaption(ReportOutputFormat.xls, ReportOutputFormat.xls.getTypeName());
    } else {
        for (ReportOutputFormat value : ReportOutputFormat.values()) {
            reportType.addItem(value);
            reportType.setItemCaption(value, value.getTypeName());
        }
    }
    reportType.setValue(ReportOutputFormat.xls);
    fl.addComponent(reportType);
    fl.addComponent(reportLocale);
    fl.addComponent(email);
}

From source file:de.kaiserpfalzEdv.vaadin.LayoutHelper.java

License:Apache License

public DateField createDateField(final String caption, final int tabIndex, final int startColumn,
        final int startRow, final int endColumn, final int endRow) {
    DateField result = new DateField(i18n.get(caption));
    addToLayout(result, tabIndex, startColumn, startRow, endColumn, endRow);
    return result;
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java

License:Apache License

protected DateField createDateField(final String caption, final int tabIndex) {
    DateField result = new DateField(presenter.translate(caption));

    result.setTabIndex(tabIndex);//from  w  ww .  j  ava 2  s. c o m
    result.setWidth(100f, PERCENTAGE);
    result.setResolution(Resolution.DAY);
    result.setShowISOWeekNumbers(true);

    return result;
}

From source file:edu.kit.dama.ui.admin.administration.user.UserDataForm.java

License:Apache License

private DateField getValidFromField() {
    if (validFromField == null) {
        String id = "validFromField";
        LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

        validFromField = new DateField("VALID FROM");
        validFromField.setId(DEBUG_ID_PREFIX + id);
        validFromField.setWidth("100%");
        validFromField.setImmediate(true);
        validFromField.setReadOnly(true);
        validFromField.setDateFormat("dd.MM.yyyy");
        validFromField.setDescription("Date from which the account of the selected user is available");
        validFromField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
        validFromField.addValueChangeListener((Property.ValueChangeEvent event) -> {
            getValidUntilField().setRangeStart((Date) event.getProperty().getValue());
        });/*w w w.j  a va2 s .  com*/
    }
    return validFromField;
}

From source file:edu.kit.dama.ui.admin.administration.user.UserDataForm.java

License:Apache License

private DateField getValidUntilField() {
    if (validUntilField == null) {
        String id = "validUntilField";
        LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

        validUntilField = new DateField("VALID UNTIL");
        validUntilField.setId(DEBUG_ID_PREFIX + id);
        validUntilField.setWidth("100%");
        validFromField.setImmediate(true);
        validUntilField.setReadOnly(true);
        validUntilField.setDateFormat("dd.MM.yyyy");
        validUntilField.setDescription("Date until which the user's KIT Data Manager account is valid");
        validUntilField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
        validUntilField.addValueChangeListener((Property.ValueChangeEvent event) -> {
            getValidFromField().setRangeEnd((Date) event.getProperty().getValue());
        });//from  ww  w  .j a  v  a2s .  c  o m
    }
    return validUntilField;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.ExpressionTriggerConfigurationPanel.java

License:Apache License

/**
 * Get the start date field./*from w  w  w.  ja  v  a 2  s.c  o m*/
 *
 * @return The start date field.
 */
private DateField getStartDateField() {
    if (startDateField == null) {
        startDateField = new DateField("START DATE");
        startDateField.setImmediate(true);
        startDateField.setDateFormat("dd.MM.yyyy HH:mm");
        startDateField.setResolution(Resolution.MINUTE);
        startDateField.setWidth("100%");
        startDateField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    }
    return startDateField;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.ExpressionTriggerConfigurationPanel.java

License:Apache License

/**
 * Get the end date field./*from www .j a v  a2 s. co  m*/
 *
 * @return The end date field.
 */
private DateField getEndDateField() {
    if (endDateField == null) {
        endDateField = new DateField("END DATE");
        endDateField.setImmediate(true);
        endDateField.setDateFormat("dd.MM.yyyy HH:mm");
        endDateField.setResolution(Resolution.MINUTE);
        endDateField.setWidth("100%");
        endDateField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    }
    return endDateField;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.IntervalTriggerConfigurationPanel.java

License:Apache License

/**
 * Get the start date field./*from  www .  j  ava2  s .c  o m*/
 *
 * @return The name field.
 */
private DateField getStartDateField() {
    if (startDateField == null) {
        startDateField = new DateField("START DATE");
        startDateField.setWidth("100%");
        startDateField.setImmediate(true);
        startDateField.setDateFormat("dd.MM.yyyy HH:mm");
        startDateField.setResolution(Resolution.MINUTE);
        startDateField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    }
    return startDateField;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.IntervalTriggerConfigurationPanel.java

License:Apache License

/**
 * Get the end date field./*from   w  w  w  . ja va 2  s .co  m*/
 *
 * @return The name field.
 */
private DateField getEndDateField() {
    if (endDateField == null) {
        endDateField = new DateField("END DATE");
        endDateField.setWidth("100%");
        endDateField.setImmediate(true);
        endDateField.setDateFormat("dd.MM.yyyy HH:mm");
        endDateField.setResolution(Resolution.MINUTE);
        endDateField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    }
    return endDateField;
}

From source file:edu.kit.dama.ui.admin.workflow.property.LinuxSoftwareMapPropertyConfigurationPanel.java

License:Apache License

private DateField getEnteredDataField() {
    if (enteredDateField == null) {
        enteredDateField = new DateField("ENTERED DATE");
        enteredDateField.setSizeFull();/* w w w  .  j  a va 2 s  . c o  m*/
        enteredDateField.setWidth("100%");
        enteredDateField.setValue(new Date());
        enteredDateField.setImmediate(true);
        enteredDateField.addStyleName(CSSTokenContainer.BOLD_CAPTION);
    }
    return enteredDateField;
}