lwuit
  1. lwuit
  2. LWUIT-454

three little things for Component.java

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      any

      Description

      The following patch adresses three little things in Component.java that you might want to consider:
      1) The tensile drag length should be configurable. Actually there are two lengths that the user might want to adjust: the length that a component can actively be dragged out of it's normal bounds and the length that the scroll animation uses when it reaches the end of the scroll area. This change allows to adjust the second one, only.

      2) The Display.getDragSpeed() method occasionally would return zero (-0.0) on my device which would lead to the motion object to return quite high values making the scrolling very fast. I added a check to not start a drag animation in that case. It would not happen often anyway. Seems to happen only when a new drag happens on an active drag animation, and even then it works most of the time.

      3) The scrollbar would not fade out on a fresh component that has not been touched yet. So I registered the component as an animation on initialization. My initial attempt would blow up the paint queue which made me add the isScrollable() condition. I also added this condidtion to every other place where the animation is registered to trigger the scroll bar fade, as well as in the animate() method itself. It looks to me that currently many components are registered without reason whenever the look+feel enables the isFadeScrollBar().

      # This patch file was generated by NetBeans IDE
      # It uses platform neutral UTF-8 encoding and \n newlines.
      --- Base (BASE)
      +++ Locally Modified (Based On LOCAL)
      @@ -1891,7 +1891,7 @@
           }
       
           private void pointerReleaseImpl(int x, int y) {
      -        if(UIManager.getInstance().getLookAndFeel().isFadeScrollBar()) {
      +        if(UIManager.getInstance().getLookAndFeel().isFadeScrollBar() && isScrollable()) {
                   Form frm = getComponentForm();
                   if(frm != null) {
                       frm.registerAnimatedInternal(this);
      @@ -1924,10 +1924,11 @@
                       }
                   }
                   float speed = Display.getInstance().getDragSpeed(!shouldScrollX);
      -            int tensileLength = getWidth() / 2;
      +            int tensileLength = getTensileLength();
                   if(!isTensileDragEnabled()) {
                       tensileLength = 0;
                   }
      +            if(speed != 0.0){
                   if(!shouldScrollX) {
                       if(speed < 0) {
                           draggedMotion = Motion.createFrictionMotion(scroll, -tensileLength, speed, 0.0004f);
      @@ -1947,7 +1948,19 @@
                   draggedMotion.start();
               }
           }
      +    }
       
      +    private int tensileLength = 60;
      +
      +    public int getTensileLength() {
      +        return tensileLength;
      +    }
      +
      +    public void setTensileLength(int tensileLength) {
      +        this.tensileLength = tensileLength;
      +    }
      +    
      +
           /**
            * Returns the Component Style allowing us to manipulate the look of the 
            * component
      @@ -2238,9 +2251,16 @@
                       if (pf != null) {
                           pf.registerAnimated(this);
                       }
      +            } else if (scrollOpacity == 0xff && isScrollable()
      +                    && UIManager.getInstance().getLookAndFeel().isFadeScrollBar()) {
      +                // trigger initial fade process on a fresh view.
      +                Form pf = getComponentForm();
      +                if (pf != null) {
      +                    pf.registerAnimatedInternal(this);
                   }
               }
           }
      +    }
       
           void deregisterAnimatedInternal() {
               Form f = getComponentForm();
      @@ -2361,7 +2381,7 @@
                   animateBackground = bgp != null && bgp instanceof Animation && ((Animation)bgp).animate();
               }
       
      -        if(UIManager.getInstance().getLookAndFeel().isFadeScrollBar()) {
      +        if(UIManager.getInstance().getLookAndFeel().isFadeScrollBar() && isScrollable()) {
                   if(scrollOpacity > 0 && !dragActivated) {
                       scrollOpacity = Math.max(0, scrollOpacity - scrollOpacityChangeSpeed);
                       return true;
      
      

        Activity

        Hide
        vprise added a comment -

        Fixed in SVN

        Show
        vprise added a comment - Fixed in SVN

          People

          • Assignee:
            Unassigned
            Reporter:
            thorsten_s
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: