From 7c421e1966d780a23fe06f48de6017c5d803c31d Mon Sep 17 00:00:00 2001 From: = Date: Fri, 15 May 2026 13:04:53 +0200 Subject: [PATCH] Feat; Added sidebar elements --- .../view/widgets/dashboard/DashBoardView.java | 21 +++++++++++++------ src/main/resources/styles.css | 21 ++++++++++++++++++- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/dashboard/DashBoardView.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/dashboard/DashBoardView.java index 2b05357..948d91a 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/dashboard/DashBoardView.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/widgets/dashboard/DashBoardView.java @@ -11,22 +11,22 @@ import edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.financialsummary.SummaryView; import javafx.geometry.HPos; import javafx.geometry.Insets; +import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.chart.LineChart; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.ScrollPane; -import javafx.scene.control.TextField; +import javafx.scene.control.*; import javafx.scene.layout.*; public class DashBoardView extends ViewElement { private LineChart chart; private XYChart.Series dataSeries; private VBox sidebar; + private VBox completeSideBar; private Stock selectedStock; private float ownedStocks = 0; + private TextField sideBarSearchField; private Label selectedStockLabel; private Label stockFullNameLabel; private Label ownedQuantityLabel; @@ -50,6 +50,12 @@ protected void initLayout() { getRootPane().setAlignment(Pos.TOP_LEFT); getRootPane().setFillHeight(true); + completeSideBar = new VBox(10); + sideBarSearchField = new TextField(); + sideBarSearchField.setPromptText("Search..."); + List timeSelectionOptions; + ComboBox> timeDropDownMenu = new ComboBox<>(); + sidebar = new VBox(10); sidebar.setPrefWidth(150); sidebar.setMaxHeight(Double.MAX_VALUE); @@ -57,7 +63,9 @@ protected void initLayout() { VBox.setVgrow(sidebar, Priority.ALWAYS); ScrollPane scrollPane = new ScrollPane(sidebar); + Separator separator = new Separator(); + completeSideBar.getChildren().addAll(sideBarSearchField, separator, scrollPane, timeDropDownMenu); scrollPane.setFitToWidth(true); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); @@ -195,7 +203,7 @@ protected void initLayout() { VBox.setVgrow(chart, Priority.ALWAYS); mainContent.getChildren().addAll(header, chart); - getRootPane().getChildren().addAll(scrollPane, mainContent); + getRootPane().getChildren().addAll(completeSideBar, mainContent); registerButton(DashBoardActions.BUY_SHARES, buyBtn); registerButton(DashBoardActions.SELL_SHARES, sellBtn); @@ -215,7 +223,8 @@ private ColumnConstraints makeCol(final float w) { @Override protected void initStyling() { - sidebar.getStyleClass().add("market-sidebar"); + completeSideBar.getStyleClass().add("market-sidebar"); + sidebar.getStyleClass().add("market-sidebar2"); selectedStockLabel.getStyleClass().add("selected-stock-pill"); selectedStockPriceLabel.getStyleClass().add("selected-stock-pill"); shareQuantityInputField.getStyleClass().add("qtyTextField"); diff --git a/src/main/resources/styles.css b/src/main/resources/styles.css index d3d5875..de4e2d4 100644 --- a/src/main/resources/styles.css +++ b/src/main/resources/styles.css @@ -236,6 +236,14 @@ /* --------------- IN GAME VIEW ------------- */ .market-sidebar { + -fx-border-color: #000000; + -fx-border-width: 0 2 0 0; + -fx-border-style: solid; + + -fx-padding: 20; +} + +.market-sidebar2 { -fx-padding: 20; } @@ -303,6 +311,7 @@ -fx-scale-x: 1.05; -fx-scale-y: 1.05; } + .qtyBtn { -fx-background-color: rgba(140, 140, 140, 0.6); @@ -335,4 +344,14 @@ -fx-min-height: 30; -fx-pref-height: 45; -fx-max-height: 60; -} \ No newline at end of file +} + +.scroll-pane { + -fx-background-color: transparent; + -fx-border-color: transparent; + -fx-padding: 0; +} + +.scroll-pane > .viewport { + -fx-background-color: transparent; +}