Search in sources :

Example 16 with ISwingFoundSet

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

the class ChainedRelatedFoundsetSelectionMonitor method update.

/**
 * Updates record selection listeners - if needed - for each related foundset in the link of relations.
 *
 * @param newRelatedFoundset newRelatedFoundset will always be rootRecord.getValue(nestedRelationNames)
 * @param rootRecord the root record where the chain of relations to monitor starts
 * @param nestedRelationNames the chain of relations like "relation1.relation2.relation3"
 */
public void update(IFoundSetInternal newRelatedFoundset, @SuppressWarnings("hiding") IRecordInternal rootRecord, @SuppressWarnings("hiding") String nestedRelationNames) {
    if (relatedFoundset != newRelatedFoundset) {
        unregisterListeners();
        relatedFoundset = newRelatedFoundset;
        // add new listeners
        String[] relationNames = nestedRelationNames.split("\\.");
        IRecordInternal currentRecord = rootRecord;
        for (int i = 0; i < relationNames.length - 1; i++) {
            ISwingFoundSet currentRelatedFoundset = (ISwingFoundSet) currentRecord.getValue(relationNames[i]);
            currentRelatedFoundset.getSelectionModel().addListSelectionListener(listSelectionListener);
            monitoredChainedFoundsets.add(currentRelatedFoundset);
            currentRecord = currentRelatedFoundset.getRecord(currentRelatedFoundset.getSelectedIndex());
            if (currentRecord == null)
                break;
        }
    }
    this.rootRecord = rootRecord;
    this.nestedRelationNames = nestedRelationNames;
}
Also used : IRecordInternal(com.servoy.j2db.dataprocessing.IRecordInternal) ISwingFoundSet(com.servoy.j2db.dataprocessing.ISwingFoundSet)

Aggregations

ISwingFoundSet (com.servoy.j2db.dataprocessing.ISwingFoundSet)16 IRecordInternal (com.servoy.j2db.dataprocessing.IRecordInternal)11 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)10 Point (java.awt.Point)6 FoundSet (com.servoy.j2db.dataprocessing.FoundSet)3 IDisplayData (com.servoy.j2db.dataprocessing.IDisplayData)3 ServoyException (com.servoy.j2db.util.ServoyException)3 EventObject (java.util.EventObject)3 IApplication (com.servoy.j2db.IApplication)2 FoundSetManager (com.servoy.j2db.dataprocessing.FoundSetManager)2 IFoundSet (com.servoy.j2db.dataprocessing.IFoundSet)2 SortColumn (com.servoy.j2db.dataprocessing.SortColumn)2 IScriptableProvider (com.servoy.j2db.scripting.IScriptableProvider)2 IComponent (com.servoy.j2db.ui.IComponent)2 IFieldComponent (com.servoy.j2db.ui.IFieldComponent)2 IRuntimeComponent (com.servoy.j2db.ui.runtime.IRuntimeComponent)2 Color (java.awt.Color)2 ArrayList (java.util.ArrayList)2 Component (org.apache.wicket.Component)2 BaseQueryTable (com.servoy.base.query.BaseQueryTable)1