Skip to content

Commit

Permalink
Fix to bounds provider code which inadvertently returns NaN during init.
Browse files Browse the repository at this point in the history
  • Loading branch information
gerring committed Jun 13, 2017
1 parent c08f66e commit 5424bee
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public abstract class NumberBox extends ButtonComposite implements BoundsProvide
// FIXME Widgets should not have a reference to the controller.
// This breaks the model/view/controller design because the controller
// is referenced by the view to look up field values.
private IBeanController beanService;
private IBeanController<?> beanService;


public NumberBox(Composite parent, int style) {
Expand Down Expand Up @@ -781,8 +781,10 @@ public void setDecimalPlaces(int decimalPlaces) {
*/
@SuppressWarnings("unchecked")
public double getMaximum() {
if (maxProvider != null)
return maxProvider.getBoundValue();
if (maxProvider != null) {
double dbl = maxProvider.getBoundValue();
if (!Double.isNaN(dbl)) return dbl;
}
if (maxFieldName != null && maxClass != null) {
ScaleBox max = beanService!=null ? (ScaleBox) beanService.getBeanField(maxFieldName, maxClass) : null;
if (max != null)
Expand Down Expand Up @@ -840,8 +842,10 @@ public void valueChangePerformed(ValueEvent e) {
*/
@SuppressWarnings("unchecked")
public double getMinimum() {
if (minProvider != null)
return minProvider.getBoundValue();
if (minProvider != null) {
double dbl = minProvider.getBoundValue();
if (!Double.isNaN(dbl)) return dbl;
}
if (minFieldName != null && minClass != null) {
final ScaleBox min = beanService!=null ? (ScaleBox) beanService.getBeanField(minFieldName, minClass) : null;
if (min != null)
Expand Down Expand Up @@ -1112,11 +1116,11 @@ public void setFieldOveride(String fieldOveride) {
this.fieldOveride = fieldOveride;
}

public IBeanController getBeanService() {
public IBeanController<?> getBeanService() {
return beanService;
}

public void setBeanService(IBeanController beanService) {
public void setBeanService(IBeanController<?> beanService) {
this.beanService = beanService;
}

Expand Down

0 comments on commit 5424bee

Please sign in to comment.