예제 #1
0
  private void listEntities() {
    // A dead simple in memory listing would be:
    list.setBeans(clientRepository.findAll());

    // Lazy binding with SortableLazyList: memory and query efficient
    // connection from Vaadin Table to Spring Repository
    // Note that fetching strategies can be given to MTable constructor as well.
    // Use this approach if you expect you'll have lots of data in your
    // table.

    /*list.setBeans(new SortableLazyList<>(
            // entity fetching strategy
            (firstRow, asc, sortProperty) -> clientRepository.findAllBy(
                    new PageRequest(
                            firstRow / PAGE_SIZE,
                            PAGE_SIZE,
                            asc ? Sort.Direction.ASC : Sort.Direction.DESC,
                            // fall back to id as "natural order"
                            sortProperty == null ? "id" : sortProperty
                    )
            ),
            // count fetching strategy
            () -> (int) clientRepository.count(),
            PAGE_SIZE
    ));*/
    adjustActionButtonState();
  }
예제 #2
0
 public void saveEntry(Client entry) {
   clientRepository.save(entry);
   listEntities();
   closeWindow();
 }
예제 #3
0
 public void remove(ClickEvent e) {
   clientRepository.delete(list.getValue());
   list.setValue(null);
   listEntities();
 }