}
final VerticalLayout root = new VerticalLayout();
final MahasiswaForm form = new MahasiswaForm();
final MahasiswaList list = new MahasiswaList();
form.setMargin(true);
form.getSaveButton().addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
form.save();
((JPAContainer)list.getMhsTable().getContainerDataSource()).refresh();
form.clear();
list.getMhsTable().setValue(null);
}
});
list.getMhsTable().addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
if (event.getProperty().getValue() != null) {
Object mhsId = event.getProperty().getValue();
Mahasiswa selectedMahasiswa = createEntityManager().find(Mahasiswa.class, mhsId);