Fix broken navigation link

This commit is contained in:
Manfred Karrer 2014-09-08 21:34:06 +02:00
parent 05525e3558
commit 9644cb3eda
14 changed files with 50 additions and 367 deletions

View File

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

View File

@ -97,6 +97,7 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
}
}
///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
@ -114,18 +115,15 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
}
@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);
}
}

View File

@ -80,7 +80,7 @@ public class AccountSettingsCB extends CachedCodeBehind<AccountSettingsPM> {
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"));
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");

View File

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

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,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 <http://www.gnu.org/licenses/>.
*/
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<DepositListItem> addressList;
@FXML private TableView<DepositListItem> tableView;
@FXML private TableColumn<String, 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<String, DepositListItem>, TableCell<String,
DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, 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<String, DepositListItem>, TableCell<String, DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, 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<String, DepositListItem>, TableCell<String, DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, 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<String, DepositListItem>, TableCell<String,
DepositListItem>>() {
@Override
public TableCell<String, DepositListItem> call(TableColumn<String, DepositListItem> column) {
return new TableCell<String, 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.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);
}
}

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.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>

View File

@ -19,11 +19,13 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.home.HomeController"
AnchorPane.bottomAnchor="30" AnchorPane.leftAnchor="10" AnchorPane.rightAnchor="10"
AnchorPane.topAnchor="10"
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.home.HomeController"
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
xmlns:fx="http://javafx.com/fxml">
<Tab text="TODO" closable="false">
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<Label id="headline-label" text="Overview"/>
@ -32,4 +34,5 @@
<Button text="Register yourself as an arbitrator" onAction="#onArbitratorRegistration"/>
<Button text="Edit my arbitrator details" onAction="#onArbitratorEdit"/>
</VBox>
</AnchorPane>
</Tab>
</TabPane>

View File

@ -19,13 +19,13 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.msg.MsgController"
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.msg.MsgController"
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
xmlns:fx="http://javafx.com/fxml">
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<Label id="headline-label" text="Message"/>
<Tab text="TODO" closable="false">
</VBox>
</AnchorPane>
</Tab>
</TabPane>

View File

@ -223,8 +223,8 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
// Navigation
///////////////////////////////////////////////////////////////////////////////////////////
private void openSettings() {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.SETTINGS);
private void openAccountSettings() {
MainController.GET_INSTANCE().loadViewAndGetChildController(NavigationItem.ACCOUNT);
}
private void close() {
@ -438,17 +438,17 @@ public class CreateOfferCB extends CachedCodeBehind<CreateOfferPM> {
acceptedCountriesLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedCountriesLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedCountriesLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedCountriesLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedCountriesLabelIcon.setOnMouseClicked(e -> openAccountSettings());
acceptedLanguagesLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedLanguagesLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedLanguagesLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedLanguagesLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedLanguagesLabelIcon.setOnMouseClicked(e -> openAccountSettings());
acceptedArbitratorsLabelIcon.setId("clickable-icon");
AwesomeDude.setIcon(acceptedArbitratorsLabelIcon, AwesomeIcon.EDIT_SIGN);
Tooltip.install(acceptedArbitratorsLabelIcon, new Tooltip(BSResources.get("shared.openSettings")));
acceptedArbitratorsLabelIcon.setOnMouseClicked(e -> openSettings());
acceptedArbitratorsLabelIcon.setOnMouseClicked(e -> openAccountSettings());
}
private void setupTotalToPayInfoIconLabel() {

View File

@ -17,15 +17,10 @@
package io.bitsquare.gui.util;
import java.awt.*;
import javafx.scene.image.Image;
import javafx.scene.image.*;
public class ImageUtil {
public static final String hiRes = Toolkit.getDefaultToolkit().getScreenResolution() >= 144 ? "_hi_res" : "";
public static final String SPLASH_LOGO = "/images/logo_600_600.png";
public static final String SYS_TRAY = "/images/system_tray_icon_44_32.png";
@ -63,11 +58,10 @@ public class ImageUtil {
public static final String INFO = "/images/info.png";
public static Image getIconImage(String iconName) {
return new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images", "/images" + hiRes)));
return new Image(ImageUtil.class.getResourceAsStream(iconName));
}
public static ImageView getIconImageView(String iconName) {
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images",
"/images" + hiRes))));
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName)));
}
}

View File

@ -404,7 +404,7 @@ public class MessageFacade implements MessageBroker {
// Check dirty flag for a location key
///////////////////////////////////////////////////////////////////////////////////////////
// TODO just temp...
// TODO just temporary
public BooleanProperty getIsDirtyProperty() {
return isDirty;
}

View File

@ -62,7 +62,8 @@ createOffer.advancedBox.title=Advanced settings
createOffer.advancedBox.countries=Accepted countries:
createOffer.advancedBox.languages=Accepted languages:
createOffer.advancedBox.arbitrators=Accepted arbitrators:
createOffer.advancedBox.txType=Payments method: createOffer.advancedBox.currency=Currency:
createOffer.advancedBox.txType=Payments method:
createOffer.advancedBox.currency=Currency:
createOffer.advancedBox.county=Payments account country:
createOffer.advancedBox.info=Your trading partners must fulfill your offer restrictions. You can edit the accepted countries, languages and arbitrators in the settings. The payments account details are used from your current selected payments account (if you have multiple payments accounts).