question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ListSelectionView broken in 8.40.15

See original GitHub issue

In 8.40.15 the list selection view lists (target and source lists) seems to have stopped updating. Here is sample code demonstrating the problem:

package playing;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.controlsfx.control.ListSelectionView;

import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.embed.swing.JFXPanel;
import javafx.geometry.Orientation;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.util.Callback;

public class Playing
{
    private ListSelectionView<String> view;

    public Playing()
    {
        setup();
    }

    private void setup()
    {

        List<String> list = new ArrayList<>();
        list.add("A");
        list.add("B");
        list.add("C");
        list.add("D");
        view = new ListSelectionView<>();

        view.setOrientation(Orientation.HORIZONTAL);

        MyResultConverter resultConverter = new MyResultConverter();

        view.setTargetItems(FXCollections.observableList(list));

        Platform.runLater(() ->
        {
            Dialog<List<String>> fxDialog = new Dialog<>();
            fxDialog.setTitle("Select");
            fxDialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
            fxDialog.getDialogPane().setContent(view);
            fxDialog.setResultConverter(resultConverter);
            fxDialog.setOnCloseRequest(e -> processResults(fxDialog.getResult()));
            fxDialog.show();
        });

    }

    public static void main(String[] args)
    {
        new JFXPanel();
        new Playing();
        try
        {
            Thread.sleep(30000);
        }
        catch (InterruptedException e)
        {
            Thread.currentThread().interrupt();
        }
    }

    /**
     * 
     * This callback is used by the dialog when the user hits the ok/cancel buttons
     * 
     * 
     */

    private class MyResultConverter implements Callback<ButtonType, List<String>>
    {
        @Override
        public List<String> call(ButtonType b)
        {
            if (b == ButtonType.OK)
            {
                System.out.println("Sources: ");
                view.getSourceItems().forEach(e -> System.out.print(e + "|"));
                return view.getTargetItems();
            }
            else
            {
                return Collections.emptyList();
            }
        }
    }

    private void processResults(List<String> list)
    {
        System.out.println("Result: ");
        list.stream().forEach(f -> System.out.println(f));
    }

}

When you run the dialog and modify the list, the result always print A B C D for the target list. Reverting back to 8.40.14 fixes it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
abhinayagarwalcommented, Oct 10, 2019

@ViniciusSSilva Ah, my bad. I was checking the date of commit instead of the date of merge.

If someone wants to try out the latest version, we release snapshot versions for ControlsFX.

1reaction
ViniciusSSilvacommented, Oct 9, 2019

I am not sure why, but it seems both 8.40.15 and 11.0.0 does not have the fix in them. Can someone build from the source and check if it fixes the issue for them?

The 11.0.0 Release was done before #1117 bug-fix

I found a way to fix it using https://jitpack.io

add the arg: --add-exports=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED

pom.xml changes (with maven):

...
<repositories>
     <repository>
          <id>jitpack.io</id>
          <url>https://jitpack.io</url>
     </repository>
</repositories>
...
<dependencies>
    ...
    <!-- ControlsFx Release Jul 08, 2019 -->
    <dependency>
        <groupId>com.github.abhinayagarwal.controlsfx</groupId>
        <artifactId>controlsfx</artifactId>
        <version>-cdad7beeb2-1</version>
    </dependency>
    ...
</dependencies>
...

Edit: It is also possible to use the version from the original repository

...
<repositories>
     <repository>
          <id>jitpack.io</id>
          <url>https://jitpack.io</url>
     </repository>
</repositories>
...
<dependencies>
    ...
    <!-- ControlsFx using origin/master as version -->
    <dependency>
        <groupId>com.github.controlsfx.controlsfx</groupId>
        <artifactId>controlsfx</artifactId>
        <version>-SNAPSHOT</version>
    </dependency>
    ...
</dependencies>
...
Read more comments on GitHub >

github_iconTop Results From Across the Web

ControlsFX - Google Groups
Hei there So I have the following problem. ... ListSelectionView keytyped on source or target items ... Avaibility of version 8.40.15 in MavenCentral....
Read more >
ListSelectionView (ControlsFX Project 11.0.3)
A control used to perform a multi-selection via the help of two list views. Items can be moved from one list (source) to...
Read more >
Recently Active 'controlsfx' Questions - Page 2 - Stack Overflow
I'm using OpenFX 11, OpenJDK 11 and controlsfx 8.40.15 library Getting Caused by: ... such as List Selection View, or List Action View...
Read more >
ListSelectionView (ControlsFX Project 8.40.10) - Javadox
public class ListSelectionView<T>extends Control. A control used to perform a multi-selection via the help of two list views. Items can be moved from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found