public abstract class AbstractGriffonArtifactScript extends Script implements GriffonArtifact
Modifier and Type | Field and Description |
---|---|
protected GriffonApplication |
application |
Constructor and Description |
---|
AbstractGriffonArtifactScript() |
Modifier and Type | Method and Description |
---|---|
ClassLoader |
classloader()
Returns the classloader used to resolve resources.
|
List<? extends GriffonMvcArtifact> |
createMVC(Map<String,Object> args,
String mvcType)
Instantiates an MVC group of the specified type with additional variables.
|
List<? extends GriffonMvcArtifact> |
createMVC(Map<String,Object> args,
String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
List<? extends GriffonMvcArtifact> |
createMVC(String mvcType)
Instantiates an MVC group of the specified type returning only the MVC parts.
|
List<? extends GriffonMvcArtifact> |
createMVC(String mvcType,
Map<String,Object> args)
Instantiates an MVC group of the specified type with additional variables.
|
List<? extends GriffonMvcArtifact> |
createMVC(String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
List<? extends GriffonMvcArtifact> |
createMVC(String mvcType,
String mvcId,
Map<String,Object> args)
Instantiates an MVC group of the specified type with a particular name.
|
MVCGroup |
createMVCGroup(Map<String,Object> args,
String mvcType)
Instantiates an MVC group of the specified type with additional variables.
|
MVCGroup |
createMVCGroup(Map<String,Object> args,
String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
MVCGroup |
createMVCGroup(String mvcType)
Instantiates an MVC group of the specified type.
|
MVCGroup |
createMVCGroup(String mvcType,
Map<String,Object> args)
Instantiates an MVC group of the specified type with additional variables.
|
MVCGroup |
createMVCGroup(String mvcType,
String mvcId)
Instantiates an MVC group of the specified type with a particular name.
|
MVCGroup |
createMVCGroup(String mvcType,
String mvcId,
Map<String,Object> args)
Instantiates an MVC group of the specified type with a particular name.
|
void |
destroyMVCGroup(String mvcId)
Destroys an MVC group identified by a particular name.
|
GriffonApplication |
getApplication()
Reference to the current
GriffonApplication |
protected abstract String |
getArtifactType() |
GriffonClass |
getGriffonClass()
Returns the GriffonClass associated with this artifact.
|
Logger |
getLog()
Returns a Logger instance suitable for this Artifact.
|
InputStream |
getResourceAsStream(String name)
Returns an input stream for reading the specified resource.
|
URL |
getResourceAsURL(String name)
Finds the resource with the given name.
|
List<URL> |
getResources(String name)
Finds all the resources with the given name.
|
boolean |
isUIThread()
True if the current thread is the UI thread.
|
<R> Future<R> |
runFuture(Callable<R> callable)
Executes a code block as a Future on a default ExecutorService.
|
<R> Future<R> |
runFuture(ExecutorService executorService,
Callable<R> callable)
Executes a code block as a Future on an ExecutorService.
|
void |
runInsideUIAsync(Runnable runnable)
Executes a code block asynchronously on the UI thread.
|
<R> R |
runInsideUISync(Callable<R> callable)
Executes a code block synchronously on the UI thread.
|
void |
runInsideUISync(Runnable runnable)
Executes a code block synchronously on the UI thread.
|
void |
runOutsideUI(Runnable runnable)
Executes a code block outside of the UI thread.
|
<M extends GriffonModel,V extends GriffonView,C extends GriffonController> |
withMVC(Map<String,Object> args,
String mvcType,
MVCFunction<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> |
withMVC(Map<String,Object> args,
String mvcType,
String mvcId,
MVCFunction<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> |
withMVC(String mvcType,
Map<String,Object> args,
MVCFunction<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> |
withMVC(String mvcType,
MVCFunction<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> |
withMVC(String mvcType,
String mvcId,
Map<String,Object> args,
MVCFunction<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> |
withMVC(String mvcType,
String mvcId,
MVCFunction<M,V,C> handler)
Instantiates an MVC group of the specified type then destroys it after it has been handled.
|
evaluate, evaluate, getBinding, getProperty, invokeMethod, print, printf, printf, println, println, run, run, setBinding, setProperty
getMetaClass, setMetaClass
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup, withMVCGroup
@Inject protected GriffonApplication application
@Nonnull public GriffonApplication getApplication()
GriffonArtifact
GriffonApplication
getApplication
in interface GriffonArtifact
@Nonnull public GriffonClass getGriffonClass()
GriffonArtifact
getGriffonClass
in interface GriffonArtifact
@Nonnull public Logger getLog()
GriffonArtifact
The Logger is configured with the following prefix 'griffon.app.<type>' where <type> stands for the artifact's type.
Example: the Logger for class com.acme.SampleController will be configured for 'griffon.app.controller.com.acme.SampleController'.
getLog
in interface GriffonArtifact
public boolean isUIThread()
ThreadingHandler
isUIThread
in interface ThreadingHandler
@Nonnull public <R> Future<R> runFuture(@Nonnull ExecutorService executorService, @Nonnull Callable<R> callable)
ThreadingHandler
runFuture
in interface ThreadingHandler
@Nonnull public <R> Future<R> runFuture(@Nonnull Callable<R> callable)
ThreadingHandler
runFuture
in interface ThreadingHandler
public void runInsideUISync(@Nonnull Runnable runnable)
ThreadingHandler
runInsideUISync
in interface ThreadingHandler
public void runOutsideUI(@Nonnull Runnable runnable)
ThreadingHandler
runOutsideUI
in interface ThreadingHandler
public void runInsideUIAsync(@Nonnull Runnable runnable)
ThreadingHandler
runInsideUIAsync
in interface ThreadingHandler
@Nullable public <R> R runInsideUISync(@Nonnull Callable<R> callable)
ThreadingHandler
runInsideUISync
in interface ThreadingHandler
@Nonnull public ClassLoader classloader()
ResourceHandler
classloader
in interface ResourceHandler
@Nullable public URL getResourceAsURL(@Nonnull String name)
ResourceHandler
The name of a resource is a '/'-separated path name that identifies the resource.
getResourceAsURL
in interface ResourceHandler
name
- The resource name@Nullable public List<URL> getResources(@Nonnull String name)
ResourceHandler
The name of a resource is a /-separated path name that identifies the resource.
getResources
in interface ResourceHandler
name
- The resource nameURL
objects for
the resource. If no resources could be found, the list
will be empty. Resources that the class loader doesn't have
access to will not be in the list.@Nullable public InputStream getResourceAsStream(@Nonnull String name)
ResourceHandler
getResourceAsStream
in interface ResourceHandler
name
- The resource name@Nonnull public MVCGroup 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:
MVCGroup fooGroup = createMVCGroup('foo') MVCGroup barGroup = createMVCGroup('bar', model: fooGroup.model) assert fooGroup.model == barGroup.model
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> createMVC(@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) = createMVC('foo') assert (c instanceof FooController)
createMVC
in interface MVCHandler
mvcType
- the type of group to build.public <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull MVCFunction<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
withMVC("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.
withMVC
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 group@Nonnull public List<? extends GriffonMvcArtifact> createMVC(@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) = createMVC('foo', 'foo' + System.currenttimeMillis()) assert (c instanceof FooController)MVC groups must have an unique name.
createMVC
in interface MVCHandler
mvcType
- the type of group to build.mvcId
- the name to assign to the built group.@Nonnull public List<? extends GriffonMvcArtifact> createMVC(@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) = createMVC('foo', 'foo1') def (m2, v2, c2) = createMVC('foo', 'foo2', model: m1) assert fm1 == m2MVC groups must have an unique name.
createMVC
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.public <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)
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 withMVC("foo", "foo1", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVC
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 group@Nonnull public MVCGroup 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:
MVCGroup fooGroup1 = createMVCGroup('foo', 'foo1') MVCGroup fooGroup2 = createMVCGroup('bar', 'foo2', model: fooGroup1.model) assert fooGroup1.model == fooGroup2.modelMVC 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 MVCGroup 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:
MVCGroup fooGroup1 = createMVCGroup('foo', 'foo1') MVCGroup fooGroup2 = createMVCGroup('bar', 'foo2', model: fooGroup1.model) assert fooGroup1.model == fooGroup2.modelMVC 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.@Nonnull public List<? extends GriffonMvcArtifact> createMVC(@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) = createMVC('foo') def (m2, v2, c2) = createMVC('bar', model: m1) assert fm1 == m2
createMVC
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.public <M extends GriffonModel,V extends GriffonView,C extends GriffonController> void withMVC(@Nonnull String mvcType, @Nonnull MVCFunction<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
withMVC("foo", new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVC
in interface MVCHandler
mvcType
- the type of group to build.handler
- a code block used to configure and manage the instantiated group@Nonnull public MVCGroup 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
MapfooGroup = createMVCGroup('foo') assert (fooGroup.controller instanceof FooController)
createMVCGroup
in interface MVCHandler
mvcType
- the type of group to build.@Nonnull public MVCGroup 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
MVCGroup fooGroup = createMVCGroup('foo', 'foo' + System.currentTimeMillis()) assert (fooGroup.controller 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> createMVC(@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) = createMVC('foo') def (m2, v2, c2) = createMVC('bar', model: m1) assert fm1 == m2
createMVC
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.public <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)
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 withMVC("foo", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVC
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 grouppublic <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)
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 withMVC("foo", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVC
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 group@Nonnull public MVCGroup 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:
MVCGroup fooGroup = createMVCGroup('foo') MVCGroup barGroup = createMVCGroup('bar', model: fooGroup.model) assert fooGroup.model == barGroup.model
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> createMVC(@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) = createMVC('foo', 'foo1') def (m2, v2, c2) = createMVC('foo', 'foo2', model: m1) assert fm1 == m2MVC groups must have an unique name.
createMVC
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 withMVC(@Nonnull String mvcType, @Nonnull String mvcId, @Nonnull Map<String,Object> args, @Nonnull MVCFunction<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 withMVC("foo", "foo1", map, new MVCCallable<FooModel, FooView, FooController>() { public void call(FooModel m, FooView v, FooController c) { m.setSomeProperty(someValue); c.invokeAnAction(); } });
withMVC
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 void destroyMVCGroup(@Nonnull String mvcId)
MVCHandler
ATTENTION: make sure to call the super implementation if you override this method otherwise group references will not be kept up to date.
destroyMVCGroup
in interface MVCHandler
mvcId
- the name of the group to destroy and dispose.