daily pastebin goal
23%
SHARE
TWEET

Untitled

kixito Jan 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import java.io.IOException;
  3. import java.net.URL;
  4. import java.util.ResourceBundle;
  5. import javafx.collections.FXCollections;
  6. import javafx.collections.ObservableList;
  7. import javafx.collections.transformation.FilteredList;
  8. import javafx.collections.transformation.SortedList;
  9. import javafx.fxml.FXML;
  10. import javafx.fxml.Initializable;
  11. import javafx.scene.control.TableColumn;
  12. import javafx.scene.control.TableView;
  13. import javafx.scene.control.TextArea;
  14. import javafx.scene.control.TextField;
  15. import logistic.Main;
  16.  
  17. public class InsertLogistic implements Initializable{  
  18. //public class InsertLogistic{
  19.     //private Main main;
  20.    
  21.     @FXML
  22.     private TextField t_name;
  23.     @FXML
  24.     private TextArea t_address;
  25.  
  26.     @FXML
  27.     private TableView<ProductConfirmGet> productConfirm;
  28.     @FXML
  29.     private TableColumn<ProductConfirmGet, String> name;
  30.     @FXML
  31.     private TableColumn<ProductConfirmGet, String> quantity;
  32.  
  33.    
  34.     private ObservableList<ProductConfirmGet> dataconfirm = FXCollections.observableArrayList();
  35.     //private ObservableList<Product> dataFilter = FXCollections.observableArrayList();
  36.    
  37.     public void setDataget(ObservableList<ProductConfirmGet> dataconfirm1) {
  38.         this.dataconfirm = dataconfirm1;
  39.         //dataconfirm.forEach(item -> System.out.println(item.getName()+" "+item.getQuantity()));
  40.         initialize();
  41.         //InsertLogisticTable it = new InsertLogisticTable(this.dataconfirm);
  42.        
  43. }  
  44.     /*
  45.     public InsertLogistic() {
  46.         dataconfirm.add(new ProductConfirmGet("2","3"));
  47.     }
  48.     */
  49.     @FXML
  50.     public void initialize(){
  51.        
  52.         //Initialize the columns.
  53.         name.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
  54.         quantity.setCellValueFactory(cellData -> cellData.getValue().quantityProperty());
  55.    
  56.        
  57.         //Wrap the ObservableList in a FilteredList (initially display all data).
  58.         FilteredList<ProductConfirmGet> filteredData = new FilteredList<>(this.dataconfirm, p -> true);
  59.        
  60.        
  61.         //Wrap the FilteredList in a SortedList.
  62.         SortedList<ProductConfirmGet> sortedData = new SortedList<>(filteredData);
  63.    
  64.        
  65.         //Bind the SortedList comparator to the TableView comparator.
  66.         //Otherwise, sorting the TableView would have no effect.
  67.         sortedData.comparatorProperty().bind(productConfirm.comparatorProperty());
  68.        
  69.         sortedData.forEach(item -> System.out.println(item.getName()+" "+item.getQuantity()));
  70.         System.out.println(productConfirm.getAccessibleRoleDescription());
  71.         //Add sorted (and filtered) data to the table.
  72.         productConfirm.setItems(sortedData);
  73.         System.out.println(productConfirm.getAccessibleRoleDescription());
  74.     }
  75.    
  76.     @Override
  77.     public void initialize(URL location, ResourceBundle resources) {
  78.         // TODO Auto-generated method stub
  79.        
  80.     }
  81.    
  82.     @FXML
  83.     private void getProduct() throws IOException{
  84.         Main main = new Main();
  85.         main.showProductSelect();
  86.        
  87.     }
  88.  
  89.  
  90.  
  91.     @FXML
  92.     public void confirm() throws IOException{
  93.         //System.out.println("Hello");
  94.        
  95.     }
  96.  
  97.    
  98.    
  99.    
  100. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top