Last change
on this file since 3068 was
1996,
checked in by mstoeger, 15 years ago
|
implemented IStorable and made use of the PersistenceManager wherever possible. #639
|
File size:
1.0 KB
|
Line | |
---|
1 | using System.Globalization;
|
---|
2 | using System.Xml;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Visualization.LabelProvider {
|
---|
6 | public class ContinuousLabelProvider : StorableBase, ILabelProvider {
|
---|
7 | private string format;
|
---|
8 |
|
---|
9 | public ContinuousLabelProvider() {}
|
---|
10 |
|
---|
11 | public ContinuousLabelProvider(string format) {
|
---|
12 | this.format = format;
|
---|
13 | }
|
---|
14 |
|
---|
15 | public string GetLabel(double value) {
|
---|
16 | return value.ToString(format, CultureInfo.InvariantCulture);
|
---|
17 | }
|
---|
18 |
|
---|
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);
|
---|
21 |
|
---|
22 | XmlSupport.SetAttribute("Format", format, node);
|
---|
23 |
|
---|
24 | return node;
|
---|
25 | }
|
---|
26 |
|
---|
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);
|
---|
31 | }
|
---|
32 | }
|
---|
33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.