diff --git a/lib/javafx-jmods-21/javafx.base.jmod b/lib/javafx-jmods-21/javafx.base.jmod new file mode 100644 index 0000000..a094400 Binary files /dev/null and b/lib/javafx-jmods-21/javafx.base.jmod differ diff --git a/lib/javafx-jmods-21/javafx.controls.jmod b/lib/javafx-jmods-21/javafx.controls.jmod new file mode 100644 index 0000000..333189a Binary files /dev/null and b/lib/javafx-jmods-21/javafx.controls.jmod differ diff --git a/lib/javafx-jmods-21/javafx.fxml.jmod b/lib/javafx-jmods-21/javafx.fxml.jmod new file mode 100644 index 0000000..4a661a2 Binary files /dev/null and b/lib/javafx-jmods-21/javafx.fxml.jmod differ diff --git a/lib/javafx-jmods-21/javafx.graphics.jmod b/lib/javafx-jmods-21/javafx.graphics.jmod new file mode 100644 index 0000000..e5d2d59 Binary files /dev/null and b/lib/javafx-jmods-21/javafx.graphics.jmod differ diff --git a/lib/javafx-jmods-21/javafx.media.jmod b/lib/javafx-jmods-21/javafx.media.jmod new file mode 100644 index 0000000..aaa69f1 Binary files /dev/null and b/lib/javafx-jmods-21/javafx.media.jmod differ diff --git a/lib/javafx-jmods-21/javafx.swing.jmod b/lib/javafx-jmods-21/javafx.swing.jmod new file mode 100644 index 0000000..7976984 Binary files /dev/null and b/lib/javafx-jmods-21/javafx.swing.jmod differ diff --git a/lib/javafx-jmods-21/javafx.web.jmod b/lib/javafx-jmods-21/javafx.web.jmod new file mode 100644 index 0000000..ff9b1ec Binary files /dev/null and b/lib/javafx-jmods-21/javafx.web.jmod differ diff --git a/src/main/java/com/gtohelper/datafetcher/controllers/HandAnalysisController.java b/src/main/java/com/gtohelper/datafetcher/controllers/HandAnalysisController.java index 8ab9f17..adae541 100644 --- a/src/main/java/com/gtohelper/datafetcher/controllers/HandAnalysisController.java +++ b/src/main/java/com/gtohelper/datafetcher/controllers/HandAnalysisController.java @@ -8,8 +8,8 @@ import com.gtohelper.utility.Popups; import com.gtohelper.utility.SaveFileHelper; import javafx.application.Platform; -import javafx.beans.property.ReadOnlyObjectWrapper; -import javafx.beans.property.SimpleStringProperty; +import javafx.beans.binding.Bindings; +import javafx.beans.property.*; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; @@ -42,9 +42,9 @@ public class HandAnalysisController { ObservableList sessionTableItems = FXCollections.observableArrayList(); @FXML TableColumn sessionTableDateColumn; @FXML TableColumn sessionTableLengthColumn; - @FXML TableColumn sessionTableFlopsColumn; - @FXML TableColumn sessionTableHandsColumn; - @FXML TableColumn sessionTableMoneyColumn; + @FXML TableColumn sessionTableFlopsColumn; + @FXML TableColumn sessionTableHandsColumn; + @FXML TableColumn sessionTableMoneyColumn; /* Position v position tab controls. @@ -62,9 +62,9 @@ public class HandAnalysisController { TableView tournamentTable; ObservableList tournamentTableItems = FXCollections.observableArrayList(); @FXML TableColumn tournamentTableDateColumn; - @FXML TableColumn tournamentTableHandsColumn; - @FXML TableColumn tournamentTablePlayersColumn; - @FXML TableColumn tournamentTableBuyinColumn; + @FXML TableColumn tournamentTableHandsColumn; + @FXML TableColumn tournamentTablePlayersColumn; + @FXML TableColumn tournamentTableBuyinColumn; /* Hand table controls @@ -73,7 +73,7 @@ public class HandAnalysisController { TableView handsTable; ObservableList handsTableItems = FXCollections.observableArrayList(); @FXML TableColumn handsTableDateColumn; - @FXML TableColumn handsTableCWonColumn; + @FXML TableColumn handsTableCWonColumn; @FXML TableColumn handsTableHandColumn; @FXML TableColumn handsTableBoardColumn; @@ -197,8 +197,21 @@ private void initializeControls() { handsTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); handsTable.getSelectionModel().selectedItemProperty().addListener((options, oldValue, newValue) -> updateSolveButtonDisabledState()); handsTableDateColumn.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().date_played.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); - handsTableCWonColumn.setCellValueFactory(p -> new SimpleStringProperty("" + p.getValue().amt_pot)); + handsTableCWonColumn.setCellValueFactory(p -> new SimpleDoubleProperty(p.getValue().amt_pot).asObject()); + handsTableCWonColumn.setCellFactory(col -> new TableCell() { + @Override + protected void updateItem(Double item, boolean empty) { + super.updateItem(item, empty); + if (empty || item == null) { + setText(null); + } else { + // Format the Double value with two decimal places + setText(String.format("%.2f", item)); + } + } + }); handsTableHandColumn.setCellValueFactory(p -> new ReadOnlyObjectWrapper(new Hand(p.getValue().getHandDataForPlayer(player.id_player)))); + handsTableHandColumn.setSortable(false); handsTableHandColumn.setCellFactory(new Callback<>() { @Override public TableCell call(TableColumn param) { @@ -217,6 +230,7 @@ public void updateItem(Hand hand, boolean empty) { } }); handsTableBoardColumn.setCellValueFactory(p -> new ReadOnlyObjectWrapper(new Board(p.getValue()))); + handsTableBoardColumn.setSortable(false); handsTableBoardColumn.setCellFactory(new Callback<>() { @Override public TableCell call(TableColumn param) { @@ -277,9 +291,21 @@ private void initializeSessionAndTagControls() { sessionTable.getSortOrder().add(sessionTableDateColumn); sessionTableDateColumn.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().getMinSessionStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); sessionTableDateColumn.setSortType(TableColumn.SortType.DESCENDING); - sessionTableHandsColumn.setCellValueFactory(p -> new SimpleStringProperty(String.valueOf(p.getValue().getHandCount()))); - sessionTableFlopsColumn.setCellValueFactory(p -> new SimpleStringProperty(String.valueOf(p.getValue().getFlopsCount()))); - sessionTableMoneyColumn.setCellValueFactory(p -> new SimpleStringProperty(new BigDecimal(p.getValue().getAmountWon()).setScale(2, RoundingMode.HALF_UP).toString())); + sessionTableHandsColumn.setCellValueFactory(p -> new SimpleIntegerProperty(p.getValue().getHandCount()).asObject()); + sessionTableFlopsColumn.setCellValueFactory(p -> new SimpleIntegerProperty(p.getValue().getFlopsCount()).asObject()); + sessionTableMoneyColumn.setCellValueFactory(p -> new SimpleDoubleProperty(p.getValue().getAmountWon()).asObject()); + sessionTableMoneyColumn.setCellFactory(col -> new TableCell() { + @Override + protected void updateItem(Double item, boolean empty) { + super.updateItem(item, empty); + if (empty || item == null) { + setText(null); + } else { + // Format the Double value with two decimal places + setText(String.format("%.2f", item)); + } + } + }); sessionTableLengthColumn.setCellValueFactory(p -> new SimpleStringProperty( // No elegant way to display this apparently. Use this weird Stack Overflow suggestion. String.format("%d:%02d", @@ -376,9 +402,22 @@ private void initializeTournamentControls() { // Ideally, these should have accessors tournamentTableDateColumn.setCellValueFactory(p -> new SimpleStringProperty(p.getValue().date_start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); tournamentTableDateColumn.setSortType(TableColumn.SortType.DESCENDING); - tournamentTableHandsColumn.setCellValueFactory(p -> new SimpleStringProperty(String.valueOf(p.getValue().cnt_hands))); - tournamentTablePlayersColumn.setCellValueFactory(p -> new SimpleStringProperty(String.valueOf(p.getValue().cnt_players))); - tournamentTableBuyinColumn.setCellValueFactory(p -> new SimpleStringProperty(new BigDecimal(p.getValue().amt_buyin).setScale(2, RoundingMode.HALF_UP).toString())); + tournamentTableHandsColumn.setCellValueFactory(p -> new SimpleIntegerProperty(p.getValue().cnt_hands).asObject()); + tournamentTablePlayersColumn.setCellValueFactory(p -> new SimpleIntegerProperty(p.getValue().cnt_players).asObject()); + tournamentTableBuyinColumn.setCellValueFactory(p -> new SimpleDoubleProperty(p.getValue().amt_buyin).asObject()); + + tournamentTableBuyinColumn.setCellFactory(col -> new TableCell() { + @Override + protected void updateItem(Double item, boolean empty) { + super.updateItem(item, empty); + if (empty || item == null) { + setText(null); + } else { + // Format the Double value with two decimal places + setText(String.format("%.2f", item)); + } + } + }); tournamentTable.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { getTournamentHands(); diff --git a/src/main/java/com/gtohelper/utility/CardResolver.java b/src/main/java/com/gtohelper/utility/CardResolver.java index 33ea786..29ea08c 100644 --- a/src/main/java/com/gtohelper/utility/CardResolver.java +++ b/src/main/java/com/gtohelper/utility/CardResolver.java @@ -94,7 +94,7 @@ public static String getHandStringForPlayer(Player p, HandData data) { } public static String getHandString(HandData.PlayerHandData playerHand) { - if(playerHand != null) + if(playerHand != null && playerHand.holecard_1 != 0 & playerHand.holecard_2 != 0) return resolveToString(playerHand.holecard_1) + " " + resolveToString(playerHand.holecard_2); else return ""; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..fadbd5b --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,10 @@ +module com.gtohelper { + requires java.base; + requires java.sql; + requires java.desktop; + requires javafx.base; + requires javafx.fxml; + requires javafx.controls; + + exports com.gtohelper; +}