Clarify MVC UI provider.
[lgpl/argeo-commons.git] / org.argeo.api / src / org / argeo / api / MvcProvider.java
index 9c5c4a06bdafbb6d68265570aa6551ceae78d32c..5d48873ab89e04bf6feb970919a6cf75ed6dc377 100644 (file)
@@ -10,6 +10,8 @@ import java.util.function.BiFunction;
  */
 @FunctionalInterface
 public interface MvcProvider<V, M, W> extends BiFunction<V, M, W> {
+       W createUiPart(V parent, M context);
+       
        /**
         * Whether this parent view is supported.
         * 
@@ -28,11 +30,15 @@ public interface MvcProvider<V, M, W> extends BiFunction<V, M, W> {
                return true;
        }
 
-       default W createUiPart(V parent, M context) {
+       default W apply(V parent, M context) {
                if (!isViewSupported(parent))
                        throw new IllegalArgumentException("Parent view " + parent + "is not supported.");
                if (!isModelSupported(context))
                        throw new IllegalArgumentException("Model context " + context + "is not supported.");
-               return apply(parent, context);
+               return createUiPart(parent, context);
+       }
+
+       default W createUiPart(V parent) {
+               return createUiPart(parent, null);
        }
 }