// First get a complete copy of the current node
final RecordModel array = node.getRecordModel();
array.setValue( "equipment_file_name", file.getAbsolutePath(), false ); //$NON-NLS-1$
// Go through the stored model and find the appropriate recording for each spot node at this scope is an Assay
final NodeUtils nodeUtils = new NodeUtils();
// Need the microscope recording object here in order to add a microscope:
MicroscopeRecording recording =null;
String lensNA =""; //$NON-NLS-1$
String mag=""; //$NON-NLS-1$
String lensName=""; //$NON-NLS-1$
// Need to precompute the total number of spots on each dish and cache this
final int numberOfDishes = nodeUtils.getIntegerFieldValue( node, "numberOfDishes" ); //$NON-NLS-1$
for( int i = 0; i < numberOfDishes; i++ )
{
final String dishDisplayName = "DISH:-" + ( i + 1 ); //$NON-NLS-1$
RecordModel microscopeRecordModel = recordModelFactory.createRecordModel( "Microscope" ); //$NON-NLS-1$
for( Enumeration assayChildren = node.children(); assayChildren.hasMoreElements(); )
{
NavigationTreeNode dishNode = (NavigationTreeNode)assayChildren.nextElement();
if( dishNode.getDisplayName().trim().equals( dishDisplayName ) )
{
// should have got the appropriate dish by here
// Get number of rows/columns from this dish, as each dish could be different :-(
final int rows = nodeUtils.getIntegerFieldValue( dishNode, "numberOfRows" ); //$NON-NLS-1$
final int columns = nodeUtils.getIntegerFieldValue( dishNode, "numberOfColumns" ); //$NON-NLS-1$
final List selectedSpots = new ArrayList();
final Collection deselectedSpots = new ArrayList();
for( Enumeration spotNodes = dishNode.children(); spotNodes.hasMoreElements(); )
{
final NavigationTreeNode spotNode = (NavigationTreeNode)spotNodes.nextElement();
final int rowNumber = nodeUtils.getIntegerFieldValue( spotNode, "row" ); //$NON-NLS-1$
final int columnNumber = nodeUtils.getIntegerFieldValue( spotNode, "column" ); //$NON-NLS-1$
final Collection plasmids = new ArrayList();
final Spot spot = new Spot( new SpotReading( plasmids, plasmids ) );
spot.setRow( rowNumber );
spot.setColumn( columnNumber );
selectedSpots.add( spot );
}
// Ask the user about which spots they asked the microscope to track
getTrackedSpots( rows, columns, recordings.size(), selectedSpots, deselectedSpots );
final boolean deleteNonTrackedSpots = ( deselectedSpots.size() > 0 ) ? deleteNonTrackedSpots() : false;
for( Enumeration spotNodes = dishNode.children(); spotNodes.hasMoreElements(); )
{
final NavigationTreeNode spotNode = (NavigationTreeNode)spotNodes.nextElement();
if( spotNode.getDisplayName().trim().startsWith( "SPOTREADING" ) ) //$NON-NLS-1$
{
final int rowNumber = nodeUtils.getIntegerFieldValue( spotNode, "row" ); //$NON-NLS-1$
final int columnNumber = nodeUtils.getIntegerFieldValue( spotNode, "column" ); //$NON-NLS-1$
// Now get the appropriate Microscope model and add it to this spot:
recording = getRecording( recordings, selectedSpots, rowNumber, columnNumber );
final RecordModel spotRecordModel = spotNode.getRecordModel();