j'ai un tableau à remplir par une requête SQL de jointure, où j'utilise 3 tables liées:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<TableView fx:id="table" prefHeight="266.0" prefWidth="1056.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                    <columns>
                      <TableColumn fx:id="colMat" prefWidth="123.0" text="Matricule" />
                      <TableColumn fx:id="colNom" prefWidth="147.00001525878906" text="Nom" />
                        <TableColumn fx:id="colPrenom" prefWidth="64.33331298828125" text="Prénom" />
                        <TableColumn fx:id="colSpe" prefWidth="128.99996948242188" text="Spécialité" />
                        <TableColumn fx:id="colNiv" prefWidth="111.33331298828125" text="Niveau" />
                        <TableColumn fx:id="colForm" prefWidth="140.0" text="Formation" />
                        <TableColumn fx:id="colDateIns" prefWidth="118.3333740234375" text="Date d'inscription" />
                        <TableColumn fx:id="colValide" maxWidth="163.33331298828125" prefWidth="163.33331298828125" text="Valide" />
                    </columns>
                  </TableView>
j'ai déclaré les colonnes dans le constructeur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
@FXML private TableView<String> table;
@FXML private TableColumn<Etudiant, String> colMat;
@FXML private TableColumn<Etudiant, String> colNom;
@FXML private TableColumn<Etudiant, String> colPrenom;
@FXML private TableColumn<Etudiant, String> colSpe;
@FXML private TableColumn<Etudiant, String> colNiv;
@FXML private TableColumn<Formation, String> colForm;
@FXML private TableColumn<Inscription, String> colDateIns;
@FXML private TableColumn<Inscription, String> colValide;
comme vous pouvez le constatez, chaque colonne appartient à une table différente, donc une classe modèle différente, donc en voulant remplir le tableau j'ai eu une erreur de syntaxe
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 public void initTable(String id) throws SQLException {        
        ObservableList<String> donnees = FXCollections.observableArrayList();
        donnees.clear();
        donnees = importTable();//méthode qui retourne la liste de données par SQL
 
        //erreur de retour bad return type in lambda expression
        colMat.setCellValueFactory(cellData -> cellData.getValue().getMatricule());
 
        table.setItems(donnees);//attribuer la liste au tableau
    }
dans la classe Etudiant, l'attribut est retourné et déclaré comme ceci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
private StringProperty matricule;
 
public String getMatricule() {
        return matricule.get();
}
svp, comment résoudre cette erreur ?

merci