0001 /*
0002 * Copyright 2008-2017 the original author or authors.
0003 *
0004 * Licensed under the Apache License, Version 2.0 (the "License");
0005 * you may not use this file except in compliance with the License.
0006 * You may obtain a copy of the License at
0007 *
0008 * http://www.apache.org/licenses/LICENSE-2.0
0009 *
0010 * Unless required by applicable law or agreed to in writing, software
0011 * distributed under the License is distributed on an "AS IS" BASIS,
0012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013 * See the License for the specific language governing permissions and
0014 * limitations under the License.
0015 */
0016 package griffon.core.mvc;
0017
0018 import griffon.core.artifact.GriffonController;
0019 import griffon.core.artifact.GriffonModel;
0020 import griffon.core.artifact.GriffonMvcArtifact;
0021 import griffon.core.artifact.GriffonView;
0022
0023 import javax.annotation.Nonnull;
0024 import java.util.List;
0025 import java.util.Map;
0026
0027 /**
0028 * Base contract for classes that can manipulate MVC groups.
0029 * There are 4 types of methods used for instantiating a group:
0030 * <ul>
0031 * <ol>{@code createMVCGroup()} - creates a new group instance returning all members.</ol>
0032 * <ol>{@code createMVC()} - creates a new group instance returning only Model, View and Controller members.</ol>
0033 * <ol>{@code withMVCGroup()} - creates a new group instance and destroys it immediately after it has been processed by the callback.</ol>
0034 * <ol>{@code withMVC()} - creates a new group instance and destroys it immediately after it has been processed by the callback.</ol>
0035 * </ul>
0036 * <p/>
0037 * It's worth mentioning that the value of the {@code mvcId} parameter must be unique otherwise a collision will occur.
0038 * When that happens the application will report and exception and terminate. This behavior can be configured to be more
0039 * lenient, by defining a configuration flag {@code griffon.mvcid.collision} in {@code Config}. <br/>
0040 * Accepted values are
0041 * <ul>
0042 * <ol>warning - reports the error but allows the application to continue. Destroys the existing group before continuing.</ol>
0043 * <ol>exception - reports the error and terminates the application. this is the default behavior.</ol>
0044 * </ul>
0045 *
0046 * @author Andres Almiray
0047 * @since 2.0.0
0048 */
0049 public interface MVCHandler {
0050 /**
0051 * Instantiates an MVC group of the specified type.<p>
0052 * MVC groups must be previously configured with the application's metadata
0053 * before they can be used. This registration process usually takes place automatically
0054 * at boot time. The type of the group can be normally found in the application's
0055 * configuration file.<p>
0056 * For example, with the following entry available in {@code Config.groovy}
0057 * <p/>
0058 * <pre>
0059 * mvcGroups {
0060 * foo {
0061 * model = 'com.acme.FooModel'
0062 * view = 'com.acme.FooView'
0063 * controller = 'com.acme.FooController'
0064 * }
0065 * }
0066 * </pre>
0067 * <p/>
0068 * An instance of the "foo" group can be created as follows
0069 * <p/>
0070 * <pre>
0071 * MVCGroup fooGroup = createMVCGroup('foo')
0072 * assert (fooGroup.controller instanceof FooController)
0073 * </pre>
0074 *
0075 * @param mvcType the type of group to build.
0076 *
0077 * @return an MVCGroup instance of the desired type
0078 *
0079 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0080 * configuration or if a group with the same mvcId exists already.
0081 */
0082 @Nonnull
0083 MVCGroup createMVCGroup(@Nonnull String mvcType);
0084
0085 /**
0086 * Instantiates an MVC group of the specified type with a particular name.<p>
0087 * MVC groups must be previously configured with the application's metadata
0088 * before they can be used. This registration process usually takes place automatically
0089 * at boot time. The type of the group can be normally found in the application's
0090 * configuration file.<p>
0091 * For example, with the following entry available in {@code Config.groovy}
0092 * <p/>
0093 * <pre>
0094 * mvcGroups {
0095 * foo {
0096 * model = 'com.acme.FooModel'
0097 * view = 'com.acme.FooView'
0098 * controller = 'com.acme.FooController'
0099 * }
0100 * }
0101 * </pre>
0102 * <p/>
0103 * An instance of the "foo" group can be created as follows
0104 * <p/>
0105 * <pre>
0106 * MVCGroup fooGroup = createMVCGroup('foo', 'foo' + System.currentTimeMillis())
0107 * assert (fooGroup.controller instanceof FooController)
0108 * </pre>
0109 * <p/>
0110 * MVC groups must have an unique name.
0111 *
0112 * @param mvcType the type of group to build.
0113 * @param mvcId the name to assign to the built group.
0114 *
0115 * @return an MVCGroup instance of the desired type
0116 *
0117 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0118 * configuration or if a group with the same mvcId exists already.
0119 */
0120 @Nonnull
0121 MVCGroup createMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId);
0122
0123 /**
0124 * Instantiates an MVC group of the specified type with additional variables.<p>
0125 * MVC groups must be previously configured with the application's metadata
0126 * before they can be used. This registration process usually takes place automatically
0127 * at boot time. The type of the group can be normally found in the application's
0128 * configuration file.<p>
0129 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0130 * scenarios <ul>
0131 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0132 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0133 * on any MVC member of the group.</li>
0134 * </ul>
0135 * <p/>
0136 * For example, with the following entry available in {@code Config.groovy}
0137 * <p/>
0138 * <pre>
0139 * mvcGroups {
0140 * foo {
0141 * model = 'com.acme.FooModel'
0142 * view = 'com.acme.FooView'
0143 * controller = 'com.acme.FooController'
0144 * }
0145 * bar {
0146 * model = 'com.acme.FooModel'
0147 * view = 'com.acme.BarView'
0148 * controller = 'com.acme.BarController'
0149 * }
0150 * }
0151 * </pre>
0152 * <p/>
0153 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0154 * instance by creating the groups in the following way:
0155 * <p/>
0156 * <pre>
0157 * MVCGroup fooGroup = createMVCGroup('foo')
0158 * MVCGroup barGroup = createMVCGroup('bar', model: fooGroup.model)
0159 * assert fooGroup.model == barGroup.model
0160 * </pre>
0161 *
0162 * @param args any useful values that can be set as properties on each MVC member or that
0163 * identify a member that can be shared with other groups.
0164 * @param mvcType the type of group to build.
0165 *
0166 * @return an MVCGroup instance of the desired type
0167 *
0168 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0169 * configuration or if a group with the same mvcId exists already.
0170 */
0171 @Nonnull
0172 MVCGroup createMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType);
0173
0174 /**
0175 * Instantiates an MVC group of the specified type with additional variables.<p>
0176 * MVC groups must be previously configured with the application's metadata
0177 * before they can be used. This registration process usually takes place automatically
0178 * at boot time. The type of the group can be normally found in the application's
0179 * configuration file.<p>
0180 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0181 * scenarios <ul>
0182 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0183 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0184 * on any MVC member of the group.</li>
0185 * </ul>
0186 * <p/>
0187 * For example, with the following entry available in {@code Config.groovy}
0188 * <p/>
0189 * <pre>
0190 * mvcGroups {
0191 * foo {
0192 * model = 'com.acme.FooModel'
0193 * view = 'com.acme.FooView'
0194 * controller = 'com.acme.FooController'
0195 * }
0196 * bar {
0197 * model = 'com.acme.FooModel'
0198 * view = 'com.acme.BarView'
0199 * controller = 'com.acme.BarController'
0200 * }
0201 * }
0202 * </pre>
0203 * <p/>
0204 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0205 * instance by creating the groups in the following way:
0206 * <p/>
0207 * <pre>
0208 * MVCGroup fooGroup = createMVCGroup('foo')
0209 * MVCGroup barGroup = createMVCGroup('bar', model: fooGroup.model)
0210 * assert fooGroup.model == barGroup.model
0211 * </pre>
0212 *
0213 * @param mvcType the type of group to build.
0214 * @param args any useful values that can be set as properties on each MVC member or that
0215 * identify a member that can be shared with other groups.
0216 *
0217 * @return an MVCGroup instance of the desired type
0218 *
0219 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0220 * configuration or if a group with the same mvcId exists already.
0221 */
0222 @Nonnull
0223 MVCGroup createMVCGroup(@Nonnull String mvcType, @Nonnull Map<String, Object> args);
0224
0225 /**
0226 * Instantiates an MVC group of the specified type with a particular name.<p>
0227 * MVC groups must be previously configured with the application's metadata
0228 * before they can be used. This registration process usually takes place automatically
0229 * at boot time. The type of the group can be normally found in the application's
0230 * configuration file.<p>
0231 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0232 * scenarios <ul>
0233 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0234 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0235 * on any MVC member of the group.</li>
0236 * </ul>
0237 * <p/>
0238 * For example, with the following entry available in {@code Config.groovy}
0239 * <p/>
0240 * <pre>
0241 * mvcGroups {
0242 * foo {
0243 * model = 'com.acme.FooModel'
0244 * view = 'com.acme.FooView'
0245 * controller = 'com.acme.FooController'
0246 * }
0247 * }
0248 * </pre>
0249 * <p/>
0250 * We can create two instances of the same group that share the same model instance in the following way:
0251 * <p/>
0252 * <pre>
0253 * MVCGroup fooGroup1 = createMVCGroup('foo', 'foo1')
0254 * MVCGroup fooGroup2 = createMVCGroup('foo', 'foo2', model: fooGroup1.model)
0255 * assert fooGroup1.model == fooGroup2.model
0256 * </pre>
0257 * <p/>
0258 * MVC groups must have an unique name.
0259 *
0260 * @param args any useful values that can be set as properties on each MVC member or that
0261 * identify a member that can be shared with other groups.
0262 * @param mvcType the type of group to build.
0263 * @param mvcId the name to assign to the built group.
0264 *
0265 * @return an MVCGroup instance of the desired type
0266 *
0267 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0268 * configuration or if a group with the same mvcId exists already.
0269 */
0270 @Nonnull
0271 MVCGroup createMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId);
0272
0273 /**
0274 * Instantiates an MVC group of the specified type with a particular name.<p>
0275 * MVC groups must be previously configured with the application's metadata
0276 * before they can be used. This registration process usually takes place automatically
0277 * at boot time. The type of the group can be normally found in the application's
0278 * configuration file.<p>
0279 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0280 * scenarios <ul>
0281 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0282 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0283 * on any MVC member of the group.</li>
0284 * </ul>
0285 * <p/>
0286 * For example, with the following entry available in {@code Config.groovy}
0287 * <p/>
0288 * <pre>
0289 * mvcGroups {
0290 * foo {
0291 * model = 'com.acme.FooModel'
0292 * view = 'com.acme.FooView'
0293 * controller = 'com.acme.FooController'
0294 * }
0295 * }
0296 * </pre>
0297 * <p/>
0298 * We can create two instances of the same group that share the same model instance in the following way:
0299 * <p/>
0300 * <pre>
0301 * MVCGroup fooGroup1 = createMVCGroup('foo', 'foo1')
0302 * MVCGroup fooGroup2 = createMVCGroup('foo', 'foo2', model: fooGroup1.model)
0303 * assert fooGroup1.model == fooGroup2.model
0304 * </pre>
0305 * <p/>
0306 * MVC groups must have an unique name.
0307 *
0308 * @param mvcType the type of group to build.
0309 * @param mvcId the name to assign to the built group.
0310 * @param args any useful values that can be set as properties on each MVC member or that
0311 * identify a member that can be shared with other groups.
0312 *
0313 * @return an MVCGroup instance of the desired type
0314 *
0315 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0316 * configuration or if a group with the same mvcId exists already.
0317 */
0318 @Nonnull
0319 MVCGroup createMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args);
0320
0321 /**
0322 * Instantiates an MVC group of the specified type.<p>
0323 * MVC groups must be previously configured with the application's metadata
0324 * before they can be used. This registration process usually takes place automatically
0325 * at boot time. The type of the group can be normally found in the application's
0326 * configuration file.<p>
0327 * For example, with the following entry available in {@code Config.groovy}
0328 * <p/>
0329 * <pre>
0330 * mvcGroups {
0331 * foo {
0332 * model = 'com.acme.FooModel'
0333 * view = 'com.acme.FooView'
0334 * controller = 'com.acme.FooController'
0335 * }
0336 * }
0337 * </pre>
0338 * <p/>
0339 * An instance of the "foo" group can be created as follows
0340 * <p/>
0341 * <pre>
0342 * FooMVCGroup fooGroup = createMVCGroup(FooMVCGroup)
0343 * assert (fooGroup.controller instanceof FooController)
0344 * </pre>
0345 *
0346 * @param mvcType the type of group to build.
0347 *
0348 * @return an MVCGroup instance of the desired type
0349 *
0350 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0351 * configuration or if a group with the same mvcId exists already.
0352 * @since 2.11.0
0353 */
0354 @Nonnull
0355 <MVC extends TypedMVCGroup> MVC createMVCGroup(@Nonnull Class<? extends MVC> mvcType);
0356
0357 /**
0358 * Instantiates an MVC group of the specified type with a particular name.<p>
0359 * MVC groups must be previously configured with the application's metadata
0360 * before they can be used. This registration process usually takes place automatically
0361 * at boot time. The type of the group can be normally found in the application's
0362 * configuration file.<p>
0363 * For example, with the following entry available in {@code Config.groovy}
0364 * <p/>
0365 * <pre>
0366 * mvcGroups {
0367 * foo {
0368 * model = 'com.acme.FooModel'
0369 * view = 'com.acme.FooView'
0370 * controller = 'com.acme.FooController'
0371 * }
0372 * }
0373 * </pre>
0374 * <p/>
0375 * An instance of the "foo" group can be created as follows
0376 * <p/>
0377 * <pre>
0378 * FooMVCGroup fooGroup = createMVCGroup(FooMVCGroup, 'foo' + System.currentTimeMillis())
0379 * assert (fooGroup.controller instanceof FooController)
0380 * </pre>
0381 * <p/>
0382 * MVC groups must have an unique name.
0383 *
0384 * @param mvcType the type of group to build.
0385 * @param mvcId the name to assign to the built group.
0386 *
0387 * @return an MVCGroup instance of the desired type
0388 *
0389 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0390 * configuration or if a group with the same mvcId exists already.
0391 * @since 2.11.0
0392 */
0393 @Nonnull
0394 <MVC extends TypedMVCGroup> MVC createMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId);
0395
0396 /**
0397 * Instantiates an MVC group of the specified type with additional variables.<p>
0398 * MVC groups must be previously configured with the application's metadata
0399 * before they can be used. This registration process usually takes place automatically
0400 * at boot time. The type of the group can be normally found in the application's
0401 * configuration file.<p>
0402 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0403 * scenarios <ul>
0404 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0405 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0406 * on any MVC member of the group.</li>
0407 * </ul>
0408 * <p/>
0409 * For example, with the following entry available in {@code Config.groovy}
0410 * <p/>
0411 * <pre>
0412 * mvcGroups {
0413 * foo {
0414 * model = 'com.acme.FooModel'
0415 * view = 'com.acme.FooView'
0416 * controller = 'com.acme.FooController'
0417 * }
0418 * bar {
0419 * model = 'com.acme.FooModel'
0420 * view = 'com.acme.BarView'
0421 * controller = 'com.acme.BarController'
0422 * }
0423 * }
0424 * </pre>
0425 * <p/>
0426 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0427 * instance by creating the groups in the following way:
0428 * <p/>
0429 * <pre>
0430 * FooMVCGroup fooGroup = createMVCGroup(FooMVCGroup)
0431 * BarMVCGroup barGroup = createMVCGroup(BarMVCGroup, model: fooGroup.model)
0432 * assert fooGroup.model == barGroup.model
0433 * </pre>
0434 *
0435 * @param args any useful values that can be set as properties on each MVC member or that
0436 * identify a member that can be shared with other groups.
0437 * @param mvcType the type of group to build.
0438 *
0439 * @return an MVCGroup instance of the desired type
0440 *
0441 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0442 * configuration or if a group with the same mvcId exists already.
0443 * @since 2.11.0
0444 */
0445 @Nonnull
0446 <MVC extends TypedMVCGroup> MVC createMVCGroup(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType);
0447
0448 /**
0449 * Instantiates an MVC group of the specified type with additional variables.<p>
0450 * MVC groups must be previously configured with the application's metadata
0451 * before they can be used. This registration process usually takes place automatically
0452 * at boot time. The type of the group can be normally found in the application's
0453 * configuration file.<p>
0454 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0455 * scenarios <ul>
0456 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0457 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0458 * on any MVC member of the group.</li>
0459 * </ul>
0460 * <p/>
0461 * For example, with the following entry available in {@code Config.groovy}
0462 * <p/>
0463 * <pre>
0464 * mvcGroups {
0465 * foo {
0466 * model = 'com.acme.FooModel'
0467 * view = 'com.acme.FooView'
0468 * controller = 'com.acme.FooController'
0469 * }
0470 * bar {
0471 * model = 'com.acme.FooModel'
0472 * view = 'com.acme.BarView'
0473 * controller = 'com.acme.BarController'
0474 * }
0475 * }
0476 * </pre>
0477 * <p/>
0478 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0479 * instance by creating the groups in the following way:
0480 * <p/>
0481 * <pre>
0482 * FooMVCGroup fooGroup = createMVCGroup(FooMVCGroup)
0483 * BarMVCGroup barGroup = createMVCGroup(BarMVCGroup, model: fooGroup.model)
0484 * assert fooGroup.model == barGroup.model
0485 * </pre>
0486 *
0487 * @param mvcType the type of group to build.
0488 * @param args any useful values that can be set as properties on each MVC member or that
0489 * identify a member that can be shared with other groups.
0490 *
0491 * @return an MVCGroup instance of the desired type
0492 *
0493 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0494 * configuration or if a group with the same mvcId exists already.
0495 * @since 2.11.0
0496 */
0497 @Nonnull
0498 <MVC extends TypedMVCGroup> MVC createMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull Map<String, Object> args);
0499
0500 /**
0501 * Instantiates an MVC group of the specified type with a particular name.<p>
0502 * MVC groups must be previously configured with the application's metadata
0503 * before they can be used. This registration process usually takes place automatically
0504 * at boot time. The type of the group can be normally found in the application's
0505 * configuration file.<p>
0506 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0507 * scenarios <ul>
0508 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0509 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0510 * on any MVC member of the group.</li>
0511 * </ul>
0512 * <p/>
0513 * For example, with the following entry available in {@code Config.groovy}
0514 * <p/>
0515 * <pre>
0516 * mvcGroups {
0517 * foo {
0518 * model = 'com.acme.FooModel'
0519 * view = 'com.acme.FooView'
0520 * controller = 'com.acme.FooController'
0521 * }
0522 * }
0523 * </pre>
0524 * <p/>
0525 * We can create two instances of the same group that share the same model instance in the following way:
0526 * <p/>
0527 * <pre>
0528 * FooMVCGroup fooGroup1 = createMVCGroup(FooMVCGroup, 'foo1')
0529 * FooMVCGroup fooGroup2 = createMVCGroup(FooMVCGroup, 'foo2', model: fooGroup1.model)
0530 * assert fooGroup1.model == fooGroup2.model
0531 * </pre>
0532 * <p/>
0533 * MVC groups must have an unique name.
0534 *
0535 * @param args any useful values that can be set as properties on each MVC member or that
0536 * identify a member that can be shared with other groups.
0537 * @param mvcType the type of group to build.
0538 * @param mvcId the name to assign to the built group.
0539 *
0540 * @return an MVCGroup instance of the desired type
0541 *
0542 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0543 * configuration or if a group with the same mvcId exists already.
0544 * @since 2.11.0
0545 */
0546 @Nonnull
0547 <MVC extends TypedMVCGroup> MVC createMVCGroup(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId);
0548
0549 /**
0550 * Instantiates an MVC group of the specified type with a particular name.<p>
0551 * MVC groups must be previously configured with the application's metadata
0552 * before they can be used. This registration process usually takes place automatically
0553 * at boot time. The type of the group can be normally found in the application's
0554 * configuration file.<p>
0555 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0556 * scenarios <ul>
0557 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0558 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0559 * on any MVC member of the group.</li>
0560 * </ul>
0561 * <p/>
0562 * For example, with the following entry available in {@code Config.groovy}
0563 * <p/>
0564 * <pre>
0565 * mvcGroups {
0566 * foo {
0567 * model = 'com.acme.FooModel'
0568 * view = 'com.acme.FooView'
0569 * controller = 'com.acme.FooController'
0570 * }
0571 * }
0572 * </pre>
0573 * <p/>
0574 * We can create two instances of the same group that share the same model instance in the following way:
0575 * <p/>
0576 * <pre>
0577 * FooMVCGroup fooGroup1 = createMVCGroup(FooMVCGroup, 'foo1')
0578 * FooMVCGroup fooGroup2 = createMVCGroup(FooMVCGroup, 'foo2', model: fooGroup1.model)
0579 * assert fooGroup1.model == fooGroup2.model
0580 * </pre>
0581 * <p/>
0582 * MVC groups must have an unique name.
0583 *
0584 * @param mvcType the type of group to build.
0585 * @param mvcId the name to assign to the built group.
0586 * @param args any useful values that can be set as properties on each MVC member or that
0587 * identify a member that can be shared with other groups.
0588 *
0589 * @return an MVCGroup instance of the desired type
0590 *
0591 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0592 * configuration or if a group with the same mvcId exists already.
0593 * @since 2.11.0
0594 */
0595 @Nonnull
0596 <MVC extends TypedMVCGroup> MVC createMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args);
0597
0598 /**
0599 * Instantiates an MVC group of the specified type returning only the MVC parts.<p>
0600 * MVC groups must be previously configured with the application's metadata
0601 * before they can be used. This registration process usually takes place automatically
0602 * at boot time. The type of the group can be normally found in the application's
0603 * configuration file.<p>
0604 * For example, with the following entry available in {@code Config.groovy}
0605 * <p/>
0606 * <pre>
0607 * mvcGroups {
0608 * foo {
0609 * model = 'com.acme.FooModel'
0610 * view = 'com.acme.FooView'
0611 * controller = 'com.acme.FooController'
0612 * }
0613 * }
0614 * </pre>
0615 * <p/>
0616 * An instance of the "foo" group can be created as follows
0617 * <p/>
0618 * <pre>
0619 * def (m, v, c) = createMVC('foo')
0620 * assert (c instanceof FooController)
0621 * </pre>
0622 *
0623 * @param mvcType the type of group to build.
0624 *
0625 * @return a List with the canonical MVC members of the group
0626 *
0627 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0628 * configuration or if a group with the same mvcId exists already.
0629 */
0630 @Nonnull
0631 List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType);
0632
0633 /**
0634 * Instantiates an MVC group of the specified type with additional variables.<p>
0635 * MVC groups must be previously configured with the application's metadata
0636 * before they can be used. This registration process usually takes place automatically
0637 * at boot time. The type of the group can be normally found in the application's
0638 * configuration file.<p>
0639 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0640 * scenarios <ul>
0641 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0642 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0643 * on any MVC member of the group.</li>
0644 * </ul>
0645 * <p/>
0646 * For example, with the following entry available in {@code Config.groovy}
0647 * <p/>
0648 * <pre>
0649 * mvcGroups {
0650 * foo {
0651 * model = 'com.acme.FooModel'
0652 * view = 'com.acme.FooView'
0653 * controller = 'com.acme.FooController'
0654 * }
0655 * bar {
0656 * model = 'com.acme.FooModel'
0657 * view = 'com.acme.BarView'
0658 * controller = 'com.acme.BarController'
0659 * }
0660 * }
0661 * </pre>
0662 * <p/>
0663 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0664 * instance by creating the groups in the following way:
0665 * <p/>
0666 * <pre>
0667 * def (m1, v1, c1) = createMVC('foo')
0668 * def (m2, v2, c2) = createMVC('bar', model: m1)
0669 * assert fm1 == m2
0670 * </pre>
0671 *
0672 * @param args any useful values that can be set as properties on each MVC member or that
0673 * identify a member that can be shared with other groups.
0674 * @param mvcType the type of group to build.
0675 *
0676 * @return a List with the canonical MVC members of the group
0677 *
0678 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0679 * configuration or if a group with the same mvcId exists already.
0680 */
0681 @Nonnull
0682 List<? extends GriffonMvcArtifact> createMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType);
0683
0684 /**
0685 * Instantiates an MVC group of the specified type with additional variables.<p>
0686 * MVC groups must be previously configured with the application's metadata
0687 * before they can be used. This registration process usually takes place automatically
0688 * at boot time. The type of the group can be normally found in the application's
0689 * configuration file.<p>
0690 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0691 * scenarios <ul>
0692 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0693 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0694 * on any MVC member of the group.</li>
0695 * </ul>
0696 * <p/>
0697 * For example, with the following entry available in {@code Config.groovy}
0698 * <p/>
0699 * <pre>
0700 * mvcGroups {
0701 * foo {
0702 * model = 'com.acme.FooModel'
0703 * view = 'com.acme.FooView'
0704 * controller = 'com.acme.FooController'
0705 * }
0706 * bar {
0707 * model = 'com.acme.FooModel'
0708 * view = 'com.acme.BarView'
0709 * controller = 'com.acme.BarController'
0710 * }
0711 * }
0712 * </pre>
0713 * <p/>
0714 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0715 * instance by creating the groups in the following way:
0716 * <p/>
0717 * <pre>
0718 * def (m1, v1, c1) = createMVC('foo')
0719 * def (m2, v2, c2) = createMVC('bar', model: m1)
0720 * assert fm1 == m2
0721 * </pre>
0722 *
0723 * @param mvcType the type of group to build.
0724 * @param args any useful values that can be set as properties on each MVC member or that
0725 * identify a member that can be shared with other groups.
0726 *
0727 * @return a List with the canonical MVC members of the group
0728 *
0729 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0730 * configuration or if a group with the same mvcId exists already.
0731 */
0732 @Nonnull
0733 List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType, @Nonnull Map<String, Object> args);
0734
0735 /**
0736 * Instantiates an MVC group of the specified type with a particular name.<p>
0737 * MVC groups must be previously configured with the application's metadata
0738 * before they can be used. This registration process usually takes place automatically
0739 * at boot time. The type of the group can be normally found in the application's
0740 * configuration file.<p>
0741 * For example, with the following entry available in {@code Config.groovy}
0742 * <p/>
0743 * <pre>
0744 * mvcGroups {
0745 * foo {
0746 * model = 'com.acme.FooModel'
0747 * view = 'com.acme.FooView'
0748 * controller = 'com.acme.FooController'
0749 * }
0750 * }
0751 * </pre>
0752 * <p/>
0753 * An instance of the "foo" group can be created as follows
0754 * <p/>
0755 * <pre>
0756 * def (m, v, c) = createMVC('foo', 'foo' + System.currentTimeMillis())
0757 * assert (c instanceof FooController)
0758 * </pre>
0759 * <p/>
0760 * MVC groups must have an unique name.
0761 *
0762 * @param mvcType the type of group to build.
0763 * @param mvcId the name to assign to the built group.
0764 *
0765 * @return a List with the canonical MVC members of the group
0766 *
0767 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0768 * configuration or if a group with the same mvcId exists already.
0769 */
0770 @Nonnull
0771 List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType, @Nonnull String mvcId);
0772
0773 /**
0774 * Instantiates an MVC group of the specified type with a particular name.<p>
0775 * MVC groups must be previously configured with the application's metadata
0776 * before they can be used. This registration process usually takes place automatically
0777 * at boot time. The type of the group can be normally found in the application's
0778 * configuration file.<p>
0779 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0780 * scenarios <ul>
0781 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0782 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0783 * on any MVC member of the group.</li>
0784 * </ul>
0785 * <p/>
0786 * For example, with the following entry available in {@code Config.groovy}
0787 * <p/>
0788 * <pre>
0789 * mvcGroups {
0790 * foo {
0791 * model = 'com.acme.FooModel'
0792 * view = 'com.acme.FooView'
0793 * controller = 'com.acme.FooController'
0794 * }
0795 * }
0796 * </pre>
0797 * <p/>
0798 * We can create two instances of the same group that share the same model instance in the following way:
0799 * <p/>
0800 * <pre>
0801 * def (m1, v1, c1) = createMVC('foo', 'foo1')
0802 * def (m2, v2, c2) = createMVC('foo', 'foo2', model: m1)
0803 * assert fm1 == m2
0804 * </pre>
0805 * <p/>
0806 * MVC groups must have an unique name.
0807 *
0808 * @param args any useful values that can be set as properties on each MVC member or that
0809 * identify a member that can be shared with other groups.
0810 * @param mvcType the type of group to build.
0811 * @param mvcId the name to assign to the built group.
0812 *
0813 * @return a List with the canonical MVC members of the group
0814 *
0815 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0816 * configuration or if a group with the same mvcId exists already.
0817 */
0818 @Nonnull
0819 List<? extends GriffonMvcArtifact> createMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId);
0820
0821 /**
0822 * Instantiates an MVC group of the specified type with a particular name.<p>
0823 * MVC groups must be previously configured with the application's metadata
0824 * before they can be used. This registration process usually takes place automatically
0825 * at boot time. The type of the group can be normally found in the application's
0826 * configuration file.<p>
0827 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0828 * scenarios <ul>
0829 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0830 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0831 * on any MVC member of the group.</li>
0832 * </ul>
0833 * <p/>
0834 * For example, with the following entry available in {@code Config.groovy}
0835 * <p/>
0836 * <pre>
0837 * mvcGroups {
0838 * foo {
0839 * model = 'com.acme.FooModel'
0840 * view = 'com.acme.FooView'
0841 * controller = 'com.acme.FooController'
0842 * }
0843 * }
0844 * </pre>
0845 * <p/>
0846 * We can create two instances of the same group that share the same model instance in the following way:
0847 * <p/>
0848 * <pre>
0849 * def (m1, v1, c1) = createMVC('foo', 'foo1')
0850 * def (m2, v2, c2) = createMVC('foo', 'foo2', model: m1)
0851 * assert fm1 == m2
0852 * </pre>
0853 * <p/>
0854 * MVC groups must have an unique name.
0855 *
0856 * @param mvcType the type of group to build.
0857 * @param mvcId the name to assign to the built group.
0858 * @param args any useful values that can be set as properties on each MVC member or that
0859 * identify a member that can be shared with other groups.
0860 *
0861 * @return a List with the canonical MVC members of the group
0862 *
0863 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0864 * configuration or if a group with the same mvcId exists already.
0865 */
0866 @Nonnull
0867 List<? extends GriffonMvcArtifact> createMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args);
0868
0869 /**
0870 * Instantiates an MVC group of the specified type returning only the MVC parts.<p>
0871 * MVC groups must be previously configured with the application's metadata
0872 * before they can be used. This registration process usually takes place automatically
0873 * at boot time. The type of the group can be normally found in the application's
0874 * configuration file.<p>
0875 * For example, with the following entry available in {@code Config.groovy}
0876 * <p/>
0877 * <pre>
0878 * mvcGroups {
0879 * foo {
0880 * model = 'com.acme.FooModel'
0881 * view = 'com.acme.FooView'
0882 * controller = 'com.acme.FooController'
0883 * }
0884 * }
0885 * </pre>
0886 * <p/>
0887 * An instance of the "foo" group can be created as follows
0888 * <p/>
0889 * <pre>
0890 * def (m, v, c) = createMVC(FooMVCGroup)
0891 * assert (c instanceof FooController)
0892 * </pre>
0893 *
0894 * @param mvcType the type of group to build.
0895 *
0896 * @return a List with the canonical MVC members of the group
0897 *
0898 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0899 * configuration or if a group with the same mvcId exists already.
0900 * @since 2.11.0
0901 */
0902 @Nonnull
0903 <MVC extends TypedMVCGroup> List<? extends GriffonMvcArtifact> createMVC(@Nonnull Class<? extends MVC> mvcType);
0904
0905 /**
0906 * Instantiates an MVC group of the specified type with additional variables.<p>
0907 * MVC groups must be previously configured with the application's metadata
0908 * before they can be used. This registration process usually takes place automatically
0909 * at boot time. The type of the group can be normally found in the application's
0910 * configuration file.<p>
0911 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0912 * scenarios <ul>
0913 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0914 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0915 * on any MVC member of the group.</li>
0916 * </ul>
0917 * <p/>
0918 * For example, with the following entry available in {@code Config.groovy}
0919 * <p/>
0920 * <pre>
0921 * mvcGroups {
0922 * foo {
0923 * model = 'com.acme.FooModel'
0924 * view = 'com.acme.FooView'
0925 * controller = 'com.acme.FooController'
0926 * }
0927 * bar {
0928 * model = 'com.acme.FooModel'
0929 * view = 'com.acme.BarView'
0930 * controller = 'com.acme.BarController'
0931 * }
0932 * }
0933 * </pre>
0934 * <p/>
0935 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0936 * instance by creating the groups in the following way:
0937 * <p/>
0938 * <pre>
0939 * def (m1, v1, c1) = createMVC(FooMVCGroup)
0940 * def (m2, v2, c2) = createMVC(BarMVCGroup, model: m1)
0941 * assert fm1 == m2
0942 * </pre>
0943 *
0944 * @param args any useful values that can be set as properties on each MVC member or that
0945 * identify a member that can be shared with other groups.
0946 * @param mvcType the type of group to build.
0947 *
0948 * @return a List with the canonical MVC members of the group
0949 *
0950 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
0951 * configuration or if a group with the same mvcId exists already.
0952 * @since 2.11.0
0953 */
0954 @Nonnull
0955 <MVC extends TypedMVCGroup> List<? extends GriffonMvcArtifact> createMVC(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType);
0956
0957 /**
0958 * Instantiates an MVC group of the specified type with additional variables.<p>
0959 * MVC groups must be previously configured with the application's metadata
0960 * before they can be used. This registration process usually takes place automatically
0961 * at boot time. The type of the group can be normally found in the application's
0962 * configuration file.<p>
0963 * The <tt>args</tt> Map can contain any value that will be used in one of the following
0964 * scenarios <ul>
0965 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
0966 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
0967 * on any MVC member of the group.</li>
0968 * </ul>
0969 * <p/>
0970 * For example, with the following entry available in {@code Config.groovy}
0971 * <p/>
0972 * <pre>
0973 * mvcGroups {
0974 * foo {
0975 * model = 'com.acme.FooModel'
0976 * view = 'com.acme.FooView'
0977 * controller = 'com.acme.FooController'
0978 * }
0979 * bar {
0980 * model = 'com.acme.FooModel'
0981 * view = 'com.acme.BarView'
0982 * controller = 'com.acme.BarController'
0983 * }
0984 * }
0985 * </pre>
0986 * <p/>
0987 * Notice that groups "foo" and "bar share the same model type, We can make them share the same model
0988 * instance by creating the groups in the following way:
0989 * <p/>
0990 * <pre>
0991 * def (m1, v1, c1) = createMVC(FooMVCGroup)
0992 * def (m2, v2, c2) = createMVC(BarMVCGroup, model: m1)
0993 * assert fm1 == m2
0994 * </pre>
0995 *
0996 * @param mvcType the type of group to build.
0997 * @param args any useful values that can be set as properties on each MVC member or that
0998 * identify a member that can be shared with other groups.
0999 *
1000 * @return a List with the canonical MVC members of the group
1001 *
1002 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1003 * configuration or if a group with the same mvcId exists already.
1004 * @since 2.11.0
1005 */
1006 @Nonnull
1007 <MVC extends TypedMVCGroup> List<? extends GriffonMvcArtifact> createMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull Map<String, Object> args);
1008
1009 /**
1010 * Instantiates an MVC group of the specified type with a particular name.<p>
1011 * MVC groups must be previously configured with the application's metadata
1012 * before they can be used. This registration process usually takes place automatically
1013 * at boot time. The type of the group can be normally found in the application's
1014 * configuration file.<p>
1015 * For example, with the following entry available in {@code Config.groovy}
1016 * <p/>
1017 * <pre>
1018 * mvcGroups {
1019 * foo {
1020 * model = 'com.acme.FooModel'
1021 * view = 'com.acme.FooView'
1022 * controller = 'com.acme.FooController'
1023 * }
1024 * }
1025 * </pre>
1026 * <p/>
1027 * An instance of the "foo" group can be created as follows
1028 * <p/>
1029 * <pre>
1030 * def (m, v, c) = createMVC(FooMVCGroup, 'foo' + System.currentTimeMillis())
1031 * assert (c instanceof FooController)
1032 * </pre>
1033 * <p/>
1034 * MVC groups must have an unique name.
1035 *
1036 * @param mvcType the type of group to build.
1037 * @param mvcId the name to assign to the built group.
1038 *
1039 * @return a List with the canonical MVC members of the group
1040 *
1041 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1042 * configuration or if a group with the same mvcId exists already.
1043 * @since 2.11.0
1044 */
1045 @Nonnull
1046 <MVC extends TypedMVCGroup> List<? extends GriffonMvcArtifact> createMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId);
1047
1048 /**
1049 * Instantiates an MVC group of the specified type with a particular name.<p>
1050 * MVC groups must be previously configured with the application's metadata
1051 * before they can be used. This registration process usually takes place automatically
1052 * at boot time. The type of the group can be normally found in the application's
1053 * configuration file.<p>
1054 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1055 * scenarios <ul>
1056 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1057 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1058 * on any MVC member of the group.</li>
1059 * </ul>
1060 * <p/>
1061 * For example, with the following entry available in {@code Config.groovy}
1062 * <p/>
1063 * <pre>
1064 * mvcGroups {
1065 * foo {
1066 * model = 'com.acme.FooModel'
1067 * view = 'com.acme.FooView'
1068 * controller = 'com.acme.FooController'
1069 * }
1070 * }
1071 * </pre>
1072 * <p/>
1073 * We can create two instances of the same group that share the same model instance in the following way:
1074 * <p/>
1075 * <pre>
1076 * def (m1, v1, c1) = createMVC(FooMVCGroup, 'foo1')
1077 * def (m2, v2, c2) = createMVC(FooMVCGroup, 'foo2', model: m1)
1078 * assert fm1 == m2
1079 * </pre>
1080 * <p/>
1081 * MVC groups must have an unique name.
1082 *
1083 * @param args any useful values that can be set as properties on each MVC member or that
1084 * identify a member that can be shared with other groups.
1085 * @param mvcType the type of group to build.
1086 * @param mvcId the name to assign to the built group.
1087 *
1088 * @return a List with the canonical MVC members of the group
1089 *
1090 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1091 * configuration or if a group with the same mvcId exists already.
1092 * @since 2.11.0
1093 */
1094 @Nonnull
1095 <MVC extends TypedMVCGroup> List<? extends GriffonMvcArtifact> createMVC(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId);
1096
1097 /**
1098 * Instantiates an MVC group of the specified type with a particular name.<p>
1099 * MVC groups must be previously configured with the application's metadata
1100 * before they can be used. This registration process usually takes place automatically
1101 * at boot time. The type of the group can be normally found in the application's
1102 * configuration file.<p>
1103 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1104 * scenarios <ul>
1105 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1106 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1107 * on any MVC member of the group.</li>
1108 * </ul>
1109 * <p/>
1110 * For example, with the following entry available in {@code Config.groovy}
1111 * <p/>
1112 * <pre>
1113 * mvcGroups {
1114 * foo {
1115 * model = 'com.acme.FooModel'
1116 * view = 'com.acme.FooView'
1117 * controller = 'com.acme.FooController'
1118 * }
1119 * }
1120 * </pre>
1121 * <p/>
1122 * We can create two instances of the same group that share the same model instance in the following way:
1123 * <p/>
1124 * <pre>
1125 * def (m1, v1, c1) = createMVC(FooMVCGroup, 'foo1')
1126 * def (m2, v2, c2) = createMVC(FooMVCGroup, 'foo2', model: m1)
1127 * assert fm1 == m2
1128 * </pre>
1129 * <p/>
1130 * MVC groups must have an unique name.
1131 *
1132 * @param mvcType the type of group to build.
1133 * @param mvcId the name to assign to the built group.
1134 * @param args any useful values that can be set as properties on each MVC member or that
1135 * identify a member that can be shared with other groups.
1136 *
1137 * @return a List with the canonical MVC members of the group
1138 *
1139 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1140 * configuration or if a group with the same mvcId exists already.
1141 * @since 2.11.0
1142 */
1143 @Nonnull
1144 <MVC extends TypedMVCGroup> List<? extends GriffonMvcArtifact> createMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args);
1145
1146 /**
1147 * Destroys an MVC group identified by a particular name.<p>
1148 * <b>ATTENTION:</b> make sure to call the super implementation if you override this method
1149 * otherwise group references will not be kept up to date.
1150 *
1151 * @param mvcId the name of the group to destroy and dispose.
1152 */
1153 void destroyMVCGroup(@Nonnull String mvcId);
1154
1155 /**
1156 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1157 * <p>This method is of particular interest when working with short lived MVC groups such as
1158 * those used to build dialogs.<p/>
1159 * <p>MVC groups must be previously configured with the application's metadata
1160 * before they can be used. This registration process usually takes place automatically
1161 * at boot time. The type of the group can be normally found in the application's
1162 * configuration file.</p>
1163 * For example, with the following entry available in {@code Config.groovy}
1164 * <p/>
1165 * <pre>
1166 * mvcGroups {
1167 * foo {
1168 * model = 'com.acme.FooModel'
1169 * view = 'com.acme.FooView'
1170 * controller = 'com.acme.FooController'
1171 * }
1172 * }
1173 * </pre>
1174 * <p/>
1175 * An instance of the "foo" group can be used as follows
1176 * <p/>
1177 * <pre>
1178 * withMVC("foo", new MVCFunction<FooModel, FooView, FooController>() {
1179 * public void call(FooModel m, FooView v, FooController c) {
1180 * m.setSomeProperty(someValue);
1181 * c.invokeAnAction();
1182 * }
1183 * });
1184 * </pre>
1185 *
1186 * @param mvcType the type of group to build.
1187 * @param handler a code block used to configure and manage the instantiated group
1188 *
1189 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1190 * configuration
1191 */
1192 <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull MVCFunction<M, V, C> handler);
1193
1194 /**
1195 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1196 * <p>This method is of particular interest when working with short lived MVC groups such as
1197 * those used to build dialogs.<p/>
1198 * <p>MVC groups must be previously configured with the application's metadata
1199 * before they can be used. This registration process usually takes place automatically
1200 * at boot time. The type of the group can be normally found in the application's
1201 * configuration file.</p>
1202 * For example, with the following entry available in {@code Config.groovy}
1203 * <p/>
1204 * <pre>
1205 * mvcGroups {
1206 * foo {
1207 * model = 'com.acme.FooModel'
1208 * view = 'com.acme.FooView'
1209 * controller = 'com.acme.FooController'
1210 * }
1211 * }
1212 * </pre>
1213 * <p/>
1214 * An instance of the "foo" group can be used as follows
1215 * <p/>
1216 * <pre>
1217 * withMVC("foo", "foo1", new MVCFunction<FooModel, FooView, FooController>() {
1218 * public void call(FooModel m, FooView v, FooController c) {
1219 * m.setSomeProperty(someValue);
1220 * c.invokeAnAction();
1221 * }
1222 * });
1223 * </pre>
1224 * <p/>
1225 * MVC groups must have an unique name.
1226 *
1227 * @param mvcType the type of group to build.
1228 * @param mvcId the name to assign to the built group.
1229 * @param handler a code block used to configure and manage the instantiated group
1230 *
1231 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1232 * configuration
1233 */
1234 <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<M, V, C> handler);
1235
1236 /**
1237 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1238 * <p>This method is of particular interest when working with short lived MVC groups such as
1239 * those used to build dialogs.<p/>
1240 * <p>MVC groups must be previously configured with the application's metadata
1241 * before they can be used. This registration process usually takes place automatically
1242 * at boot time. The type of the group can be normally found in the application's
1243 * configuration file.</p>
1244 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1245 * scenarios <ul>
1246 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1247 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1248 * on any MVC member of the group.</li>
1249 * For example, with the following entry available in {@code Config.groovy}
1250 * <p/>
1251 * <pre>
1252 * mvcGroups {
1253 * foo {
1254 * model = 'com.acme.FooModel'
1255 * view = 'com.acme.FooView'
1256 * controller = 'com.acme.FooController'
1257 * }
1258 * }
1259 * </pre>
1260 * <p/>
1261 * An instance of the "foo" group can be used as follows
1262 * <p/>
1263 * <pre>
1264 * Map<String, Object> map = ... // initialized elsewhere
1265 * withMVC("foo", "foo1", map, new MVCFunction<FooModel, FooView, FooController>() {
1266 * public void call(FooModel m, FooView v, FooController c) {
1267 * m.setSomeProperty(someValue);
1268 * c.invokeAnAction();
1269 * }
1270 * });
1271 * </pre>
1272 * <p/>
1273 * MVC groups must have an unique name.
1274 *
1275 * @param mvcType the type of group to build.
1276 * @param mvcId the name to assign to the built group.
1277 * @param args any useful values that can be set as properties on each MVC member or that
1278 * identify a member that can be shared with other groups.
1279 * @param handler a code block used to configure and manage the instantiated group
1280 *
1281 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1282 * configuration
1283 */
1284 <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args, @Nonnull MVCFunction<M, V, C> handler);
1285
1286 /**
1287 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1288 * <p>This method is of particular interest when working with short lived MVC groups such as
1289 * those used to build dialogs.<p/>
1290 * <p>MVC groups must be previously configured with the application's metadata
1291 * before they can be used. This registration process usually takes place automatically
1292 * at boot time. The type of the group can be normally found in the application's
1293 * configuration file.</p>
1294 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1295 * scenarios <ul>
1296 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1297 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1298 * on any MVC member of the group.</li>
1299 * For example, with the following entry available in {@code Config.groovy}
1300 * <p/>
1301 * <pre>
1302 * mvcGroups {
1303 * foo {
1304 * model = 'com.acme.FooModel'
1305 * view = 'com.acme.FooView'
1306 * controller = 'com.acme.FooController'
1307 * }
1308 * }
1309 * </pre>
1310 * <p/>
1311 * An instance of the "foo" group can be used as follows
1312 * <p/>
1313 * <pre>
1314 * Map<String, Object> map = ... // initialized elsewhere
1315 * withMVC("foo", "foo1", map, new MVCFunction<FooModel, FooView, FooController>() {
1316 * public void call(FooModel m, FooView v, FooController c) {
1317 * m.setSomeProperty(someValue);
1318 * c.invokeAnAction();
1319 * }
1320 * });
1321 * </pre>
1322 * <p/>
1323 * MVC groups must have an unique name.
1324 *
1325 * @param args any useful values that can be set as properties on each MVC member or that
1326 * identify a member that can be shared with other groups.
1327 * @param mvcType the type of group to build.
1328 * @param mvcId the name to assign to the built group.
1329 * @param handler a code block used to configure and manage the instantiated group
1330 *
1331 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1332 * configuration
1333 */
1334 <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<M, V, C> handler);
1335
1336 /**
1337 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1338 * <p>This method is of particular interest when working with short lived MVC groups such as
1339 * those used to build dialogs.<p/>
1340 * <p>MVC groups must be previously configured with the application's metadata
1341 * before they can be used. This registration process usually takes place automatically
1342 * at boot time. The type of the group can be normally found in the application's
1343 * configuration file.</p>
1344 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1345 * scenarios <ul>
1346 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1347 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1348 * on any MVC member of the group.</li>
1349 * For example, with the following entry available in {@code Config.groovy}
1350 * <p/>
1351 * <pre>
1352 * mvcGroups {
1353 * foo {
1354 * model = 'com.acme.FooModel'
1355 * view = 'com.acme.FooView'
1356 * controller = 'com.acme.FooController'
1357 * }
1358 * }
1359 * </pre>
1360 * <p/>
1361 * An instance of the "foo" group can be used as follows
1362 * <p/>
1363 * <pre>
1364 * Map<String, Object> map = ... // initialized elsewhere
1365 * withMVC("foo", map, new MVCFunction<FooModel, FooView, FooController>() {
1366 * public void call(FooModel m, FooView v, FooController c) {
1367 * m.setSomeProperty(someValue);
1368 * c.invokeAnAction();
1369 * }
1370 * });
1371 * </pre>
1372 *
1373 * @param mvcType the type of group to build.
1374 * @param args any useful values that can be set as properties on each MVC member or that
1375 * identify a member that can be shared with other groups.
1376 * @param handler a code block used to configure and manage the instantiated group
1377 *
1378 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1379 * configuration
1380 */
1381 <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull Map<String, Object> args, @Nonnull MVCFunction<M, V, C> handler);
1382
1383 /**
1384 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1385 * <p>This method is of particular interest when working with short lived MVC groups such as
1386 * those used to build dialogs.<p/>
1387 * <p>MVC groups must be previously configured with the application's metadata
1388 * before they can be used. This registration process usually takes place automatically
1389 * at boot time. The type of the group can be normally found in the application's
1390 * configuration file.</p>
1391 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1392 * scenarios <ul>
1393 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1394 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1395 * on any MVC member of the group.</li>
1396 * For example, with the following entry available in {@code Config.groovy}
1397 * <p/>
1398 * <pre>
1399 * mvcGroups {
1400 * foo {
1401 * model = 'com.acme.FooModel'
1402 * view = 'com.acme.FooView'
1403 * controller = 'com.acme.FooController'
1404 * }
1405 * }
1406 * </pre>
1407 * <p/>
1408 * An instance of the "foo" group can be used as follows
1409 * <p/>
1410 * <pre>
1411 * Map<String, Object> map = ... // initialized elsewhere
1412 * withMVC("foo", map, new MVCFunction<FooModel, FooView, FooController>() {
1413 * public void call(FooModel m, FooView v, FooController c) {
1414 * m.setSomeProperty(someValue);
1415 * c.invokeAnAction();
1416 * }
1417 * });
1418 * </pre>
1419 *
1420 * @param args any useful values that can be set as properties on each MVC member or that
1421 * identify a member that can be shared with other groups.
1422 * @param mvcType the type of group to build.
1423 * @param handler a code block used to configure and manage the instantiated group
1424 *
1425 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1426 * configuration
1427 */
1428 <M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull MVCFunction<M, V, C> handler);
1429
1430 /**
1431 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1432 * <p>This method is of particular interest when working with short lived MVC groups such as
1433 * those used to build dialogs.<p/>
1434 * <p>MVC groups must be previously configured with the application's metadata
1435 * before they can be used. This registration process usually takes place automatically
1436 * at boot time. The type of the group can be normally found in the application's
1437 * configuration file.</p>
1438 * For example, with the following entry available in {@code Config.groovy}
1439 * <p/>
1440 * <pre>
1441 * mvcGroups {
1442 * foo {
1443 * model = 'com.acme.FooModel'
1444 * view = 'com.acme.FooView'
1445 * controller = 'com.acme.FooController'
1446 * }
1447 * }
1448 * </pre>
1449 * <p/>
1450 * An instance of the "foo" group can be used as follows
1451 * <p/>
1452 * <pre>
1453 * withMVC(FooMVCGroup.class, new MVCFunction<FooModel, FooView, FooController>() {
1454 * public void call(FooModel m, FooView v, FooController c) {
1455 * m.setSomeProperty(someValue);
1456 * c.invokeAnAction();
1457 * }
1458 * });
1459 * </pre>
1460 *
1461 * @param mvcType the type of group to build.
1462 * @param handler a code block used to configure and manage the instantiated group
1463 *
1464 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1465 * configuration
1466 * @since 2.11.0
1467 */
1468 <MVC extends TypedMVCGroup, M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull MVCFunction<M, V, C> handler);
1469
1470 /**
1471 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1472 * <p>This method is of particular interest when working with short lived MVC groups such as
1473 * those used to build dialogs.<p/>
1474 * <p>MVC groups must be previously configured with the application's metadata
1475 * before they can be used. This registration process usually takes place automatically
1476 * at boot time. The type of the group can be normally found in the application's
1477 * configuration file.</p>
1478 * For example, with the following entry available in {@code Config.groovy}
1479 * <p/>
1480 * <pre>
1481 * mvcGroups {
1482 * foo {
1483 * model = 'com.acme.FooModel'
1484 * view = 'com.acme.FooView'
1485 * controller = 'com.acme.FooController'
1486 * }
1487 * }
1488 * </pre>
1489 * <p/>
1490 * An instance of the "foo" group can be used as follows
1491 * <p/>
1492 * <pre>
1493 * withMVC(FooMVCGroup.class, "foo1", new MVCFunction<FooModel, FooView, FooController>() {
1494 * public void call(FooModel m, FooView v, FooController c) {
1495 * m.setSomeProperty(someValue);
1496 * c.invokeAnAction();
1497 * }
1498 * });
1499 * </pre>
1500 * <p/>
1501 * MVC groups must have an unique name.
1502 *
1503 * @param mvcType the type of group to build.
1504 * @param mvcId the name to assign to the built group.
1505 * @param handler a code block used to configure and manage the instantiated group
1506 *
1507 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1508 * configuration
1509 * @since 2.11.0
1510 */
1511 <MVC extends TypedMVCGroup, M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<M, V, C> handler);
1512
1513 /**
1514 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1515 * <p>This method is of particular interest when working with short lived MVC groups such as
1516 * those used to build dialogs.<p/>
1517 * <p>MVC groups must be previously configured with the application's metadata
1518 * before they can be used. This registration process usually takes place automatically
1519 * at boot time. The type of the group can be normally found in the application's
1520 * configuration file.</p>
1521 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1522 * scenarios <ul>
1523 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1524 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1525 * on any MVC member of the group.</li>
1526 * For example, with the following entry available in {@code Config.groovy}
1527 * <p/>
1528 * <pre>
1529 * mvcGroups {
1530 * foo {
1531 * model = 'com.acme.FooModel'
1532 * view = 'com.acme.FooView'
1533 * controller = 'com.acme.FooController'
1534 * }
1535 * }
1536 * </pre>
1537 * <p/>
1538 * An instance of the "foo" group can be used as follows
1539 * <p/>
1540 * <pre>
1541 * Map<String, Object> map = ... // initialized elsewhere
1542 * withMVC(FooMVCGroup.class, "foo1", map, new MVCFunction<FooModel, FooView, FooController>() {
1543 * public void call(FooModel m, FooView v, FooController c) {
1544 * m.setSomeProperty(someValue);
1545 * c.invokeAnAction();
1546 * }
1547 * });
1548 * </pre>
1549 * <p/>
1550 * MVC groups must have an unique name.
1551 *
1552 * @param mvcType the type of group to build.
1553 * @param mvcId the name to assign to the built group.
1554 * @param args any useful values that can be set as properties on each MVC member or that
1555 * identify a member that can be shared with other groups.
1556 * @param handler a code block used to configure and manage the instantiated group
1557 *
1558 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1559 * configuration
1560 * @since 2.11.0
1561 */
1562 <MVC extends TypedMVCGroup, M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args, @Nonnull MVCFunction<M, V, C> handler);
1563
1564 /**
1565 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1566 * <p>This method is of particular interest when working with short lived MVC groups such as
1567 * those used to build dialogs.<p/>
1568 * <p>MVC groups must be previously configured with the application's metadata
1569 * before they can be used. This registration process usually takes place automatically
1570 * at boot time. The type of the group can be normally found in the application's
1571 * configuration file.</p>
1572 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1573 * scenarios <ul>
1574 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1575 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1576 * on any MVC member of the group.</li>
1577 * For example, with the following entry available in {@code Config.groovy}
1578 * <p/>
1579 * <pre>
1580 * mvcGroups {
1581 * foo {
1582 * model = 'com.acme.FooModel'
1583 * view = 'com.acme.FooView'
1584 * controller = 'com.acme.FooController'
1585 * }
1586 * }
1587 * </pre>
1588 * <p/>
1589 * An instance of the "foo" group can be used as follows
1590 * <p/>
1591 * <pre>
1592 * Map<String, Object> map = ... // initialized elsewhere
1593 * withMVC(FooMVCGroup.class, "foo1", map, new MVCFunction<FooModel, FooView, FooController>() {
1594 * public void call(FooModel m, FooView v, FooController c) {
1595 * m.setSomeProperty(someValue);
1596 * c.invokeAnAction();
1597 * }
1598 * });
1599 * </pre>
1600 * <p/>
1601 * MVC groups must have an unique name.
1602 *
1603 * @param args any useful values that can be set as properties on each MVC member or that
1604 * identify a member that can be shared with other groups.
1605 * @param mvcType the type of group to build.
1606 * @param mvcId the name to assign to the built group.
1607 * @param handler a code block used to configure and manage the instantiated group
1608 *
1609 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1610 * configuration
1611 * @since 2.11.0
1612 */
1613 <MVC extends TypedMVCGroup, M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<M, V, C> handler);
1614
1615 /**
1616 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1617 * <p>This method is of particular interest when working with short lived MVC groups such as
1618 * those used to build dialogs.<p/>
1619 * <p>MVC groups must be previously configured with the application's metadata
1620 * before they can be used. This registration process usually takes place automatically
1621 * at boot time. The type of the group can be normally found in the application's
1622 * configuration file.</p>
1623 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1624 * scenarios <ul>
1625 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1626 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1627 * on any MVC member of the group.</li>
1628 * For example, with the following entry available in {@code Config.groovy}
1629 * <p/>
1630 * <pre>
1631 * mvcGroups {
1632 * foo {
1633 * model = 'com.acme.FooModel'
1634 * view = 'com.acme.FooView'
1635 * controller = 'com.acme.FooController'
1636 * }
1637 * }
1638 * </pre>
1639 * <p/>
1640 * An instance of the "foo" group can be used as follows
1641 * <p/>
1642 * <pre>
1643 * Map<String, Object> map = ... // initialized elsewhere
1644 * withMVC(FooMVCGroup.class, map, new MVCFunction<FooModel, FooView, FooController>() {
1645 * public void call(FooModel m, FooView v, FooController c) {
1646 * m.setSomeProperty(someValue);
1647 * c.invokeAnAction();
1648 * }
1649 * });
1650 * </pre>
1651 *
1652 * @param mvcType the type of group to build.
1653 * @param args any useful values that can be set as properties on each MVC member or that
1654 * identify a member that can be shared with other groups.
1655 * @param handler a code block used to configure and manage the instantiated group
1656 *
1657 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1658 * configuration
1659 * @since 2.11.0
1660 */
1661 <MVC extends TypedMVCGroup, M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Class<? extends MVC> mvcType, @Nonnull Map<String, Object> args, @Nonnull MVCFunction<M, V, C> handler);
1662
1663 /**
1664 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1665 * <p>This method is of particular interest when working with short lived MVC groups such as
1666 * those used to build dialogs.<p/>
1667 * <p>MVC groups must be previously configured with the application's metadata
1668 * before they can be used. This registration process usually takes place automatically
1669 * at boot time. The type of the group can be normally found in the application's
1670 * configuration file.</p>
1671 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1672 * scenarios <ul>
1673 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1674 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1675 * on any MVC member of the group.</li>
1676 * For example, with the following entry available in {@code Config.groovy}
1677 * <p/>
1678 * <pre>
1679 * mvcGroups {
1680 * foo {
1681 * model = 'com.acme.FooModel'
1682 * view = 'com.acme.FooView'
1683 * controller = 'com.acme.FooController'
1684 * }
1685 * }
1686 * </pre>
1687 * <p/>
1688 * An instance of the "foo" group can be used as follows
1689 * <p/>
1690 * <pre>
1691 * Map<String, Object> map = ... // initialized elsewhere
1692 * withMVC(FooMVCGroup.class, map, new MVCFunction<FooModel, FooView, FooController>() {
1693 * public void call(FooModel m, FooView v, FooController c) {
1694 * m.setSomeProperty(someValue);
1695 * c.invokeAnAction();
1696 * }
1697 * });
1698 * </pre>
1699 *
1700 * @param args any useful values that can be set as properties on each MVC member or that
1701 * identify a member that can be shared with other groups.
1702 * @param mvcType the type of group to build.
1703 * @param handler a code block used to configure and manage the instantiated group
1704 *
1705 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1706 * configuration
1707 * @since 2.11.0
1708 */
1709 <MVC extends TypedMVCGroup, M extends GriffonModel, V extends GriffonView, C extends GriffonController> void withMVC(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType, @Nonnull MVCFunction<M, V, C> handler);
1710
1711 /**
1712 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1713 * <p>This method is of particular interest when working with short lived MVC groups such as
1714 * those used to build dialogs.<p/>
1715 * <p>MVC groups must be previously configured with the application's metadata
1716 * before they can be used. This registration process usually takes place automatically
1717 * at boot time. The type of the group can be normally found in the application's
1718 * configuration file.</p>
1719 * For example, with the following entry available in {@code Config.groovy}
1720 * <p/>
1721 * <pre>
1722 * mvcGroups {
1723 * foo {
1724 * model = 'com.acme.FooModel'
1725 * view = 'com.acme.FooView'
1726 * controller = 'com.acme.FooController'
1727 * }
1728 * }
1729 * </pre>
1730 * <p/>
1731 * An instance of the "foo" group can be used as follows
1732 * <p/>
1733 * <pre>
1734 * withMVCGroup("foo", new MVCGroupFunction() {
1735 * public void call(MVCGroup group) {
1736 * group.getModel().setSomeProperty(someValue);
1737 * group.getController().invokeAnAction();
1738 * }
1739 * });
1740 * </pre>
1741 *
1742 * @param mvcType the type of group to build.
1743 * @param handler a code block used to configure and manage the instantiated group
1744 *
1745 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1746 * configuration
1747 * @since 2.1.0
1748 */
1749 void withMVCGroup(@Nonnull String mvcType, @Nonnull MVCGroupFunction handler);
1750
1751 /**
1752 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1753 * <p>This method is of particular interest when working with short lived MVC groups such as
1754 * those used to build dialogs.<p/>
1755 * <p>MVC groups must be previously configured with the application's metadata
1756 * before they can be used. This registration process usually takes place automatically
1757 * at boot time. The type of the group can be normally found in the application's
1758 * configuration file.</p>
1759 * For example, with the following entry available in {@code Config.groovy}
1760 * <p/>
1761 * <pre>
1762 * mvcGroups {
1763 * foo {
1764 * model = 'com.acme.FooModel'
1765 * view = 'com.acme.FooView'
1766 * controller = 'com.acme.FooController'
1767 * }
1768 * }
1769 * </pre>
1770 * <p/>
1771 * An instance of the "foo" group can be used as follows
1772 * <p/>
1773 * <pre>
1774 * withMVCGroup("foo", "foo1", new MVCGroupFunction() {
1775 * public void call(MVCGroup group) {
1776 * group.getModel().setSomeProperty(someValue);
1777 * group.getController().invokeAnAction();
1778 * }
1779 * });
1780 * </pre>
1781 * <p/>
1782 * MVC groups must have an unique name.
1783 *
1784 * @param mvcType the type of group to build.
1785 * @param mvcId the name to assign to the built group.
1786 * @param handler a code block used to configure and manage the instantiated group
1787 *
1788 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1789 * configuration
1790 * @since 2.1.0
1791 */
1792 void withMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCGroupFunction handler);
1793
1794 /**
1795 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1796 * <p>This method is of particular interest when working with short lived MVC groups such as
1797 * those used to build dialogs.<p/>
1798 * <p>MVC groups must be previously configured with the application's metadata
1799 * before they can be used. This registration process usually takes place automatically
1800 * at boot time. The type of the group can be normally found in the application's
1801 * configuration file.</p>
1802 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1803 * scenarios <ul>
1804 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1805 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1806 * on any MVC member of the group.</li>
1807 * For example, with the following entry available in {@code Config.groovy}
1808 * <p/>
1809 * <pre>
1810 * mvcGroups {
1811 * foo {
1812 * model = 'com.acme.FooModel'
1813 * view = 'com.acme.FooView'
1814 * controller = 'com.acme.FooController'
1815 * }
1816 * }
1817 * </pre>
1818 * <p/>
1819 * An instance of the "foo" group can be used as follows
1820 * <p/>
1821 * <pre>
1822 * Map<String, Object> map = ... // initialized elsewhere
1823 * withMVCGroup("foo", "foo1", map, new MVCGroupFunction() {
1824 * public void call(MVCGroup group) {
1825 * group.getModel().setSomeProperty(someValue);
1826 * group.getController().invokeAnAction();
1827 * }
1828 * });
1829 * </pre>
1830 * <p/>
1831 * MVC groups must have an unique name.
1832 *
1833 * @param mvcType the type of group to build.
1834 * @param mvcId the name to assign to the built group.
1835 * @param args any useful values that can be set as properties on each MVC member or that
1836 * identify a member that can be shared with other groups.
1837 * @param handler a code block used to configure and manage the instantiated group
1838 *
1839 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1840 * configuration
1841 * @since 2.1.0
1842 */
1843 void withMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args, @Nonnull MVCGroupFunction handler);
1844
1845 /**
1846 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1847 * <p>This method is of particular interest when working with short lived MVC groups such as
1848 * those used to build dialogs.<p/>
1849 * <p>MVC groups must be previously configured with the application's metadata
1850 * before they can be used. This registration process usually takes place automatically
1851 * at boot time. The type of the group can be normally found in the application's
1852 * configuration file.</p>
1853 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1854 * scenarios <ul>
1855 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1856 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1857 * on any MVC member of the group.</li>
1858 * For example, with the following entry available in {@code Config.groovy}
1859 * <p/>
1860 * <pre>
1861 * mvcGroups {
1862 * foo {
1863 * model = 'com.acme.FooModel'
1864 * view = 'com.acme.FooView'
1865 * controller = 'com.acme.FooController'
1866 * }
1867 * }
1868 * </pre>
1869 * <p/>
1870 * An instance of the "foo" group can be used as follows
1871 * <p/>
1872 * <pre>
1873 * Map<String, Object> map = ... // initialized elsewhere
1874 * withMVCGroup("foo", "foo1", map, new MVCGroupFunction() {
1875 * public void call(MVCGroup group) {
1876 * group.getModel().setSomeProperty(someValue);
1877 * group.getController().invokeAnAction();
1878 * }
1879 * });
1880 * </pre>
1881 * <p/>
1882 * MVC groups must have an unique name.
1883 *
1884 * @param args any useful values that can be set as properties on each MVC member or that
1885 * identify a member that can be shared with other groups.
1886 * @param mvcType the type of group to build.
1887 * @param mvcId the name to assign to the built group.
1888 * @param handler a code block used to configure and manage the instantiated group
1889 *
1890 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1891 * configuration
1892 * @since 2.1.0
1893 */
1894 void withMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCGroupFunction handler);
1895
1896 /**
1897 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1898 * <p>This method is of particular interest when working with short lived MVC groups such as
1899 * those used to build dialogs.<p/>
1900 * <p>MVC groups must be previously configured with the application's metadata
1901 * before they can be used. This registration process usually takes place automatically
1902 * at boot time. The type of the group can be normally found in the application's
1903 * configuration file.</p>
1904 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1905 * scenarios <ul>
1906 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1907 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1908 * on any MVC member of the group.</li>
1909 * For example, with the following entry available in {@code Config.groovy}
1910 * <p/>
1911 * <pre>
1912 * mvcGroups {
1913 * foo {
1914 * model = 'com.acme.FooModel'
1915 * view = 'com.acme.FooView'
1916 * controller = 'com.acme.FooController'
1917 * }
1918 * }
1919 * </pre>
1920 * <p/>
1921 * An instance of the "foo" group can be used as follows
1922 * <p/>
1923 * <pre>
1924 * Map<String, Object> map = ... // initialized elsewhere
1925 * withMVCGroup("foo", map, new MVCGroupFunction() {
1926 * public void call(MVCGroup group) {
1927 * group.getModel().setSomeProperty(someValue);
1928 * group.getController().invokeAnAction();
1929 * }
1930 * });
1931 * </pre>
1932 *
1933 * @param mvcType the type of group to build.
1934 * @param args any useful values that can be set as properties on each MVC member or that
1935 * identify a member that can be shared with other groups.
1936 * @param handler a code block used to configure and manage the instantiated group
1937 *
1938 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1939 * configuration
1940 * @since 2.1.0
1941 */
1942 void withMVCGroup(@Nonnull String mvcType, @Nonnull Map<String, Object> args, @Nonnull MVCGroupFunction handler);
1943
1944 /**
1945 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1946 * <p>This method is of particular interest when working with short lived MVC groups such as
1947 * those used to build dialogs.<p/>
1948 * <p>MVC groups must be previously configured with the application's metadata
1949 * before they can be used. This registration process usually takes place automatically
1950 * at boot time. The type of the group can be normally found in the application's
1951 * configuration file.</p>
1952 * The <tt>args</tt> Map can contain any value that will be used in one of the following
1953 * scenarios <ul>
1954 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
1955 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
1956 * on any MVC member of the group.</li>
1957 * For example, with the following entry available in {@code Config.groovy}
1958 * <p/>
1959 * <pre>
1960 * mvcGroups {
1961 * foo {
1962 * model = 'com.acme.FooModel'
1963 * view = 'com.acme.FooView'
1964 * controller = 'com.acme.FooController'
1965 * }
1966 * }
1967 * </pre>
1968 * <p/>
1969 * An instance of the "foo" group can be used as follows
1970 * <p/>
1971 * <pre>
1972 * Map<String, Object> map = ... // initialized elsewhere
1973 * withMVCGroup("foo", map, new MVCGroupFunction() {
1974 * public void call(MVCGroup group) {
1975 * group.getModel().setSomeProperty(someValue);
1976 * group.getController().invokeAnAction();
1977 * }
1978 * });
1979 * </pre>
1980 *
1981 * @param args any useful values that can be set as properties on each MVC member or that
1982 * identify a member that can be shared with other groups.
1983 * @param mvcType the type of group to build.
1984 * @param handler a code block used to configure and manage the instantiated group
1985 *
1986 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
1987 * configuration
1988 * @since 2.1.0
1989 */
1990 void withMVCGroup(@Nonnull Map<String, Object> args, @Nonnull String mvcType, @Nonnull MVCGroupFunction handler);
1991
1992 /**
1993 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
1994 * <p>This method is of particular interest when working with short lived MVC groups such as
1995 * those used to build dialogs.<p/>
1996 * <p>MVC groups must be previously configured with the application's metadata
1997 * before they can be used. This registration process usually takes place automatically
1998 * at boot time. The type of the group can be normally found in the application's
1999 * configuration file.</p>
2000 * For example, with the following entry available in {@code Config.groovy}
2001 * <p/>
2002 * <pre>
2003 * mvcGroups {
2004 * foo {
2005 * model = 'com.acme.FooModel'
2006 * view = 'com.acme.FooView'
2007 * controller = 'com.acme.FooController'
2008 * }
2009 * }
2010 * </pre>
2011 * <p/>
2012 * An instance of the "foo" group can be used as follows
2013 * <p/>
2014 * <pre>
2015 * withMVCGroup(FooMVCGroup.class, new TypedMVCGroupFunction<>() {
2016 * public void call(MVC group) {
2017 * group.getModel().setSomeProperty(someValue);
2018 * group.getController().invokeAnAction();
2019 * }
2020 * });
2021 * </pre>
2022 *
2023 * @param mvcType the type of group to build.
2024 * @param handler a code block used to configure and manage the instantiated group
2025 *
2026 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
2027 * configuration
2028 * @since 2.11.0
2029 */
2030 <MVC extends TypedMVCGroup> void withMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull TypedMVCGroupFunction<MVC> handler);
2031
2032 /**
2033 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
2034 * <p>This method is of particular interest when working with short lived MVC groups such as
2035 * those used to build dialogs.<p/>
2036 * <p>MVC groups must be previously configured with the application's metadata
2037 * before they can be used. This registration process usually takes place automatically
2038 * at boot time. The type of the group can be normally found in the application's
2039 * configuration file.</p>
2040 * For example, with the following entry available in {@code Config.groovy}
2041 * <p/>
2042 * <pre>
2043 * mvcGroups {
2044 * foo {
2045 * model = 'com.acme.FooModel'
2046 * view = 'com.acme.FooView'
2047 * controller = 'com.acme.FooController'
2048 * }
2049 * }
2050 * </pre>
2051 * <p/>
2052 * An instance of the "foo" group can be used as follows
2053 * <p/>
2054 * <pre>
2055 * withMVCGroup(FooMVCGroup.class, "foo1", new TypedMVCGroupFunction<>() {
2056 * public void call(MVC group) {
2057 * group.getModel().setSomeProperty(someValue);
2058 * group.getController().invokeAnAction();
2059 * }
2060 * });
2061 * </pre>
2062 * <p/>
2063 * MVC groups must have an unique name.
2064 *
2065 * @param mvcType the type of group to build.
2066 * @param mvcId the name to assign to the built group.
2067 * @param handler a code block used to configure and manage the instantiated group
2068 *
2069 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
2070 * configuration
2071 * @since 2.11.0
2072 */
2073 <MVC extends TypedMVCGroup> void withMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull TypedMVCGroupFunction<MVC> handler);
2074
2075 /**
2076 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
2077 * <p>This method is of particular interest when working with short lived MVC groups such as
2078 * those used to build dialogs.<p/>
2079 * <p>MVC groups must be previously configured with the application's metadata
2080 * before they can be used. This registration process usually takes place automatically
2081 * at boot time. The type of the group can be normally found in the application's
2082 * configuration file.</p>
2083 * The <tt>args</tt> Map can contain any value that will be used in one of the following
2084 * scenarios <ul>
2085 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
2086 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
2087 * on any MVC member of the group.</li>
2088 * For example, with the following entry available in {@code Config.groovy}
2089 * <p/>
2090 * <pre>
2091 * mvcGroups {
2092 * foo {
2093 * model = 'com.acme.FooModel'
2094 * view = 'com.acme.FooView'
2095 * controller = 'com.acme.FooController'
2096 * }
2097 * }
2098 * </pre>
2099 * <p/>
2100 * An instance of the "foo" group can be used as follows
2101 * <p/>
2102 * <pre>
2103 * Map<String, Object> map = ... // initialized elsewhere
2104 * withMVCGroup(FooMVCGroup.class, "foo1", map, new TypedMVCGroupFunction<>() {
2105 * public void call(MVC group) {
2106 * group.getModel().setSomeProperty(someValue);
2107 * group.getController().invokeAnAction();
2108 * }
2109 * });
2110 * </pre>
2111 * <p/>
2112 * MVC groups must have an unique name.
2113 *
2114 * @param mvcType the type of group to build.
2115 * @param mvcId the name to assign to the built group.
2116 * @param args any useful values that can be set as properties on each MVC member or that
2117 * identify a member that can be shared with other groups.
2118 * @param handler a code block used to configure and manage the instantiated group
2119 *
2120 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
2121 * configuration
2122 * @since 2.11.0
2123 */
2124 <MVC extends TypedMVCGroup> void withMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull Map<String, Object> args, @Nonnull TypedMVCGroupFunction<MVC> handler);
2125
2126 /**
2127 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
2128 * <p>This method is of particular interest when working with short lived MVC groups such as
2129 * those used to build dialogs.<p/>
2130 * <p>MVC groups must be previously configured with the application's metadata
2131 * before they can be used. This registration process usually takes place automatically
2132 * at boot time. The type of the group can be normally found in the application's
2133 * configuration file.</p>
2134 * The <tt>args</tt> Map can contain any value that will be used in one of the following
2135 * scenarios <ul>
2136 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
2137 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
2138 * on any MVC member of the group.</li>
2139 * For example, with the following entry available in {@code Config.groovy}
2140 * <p/>
2141 * <pre>
2142 * mvcGroups {
2143 * foo {
2144 * model = 'com.acme.FooModel'
2145 * view = 'com.acme.FooView'
2146 * controller = 'com.acme.FooController'
2147 * }
2148 * }
2149 * </pre>
2150 * <p/>
2151 * An instance of the "foo" group can be used as follows
2152 * <p/>
2153 * <pre>
2154 * Map<String, Object> map = ... // initialized elsewhere
2155 * withMVCGroup(FooMVCGroup.class, "foo1", map, new TypedMVCGroupFunction<>() {
2156 * public void call(MVC group) {
2157 * group.getModel().setSomeProperty(someValue);
2158 * group.getController().invokeAnAction();
2159 * }
2160 * });
2161 * </pre>
2162 * <p/>
2163 * MVC groups must have an unique name.
2164 *
2165 * @param args any useful values that can be set as properties on each MVC member or that
2166 * identify a member that can be shared with other groups.
2167 * @param mvcType the type of group to build.
2168 * @param mvcId the name to assign to the built group.
2169 * @param handler a code block used to configure and manage the instantiated group
2170 *
2171 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
2172 * configuration
2173 * @since 2.11.0
2174 */
2175 <MVC extends TypedMVCGroup> void withMVCGroup(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType, @Nonnull String mvcId, @Nonnull TypedMVCGroupFunction<MVC> handler);
2176
2177 /**
2178 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
2179 * <p>This method is of particular interest when working with short lived MVC groups such as
2180 * those used to build dialogs.<p/>
2181 * <p>MVC groups must be previously configured with the application's metadata
2182 * before they can be used. This registration process usually takes place automatically
2183 * at boot time. The type of the group can be normally found in the application's
2184 * configuration file.</p>
2185 * The <tt>args</tt> Map can contain any value that will be used in one of the following
2186 * scenarios <ul>
2187 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
2188 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
2189 * on any MVC member of the group.</li>
2190 * For example, with the following entry available in {@code Config.groovy}
2191 * <p/>
2192 * <pre>
2193 * mvcGroups {
2194 * foo {
2195 * model = 'com.acme.FooModel'
2196 * view = 'com.acme.FooView'
2197 * controller = 'com.acme.FooController'
2198 * }
2199 * }
2200 * </pre>
2201 * <p/>
2202 * An instance of the "foo" group can be used as follows
2203 * <p/>
2204 * <pre>
2205 * Map<String, Object> map = ... // initialized elsewhere
2206 * withMVCGroup(FooMVCGroup.class, map, new TypedMVCGroupFunction<>() {
2207 * public void call(MVC group) {
2208 * group.getModel().setSomeProperty(someValue);
2209 * group.getController().invokeAnAction();
2210 * }
2211 * });
2212 * </pre>
2213 *
2214 * @param mvcType the type of group to build.
2215 * @param args any useful values that can be set as properties on each MVC member or that
2216 * identify a member that can be shared with other groups.
2217 * @param handler a code block used to configure and manage the instantiated group
2218 *
2219 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
2220 * configuration
2221 * @since 2.11.0
2222 */
2223 <MVC extends TypedMVCGroup> void withMVCGroup(@Nonnull Class<? extends MVC> mvcType, @Nonnull Map<String, Object> args, @Nonnull TypedMVCGroupFunction<MVC> handler);
2224
2225 /**
2226 * Instantiates an MVC group of the specified type then destroys it after it has been handled.<p>
2227 * <p>This method is of particular interest when working with short lived MVC groups such as
2228 * those used to build dialogs.<p/>
2229 * <p>MVC groups must be previously configured with the application's metadata
2230 * before they can be used. This registration process usually takes place automatically
2231 * at boot time. The type of the group can be normally found in the application's
2232 * configuration file.</p>
2233 * The <tt>args</tt> Map can contain any value that will be used in one of the following
2234 * scenarios <ul>
2235 * <li>The key matches a member definition; the value will be used as the instance of such member.</li>
2236 * <li>The key does not match a member definition, the value is assumed to be a property that can be set
2237 * on any MVC member of the group.</li>
2238 * For example, with the following entry available in {@code Config.groovy}
2239 * <p/>
2240 * <pre>
2241 * mvcGroups {
2242 * foo {
2243 * model = 'com.acme.FooModel'
2244 * view = 'com.acme.FooView'
2245 * controller = 'com.acme.FooController'
2246 * }
2247 * }
2248 * </pre>
2249 * <p/>
2250 * An instance of the "foo" group can be used as follows
2251 * <p/>
2252 * <pre>
2253 * Map<String, Object> map = ... // initialized elsewhere
2254 * withMVCGroup(FooMVCGroup.class, map, new TypedMVCGroupFunction<>() {
2255 * public void call(MVC group) {
2256 * group.getModel().setSomeProperty(someValue);
2257 * group.getController().invokeAnAction();
2258 * }
2259 * });
2260 * </pre>
2261 *
2262 * @param args any useful values that can be set as properties on each MVC member or that
2263 * identify a member that can be shared with other groups.
2264 * @param mvcType the type of group to build.
2265 * @param handler a code block used to configure and manage the instantiated group
2266 *
2267 * @throws griffon.exceptions.MVCGroupInstantiationException - if the type specified is not found in the application's
2268 * configuration
2269 * @since 2.11.0
2270 */
2271 <MVC extends TypedMVCGroup> void withMVCGroup(@Nonnull Map<String, Object> args, @Nonnull Class<? extends MVC> mvcType, @Nonnull TypedMVCGroupFunction<MVC> handler);
2272 }
|