Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17485


Ignore:
Timestamp:
03/23/20 16:40:16 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • fixed a bug in ConstrainedValueParameterConverter -> added an extra check to get the correct child
  • fixed a bug in JsonItemValidator -> now the error messages get appended correctly
  • fixed a validation bug in JsonItemMultiValueControl -> now it should not validate a readonly textbox anymore
Location:
branches/3026_IntegrationIntoSymSpace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.cs

    r17484 r17485  
    182182    #region Validation
    183183    private void textBoxRows_Validating(object sender, CancelEventArgs e) {
    184       if (string.IsNullOrWhiteSpace(textBoxRows.Text)) {
    185         errorProvider.SetError(textBoxRows, "'Rows' must not be empty.");
    186         e.Cancel = true;
    187       } else if (!int.TryParse(textBoxRows.Text, out int r)) {
    188         errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer.");
    189         e.Cancel = true;
    190       } else if (r == 0) {
    191         errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer larger than 0.");
    192         e.Cancel = true;
    193       } else {
     184      if (textBoxRows.ReadOnly) {
    194185        errorProvider.SetError(textBoxRows, null);
     186      } else {
     187        if (string.IsNullOrWhiteSpace(textBoxRows.Text)) {
     188          errorProvider.SetError(textBoxRows, "'Rows' must not be empty.");
     189          e.Cancel = true;
     190        } else if (!int.TryParse(textBoxRows.Text, out int r)) {
     191          errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer.");
     192          e.Cancel = true;
     193        } else if (r == 0) {
     194          errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer larger than 0.");
     195          e.Cancel = true;
     196        } else {
     197          errorProvider.SetError(textBoxRows, null);
     198        }
    195199      }
    196200    }
    197201
    198202    private void textBoxColumns_Validating(object sender, CancelEventArgs e) {
    199       if (string.IsNullOrWhiteSpace(textBoxColumns.Text)) {
    200         errorProvider.SetError(textBoxColumns, "'Columns' must not be empty.");
    201         e.Cancel = true;
    202       } else if (!int.TryParse(textBoxColumns.Text, out int r)) {
    203         errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer.");
    204         e.Cancel = true;
    205       } else if (r == 0) {
    206         errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer larger than 0.");
    207         e.Cancel = true;
    208       } else {
     203      if (textBoxColumns.ReadOnly) {
    209204        errorProvider.SetError(textBoxColumns, null);
     205      } else {
     206        if (string.IsNullOrWhiteSpace(textBoxColumns.Text)) {
     207          errorProvider.SetError(textBoxColumns, "'Columns' must not be empty.");
     208          e.Cancel = true;
     209        } else if (!int.TryParse(textBoxColumns.Text, out int r)) {
     210          errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer.");
     211          e.Cancel = true;
     212        } else if (r == 0) {
     213          errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer larger than 0.");
     214          e.Cancel = true;
     215        } else {
     216          errorProvider.SetError(textBoxColumns, null);
     217        }
    210218      }
    211219    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs

    r17483 r17485  
    2121      if (parameter.ActualValue != null && parameter.ActualValue is IParameterizedItem && cdata.Children != null) {
    2222        foreach(var child in cdata.Children) {
    23           if(child.Name == cdata.Value || child.Path.EndsWith(cdata.Value))
     23          if(child.Name == cdata.Value || child.Path.EndsWith(cdata.Value) || child.Name == parameter.ActualValue.ItemName)
    2424            root.Inject(parameter.ActualValue, child, root);
    2525        }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs

    r17481 r17485  
    4242
    4343      public ValidationResult Validate() {
    44         IEnumerable<string> errors = Enumerable.Empty<string>();
     44        List<string> errors = new List<string>();
    4545        bool success = true;
    4646        foreach(var x in Root) {
    47           var res = ((JsonItem)x).Validate();
    48           //if one success is false -> whole validation is false
    49           success = success && res.Success;
    50           errors.Concat(res.Errors);
     47          JsonItem item = x as JsonItem;
     48          if(item.Active) {
     49            var res = ((JsonItem)x).Validate();
     50            //if one success is false -> whole validation is false
     51            success = success && res.Success;
     52            errors.AddRange(res.Errors);
     53          }
    5154        }
    5255        return new ValidationResult(success, errors);
Note: See TracChangeset for help on using the changeset viewer.