use of org.linkki.samples.dynamicfield.model.Car in project linkki by linkki-framework.
the class DynamicFieldUI method init.
@Override
protected void init(VaadinRequest request) {
Page.getCurrent().setTitle("Linkki :: Dynamic Fields Sample");
List<Car> carStorage = getCarStorage();
BindingContext bindingContext = new BindingContext();
TableSection<CarRowPmo> table = new DefaultPmoBasedSectionFactory().createTableSection(new CarTablePmo(carStorage, () -> new NewCarDialog(carStorage, bindingContext::updateUI)), bindingContext);
setContent(table);
}
use of org.linkki.samples.dynamicfield.model.Car in project linkki by linkki-framework.
the class DynamicFieldUI method getCarStorage.
// some fake persistent storage
// store the cars in the session so it is available after a browser
// refresh as long as we are in the same session
private List<Car> getCarStorage() {
List<Car> carStorage;
WrappedSession session = CurrentInstance.get(VaadinSession.class).getSession();
@SuppressWarnings("unchecked") List<Car> storage = (List<Car>) session.getAttribute(CAR_STORAGE_ATTRIBUTE);
if (storage != null) {
carStorage = storage;
} else {
carStorage = new ArrayList<>();
addCars(carStorage);
session.setAttribute(CAR_STORAGE_ATTRIBUTE, carStorage);
}
return carStorage;
}
use of org.linkki.samples.dynamicfield.model.Car in project linkki by linkki-framework.
the class DynamicFieldUI method createCar.
private Car createCar(CarType carType, String make, String model, double retention) {
Car car = new Car(carType);
car.setMake(make);
car.setModel(model);
car.setRetention(retention);
return car;
}
Aggregations