public abstract class AbstractMVCGroupManager extends Object implements MVCGroupManager
MVCGroupManager
interface.Modifier and Type | Field and Description |
---|---|
protected static String |
ERROR_ARGS_NULL |
protected static String |
ERROR_CONFIG_NULL |
protected static String |
ERROR_CONFIGURATION_NULL |
protected static String |
ERROR_GROUP_NULL |
protected static String |
ERROR_MVCID_BLANK |
protected static String |
ERROR_MVCTYPE_BLANK |
Constructor and Description |
---|
AbstractMVCGroupManager(GriffonApplication application) |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguration(MVCGroupConfiguration configuration) |
protected void |
addGroup(MVCGroup group) |
MVCGroup |
buildMVCGroup(Map<String,Object> args,
String mvcType)
Instantiates an MVC group of the specified type with additional variables.
|
MVCGroup |
buildMVCGroup(Map<String,Object> args,
String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
protected abstract MVCGroup |
buildMVCGroup(MVCGroupConfiguration configuration,
String mvcId,
Map<String,Object> args) |
MVCGroup |
buildMVCGroup(String mvcType)
Instantiates an MVC group of the specified type.
|
MVCGroup |
buildMVCGroup(String mvcType,
Map<String,Object> args)
Instantiates an MVC group of the specified type with additional variables.
|
MVCGroup |
buildMVCGroup(String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
MVCGroup |
buildMVCGroup(String mvcType,
String mvcId,
Map<String,Object> args)
Instantiates an MVC group of the specified type with a particular name.
|
MVCGroupConfiguration |
cloneMVCGroupConfiguration(String mvcType,
Map<String,Object> config)
Clones an existing MVCGroupConfiguration, optionally overriding additional config values.
|
List<? extends GriffonMvcArtifact> |
createMVCGroup(Map<String,Object> args,
String mvcType)
Instantiates an MVC group of the specified type with additional variables.
|
List<? extends GriffonMvcArtifact> |
createMVCGroup(Map<String,Object> args,
String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
protected List<? extends GriffonMvcArtifact> |
createMVCGroup(MVCGroupConfiguration configuration,
String mvcId,
Map<String,Object> args) |
List<? extends GriffonMvcArtifact> |
createMVCGroup(String mvcType)
Instantiates an MVC group of the specified type returning only the MVC parts.
|
List<? extends GriffonMvcArtifact> |
createMVCGroup(String mvcType,
Map<String,Object> args)
Instantiates an MVC group of the specified type with additional variables.
|
List<? extends GriffonMvcArtifact> |
createMVCGroup(String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
List<? extends GriffonMvcArtifact> |
createMVCGroup(String mvcType,
String mvcId,
Map<String,Object> args)
Instantiates an MVC group of the specified type with a particular name.
|
protected abstract void |
doInitialize(Map<String,MVCGroupConfiguration> configurations) |
MVCGroupConfiguration |
findConfiguration(String mvcType) |
MVCGroup |
findGroup(String mvcId) |
GriffonApplication |
getApplication() |
MVCGroup |
getAt(String mvcId) |
Map<String,MVCGroupConfiguration> |
getConfigurations() |
Map<String,? extends GriffonController> |
getControllers()
Returns all currently available controller instances, keyed by group name.
|
Map<String,MVCGroup> |
getGroups() |
Map<String,? extends GriffonModel> |
getModels()
Returns all currently available model instances, keyed by group name.
|
Map<String,? extends GriffonView> |
getViews()
Returns all currently available view instances, keyed by group name.
|
void |
initialize(Map<String,MVCGroupConfiguration> configurations)
Initializes this manager with the group configurations provided by the application and addons.
|
void |
removeConfiguration(MVCGroupConfiguration configuration) |
void |
removeConfiguration(String name) |
protected void |
removeGroup(MVCGroup group) |
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(Map<String,Object> args,
String mvcType,
MVCCallable<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(Map<String,Object> args,
String mvcType,
String mvcId,
MVCCallable<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
protected <M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(MVCGroupConfiguration configuration,
String mvcId,
Map<String,Object> args,
MVCCallable<M,V,C> handler) |
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(String mvcType,
Map<String,Object> args,
MVCCallable<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(String mvcType,
MVCCallable<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(String mvcType,
String mvcId,
Map<String,Object> args,
MVCCallable<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVCGroup(String mvcType,
String mvcId,
MVCCallable<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newMVCGroup, newMVCGroupConfiguration
destroyMVCGroup
protected static final String ERROR_MVCTYPE_BLANK
protected static final String ERROR_MVCID_BLANK
protected static final String ERROR_CONFIGURATION_NULL
protected static final String ERROR_GROUP_NULL
protected static final String ERROR_CONFIG_NULL
protected static final String ERROR_ARGS_NULL
@Inject public AbstractMVCGroupManager(@Nonnull GriffonApplication application)
public GriffonApplication getApplication()
getApplication
in interface MVCGroupManager
@Nonnull public Map<String,MVCGroupConfiguration> getConfigurations()
getConfigurations
in interface MVCGroupManager
@Nonnull public Map<String,MVCGroup> getGroups()
getGroups
in interface MVCGroupManager
@Nonnull public MVCGroupConfiguration findConfiguration(@Nonnull String mvcType)
findConfiguration
in interface MVCGroupManager
@Nullable public MVCGroup findGroup(@Nonnull String mvcId)
findGroup
in interface MVCGroupManager
@Nullable public MVCGroup getAt(@Nonnull String mvcId)
getAt
in interface MVCGroupManager
public final void initialize(@Nonnull Map<String,MVCGroupConfiguration> configurations)
MVCGroupManager
initialize
in interface MVCGroupManager
configurations
- available group configurationspublic void addConfiguration(@Nonnull MVCGroupConfiguration configuration)
addConfiguration
in interface MVCGroupManager
public void removeConfiguration(@Nonnull MVCGroupConfiguration configuration)
removeConfiguration
in interface MVCGroupManager
public void removeConfiguration(@Nonnull String name)
removeConfiguration
in interface MVCGroupManager
@Nonnull public final Map<String,? extends GriffonModel> getModels()
MVCGroupManager
getModels
in interface MVCGroupManager
@Nonnull public final Map<String,? extends GriffonView> getViews()
MVCGroupManager
getViews
in interface MVCGroupManager
@Nonnull public final Map<String,? extends GriffonController> getControllers()
MVCGroupManager
getControllers
in interface MVCGroupManager
@Nonnull public MVCGroupConfiguration cloneMVCGroupConfiguration(@Nonnull String mvcType, @Nonnull Map<String,Object> config)
MVCGroupManager
cloneMVCGroupConfiguration
in interface MVCGroupManager
mvcType
- the name of the configuration to cloneconfig
- additional config parameters to be set on the configuration@Nonnull protected List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull MVCGroupConfiguration configuration, @Nullable String mvcId, @Nonnull Map<String,Object> args)
protected <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull MVCGroupConfiguration configuration, @Nullable String mvcId, @Nonnull Map<String,Object> args, @Nonnull MVCCallable<M,V,C> handler)
@Nonnull protected abstract MVCGroup buildMVCGroup(@Nonnull MVCGroupConfiguration configuration, @Nullable String mvcId, @Nonnull Map<String,Object> args)
protected abstract void doInitialize(@Nonnull Map<String,MVCGroupConfiguration> configurations)
@Nonnull public MVCGroup buildMVCGroup(@Nonnull String mvcType)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
For example, with the following entry available in Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be created as follows
MapfooGroup = buildMVCGroup('foo') assert (fooGroup.controller instanceof FooController)
buildMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.@Nonnull public MVCGroup buildMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
For example, with the following entry available in Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be created as follows
MapMVC groups must have an unique name.fooGroup = buildMVCGroup('foo', 'foo' + System.currentTimeMillis()) assert (fooGroup.controller instanceof FooController)
buildMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.@Nonnull public MVCGroup buildMVCGroup(@Nonnull Map<String,Object> args, @Nonnull String mvcType)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } 'bar' { model = 'com.acme.FooModel' view = 'com.acme.BarView' controller = 'com.acme.BarController' } }Notice that groups "foo" and "bar share the same model type, We can make them share the same model instance by creating the groups in the following way:
MapfooGroup = buildMVCGroup('foo') Map barGroup = buildMVCGroup('bar', model: fooGroup.model) assert fooGroup.model == barGroup.model
buildMVCGroup
in interface MVCHandler
args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.mvcType
- the type of group to build.@Nonnull public MVCGroup buildMVCGroup(@Nonnull String mvcType, @Nonnull Map<String,Object> args)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } 'bar' { model = 'com.acme.FooModel' view = 'com.acme.BarView' controller = 'com.acme.BarController' } }Notice that groups "foo" and "bar share the same model type, We can make them share the same model instance by creating the groups in the following way:
MapfooGroup = buildMVCGroup('foo') Map barGroup = buildMVCGroup('bar', model: fooGroup.model) assert fooGroup.model == barGroup.model
buildMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.@Nonnull public MVCGroup buildMVCGroup(@Nonnull Map<String,Object> args, @Nonnull String mvcType, @Nonnull String mvcId)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }We can create two instances of the same group that share the same model instance in the following way:
MapMVC groups must have an unique name.fooGroup1 = buildMVCGroup('foo', 'foo1') Map fooGroup2 = buildMVCGroup('bar', 'foo2', model: fooGroup1.model) assert fooGroup1.model == fooGroup2.model
buildMVCGroup
in interface MVCHandler
args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.mvcType
- the type of group to build.mvcId
- the name to assign to the built group.@Nonnull public MVCGroup buildMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String,Object> args)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }We can create two instances of the same group that share the same model instance in the following way:
MapMVC groups must have an unique name.fooGroup1 = buildMVCGroup('foo', 'foo1') Map fooGroup2 = buildMVCGroup('bar', 'foo2', model: fooGroup1.model) assert fooGroup1.model == fooGroup2.model
buildMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.@Nonnull public List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull String mvcType)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
For example, with the following entry available in Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be created as follows
def (m, v, c) = createMVCGroup('foo') assert (c instanceof FooController)
createMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.@Nonnull public List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull Map<String,Object> args, @Nonnull String mvcType)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } 'bar' { model = 'com.acme.FooModel' view = 'com.acme.BarView' controller = 'com.acme.BarController' } }Notice that groups "foo" and "bar share the same model type, We can make them share the same model instance by creating the groups in the following way:
def (m1, v1, c1) = createMVCGroup('foo') def (m2, v2, c2) = createMVCGroup('bar', model: m1) assert fm1 == m2
createMVCGroup
in interface MVCHandler
args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.mvcType
- the type of group to build.@Nonnull public List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull String mvcType, @Nonnull Map<String,Object> args)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } 'bar' { model = 'com.acme.FooModel' view = 'com.acme.BarView' controller = 'com.acme.BarController' } }Notice that groups "foo" and "bar share the same model type, We can make them share the same model instance by creating the groups in the following way:
def (m1, v1, c1) = createMVCGroup('foo') def (m2, v2, c2) = createMVCGroup('bar', model: m1) assert fm1 == m2
createMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.@Nonnull public List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
For example, with the following entry available in Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be created as follows
def (m, v, c) = createMVCGroup('foo', 'foo' + System.currenttimeMillis()) assert (c instanceof FooController)MVC groups must have an unique name.
createMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.@Nonnull public List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull Map<String,Object> args, @Nonnull String mvcType, @Nonnull String mvcId)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }We can create two instances of the same group that share the same model instance in the following way:
def (m1, v1, c1) = createMVCGroup('foo', 'foo1') def (m2, v2, c2) = createMVCGroup('foo', 'foo2', model: m1) assert fm1 == m2MVC groups must have an unique name.
createMVCGroup
in interface MVCHandler
args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.mvcType
- the type of group to build.mvcId
- the name to assign to the built group.@Nonnull public List<? extends GriffonMvcArtifact> createMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String,Object> args)
MVCHandler
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenarios
Application.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }We can create two instances of the same group that share the same model instance in the following way:
def (m1, v1, c1) = createMVCGroup('foo', 'foo1') def (m2, v2, c2) = createMVCGroup('foo', 'foo2', model: m1) assert fm1 == m2MVC groups must have an unique name.
createMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.public <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull String mvcType, @Nonnull MVCCallable<M,V,C> handler)
MVCHandler
This method is of particular interest when working with short lived MVC groups such as those used to build dialogs.
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
For example, with the following entry available inApplication.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be used as follows
withMVCGroup("foo", new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.handler
- a code block used to configure and manage the instantiated grouppublic <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCCallable<M,V,C> handler)
MVCHandler
This method is of particular interest when working with short lived MVC groups such as those used to build dialogs.
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
For example, with the following entry available inApplication.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be used as follows
withMVCGroup("foo", "foo1", new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });MVC groups must have an unique name.
withMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.handler
- a code block used to configure and manage the instantiated grouppublic <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String,Object> args, @Nonnull MVCCallable<M,V,C> handler)
MVCHandler
This method is of particular interest when working with short lived MVC groups such as those used to build dialogs.
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenariosApplication.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be used as follows
MapMVC groups must have an unique name.map = ... // initialized elsewhere withMVCGroup("foo", "foo1", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.handler
- a code block used to configure and manage the instantiated grouppublic <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull Map<String,Object> args, @Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCCallable<M,V,C> handler)
MVCHandler
This method is of particular interest when working with short lived MVC groups such as those used to build dialogs.
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenariosApplication.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be used as follows
MapMVC groups must have an unique name.map = ... // initialized elsewhere withMVCGroup("foo", "foo1", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVCGroup
in interface MVCHandler
args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.mvcType
- the type of group to build.mvcId
- the name to assign to the built group.handler
- a code block used to configure and manage the instantiated grouppublic <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull String mvcType, @Nonnull Map<String,Object> args, @Nonnull MVCCallable<M,V,C> handler)
MVCHandler
This method is of particular interest when working with short lived MVC groups such as those used to build dialogs.
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenariosApplication.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be used as follows
Mapmap = ... // initialized elsewhere withMVCGroup("foo", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.handler
- a code block used to configure and manage the instantiated grouppublic <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVCGroup(@Nonnull Map<String,Object> args, @Nonnull String mvcType, @Nonnull MVCCallable<M,V,C> handler)
MVCHandler
This method is of particular interest when working with short lived MVC groups such as those used to build dialogs.
MVC Groups must be previously configured with the application's metadata before they can be used. This registration process usually takes place automatically at boot time. The type of the group can be normally found in the application's configuration file.
The args Map can contain any value that will be used in one of the following scenariosApplication.groovy
mvcGroups { 'foo' { model = 'com.acme.FooModel' view = 'com.acme.FooView' controller = 'com.acme.FooController' } }An instance of the "foo" group can be used as follows
Mapmap = ... // initialized elsewhere withMVCGroup("foo", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVCGroup
in interface MVCHandler
args
- any useful values that can be set as properties on each MVC member or that
identify a member that can be shared with other groups.mvcType
- the type of group to build.handler
- a code block used to configure and manage the instantiated group