diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/Exchange.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/Exchange.java index cfa3940..9c5796a 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/Exchange.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/Exchange.java @@ -208,7 +208,7 @@ public Transaction sell(final Share share, final Player player) * * @throws IllegalArgumentException if any parameter is null, or if player does not have enough shares. * */ - public List sell(final BigDecimal amount, final String stockSymbol, final Player player) + public List sell(BigDecimal amount, final String stockSymbol, final Player player) throws IllegalArgumentException { if (amount == null || player == null || !Validator.NOT_EMPTY.isValid(stockSymbol)) { throw new IllegalArgumentException("Invalid sell!"); @@ -221,7 +221,7 @@ public List sell(final BigDecimal amount, final String stockSymbol, BigDecimal totalOwned = player.getPortfolio().getTotalSharesBySymbol(stockSymbol); if (amount.compareTo(totalOwned) > 0) { - throw new IllegalArgumentException("Not enough shares!"); + amount = totalOwned; } ArrayList transactions = new ArrayList<>(); BigDecimal remainingToSell = amount; 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 2b612a0..2b05357 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 @@ -115,6 +115,7 @@ protected void initLayout() { HBox header = new HBox(20); header.setAlignment(Pos.CENTER_LEFT); + // Stock Identity (The gray pill) VBox stockIdentity = new VBox(5); selectedStockLabel = new Label("APL"); @@ -182,6 +183,10 @@ protected void initLayout() { grid.add(qtySection, 0, 0, 6,1); grid.add(tradeBtns, 0, 1, 6, 1); + HBox.setHgrow(stockIdentity, Priority.ALWAYS); + HBox.setHgrow(priceStats, Priority.ALWAYS); + HBox.setHgrow(grid, Priority.ALWAYS); + header.getChildren().addAll(stockIdentity, priceStats, grid); Region spacer = new Region();