| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 
 | package liste;
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import bean.Liste;
import bean.Type;
import fxmltableview.FxmlListe;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.MenuBar;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellDataFeatures;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.util.Callback;
 
import menu.MenuManager;
 
/**
 * FXML Controller class
 *
 * @author Ordi
 */
public class Liste1Controller {
 
    @FXML
    private TableView<Type> tableView2;
    @FXML
    private TableColumn<Type, Integer> Index;
    @FXML
    private TableColumn<Object, String> Type;
    @FXML
    private TableColumn<Type, String> Categorie;
    @FXML
    private TableColumn<Type, String> Nom;
 
    private MenuManager menu;
 
    //private ObservableList<Liste> personData = FXCollections.observableArrayList();
    /**
     * The constructor. The constructor is called before the initialize()
     * method.
     */
    public Liste1Controller() {
 
    }
 
    /**
     * Initializes the controller class.
     */
    @FXML
    public void initialize() {
        tableView2.setEditable(true);
        Index.setCellValueFactory(new PropertyValueFactory<Type, Integer>("Index"));
        Type.setCellFactory(TextFieldTableCell.forTableColumn());
        /*Type.setCellValueFactory(new Callback<CellDataFeatures<Type, String>, ObservableValue<String>>() {
            public ObservableValue<String> call(CellDataFeatures<Type, String> p) {
                return new SimpleStringProperty(p.getValue().getType());
            }
        });*/
        //Type.setCellValueFactory(new PropertyValueFactory<Type, String>("Type"));
        Categorie.setCellValueFactory(new PropertyValueFactory<Type, String>("Categorie"));
        Nom.setCellValueFactory(new PropertyValueFactory<Type, String>("Nom"));
 
    }
 
    public void initManager(final MenuManager menuManager) {
        this.menu = menuManager;
    }
 
    public void setMainApp(ObservableList<Type> mainApp) {
 
        // Add observable list data to the table
        tableView2.setItems(mainApp);
    }
 
    @FXML
    private void handleAboutQuit(final ActionEvent event) {
        System.exit(0);
    }
 
    public final void setOnEditCommit(EventHandler<TableColumn.CellEditEvent<Type, String>> value) {
 
    }
 
} | 
Partager