Package swingtree.api.mvvm
Interface BoundViewSupplier<M extends sprouts.HasId<?>>
- Type Parameters:
M
- The type of model for which a view declaration is created upon an invocation to {createViewFor(Var)
}. This is expected to be an immutable object with value semantics, like a record for example...
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A provider of a view bound to a
Var
property, usually containing a value object
based view model or a simple data model in the form of a record from
which the calcite dynamically creates and manages sub-views.
See:
UIForAnySwing.addAll(Var, BoundViewSupplier)
,
UIForAnySwing.addAll(String, Var, BoundViewSupplier)
,
UIForAnySwing.addAll(AddConstraint, Var, BoundViewSupplier)
,
-
Method Summary
Modifier and TypeMethodDescriptionUIForAnySwing
<?, ?> createViewFor
(sprouts.Var<M> viewModel) Creates a view representing an instance of the typeM
, which is a view model or a simple data model.
-
Method Details
-
createViewFor
Creates a view representing an instance of the typeM
, which is a view model or a simple data model.
Note that this method deliberately requires the handling of checked exceptions at its invocation sites because there may be any number of implementations hiding behind this interface and so it is unwise to assume that all of them will be able to execute gracefully without throwing exceptions.- Parameters:
viewModel
- The thing to create a view for, usually a view model or a simple data model.- Returns:
- A view for the given view model in the form of a
UIForAnySwing
, a builder node which wraps the actual main component of the view. - Throws:
Exception
- if the view could not be created by the client code.
-