-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
jfx24, jfx25
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When a FilteredList wraps a TabObservableList (used internally by TabPane.getTabs()), it fails to recompute its contents correctly during a tab reordering (permutation). This results in the FilteredList containing outdated elements or incorrect order. No exceptions are thrown, but the filtered list becomes semantically incorrect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a TabPane with some tabs.
Wrap its tab list (TabObservableList) in a FilteredList<Tab> with a predicate (e.g., tab text starts with "lib").
Perform a permutation (reordering) on the base tab list using TabObservableList.reorder(...).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The FilteredList should automatically detect changes in order or filtering conditions and update its internal state to reflect the correct filtered view.
ACTUAL -
The FilteredList continues to reference an outdated view after permutation. The filtered content becomes incorrect even though the backing list changed.
---------- BEGIN SOURCE ----------
package org.jabref.gui.javafx;
import java.util.List;
import javafx.collections.transformation.FilteredList;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import com.sun.javafx.scene.control.TabObservableList;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testfx.framework.junit5.ApplicationExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@ExtendWith(ApplicationExtension.class)
public class TabObservableListFilteredTest {
@Test
public void testFilteredListDetectsPermutation() {
Tab lib1 = new Tab("lib1");
Tab lib2 = new Tab("lib2");
Tab other = new Tab("other");
TabPane tabPane = new TabPane(lib1, other, lib2);
TabObservableList<Tab> base = (TabObservableList) tabPane.getTabs();
FilteredList<Tab> filtered = new FilteredList<>(base, tab -> tab.getText().startsWith("lib"));
assertEquals(List.of(lib1, lib2), filtered);
// Perform permutation
base.reorder(lib1, other);
// This fails: filtered list did not update correctly
assertNotEquals(other, filtered.get(0)); // Should hold if filter was applied correctly
assertEquals(List.of(lib2, lib1), filtered); // Expected filtered order after permutation
}
}
---------- END SOURCE ----------
When a FilteredList wraps a TabObservableList (used internally by TabPane.getTabs()), it fails to recompute its contents correctly during a tab reordering (permutation). This results in the FilteredList containing outdated elements or incorrect order. No exceptions are thrown, but the filtered list becomes semantically incorrect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a TabPane with some tabs.
Wrap its tab list (TabObservableList) in a FilteredList<Tab> with a predicate (e.g., tab text starts with "lib").
Perform a permutation (reordering) on the base tab list using TabObservableList.reorder(...).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The FilteredList should automatically detect changes in order or filtering conditions and update its internal state to reflect the correct filtered view.
ACTUAL -
The FilteredList continues to reference an outdated view after permutation. The filtered content becomes incorrect even though the backing list changed.
---------- BEGIN SOURCE ----------
package org.jabref.gui.javafx;
import java.util.List;
import javafx.collections.transformation.FilteredList;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import com.sun.javafx.scene.control.TabObservableList;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testfx.framework.junit5.ApplicationExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@ExtendWith(ApplicationExtension.class)
public class TabObservableListFilteredTest {
@Test
public void testFilteredListDetectsPermutation() {
Tab lib1 = new Tab("lib1");
Tab lib2 = new Tab("lib2");
Tab other = new Tab("other");
TabPane tabPane = new TabPane(lib1, other, lib2);
TabObservableList<Tab> base = (TabObservableList) tabPane.getTabs();
FilteredList<Tab> filtered = new FilteredList<>(base, tab -> tab.getText().startsWith("lib"));
assertEquals(List.of(lib1, lib2), filtered);
// Perform permutation
base.reorder(lib1, other);
// This fails: filtered list did not update correctly
assertNotEquals(other, filtered.get(0)); // Should hold if filter was applied correctly
assertEquals(List.of(lib2, lib1), filtered); // Expected filtered order after permutation
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8359020 TabObservableList.reorder changes content of filtered list
-
- Open
-