Search in sources :

Example 1 with IDestroyable

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();
}
Also used : IDestroyable(com.servoy.j2db.util.IDestroyable) IComponent(com.servoy.j2db.ui.IComponent) AbstractRuntimeBaseComponent(com.servoy.j2db.ui.scripting.AbstractRuntimeBaseComponent) BaseComponent(com.servoy.j2db.persistence.BaseComponent) GraphicalComponent(com.servoy.j2db.persistence.GraphicalComponent) IFieldComponent(com.servoy.j2db.ui.IFieldComponent) Component(org.apache.wicket.Component) IPortalComponent(com.servoy.j2db.ui.IPortalComponent) IRuntimeComponent(com.servoy.j2db.ui.runtime.IRuntimeComponent) ISwingFoundSet(com.servoy.j2db.dataprocessing.ISwingFoundSet)

Example 2 with IDestroyable

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);
    }
}
Also used : IServoyAwareBean(com.servoy.j2db.dataui.IServoyAwareBean) IExecutingEnviroment(com.servoy.j2db.scripting.IExecutingEnviroment) IDestroyable(com.servoy.j2db.util.IDestroyable) ScopesScope(com.servoy.j2db.scripting.ScopesScope) SolutionScope(com.servoy.j2db.scripting.SolutionScope)

Example 3 with IDestroyable

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;
    }
}
Also used : IDestroyable(com.servoy.j2db.util.IDestroyable) TableColumnModel(javax.swing.table.TableColumnModel)

Aggregations

IDestroyable (com.servoy.j2db.util.IDestroyable)3 ISwingFoundSet (com.servoy.j2db.dataprocessing.ISwingFoundSet)1 IServoyAwareBean (com.servoy.j2db.dataui.IServoyAwareBean)1 BaseComponent (com.servoy.j2db.persistence.BaseComponent)1 GraphicalComponent (com.servoy.j2db.persistence.GraphicalComponent)1 IExecutingEnviroment (com.servoy.j2db.scripting.IExecutingEnviroment)1 ScopesScope (com.servoy.j2db.scripting.ScopesScope)1 SolutionScope (com.servoy.j2db.scripting.SolutionScope)1 IComponent (com.servoy.j2db.ui.IComponent)1 IFieldComponent (com.servoy.j2db.ui.IFieldComponent)1 IPortalComponent (com.servoy.j2db.ui.IPortalComponent)1 IRuntimeComponent (com.servoy.j2db.ui.runtime.IRuntimeComponent)1 AbstractRuntimeBaseComponent (com.servoy.j2db.ui.scripting.AbstractRuntimeBaseComponent)1 TableColumnModel (javax.swing.table.TableColumnModel)1 Component (org.apache.wicket.Component)1