feat: ExpensesView
added isPeriodic column with check box
This commit is contained in:
parent
8b9bfedbfe
commit
a8765f1e84
1 changed files with 8 additions and 0 deletions
|
@ -27,6 +27,7 @@ import com.vaadin.flow.component.textfield.TextArea;
|
||||||
import com.vaadin.flow.component.textfield.TextField;
|
import com.vaadin.flow.component.textfield.TextField;
|
||||||
import com.vaadin.flow.data.binder.BeanValidationBinder;
|
import com.vaadin.flow.data.binder.BeanValidationBinder;
|
||||||
import com.vaadin.flow.data.binder.ValidationException;
|
import com.vaadin.flow.data.binder.ValidationException;
|
||||||
|
import com.vaadin.flow.data.renderer.LitRenderer;
|
||||||
import com.vaadin.flow.router.*;
|
import com.vaadin.flow.router.*;
|
||||||
import com.vaadin.flow.spring.data.VaadinSpringDataHelpers;
|
import com.vaadin.flow.spring.data.VaadinSpringDataHelpers;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
@ -173,8 +174,15 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
|
||||||
periodUnit.setItems(PeriodUnit.values());
|
periodUnit.setItems(PeriodUnit.values());
|
||||||
periodInterval = new TextField("Period Interval");
|
periodInterval = new TextField("Period Interval");
|
||||||
date = new DatePicker("Date");
|
date = new DatePicker("Date");
|
||||||
|
LitRenderer<Expense> importantRenderer = LitRenderer.<Expense>of(
|
||||||
|
"<vaadin-icon icon='vaadin:${item.icon}' style='width: var(--lumo-icon-size-s); height: var(--lumo-icon-size-s); color: ${item.color};'></vaadin-icon>")
|
||||||
|
.withProperty("icon", important -> important.getIsPeriodic() ? "check" : "minus").withProperty("color",
|
||||||
|
important -> important.getIsPeriodic()
|
||||||
|
? "var(--lumo-primary-text-color)"
|
||||||
|
: "var(--lumo-disabled-text-color)");
|
||||||
|
|
||||||
formLayout.add(name, cost, category, description, isPeriodic, periodUnit, periodInterval, date);
|
formLayout.add(name, cost, category, description, isPeriodic, periodUnit, periodInterval, date);
|
||||||
|
grid.addColumn(importantRenderer).setHeader("Important").setAutoWidth(true);
|
||||||
editorDiv.add(formLayout);
|
editorDiv.add(formLayout);
|
||||||
createButtonLayout(editorLayoutDiv);
|
createButtonLayout(editorLayoutDiv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue