Advertisement
Guest User

Untitled

a guest
May 24th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. package nl.avans.view.dashboard;
  2.  
  3. import javafx.collections.ObservableList;
  4. import javafx.geometry.Insets;
  5. import javafx.geometry.Pos;
  6. import javafx.scene.control.TableColumn;
  7. import javafx.scene.control.TableView;
  8. import javafx.scene.control.TextField;
  9. import javafx.scene.control.cell.PropertyValueFactory;
  10. import javafx.scene.layout.Background;
  11. import javafx.scene.layout.BackgroundFill;
  12. import javafx.scene.layout.FlowPane;
  13. import javafx.scene.layout.VBox;
  14. import javafx.scene.paint.Color;
  15. import nl.avans.controller.dashboard.CreateNewGameController;
  16. import nl.avans.controller.dashboard.StatisticsController;
  17. import nl.avans.helpers.Styling;
  18.  
  19. public class StatisticsPane extends FlowPane {
  20.  
  21.  
  22. private TableView<String> tableView, tableViewName;
  23. private CreateNewGameController gameController;
  24. private TextField filter;
  25. private ObservableList<String> players;
  26.  
  27.  
  28. @SuppressWarnings("unchecked")
  29.  
  30. public StatisticsPane(StatisticsController controller) {
  31.  
  32.  
  33. filter = new TextField();
  34. filter.setPadding(Styling.PADDING);
  35. filter.setPromptText("Speler zoeken...");
  36.  
  37. TableColumn nameColumn = new TableColumn<>("Naam");
  38. nameColumn.setCellValueFactory(new PropertyValueFactory<>("naam"));
  39. nameColumn.setMinWidth(100);
  40. nameColumn.setStyle("-fx-fill: white; -fx-background-color: grey; -fx-border-radius: 10 0 0 0;");
  41.  
  42.  
  43. TableColumn winColumn = new TableColumn<>("Win");
  44. winColumn.setCellValueFactory(new PropertyValueFactory<>("win"));
  45. winColumn.setMinWidth(100);
  46. winColumn.setStyle("-fx-fill: white; -fx-background-color: grey; -fx-border-radius: 0 0 0 0;");
  47.  
  48.  
  49. TableColumn lossColumn = new TableColumn<>("Lose");
  50. lossColumn.setCellValueFactory(new PropertyValueFactory<>("loss"));
  51. lossColumn.setMinWidth(100);
  52. lossColumn.setStyle("-fx-text-fill: white; -fx-background-color: grey");
  53.  
  54. TableColumn worthColumn = new TableColumn<>("Waarde");
  55. worthColumn.setCellValueFactory(new PropertyValueFactory<>("diceworth"));
  56. worthColumn.setMinWidth(100);
  57.  
  58. worthColumn.setStyle("-fx-text-fill: white; -fx-background-color: grey");
  59.  
  60.  
  61. TableColumn colorColumn = new TableColumn<>("Kleur");
  62. colorColumn.setCellValueFactory(new PropertyValueFactory<>("dicecolor"));
  63. colorColumn.setMinWidth(100);
  64. colorColumn.setStyle("-fx-fill: white; -fx-background-color: grey");
  65.  
  66.  
  67. TableColumn opponentColumn = new TableColumn<>("Tegenstander");
  68. opponentColumn.setCellValueFactory(new PropertyValueFactory<>("opponents"));
  69. opponentColumn.setMinWidth(120);
  70. opponentColumn.setStyle("-fx-fill: white; -fx-background-color: grey");
  71.  
  72.  
  73. tableView = new TableView<>();
  74. tableViewName = new TableView<>();
  75. tableView.setStyle("-fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 10 10;");
  76.  
  77.  
  78. tableView.getColumns().addAll(nameColumn, winColumn, lossColumn, worthColumn, colorColumn, opponentColumn);
  79. // tableViewName.setItems(getPlayer());
  80.  
  81.  
  82.  
  83.  
  84. VBox search = new VBox();
  85. search.setSpacing(10);
  86. search.getChildren().addAll(filter);
  87.  
  88. VBox rootnode = new VBox(search, tableView);
  89. rootnode.setPadding(new Insets(30, 30, 30, 30));
  90. rootnode.setSpacing(20);
  91. rootnode.setBackground(new Background(new BackgroundFill(Color.WHITE, Styling.BORDER_RADIUS, null)));
  92. getChildren().add(rootnode);
  93. setAlignment(Pos.CENTER);
  94. setPadding(new Insets(20));
  95. rootnode.setStyle("-fx-border-radius:10 10 10 10");
  96. }
  97.  
  98.  
  99. }
  100. //public ObservableList<Player> getPlayer(){
  101. // players = FXCollections.observableArrayList(gameController.getUserNameList());
  102. //
  103. // return players;
  104. //}
  105. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement