Skip to content

Commit

Permalink
Feat; Added sidebar elements
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyah committed May 15, 2026
1 parent f4ed619 commit 7c421e1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<HBox, DashBoardActions> {
private LineChart<Number, Number> chart;
private XYChart.Series<Number, Number> 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;
Expand All @@ -50,14 +50,22 @@ protected void initLayout() {
getRootPane().setAlignment(Pos.TOP_LEFT);
getRootPane().setFillHeight(true);

completeSideBar = new VBox(10);
sideBarSearchField = new TextField();
sideBarSearchField.setPromptText("Search...");
List<String> timeSelectionOptions;
ComboBox<List<String>> timeDropDownMenu = new ComboBox<>();

sidebar = new VBox(10);
sidebar.setPrefWidth(150);
sidebar.setMaxHeight(Double.MAX_VALUE);
sidebar.setMinWidth(150);
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);
Expand Down Expand Up @@ -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);
Expand All @@ -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");
Expand Down
21 changes: 20 additions & 1 deletion src/main/resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -303,6 +311,7 @@
-fx-scale-x: 1.05;
-fx-scale-y: 1.05;
}

.qtyBtn {
-fx-background-color: rgba(140, 140, 140, 0.6);

Expand Down Expand Up @@ -335,4 +344,14 @@
-fx-min-height: 30;
-fx-pref-height: 45;
-fx-max-height: 60;
}
}

.scroll-pane {
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-padding: 0;
}

.scroll-pane > .viewport {
-fx-background-color: transparent;
}

0 comments on commit 7c421e1

Please sign in to comment.