diff options
Diffstat (limited to 'ui-fx/src')
4 files changed, 79 insertions, 0 deletions
diff --git a/ui-fx/src/main/java/market/guess/ui/desktop/AppState.java b/ui-fx/src/main/java/market/guess/ui/desktop/AppState.java index b116833..5c73e1f 100644 --- a/ui-fx/src/main/java/market/guess/ui/desktop/AppState.java +++ b/ui-fx/src/main/java/market/guess/ui/desktop/AppState.java | |||
| @@ -318,6 +318,9 @@ public final class AppState { | |||
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | UserData u = new UserData(acc.owner(), role, bal, acc.blocked(), isMm); | 320 | UserData u = new UserData(acc.owner(), role, bal, acc.blocked(), isMm); |
| 321 | if (acc.entries() != null) { | ||
| 322 | u.ledger.addAll(acc.entries()); | ||
| 323 | } | ||
| 321 | 324 | ||
| 322 | if (acc.entries() != null && !acc.entries().isEmpty()) { | 325 | if (acc.entries() != null && !acc.entries().isEmpty()) { |
| 323 | var entries = acc.entries(); | 326 | var entries = acc.entries(); |
diff --git a/ui-fx/src/main/java/market/guess/ui/desktop/controllers/UsersTabController.java b/ui-fx/src/main/java/market/guess/ui/desktop/controllers/UsersTabController.java index f5c787b..12b74e6 100644 --- a/ui-fx/src/main/java/market/guess/ui/desktop/controllers/UsersTabController.java +++ b/ui-fx/src/main/java/market/guess/ui/desktop/controllers/UsersTabController.java | |||
| @@ -7,6 +7,8 @@ import javafx.application.Platform; | |||
| 7 | import javafx.collections.ListChangeListener; | 7 | import javafx.collections.ListChangeListener; |
| 8 | import javafx.css.PseudoClass; | 8 | import javafx.css.PseudoClass; |
| 9 | import javafx.fxml.FXML; | 9 | import javafx.fxml.FXML; |
| 10 | import javafx.geometry.Insets; | ||
| 11 | import javafx.geometry.Pos; | ||
| 10 | import javafx.scene.Node; | 12 | import javafx.scene.Node; |
| 11 | import javafx.scene.chart.LineChart; | 13 | import javafx.scene.chart.LineChart; |
| 12 | import javafx.scene.chart.NumberAxis; | 14 | import javafx.scene.chart.NumberAxis; |
| @@ -15,10 +17,12 @@ import javafx.scene.control.Label; | |||
| 15 | import javafx.scene.control.ListView; | 17 | import javafx.scene.control.ListView; |
| 16 | import javafx.scene.control.TextField; | 18 | import javafx.scene.control.TextField; |
| 17 | import javafx.scene.layout.HBox; | 19 | import javafx.scene.layout.HBox; |
| 20 | import javafx.scene.layout.Priority; | ||
| 18 | import javafx.scene.layout.StackPane; | 21 | import javafx.scene.layout.StackPane; |
| 19 | import javafx.scene.layout.VBox; | 22 | import javafx.scene.layout.VBox; |
| 20 | import market.guess.model.event.EventStatus; | 23 | import market.guess.model.event.EventStatus; |
| 21 | import market.guess.model.event.MechanismType; | 24 | import market.guess.model.event.MechanismType; |
| 25 | import market.guess.model.ledger.LedgerEntryDTO; | ||
| 22 | import market.guess.ui.desktop.AppState; | 26 | import market.guess.ui.desktop.AppState; |
| 23 | import market.guess.ui.desktop.components.TradeSide; | 27 | import market.guess.ui.desktop.components.TradeSide; |
| 24 | import market.guess.ui.desktop.components.UserEventItemView; | 28 | import market.guess.ui.desktop.components.UserEventItemView; |
| @@ -65,6 +69,7 @@ public class UsersTabController { | |||
| 65 | @FXML private HBox blockedBanner; | 69 | @FXML private HBox blockedBanner; |
| 66 | @FXML private LineChart<Number, Number> balanceChart; | 70 | @FXML private LineChart<Number, Number> balanceChart; |
| 67 | @FXML private VBox participationRowsContainer; | 71 | @FXML private VBox participationRowsContainer; |
| 72 | @FXML private VBox ledgerRowsContainer; | ||
| 68 | 73 | ||
| 69 | @FXML private VBox tradePanel; | 74 | @FXML private VBox tradePanel; |
| 70 | @FXML private Label noTradeEventLabel; | 75 | @FXML private Label noTradeEventLabel; |
| @@ -252,6 +257,13 @@ public class UsersTabController { | |||
| 252 | } | 257 | } |
| 253 | participationRowsContainer.getChildren().setAll(evRows); | 258 | participationRowsContainer.getChildren().setAll(evRows); |
| 254 | 259 | ||
| 260 | // Account activity, newest first | ||
| 261 | var ledgerRows = new ArrayList<Node>(actor.ledger.size()); | ||
| 262 | for (var entry : actor.ledger.reversed()) { | ||
| 263 | ledgerRows.add(buildLedgerRow(entry)); | ||
| 264 | } | ||
| 265 | ledgerRowsContainer.getChildren().setAll(ledgerRows); | ||
| 266 | |||
| 255 | // Trade Panel | 267 | // Trade Panel |
| 256 | refreshTradePanel(actor); | 268 | refreshTradePanel(actor); |
| 257 | } | 269 | } |
| @@ -426,6 +438,40 @@ public class UsersTabController { | |||
| 426 | return valid; | 438 | return valid; |
| 427 | } | 439 | } |
| 428 | 440 | ||
| 441 | private static Node buildLedgerRow(LedgerEntryDTO entry) { | ||
| 442 | var note = ledgerCell(entry.note(), -1, "gm-text-ink"); | ||
| 443 | note.setMinWidth(0); | ||
| 444 | note.setMaxWidth(Double.MAX_VALUE); | ||
| 445 | HBox.setHgrow(note, Priority.ALWAYS); | ||
| 446 | var amount = ledgerCell(entry.amount(), 90, "gm-font-mono", "gm-text-ink"); | ||
| 447 | amount.setAlignment(Pos.CENTER_RIGHT); | ||
| 448 | var balance = ledgerCell(entry.balanceAfter(), 90, "gm-font-mono", "gm-text-ink"); | ||
| 449 | balance.setAlignment(Pos.CENTER_RIGHT); | ||
| 450 | var row = | ||
| 451 | new HBox( | ||
| 452 | 8, | ||
| 453 | ledgerCell(entry.at(), 150, "gm-font-mono", "gm-text-ink2"), | ||
| 454 | ledgerCell(entry.type().name(), 96, "gm-text-ink2"), | ||
| 455 | note, | ||
| 456 | amount, | ||
| 457 | balance); | ||
| 458 | row.setAlignment(Pos.CENTER_LEFT); | ||
| 459 | row.setPadding(new Insets(7, 11, 7, 11)); | ||
| 460 | row.getStyleClass().add("gm-divider-top"); | ||
| 461 | return row; | ||
| 462 | } | ||
| 463 | |||
| 464 | private static Label ledgerCell(String text, double width, String... styleClasses) { | ||
| 465 | var label = new Label(text); | ||
| 466 | label.getStyleClass().add("gm-text-sm"); | ||
| 467 | label.getStyleClass().addAll(styleClasses); | ||
| 468 | if (width > 0) { | ||
| 469 | label.setMinWidth(width); | ||
| 470 | label.setPrefWidth(width); | ||
| 471 | } | ||
| 472 | return label; | ||
| 473 | } | ||
| 474 | |||
| 429 | private Node buildParticipationRow(UserEventRow ev) { | 475 | private Node buildParticipationRow(UserEventRow ev) { |
| 430 | var row = new UserEventItemView(ev); | 476 | var row = new UserEventItemView(ev); |
| 431 | row.setOnMouseClicked( | 477 | row.setOnMouseClicked( |
diff --git a/ui-fx/src/main/java/market/guess/ui/desktop/model/UserData.java b/ui-fx/src/main/java/market/guess/ui/desktop/model/UserData.java index 62ad526..d6ec093 100644 --- a/ui-fx/src/main/java/market/guess/ui/desktop/model/UserData.java +++ b/ui-fx/src/main/java/market/guess/ui/desktop/model/UserData.java | |||
| @@ -3,6 +3,7 @@ package market.guess.ui.desktop.model; | |||
| 3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
| 4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
| 5 | import java.util.List; | 5 | import java.util.List; |
| 6 | import market.guess.model.ledger.LedgerEntryDTO; | ||
| 6 | 7 | ||
| 7 | public final class UserData { | 8 | public final class UserData { |
| 8 | public final String name; | 9 | public final String name; |
| @@ -17,6 +18,7 @@ public final class UserData { | |||
| 17 | public final boolean isMm; | 18 | public final boolean isMm; |
| 18 | public final List<ChartPoint> balanceHistory = new ArrayList<>(); | 19 | public final List<ChartPoint> balanceHistory = new ArrayList<>(); |
| 19 | public final List<UserEventRow> events = new ArrayList<>(); | 20 | public final List<UserEventRow> events = new ArrayList<>(); |
| 21 | public final List<LedgerEntryDTO> ledger = new ArrayList<>(); | ||
| 20 | 22 | ||
| 21 | public UserData(String name, String role, double balance, boolean blocked, boolean isMm) { | 23 | public UserData(String name, String role, double balance, boolean blocked, boolean isMm) { |
| 22 | this.name = name; | 24 | this.name = name; |
diff --git a/ui-fx/src/main/resources/market/guess/ui/desktop/controllers/users_tab.fxml b/ui-fx/src/main/resources/market/guess/ui/desktop/controllers/users_tab.fxml index abc03e5..fcb1653 100644 --- a/ui-fx/src/main/resources/market/guess/ui/desktop/controllers/users_tab.fxml +++ b/ui-fx/src/main/resources/market/guess/ui/desktop/controllers/users_tab.fxml | |||
| @@ -231,6 +231,34 @@ | |||
| 231 | </VBox> | 231 | </VBox> |
| 232 | </children> | 232 | </children> |
| 233 | </VBox> | 233 | </VBox> |
| 234 | <VBox spacing="7.0"> | ||
| 235 | <children> | ||
| 236 | <HBox alignment="CENTER_LEFT"> | ||
| 237 | <children> | ||
| 238 | <Label styleClass="gm-text-base, gm-font-semibold, gm-text-ink" text="Account activity" /> | ||
| 239 | <Region HBox.hgrow="ALWAYS" /> | ||
| 240 | <Label styleClass="gm-text-sm, gm-font-regular, gm-text-ink2" text="newest first" /> | ||
| 241 | </children> | ||
| 242 | </HBox> | ||
| 243 | <VBox styleClass="gm-card-panel"> | ||
| 244 | <children> | ||
| 245 | <HBox alignment="CENTER_LEFT" spacing="8.0" styleClass="gm-bg-panel3"> | ||
| 246 | <padding> | ||
| 247 | <Insets bottom="8.0" left="11.0" right="11.0" top="8.0" /> | ||
| 248 | </padding> | ||
| 249 | <children> | ||
| 250 | <Label minWidth="150.0" prefWidth="150.0" styleClass="gm-text-xs, gm-font-semibold, gm-text-ink2, gm-font-mono" text="Time" /> | ||
| 251 | <Label minWidth="96.0" prefWidth="96.0" styleClass="gm-text-xs, gm-font-semibold, gm-text-ink2, gm-font-mono" text="Type" /> | ||
| 252 | <Label maxWidth="1.7976931348623157E308" minWidth="0.0" styleClass="gm-text-xs, gm-font-semibold, gm-text-ink2, gm-font-mono" text="Details" textOverrun="ELLIPSIS" HBox.hgrow="ALWAYS" /> | ||
| 253 | <Label alignment="CENTER_RIGHT" minWidth="90.0" prefWidth="90.0" styleClass="gm-text-xs, gm-font-semibold, gm-text-ink2, gm-font-mono" text="Amount" /> | ||
| 254 | <Label alignment="CENTER_RIGHT" minWidth="90.0" prefWidth="90.0" styleClass="gm-text-xs, gm-font-semibold, gm-text-ink2, gm-font-mono" text="Balance" /> | ||
| 255 | </children> | ||
| 256 | </HBox> | ||
| 257 | <VBox fx:id="ledgerRowsContainer" /> | ||
| 258 | </children> | ||
| 259 | </VBox> | ||
| 260 | </children> | ||
| 261 | </VBox> | ||
| 234 | </children> | 262 | </children> |
| 235 | </VBox> | 263 | </VBox> |
| 236 | </content> | 264 | </content> |