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:
1.0 KB
|
Rev | Line | |
---|
[17266] | 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 |
|
---|
[17284] | 8 | namespace HeuristicLab.JsonInterface {
|
---|
[17407] | 9 | public class LookupParameterConverter : BaseConverter {
|
---|
[17394] | 10 | public override int Priority => 3;
|
---|
| 11 | public override Type ConvertableType => typeof(ILookupParameter);
|
---|
[17828] | 12 |
|
---|
| 13 | public override bool CanConvertType(Type t) =>
|
---|
| 14 | t.GetInterfaces().Any(x => x == typeof(ILookupParameter));
|
---|
| 15 |
|
---|
[17407] | 16 | public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
|
---|
[17471] | 17 | ((ILookupParameter)item).ActualName = ((ILookupJsonItem)data).ActualName as string;
|
---|
[17266] | 18 |
|
---|
[17407] | 19 | public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
|
---|
| 20 | IParameter parameter = value as IParameter;
|
---|
[17394] | 21 |
|
---|
[17471] | 22 | IJsonItem item = new LookupJsonItem() {
|
---|
[17407] | 23 | Name = parameter.Name,
|
---|
[17433] | 24 | Description = parameter.Description,
|
---|
[17407] | 25 | ActualName = ((ILookupParameter)parameter).ActualName
|
---|
| 26 | };
|
---|
| 27 | return item;
|
---|
| 28 | }
|
---|
[17266] | 29 | }
|
---|
| 30 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.