Search in sources :

Example 1 with EditRecordList

use of com.servoy.j2db.dataprocessing.EditRecordList in project servoy-client by Servoy.

the class BasicFormManager method canBeDeleted.

protected boolean canBeDeleted(IFormController fp) {
    if (fp.isFormVisible()) {
        if (Debug.tracing())
            Debug.trace("Couldn't destroy form " + fp.getName() + "  instance because it is still visible");
        return false;
    }
    // cannot be deleted if a global var has a ref
    ScopesScope scopesScope = application.getScriptEngine().getScopesScope();
    if (hasReferenceInScriptable(scopesScope, fp, new HashSet<Scriptable>())) {
        if (Debug.tracing())
            Debug.trace("Couldn't destroy form " + fp.getName() + "  instance because it has references in scripting");
        return false;
    }
    if (fp.isFormExecutingFunction()) {
        if (Debug.tracing())
            Debug.trace("Couldn't destroy form " + fp.getName() + "  instance because it is executing a function");
        return false;
    }
    // if this controller uses a separate foundset
    if (fp.getForm().getUseSeparateFoundSet()) {
        // test if that foundset has edited records that can't be saved
        EditRecordList editRecordList = application.getFoundSetManager().getEditRecordList();
        if (editRecordList.stopIfEditing(fp.getFoundSet()) != ISaveConstants.STOPPED) {
            if (Debug.tracing())
                Debug.trace("Couldn't destroy form " + fp.getName() + "  instance because it has a seperate foundset that has editing records");
            return false;
        }
    }
    // the cached currentcontroller may not be destroyed
    SolutionScope ss = application.getScriptEngine().getSolutionScope();
    // $NON-NLS-1$
    return ss == null || fp.initForJSUsage() != ss.get("currentcontroller", ss);
}
Also used : EditRecordList(com.servoy.j2db.dataprocessing.EditRecordList) ScopesScope(com.servoy.j2db.scripting.ScopesScope) Scriptable(org.mozilla.javascript.Scriptable) SolutionScope(com.servoy.j2db.scripting.SolutionScope)

Example 2 with EditRecordList

use of com.servoy.j2db.dataprocessing.EditRecordList in project servoy-client by Servoy.

the class AlwaysRowSelectedSelectionModel method testStopUIEditing.

private boolean testStopUIEditing() {
    for (IFormController fco : formControllers.toArray(new IFormController[formControllers.size()])) {
        if (fco.isFormVisible()) {
            EditRecordList editRecordList = fco.getApplication().getFoundSetManager().getEditRecordList();
            IRecord[] editedRecords = editRecordList.getEditedRecords(fco.getFoundSet());
            if (editedRecords.length > 0) {
                int stopEditing = editRecordList.stopEditing(false, Arrays.asList(editedRecords));
                return stopEditing == ISaveConstants.STOPPED || stopEditing == ISaveConstants.AUTO_SAVE_BLOCKED;
            }
        }
    }
    return true;
}
Also used : EditRecordList(com.servoy.j2db.dataprocessing.EditRecordList) IRecord(com.servoy.j2db.dataprocessing.IRecord) IFormController(com.servoy.j2db.IFormController)

Aggregations

EditRecordList (com.servoy.j2db.dataprocessing.EditRecordList)2 IFormController (com.servoy.j2db.IFormController)1 IRecord (com.servoy.j2db.dataprocessing.IRecord)1 ScopesScope (com.servoy.j2db.scripting.ScopesScope)1 SolutionScope (com.servoy.j2db.scripting.SolutionScope)1 Scriptable (org.mozilla.javascript.Scriptable)1