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;
}
Aggregations