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();
  }
Example #2
0
  // Controller methods.
  //
  // In a big project, consider using separate controller/presenter
  // for improved testability. MVP is a popular pattern for large
  // Vaadin applications.
  private void listPayees() {
    // filtered by authorized user from Bluemix SSO
    try {
      Subject s = WSSubject.getCallerSubject();

      if (s != null) {
        Set<Principal> principals = s.getPrincipals();
        if (principals != null && principals.size() > 0) {
          authname = principals.iterator().next().getName();
        }
      }

    } catch (Exception exc) {
      authname = "bad stuff";
    }
    tservice.updateTransactions(authname);
    payeeTable.setBeans(new ArrayList<>(service.findByName(authname)));
  }
Example #3
0
 private void listPayees(String filterString) {
   payeeTable.setBeans(new ArrayList<>(service.findByName(filterString)));
 }