Skip to content

Commit 4972ef0

Browse files
authored
Merge pull request #58 from ponder-lab/spinner-explicit-maximum
Set an explicit `Spinner` maximum in `addSpinnerButton`
2 parents 6e7eebd + 14c3e84 commit 4972ef0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • edu.cuny.citytech.refactoring.common.ui/src/edu/cuny/citytech/refactoring/common/ui

edu.cuny.citytech.refactoring.common.ui/src/edu/cuny/citytech/refactoring/common/ui/InputPage.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ protected void addIntegerButton(String text, String key, int defaultValue, Consu
8585
* Adds a {@link Spinner} control for a small bounded positive integer setting. Like
8686
* {@link #addIntegerButton(String, String, int, Consumer, Composite)}, this seeds {@code defaultValue} into the dialog settings if
8787
* {@code key} is absent. Unlike the free-text {@link Text}-backed integer button, the spinner offers up/down steppers, enforces
88-
* integer-only input, and pins a {@code minimum}, eliminating the silent parse-failure path.
88+
* integer-only input, and pins a {@code minimum}, eliminating the silent parse-failure path. The maximum is left unbounded
89+
* ({@link Integer#MAX_VALUE}) rather than the SWT default of {@code 100}, so stored or default values above {@code 100} are not
90+
* silently clamped.
8991
*
9092
* @param text The label for the control.
9193
* @param key The dialog settings key under which the value is stored.
@@ -103,6 +105,8 @@ protected void addSpinnerButton(String text, String key, int defaultValue, int m
103105
label.setText(text);
104106

105107
Spinner spinner = new Spinner(result, SWT.BORDER);
108+
// Raise the cap off SWT's default of 100 before setting the minimum so neither bound silently clamps the stored value.
109+
spinner.setMaximum(Integer.MAX_VALUE);
106110
spinner.setMinimum(minimum);
107111
spinner.setSelection(this.settings.getInt(key));
108112
// Read back the (possibly minimum-clamped) selection so the consumer and settings stay consistent with the control.

0 commit comments

Comments
 (0)