use of com.servoy.j2db.scripting.SolutionScope in project servoy-client by Servoy.
the class DataAdapterList method destroy.
/**
*/
public void destroy() {
if (currentRecord != null) {
// With prototype you can still get global foundsets
// setRecord(new PrototypeState(currentRecord.getParentFoundSet()), true);
setRecord(null, false);
}
if (formController != null && !formController.isDestroyed() && formController.getFormScope() != null) {
formController.getFormScope().getModificationSubject().removeModificationListener(this);
}
IExecutingEnviroment er = application.getScriptEngine();
if (er != null) {
SolutionScope ss = er.getSolutionScope();
if (ss != null) {
ScopesScope gs = ss.getScopesScope();
if (gs != null) {
gs.getModificationSubject().removeModificationListener(this);
}
}
}
if (servoyAwareBeans != null) {
for (IServoyAwareBean b : servoyAwareBeans) {
try {
if (b instanceof IDestroyable) {
((IDestroyable) b).destroy();
}
} catch (RuntimeException e) {
// never make the app break on faulty beans
Debug.error(e);
}
}
}
servoyAwareBeans = null;
if (relatedDataAdapters != null) {
for (IDisplayRelatedData drd : relatedDataAdapters) {
drd.destroy();
}
}
relatedDataAdapters = null;
if (dataDisplays != null) {
for (IDisplayData dd : dataDisplays) {
if (dd instanceof IDestroyable) {
((IDestroyable) dd).destroy();
}
}
}
dataDisplays = null;
if (dataAdapters != null) {
for (IDataAdapter da : dataAdapters.values()) {
if (da instanceof IDestroyable) {
((IDestroyable) da).destroy();
}
}
}
dataAdapters = null;
currentDisplay = null;
visible = false;
destroyed = true;
if (currentRecord != null) {
// $NON-NLS-1$
Debug.error("After destroy there is still a current record in DataAdapterList of formcontroller: " + formController, new RuntimeException());
currentRecord.removeModificationListener(this);
}
}
use of com.servoy.j2db.scripting.SolutionScope in project servoy-client by Servoy.
the class BasicFormController method destroy.
public void destroy() {
SolutionScope solScope = application.getScriptEngine().getSolutionScope();
// $NON-NLS-1$
((CreationalPrototype) solScope.get("forms", solScope)).removeFormPanel(this);
if (scriptableForm != null) {
scriptableForm.destroy();
}
scriptableForm = null;
if (formScope != null) {
formScope.destroy();
}
formScope = null;
destroyed = true;
isFormVisible = false;
}
use of com.servoy.j2db.scripting.SolutionScope in project servoy-client by Servoy.
the class FormManager method setCurrentContainer.
/**
* @param mainContainer
*/
public void setCurrentContainer(IMainContainer mainContainer, String name) {
if (mainContainer != null) {
currentContainer = mainContainer;
if (name != null) {
// reset it in the containers (must be done for the webclient)
containers.put(name, mainContainer);
}
} else {
currentContainer = getMainContainer(null);
}
enableCmds(true);
FormController formController = currentContainer.getController();
if (formController != null) {
IExecutingEnviroment scriptEngine = application.getScriptEngine();
if (scriptEngine != null) {
SolutionScope ss = scriptEngine.getSolutionScope();
Context.enter();
try {
// $NON-NLS-1$
ss.put("currentcontroller", ss, new NativeJavaObject(ss, formController.initForJSUsage(), new InstanceJavaMembers(ss, JSForm.class)));
} finally {
Context.exit();
}
}
}
application.getRuntimeWindowManager().setCurrentWindowName(name);
}
Aggregations