5.2.1 MVCGroupManager - Reference Documentation
Authors: Andres Almiray
Version: 1.2.0
5.2.1 MVCGroupManager
This class is responsible for holding the configuration of all MVC groups no matter how they were defined, which can be either inApplication.groovy
or in an addon descriptor.During the startup sequence an instance of MVCGroupManager
will be created and initialized. Later the application will instruct this instance to create all startup groups as required. MVCGroupManager
has a handful set of methods that deal with MVC group configuration alone; however those that deal with group instantiation come in 3 versions, with 2 flavors each (one Groovy, the other Java friendly).Locating a group configuration is easily done by specifying the name you're interested in findingdef configuration = app.mvcGroupManager.findConfiguration('foo')
create
methoddef configuration = app.mvcGroupManager.findConfiguration('foo') def group1 = configuration.create('foo1') def group2 = configuration.create('foo2', [someKey: 'someValue']) // the following will make the group's id match its name def group3 = configuration.create() def group4 = configuration.create(someKey: 'someValue')
Config.groovy
griffon.mvcid.collision = 'warning' // accepted values are 'warning', 'exception' (default)
def g1 = app.mvcGroupManager.groups.foo1 def g2 = app.mvcGroupManager.findGroup('foo1') def g3 = app.mvcGroupManager.foo1 assert g1 == g2 assert g1 == g3
app.mvcGroupManager.models.each { model ->
// do something with model
}