Last change
on this file since 17444 was
17433,
checked in by dpiringe, 5 years ago
|
#3026:
- added property Description in IJsonItem and updated all construction calls
- updated UnsupportedJsonItem with unsupported property Description
- updated JsonItemBaseControl and JsonItemVMBase for new property Description
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Core;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.JsonInterface {
|
---|
9 | public class ValueLookupParameterConverter : BaseConverter {
|
---|
10 | public override int Priority => 4;
|
---|
11 | public override Type ConvertableType => typeof(IValueLookupParameter);
|
---|
12 |
|
---|
13 | public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
|
---|
14 | IValueLookupParameter param = item as IValueLookupParameter;
|
---|
15 | param.ActualName = CastValue<string>(data.ActualName);
|
---|
16 | if (param.Value != null)
|
---|
17 | root.Inject(param.Value, data, root);
|
---|
18 | }
|
---|
19 |
|
---|
20 | public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
|
---|
21 | IValueLookupParameter param = value as IValueLookupParameter;
|
---|
22 |
|
---|
23 | IJsonItem item = new JsonItem() {};
|
---|
24 |
|
---|
25 | if (param.Value != null) {
|
---|
26 | IJsonItem tmp = root.Extract(param.Value, root);
|
---|
27 | item = tmp;
|
---|
28 | } else {
|
---|
29 | item.Range = new object[] { GetMinValue(param.DataType), GetMaxValue(param.DataType) };
|
---|
30 | }
|
---|
31 | item.Name = param.Name;
|
---|
32 | item.Description = param.Description;
|
---|
33 | item.ActualName = param.ActualName;
|
---|
34 | return item;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.