Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
simasch committed Nov 5, 2024
1 parent 8177556 commit 96beb93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ch.martinelli.demo.vaadinjooq.employee.model.Sequences;
import ch.martinelli.demo.vaadinjooq.employee.model.tables.Department;
import ch.martinelli.demo.vaadinjooq.employee.model.tables.Employee;
import ch.martinelli.demo.vaadinjooq.employee.model.tables.records.EmployeeRecord;
import net.datafaker.Faker;
import org.jooq.DSLContext;
import org.springframework.boot.ApplicationArguments;
Expand Down Expand Up @@ -35,16 +34,16 @@ public void run(ApplicationArguments args) {

var faker = new Faker();
for (int i = 0; i < 100; i++) {
EmployeeRecord employeeRecord = dslContext.newRecord(Employee.EMPLOYEE);
employeeRecord.setId(dslContext.nextval(Sequences.EMPLOYEE_SEQ).intValue());
employeeRecord.setFirstName(faker.name().firstName());
employeeRecord.setLastName(faker.name().lastName());
var employee = dslContext.newRecord(Employee.EMPLOYEE);
employee.setId(dslContext.nextval(Sequences.EMPLOYEE_SEQ).intValue());
employee.setFirstName(faker.name().firstName());
employee.setLastName(faker.name().lastName());
if (i % 7 == 0) {
employeeRecord.setDepartmentId(hrDepartment.getId());
employee.setDepartmentId(hrDepartment.getId());
} else {
employeeRecord.setDepartmentId(itDepartment.getId());
employee.setDepartmentId(itDepartment.getId());
}
employeeRecord.store();
employee.store();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public class EmployeeForm extends FormLayout {
private final ComboBox<DepartmentRecord> departmentId = new ComboBox<>("Department");

private final Binder<EmployeeRecord> binder = new Binder<>(EmployeeRecord.class);
private final Button save;
private final Button delete;

private EmployeeRecord employee;

Expand Down Expand Up @@ -106,11 +104,11 @@ public DepartmentRecord convertToPresentation(Integer integer, ValueContext valu
})
.bind(EmployeeRecord::getDepartmentId, EmployeeRecord::setDepartmentId);

save = new Button("Save");
var save = new Button("Save");
save.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
save.addClickListener(this::save);

delete = new Button("Delete");
var delete = new Button("Delete");
delete.addClickListener(this::delete);

add(id, firstName, lastName, departmentId, new HorizontalLayout(save, delete));
Expand Down

0 comments on commit 96beb93

Please sign in to comment.