Project

General

Profile

GuiWebDriver.java.patch

Sergey Ivanovskiy, 11/20/2026 11:30 AM

Download (3.12 KB)

View differences:

new/src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2026-11-20 13:33:00 +0000
2778 2778
   }
2779 2779

  
2780 2780
   /**
2781
    * Retrieves the effective direct upload definitions.
2781
    * Retrieves the effective direct upload definitions of all windows. The web client replaces the
2782
    * definitions of every window with the ones it receives, so the result is always the complete set.
2782 2783
    *
2783
    * @return  A map of widget IDs to lists of client direct upload definitions.
2784
    *          Each client direct upload definition contains information such as
2785
    *          widget ID, event codes, title, multiple file upload support,
2786
    *          upload flag, upload directory, file filters, and widget bounds.
2784
    * @return  A map of window IDs to lists of client direct upload definitions, or {@code null} if
2785
    *          neither a registration nor the state of a registered widget changed since the last
2786
    *          call. Each client direct upload definition contains information such as widget ID,
2787
    *          event codes, title, multiple file upload support, upload flag, upload directory, file
2788
    *          filters, and widget bounds.
2787 2789
    */
2788 2790
   private Map<Integer, List<ClientDirectUploadDef>> getDirectUploadDefinitions()
2789 2791
   {
2790 2792
      ThinClient tc = ThinClient.getInstance();
2791 2793

  
2792
      List<DirectUploadDef> list = tc.getEffectiveDirectUploads();
2793
      boolean nomod = tc.getDirectUploadsModcount() == directUploadsModcount;
2794
      Map<Integer, List<ClientDirectUploadDef>> uploadDefs = nomod ? null : new HashMap<>();
2794
      List<DirectUploadDef> list     = tc.getEffectiveDirectUploads();
2795
      int                   modcount = tc.getDirectUploadsModcount();
2796
      boolean               nomod    = modcount == directUploadsModcount;
2797

  
2798
      directUploadsModcount = modcount;
2799

  
2800
      // the web client drops the definitions of all windows before it registers the ones sent, so a
2801
      // state change of one registered widget (e.g. hidden or disabled) must resend the complete set
2802
      if (nomod &&
2803
          (list == null || list.stream().noneMatch(ed -> stateChanged.contains(ed.getWidgetId()))))
2804
      {
2805
         return null;
2806
      }
2807

  
2808
      Map<Integer, List<ClientDirectUploadDef>> uploadDefs = new HashMap<>();
2795 2809

  
2796 2810
      if (list != null)
2797 2811
      {
......
2799 2813
         {
2800 2814
            int wid = ed.getWidgetId();
2801 2815

  
2802
            // proceed even when directUploadsModcount didn't change, but the widget encountered
2803
            // a state change
2804
            if (nomod && !stateChanged.contains(wid))
2805
            {
2806
               continue;
2807
            }
2808

  
2809
            if (uploadDefs == null)
2810
            {
2811
               uploadDefs = new HashMap<>();
2812
            }
2813

  
2814 2816
            Widget w = tc.getWidget(wid);
2815 2817
            if (w == null || !w.isVisible() || !w.isEnabled())
2816 2818
            {
......
2838 2840
         }
2839 2841
      }
2840 2842

  
2841
      directUploadsModcount = tc.getDirectUploadsModcount();
2842 2843
      return uploadDefs;
2843 2844
   }
2844 2845