Fixed jdk7 problem in Multislider and NPE when there is no motor in the
ThrustCurveMotorSelectionPanel.
This commit is contained in:
parent
7687568f81
commit
e4afa7961e
@ -461,7 +461,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
|
|||||||
|
|
||||||
List<ThrustCurveMotor> getFilteredCurves() {
|
List<ThrustCurveMotor> getFilteredCurves() {
|
||||||
List<ThrustCurveMotor> motors = selectedMotorSet.getMotors();
|
List<ThrustCurveMotor> motors = selectedMotorSet.getMotors();
|
||||||
if (hideSimilarBox.isSelected()) {
|
if (hideSimilarBox.isSelected() && selectedMotor != null) {
|
||||||
List<ThrustCurveMotor> filtered = new ArrayList<ThrustCurveMotor>(motors.size());
|
List<ThrustCurveMotor> filtered = new ArrayList<ThrustCurveMotor>(motors.size());
|
||||||
for (int i = 0; i < motors.size(); i++) {
|
for (int i = 0; i < motors.size(); i++) {
|
||||||
ThrustCurveMotor m = motors.get(i);
|
ThrustCurveMotor m = motors.get(i);
|
||||||
@ -469,7 +469,6 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
|
|||||||
filtered.add(m);
|
filtered.add(m);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double similarity = MotorCorrelation.similarity(selectedMotor, m);
|
double similarity = MotorCorrelation.similarity(selectedMotor, m);
|
||||||
log.debug("Motor similarity: " + similarity);
|
log.debug("Motor similarity: " + similarity);
|
||||||
if (similarity < MOTOR_SIMILARITY_THRESHOLD) {
|
if (similarity < MOTOR_SIMILARITY_THRESHOLD) {
|
||||||
|
@ -311,7 +311,17 @@ public class MultiSlider extends JSlider {
|
|||||||
* description: The sliders BoundedRangeModel.
|
* description: The sliders BoundedRangeModel.
|
||||||
*/
|
*/
|
||||||
public void setModel(BoundedRangeModel newModel) {
|
public void setModel(BoundedRangeModel newModel) {
|
||||||
|
// Hack around jdk 7 problem: http://code.google.com/p/geoviz/issues/detail?id=80
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
setModelAt(getCurrentThumbIndex(), newModel);
|
setModelAt(getCurrentThumbIndex(), newModel);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
this.sliderModel = newModel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@ -392,7 +402,16 @@ public class MultiSlider extends JSlider {
|
|||||||
* @see #setValue
|
* @see #setValue
|
||||||
*/
|
*/
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
|
// Hack around jdk 7 problem: http://code.google.com/p/geoviz/issues/detail?id=80
|
||||||
|
try
|
||||||
|
{
|
||||||
return getValueAt(getCurrentThumbIndex());
|
return getValueAt(getCurrentThumbIndex());
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
Loading…
x
Reference in New Issue
Block a user