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"), PENDING_TRADE("/io/bitsquare/gui/orders/pending/PendingTradeView.fxml"),
CLOSED_TRADE("/io/bitsquare/gui/orders/closed/ClosedTradeView.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"), WITHDRAWAL("/io/bitsquare/gui/funds/withdrawal/WithdrawalView.fxml"),
TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"), TRANSACTIONS("/io/bitsquare/gui/funds/transactions/TransactionsView.fxml"),

View File

@ -97,6 +97,7 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers // UI handlers
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -114,18 +115,15 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
} }
@FXML @FXML
private void onOpenHelp() { private void onSkipped() {
Help.openWindow(HelpId.SETUP_PASSWORD);
}
public void onSkipped() {
if (parentController instanceof SetupCB) if (parentController instanceof SetupCB)
((SetupCB) parentController).onCompleted(this); ((SetupCB) parentController).onCompleted(this);
} }
/////////////////////////////////////////////////////////////////////////////////////////// @FXML
// Private methods 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", registration = new MenuItem(this, content, "Renew your account",
NavigationItem.REGISTRATION, toggleGroup); NavigationItem.REGISTRATION, toggleGroup);
// registration.setDisable(true); registration.setDisable(true);
leftVBox.getChildren().addAll(seedWords, password, leftVBox.getChildren().addAll(seedWords, password,
restrictions, fiatAccount, registration); restrictions, fiatAccount, registration);
@ -151,7 +151,14 @@ class MenuItem extends ToggleButton {
Label icon = new Label(); Label icon = new Label();
icon.setTextFill(Paint.valueOf("#999")); 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); setGraphic(icon);
setOnAction((event) -> show()); setOnAction((event) -> show());
@ -169,7 +176,7 @@ class MenuItem extends ToggleButton {
disableProperty().addListener((ov, oldValue, newValue) -> { disableProperty().addListener((ov, oldValue, newValue) -> {
if (newValue) { if (newValue) {
setId("account-settings-item-background-disabled"); setId("account-settings-item-background-disabled");
icon.setTextFill(Paint.valueOf("#ccc")); //icon.setTextFill(Paint.valueOf("#ccc"));
} }
else { else {
setId("account-settings-item-background-active"); setId("account-settings-item-background-active");

View File

@ -58,8 +58,7 @@ public class FundsController extends CachedViewController {
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
super.initialize(url, rb); super.initialize(url, rb);
((CachingTabPane) root).initialize( ((CachingTabPane) root).initialize(this, persistence, NavigationItem.WITHDRAWAL.getFxmlUrl(),
this, persistence, NavigationItem.DEPOSIT.getFxmlUrl(), NavigationItem.WITHDRAWAL.getFxmlUrl(),
NavigationItem.TRANSACTIONS.getFxmlUrl()); NavigationItem.TRANSACTIONS.getFxmlUrl());
} }

View File

@ -24,7 +24,6 @@
AnchorPane.topAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<Tab text="Deposit" closable="false"/>
<Tab text="Withdrawal" closable="false"/> <Tab text="Withdrawal" closable="false"/>
<Tab text="Transactions" 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,17 +19,20 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.home.HomeController" <TabPane fx:id="root" fx:controller="io.bitsquare.gui.home.HomeController"
AnchorPane.bottomAnchor="30" AnchorPane.leftAnchor="10" AnchorPane.rightAnchor="10" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.topAnchor="10" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" <Tab text="TODO" closable="false">
AnchorPane.topAnchor="0.0">
<Label id="headline-label" text="Overview"/>
<Label text="TODO"/>
<Button text="Register yourself as an arbitrator" onAction="#onArbitratorRegistration"/> <VBox spacing="20" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
<Button text="Edit my arbitrator details" onAction="#onArbitratorEdit"/> AnchorPane.topAnchor="0.0">
</VBox> <Label id="headline-label" text="Overview"/>
</AnchorPane> <Label text="TODO"/>
<Button text="Register yourself as an arbitrator" onAction="#onArbitratorRegistration"/>
<Button text="Edit my arbitrator details" onAction="#onArbitratorEdit"/>
</VBox>
</Tab>
</TabPane>

View File

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

View File

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

View File

@ -17,15 +17,10 @@
package io.bitsquare.gui.util; package io.bitsquare.gui.util;
import java.awt.*;
import javafx.scene.image.Image;
import javafx.scene.image.*; import javafx.scene.image.*;
public class ImageUtil { 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 SPLASH_LOGO = "/images/logo_600_600.png";
public static final String SYS_TRAY = "/images/system_tray_icon_44_32.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 final String INFO = "/images/info.png";
public static Image getIconImage(String iconName) { 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) { public static ImageView getIconImageView(String iconName) {
return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName.replace("/images", return new ImageView(new Image(ImageUtil.class.getResourceAsStream(iconName)));
"/images" + hiRes))));
} }
} }

View File

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

View File

@ -62,7 +62,8 @@ createOffer.advancedBox.title=Advanced settings
createOffer.advancedBox.countries=Accepted countries: createOffer.advancedBox.countries=Accepted countries:
createOffer.advancedBox.languages=Accepted languages: createOffer.advancedBox.languages=Accepted languages:
createOffer.advancedBox.arbitrators=Accepted arbitrators: 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.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). 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).