/*
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
*/
|
package com.megatim.fdxconvert.controller.table;
|
|
import com.megatim.fdxconvert.model.AlphaNumeriqueField;
|
import java.time.LocalDateTime;
|
import java.time.format.DateTimeFormatter;
|
import javafx.beans.property.SimpleStringProperty;
|
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
|
/**
|
*
|
* @author ASUS
|
*/
|
public class AlphaNumeriqueFieldTable {
|
|
private AlphaNumeriqueFieldTable() {
|
|
}
|
|
public static TableColumn<AlphaNumeriqueField, String> codeTypeFichierColumn() {
|
TableColumn<AlphaNumeriqueField, String> column = new TableColumn("Typefichier");
|
column.setCellValueFactory(new PropertyValueFactory("codeTypefichier"));
|
return column;
|
}
|
|
public static TableColumn<AlphaNumeriqueField, String> codeColonneColumn() {
|
TableColumn<AlphaNumeriqueField, String> column = new TableColumn("Code du Champ");
|
column.setCellValueFactory(e -> {
|
return new SimpleStringProperty(e.getValue().getCodeColonne());
|
});
|
return column;
|
}
|
|
public static TableColumn<AlphaNumeriqueField, Boolean> shouldBeTruncatedColumn() {
|
TableColumn<AlphaNumeriqueField, Boolean> column = new TableColumn("Peut être tronqué");
|
column.setCellValueFactory(new PropertyValueFactory("shouldBeTruncated"));
|
return column;
|
}
|
|
public static TableColumn<AlphaNumeriqueField, Integer> tailleColumn() {
|
TableColumn<AlphaNumeriqueField, Integer> column = new TableColumn("Taille du champ");
|
column.setCellValueFactory(new PropertyValueFactory("taille"));
|
return column;
|
}
|
|
public static TableColumn<AlphaNumeriqueField, Integer> indexColumn() {
|
TableColumn<AlphaNumeriqueField, Integer> column = new TableColumn("Index de début du champ");
|
column.setCellValueFactory(new PropertyValueFactory("index"));
|
return column;
|
}
|
|
public static TableColumn<AlphaNumeriqueField, String> dateCreationColumn() {
|
TableColumn<AlphaNumeriqueField, String> column = new TableColumn("Date de creation");
|
column.setCellValueFactory(c -> {
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
LocalDateTime date = c.getValue().getDateCreation();
|
|
return new SimpleStringProperty(date != null ? ""+ date.format(formatter) : "");
|
});
|
return column;
|
}
|
|
}
|