Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.net.URL;
- import java.util.ResourceBundle;
- import javafx.collections.FXCollections;
- import javafx.collections.ObservableList;
- import javafx.collections.transformation.FilteredList;
- import javafx.collections.transformation.SortedList;
- import javafx.fxml.FXML;
- import javafx.fxml.Initializable;
- import javafx.scene.control.TableColumn;
- import javafx.scene.control.TableView;
- import javafx.scene.control.TextArea;
- import javafx.scene.control.TextField;
- import logistic.Main;
- public class InsertLogistic implements Initializable{
- //public class InsertLogistic{
- //private Main main;
- @FXML
- private TextField t_name;
- @FXML
- private TextArea t_address;
- @FXML
- private TableView<ProductConfirmGet> productConfirm;
- @FXML
- private TableColumn<ProductConfirmGet, String> name;
- @FXML
- private TableColumn<ProductConfirmGet, String> quantity;
- private ObservableList<ProductConfirmGet> dataconfirm = FXCollections.observableArrayList();
- //private ObservableList<Product> dataFilter = FXCollections.observableArrayList();
- public void setDataget(ObservableList<ProductConfirmGet> dataconfirm1) {
- this.dataconfirm = dataconfirm1;
- //dataconfirm.forEach(item -> System.out.println(item.getName()+" "+item.getQuantity()));
- initialize();
- //InsertLogisticTable it = new InsertLogisticTable(this.dataconfirm);
- }
- /*
- public InsertLogistic() {
- dataconfirm.add(new ProductConfirmGet("2","3"));
- }
- */
- @FXML
- public void initialize(){
- //Initialize the columns.
- name.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
- quantity.setCellValueFactory(cellData -> cellData.getValue().quantityProperty());
- //Wrap the ObservableList in a FilteredList (initially display all data).
- FilteredList<ProductConfirmGet> filteredData = new FilteredList<>(this.dataconfirm, p -> true);
- //Wrap the FilteredList in a SortedList.
- SortedList<ProductConfirmGet> sortedData = new SortedList<>(filteredData);
- //Bind the SortedList comparator to the TableView comparator.
- //Otherwise, sorting the TableView would have no effect.
- sortedData.comparatorProperty().bind(productConfirm.comparatorProperty());
- sortedData.forEach(item -> System.out.println(item.getName()+" "+item.getQuantity()));
- System.out.println(productConfirm.getAccessibleRoleDescription());
- //Add sorted (and filtered) data to the table.
- productConfirm.setItems(sortedData);
- System.out.println(productConfirm.getAccessibleRoleDescription());
- }
- @Override
- public void initialize(URL location, ResourceBundle resources) {
- // TODO Auto-generated method stub
- }
- @FXML
- private void getProduct() throws IOException{
- Main main = new Main();
- main.showProductSelect();
- }
- @FXML
- public void confirm() throws IOException{
- //System.out.println("Hello");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement