Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/widgets/ScrollBar.js9
-rw-r--r--bundles/org.eclipse.rap.rwt.q07/resources/client.js2
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js10
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js10
4 files changed, 29 insertions, 2 deletions
diff --git a/bundles/org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/widgets/ScrollBar.js b/bundles/org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/widgets/ScrollBar.js
index fc4896d779..b10ed31724 100644
--- a/bundles/org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/widgets/ScrollBar.js
+++ b/bundles/org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/widgets/ScrollBar.js
@@ -188,7 +188,6 @@ qx.Class.define( "org.eclipse.rwt.widgets.ScrollBar", {
}
this._dispatchValueChanged();
}
- this._lastValue = this._selection;
},
////////////
@@ -245,6 +244,14 @@ qx.Class.define( "org.eclipse.rwt.widgets.ScrollBar", {
_getScrollBarWidth : function() {
return org.eclipse.rwt.widgets.ScrollBar.BAR_WIDTH;
+ },
+
+ _updateStepsize : function() {
+ var oldValue = this._selection;
+ this.base( arguments );
+ if( oldValue !== this._selection ) {
+ this._dispatchValueChanged();
+ }
}
}
diff --git a/bundles/org.eclipse.rap.rwt.q07/resources/client.js b/bundles/org.eclipse.rap.rwt.q07/resources/client.js
index 068b3951fc..3a44dc29a3 100644
--- a/bundles/org.eclipse.rap.rwt.q07/resources/client.js
+++ b/bundles/org.eclipse.rap.rwt.q07/resources/client.js
@@ -112,7 +112,7 @@ qx.Class.define($[215],{type:$[30],extend:qx.util.manager.Object,construct:funct
qx.Class.define("qx.ui.selection.SelectionManager",{extend:qx.core.Target,construct:function(a){arguments.callee.base.call(this);this._selectedItems=new qx.ui.selection.Selection(this);if(a!=null){this.setBoundedWidget(a)}},events:{changeSelection:$[79]},properties:{boundedWidget:{check:$[135],nullable:true},multiSelection:{check:$[4],init:true},dragSelection:{check:$[4],init:true},canDeselect:{check:$[4],init:true},fireChange:{check:$[4],init:true},anchorItem:{check:$[108],nullable:true,apply:"_applyAnchorItem",event:"changeAnchorItem"},leadItem:{check:$[108],nullable:true,apply:"_applyLeadItem",event:$[351]},multiColumnSupport:{check:$[4],init:false}},members:{_applyAnchorItem:function(b,a){if(a){this.renderItemAnchorState(a,false)}if(b){this.renderItemAnchorState(b,true)}},_applyLeadItem:function(b,a){if(a){this.renderItemLeadState(a,false)}if(b){this.renderItemLeadState(b,true)}},_getFirst:function(){return this.getBoundedWidget().getFirstVisibleChild()},_getLast:function(){return this.getBoundedWidget().getLastVisibleChild()},getFirst:function(){var a=this._getFirst();if(a){return a.getEnabled()?a:this.getNext(a)}},getLast:function(){var a=this._getLast();if(a){return a.getEnabled()?a:this.getPrevious(a)}},getItems:function(){return this.getBoundedWidget().getChildren()},getNextSibling:function(a){return a.getNextSibling()},getPreviousSibling:function(a){return a.getPreviousSibling()},getNext:function(a){while(a){a=this.getNextSibling(a);if(!a){break}if(this.getItemEnabled(a)){return a}}return null},getPrevious:function(a){while(a){a=this.getPreviousSibling(a);if(!a){break}if(this.getItemEnabled(a)){return a}}return null},isBefore:function(b,a){var c=this.getItems();return c.indexOf(b)<c.indexOf(a)},isEqual:function(b,a){return b==a},getItemHashCode:function(a){return a.toHashCode()},scrollItemIntoView:function(b,a){b.scrollIntoView(a)},getItemLeft:function(a){return a.getOffsetLeft()},getItemTop:function(a){return a.getOffsetTop()},getItemWidth:function(a){return a.getOffsetWidth()},getItemHeight:function(a){return a.getOffsetHeight()},getItemEnabled:function(a){return a.getEnabled()},renderItemSelectionState:function(b,a){a?b.addState($[29]):b.removeState($[29]);if(b.handleStateChange){b.handleStateChange()}},renderItemAnchorState:function(a,b){b?a.addState("anchor"):a.removeState("anchor");if(a.handleStateChange!=null){a.handleStateChange()}},renderItemLeadState:function(b,a){a?b.addState("lead"):b.removeState("lead");if(b.handleStateChange!=null){b.handleStateChange()}},getItemSelected:function(a){return this._selectedItems.contains(a)},setItemSelected:function(d,c){switch(this.getMultiSelection()){case true:if(!this.getItemEnabled(d)){return}if(this.getItemSelected(d)==c){return}this.renderItemSelectionState(d,c);c?this._selectedItems.add(d):this._selectedItems.remove(d);this._dispatchChange();break;case false:var b=this.getSelectedItems()[0];if(c){var a=b;if(this.isEqual(d,a)){return}if(a!=null){this.renderItemSelectionState(a,false)}this.renderItemSelectionState(d,true);this._selectedItems.removeAll();this._selectedItems.add(d);this._dispatchChange()}else{if(!this.isEqual(b,d)){this.renderItemSelectionState(d,false);this._dispatchChange()}}break}},getSelectedItems:function(){return this._selectedItems.toArray()},getSelectedItem:function(){return this._selectedItems.getFirst()},setSelectedItems:function(c){var b=this._getChangeValue();var a=this.getFireChange();this.setFireChange(false);this._deselectAll();var e;var f=c.length;for(var d=0;d<f;d++){e=c[d];if(!this.getItemEnabled(e)){continue}this._selectedItems.add(e);this.renderItemSelectionState(e,true)}this.setFireChange(a);if(a&&this._hasChanged(b)){this._dispatchChange()}},setSelectedItem:function(c){if(!c){return}if(!this.getItemEnabled(c)){return}var b=this._getChangeValue();var a=this.getFireChange();this.setFireChange(false);this._deselectAll();this._selectedItems.add(c);this.renderItemSelectionState(c,true);this.setFireChange(a);if(a&&this._hasChanged(b)){this._dispatchChange()}},selectAll:function(){var b=this._getChangeValue();var a=this.getFireChange();this.setFireChange(false);this._selectAll();this.setFireChange(a);if(a&&this._hasChanged(b)){this._dispatchChange()}},_selectAll:function(){if(!this.getMultiSelection()){return}var c;var a=this.getItems();var d=a.length;this._selectedItems.removeAll();for(var b=0;b<d;b++){c=a[b];if(!this.getItemEnabled(c)){continue}this._selectedItems.add(c);this.renderItemSelectionState(c,true)}return true},deselectAll:function(){var b=this._getChangeValue();var a=this.getFireChange();this.setFireChange(false);this._deselectAll();this.setFireChange(a);if(a&&this._hasChanged(b)){this._dispatchChange()}},_deselectAll:function(){var a=this._selectedItems.toArray();for(var b=0;b<a.length;b++){this.renderItemSelectionState(a[b],false)}this._selectedItems.removeAll();return true},selectItemRange:function(d,b){var c=this._getChangeValue();var a=this.getFireChange();this.setFireChange(false);this._selectItemRange(d,b,true);this.setFireChange(a);if(a&&this._hasChanged(c)){this._dispatchChange()}},_selectItemRange:function(b,a,c){if(this.isBefore(a,b)){return this._selectItemRange(a,b,c)}if(c){this._deselectAll()}var d=b;while(d!=null){if(this.getItemEnabled(d)){this._selectedItems.add(d);this.renderItemSelectionState(d,true)}if(this.isEqual(d,a)){break}d=this.getNext(d)}return true},_deselectItemRange:function(b,a){if(this.isBefore(a,b)){return this._deselectItemRange(a,b)}var c=b;while(c!=null){this._selectedItems.remove(c);this.renderItemSelectionState(c,false);if(this.isEqual(c,a)){break}c=this.getNext(c)}},_activeDragSession:false,handleMouseDown:function(a,b){b.stopPropagation();if(!b.isLeftButtonPressed()&&!b.isRightButtonPressed()){return}if(b.isRightButtonPressed()&&this.getItemSelected(a)){return}if(b.isShiftPressed()||this.getDragSelection()||(!this.getItemSelected(a)&&!b.isCtrlPressed())){this._onmouseevent(a,b)}else{this.setLeadItem(a)}this._activeDragSession=this.getDragSelection();if(this._activeDragSession){this.getBoundedWidget().addEventListener($[16],this._ondragup,this);this.getBoundedWidget().setCapture(true)}},_ondragup:function(a){this.getBoundedWidget().removeEventListener($[16],this._ondragup,this);this.getBoundedWidget().setCapture(false);this._activeDragSession=false},handleMouseUp:function(a,b){if(!b.isLeftButtonPressed()){return}if(b.isCtrlPressed()||this.getItemSelected(a)&&!this._activeDragSession){this._onmouseevent(a,b)}if(this._activeDragSession){this._activeDragSession=false;this.getBoundedWidget().setCapture(false)}},handleMouseOver:function(b,a){if(!this.getDragSelection()||!this._activeDragSession){return}this._onmouseevent(b,a,true)},handleClick:function(a,b){},handleDblClick:function(a,b){},_onmouseevent:function(h,g,d){if(!this.getItemEnabled(h)){return}var k=this._getChangeValue();var j=this.getLeadItem();var a=this.getFireChange();this.setFireChange(false);var c=this.getSelectedItems();var b=c.length;this.setLeadItem(h);var l=this.getAnchorItem();var i=g.isCtrlPressed();var f=g.isShiftPressed();if(!l||b==0||(i&&!f&&this.getMultiSelection()&&!this.getDragSelection())){this.setAnchorItem(h);l=h}if((!i&&!f&&!this._activeDragSession||!this.getMultiSelection())){if(!this.getItemEnabled(h)){return}this._deselectAll();this.setAnchorItem(h);if(this._activeDragSession){this.scrollItemIntoView((this.getBoundedWidget().getScrollTop()>(this.getItemTop(h)-1)?this.getPrevious(h):this.getNext(h))||h)}if(!this.getItemSelected(h)){this.renderItemSelectionState(h,true)}this._selectedItems.add(h);this._addToCurrentSelection=true}else{if(this._activeDragSession&&d){if(j){this._deselectItemRange(l,j)}if(this.isBefore(l,h)){if(this._addToCurrentSelection){this._selectItemRange(l,h,false)}else{this._deselectItemRange(l,h)}}else{if(this._addToCurrentSelection){this._selectItemRange(h,l,false)}else{this._deselectItemRange(h,l)}}this.scrollItemIntoView((this.getBoundedWidget().getScrollTop()>(this.getItemTop(h)-1)?this.getPrevious(h):this.getNext(h))||h)}else{if(this.getMultiSelection()&&i&&!f){if(!this._activeDragSession){this._addToCurrentSelection=!(this.getCanDeselect()&&this.getItemSelected(h))}this.setItemSelected(h,this._addToCurrentSelection);this.setAnchorItem(h)}else{if(this.getMultiSelection()&&i&&f){if(!this._activeDragSession){this._addToCurrentSelection=!(this.getCanDeselect()&&this.getItemSelected(h))}if(this._addToCurrentSelection){this._selectItemRange(l,h,false)}else{this._deselectItemRange(l,h)}}else{if(this.getMultiSelection()&&!i&&f){if(this.getCanDeselect()){this._selectItemRange(l,h,true)}else{if(j){this._deselectItemRange(l,j)}this._selectItemRange(l,h,false)}}}}}}this.setFireChange(a);if(a&&this._hasChanged(k)){this._dispatchChange()}},handleKeyDown:function(a){this.warn("qx.ui.selection.SelectionManager.handleKeyDown is deprecated! Use keypress insted and bind it to the onkeypress event.");this.handleKeyPress(a)},handleKeyPress:function(d){var c=this._getChangeValue();var a=this.getFireChange();this.setFireChange(false);if(d.getKeyIdentifier()=="A"&&d.isCtrlPressed()){if(this.getMultiSelection()){this._selectAll();this.setLeadItem(this.getFirst())}}else{var b=this.getAnchorItem();var e=this.getItemToSelect(d);if(e&&this.getItemEnabled(e)){this.setLeadItem(e);this.scrollItemIntoView(e);d.preventDefault();if(d.isShiftPressed()&&this.getMultiSelection()){if(b==null){this.setAnchorItem(e)}this._selectItemRange(this.getAnchorItem(),e,true)}else{if(!d.isCtrlPressed()){this._deselectAll();this.renderItemSelectionState(e,true);this._selectedItems.add(e);this.setAnchorItem(e)}else{if(d.getKeyIdentifier()==$[91]){if(this._selectedItems.contains(e)){this.renderItemSelectionState(e,false);this._selectedItems.remove(e);this.setAnchorItem(this._selectedItems.getFirst())}else{if(!d.isCtrlPressed()||!this.getMultiSelection()){this._deselectAll()}this.renderItemSelectionState(e,true);this._selectedItems.add(e);this.setAnchorItem(e)}}}}}}this.setFireChange(a);if(a&&this._hasChanged(c)){this._dispatchChange()}},getItemToSelect:function(a){if(a.isAltPressed()){return null}switch(a.getKeyIdentifier()){case"Home":return this.getHome(this.getLeadItem());case"End":return this.getEnd(this.getLeadItem());case"Down":return this.getDown(this.getLeadItem());case"Up":return this.getUp(this.getLeadItem());case"Left":return this.getLeft(this.getLeadItem());case $[52]:return this.getRight(this.getLeadItem());case $[57]:return this.getPageUp(this.getLeadItem())||this.getHome(this.getLeadItem());case $[54]:return this.getPageDown(this.getLeadItem())||this.getEnd(this.getLeadItem());case $[91]:if(a.isCtrlPressed()){return this.getLeadItem()}}return null},_dispatchChange:function(){if(!this.getFireChange()){return}if(this.hasEventListeners($[282])){this.dispatchEvent(new qx.event.type.DataEvent($[282],this.getSelectedItems()),true)}},_hasChanged:function(a){return a!=this._getChangeValue()},_getChangeValue:function(){return this._selectedItems.getChangeValue()},getHome:function(){return this.getFirst()},getEnd:function(){return this.getLast()},getDown:function(a){if(!a){return this.getFirst()}return this.getMultiColumnSupport()?(this.getUnder(a)||this.getLast()):this.getNext(a)},getUp:function(a){if(!a){return this.getLast()}return this.getMultiColumnSupport()?(this.getAbove(a)||this.getFirst()):this.getPrevious(a)},getLeft:function(a){if(!this.getMultiColumnSupport()){return null}return !a?this.getLast():this.getPrevious(a)},getRight:function(a){if(!this.getMultiColumnSupport()){return null}return !a?this.getFirst():this.getNext(a)},getAbove:function(a){throw new Error("getAbove(): Not implemented yet")},getUnder:function(a){throw new Error("getUnder(): Not implemented yet")},getPageUp:function(e){var c=this.getBoundedWidget();var b=c.getScrollTop();var f=c.getClientHeight();var a=this.getLeadItem();if(!a){a=this.getFirst()}var d=0;while(d<2){while(a&&(this.getItemTop(a)-this.getItemHeight(a)>=b)){a=this.getUp(a)}if(a==null){break}if(a!=this.getLeadItem()){this.scrollItemIntoView(a,true);break}c.setScrollTop(b-f-this.getItemHeight(a));b=c.getScrollTop();d++}return a},getPageDown:function(e){var c=this.getBoundedWidget();var b=c.getScrollTop();var f=c.getClientHeight();var a=this.getLeadItem();if(!a){a=this.getFirst()}var d=0;while(d<2){while(a&&((this.getItemTop(a)+(2*this.getItemHeight(a)))<=(b+f))){a=this.getDown(a)}if(a==null){break}if(a!=this.getLeadItem()){break}c.setScrollTop(b+f-2*this.getItemHeight(a));b=c.getScrollTop();d++}return a}},destruct:function(){this._disposeObjects("_selectedItems")}});
qx.Class.define("qx.ui.selection.Selection",{extend:qx.core.Object,construct:function(a){arguments.callee.base.call(this);this.__manager=a;this.removeAll()},members:{add:function(a){this.__storage[this.getItemHashCode(a)]=a},remove:function(a){delete this.__storage[this.getItemHashCode(a)]},removeAll:function(){this.__storage={}},contains:function(a){return this.getItemHashCode(a) in this.__storage},toArray:function(){var b=[];for(var a in this.__storage){b.push(this.__storage[a])}return b},getFirst:function(){for(var a in this.__storage){return this.__storage[a]}return null},getChangeValue:function(){var b=[];for(var a in this.__storage){b.push(a)}b.sort();return b.join(";")},getItemHashCode:function(a){return this.__manager.getItemHashCode(a)},isEmpty:function(){return qx.lang.Object.isEmpty(this.__storage)}},destruct:function(){this._disposeFields("__storage","__manager")}});
qx.Class.define("org.eclipse.swt.widgets.AbstractSlider",{extend:qx.ui.layout.CanvasLayout,construct:function(a){arguments.callee.base.call(this);this.setOverflow($[14]);this._horizontal=a;this._selection=0;this._minimum=0;this._maximum=100;this._increment=1;this._pageIncrement=10;this._thumbLength=10;this._pxStep=1.38;this._thumbDragOffset=0;this._autoRepeat=null;this._mouseOffset=0;this._repeatTimer=new qx.client.Timer(100);this._thumb=new qx.ui.basic.Atom();this._minButton=new org.eclipse.rwt.widgets.BasicButton("push");this._maxButton=new org.eclipse.rwt.widgets.BasicButton("push");this.add(this._thumb);this.add(this._minButton);this.add(this._maxButton);this._configureSubwidgets();this._registerListeners()},destruct:function(){if(this._repeatTimer!=null){this._repeatTimer.stop();this._repeatTimer.dispose()}this._repeatTimer=null;this._thumb=null;this._minButton=null;this._maxButton=null},statics:{BUTTON_WIDTH:16},members:{_setSelection:function(b){var a=this._limitSelection(b);if(a!==this._selection){this._selection=a;this._selectionChanged()}},_setMinimum:function(a){this._minimum=a;this._updateThumbSize()},_setMaximum:function(a){this._maximum=a;this._updateThumbSize()},_setIncrement:function(a){this._increment=a},_setPageIncrement:function(a){this._pageIncrement=a},_setThumb:function(a){this._thumbLength=a;this._updateThumbSize()},_registerListeners:function(){this._repeatTimer.addEventListener($[58],this._onRepeatTimerInterval,this);this.addEventListener($[56],this._onChangeSize,this);this.addEventListener($[67],this._onChangeSize,this);this.addEventListener($[152],this._onChangeEnabled,this);this.addEventListener($[2],this._onLineMouseDown,this);this.addEventListener($[16],this._onMouseUpOut,this);this.addEventListener($[15],this._onMouseUpOut,this);this.addEventListener($[59],this._onLineMouseMove,this);this.addEventListener($[47],this._onMouseWheel,this);this._thumb.addEventListener($[2],this._onThumbMouseDown,this);this._thumb.addEventListener($[59],this._onThumbMouseMove,this);this._thumb.addEventListener($[16],this._onThumbMouseUp,this);this._minButton.addEventListener($[2],this._onMinButtonMouseDown,this);this._maxButton.addEventListener($[2],this._onMaxButtonMouseDown,this)},_selectionChanged:function(){this._updateThumbPosition();if(this._autoRepeat!==null&&!this._repeatTimer.isEnabled()){qx.client.Timer.once(this._repeatTimerStart,this,250)}},_onChangeSize:function(a){this._updateThumbSize()},_onChangeEnabled:function(a){this._thumb.setVisibility(a.getValue())},_onMouseWheel:function(a){a.preventDefault();a.stopPropagation();var c=a.getWheelDelta();var d=(c/Math.abs(c))*this._increment;var b=this._selection-d;if(b<this._minimum){b=this._minimum}if(b>(this._maximum-this._thumbWidth)){b=this._maximum-this._thumbWidth}this._setSelection(b)},_onLineMouseDown:function(a){if(a.isLeftButtonPressed()){this._mouseOffset=this._getMouseOffset(a);this._handleLineMouseDown()}},_onLineMouseMove:function(a){this._mouseOffset=this._getMouseOffset(a)},_onMinButtonMouseDown:function(a){a.stopPropagation();if(a.isLeftButtonPressed()){this._autoRepeat="minButton";this._setSelection(this._selection-this._increment)}},_onMaxButtonMouseDown:function(a){a.stopPropagation();if(a.isLeftButtonPressed()){this._autoRepeat="maxButton";this._setSelection(this._selection+this._increment)}},_onMouseUpOut:function(a){this._autoRepeat=null;this._repeatTimer.stop()},_onThumbMouseDown:function(b){b.stopPropagation();this._thumb.addState($[23]);if(b.isLeftButtonPressed()){var a=this._getMouseOffset(b);this._thumbDragOffset=a-this._getThumbPosition();this._thumb.setCapture(true)}},_onThumbMouseMove:function(c){c.stopPropagation();if(this._thumb.getCapture()){var b=this._getMouseOffset(c);var a=this._getSelectionFromPosition(b-this._thumbDragOffset);this._setSelection(a)}},_onThumbMouseUp:function(a){a.stopPropagation();this._repeatTimer.stop();this._thumb.setCapture(false);this._thumb.removeState($[23])},_configureSubwidgets:function(){if(this._horizontal){this._thumb.setHeight("100%");this._minButton.setHeight("100%");this._maxButton.setHeight("100%");this._maxButton.setRight(0)}else{this._thumb.setWidth("100%");this._minButton.setWidth("100%");this._maxButton.setWidth("100%");this._maxButton.setBottom(0)}org.eclipse.swt.WidgetUtil.fixIEBoxHeight(this._thumb);org.eclipse.swt.WidgetUtil.fixIEBoxHeight(this._minButton);org.eclipse.swt.WidgetUtil.fixIEBoxHeight(this._maxButton);this._minButton.setTabIndex(null);this._maxButton.setTabIndex(null)},_visualizeFocus:function(){arguments.callee.base.call(this);this._thumb.addState($[121])},_visualizeBlur:function(){arguments.callee.base.call(this);this._thumb.removeState($[121])},_repeatTimerStart:function(){if(this._autoRepeat!=null){this._repeatTimer.start()}},_onRepeatTimerInterval:function(a){switch(this._autoRepeat){case"minButton":this._setSelection(this._selection-this._increment);break;case"maxButton":this._setSelection(this._selection+this._increment);break;case"line":this._handleLineMouseDown();if(this._autoRepeat===null){this._repeatTimer.stop()}break}},_handleLineMouseDown:function(){var b=this._getThumbSize()/2;var c=this._getThumbPosition()+b;var a;if(this._mouseOffset>c){a=this._selection+this._pageIncrement}else{a=this._selection-this._pageIncrement}var d=this._pageIncrement*this._pxStep+b;if(Math.abs(this._mouseOffset-c)>d){this._autoRepeat="line"}else{this._autoRepeat=null}this._setSelection(a)},_updateThumbPosition:function(){var a=org.eclipse.swt.widgets.AbstractSlider.BUTTON_WIDTH;a+=this._pxStep*(this._selection-this._minimum);if(this._horizontal){this._thumb.setLeft(a)}else{this._thumb.setTop(a)}},_updateThumbSize:function(){var a=this._thumbLength*this._getLineSize()/(this._maximum-this._minimum);if(this._horizontal){this._thumb.setWidth(a)}else{this._thumb.setHeight(a)}this._updateStepsize()},_updateStepsize:function(){var b=this._maximum-this._minimum-this._thumbLength;if(b!=0){var a=org.eclipse.swt.widgets.AbstractSlider.BUTTON_WIDTH;var c=this._getLineSize()-this._getThumbSize();this._pxStep=c/b}else{this._pxStep=0}this._selection=this._limitSelection(this._selection);this._updateThumbPosition()},_getSelectionFromPosition:function(a){var b=org.eclipse.swt.widgets.AbstractSlider.BUTTON_WIDTH;var c=(a-b)/this._pxStep+this._minimum;return this._limitSelection(Math.round(c))},_limitSelection:function(b){var a=b;if(b>=(this._maximum-this._thumbLength)){a=this._maximum-this._thumbLength}if(a<=this._minimum){a=this._minimum}return a},_getMouseOffset:function(c){var b=qx.bom.element.Location;var a;if(this._horizontal){a=c.getPageX()-b.getLeft(this.getElement())}else{a=c.getPageY()-b.getTop(this.getElement())}return a},_getThumbPosition:function(){var a;if(this._horizontal){a=this._thumb.getLeft()}else{a=this._thumb.getTop()}return a},_getThumbSize:function(){var a;if(this._horizontal){a=this._thumb.getWidth()}else{a=this._thumb.getHeight()}return a},_getLineSize:function(){var b=org.eclipse.swt.widgets.AbstractSlider.BUTTON_WIDTH;var a=this._getSliderSize()-this.getFrameWidth()-2*b;return a},_getSliderSize:function(){var a;if(this._horizontal){a=this.getWidth()}else{a=this.getHeight()}return a}}});
-qx.Class.define("org.eclipse.rwt.widgets.ScrollBar",{extend:org.eclipse.swt.widgets.AbstractSlider,construct:function(a){arguments.callee.base.call(this,a);this._idealValue=0;this._selectionFactor=1;this._lastDispatchedValue=0;this._mergeEvents=false;this._renderSum=0;this._renderSamples=0;this._eventTimerId=null;this._setMinimum(0);this._minThumbSize=org.eclipse.rwt.widgets.ScrollBar.MIN_THUMB_SIZE;this.setIncrement(20);this.setAppearance("slider");this._thumb.setAppearance($[556]);this._minButton.setAppearance($[506]);this._maxButton.setAppearance($[527]);this.addEventListener($[28],this._stopEvent,this);this.addEventListener($[62],this._stopEvent,this);this._eventTimer=null;this._setStates()},destruct:function(){if(this._eventTimer!=null){this._eventTimer.dispose();this._eventTimer=null}},statics:{BAR_WIDTH:15,MERGE_THRESHOLD:4,MIN_THUMB_SIZE:8,_nativeWidth:null,getNativeScrollBarWidth:function(){if(this._nativeWidth===null){var a=document.createElement("div");a.style.width="100px";a.style.height="100px";a.style.overflow=$[25];a.style.visibility=$[14];document.body.appendChild(a);this._nativeWidth=a.offsetWidth-a.clientWidth;document.body.removeChild(a)}return this._nativeWidth}},events:{changeValue:$[9]},members:{setValue:function(a){this._idealValue=a;this._setSelection(a*this._selectionFactor)},getValue:function(a){return this._selection/this._selectionFactor},setMaximum:function(a){this._setMaximum(a);if(this._idealValue!==null){this._setSelection(this._idealValue)}this._updateThumbLength()},getMaximum:function(){return this._maximum},setIncrement:function(a){this._setIncrement(a);this._updatePageIncrement()},setMergeEvents:function(a){if(!a&&this._mergeEvents){this.warn("mergeEvents can not be set to false")}else{if(a){this._mergeEvents=true;this._eventTimer=new qx.client.Timer(125);this._eventTimer.addEventListener($[58],this._dispatchValueChanged,this)}}},getMergeEvents:function(){return this._mergeEvents},autoEnableMerge:function(c){if(!this._mergeEvents&&c>0){this._renderSamples++;this._renderSum+=c;var b=this._renderSum/this._renderSamples;var a=false;if(this._renderSamples>2){a=b>200}else{a=c>700}if(a){this.setMergeEvents(true)}}},_onChangeSize:function(){arguments.callee.base.call(this);this._updateThumbLength();this._updatePageIncrement();if(this._idealValue!==null){this._setSelection(this._idealValue)}},_updateThumbSize:function(){arguments.callee.base.call(this);var a=this._getThumbSize();if(a<this._minThumbSize){this.addToQueue($[447])}else{this._selectionFactor=1}},_layoutPost:function(b){arguments.callee.base.call(this,b);if(b[$[447]]){if(this._maximum>0&&this._getLineSize()>0){var a=this._getThumbSize();if(a<this._minThumbSize){var d=this._getSliderSize();var c=this._minThumbSize*this._maximum/this._getLineSize();this._setThumb(c);this._selectionFactor=(this._maximum-c)/(this._maximum-d)}}}},_setSelection:function(a){if(a!==this._idealValue){this._idealValue=null}arguments.callee.base.call(this,a)},_selectionChanged:function(){arguments.callee.base.call(this);if(this._getMergeCurrentEvent()){this._eventTimer.stop();this._eventTimer.start()}else{if(this._mergeEvents){this._eventTimer.stop()}this._dispatchValueChanged()}this._lastValue=this._selection},_updateThumbLength:function(){this._setThumb(this._getSliderSize())},_updatePageIncrement:function(){this._setPageIncrement(this._getSliderSize()-this._increment)},_stopEvent:function(a){a.stopPropagation();a.preventDefault()},_getMergeCurrentEvent:function(){var a=false;if(this._mergeEvents){var b=org.eclipse.rwt.widgets.ScrollBar.MERGE_THRESHOLD;var c=Math.abs(this._lastDispatchedValue-this._selection);if(c>=this._increment*b){a=true}}return a},_dispatchValueChanged:function(){this._lastDispatchedValue=this._selection;this.createDispatchEvent($[78])},_setStates:function(){var a=this._horizontal?$[281]:$[241];var b=this._horizontal?$[50]:$[42];this.addState(a);this._minButton.addState(a);this._minButton.addState(b);this._maxButton.addState(a);this._maxButton.addState(b);this._thumb.addState(a)},_computePreferredInnerWidth:function(){return this._horizontal?0:this._getScrollBarWidth()},_computePreferredInnerHeight:function(){return this._horizontal?this._getScrollBarWidth():0},_getScrollBarWidth:function(){return org.eclipse.rwt.widgets.ScrollBar.BAR_WIDTH}}});
+qx.Class.define("org.eclipse.rwt.widgets.ScrollBar",{extend:org.eclipse.swt.widgets.AbstractSlider,construct:function(a){arguments.callee.base.call(this,a);this._idealValue=0;this._selectionFactor=1;this._lastDispatchedValue=0;this._mergeEvents=false;this._renderSum=0;this._renderSamples=0;this._eventTimerId=null;this._setMinimum(0);this._minThumbSize=org.eclipse.rwt.widgets.ScrollBar.MIN_THUMB_SIZE;this.setIncrement(20);this.setAppearance("slider");this._thumb.setAppearance($[556]);this._minButton.setAppearance($[506]);this._maxButton.setAppearance($[527]);this.addEventListener($[28],this._stopEvent,this);this.addEventListener($[62],this._stopEvent,this);this._eventTimer=null;this._setStates()},destruct:function(){if(this._eventTimer!=null){this._eventTimer.dispose();this._eventTimer=null}},statics:{BAR_WIDTH:15,MERGE_THRESHOLD:4,MIN_THUMB_SIZE:8,_nativeWidth:null,getNativeScrollBarWidth:function(){if(this._nativeWidth===null){var a=document.createElement("div");a.style.width="100px";a.style.height="100px";a.style.overflow=$[25];a.style.visibility=$[14];document.body.appendChild(a);this._nativeWidth=a.offsetWidth-a.clientWidth;document.body.removeChild(a)}return this._nativeWidth}},events:{changeValue:$[9]},members:{setValue:function(a){this._idealValue=a;this._setSelection(a*this._selectionFactor)},getValue:function(a){return this._selection/this._selectionFactor},setMaximum:function(a){this._setMaximum(a);if(this._idealValue!==null){this._setSelection(this._idealValue)}this._updateThumbLength()},getMaximum:function(){return this._maximum},setIncrement:function(a){this._setIncrement(a);this._updatePageIncrement()},setMergeEvents:function(a){if(!a&&this._mergeEvents){this.warn("mergeEvents can not be set to false")}else{if(a){this._mergeEvents=true;this._eventTimer=new qx.client.Timer(125);this._eventTimer.addEventListener($[58],this._dispatchValueChanged,this)}}},getMergeEvents:function(){return this._mergeEvents},autoEnableMerge:function(c){if(!this._mergeEvents&&c>0){this._renderSamples++;this._renderSum+=c;var b=this._renderSum/this._renderSamples;var a=false;if(this._renderSamples>2){a=b>200}else{a=c>700}if(a){this.setMergeEvents(true)}}},_onChangeSize:function(){arguments.callee.base.call(this);this._updateThumbLength();this._updatePageIncrement();if(this._idealValue!==null){this._setSelection(this._idealValue)}},_updateThumbSize:function(){arguments.callee.base.call(this);var a=this._getThumbSize();if(a<this._minThumbSize){this.addToQueue($[447])}else{this._selectionFactor=1}},_layoutPost:function(b){arguments.callee.base.call(this,b);if(b[$[447]]){if(this._maximum>0&&this._getLineSize()>0){var a=this._getThumbSize();if(a<this._minThumbSize){var d=this._getSliderSize();var c=this._minThumbSize*this._maximum/this._getLineSize();this._setThumb(c);this._selectionFactor=(this._maximum-c)/(this._maximum-d)}}}},_setSelection:function(a){if(a!==this._idealValue){this._idealValue=null}arguments.callee.base.call(this,a)},_selectionChanged:function(){arguments.callee.base.call(this);if(this._getMergeCurrentEvent()){this._eventTimer.stop();this._eventTimer.start()}else{if(this._mergeEvents){this._eventTimer.stop()}this._dispatchValueChanged()}},_updateThumbLength:function(){this._setThumb(this._getSliderSize())},_updatePageIncrement:function(){this._setPageIncrement(this._getSliderSize()-this._increment)},_stopEvent:function(a){a.stopPropagation();a.preventDefault()},_getMergeCurrentEvent:function(){var a=false;if(this._mergeEvents){var b=org.eclipse.rwt.widgets.ScrollBar.MERGE_THRESHOLD;var c=Math.abs(this._lastDispatchedValue-this._selection);if(c>=this._increment*b){a=true}}return a},_dispatchValueChanged:function(){this._lastDispatchedValue=this._selection;this.createDispatchEvent($[78])},_setStates:function(){var a=this._horizontal?$[281]:$[241];var b=this._horizontal?$[50]:$[42];this.addState(a);this._minButton.addState(a);this._minButton.addState(b);this._maxButton.addState(a);this._maxButton.addState(b);this._thumb.addState(a)},_computePreferredInnerWidth:function(){return this._horizontal?0:this._getScrollBarWidth()},_computePreferredInnerHeight:function(){return this._horizontal?this._getScrollBarWidth():0},_getScrollBarWidth:function(){return org.eclipse.rwt.widgets.ScrollBar.BAR_WIDTH},_updateStepsize:function(){var a=this._selection;arguments.callee.base.call(this);if(a!==this._selection){this._dispatchValueChanged()}}}});
qx.Class.define($[539],{extend:qx.core.Target,properties:{uiReady:{check:$[4],init:false}},members:{main:function(){qx.theme.manager.Meta.getInstance().initialize();qx.ui.core.ClientDocument.getInstance();qx.client.Timer.once(this._preload,this,0)},close:function(){},terminate:function(){org.eclipse.rwt.EventHandler.detachEvents();org.eclipse.rwt.EventHandler.cleanUp()},_preload:function(){this.debug("preloading visible images...");this.__preloader=new qx.io.image.PreloaderSystem(qx.io.image.Manager.getInstance().getVisibleImages(),this._preloaderDone,this);this.__preloader.start()},_preloaderDone:function(){this.setUiReady(true);this.__preloader.dispose();this.__preloader=null;var a=(new Date).valueOf();qx.ui.core.Widget.flushGlobalQueues();this.info("render runtime: "+(new Date-a)+"ms");org.eclipse.rwt.EventHandler.init();org.eclipse.rwt.EventHandler.attachEvents();qx.client.Timer.once(this._postload,this,100)},_postload:function(){this.debug("preloading hidden images...");this.__postloader=new qx.io.image.PreloaderSystem(qx.io.image.Manager.getInstance().getHiddenImages(),this._postloaderDone,this);this.__postloader.start()},_postloaderDone:function(){this.__postloader.dispose();this.__postloader=null}}});
qx.Class.define("qx.io.image.PreloaderSystem",{extend:qx.core.Target,construct:function(c,b,a){arguments.callee.base.call(this);if(c instanceof Array){this._list=qx.lang.Object.fromArray(c)}else{this._list=c}this._timer=new qx.client.Timer(qx.core.Setting.get("qx.preloaderTimeout"));this._timer.addEventListener($[58],this.__oninterval,this);if(b){this.addEventListener($[40],b,a||null)}},events:{completed:$[9]},members:{_stopped:false,start:function(){if(qx.lang.Object.isEmpty(this._list)){this.createDispatchEvent($[40]);return}for(var a in this._list){var b=qx.io.image.PreloaderManager.getInstance().create(qx.io.Alias.getInstance().resolve(a));if(b.isErroneous()||b.isLoaded()){delete this._list[a]}else{b._origSource=a;b.addEventListener("load",this.__onload,this);b.addEventListener($[109],this.__onerror,this)}}this._check()},__onload:function(a){if(this.getDisposed()){return}delete this._list[a.getTarget()._origSource];this._check()},__onerror:function(a){if(this.getDisposed()){return}delete this._list[a.getTarget()._origSource];this._check()},__oninterval:function(a){this.debug("Cannot preload: "+qx.lang.Object.getKeysAsString(this._list));this._stopped=true;this._timer.stop();this.createDispatchEvent($[40])},_check:function(){if(this._stopped){return}if(qx.lang.Object.isEmpty(this._list)){this._timer.stop();this.createDispatchEvent($[40])}else{this._timer.restart()}}},settings:{"qx.preloaderTimeout":3000},destruct:function(){if(this._timer){this._timer.removeEventListener($[58],this.__oninterval,this);this._disposeObjects("_timer")}this._disposeFields("_list")}});
qx.Class.define("qx.io.remote.RequestQueue",{type:$[30],extend:qx.core.Target,construct:function(){arguments.callee.base.call(this);this._queue=[];this._active=[];this._totalRequests=0;this._timer=new qx.client.Timer(500);this._timer.addEventListener($[58],this._oninterval,this)},properties:{enabled:{init:true,check:$[4],apply:$[373]},maxTotalRequests:{check:$[18],nullable:true},maxConcurrentRequests:{check:$[18],init:3},defaultTimeout:{check:$[18],init:5000}},members:{_debug:function(){if(qx.core.Variant.isSet($[3],"on")){if(qx.core.Setting.get($[60])){var a=this._active.length+"/"+(this._queue.length+this._active.length);this.debug("Progress: "+a);window.status="Request-Queue Progress: "+a}}},_check:function(){this._debug();if(this._active.length==0&&this._queue.length==0){this._timer.stop()}if(!this.getEnabled()){return}if(this._active.length>=this.getMaxConcurrentRequests()||this._queue.length==0){return}if(this.getMaxTotalRequests()!=null&&this._totalRequests>=this.getMaxTotalRequests()){return}var c=this._queue.shift();var e=new qx.io.remote.Exchange(c);this._totalRequests++;this._active.push(e);this._debug();e.addEventListener($[63],this._onsending,this);e.addEventListener($[68],this._onreceiving,this);e.addEventListener($[40],this._oncompleted,this);e.addEventListener($[66],this._oncompleted,this);e.addEventListener($[64],this._oncompleted,this);e.addEventListener($[48],this._oncompleted,this);var d=true;try{d=e.send()}catch(a){d=a}if(d!==true){var b=new qx.io.remote.Response($[48]);b.setContent(d);e.dispatchEvent(b)}else{e._start=(new Date()).valueOf()}if(this._queue.length>0){this._check()}},_remove:function(a){qx.lang.Array.remove(this._active,a);this._check()},_activeCount:0,_onsending:function(b){if(qx.core.Variant.isSet($[3],"on")){if(qx.core.Setting.get($[60])){this._activeCount++;b.getTarget()._counted=true;this.debug($[525]+this._activeCount)}}var a=b.getTarget();a.getRequest()._onsending(b)},_onreceiving:function(a){a.getTarget().getRequest()._onreceiving(a)},_oncompleted:function(c){if(qx.core.Variant.isSet($[3],"on")){if(qx.core.Setting.get($[60])){if(c.getTarget()._counted){this._activeCount--;this.debug($[525]+this._activeCount)}}}var b=c.getTarget();this._remove(b);var a=b.getRequest();if(a["_on"+c.getType()]){a["_on"+c.getType()](c)}b.dispose()},_oninterval:function(g){var j=this._active;if(j.length==0){this._timer.stop();return}var f;var d;var a=this.getDefaultTimeout();var b;var h;for(var c=j.length-1;c>=0;c--){f=j[c];d=f.getRequest();if(d.isAsynchronous()){b=d.getTimeout();if(b==0||f._start==null){continue}if(b==null){b=a}h=(new Date).valueOf()-f._start;if(h>b){this.warn("Timeout: transport "+f.toHashCode());this.warn(h+"ms > "+b+"ms");f.timeout()}}}},_applyEnabled:function(b,a){if(b){this._check()}this._timer.setEnabled(b)},add:function(a){a.setState($[193]);this._queue.push(a);this._check();if(this.getEnabled()){this._timer.start()}},abort:function(a){var b=a.getTransport();if(b){b.abort()}else{if(qx.lang.Array.contains(this._queue,a)){qx.lang.Array.remove(this._queue,a)}}}},destruct:function(){this._disposeObjectDeep("_active",1);this._disposeObjects("_timer");this._disposeFields("_queue")}});
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js
index a2b72e7469..c39ff13f0c 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js
@@ -68,6 +68,16 @@ qx.Class.define( "org.eclipse.rwt.test.tests.ScrollBarTest", {
assertEquals( 3, events.length );
bar.destroy();
},
+
+ testFireEventOnSetMaximum : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var bar = this._createScrollBar();
+ var events = this._getChangeLogger( bar );
+ bar.setValue( 250 );
+ bar.setMaximum( 200 );
+ assertEquals( 2, events.length );
+ bar.destroy();
+ },
testSetInvalidValue : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js
index a2b72e7469..c39ff13f0c 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ScrollBarTest.js
@@ -68,6 +68,16 @@ qx.Class.define( "org.eclipse.rwt.test.tests.ScrollBarTest", {
assertEquals( 3, events.length );
bar.destroy();
},
+
+ testFireEventOnSetMaximum : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var bar = this._createScrollBar();
+ var events = this._getChangeLogger( bar );
+ bar.setValue( 250 );
+ bar.setMaximum( 200 );
+ assertEquals( 2, events.length );
+ bar.destroy();
+ },
testSetInvalidValue : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;

Back to the top