I get an IndexOutOfBoundsException if I run the following code.
Don't know, if this is considered as a bug in the runtime or if this is the developer's fault of messing up the destination list.
Why is it done by index anyway? If I remove something in the source list, it should be fine to just call remove(object) on the destination list. If it doesn't exist anymore it will be silently ignored.
Please comment if this will get fixed or if it is up to the developer to avoid such scenarios.
see also:
RT-19636
2nd comment
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.List;
public class TestApp3 extends Application {
public static void main(String[] args) throws Exception {
launch(args);
}
public void start(final Stage stage) throws Exception {
VBox root = new VBox();
List<String> destinationList = new ArrayList<String>();
ObservableList<String> sourceList = FXCollections.observableArrayList("String1", "String2");
Bindings.bindContent(destinationList, sourceList);
System.out.println(destinationList);
destinationList.remove("String1");
sourceList.remove("String2");
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}
Don't know, if this is considered as a bug in the runtime or if this is the developer's fault of messing up the destination list.
Why is it done by index anyway? If I remove something in the source list, it should be fine to just call remove(object) on the destination list. If it doesn't exist anymore it will be silently ignored.
Please comment if this will get fixed or if it is up to the developer to avoid such scenarios.
see also:
2nd comment
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.List;
public class TestApp3 extends Application {
public static void main(String[] args) throws Exception {
launch(args);
}
public void start(final Stage stage) throws Exception {
VBox root = new VBox();
List<String> destinationList = new ArrayList<String>();
ObservableList<String> sourceList = FXCollections.observableArrayList("String1", "String2");
Bindings.bindContent(destinationList, sourceList);
System.out.println(destinationList);
destinationList.remove("String1");
sourceList.remove("String2");
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}