Rename orders to portfolio, orderbook to offerbook

This commit is contained in:
Manfred Karrer 2014-10-25 01:18:38 +02:00
parent 5094b2de4a
commit 68387eb13d
40 changed files with 173 additions and 171 deletions

View file

@ -159,7 +159,7 @@ public class Navigation {
HOME("/io/bitsquare/gui/main/home/HomeView.fxml"), HOME("/io/bitsquare/gui/main/home/HomeView.fxml"),
BUY("/io/bitsquare/gui/main/trade/BuyView.fxml"), BUY("/io/bitsquare/gui/main/trade/BuyView.fxml"),
SELL("/io/bitsquare/gui/main/trade/SellView.fxml"), SELL("/io/bitsquare/gui/main/trade/SellView.fxml"),
ORDERS("/io/bitsquare/gui/main/orders/OrdersView.fxml"), PORTFOLIO("/io/bitsquare/gui/main/portfolio/PortfolioView.fxml"),
FUNDS("/io/bitsquare/gui/main/funds/FundsView.fxml"), FUNDS("/io/bitsquare/gui/main/funds/FundsView.fxml"),
MSG("/io/bitsquare/gui/main/msg/MsgView.fxml"), MSG("/io/bitsquare/gui/main/msg/MsgView.fxml"),
SETTINGS("/io/bitsquare/gui/main/settings/SettingsView.fxml"), SETTINGS("/io/bitsquare/gui/main/settings/SettingsView.fxml"),
@ -171,14 +171,14 @@ public class Navigation {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// buy/sell (trade) // buy/sell (trade)
ORDER_BOOK("/io/bitsquare/gui/main/trade/orderbook/OrderBookView.fxml"), OFFER_BOOK("/io/bitsquare/gui/main/trade/offerbook/OfferBookView.fxml"),
CREATE_OFFER("/io/bitsquare/gui/main/trade/createoffer/CreateOfferView.fxml"), CREATE_OFFER("/io/bitsquare/gui/main/trade/createoffer/CreateOfferView.fxml"),
TAKE_OFFER("/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.fxml"), TAKE_OFFER("/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.fxml"),
// orders // portfolio
OFFERS("/io/bitsquare/gui/main/orders/offer/OffersView.fxml"), OFFERS("/io/bitsquare/gui/main/portfolio/offer/OffersView.fxml"),
PENDING_TRADES("/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml"), PENDING_TRADES("/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.fxml"),
CLOSED_TRADES("/io/bitsquare/gui/main/orders/closed/ClosedTradesView.fxml"), CLOSED_TRADES("/io/bitsquare/gui/main/portfolio/closed/ClosedTradesView.fxml"),
// funds // funds
WITHDRAWAL("/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.fxml"), WITHDRAWAL("/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.fxml"),

View file

@ -68,11 +68,11 @@
-fx-image: url("../../../images/nav/sell_active.png"); -fx-image: url("../../../images/nav/sell_active.png");
} }
#image-nav-orders { #image-nav-portfolio {
-fx-image: url("../../../images/nav/orders.png"); -fx-image: url("../../../images/nav/portfolio.png");
} }
#image-nav-orders-active { #image-nav-portfolio-active {
-fx-image: url("../../../images/nav/orders_active.png"); -fx-image: url("../../../images/nav/portfolio_active.png");
} }
#image-nav-funds { #image-nav-funds {

View file

@ -256,7 +256,7 @@ public class MainViewCB extends ViewCB<MainPM> {
case MSG: case MSG:
msgButton.setSelected(true); msgButton.setSelected(true);
break; break;
case ORDERS: case PORTFOLIO:
ordersButton.setSelected(true); ordersButton.setSelected(true);
break; break;
case SETTINGS: case SETTINGS:
@ -337,7 +337,7 @@ public class MainViewCB extends ViewCB<MainPM> {
sellButton = addNavButton(leftNavPane, "Sell BTC", Navigation.Item.SELL); sellButton = addNavButton(leftNavPane, "Sell BTC", Navigation.Item.SELL);
ordersButtonButtonPane = new Pane(); ordersButtonButtonPane = new Pane();
ordersButton = addNavButton(ordersButtonButtonPane, "Portfolio", Navigation.Item.ORDERS); ordersButton = addNavButton(ordersButtonButtonPane, "Portfolio", Navigation.Item.PORTFOLIO);
leftNavPane.getChildren().add(ordersButtonButtonPane); leftNavPane.getChildren().add(ordersButtonButtonPane);
fundsButton = addNavButton(leftNavPane, "Funds", Navigation.Item.FUNDS); fundsButton = addNavButton(leftNavPane, "Funds", Navigation.Item.FUNDS);

View file

@ -19,7 +19,7 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.main.orders.OrdersViewCB" <TabPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.PortfolioViewCB"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0" AnchorPane.topAnchor="0.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders; package io.bitsquare.gui.main.portfolio;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation; import io.bitsquare.gui.Navigation;
@ -40,8 +40,8 @@ import javafx.scene.control.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class OrdersViewCB extends CachedViewCB { public class PortfolioViewCB extends CachedViewCB {
private static final Logger log = LoggerFactory.getLogger(OrdersViewCB.class); private static final Logger log = LoggerFactory.getLogger(PortfolioViewCB.class);
private final Navigation navigation; private final Navigation navigation;
private final TradeManager tradeManager; private final TradeManager tradeManager;
@ -57,7 +57,7 @@ public class OrdersViewCB extends CachedViewCB {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
OrdersViewCB(Navigation navigation, TradeManager tradeManager) { PortfolioViewCB(Navigation navigation, TradeManager tradeManager) {
super(); super();
this.navigation = navigation; this.navigation = navigation;
@ -73,17 +73,18 @@ public class OrdersViewCB extends CachedViewCB {
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
navigationListener = navigationItems -> { navigationListener = navigationItems -> {
if (navigationItems != null && navigationItems.length == 3 if (navigationItems != null && navigationItems.length == 3
&& navigationItems[1] == Navigation.Item.ORDERS) && navigationItems[1] == Navigation.Item.PORTFOLIO)
loadView(navigationItems[2]); loadView(navigationItems[2]);
}; };
tabChangeListener = (ov, oldValue, newValue) -> { tabChangeListener = (ov, oldValue, newValue) -> {
if (newValue == offersTab) if (newValue == offersTab)
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.OFFERS); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO, Navigation.Item.OFFERS);
else if (newValue == pendingTradesTab) else if (newValue == pendingTradesTab)
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.PENDING_TRADES); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO,
Navigation.Item.PENDING_TRADES);
else if (newValue == closedTradesTab) else if (newValue == closedTradesTab)
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.CLOSED_TRADES); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO, Navigation.Item.CLOSED_TRADES);
}; };
super.initialize(url, rb); super.initialize(url, rb);
@ -97,9 +98,9 @@ public class OrdersViewCB extends CachedViewCB {
navigation.addListener(navigationListener); navigation.addListener(navigationListener);
if (tradeManager.getPendingTrades().size() == 0) if (tradeManager.getPendingTrades().size() == 0)
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.OFFERS); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO, Navigation.Item.OFFERS);
else else
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.PENDING_TRADES); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO, Navigation.Item.PENDING_TRADES);
} }
@Override @Override

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.closed; package io.bitsquare.gui.main.portfolio.closed;
import io.bitsquare.trade.Trade; import io.bitsquare.trade.Trade;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.closed; package io.bitsquare.gui.main.portfolio.closed;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
import io.bitsquare.trade.Direction; import io.bitsquare.trade.Direction;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.closed; package io.bitsquare.gui.main.portfolio.closed;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.BSFormatter;

