Constructor and Description |
---|
FormManager()
Creates a new FormManager instance - this should not be called by users,
and instead should be left to Particle to manage.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
This method is called on application shutdown so that the forms can be disposed.
|
<T extends Form<?>> |
getForm(java.lang.Class<T> formCls,
Form.UpdateMode updateMode)
Attempts to return the form represented by the given class (which is a class
that extends from
Form ), with the form configured to operate in the
given update mode . |
void |
init()
This method is called on application startup so that the forms can be
correctly initialised.
|
void |
registerForm(java.lang.Class<? extends Form<?>> formClass)
Registers the given form class - the name that will be used will be read
from the
ParticleForm.name() value. |
void |
unregisterForm(java.lang.Class<? extends Form<?>> formClass)
Removes the given form from the form manager, and disposes it if it has
previously be instantiated.
|
public FormManager()
public void init()
public void dispose()
public <T extends Form<?>> java.util.Optional<T> getForm(java.lang.Class<T> formCls, Form.UpdateMode updateMode)
Form
), with the form configured to operate in the
given update mode
.T
- The class type of the form.formCls
- The class containing the form that is being requested.updateMode
- The update mode to use in the formpublic void registerForm(java.lang.Class<? extends Form<?>> formClass)
ParticleForm.name()
value. Note that this method only
needs to be called in instances where Forms are not automatically discovered
due to their @ParticleForm
annotation (so, only in rare
cases is this method needing to be called).public void unregisterForm(java.lang.Class<? extends Form<?>> formClass)