Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 352070 | Differences between
and this patch

Collapse All | Expand All

(-)js/qx/ui/selection/SelectionManager.js (-64 / +67 lines)
Lines 1668-1677 Link Here
1668
     */
1668
     */
1669
    getPageUp : function(vItem)
1669
    getPageUp : function(vItem)
1670
    {
1670
    {
1671
      var vBoundedWidget = this.getBoundedWidget();
1672
      var vParentScrollTop = vBoundedWidget.getScrollTop();
1673
      var vParentClientHeight = vBoundedWidget.getClientHeight();
1674
1675
      // Find next item
1671
      // Find next item
1676
      var nextItem = this.getLeadItem();
1672
      var nextItem = this.getLeadItem();
1677
1673
Lines 1679-1717 Link Here
1679
        nextItem = this.getFirst();
1675
        nextItem = this.getFirst();
1680
      }
1676
      }
1681
1677
1682
      // Normally we should reach the status "lead" for the
1678
      var vBoundedWidget = this.getBoundedWidget();
1683
      // nextItem after two iterations.
1679
      if( vBoundedWidget.isCreated() ) {
1684
      var tryLoops = 0;
1680
        var vParentScrollTop = vBoundedWidget.getScrollTop();
1685
1681
        var vParentClientHeight = vBoundedWidget.getClientHeight();
1686
      while (tryLoops < 2)
1682
        // Normally we should reach the status "lead" for the
1687
      {
1683
        // nextItem after two iterations.
1688
        while (nextItem && (this.getItemTop(nextItem) - this.getItemHeight(nextItem) >= vParentScrollTop)) {
1684
        var tryLoops = 0;
1689
          nextItem = this.getUp(nextItem);
1690
        }
1691
1692
        // This should never occour after the fix above
1693
        if (nextItem == null) {
1694
          break;
1695
        }
1696
1685
1697
        // If the nextItem is not anymore the leadItem
1686
        while (tryLoops < 2)
1698
        // Means: There has occured a change.
1699
        // We break here. This is normally the second step.
1700
        if (nextItem != this.getLeadItem())
1701
        {
1687
        {
1702
          // be sure that the top is reached
1688
          while (nextItem && (this.getItemTop(nextItem) - this.getItemHeight(nextItem) >= vParentScrollTop)) {
1703
          this.scrollItemIntoView(nextItem, true);
1689
            nextItem = this.getUp(nextItem);
1704
          break;
1690
          }
1705
        }
1691
1692
          // This should never occour after the fix above
1693
          if (nextItem == null) {
1694
            break;
1695
          }
1696
1697
          // If the nextItem is not anymore the leadItem
1698
          // Means: There has occured a change.
1699
          // We break here. This is normally the second step.
1700
          if (nextItem != this.getLeadItem())
1701
          {
1702
            // be sure that the top is reached
1703
            this.scrollItemIntoView(nextItem, true);
1704
            break;
1705
          }
1706
1706
1707
        // Update scrolling (this is normally the first step)
1707
          // Update scrolling (this is normally the first step)
1708
        vBoundedWidget.setScrollTop(vParentScrollTop - vParentClientHeight - this.getItemHeight(nextItem));
1708
          vBoundedWidget.setScrollTop(vParentScrollTop - vParentClientHeight - this.getItemHeight(nextItem));
1709
1709
1710
        // Use the real applied value instead of the calulated above
1710
          // Use the real applied value instead of the calulated above
1711
        vParentScrollTop = vBoundedWidget.getScrollTop();
1711
          vParentScrollTop = vBoundedWidget.getScrollTop();
1712
1712
1713
        // Increment counter
1713
          // Increment counter
1714
        tryLoops++;
1714
          tryLoops++;
1715
        }
1715
      }
1716
      }
1716
1717
1717
      return nextItem;
1718
      return nextItem;
Lines 1729-1776 Link Here
1729
     */
1730
     */
1730
    getPageDown : function(vItem)
1731
    getPageDown : function(vItem)
