use of com.dala.data.company.Company in project DoodleVerse by davidemarcoli.
the class CompanyManagementView method createEditor.
/**
* Create the Company CRUD-Editor
* @return the created Crud-Editor
*/
private CrudEditor<Company> createEditor() {
TextField companyName = new TextField("Company");
FormLayout form = new FormLayout(companyName);
form.setMaxWidth("480px");
form.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1), new FormLayout.ResponsiveStep("30em", 2));
Binder<Company> binder = new Binder<>(Company.class);
binder.forField(companyName).asRequired().bind(Company::getCompanyName, Company::setCompanyName);
return new BinderCrudEditor<>(binder, form);
}
use of com.dala.data.company.Company in project DoodleVerse by davidemarcoli.
the class CompanyManagementView method setupToolbar.
/**
* Setup the toolbar
*/
private void setupToolbar() {
Html total = new Html("<span>Total: <b>" + companyRepository.count() + "</b> companies</span>");
Button button = new Button("New company", VaadinIcon.PLUS.create());
button.addClickListener(event -> {
Company newCompany = new Company();
crud.edit(newCompany, Crud.EditMode.NEW_ITEM);
});
button.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
HorizontalLayout toolbar = new HorizontalLayout(total, button);
toolbar.setAlignItems(FlexComponent.Alignment.CENTER);
toolbar.setFlexGrow(1, toolbar);
toolbar.setJustifyContentMode(FlexComponent.JustifyContentMode.BETWEEN);
toolbar.setSpacing(false);
crud.setToolbar(toolbar);
}
use of com.dala.data.company.Company in project DoodleVerse by davidemarcoli.
the class FakeGenerator method generateCompanies.
/**
* Generate random companys
* @param count the number of randomly generated companys
* @return the generated companys
*/
public ArrayList<Company> generateCompanies(int count) {
ArrayList<Company> companies = new ArrayList<>();
for (int i = 0; i < count; i++) {
ArrayList<Department> departments = generateDepartment(10);
companies.add(new Company(0L, faker.company().name(), departments));
}
return companies;
}
Aggregations