diff --git a/src/main/java/io/bitsquare/gui/NavigationItem.java b/src/main/java/io/bitsquare/gui/NavigationItem.java index 520f443d44..cc3a863005 100644 --- a/src/main/java/io/bitsquare/gui/NavigationItem.java +++ b/src/main/java/io/bitsquare/gui/NavigationItem.java @@ -39,7 +39,6 @@ public enum NavigationItem { PENDING_TRADE("/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"), CLOSED_TRADE("/io/bitsquare/gui/orders/closed/ClosedTradeView.fxml"), - DEPOSIT("/io/bitsquare/gui/funds/deposit/DepositView.fxml"), WITHDRAWAL("/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"), TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"), diff --git a/src/main/java/io/bitsquare/gui/account/addpassword/PasswordCB.java b/src/main/java/io/bitsquare/gui/account/addpassword/PasswordCB.java index d8e4264460..195e55ddd7 100644 --- a/src/main/java/io/bitsquare/gui/account/addpassword/PasswordCB.java +++ b/src/main/java/io/bitsquare/gui/account/addpassword/PasswordCB.java @@ -97,6 +97,7 @@ public class PasswordCB extends CachedCodeBehind { } } + /////////////////////////////////////////////////////////////////////////////////////////// // UI handlers /////////////////////////////////////////////////////////////////////////////////////////// @@ -114,18 +115,15 @@ public class PasswordCB extends CachedCodeBehind { } @FXML - private void onOpenHelp() { - Help.openWindow(HelpId.SETUP_PASSWORD); - } - - public void onSkipped() { + private void onSkipped() { if (parentController instanceof SetupCB) ((SetupCB) parentController).onCompleted(this); } - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// + @FXML + private void onOpenHelp() { + Help.openWindow(HelpId.SETUP_PASSWORD); + } } diff --git a/src/main/java/io/bitsquare/gui/account/settings/AccountSettingsCB.java b/src/main/java/io/bitsquare/gui/account/settings/AccountSettingsCB.java index 2e31e0fe8e..35ffd754d8 100644 --- a/src/main/java/io/bitsquare/gui/account/settings/AccountSettingsCB.java +++ b/src/main/java/io/bitsquare/gui/account/settings/AccountSettingsCB.java @@ -80,7 +80,7 @@ public class AccountSettingsCB extends CachedCodeBehind { registration = new MenuItem(this, content, "Renew your account", NavigationItem.REGISTRATION, toggleGroup); - // registration.setDisable(true); + registration.setDisable(true); leftVBox.getChildren().addAll(seedWords, password, restrictions, fiatAccount, registration); @@ -151,7 +151,14 @@ class MenuItem extends ToggleButton { Label icon = new Label(); icon.setTextFill(Paint.valueOf("#999")); - AwesomeDude.setIcon(icon, AwesomeIcon.EDIT_SIGN); + if (navigationItem.equals(NavigationItem.SEED_WORDS)) + AwesomeDude.setIcon(icon, AwesomeIcon.INFO_SIGN); + else if (navigationItem.equals(NavigationItem.REGISTRATION)) + AwesomeDude.setIcon(icon, AwesomeIcon.BRIEFCASE); + else + AwesomeDude.setIcon(icon, AwesomeIcon.EDIT_SIGN); + + setGraphic(icon); setOnAction((event) -> show()); @@ -169,7 +176,7 @@ class MenuItem extends ToggleButton { disableProperty().addListener((ov, oldValue, newValue) -> { if (newValue) { setId("account-settings-item-background-disabled"); - icon.setTextFill(Paint.valueOf("#ccc")); + //icon.setTextFill(Paint.valueOf("#ccc")); } else { setId("account-settings-item-background-active"); diff --git a/src/main/java/io/bitsquare/gui/funds/FundsController.java b/src/main/java/io/bitsquare/gui/funds/FundsController.java index 85bd05a314..956825bda2 100644 --- a/src/main/java/io/bitsquare/gui/funds/FundsController.java +++ b/src/main/java/io/bitsquare/gui/funds/FundsController.java @@ -58,8 +58,7 @@ public class FundsController extends CachedViewController { public void initialize(URL url, ResourceBundle rb) { super.initialize(url, rb); - ((CachingTabPane) root).initialize( - this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(), NavigationItem.WITHDRAWAL.getFxmlUrl(), + ((CachingTabPane) root).initialize(this, persistence, NavigationItem.WITHDRAWAL.getFxmlUrl(), NavigationItem.TRANSACTIONS.getFxmlUrl()); } diff --git a/src/main/java/io/bitsquare/gui/funds/FundsView.fxml b/src/main/java/io/bitsquare/gui/funds/FundsView.fxml index d9acc082c2..1e9536afb0 100644 --- a/src/main/java/io/bitsquare/gui/funds/FundsView.fxml +++ b/src/main/java/io/bitsquare/gui/funds/FundsView.fxml @@ -24,7 +24,6 @@ AnchorPane.topAnchor="0.0" xmlns:fx="http://javafx.com/fxml"> - diff --git a/src/main/java/io/bitsquare/gui/funds/deposit/DepositController.java b/src/main/java/io/bitsquare/gui/funds/deposit/DepositController.java deleted file mode 100644 index e14f8f2371..0000000000 --- a/src/main/java/io/bitsquare/gui/funds/deposit/DepositController.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This file is part of Bitsquare. - * - * Bitsquare is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bitsquare is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bitsquare. If not, see . - */ - -package io.bitsquare.gui.funds.deposit; - -import io.bitsquare.btc.AddressEntry; -import io.bitsquare.btc.WalletFacade; -import io.bitsquare.gui.CachedViewController; - -import java.net.URL; - -import java.util.List; -import java.util.ResourceBundle; -import java.util.stream.Collectors; - -import javax.inject.Inject; - -import javafx.beans.property.ReadOnlyObjectWrapper; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.fxml.FXML; -import javafx.scene.control.*; -import javafx.scene.input.*; -import javafx.util.Callback; - -import de.jensd.fx.fontawesome.AwesomeDude; -import de.jensd.fx.fontawesome.AwesomeIcon; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -// TODO: might be removed completely -public class DepositController extends CachedViewController { - private static final Logger log = LoggerFactory.getLogger(DepositController.class); - - private final WalletFacade walletFacade; - private ObservableList addressList; - - @FXML private TableView tableView; - @FXML private TableColumn labelColumn, addressColumn, balanceColumn, copyColumn, - confidenceColumn; - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Constructor - /////////////////////////////////////////////////////////////////////////////////////////// - - @Inject - private DepositController(WalletFacade walletFacade) { - this.walletFacade = walletFacade; - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Lifecycle - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - public void initialize(URL url, ResourceBundle rb) { - super.initialize(url, rb); - - tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); - - setLabelColumnCellFactory(); - setBalanceColumnCellFactory(); - setCopyColumnCellFactory(); - setConfidenceColumnCellFactory(); - } - - @Override - public void deactivate() { - super.deactivate(); - - for (DepositListItem anAddressList : addressList) - anAddressList.cleanup(); - } - - @Override - public void activate() { - super.activate(); - - List addressEntryList = walletFacade.getAddressEntryList(); - addressList = FXCollections.observableArrayList(); - addressList.addAll(addressEntryList.stream().map(anAddressEntryList -> - new DepositListItem(anAddressEntryList, walletFacade)).collect(Collectors.toList())); - - tableView.setItems(addressList); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // UI handlers - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Private methods - /////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Cell factories - /////////////////////////////////////////////////////////////////////////////////////////// - - private void setLabelColumnCellFactory() { - labelColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue())); - labelColumn.setCellFactory(new Callback, TableCell>() { - - @Override - public TableCell call(TableColumn column) { - return new TableCell() { - - Hyperlink hyperlink; - - @Override - public void updateItem(final DepositListItem item, boolean empty) { - super.updateItem(item, empty); - - if (item != null && !empty) { - hyperlink = new Hyperlink(item.getLabel()); - hyperlink.setId("id-link"); - if (item.getAddressEntry().getOfferId() != null) { - Tooltip tooltip = new Tooltip(item.getAddressEntry().getOfferId()); - Tooltip.install(hyperlink, tooltip); - - hyperlink.setOnAction(event -> - log.info("Show trade details " + item.getAddressEntry().getOfferId())); - } - setGraphic(hyperlink); - } - else { - setGraphic(null); - setId(null); - } - } - }; - } - }); - } - - private void setBalanceColumnCellFactory() { - balanceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue())); - balanceColumn.setCellFactory( - new Callback, TableCell>() { - - @Override - public TableCell call(TableColumn column) { - return new TableCell() { - @Override - public void updateItem(final DepositListItem item, boolean empty) { - super.updateItem(item, empty); - - if (item != null && !empty) { - setGraphic(item.getBalanceLabel()); - } - else { - setGraphic(null); - } - } - }; - } - }); - } - - private void setCopyColumnCellFactory() { - copyColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue())); - copyColumn.setCellFactory( - new Callback, TableCell>() { - - @Override - public TableCell call(TableColumn column) { - return new TableCell() { - final Label copyIcon = new Label(); - - { - copyIcon.getStyleClass().add("copy-icon"); - AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); - Tooltip.install(copyIcon, new Tooltip("Copy address to clipboard")); - } - - @Override - public void updateItem(final DepositListItem item, boolean empty) { - super.updateItem(item, empty); - - if (item != null && !empty) { - setGraphic(copyIcon); - copyIcon.setOnMouseClicked(e -> { - Clipboard clipboard = Clipboard.getSystemClipboard(); - ClipboardContent content = new ClipboardContent(); - content.putString(item.addressStringProperty().get()); - clipboard.setContent(content); - }); - - } - else { - setGraphic(null); - } - } - }; - } - }); - } - - private void setConfidenceColumnCellFactory() { - confidenceColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper(addressListItem.getValue - ())); - confidenceColumn.setCellFactory(new Callback, TableCell>() { - - @Override - public TableCell call(TableColumn column) { - return new TableCell() { - - @Override - public void updateItem(final DepositListItem item, boolean empty) { - super.updateItem(item, empty); - - if (item != null && !empty) { - setGraphic(item.getProgressIndicator()); - } - else { - setGraphic(null); - } - } - }; - } - }); - } - -} - diff --git a/src/main/java/io/bitsquare/gui/funds/deposit/DepositListItem.java b/src/main/java/io/bitsquare/gui/funds/deposit/DepositListItem.java deleted file mode 100644 index 9f443f97de..0000000000 --- a/src/main/java/io/bitsquare/gui/funds/deposit/DepositListItem.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of Bitsquare. - * - * Bitsquare is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bitsquare is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bitsquare. If not, see . - */ - -package io.bitsquare.gui.funds.deposit; - -import io.bitsquare.btc.AddressEntry; -import io.bitsquare.btc.WalletFacade; -import io.bitsquare.gui.funds.withdrawal.WithdrawalListItem; - -public class DepositListItem extends WithdrawalListItem { - public DepositListItem(AddressEntry addressEntry, WalletFacade walletFacade) { - super(addressEntry, walletFacade); - } - -} diff --git a/src/main/java/io/bitsquare/gui/funds/deposit/DepositView.fxml b/src/main/java/io/bitsquare/gui/funds/deposit/DepositView.fxml deleted file mode 100644 index 98030250a2..0000000000 --- a/src/main/java/io/bitsquare/gui/funds/deposit/DepositView.fxml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/io/bitsquare/gui/home/HomeView.fxml b/src/main/java/io/bitsquare/gui/home/HomeView.fxml index b27189272c..aee5180f0d 100644 --- a/src/main/java/io/bitsquare/gui/home/HomeView.fxml +++ b/src/main/java/io/bitsquare/gui/home/HomeView.fxml @@ -19,17 +19,20 @@ - + - -