Last change
on this file since 2716 was
1996,
checked in by mstoeger, 16 years ago
|
implemented IStorable and made use of the PersistenceManager wherever possible. #639
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1182] | 1 | using System.Globalization;
|
---|
[1385] | 2 | using System.Xml;
|
---|
[1996] | 3 | using HeuristicLab.Core;
|
---|
[1182] | 4 |
|
---|
[1194] | 5 | namespace HeuristicLab.Visualization.LabelProvider {
|
---|
[1996] | 6 | public class ContinuousLabelProvider : StorableBase, ILabelProvider {
|
---|
| 7 | private string format;
|
---|
[1182] | 8 |
|
---|
[1194] | 9 | public ContinuousLabelProvider() {}
|
---|
[1182] | 10 |
|
---|
[1194] | 11 | public ContinuousLabelProvider(string format) {
|
---|
[1182] | 12 | this.format = format;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public string GetLabel(double value) {
|
---|
| 16 | return value.ToString(format, CultureInfo.InvariantCulture);
|
---|
| 17 | }
|
---|
[1385] | 18 |
|
---|
[1996] | 19 | public override XmlNode GetXmlNode(string name, XmlDocument document, System.Collections.Generic.IDictionary<System.Guid, IStorable> persistedObjects) {
|
---|
| 20 | XmlNode node = base.GetXmlNode(name, document, persistedObjects);
|
---|
[1385] | 21 |
|
---|
[1996] | 22 | XmlSupport.SetAttribute("Format", format, node);
|
---|
[1385] | 23 |
|
---|
[1996] | 24 | return node;
|
---|
[1385] | 25 | }
|
---|
| 26 |
|
---|
[1996] | 27 | public override void Populate(XmlNode node, System.Collections.Generic.IDictionary<System.Guid, IStorable> restoredObjects) {
|
---|
| 28 | base.Populate(node, restoredObjects);
|
---|
| 29 |
|
---|
| 30 | this.format = XmlSupport.GetAttribute("Format", "0", node);
|
---|
[1385] | 31 | }
|
---|
[1182] | 32 | }
|
---|
| 33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.