Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListSpinnerIntegerList.indexOf( size ) doesn't return -1 #17

Closed
faerindel opened this issue Dec 23, 2014 · 2 comments
Closed

ListSpinnerIntegerList.indexOf( size ) doesn't return -1 #17

faerindel opened this issue Dec 23, 2014 · 2 comments
Assignees

Comments

@faerindel
Copy link

Is that intended?

Because this:

public void start(Stage primaryStage) {
    StackPane root = new StackPane();
    ListSpinner<Integer> spinner = new ListSpinner<>(new ListSpinnerIntegerList(0, 59)).withEditable(true).withStringConverter(StringConverterFactory.forInteger());
    ListSpinnerIntegerList list = new ListSpinnerIntegerList(0, 59);
    System.out.println(list.indexOf(59));
    System.out.println(list.indexOf(60));
    System.out.println(list.indexOf(61));
    System.out.println(list.size());
    root.getChildren().add(spinner);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();
}

Outputs:
59
60
-1
60

And if you introduce 60 in the ListSpinner textfield it throws:
java.lang.IllegalArgumentException: Index out of bounds: 60, valid values are 0-59
(any other invalid value just puts last value back, as expected)

I'm using jfxtras-controls-8.0.r3.jar downloaded directly from the Maven repo.

@tbee
Copy link
Member

tbee commented Dec 23, 2014

Interesting. I'll take a look tomorrow.

Tom

On 23-12-2014 22:25, faerindel wrote:

Is that intended?

Because this:

|public void start(Stage primaryStage) {
StackPane root = new StackPane();
ListSpinner spinner = new ListSpinner<>(new ListSpinnerIntegerList(0, 59)).withEditable(true).withStringConverter(StringConverterFactory.forInteger());
ListSpinnerIntegerList list = new ListSpinnerIntegerList(0, 59);
System.out.println(list.indexOf(59));
System.out.println(list.indexOf(60));
System.out.println(list.indexOf(61));
System.out.println(list.size());
root.getChildren().add(spinner);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
|

Outputs:
59
60
-1
60

And if you introduce 60 in the ListSpinner textfield it throws:
java.lang.IllegalArgumentException: Index out of bounds: 60, valid values are 0-59
(any other invalid value just puts last value back, as expected)

I'm using jfxtras-controls-8.0.r3.jar downloaded directly from the Maven repo.


Reply to this email directly or view it on GitHub #17.

@faerindel faerindel changed the title ListSpinnerIntegerList.indefOf( size ) doesn't return -1 ListSpinnerIntegerList.indexOf( size ) doesn't return -1 Dec 23, 2014
tbee added a commit that referenced this issue Dec 24, 2014
@tbee tbee self-assigned this Dec 24, 2014
@tbee
Copy link
Member

tbee commented Dec 24, 2014

You have indeed uncovered a bug, it was fixed in the current r4-SNAPSHOT. Tests were added to make sure it does not regress. Thanks!

@tbee tbee closed this as completed Dec 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants