Search in sources :

Example 6 with IDataAdapterList

use of com.servoy.j2db.server.ngclient.IDataAdapterList in project servoy-client by Servoy.

the class WebFormController method refreshAllPartRenderers.

@Override
protected void refreshAllPartRenderers(IRecordInternal[] records) {
    if (!isFormVisible || application.isShutDown() || rendering)
        return;
    // don't do anything yet when there are records but the selection is invalid
    if (formModel != null && (formModel.getSize() > 0 && (formModel.getSelectedIndex() < 0 || formModel.getSelectedIndex() >= formModel.getSize())))
        return;
    // let the ui know that it will be touched, so that locks can be taken if needed.
    boolean executeOnRecordSelect = false;
    IRecordInternal[] state = records;
    if (state == null) {
        if (formModel != null) {
            state = new IRecordInternal[] { formModel.getPrototypeState() };
        } else {
            state = new IRecordInternal[] { new PrototypeState(null) };
        }
    }
    if (!(records == null && formModel != null && formModel.getRawSize() > 0) && isStateChanged(state)) {
        lastState = state;
        executeOnRecordSelect = true;
    }
    IDataAdapterList dataAdapterList = getFormUI().getDataAdapterList();
    for (IRecordInternal r : state) dataAdapterList.setRecord(r, true);
    if (executeOnRecordSelect) {
        // do this at the end because dataRenderer.refreshRecord(state) will update selection
        // for related tabs - and we should execute js code after they have been updated
        executeOnRecordSelect();
    }
}
Also used : IRecordInternal(com.servoy.j2db.dataprocessing.IRecordInternal) IDataAdapterList(com.servoy.j2db.server.ngclient.IDataAdapterList) PrototypeState(com.servoy.j2db.dataprocessing.PrototypeState)

Aggregations

IDataAdapterList (com.servoy.j2db.server.ngclient.IDataAdapterList)6 Form (com.servoy.j2db.persistence.Form)3 IWebFormUI (com.servoy.j2db.server.ngclient.IWebFormUI)2 JSONObject (org.json.JSONObject)2 Test (org.junit.Test)2 CustomValueList (com.servoy.j2db.dataprocessing.CustomValueList)1 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)1 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)1 IValueList (com.servoy.j2db.dataprocessing.IValueList)1 PrototypeState (com.servoy.j2db.dataprocessing.PrototypeState)1 Field (com.servoy.j2db.persistence.Field)1 IPersist (com.servoy.j2db.persistence.IPersist)1 TabPanel (com.servoy.j2db.persistence.TabPanel)1 ValueList (com.servoy.j2db.persistence.ValueList)1 ComponentContext (com.servoy.j2db.server.ngclient.ComponentContext)1 FormElement (com.servoy.j2db.server.ngclient.FormElement)1 IWebFormController (com.servoy.j2db.server.ngclient.IWebFormController)1 ServoyDataConverterContext (com.servoy.j2db.server.ngclient.ServoyDataConverterContext)1 WebFormComponent (com.servoy.j2db.server.ngclient.WebFormComponent)1 WebFormUI (com.servoy.j2db.server.ngclient.WebFormUI)1