package Controllers.Stock;

import Controllers.Traitement.Adaptateur;
import Models.Categorie.CategorieListe;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.text.Text;

/**
 * FXML Controller class
 * @author Maher
 */
public class PrintAllCategorieController implements Initializable {

    @FXML private Text TextLocale;
    @FXML private Text TextDateCreate;
    @FXML private Text TextPagination;
    
    @FXML private TableView<CategorieListe> TableViewCategorie ;
    @FXML private TableColumn<CategorieListe, String> TabColCategorie;
    @FXML private TableColumn<CategorieListe, String> TabColQuantite;
    
    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        TabColCategorie.setCellValueFactory(new PropertyValueFactory<CategorieListe, String>("Nom"));
        TabColQuantite.setCellValueFactory(new PropertyValueFactory<CategorieListe, String>("Quantite"));
        TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
        TabColQuantite.getStyleClass().add("Center");
    }    
    
    
    public void setCategories(ObservableList<CategorieListe> listCateg, String Local, String Pagination){
        TableViewCategorie.setItems(null);
        TableViewCategorie.setItems(listCateg);
        TextLocale.setText(Local);
        TextPagination.setText(Pagination);
        TextDateCreate.setText(Adaptateur.getDefaultCurrentDate("dd/MM/yyyy HH:mm"));
    }
}
