Griffon Guide 0.9.5-rc2 - Reference Documentation

# createMVCGroup(*)

## Purpose

Create a new MVC group instance.

## Examples

Groovy

    class SampleController {
        def action = { evt = null ->
            def (m, v, c) = createMVCGroup('Other')
        }
    }

Java

    import griffon.core.*;
    import org.codehaus.griffon.runtime.core.AbstractGriffonController;public class SampleController extends AbstractGriffonController {
        void action() {
            List<? extends GriffonMvcArtifact> mvc = createMVCGroup("Other");
        }
    }

## Description

This method lets you create new instances of a MVC group. It always returns 3 elements: Model, View, and Controller in that order. There are several ways to invoke this method depending on your needs

- `createMVCGroup(String groupType)` - creates a new group identified by <groupType> with default settings.
- `createMVCGroup(String groupType, String groupName)` - creates a new group identified by <groupType> with default settings and an specific <groupName>. You can reference the whole group later by accessing `app.groups.<groupName>`.
- `createMVCGroup(String groupType, Map params)` - creates a new group identified by <groupType> with additional params. The `params` argument will be fed as the `args` value of `mvcGroupInit()`.
- `createMVCGroup(String groupType, String groupName, Map params)` - a combination of all previous definitions.

This method is a restricted version of the more general `buildMVCGroup()`.

Fired Events:

- `NewInstance` - for each member of the MVC group that had to be instantiated
- `InitializeMVCGroup` - before each group member is initialized
- `CreateMVCGroup` - after the group has been created