don't fire an event when propagating an extension of the min/max range

This commit is contained in:
Axel Uhl committed 2012-02-28 20:50:36 +01:00
1 parent bebd931777
commit 674196c458
4 files changed
+20 -19

No files matched your search

@@ -261,7 +261,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl implemen
* {@link #trackedRace} with data received from the trackers.
*/
private boolean isTrackedRaceStillReachable() {
return Util.contains(getEvent().getAllRaces(), trackedRace.getRace()) &&
return trackedRace != null && Util.contains(getEvent().getAllRaces(), trackedRace.getRace()) &&
getTrackedEvent().getExistingTrackedRace(trackedRace.getRace()) == trackedRace;
}
@@ -174,7 +174,7 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
}
// never reduce max if it was already set
if (min != null && max != null && (getMax() == null || getMax().before(max))) {
setMinMax(min, max);
setMinMax(min, max, false);
}
}
@@ -36,14 +36,14 @@ public class TimePanel<T extends TimePanelSettings> extends FormPanel implements
/**
* The start time point of the time interval visualized by this time panel. May be <code>null</code> if not yet initialized.
*
* @see #setMinMax(Date, Date)
* @see #setMinMax(Date, Date, boolean)
*/
private Date min;
/**
* The end time point of the time interval visualized by this time panel. May be <code>null</code> if not yet initialized.
*
* @see #setMinMax(Date, Date)
* @see #setMinMax(Date, Date, boolean)
*/
private Date max;
@@ -271,7 +271,7 @@ public class TimePanel<T extends TimePanelSettings> extends FormPanel implements
// Handle it equally for replay and live mode for robustness reasons. This at least allows a user
// to watch on even if the time panel was off in its assumptions about race end and end of tracking.
if (time.after(getMax())) {
setMinMax(getMin(), time);
setMinMax(getMin(), time, false);
}
long t = time.getTime();
sliderBar.setCurrentValue(new Double(t), false);
@@ -295,22 +295,23 @@ public class TimePanel<T extends TimePanelSettings> extends FormPanel implements
/**
* @param min must not be <code>null</code>
* @param max must not be <code>null</code>
* @param fireEvent TODO
*/
public void setMinMax(Date min, Date max) {
public void setMinMax(Date min, Date max, boolean fireEvent) {
assert min != null && max != null;
boolean changed = false;
int numTicks = 8;
if (!max.equals(this.max)) {
changed = true;
this.max = max;
sliderBar.setMaxValue(new Double(max.getTime()));
sliderBar.setMaxValue(new Double(max.getTime()), fireEvent);
}
if (!min.equals(this.min)) {
changed = true;
this.min = min;
sliderBar.setMinValue(new Double(min.getTime()));
sliderBar.setMinValue(new Double(min.getTime()), fireEvent);
if (sliderBar.getCurrentValue() == null) {
sliderBar.setCurrentValue(new Double(min.getTime()));
sliderBar.setCurrentValue(new Double(min.getTime()), fireEvent);
}
}
if (changed) {
@@ -318,9 +319,9 @@ public class TimePanel<T extends TimePanelSettings> extends FormPanel implements
sliderBar.setNumTicks(numTicks);
int numSteps = sliderBar.getElement().getClientWidth();
if (numSteps > 0) {
sliderBar.setStepSize(numSteps);
sliderBar.setStepSize(numSteps, fireEvent);
} else {
sliderBar.setStepSize(1000);
sliderBar.setStepSize(1000, fireEvent);
}
}
}
@@ -702,10 +702,10 @@ public class SliderBar extends FocusPanel implements RequiresResize, HasValue<Do
* @param maxValue
* the current value
*/
public void setMaxValue(Double maxValue) {
public void setMaxValue(Double maxValue, boolean fireEvent) {
this.maxValue = maxValue;
drawTickLabels();
resetCurrentValue();
resetCurrentValue(fireEvent);
}
/**
@@ -714,10 +714,10 @@ public class SliderBar extends FocusPanel implements RequiresResize, HasValue<Do
* @param minValue
* the current value
*/
public void setMinValue(Double minValue) {
public void setMinValue(Double minValue, boolean fireEvent) {
this.minValue = minValue;
drawTickLabels();
resetCurrentValue();
resetCurrentValue(fireEvent);
}
/**
@@ -767,9 +767,9 @@ public class SliderBar extends FocusPanel implements RequiresResize, HasValue<Do
* @param stepSize
* the current value
*/
public void setStepSize(double stepSize) {
public void setStepSize(double stepSize, boolean fireEvent) {
this.stepSize = stepSize;
resetCurrentValue();
resetCurrentValue(fireEvent);
}
public void setValue(Double value) {
@@ -1088,8 +1088,8 @@ public class SliderBar extends FocusPanel implements RequiresResize, HasValue<Do
/**
* Reset the progress to constrain the progress to the current range and redraw the knob as needed.
*/
private void resetCurrentValue() {
setCurrentValue(getCurrentValue());
private synchronized void resetCurrentValue(boolean fireEvent) {
setCurrentValue(getCurrentValue(), fireEvent);
}
/**