private void gridView_ShowCellToolTip(DataGridViewCell cell) { MassSpectrum spectrum = cell.OwningRow.Tag as MassSpectrum; Spectrum s = spectrum.Element; TreeViewForm treeViewForm = new TreeViewForm(spectrum); TreeView tv = treeViewForm.TreeView; if (gridView.Columns[cell.ColumnIndex].Name == "PrecursorInfo") { treeViewForm.Text = "Precursor Details"; if (s.precursors.Count == 0) { tv.Nodes.Add("No precursor information available."); } else { foreach (Precursor p in s.precursors) { string pNodeText = "Precursor scan"; if (p.sourceFile != null && p.externalSpectrumID.Length > 0) { pNodeText += String.Format(": {0}:{1}", p.sourceFile.name, p.externalSpectrumID); } else if (p.spectrumID.Length > 0) { pNodeText += String.Format(": {0}", p.spectrumID); } TreeNode pNode = tv.Nodes.Add(pNodeText); addParamsToTreeNode(p as ParamContainer, pNode); if (p.selectedIons.Count == 0) { pNode.Nodes.Add("No selected ion list available."); } else { foreach (SelectedIon si in p.selectedIons) { TreeNode siNode = pNode.Nodes.Add("Selected ion"); //siNode.ToolTipText = new CVTermInfo(CVID.MS_selected_ion); // not yet in CV addParamsToTreeNode(si as ParamContainer, siNode); } } if (p.activation.empty()) { pNode.Nodes.Add("No activation details available."); } else { TreeNode actNode = pNode.Nodes.Add("Activation"); addParamsToTreeNode(p.activation as ParamContainer, actNode); } if (p.isolationWindow.empty()) { pNode.Nodes.Add("No isolation window details available."); } else { TreeNode iwNode = pNode.Nodes.Add("Isolation Window"); addParamsToTreeNode(p.isolationWindow as ParamContainer, iwNode); } } } } else if (gridView.Columns[cell.ColumnIndex].Name == "ScanInfo") { treeViewForm.Text = "Scan Configuration Details"; if (s.scanList.empty()) { tv.Nodes.Add("No scan details available."); } else { TreeNode slNode = tv.Nodes.Add("Scan List"); addParamsToTreeNode(s.scanList as ParamContainer, slNode); foreach (Scan scan in s.scanList.scans) { TreeNode scanNode = slNode.Nodes.Add("Acquisition"); addParamsToTreeNode(scan as ParamContainer, scanNode); foreach (ScanWindow sw in scan.scanWindows) { TreeNode swNode = scanNode.Nodes.Add("Scan Window"); addParamsToTreeNode(sw as ParamContainer, swNode); } } } } else if (gridView.Columns[cell.ColumnIndex].Name == "InstrumentConfigurationID") { treeViewForm.Text = "Instrument Configuration Details"; InstrumentConfiguration ic = s.scanList.scans[0].instrumentConfiguration; if (ic == null || ic.empty()) { tv.Nodes.Add("No instrument configuration details available."); } else { TreeNode icNode = tv.Nodes.Add(String.Format("Instrument Configuration ({0})", ic.id)); addParamsToTreeNode(ic as ParamContainer, icNode); if (ic.componentList.Count == 0) { icNode.Nodes.Add("No component list available."); } else { TreeNode clNode = icNode.Nodes.Add("Component List"); foreach (pwiz.CLI.msdata.Component c in ic.componentList) { string cNodeText; switch (c.type) { case ComponentType.ComponentType_Source: cNodeText = "Source"; break; case ComponentType.ComponentType_Analyzer: cNodeText = "Analyzer"; break; default: case ComponentType.ComponentType_Detector: cNodeText = "Detector"; break; } TreeNode cNode = clNode.Nodes.Add(cNodeText); addParamsToTreeNode(c as ParamContainer, cNode); } } Software sw = ic.software; if (sw == null || sw.empty()) { icNode.Nodes.Add("No software details available."); } else { TreeNode swNode = icNode.Nodes.Add(String.Format("Software ({0})", sw.id)); CVParam softwareParam = sw.cvParamChild(CVID.MS_software); TreeNode swNameNode = swNode.Nodes.Add("Name: " + softwareParam.name); swNameNode.ToolTipText = new CVTermInfo(softwareParam.cvid).def; swNode.Nodes.Add("Version: " + sw.version); } } } else if (gridView.Columns[cell.ColumnIndex].Name == "DataProcessing") { treeViewForm.Text = "Data Processing Details"; DataProcessing dp = s.dataProcessing; if (dp == null || dp.empty()) { tv.Nodes.Add("No data processing details available."); } else { TreeNode dpNode = tv.Nodes.Add(String.Format("Data Processing ({0})", dp.id)); if (dp.processingMethods.Count == 0) { dpNode.Nodes.Add("No component list available."); } else { TreeNode pmNode = dpNode.Nodes.Add("Processing Methods"); foreach (ProcessingMethod pm in dp.processingMethods) { addParamsToTreeNode(pm as ParamContainer, pmNode); } } } } else { return; } tv.ExpandAll(); treeViewForm.StartPosition = FormStartPosition.CenterParent; treeViewForm.AutoSize = true; //treeViewForm.DoAutoSize(); treeViewForm.Show(this.DockPanel); //leaveTimer.Start(); this.Focus(); }
private void gridView_ShowCellToolTip( DataGridViewCell cell ) { MassSpectrum spectrum = cell.OwningRow.Tag as MassSpectrum; Spectrum s = spectrum.Element; TreeViewForm treeViewForm = new TreeViewForm( spectrum ); TreeView tv = treeViewForm.TreeView; if( gridView.Columns[cell.ColumnIndex].Name == "PrecursorInfo" ) { treeViewForm.Text = "Precursor Details"; if( s.precursors.Count == 0 ) tv.Nodes.Add( "No precursor information available." ); else { foreach( Precursor p in s.precursors ) { string pNodeText = "Precursor scan"; if( p.sourceFile != null && p.externalSpectrumID.Length > 0 ) pNodeText += String.Format( ": {0}:{1}", p.sourceFile.name, p.externalSpectrumID ); else if( p.spectrumID.Length > 0 ) pNodeText += String.Format( ": {0}", p.spectrumID ); TreeNode pNode = tv.Nodes.Add( pNodeText ); addParamsToTreeNode( p as ParamContainer, pNode ); if( p.selectedIons.Count == 0 ) pNode.Nodes.Add( "No selected ion list available." ); else { foreach( SelectedIon si in p.selectedIons ) { TreeNode siNode = pNode.Nodes.Add( "Selected ion" ); //siNode.ToolTipText = new CVTermInfo(CVID.MS_selected_ion); // not yet in CV addParamsToTreeNode( si as ParamContainer, siNode ); } } if( p.activation.empty() ) pNode.Nodes.Add( "No activation details available." ); else { TreeNode actNode = pNode.Nodes.Add( "Activation" ); addParamsToTreeNode( p.activation as ParamContainer, actNode ); } if( p.isolationWindow.empty() ) pNode.Nodes.Add( "No isolation window details available." ); else { TreeNode iwNode = pNode.Nodes.Add( "Isolation Window" ); addParamsToTreeNode( p.isolationWindow as ParamContainer, iwNode ); } } } } else if( gridView.Columns[cell.ColumnIndex].Name == "ScanInfo" ) { treeViewForm.Text = "Scan Configuration Details"; if( s.scanList.empty() ) tv.Nodes.Add( "No scan details available." ); else { TreeNode slNode = tv.Nodes.Add( "Scan List" ); addParamsToTreeNode( s.scanList as ParamContainer, slNode ); foreach( Scan scan in s.scanList.scans ) { TreeNode scanNode = slNode.Nodes.Add( "Acquisition" ); addParamsToTreeNode( scan as ParamContainer, scanNode ); foreach( ScanWindow sw in scan.scanWindows ) { TreeNode swNode = scanNode.Nodes.Add( "Scan Window" ); addParamsToTreeNode( sw as ParamContainer, swNode ); } } } } else if( gridView.Columns[cell.ColumnIndex].Name == "InstrumentConfigurationID" ) { treeViewForm.Text = "Instrument Configuration Details"; InstrumentConfiguration ic = s.scanList.scans[0].instrumentConfiguration; if( ic == null || ic.empty() ) tv.Nodes.Add( "No instrument configuration details available." ); else { TreeNode icNode = tv.Nodes.Add( String.Format( "Instrument Configuration ({0})", ic.id ) ); addParamsToTreeNode( ic as ParamContainer, icNode ); if( ic.componentList.Count == 0 ) icNode.Nodes.Add( "No component list available." ); else { TreeNode clNode = icNode.Nodes.Add( "Component List" ); foreach( pwiz.CLI.msdata.Component c in ic.componentList ) { string cNodeText; switch( c.type ) { case ComponentType.ComponentType_Source: cNodeText = "Source"; break; case ComponentType.ComponentType_Analyzer: cNodeText = "Analyzer"; break; default: case ComponentType.ComponentType_Detector: cNodeText = "Detector"; break; } TreeNode cNode = clNode.Nodes.Add( cNodeText ); addParamsToTreeNode( c as ParamContainer, cNode ); } } Software sw = ic.software; if( sw == null || sw.empty() ) icNode.Nodes.Add( "No software details available." ); else { TreeNode swNode = icNode.Nodes.Add( String.Format( "Software ({0})", sw.id ) ); CVParam softwareParam = sw.cvParamChild( CVID.MS_software ); TreeNode swNameNode = swNode.Nodes.Add( "Name: " + softwareParam.name ); swNameNode.ToolTipText = new CVTermInfo( softwareParam.cvid ).def; swNode.Nodes.Add( "Version: " + sw.version ); } } } else if( gridView.Columns[cell.ColumnIndex].Name == "DataProcessing" ) { treeViewForm.Text = "Data Processing Details"; DataProcessing dp = s.dataProcessing; if( dp == null || dp.empty() ) tv.Nodes.Add( "No data processing details available." ); else { TreeNode dpNode = tv.Nodes.Add( String.Format( "Data Processing ({0})", dp.id ) ); if( dp.processingMethods.Count == 0 ) dpNode.Nodes.Add( "No component list available." ); else { TreeNode pmNode = dpNode.Nodes.Add( "Processing Methods" ); foreach( ProcessingMethod pm in dp.processingMethods ) { addParamsToTreeNode( pm as ParamContainer, pmNode ); } } } } else return; tv.ExpandAll(); treeViewForm.StartPosition = FormStartPosition.CenterParent; treeViewForm.AutoSize = true; //treeViewForm.DoAutoSize(); treeViewForm.Show( this.DockPanel ); //leaveTimer.Start(); this.Focus(); }