Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/MatrixJsonItem.cs @ 17519

Last change on this file since 17519 was 17519, checked in by dpiringe, 4 years ago

#3026:

  • added error output for failed runner initialization
  • reorganised some final view models
  • TargetedJsonItemType (in JsonItemVMBase) now automatically returns the type of the defined JsonItem
  • code cleanup
  • refactored RegressionProblemDataConverter
  • added lots of comments
  • added new view for StringArrayJsonItem
  • added new UI component for concrete restricted items and used it in JsonItemConcreteItemArrayControl and JsonItemValidValuesControl
File size: 1.1 KB
Line 
1using System.Collections.Generic;
2using Newtonsoft.Json.Linq;
3
4namespace HeuristicLab.JsonInterface {
5  public abstract class MatrixJsonItem<T> : ValueJsonItem<T[][]>, IMatrixJsonItem {
6    public virtual bool RowsResizable { get; set; }
7    public virtual bool ColumnsResizable { get; set; }
8
9    IList<string> rows = new List<string>();
10    public IEnumerable<string> RowNames {
11      get => rows;
12      set => rows = new List<string>(value);
13    }
14
15    IList<string> cols = new List<string>();
16    public IEnumerable<string> ColumnNames {
17      get => cols;
18      set => cols = new List<string>(value);
19    }
20
21    public override void SetJObject(JObject jObject) {
22      base.SetJObject(jObject);
23      RowsResizable = (jObject[nameof(IMatrixJsonItem.RowsResizable)]?.ToObject<bool>()).GetValueOrDefault();
24      ColumnsResizable = (jObject[nameof(IMatrixJsonItem.ColumnsResizable)]?.ToObject<bool>()).GetValueOrDefault();
25      RowNames = jObject[nameof(IMatrixJsonItem.RowNames)]?.ToObject<IEnumerable<string>>();
26      ColumnNames = jObject[nameof(IMatrixJsonItem.ColumnNames)]?.ToObject<IEnumerable<string>>();
27    }
28  }
29}
Note: See TracBrowser for help on using the repository browser.