Last change
on this file since 17828 was
17828,
checked in by dpiringe, 3 years ago
|
#3026
- removed the option to set the value for JsonItems via exporter
- reworked some base controls
- added new controls for JsonItem specific properties (e.g. ArrayResizable)
- deleted a lot of obsolet controls
- removed the Enable checkbox in the detail view of JsonItems
- exporter now clones the IOptimizer object
- added a check + message for unsupported exports
- list of JsonItems now includes unsupported JsonItems (disabled and marked with 'unsupported')
- refactored the converter type check
- now every converter has to specify its supported type(s)
|
File size:
977 bytes
|
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 | using HeuristicLab.Optimization;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.JsonInterface {
|
---|
10 | public class ResultParameterConverter : BaseConverter {
|
---|
11 | public override int Priority => 5;
|
---|
12 |
|
---|
13 | public override Type ConvertableType => typeof(IResultParameter);
|
---|
14 |
|
---|
15 | public override bool CanConvertType(Type t) =>
|
---|
16 | t.GetInterfaces().Any(x => x == typeof(IResultParameter));
|
---|
17 |
|
---|
18 | public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
|
---|
19 | IResultParameter res = value as IResultParameter;
|
---|
20 | return new ResultJsonItem() {
|
---|
21 | Name = res.ActualName,
|
---|
22 | Description = res.Description
|
---|
23 | };
|
---|
24 | }
|
---|
25 |
|
---|
26 | public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
|
---|
27 | IResultParameter res = item as IResultParameter;
|
---|
28 | res.ActualName = data.Name;
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.