mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-10 22:30:56 +00:00
Bug 3397 - SliderBar keyboard navigation does not fire changes
Change-Id: Ic373d94f0c2f1c3c8b569aa044fd9cddd95becac
This commit is contained in:
1 parent
3ea81203b4
commit
5fdf4366e1
1 file changed
+28
@@ -8,6 +8,7 @@ import com.google.gwt.dom.client.Style.Display;
|
||||
import com.google.gwt.dom.client.Style.Position;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.dom.client.Style.Visibility;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.gwt.client.controls.slider.TimeTicksCalculator.NormalizedInterval;
|
||||
@@ -95,6 +96,33 @@ public class TimeSlider extends SliderBar {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override parent version because event don't fire when we set value which is in multiples of stepSize
|
||||
*/
|
||||
@Override
|
||||
public synchronized void setCurrentValue(Double curValue, boolean fireEvent) {
|
||||
// Confine the value to the range
|
||||
if (!isMinMaxInitialized() || curValue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Double newValue = Math.max(minValue, Math.min(maxValue, curValue));
|
||||
double remainder = (newValue - minValue) % stepSize;
|
||||
newValue -= remainder;
|
||||
// Go to next step if more than halfway there
|
||||
if ((remainder > (stepSize / 2)) && ((newValue + stepSize) <= maxValue)) {
|
||||
newValue += stepSize;
|
||||
}
|
||||
|
||||
boolean isValueChanged = !newValue.equals(this.curValue) && this.curValue != null;
|
||||
this.curValue = newValue;
|
||||
// Redraw the knob
|
||||
drawKnob();
|
||||
// Fire the ValueChangeEvent if the value actually changed
|
||||
if (fireEvent && isValueChanged) {
|
||||
ValueChangeEvent.fire(this, this.curValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the labels along the line.
|
||||
|
||||
Reference in new issue
Block a user