View file

@ -21,7 +21,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.orders.closed.ClosedTradesViewCB" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.closed.ClosedTradesViewCB"
hgap="5.0" vgap="5" hgap="5.0" vgap="5"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<padding> <padding>

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.closed; package io.bitsquare.gui.main.portfolio.closed;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.offer; package io.bitsquare.gui.main.portfolio.offer;
import io.bitsquare.trade.Offer; import io.bitsquare.trade.Offer;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.offer; package io.bitsquare.gui.main.portfolio.offer;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
import io.bitsquare.trade.Direction; import io.bitsquare.trade.Direction;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.offer; package io.bitsquare.gui.main.portfolio.offer;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.BSFormatter;

View file

@ -21,7 +21,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.orders.offer.OffersViewCB" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.offer.OffersViewCB"
hgap="5.0" vgap="5" hgap="5.0" vgap="5"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<padding> <padding>

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.offer; package io.bitsquare.gui.main.portfolio.offer;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending; package io.bitsquare.gui.main.portfolio.pending;
import io.bitsquare.trade.Trade; import io.bitsquare.trade.Trade;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending; package io.bitsquare.gui.main.portfolio.pending;
import io.bitsquare.btc.AddressEntry; import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.FeePolicy; import io.bitsquare.btc.FeePolicy;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending; package io.bitsquare.gui.main.portfolio.pending;
import io.bitsquare.btc.WalletFacade; import io.bitsquare.btc.WalletFacade;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;

View file

@ -27,7 +27,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?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.main.orders.pending.PendingTradesViewCB" <AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.pending.PendingTradesViewCB"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<ScrollPane fx:id="scrollPane" fitToWidth="true" fitToHeight="true" <ScrollPane fx:id="scrollPane" fitToWidth="true" fitToHeight="true"

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending; package io.bitsquare.gui.main.portfolio.pending;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation; import io.bitsquare.gui.Navigation;
@ -208,7 +208,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
presentationModel.removePendingTrade(); presentationModel.removePendingTrade();
presentationModel.withdraw(withdrawAddressTextField.getText()); presentationModel.withdraw(withdrawAddressTextField.getText());
Platform.runLater(() -> Platform.runLater(() ->
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.CLOSED_TRADES)); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO,
Navigation.Item.CLOSED_TRADES));
} }
@FXML @FXML

View file