1731
    {
1732
    {
1732
      var vBoundedWidget = this.getBoundedWidget();
1733
      var vParentScrollTop = vBoundedWidget.getScrollTop();
1734
      var vParentClientHeight = vBoundedWidget.getClientHeight();
1735
1736
      // Find next item
1733
      // Find next item
1737
      var nextItem = this.getLeadItem();
1734
      var nextItem = this.getLeadItem();
1738
1735
1739
      if (!nextItem) {
1736
      if (!nextItem) {
1740
        nextItem = this.getFirst();
1737
        nextItem = this.getFirst();
1741
      }
1738
      }
1739
      
1740
      var vBoundedWidget = this.getBoundedWidget();
1741
      if( vBoundedWidget.isCreated() ) {
1742
        var vParentScrollTop = vBoundedWidget.getScrollTop();
1743
        var vParentClientHeight = vBoundedWidget.getClientHeight();
1744
1745
        // Normally we should reach the status "lead" for the
1746
        // nextItem after two iterations.
1747
        var tryLoops = 0;
1742
1748
1743
      // Normally we should reach the status "lead" for the
1749
        while (tryLoops < 2)
1744
      // nextItem after two iterations.
1750
        {
1745
      var tryLoops = 0;
1751
          // Find next
1746
1752
          while (nextItem && ((this.getItemTop(nextItem) + (2 * this.getItemHeight(nextItem))) <= (vParentScrollTop + vParentClientHeight))) {
1747
      while (tryLoops < 2)
1753
            nextItem = this.getDown(nextItem);
1748
      {
1754
          }
1749
        // Find next
1755
1750
        while (nextItem && ((this.getItemTop(nextItem) + (2 * this.getItemHeight(nextItem))) <= (vParentScrollTop + vParentClientHeight))) {
1756
          // This should never occour after the fix above
1751
          nextItem = this.getDown(nextItem);
1757
          if (nextItem == null) {
1752
        }
1758
            break;
1753
1759
          }
1754
        // This should never occour after the fix above
1760
1755
        if (nextItem == null) {
1761
          // If the nextItem is not anymore the leadItem
1756
          break;
1762
          // Means: There has occured a change.
1757
        }
1763
          // We break here. This is normally the second step.
1758
1764
          if (nextItem != this.getLeadItem()) {
1759
        // If the nextItem is not anymore the leadItem
1765
            break;
1760
        // Means: There has occured a change.
1766
          }
1761
        // We break here. This is normally the second step.
1762
        if (nextItem != this.getLeadItem()) {
1763
          break;
1764
        }
1765
1767
1766
        // Update scrolling (this is normally the first step)
1768
          // Update scrolling (this is normally the first step)
1767
        vBoundedWidget.setScrollTop(vParentScrollTop + vParentClientHeight - 2 * this.getItemHeight(nextItem));
1769
          vBoundedWidget.setScrollTop(vParentScrollTop + vParentClientHeight - 2 * this.getItemHeight(nextItem));
1768
1770
1769
        // Use the real applied value instead of the calulated above
1771
          // Use the real applied value instead of the calulated above
1770
        vParentScrollTop = vBoundedWidget.getScrollTop();
1772
          vParentScrollTop = vBoundedWidget.getScrollTop();
1771
1773
1772
        // Increment counter
1774
          // Increment counter
1773
        tryLoops++;
1775
          tryLoops++;
1776
        }
1774
      }
1777
      }
1775
1778
1776
      return nextItem;
1779
      return nextItem;
(-)js/org/eclipse/rwt/test/tests/ComboTest.js (+24 lines)
Lines 206-211 Link Here
206
      combo.destroy();
206
      combo.destroy();
207
    },
207
    },
208
208
209
    testPageUpOnNotCreatedList : function() {
210
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
211
      var combo = this._createDefaultCombo();
212
      combo.setEditable( true );
213
      combo.select( 3 );
214
      testUtil.flush();
215
      combo.focus();
216
      testUtil.keyDown( combo._field.getElement(), "PageUp" );
217
      assertEquals( "Ruby", combo._list.getSelectedItems()[ 0 ].getLabel() );
218
      combo.destroy();
219
    },
220
221
    testPageDownOnNotCreatedList : function() {
222
      var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
223
      var combo = this._createDefaultCombo();
224
      combo.setEditable( true );
225
      combo.select( 3 );
226
      testUtil.flush();
227
      combo.focus();
228
      testUtil.keyDown( combo._field.getElement(), "PageDown" );
229
      assertEquals( "Ruby", combo._list.getSelectedItems()[ 0 ].getLabel() );
230
      combo.destroy();
231
    },
232
209
    //////////
233
    //////////
210
    // Helpers
234
    // Helpers
211
235

Return to bug 352070