Project

General

Profile

6016-20220202.patch

Marian Edu, 02/02/2022 09:47 AM

Download (3.67 KB)

View differences:

new/src/com/goldencode/p2j/ui/ControlSetEntity.java 2022-02-02 14:43:25 +0000
96 96
**     HC  20211102          Implemented i18n support.
97 97
**     AL2 20220124          Make all control set entities to check for screen-value validity.
98 98
**     ME  20220201          Allow for multiple values list when setting screen-value (delimiter is used).
99
**     ME  20220202          Do not split value using delimiter on validateScreenValue - only selection-list
99 100
*/
100 101
/*
101 102
** This program is free software: you can redistribute it and/or modify
......
2866 2867
   }
2867 2868
   
2868 2869
   /**
2869
    * Validate the value(s) for SCREEN-VALUE attribute, the delimiter is used
2870
    * to split it into an array.
2870
    * Validate the value(s) for SCREEN-VALUE attribute.
2871 2871
    * 
2872 2872
    * @param value
2873 2873
    * The to be validated as SCREEN-VALUE attribute.
......
2876 2876
    */
2877 2877
   boolean validateScreenValue(character value)
2878 2878
   {
2879
      if (!value.isUnknown())
2879
      if (!isValidScreenValue(value))
2880 2880
      {
2881
         char delimiter = getAttr("delimiter", () -> config.delimiter);
2882
         character[] values = TextOps.entries(character.class, value.getValue(),
2883
                  String.valueOf(delimiter));
2884

  
2885
         if (!isValidScreenValue(values))
2881
         if (_isRealized())
2886 2882
         {
2887
            if (_isRealized())
2888
            {
2889
               ErrorManager.recordOrShowWarning(4058, String.format(
2890
                        "Attribute SCREEN-VALUE for the %s %s has an invalid value of %s", type(),
2891
                        widgetName(), (value.isUnknown() ? "UNKNOWN" : value.getValue())), true,
2892
                        false, false, true);
2893
            }
2894

  
2895
            return false;
2883
            ErrorManager.recordOrShowWarning(4058, String.format(
2884
                     "Attribute SCREEN-VALUE for the %s %s has an invalid value of %s", type(),
2885
                     widgetName(), (value.isUnknown() ? "UNKNOWN" : value.getValue())), true,
2886
                     false, false, true);
2896 2887
         }
2888

  
2889
         return false;
2897 2890
      }
2898 2891

  
2899 2892
      return true;
......
2936 2929
      
2937 2930
      for (character value : values)
2938 2931
      {
2939
         if (!value.isUnknown() &&
2932
         if (value.isUnknown() ||
2940 2933
             !Arrays.stream(items).anyMatch(item -> CompareOps._isEqual(item.getCharacterValue(), value)))
2941 2934
         {
2942 2935
            return false;
new/src/com/goldencode/p2j/ui/SelectionListWidget.java 2022-02-02 14:44:08 +0000
57 57
**                           widget must be rejected with the warning 4053. See #5937-53.
58 58
**     AL2 20220124          Check screen-value validity through ControlSetEntity.
59 59
**     ME  20220201          Handle multiple values list in set screen-value.
60
**     ME  20220202          Split value using delimiter on validateScreenValue.
60 61
*/
61 62
/*
62 63
** This program is free software: you can redistribute it and/or modify
......
1013 1014
   protected boolean isValidScreenValue(character value)
1014 1015
   {
1015 1016
      // it is valid to assign unknown to screen-value of a selection list widget
1016
      return value.isUnknown() || super.isValidScreenValue(value);
1017
      if (value.isUnknown())
1018
         return true;
1019
      
1020
      char delimiter = getAttr("delimiter", () -> config.delimiter);
1021
      character[] values = TextOps.entries(character.class, value.getValue(),
1022
               String.valueOf(delimiter));
1023
      
1024
      return super.isValidScreenValue(values);
1017 1025
   }
1018 1026

  
1019 1027
   /**