From 2d1ac40c725c508f293248b9cd0e7de002670762 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Tue, 11 Dec 2018 15:47:19 +0100 Subject: [PATCH] Move token label and buy button to ThumbOverviewTab --- client/src/main/java/ctbrec/ui/SiteTab.java | 24 +------------------ .../main/java/ctbrec/ui/ThumbOverviewTab.java | 12 ++++++++-- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/client/src/main/java/ctbrec/ui/SiteTab.java b/client/src/main/java/ctbrec/ui/SiteTab.java index 04afc41f..1b0fc0b1 100644 --- a/client/src/main/java/ctbrec/ui/SiteTab.java +++ b/client/src/main/java/ctbrec/ui/SiteTab.java @@ -1,40 +1,18 @@ package ctbrec.ui; import ctbrec.sites.Site; -import javafx.geometry.Insets; -import javafx.geometry.Pos; import javafx.scene.Scene; -import javafx.scene.control.Button; import javafx.scene.control.Tab; -import javafx.scene.layout.BorderPane; -import javafx.scene.layout.HBox; public class SiteTab extends Tab implements TabSelectionListener { - private BorderPane rootPane = new BorderPane(); - private HBox tokenPanel; private SiteTabPane siteTabPane; public SiteTab(Site site, Scene scene) { super(site.getName()); - setClosable(false); - setContent(rootPane); siteTabPane = new SiteTabPane(site, scene); - rootPane.setCenter(siteTabPane); - - if (site.supportsTips() && site.credentialsAvailable()) { - Button buyTokens = new Button("Buy Tokens"); - buyTokens.setOnAction((e) -> DesktopIntegration.open(site.getBuyTokensLink())); - TokenLabel tokenBalance = new TokenLabel(site); - tokenPanel = new HBox(5, tokenBalance, buyTokens); - tokenPanel.setAlignment(Pos.BASELINE_RIGHT); - rootPane.setTop(tokenPanel); - // HBox.setMargin(tokenBalance, new Insets(0, 5, 0, 0)); - // HBox.setMargin(buyTokens, new Insets(0, 5, 0, 0)); - tokenBalance.loadBalance(); - BorderPane.setMargin(tokenPanel, new Insets(5, 10, 0, 10)); - } + setContent(siteTabPane); } @Override diff --git a/client/src/main/java/ctbrec/ui/ThumbOverviewTab.java b/client/src/main/java/ctbrec/ui/ThumbOverviewTab.java index 5e5ec52a..f1d01ece 100644 --- a/client/src/main/java/ctbrec/ui/ThumbOverviewTab.java +++ b/client/src/main/java/ctbrec/ui/ThumbOverviewTab.java @@ -143,7 +143,6 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener { + "Try \"1080\" or \">720\" or \"public\""); filterInput.setTooltip(filterTooltip); filterInput.getStyleClass().remove("search-box-icon"); - BorderPane.setMargin(filterInput, new Insets(5)); SearchBox searchInput = new SearchBox(); searchInput.setPromptText("Search Model"); @@ -154,7 +153,6 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener { popover.hide(); } }); - BorderPane.setMargin(searchInput, new Insets(5)); popover = new SearchPopover(); popover.maxWidthProperty().bind(popover.minWidthProperty()); @@ -170,9 +168,19 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener { HBox topBar = new HBox(5); HBox.setHgrow(filterInput, Priority.ALWAYS); topBar.getChildren().add(filterInput); + if (site.supportsTips() && site.credentialsAvailable()) { + Button buyTokens = new Button("Buy Tokens"); + buyTokens.setOnAction((e) -> DesktopIntegration.open(site.getBuyTokensLink())); + TokenLabel tokenBalance = new TokenLabel(site); + tokenBalance.setAlignment(Pos.CENTER_RIGHT); + tokenBalance.prefHeightProperty().bind(buyTokens.heightProperty()); + topBar.getChildren().addAll(tokenBalance, buyTokens); + tokenBalance.loadBalance(); + } if(site.supportsSearch()) { topBar.getChildren().add(searchInput); } + BorderPane.setMargin(topBar, new Insets(0, 5, 0, 5)); scrollPane.setContent(grid); scrollPane.setFitToHeight(true);