@ -21,7 +21,7 @@ import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation; import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.main.trade.createoffer.CreateOfferViewCB; import io.bitsquare.gui.main.trade.createoffer.CreateOfferViewCB;
import io.bitsquare.gui.main.trade.orderbook.OrderBookViewCB; import io.bitsquare.gui.main.trade.offerbook.OfferBookViewCB;
import io.bitsquare.gui.main.trade.takeoffer.TakeOfferViewCB; import io.bitsquare.gui.main.trade.takeoffer.TakeOfferViewCB;
import io.bitsquare.trade.Direction; import io.bitsquare.trade.Direction;
import io.bitsquare.trade.Offer; import io.bitsquare.trade.Offer;
@ -50,7 +50,7 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
private static final Logger log = LoggerFactory.getLogger(TradeViewCB.class); private static final Logger log = LoggerFactory.getLogger(TradeViewCB.class);
// private final OrderBookInfo orderBookInfo = new OrderBookInfo(); // private final OrderBookInfo orderBookInfo = new OrderBookInfo();
private OrderBookViewCB orderBookViewCB; private OfferBookViewCB orderBookViewCB;
private CreateOfferViewCB createOfferViewCB; private CreateOfferViewCB createOfferViewCB;
private TakeOfferViewCB takeOfferViewCB; private TakeOfferViewCB takeOfferViewCB;
private Node createOfferView; private Node createOfferView;
@ -118,7 +118,7 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
}); });
navigation.addListener(listener); navigation.addListener(listener);
navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.ORDER_BOOK); navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.OFFER_BOOK);
} }
@SuppressWarnings("EmptyMethod") @SuppressWarnings("EmptyMethod")
@ -166,7 +166,7 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
protected Initializable loadView(Navigation.Item navigationItem) { protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem); super.loadView(navigationItem);
TabPane tabPane = (TabPane) root; TabPane tabPane = (TabPane) root;
if (navigationItem == Navigation.Item.ORDER_BOOK && orderBookViewCB == null) { if (navigationItem == Navigation.Item.OFFER_BOOK && orderBookViewCB == null) {
// Orderbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens. // Orderbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
ViewLoader orderBookLoader = ViewLoader orderBookLoader =
new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false); new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
@ -244,14 +244,14 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
orderBookViewCB.enableCreateOfferButton(); orderBookViewCB.enableCreateOfferButton();
// update the navigation state // update the navigation state
navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.ORDER_BOOK); navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.OFFER_BOOK);
} }
private void onTakeOfferViewRemoved() { private void onTakeOfferViewRemoved() {
takeOfferViewCB = null; takeOfferViewCB = null;
// update the navigation state // update the navigation state
navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.ORDER_BOOK); navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.OFFER_BOOK);
} }
} }

View file

@ -277,7 +277,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
TabPane tabPane = ((TabPane) (root.getParent().getParent())); TabPane tabPane = ((TabPane) (root.getParent().getParent()));
tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem()); tabPane.getTabs().remove(tabPane.getSelectionModel().getSelectedItem());
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, Navigation.Item.OFFERS); navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO, Navigation.Item.OFFERS);
} }

View file

