Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3911

On binder BinderImpl line 333 change getDeclaredMethods for getMethods for MatchMedia inheritance

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.5.1.1
    • Fix Version/s: 8.5.2
    • Component/s: Databind 2
    • Security Level: Jimmy
    • Labels:
      None
    • Environment:

      zk framework

    • gh.sprint.customfield.default.name:
      ZK 8.5.2 S1

      Description

      We want to use MatchMedia for fluid responsiveness, but the binder implementation scan the MatchMedia annotation on the final Methods of the View Model, this cause that the same code, must be repeated on every ViewModel of the application, Why just don't change .getDeclaredMethods for .getMethods in order to allow the reuse of code, for example:

      //Code must be repeated on every VM, why not allow to put it on a super class VM
      private String layoutTemplate;
      
          @MatchMedia("all and (max-width: 768px) and (min-width: 415px)")
          @NotifyChange("layoutTemplate")
          public void ipad(@ContextParam() {
              this.layoutTemplate = "iPad_layout";
          }
      
          @MatchMedia("all and (max-width: 414px)")
          @NotifyChange("layoutTemplate")
          public void mobile(@ContextParam() {
              this.layoutTemplate = "mobile_layout";
          }
      
          @MatchMedia("all and (min-width: 769px)")
          @NotifyChange("layoutTemplate")
          public void desktop() {
              this.layoutTemplate = "desktop_layout";
          }
      
      //getters and setters ......
      

        Activity

        Hide
        dgofast dgofast added a comment -

        BinderImpl.java

        //line 333
        		for (Method m : BindUtils.getViewModelClass(getViewModel()).getDeclaredMethods()) {
        			MatchMedia annomm = m.getAnnotation(MatchMedia.class);
        			if (annomm != null) {
        
        
        Show
        dgofast dgofast added a comment - BinderImpl.java //line 333 for (Method m : BindUtils.getViewModelClass(getViewModel()).getDeclaredMethods()) { MatchMedia annomm = m.getAnnotation(MatchMedia.class); if (annomm != null ) {
        Hide
        Anonymous added a comment -

        Fixed since 2018/06/11

        Show
        Anonymous added a comment - Fixed since 2018/06/11

          People

          • Assignee:
            CharlesQiu CharlesQiu
            Reporter:
            dgofast dgofast
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 4 hours
              4h
              Remaining:
              Time Spent - 1 hour Remaining Estimate - 3 hours
              3h
              Logged:
              Time Spent - 1 hour Remaining Estimate - 3 hours
              1h

                Agile