refactored controllers partially
This commit is contained in:
parent
f24fcfc179
commit
2ff56a1874
|
|
@ -1,4 +1,4 @@
|
|||
package com.r0r5chach.pages;
|
||||
package com.r0r5chach.controllers;
|
||||
|
||||
import com.r0r5chach.competitor.Competitor;
|
||||
import com.r0r5chach.competitor.Name;
|
||||
|
|
@ -13,7 +13,7 @@ import javafx.scene.control.ChoiceBox;
|
|||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
public class EditPage {
|
||||
public class EditController {
|
||||
public static void loadPlayer(Competitor player, TextField[] textFields, ChoiceBox<Rank> level) {
|
||||
textFields[0].setText(String.valueOf(player.getPlayerNumber()));
|
||||
textFields[1].setText(player.getPlayerName().getFullName());
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.r0r5chach.controllers;
|
||||
|
||||
import com.r0r5chach.Manager;
|
||||
import com.r0r5chach.competitor.Rank;
|
||||
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
|
||||
public class FiltersController {
|
||||
@FXML
|
||||
private TextField numberFilter;
|
||||
|
||||
@FXML
|
||||
private TextField nameFilter;
|
||||
|
||||
@FXML
|
||||
ChoiceBox<Rank> levelFilter;
|
||||
|
||||
@FXML
|
||||
private TextField scoreFilter;
|
||||
|
||||
@FXML
|
||||
private ToggleGroup typeFilter;
|
||||
|
||||
@FXML
|
||||
ChoiceBox<ValorantAgent> agentFilter;
|
||||
|
||||
@FXML
|
||||
private void filterSave() {
|
||||
Manager.filtersClose();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,19 @@
|
|||
package com.r0r5chach;
|
||||
package com.r0r5chach.controllers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.r0r5chach.CompetitorList;
|
||||
import com.r0r5chach.Manager;
|
||||
import com.r0r5chach.competitor.Competitor;
|
||||
import com.r0r5chach.competitor.Rank;
|
||||
import com.r0r5chach.competitor.r6.R6Attacker;
|
||||
import com.r0r5chach.competitor.r6.R6Defender;
|
||||
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||
import com.r0r5chach.pages.CompetitorRow;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
|
|
@ -23,18 +25,20 @@ import javafx.scene.control.TableView;
|
|||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import static com.r0r5chach.pages.EditPage.loadPlayer;
|
||||
import static com.r0r5chach.pages.EditPage.loadFavoriteCharacters;
|
||||
import static com.r0r5chach.pages.EditPage.loadScores;
|
||||
import static com.r0r5chach.pages.EditPage.updatePlayer;
|
||||
import static com.r0r5chach.pages.EditPage.updateFavoriteCharacters;
|
||||
import static com.r0r5chach.pages.EditPage.updateScores;
|
||||
import static com.r0r5chach.pages.ViewPage.generateTable;
|
||||
import static com.r0r5chach.pages.ViewPage.loadTable;
|
||||
import static com.r0r5chach.controllers.EditController.loadFavoriteCharacters;
|
||||
import static com.r0r5chach.controllers.EditController.loadPlayer;
|
||||
import static com.r0r5chach.controllers.EditController.loadScores;
|
||||
import static com.r0r5chach.controllers.EditController.updateFavoriteCharacters;
|
||||
import static com.r0r5chach.controllers.EditController.updatePlayer;
|
||||
import static com.r0r5chach.controllers.EditController.updateScores;
|
||||
import static com.r0r5chach.controllers.ViewController.generateTable;
|
||||
import static com.r0r5chach.controllers.ViewController.loadTable;
|
||||
|
||||
public class MainController implements Initializable {
|
||||
private CompetitorList competitors;
|
||||
private ArrayList<Integer> competitorIds;
|
||||
private TextField[] scores;
|
||||
private TextField[] fields;
|
||||
|
||||
@FXML
|
||||
private ListView<Integer> competitorsList;
|
||||
|
|
@ -80,10 +84,6 @@ public class MainController implements Initializable {
|
|||
|
||||
@FXML
|
||||
private TextField overallScore;
|
||||
|
||||
private TextField[] scores;
|
||||
|
||||
private TextField[] fields;
|
||||
|
||||
@FXML
|
||||
private Button updateButton;
|
||||
|
|
@ -91,9 +91,6 @@ public class MainController implements Initializable {
|
|||
@FXML
|
||||
private TableView<CompetitorRow> competitorTable;
|
||||
|
||||
@FXML
|
||||
private Button filterButton;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
Platform.runLater(() -> {
|
||||
|
|
@ -152,4 +149,9 @@ public class MainController implements Initializable {
|
|||
private void loadView() {
|
||||
competitorTable.setItems(loadTable(competitors.getCompetitors()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void filterPress() throws IOException {
|
||||
Manager.filtersOpen();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.r0r5chach.pages;
|
||||
package com.r0r5chach.controllers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
@ -6,6 +6,7 @@ import com.r0r5chach.competitor.Competitor;
|
|||
import com.r0r5chach.competitor.Rank;
|
||||
import com.r0r5chach.competitor.r6.R6Player;
|
||||
import com.r0r5chach.competitor.valorant.ValorantPlayer;
|
||||
import com.r0r5chach.pages.CompetitorRow;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
|
@ -13,7 +14,7 @@ import javafx.scene.control.TableColumn;
|
|||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
|
||||
public class ViewPage {
|
||||
public class ViewController {
|
||||
|
||||
public static void generateTable(TableView<CompetitorRow> table) {
|
||||
TableColumn<CompetitorRow,Integer> playerNumCol = new TableColumn<CompetitorRow,Integer>("Player Number");
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.r0r5chach.MainController">
|
||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.r0r5chach.controllers.MainController">
|
||||
<children>
|
||||
<TabPane prefHeight="406.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE">
|
||||
<tabs>
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
<VBox prefHeight="200.0" prefWidth="100.0">
|
||||
<children>
|
||||
<TableView fx:id="competitorTable" prefHeight="371.0" prefWidth="600.0" />
|
||||
<Button fx:id="filterButton" mnemonicParsing="false" text="Filters">
|
||||
<Button fx:id="filterButton" mnemonicParsing="false" onAction="#filterPress" text="Filters">
|
||||
<VBox.margin>
|
||||
<Insets top="15.0" />
|
||||
</VBox.margin>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: #FFFFFF;" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.r0r5chach.controllers.FiltersController">
|
||||
<children>
|
||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Player Number" GridPane.halignment="RIGHT">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Player Name" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Player Level" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Overall Score" GridPane.halignment="RIGHT" GridPane.rowIndex="3">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Player Type" GridPane.halignment="RIGHT" GridPane.rowIndex="4">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Favorite Agent" GridPane.halignment="RIGHT" GridPane.rowIndex="5">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Favorite Attacker" GridPane.halignment="RIGHT" GridPane.rowIndex="6">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Favorite Defender" GridPane.halignment="RIGHT" GridPane.rowIndex="7">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Text>
|
||||
<TextField fx:id="numberFilter" GridPane.columnIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets right="150.0" />
|
||||
</GridPane.margin>
|
||||
</TextField>
|
||||
<TextField fx:id="nameFilter" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets right="150.0" />
|
||||
</GridPane.margin>
|
||||
</TextField>
|
||||
<ChoiceBox fx:id="levelFilter" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||
<ChoiceBox fx:id="agentFilter" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
||||
<ChoiceBox fx:id="attackerFilter" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="6" />
|
||||
<ChoiceBox fx:id="defenderFilter" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="7" />
|
||||
<TextField fx:id="scoreFilter" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||
<GridPane.margin>
|
||||
<Insets right="150.0" />
|
||||
</GridPane.margin>
|
||||
</TextField>
|
||||
<RadioButton mnemonicParsing="false" text="R6" GridPane.columnIndex="1" GridPane.rowIndex="4">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="typeFilter" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton mnemonicParsing="false" text="Valorant" toggleGroup="$typeFilter" GridPane.columnIndex="1" GridPane.rowIndex="4">
|
||||
<GridPane.margin>
|
||||
<Insets left="50.0" />
|
||||
</GridPane.margin>
|
||||
</RadioButton>
|
||||
<Button mnemonicParsing="false" onAction="#filterSave" text="Save" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7">
|
||||
<GridPane.margin>
|
||||
<Insets right="15.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</VBox>
|
||||
Loading…
Reference in New Issue