]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.api/src/org/argeo/api/MvcProvider.java
3 import java
.util
.function
.BiFunction
;
6 * Stateless UI part creator. Takes a parent view (V) and a model context (M) in
7 * order to create a view part (W) which can then be further configured. Such
8 * object can be used as services and reference other part of the model which
9 * are relevant for all created UI part.
12 public interface MvcProvider
<V
, M
, W
> extends BiFunction
<V
, M
, W
> {
14 * Whether this parent view is supported.
16 * @return true by default.
18 default boolean isViewSupported(V parent
) {
23 * Whether this context is supported.
25 * @return true by default.
27 default boolean isModelSupported(M context
) {
31 default W
createUiPart(V parent
, M context
) {
32 if (!isViewSupported(parent
))
33 throw new IllegalArgumentException("Parent view " + parent
+ "is not supported.");
34 if (!isModelSupported(context
))
35 throw new IllegalArgumentException("Model context " + context
+ "is not supported.");
36 return apply(parent
, context
);