diff --git a/src/main/java/io/bitsquare/gui/Navigation.java b/src/main/java/io/bitsquare/gui/Navigation.java index 57fe029f38..4ee0c88be5 100644 --- a/src/main/java/io/bitsquare/gui/Navigation.java +++ b/src/main/java/io/bitsquare/gui/Navigation.java @@ -180,7 +180,6 @@ public class Navigation { CLOSED_TRADES("/io/bitsquare/gui/main/orders/closed/ClosedTradesView.fxml"), // funds - DEPOSIT("/io/bitsquare/gui/main/funds/deposit/DepositView.fxml"), WITHDRAWAL("/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.fxml"), TRANSACTIONS("/io/bitsquare/gui/main/funds/transactions/TransactionsView.fxml"), diff --git a/src/main/java/io/bitsquare/gui/main/funds/FundsController.java b/src/main/java/io/bitsquare/gui/main/funds/FundsController.java index 1956b90a6b..3921f1de24 100644 --- a/src/main/java/io/bitsquare/gui/main/funds/FundsController.java +++ b/src/main/java/io/bitsquare/gui/main/funds/FundsController.java @@ -59,7 +59,7 @@ public class FundsController extends CachedViewController { super.initialize(url, rb); ((CachingTabPane) root).initialize( - this, persistence, Navigation.Item.DEPOSIT.getFxmlUrl(), Navigation.Item.WITHDRAWAL.getFxmlUrl(), + this, persistence, Navigation.Item.WITHDRAWAL.getFxmlUrl(), Navigation.Item.TRANSACTIONS.getFxmlUrl()); } diff --git a/src/main/java/io/bitsquare/gui/main/funds/FundsView.fxml b/src/main/java/io/bitsquare/gui/main/funds/FundsView.fxml index daf8bffcb8..67ee6c8fff 100644 --- a/src/main/java/io/bitsquare/gui/main/funds/FundsView.fxml +++ b/src/main/java/io/bitsquare/gui/main/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/main/funds/deposit/DepositController.java b/src/main/java/io/bitsquare/gui/main/funds/deposit/DepositController.java deleted file mode 100644 index 2f32fd9310..0000000000 --- a/src/main/java/io/bitsquare/gui/main/funds/deposit/DepositController.java +++ /dev/null @@ -1,254 +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.main.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 TableView tableView; - @FXML 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/main/funds/deposit/DepositListItem.java b/src/main/java/io/bitsquare/gui/main/funds/deposit/DepositListItem.java deleted file mode 100644 index a01b8755bc..0000000000 --- a/src/main/java/io/bitsquare/gui/main/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.main.funds.deposit; - -import io.bitsquare.btc.AddressEntry; -import io.bitsquare.btc.WalletFacade; -import io.bitsquare.gui.main.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/main/funds/deposit/DepositView.fxml b/src/main/java/io/bitsquare/gui/main/funds/deposit/DepositView.fxml deleted file mode 100644 index 21116fe20d..0000000000 --- a/src/main/java/io/bitsquare/gui/main/funds/deposit/DepositView.fxml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -