- Timestamp:
- 03/21/09 10:07:16 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/LabelProvider/StringLabelProvider.cs
r1194 r1385 2 2 using System.Collections.Generic; 3 3 using HeuristicLab.Visualization.LabelProvider; 4 using System.Xml; 4 5 5 6 namespace HeuristicLab.Visualization.LabelProvider { … … 26 27 return string.Empty; 27 28 } 29 30 public XmlNode GetLabelProviderXmlNode() { 31 XmlDocument Xdoc = new XmlDocument(); 32 33 XmlNode lblProvInfo = Xdoc.CreateNode(XmlNodeType.Element, "LabelProvider", null); 34 lblProvInfo.InnerText = "StringLabelProvider"; 35 36 foreach (KeyValuePair<int, string> pair in labels) 37 { 38 XmlNode strLbl = Xdoc.CreateNode(XmlNodeType.Element, "String", null); 39 40 XmlAttribute idStrLbl = Xdoc.CreateAttribute("id"); 41 idStrLbl.Value = pair.Key.ToString(); 42 strLbl.Attributes.Append(idStrLbl); 43 44 strLbl.InnerText = pair.Value; 45 lblProvInfo.AppendChild(strLbl); 46 } 47 return lblProvInfo; 48 } 49 50 public ILabelProvider PopulateLabelProviderXmlNode(XmlNode node) { 51 var labelProvider = new StringLabelProvider(); 52 53 foreach (XmlNode strLbl in node.SelectNodes("//String")) 54 { 55 labelProvider.SetLabel(int.Parse(strLbl.Attributes[0].Value), strLbl.InnerText); 56 } 57 return labelProvider; 58 } 28 59 } 29 60 }
Note: See TracChangeset
for help on using the changeset viewer.