use of com.servoy.j2db.util.IDestroyable in project servoy-client by Servoy.
the class ScrollResponseHeaderContainer method destroy.
public void destroy() {
if (dal != null)
dal.destroy();
if (currentData instanceof ISwingFoundSet) {
((ISwingFoundSet) currentData).removeTableModelListener(this);
((ISwingFoundSet) currentData).getSelectionModel().removeListSelectionListener(this);
}
for (Component comp : cellToElement.keySet()) {
if (comp instanceof IDestroyable) {
((IDestroyable) comp).destroy();
}
}
cellToElement.clear();
}
use of com.servoy.j2db.util.IDestroyable 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.util.IDestroyable in project servoy-client by Servoy.
the class PortalComponent method destroy.
public void destroy() {
// safety
setRecord(null, false);
if (dal != null) {
dal.destroy();
dal = null;
}
if (table != null) {
TableColumnModel tcm = table.getColumnModel();
for (int i = 0; i < tcm.getColumnCount(); i++) {
CellAdapter ca = (CellAdapter) tcm.getColumn(i);
Object o = ca.getEditor();
if (o instanceof IDestroyable) {
((IDestroyable) o).destroy();
}
o = ca.getRenderer();
if (o instanceof IDestroyable) {
((IDestroyable) o).destroy();
}
}
}
if (renderer != null) {
renderer.destroy();
renderer = null;
}
if (editor != null) {
editor.destroy();
editor = null;
}
}
Aggregations