@ -15,13 +15,13 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.trade.orderbook; package io.bitsquare.gui.main.trade.offerbook;
import io.bitsquare.bank.BankAccount; import io.bitsquare.bank.BankAccount;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import io.bitsquare.locale.CurrencyUtil; import io.bitsquare.locale.CurrencyUtil;
import io.bitsquare.msg.MessageFacade; import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.OrderBookListener; import io.bitsquare.msg.listeners.OfferBookListener;
import io.bitsquare.trade.Offer; import io.bitsquare.trade.Offer;
import io.bitsquare.user.User; import io.bitsquare.user.User;
import io.bitsquare.util.Utilities; import io.bitsquare.util.Utilities;
@ -47,15 +47,15 @@ import static com.google.common.base.Preconditions.checkArgument;
* It also use OrderBookListener as the lists items class and we don't want to get any dependency out of the package * It also use OrderBookListener as the lists items class and we don't want to get any dependency out of the package
* for that. * for that.
*/ */
public class OrderBook { public class OfferBook {
private static final Logger log = LoggerFactory.getLogger(OrderBook.class); private static final Logger log = LoggerFactory.getLogger(OfferBook.class);
private final MessageFacade messageFacade; private final MessageFacade messageFacade;
private final User user; private final User user;
private final ObservableList<OrderBookListItem> orderBookListItems = FXCollections.observableArrayList(); private final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
private final OrderBookListener orderBookListener; private final OfferBookListener offerBookListener;
private final ChangeListener<BankAccount> bankAccountChangeListener; private final ChangeListener<BankAccount> bankAccountChangeListener;
private final ChangeListener<Number> invalidationListener; private final ChangeListener<Number> invalidationListener;
private String fiatCode; private String fiatCode;
@ -69,14 +69,14 @@ public class OrderBook {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
OrderBook(MessageFacade messageFacade, User user) { OfferBook(MessageFacade messageFacade, User user) {
this.messageFacade = messageFacade; this.messageFacade = messageFacade;
this.user = user; this.user = user;
bankAccountChangeListener = (observableValue, oldValue, newValue) -> setBankAccount(newValue); bankAccountChangeListener = (observableValue, oldValue, newValue) -> setBankAccount(newValue);
invalidationListener = (ov, oldValue, newValue) -> requestOffers(); invalidationListener = (ov, oldValue, newValue) -> requestOffers();
orderBookListener = new OrderBookListener() { offerBookListener = new OfferBookListener() {
@Override @Override
public void onOfferAdded(Offer offer) { public void onOfferAdded(Offer offer) {
addOfferToOrderBookListItems(offer); addOfferToOrderBookListItems(offer);
@ -85,13 +85,13 @@ public class OrderBook {
@Override @Override
public void onOffersReceived(List<Offer> offers) { public void onOffersReceived(List<Offer> offers) {
//TODO use deltas instead replacing the whole list //TODO use deltas instead replacing the whole list
orderBookListItems.clear(); offerBookListItems.clear();
offers.stream().forEach(e -> addOfferToOrderBookListItems(e)); offers.stream().forEach(e -> addOfferToOrderBookListItems(e));
} }
@Override @Override
public void onOfferRemoved(Offer offer) { public void onOfferRemoved(Offer offer) {
orderBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId())); offerBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId()));
} }
}; };
} }
@ -119,8 +119,8 @@ public class OrderBook {
// Getter // Getter
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
ObservableList<OrderBookListItem> getOrderBookListItems() { ObservableList<OfferBookListItem> getOfferBookListItems() {
return orderBookListItems; return offerBookListItems;
} }
@ -133,7 +133,7 @@ public class OrderBook {
if (bankAccount != null) { if (bankAccount != null) {
country = bankAccount.getCountry(); country = bankAccount.getCountry();
fiatCode = bankAccount.getCurrency().getCurrencyCode(); fiatCode = bankAccount.getCurrency().getCurrencyCode();
orderBookListItems.stream().forEach(e -> e.setBankAccountCountry(country)); offerBookListItems.stream().forEach(e -> e.setBankAccountCountry(country));
} }
else { else {
fiatCode = CurrencyUtil.getDefaultCurrency().getCurrencyCode(); fiatCode = CurrencyUtil.getDefaultCurrency().getCurrencyCode();
@ -143,20 +143,20 @@ public class OrderBook {
private void addListeners() { private void addListeners() {
log.debug("addListeners "); log.debug("addListeners ");
user.currentBankAccountProperty().addListener(bankAccountChangeListener); user.currentBankAccountProperty().addListener(bankAccountChangeListener);
messageFacade.addOrderBookListener(orderBookListener); messageFacade.addOrderBookListener(offerBookListener);
messageFacade.invalidationTimestampProperty().addListener(invalidationListener); messageFacade.invalidationTimestampProperty().addListener(invalidationListener);
} }
private void removeListeners() { private void removeListeners() {
log.debug("removeListeners "); log.debug("removeListeners ");
user.currentBankAccountProperty().removeListener(bankAccountChangeListener); user.currentBankAccountProperty().removeListener(bankAccountChangeListener);
messageFacade.removeOrderBookListener(orderBookListener); messageFacade.removeOrderBookListener(offerBookListener);
messageFacade.invalidationTimestampProperty().removeListener(invalidationListener); messageFacade.invalidationTimestampProperty().removeListener(invalidationListener);
} }
private void addOfferToOrderBookListItems(Offer offer) { private void addOfferToOrderBookListItems(Offer offer) {
if (offer != null) { if (offer != null) {
orderBookListItems.add(new OrderBookListItem(offer, country)); offerBookListItems.add(new OfferBookListItem(offer, country));
} }
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.trade.orderbook; package io.bitsquare.gui.main.trade.offerbook;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import io.bitsquare.trade.Offer; import io.bitsquare.trade.Offer;
@ -23,7 +23,7 @@ import io.bitsquare.trade.Offer;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
public class OrderBookListItem { public class OfferBookListItem {
private final Offer offer; private final Offer offer;
private final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>(); private final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
@ -32,7 +32,7 @@ public class OrderBookListItem {
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public OrderBookListItem(Offer offer, Country bankAccountCountry) { public OfferBookListItem(Offer offer, Country bankAccountCountry) {
this.offer = offer; this.offer = offer;
setBankAccountCountry(bankAccountCountry); setBankAccountCountry(bankAccountCountry);
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.trade.orderbook; package io.bitsquare.gui.main.trade.offerbook;
import io.bitsquare.bank.BankAccount; import io.bitsquare.bank.BankAccount;
import io.bitsquare.gui.UIModel; import io.bitsquare.gui.UIModel;
@ -51,17 +51,17 @@ import org.slf4j.LoggerFactory;
/** /**
* It holds the scope specific domain data for either a buy or sell UI screen. * It holds the scope specific domain data for either a buy or sell UI screen.
*/ */
class OrderBookModel extends UIModel { class OfferBookModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(OrderBookModel.class); private static final Logger log = LoggerFactory.getLogger(OfferBookModel.class);
private final User user; private final User user;
private final OrderBook orderBook; private final OfferBook orderBook;
private final Settings settings; private final Settings settings;
private BSFormatter formatter; private BSFormatter formatter;
private final TradeManager tradeManager; private final TradeManager tradeManager;
private final FilteredList<OrderBookListItem> filteredItems; private final FilteredList<OfferBookListItem> filteredItems;
private final SortedList<OrderBookListItem> sortedItems; private final SortedList<OfferBookListItem> sortedItems;
// private OrderBookInfo orderBookInfo; // private OrderBookInfo orderBookInfo;
private ChangeListener<BankAccount> bankAccountChangeListener; private ChangeListener<BankAccount> bankAccountChangeListener;
@ -73,7 +73,7 @@ class OrderBookModel extends UIModel {
final StringProperty fiatCode = new SimpleStringProperty(); final StringProperty fiatCode = new SimpleStringProperty();
final StringProperty btcCode = new SimpleStringProperty(); final StringProperty btcCode = new SimpleStringProperty();
final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>(); final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
final ObjectProperty<Comparator<OrderBookListItem>> comparator = new SimpleObjectProperty<>(); final ObjectProperty<Comparator<OfferBookListItem>> comparator = new SimpleObjectProperty<>();
private Direction direction; private Direction direction;
@ -82,9 +82,9 @@ class OrderBookModel extends UIModel {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
OrderBookModel(User user, OfferBookModel(User user,
TradeManager tradeManager, TradeManager tradeManager,
OrderBook orderBook, OfferBook orderBook,
Settings settings, Settings settings,
BSFormatter formatter) { BSFormatter formatter) {
this.tradeManager = tradeManager; this.tradeManager = tradeManager;
@ -93,7 +93,7 @@ class OrderBookModel extends UIModel {
this.settings = settings; this.settings = settings;
this.formatter = formatter; this.formatter = formatter;
filteredItems = new FilteredList<>(orderBook.getOrderBookListItems()); filteredItems = new FilteredList<>(orderBook.getOfferBookListItems());
sortedItems = new SortedList<>(filteredItems); sortedItems = new SortedList<>(filteredItems);
} }
@ -238,7 +238,7 @@ class OrderBookModel extends UIModel {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
SortedList<OrderBookListItem> getOfferList() { SortedList<OfferBookListItem> getOfferList() {
return sortedItems; return sortedItems;
} }

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.trade.orderbook; package io.bitsquare.gui.main.trade.offerbook;
import io.bitsquare.gui.PresentationModel; import io.bitsquare.gui.PresentationModel;
import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.BSFormatter;
@ -38,8 +38,8 @@ import javafx.collections.transformation.SortedList;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
class OrderBookPM extends PresentationModel<OrderBookModel> { class OfferBookPM extends PresentationModel<OfferBookModel> {
private static final Logger log = LoggerFactory.getLogger(OrderBookPM.class); private static final Logger log = LoggerFactory.getLogger(OfferBookPM.class);
private final OptionalBtcValidator optionalBtcValidator; private final OptionalBtcValidator optionalBtcValidator;
private BSFormatter formatter; private BSFormatter formatter;
@ -58,7 +58,7 @@ class OrderBookPM extends PresentationModel<OrderBookModel> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
OrderBookPM(OrderBookModel model, OfferBookPM(OfferBookModel model,
OptionalFiatValidator optionalFiatValidator, OptionalFiatValidator optionalFiatValidator,
OptionalBtcValidator optionalBtcValidator, OptionalBtcValidator optionalBtcValidator,
BSFormatter formatter) { BSFormatter formatter) {
@ -161,7 +161,7 @@ class OrderBookPM extends PresentationModel<OrderBookModel> {
// Getters // Getters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
SortedList<OrderBookListItem> getOfferList() { SortedList<OfferBookListItem> getOfferList() {
return model.getOfferList(); return model.getOfferList();
} }
@ -185,21 +185,21 @@ class OrderBookPM extends PresentationModel<OrderBookModel> {
return model.isMyOffer(offer); return model.isMyOffer(offer);
} }
String getAmount(OrderBookListItem item) { String getAmount(OfferBookListItem item) {
return (item != null) ? formatter.formatCoin(item.getOffer().getAmount()) + return (item != null) ? formatter.formatCoin(item.getOffer().getAmount()) +
" (" + formatter.formatCoin(item.getOffer().getMinAmount()) + ")" : ""; " (" + formatter.formatCoin(item.getOffer().getMinAmount()) + ")" : "";
} }
String getPrice(OrderBookListItem item) { String getPrice(OfferBookListItem item) {
return (item != null) ? formatter.formatFiat(item.getOffer().getPrice()) : ""; return (item != null) ? formatter.formatFiat(item.getOffer().getPrice()) : "";
} }
String getVolume(OrderBookListItem item) { String getVolume(OfferBookListItem item) {
return (item != null) ? formatter.formatFiat(item.getOffer().getOfferVolume()) + return (item != null) ? formatter.formatFiat(item.getOffer().getOfferVolume()) +
" (" + formatter.formatFiat(item.getOffer().getMinOfferVolume()) + ")" : ""; " (" + formatter.formatFiat(item.getOffer().getMinOfferVolume()) + ")" : "";
} }
String getBankAccountType(OrderBookListItem item) { String getBankAccountType(OfferBookListItem item) {
return (item != null) ? BSResources.get(item.getOffer().getBankAccountType().toString()) : ""; return (item != null) ? BSResources.get(item.getOffer().getBankAccountType().toString()) : "";
} }

View file

@ -24,7 +24,7 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?> <?import javafx.scene.text.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.trade.orderbook.OrderBookViewCB" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.trade.offerbook.OfferBookViewCB"
hgap="5.0" vgap="0" hgap="5.0" vgap="0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<padding> <padding>

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.trade.orderbook; package io.bitsquare.gui.main.trade.offerbook;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.Navigation; import io.bitsquare.gui.Navigation;
@ -62,8 +62,8 @@ import static javafx.beans.binding.Bindings.createStringBinding;
* TODO: The advanced filters are not impl. yet * TODO: The advanced filters are not impl. yet
* The restrictions handling is open from the concept and is only implemented for countries yet. * The restrictions handling is open from the concept and is only implemented for countries yet.
*/ */
public class OrderBookViewCB extends CachedViewCB<OrderBookPM> { public class OfferBookViewCB extends CachedViewCB<OfferBookPM> {
private static final Logger log = LoggerFactory.getLogger(OrderBookViewCB.class); private static final Logger log = LoggerFactory.getLogger(OfferBookViewCB.class);
private final Navigation navigation; private final Navigation navigation;
private final OverlayManager overlayManager; private final OverlayManager overlayManager;
@ -80,9 +80,9 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
@FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel, @FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel,
volumeFiatLabel, extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel; volumeFiatLabel, extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel;
@FXML InputTextField volumeTextField, amountTextField, priceTextField; @FXML InputTextField volumeTextField, amountTextField, priceTextField;
@FXML TableView<OrderBookListItem> table; @FXML TableView<OfferBookListItem> table;
@FXML Button createOfferButton, showAdvancedSettingsButton, openCountryFilterButton, openPaymentMethodsFilterButton; @FXML Button createOfferButton, showAdvancedSettingsButton, openCountryFilterButton, openPaymentMethodsFilterButton;
@FXML TableColumn<OrderBookListItem, OrderBookListItem> priceColumn, amountColumn, volumeColumn, @FXML TableColumn<OfferBookListItem, OfferBookListItem> priceColumn, amountColumn, volumeColumn,
directionColumn, countryColumn, bankAccountTypeColumn; directionColumn, countryColumn, bankAccountTypeColumn;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -90,7 +90,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@Inject @Inject
OrderBookViewCB(OrderBookPM presentationModel, OfferBookViewCB(OfferBookPM presentationModel,
Navigation navigation, Navigation navigation,
OverlayManager overlayManager, OverlayManager overlayManager,
OptionalBtcValidator optionalBtcValidator, OptionalBtcValidator optionalBtcValidator,
@ -144,7 +144,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
super.activate(); super.activate();
// setOrderBookInfo has been called before // setOrderBookInfo has been called before
SortedList<OrderBookListItem> offerList = presentationModel.getOfferList(); SortedList<OfferBookListItem> offerList = presentationModel.getOfferList();
table.setItems(offerList); table.setItems(offerList);
offerList.comparatorProperty().bind(table.comparatorProperty()); offerList.comparatorProperty().bind(table.comparatorProperty());
priceColumn.setSortType((presentationModel.getDirection() == Direction.BUY) ? priceColumn.setSortType((presentationModel.getDirection() == Direction.BUY) ?
@ -388,14 +388,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void setAmountColumnCellFactory() { private void setAmountColumnCellFactory() {
amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
amountColumn.setCellFactory( amountColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
@Override @Override
public void updateItem(final OrderBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
setText(presentationModel.getAmount(item)); setText(presentationModel.getAmount(item));
} }
@ -407,14 +407,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void setPriceColumnCellFactory() { private void setPriceColumnCellFactory() {
priceColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); priceColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
priceColumn.setCellFactory( priceColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
@Override @Override
public void updateItem(final OrderBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
setText(presentationModel.getPrice(item)); setText(presentationModel.getPrice(item));
} }
@ -426,14 +426,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void setVolumeColumnCellFactory() { private void setVolumeColumnCellFactory() {
volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
volumeColumn.setCellFactory( volumeColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
@Override @Override
public void updateItem(final OrderBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
setText(presentationModel.getVolume(item)); setText(presentationModel.getVolume(item));
} }
@ -445,13 +445,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void setDirectionColumnCellFactory() { private void setDirectionColumnCellFactory() {
directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
directionColumn.setCellFactory( directionColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
final ImageView iconView = new ImageView(); final ImageView iconView = new ImageView();
final Button button = new Button(); final Button button = new Button();
@ -460,7 +460,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
button.setMinWidth(70); button.setMinWidth(70);
} }
private void verifyIfTradable(final OrderBookListItem item) { private void verifyIfTradable(final OfferBookListItem item) {
boolean isMatchingRestrictions = presentationModel.isTradable(item boolean isMatchingRestrictions = presentationModel.isTradable(item
.getOffer()); .getOffer());
button.setDisable(!isMatchingRestrictions); button.setDisable(!isMatchingRestrictions);
@ -488,7 +488,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
} }
@Override @Override
public void updateItem(final OrderBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null) { if (item != null) {
@ -529,13 +529,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void setCountryColumnCellFactory() { private void setCountryColumnCellFactory() {
countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
countryColumn.setCellFactory( countryColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
final HBox hBox = new HBox(); final HBox hBox = new HBox();
{ {
@ -545,13 +545,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
} }
@Override @Override
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) { public void updateItem(final OfferBookListItem offerBookListItem, boolean empty) {
super.updateItem(orderBookListItem, empty); super.updateItem(offerBookListItem, empty);
hBox.getChildren().clear(); hBox.getChildren().clear();
if (orderBookListItem != null) { if (offerBookListItem != null) {
Country country = orderBookListItem.getOffer().getBankAccountCountry(); Country country = offerBookListItem.getOffer().getBankAccountCountry();
hBox.getChildren().add(ImageUtil.getCountryIconImageView(orderBookListItem hBox.getChildren().add(ImageUtil.getCountryIconImageView(offerBookListItem
.getOffer().getBankAccountCountry())); .getOffer().getBankAccountCountry()));
Tooltip.install(this, new Tooltip(country.getName())); Tooltip.install(this, new Tooltip(country.getName()));
} }
@ -564,16 +564,16 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void setBankAccountTypeColumnCellFactory() { private void setBankAccountTypeColumnCellFactory() {
bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
bankAccountTypeColumn.setCellFactory( bankAccountTypeColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
@Override @Override
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) { public void updateItem(final OfferBookListItem offerBookListItem, boolean empty) {
super.updateItem(orderBookListItem, empty); super.updateItem(offerBookListItem, empty);
setText(presentationModel.getBankAccountType(orderBookListItem)); setText(presentationModel.getBankAccountType(offerBookListItem));
} }
}; };
} }

View file

@ -340,7 +340,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
getProperties().put("type", "CLOSE"); getProperties().put("type", "CLOSE");
try { try {
close(); close();
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS, navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO,
Navigation.Item.PENDING_TRADES); Navigation.Item.PENDING_TRADES);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -23,7 +23,7 @@ import io.bitsquare.msg.listeners.ArbitratorListener;
import io.bitsquare.msg.listeners.BootstrapListener; import io.bitsquare.msg.listeners.BootstrapListener;
import io.bitsquare.msg.listeners.GetPeerAddressListener; import io.bitsquare.msg.listeners.GetPeerAddressListener;
import io.bitsquare.msg.listeners.IncomingTradeMessageListener; import io.bitsquare.msg.listeners.IncomingTradeMessageListener;
import io.bitsquare.msg.listeners.OrderBookListener; import io.bitsquare.msg.listeners.OfferBookListener;
import io.bitsquare.msg.listeners.OutgoingTradeMessageListener; import io.bitsquare.msg.listeners.OutgoingTradeMessageListener;
import io.bitsquare.trade.Offer; import io.bitsquare.trade.Offer;
import io.bitsquare.trade.protocol.trade.TradeMessage; import io.bitsquare.trade.protocol.trade.TradeMessage;
@ -82,7 +82,7 @@ public class MessageFacade implements MessageBroker {
private final P2PNode p2pNode; private final P2PNode p2pNode;
private final User user; private final User user;
private final List<OrderBookListener> orderBookListeners = new ArrayList<>(); private final List<OfferBookListener> offerBookListeners = new ArrayList<>();
private final List<ArbitratorListener> arbitratorListeners = new ArrayList<>(); private final List<ArbitratorListener> arbitratorListeners = new ArrayList<>();
private final List<IncomingTradeMessageListener> incomingTradeMessageListeners = new ArrayList<>(); private final List<IncomingTradeMessageListener> incomingTradeMessageListeners = new ArrayList<>();
private final LongProperty invalidationTimestamp = new SimpleLongProperty(0); private final LongProperty invalidationTimestamp = new SimpleLongProperty(0);
@ -173,7 +173,7 @@ public class MessageFacade implements MessageBroker {
if (future.isSuccess()) { if (future.isSuccess()) {
Platform.runLater(() -> { Platform.runLater(() -> {
addOfferListener.onComplete(); addOfferListener.onComplete();
orderBookListeners.stream().forEach(listener -> { offerBookListeners.stream().forEach(listener -> {
try { try {
Object offerDataObject = offerData.object(); Object offerDataObject = offerData.object();
if (offerDataObject instanceof Offer) { if (offerDataObject instanceof Offer) {
@ -231,7 +231,7 @@ public class MessageFacade implements MessageBroker {
public void operationComplete(BaseFuture future) throws Exception { public void operationComplete(BaseFuture future) throws Exception {
if (future.isSuccess()) { if (future.isSuccess()) {
Platform.runLater(() -> { Platform.runLater(() -> {
orderBookListeners.stream().forEach(orderBookListener -> { offerBookListeners.stream().forEach(orderBookListener -> {
try { try {
Object offerDataObject = offerData.object(); Object offerDataObject = offerData.object();
if (offerDataObject instanceof Offer) { if (offerDataObject instanceof Offer) {
@ -287,7 +287,7 @@ public class MessageFacade implements MessageBroker {
} }
} }
Platform.runLater(() -> orderBookListeners.stream().forEach(listener -> Platform.runLater(() -> offerBookListeners.stream().forEach(listener ->
listener.onOffersReceived(offers))); listener.onOffersReceived(offers)));
} }
@ -298,7 +298,7 @@ public class MessageFacade implements MessageBroker {
final Map<Number640, Data> dataMap = futureGet.dataMap(); final Map<Number640, Data> dataMap = futureGet.dataMap();
if (dataMap == null || dataMap.size() == 0) { if (dataMap == null || dataMap.size() == 0) {
log.trace("Get offers from DHT delivered empty dataMap."); log.trace("Get offers from DHT delivered empty dataMap.");
Platform.runLater(() -> orderBookListeners.stream().forEach(listener -> Platform.runLater(() -> offerBookListeners.stream().forEach(listener ->
listener.onOffersReceived(new ArrayList<>()))); listener.onOffersReceived(new ArrayList<>())));
} }
else { else {
@ -447,12 +447,12 @@ public class MessageFacade implements MessageBroker {
// Event Listeners // Event Listeners
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void addOrderBookListener(OrderBookListener listener) { public void addOrderBookListener(OfferBookListener listener) {
orderBookListeners.add(listener); offerBookListeners.add(listener);
} }
public void removeOrderBookListener(OrderBookListener listener) { public void removeOrderBookListener(OfferBookListener listener) {
orderBookListeners.remove(listener); offerBookListeners.remove(listener);
} }
public void addArbitratorListener(ArbitratorListener listener) { public void addArbitratorListener(ArbitratorListener listener) {

View file

@ -21,7 +21,7 @@ import io.bitsquare.trade.Offer;
import java.util.List; import java.util.List;
public interface OrderBookListener { public interface OfferBookListener {
void onOfferAdded(Offer offer); void onOfferAdded(Offer offer);
void onOffersReceived(List<Offer> offers); void onOffersReceived(List<Offer> offers);

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 906 B

After

Width:  |  Height:  |  Size: 906 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 730 B

Before After
Before After

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending; package io.bitsquare.gui.main.portfolio.pending;
import io.bitsquare.di.BitSquareModule; import io.bitsquare.di.BitSquareModule;
import io.bitsquare.util.ViewLoader; import io.bitsquare.util.ViewLoader;
@ -68,7 +68,7 @@ public class PendingTradesUIRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
ViewLoader loader = new ViewLoader( ViewLoader loader = new ViewLoader(
getUrl("/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml"), false); getUrl("/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.fxml"), false);
try { try {
view = loader.load(); view = loader.load();

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending.uimock; package io.bitsquare.gui.main.portfolio.pending.uimock;
import io.bitsquare.gui.CachedViewCB; import io.bitsquare.gui.CachedViewCB;
import io.bitsquare.gui.components.processbar.ProcessStepBar; import io.bitsquare.gui.components.processbar.ProcessStepBar;

View file

@ -15,7 +15,7 @@
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/ */
package io.bitsquare.gui.main.orders.pending.uimock; package io.bitsquare.gui.main.portfolio.pending.uimock;
import io.bitsquare.di.BitSquareModule; import io.bitsquare.di.BitSquareModule;
import io.bitsquare.util.ViewLoader; import io.bitsquare.util.ViewLoader;
@ -68,7 +68,7 @@ public class PendingTradesUIMockRunner extends Application {
log.debug("re load"); log.debug("re load");
pane.getChildren().removeAll(); pane.getChildren().removeAll();
ViewLoader loader = new ViewLoader( ViewLoader loader = new ViewLoader(
getUrl("/io/bitsquare/gui/main/orders/pending/uimock/PendingTradesViewUIMock.fxml"), false); getUrl("/io/bitsquare/gui/main/portfolio/pending/uimock/PendingTradesViewUIMock.fxml"), false);
try { try {
view = loader.load(); view = loader.load();

View file

@ -24,7 +24,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.orders.pending.uimock.PendingTradesControllerUIMock" <GridPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.pending.uimock.PendingTradesControllerUIMock"
hgap="5.0" vgap="5" stylesheets="@../../../../../../../../../main/java/io/bitsquare/gui/bitsquare.css" hgap="5.0" vgap="5" stylesheets="@../../../../../../../../../main/java/io/bitsquare/gui/bitsquare.css"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<padding> <padding>

View file

@ -19,13 +19,13 @@ package io.bitsquare.msg.dhttest;
import io.bitsquare.BitSquare; import io.bitsquare.BitSquare;
import io.bitsquare.bank.BankAccountType; import io.bitsquare.bank.BankAccountType;
import io.bitsquare.gui.main.trade.orderbook.OrderBookListItem; import io.bitsquare.gui.main.trade.offerbook.OfferBookListItem;
import io.bitsquare.locale.CountryUtil; import io.bitsquare.locale.CountryUtil;
import io.bitsquare.msg.BootstrappedPeerFactory; import io.bitsquare.msg.BootstrappedPeerFactory;
import io.bitsquare.msg.MessageFacade; import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.AddOfferListener; import io.bitsquare.msg.listeners.AddOfferListener;
import io.bitsquare.msg.listeners.BootstrapListener; import io.bitsquare.msg.listeners.BootstrapListener;
import io.bitsquare.msg.listeners.OrderBookListener; import io.bitsquare.msg.listeners.OfferBookListener;
import io.bitsquare.trade.Direction; import io.bitsquare.trade.Direction;
import io.bitsquare.trade.Offer; import io.bitsquare.trade.Offer;
import io.bitsquare.user.User; import io.bitsquare.user.User;
@ -58,12 +58,12 @@ public class DHTTestController implements Initializable {
private final MessageFacade messageFacade; private final MessageFacade messageFacade;
private BootstrappedPeerFactory bootstrappedPeerFactory; private BootstrappedPeerFactory bootstrappedPeerFactory;
private User user; private User user;
private final ObservableList<OrderBookListItem> orderBookListItems = FXCollections.observableArrayList(); private final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
@FXML TableView table; @FXML TableView table;
@FXML TextArea stateLabel; @FXML TextArea stateLabel;
@FXML TextField toSaveTextField; @FXML TextField toSaveTextField;
@FXML TableColumn<OrderBookListItem, OrderBookListItem> idColumn; @FXML TableColumn<OfferBookListItem, OfferBookListItem> idColumn;
@Inject @Inject
private DHTTestController(MessageFacade messageFacade, User user, private DHTTestController(MessageFacade messageFacade, User user,
@ -89,7 +89,7 @@ public class DHTTestController implements Initializable {
} }
}); });
messageFacade.addOrderBookListener(new OrderBookListener() { messageFacade.addOrderBookListener(new OfferBookListener() {
@Override @Override
public void onOfferAdded(Offer offer) { public void onOfferAdded(Offer offer) {
log.debug("offer added " + offer.getId()); log.debug("offer added " + offer.getId());
@ -98,22 +98,22 @@ public class DHTTestController implements Initializable {
@Override @Override
public void onOffersReceived(List<Offer> offers) { public void onOffersReceived(List<Offer> offers) {
//TODO use deltas instead replacing the whole list //TODO use deltas instead replacing the whole list
orderBookListItems.clear(); offerBookListItems.clear();
offers.stream().forEach(offer -> { offers.stream().forEach(offer -> {
if (offer != null) { if (offer != null) {
orderBookListItems.add(new OrderBookListItem(offer, CountryUtil.getDefaultCountry())); offerBookListItems.add(new OfferBookListItem(offer, CountryUtil.getDefaultCountry()));
} }
}); });
} }
@Override @Override
public void onOfferRemoved(Offer offer) { public void onOfferRemoved(Offer offer) {
orderBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId())); offerBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId()));
} }
}); });
setIDColumnCellFactory(); setIDColumnCellFactory();
table.setItems(orderBookListItems); table.setItems(offerBookListItems);
bootstrappedPeerFactory.connectionState.addListener((ov, oldValue, newValue) -> { bootstrappedPeerFactory.connectionState.addListener((ov, oldValue, newValue) -> {
stateLabel.setText(newValue); stateLabel.setText(newValue);
@ -162,14 +162,14 @@ public class DHTTestController implements Initializable {
private void setIDColumnCellFactory() { private void setIDColumnCellFactory() {
idColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue())); idColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
idColumn.setCellFactory( idColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem, new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
OrderBookListItem>>() { OfferBookListItem>>() {
@Override @Override
public TableCell<OrderBookListItem, OrderBookListItem> call( public TableCell<OfferBookListItem, OfferBookListItem> call(
TableColumn<OrderBookListItem, OrderBookListItem> column) { TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OrderBookListItem, OrderBookListItem>() { return new TableCell<OfferBookListItem, OfferBookListItem>() {
@Override @Override
public void updateItem(final OrderBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && item.getOffer() != null && item.getOffer().getAmount() != null) if (item != null && item.getOffer() != null && item.getOffer().getAmount() != null)
setText(item.getOffer().getId()); setText(item.getOffer().getId());