com.vaadin.data.fieldgroup.BeanFieldGroup Java Examples

The following examples show how to use com.vaadin.data.fieldgroup.BeanFieldGroup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AgentForm.java    From doecode with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setAgent(Agent a) {
    this.agent = a;
    
    BeanFieldGroup.bindFieldsUnbuffered(a, this);
    
    if (a.isPersisted())
        delete.setEnabled(true);
    else
        delete.setEnabled(false);
    save.setEnabled(true);
}
 
Example #2
Source File: RepositoryForm.java    From doecode with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setSoftwareRepository(SoftwareRepository r) {
    repository = r;
    
    BeanFieldGroup.bindFieldsUnbuffered(r, this);
    
    updateAgentList();
    updateIdentifierList();
    setVisible(true);
    
    name.selectAll();
}
 
Example #3
Source File: ContactForm.java    From spring-cloud-microservice-example with GNU General Public License v3.0 5 votes vote down vote up
void edit(User contact) {
    this.contact = contact;
    if (contact != null) {
        // Bind the properties of the contact POJO to fiels in this form
        formFieldBindings = BeanFieldGroup.bindFieldsBuffered(contact, this);
        firstName.focus();
    }
    setVisible(contact != null);
}
 
Example #4
Source File: MyWindow.java    From java-course-ee with MIT License 5 votes vote down vote up
@Override
protected void init(VaadinRequest vaadinRequest) {
    mainWindow = new Window("Test Vaadin application");

    mainWindow.setWidth(800, Unit.PIXELS);
    mainWindow.setHeight(600, Unit.PIXELS);
    mainWindow.center();

    grid.setWidth("100%");
    grid.setHeight(300, Unit.PIXELS);
    grid.setSelectionMode(Grid.SelectionMode.SINGLE);

    grid.setContainerDataSource(new BeanItemContainer<Person>(Person.class, DaoImpl.getAllPersons()));
    grid.setColumns("name", "birth");
    Grid.Column bornColumn = grid.getColumn("birth");
    bornColumn.setRenderer(new DateRenderer("%1$td-%1$tm-%1$tY"));
    grid.addSelectionListener(event -> {
        Set<Object> selected = event.getSelected();
        Person o = (Person) selected.toArray()[0];
        BeanFieldGroup.bindFieldsUnbuffered(o, formLayout);
        formLayout.id.setEnabled(true);
        formLayout.name.setEnabled(true);
        formLayout.birth.setEnabled(true);
    });

    formLayout.id.setEnabled(false);
    formLayout.name.setEnabled(false);
    formLayout.birth.setEnabled(false);

    verticalLayout.setMargin(true);

    verticalLayout.addComponent(grid);
    verticalLayout.addComponent(formLayout);

    mainWindow.setContent(verticalLayout);

    addWindow(mainWindow);
}
 
Example #5
Source File: IdentifierForm.java    From doecode with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
public void setIdentifier(Identifier id) {
    this.identifier = id;
    
    BeanFieldGroup.bindFieldsUnbuffered(id, this);
    
    save.setEnabled(true);
    delete.setEnabled(id.isPersisted());
    
    setVisible(true);
    setEnabled(true);
    
    value.selectAll();
}