|
|
|
@ -3,6 +3,7 @@ import java.net.URL;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
import javafx.beans.property.SimpleDoubleProperty;
|
|
|
|
|
import javafx.beans.value.ChangeListener;
|
|
|
|
@ -18,7 +19,7 @@ import javafx.util.converter.NumberStringConverter;
|
|
|
|
|
public class HelloController implements Initializable{
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private TreeView<iCaptor> myListView;
|
|
|
|
|
private TreeView<iCaptor> myListTreeView;
|
|
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
|
private Label myLabel;
|
|
|
|
@ -29,27 +30,35 @@ public class HelloController implements Initializable{
|
|
|
|
|
@Override
|
|
|
|
|
public void initialize(URL arg0, ResourceBundle arg1) {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Tu créer un dossier root de type iCaptor = new CaptorVirtual()
|
|
|
|
|
*
|
|
|
|
|
* tu ajoute des sous dossier / fichier
|
|
|
|
|
*
|
|
|
|
|
* tu fais myListView.setRoot(root.display())
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
|
|
iCaptor it1 = new Captor("remi");
|
|
|
|
|
iCaptor it2 = new Captor("boris");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iCaptor it3 = new Captor("tom");
|
|
|
|
|
iCaptor it4 = new Captor("albert");
|
|
|
|
|
iCaptor it5 = new Captor("teemo");
|
|
|
|
|
|
|
|
|
|
ArrayList<iCaptor> array = new ArrayList<iCaptor>();
|
|
|
|
|
array.add(it1);
|
|
|
|
|
array.add(it2);
|
|
|
|
|
|
|
|
|
|
iCaptor capt = new CaptorVirtual("bernard",array);
|
|
|
|
|
myListView.setRoot(capt.display());
|
|
|
|
|
iCaptor capt = new CaptorVirtual(UUID.randomUUID().toString(),array);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TreeItem<iCaptor> root = new TreeItem<iCaptor>(new Captor("toto"));
|
|
|
|
|
root.getChildren().add(it3.display());
|
|
|
|
|
root.getChildren().add(it4.display());
|
|
|
|
|
root.getChildren().add(it5.display());
|
|
|
|
|
root.getChildren().add(capt.display());
|
|
|
|
|
|
|
|
|
|
myListTreeView.setRoot(root);
|
|
|
|
|
|
|
|
|
|
myListTreeView.setShowRoot(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void selectItem() {
|
|
|
|
|
myListView.getSelectionModel().selectedItemProperty().addListener((observableValue, captorTreeItem, t1) -> {
|
|
|
|
|
myListTreeView.getSelectionModel().selectedItemProperty().addListener((observableValue, captorTreeItem, t1) -> {
|
|
|
|
|
StringConverter<Number> coucou = new NumberStringConverter();
|
|
|
|
|
if (captorTreeItem == null)return;
|
|
|
|
|
myLabel.textProperty().bind(captorTreeItem.getValue().temp.asString());
|
|
|
|
|