Remove deposit screen (not needed anymore as deposit are done in context)

This commit is contained in:
Manfred Karrer 2014-09-26 09:35:22 +02:00
parent a4fd70f49b
commit d207b65cc7
6 changed files with 1 additions and 328 deletions

View File

@ -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"),

View File

@ -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());
}

View File

@ -24,7 +24,6 @@
AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml">
<Tab text="Deposit" closable="false"/>
<Tab text="Withdrawal" closable="false"/>
<Tab text="Transactions" closable="false"/>

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<DepositListItem> addressList;
@FXML TableView<DepositListItem> tableView;
@FXML TableColumn<DepositListItem, DepositListItem> 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<AddressEntry> 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<TableColumn<DepositListItem, DepositListItem>,
TableCell<DepositListItem,
DepositListItem>>() {
@Override
public TableCell<DepositListItem, DepositListItem> call(TableColumn<DepositListItem,
DepositListItem> column) {
return new TableCell<DepositListItem, DepositListItem>() {
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<TableColumn<DepositListItem, DepositListItem>, TableCell<DepositListItem,
DepositListItem>>() {
@Override
public TableCell<DepositListItem, DepositListItem> call(TableColumn<DepositListItem,
DepositListItem> column) {
return new TableCell<DepositListItem, DepositListItem>() {
@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<TableColumn<DepositListItem, DepositListItem>, TableCell<DepositListItem,
DepositListItem>>() {
@Override
public TableCell<DepositListItem, DepositListItem> call(TableColumn<DepositListItem,
DepositListItem> column) {
return new TableCell<DepositListItem, DepositListItem>() {
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<TableColumn<DepositListItem, DepositListItem>,
TableCell<DepositListItem,
DepositListItem>>() {
@Override
public TableCell<DepositListItem, DepositListItem> call(TableColumn<DepositListItem,
DepositListItem> column) {
return new TableCell<DepositListItem, DepositListItem>() {
@Override
public void updateItem(final DepositListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
setGraphic(item.getProgressIndicator());
}
else {
setGraphic(null);
}
}
};
}
});
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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 <http://www.gnu.org/licenses/>.
-->
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.cell.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox fx:id="root" fx:controller="io.bitsquare.gui.main.funds.deposit.DepositController"
spacing="10" xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</padding>
<TableView fx:id="tableView" VBox.vgrow="ALWAYS">
<columns>
<TableColumn text="Label" fx:id="labelColumn" minWidth="100" sortable="false"/>
<TableColumn text="Address" fx:id="addressColumn" minWidth="240" sortable="false">
<cellValueFactory>
<PropertyValueFactory property="addressString"/>
</cellValueFactory>
</TableColumn>
<TableColumn text="Balance" fx:id="balanceColumn" minWidth="50" sortable="false"/>
<TableColumn text="Copy" fx:id="copyColumn" minWidth="30" sortable="false"/>
<TableColumn text="Status" fx:id="confidenceColumn" minWidth="30" sortable="false"/>
</columns>
</TableView>
</VBox>