Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Form with DateField in Window

Francesco M
1 decade ago Apr 19, 2010 2:08pm
Yury Repeshov
1 decade ago Nov 09, 2010 8:11am
Francesco M
1 decade ago Nov 09, 2010 8:25am
Yury Repeshov
1 decade ago Nov 09, 2010 8:33am

It seems I solve my problem, now all works fine.

In this part I collect all data to my class

QQQ qqq = new qqq();
qqq.setValidFrom(validFrom);
getWindow().addWindow(buildSubWindow(qqq));

Here i create new subwindow

private Window buildSubWindow(QQQ qqq) {
Window subwindow = new Window("A subwindow");
subwindow.setHeight("450px");
subwindow.setWidth("350px");
subwindow.addComponent(buildFormEditor(qqq));
subwindow.setModal(true);
return subwindow;
}

here create form

Panel panel = new Panel();
BeanItem personItem = new BeanItem(qqq);
formEditor = new Form();
formEditor.setFormFieldFactory(new FormFieldFactory(){

@Override
public Field createField(Item item, Object propertyId, Component uiContext) {

String pid = (String) propertyId;
if(pid.equals("validFrom"))
{
DateField dateField = new DateField("Birth date");
dateField.setDateFormat("dd/MM/yyyy");
return dateField;
}
return null;
}
});
formEditor.setItemDataSource(personItem);
panel.addComponent(formEditor);

Hope this will help you.

Last updated on Nov, 9th 2010