Rename orders to portfolio, orderbook to offerbook
@ -159,7 +159,7 @@ public class Navigation {
|
||||
HOME("/io/bitsquare/gui/main/home/HomeView.fxml"),
|
||||
BUY("/io/bitsquare/gui/main/trade/BuyView.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"),
|
||||
MSG("/io/bitsquare/gui/main/msg/MsgView.fxml"),
|
||||
SETTINGS("/io/bitsquare/gui/main/settings/SettingsView.fxml"),
|
||||
@ -171,14 +171,14 @@ public class Navigation {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 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"),
|
||||
TAKE_OFFER("/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.fxml"),
|
||||
|
||||
// orders
|
||||
OFFERS("/io/bitsquare/gui/main/orders/offer/OffersView.fxml"),
|
||||
PENDING_TRADES("/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml"),
|
||||
CLOSED_TRADES("/io/bitsquare/gui/main/orders/closed/ClosedTradesView.fxml"),
|
||||
// portfolio
|
||||
OFFERS("/io/bitsquare/gui/main/portfolio/offer/OffersView.fxml"),
|
||||
PENDING_TRADES("/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.fxml"),
|
||||
CLOSED_TRADES("/io/bitsquare/gui/main/portfolio/closed/ClosedTradesView.fxml"),
|
||||
|
||||
// funds
|
||||
WITHDRAWAL("/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.fxml"),
|
||||
|
@ -68,11 +68,11 @@
|
||||
-fx-image: url("../../../images/nav/sell_active.png");
|
||||
}
|
||||
|
||||
#image-nav-orders {
|
||||
-fx-image: url("../../../images/nav/orders.png");
|
||||
#image-nav-portfolio {
|
||||
-fx-image: url("../../../images/nav/portfolio.png");
|
||||
}
|
||||
#image-nav-orders-active {
|
||||
-fx-image: url("../../../images/nav/orders_active.png");
|
||||
#image-nav-portfolio-active {
|
||||
-fx-image: url("../../../images/nav/portfolio_active.png");
|
||||
}
|
||||
|
||||
#image-nav-funds {
|
||||
|
@ -256,7 +256,7 @@ public class MainViewCB extends ViewCB<MainPM> {
|
||||
case MSG:
|
||||
msgButton.setSelected(true);
|
||||
break;
|
||||
case ORDERS:
|
||||
case PORTFOLIO:
|
||||
ordersButton.setSelected(true);
|
||||
break;
|
||||
case SETTINGS:
|
||||
@ -337,7 +337,7 @@ public class MainViewCB extends ViewCB<MainPM> {
|
||||
sellButton = addNavButton(leftNavPane, "Sell BTC", Navigation.Item.SELL);
|
||||
|
||||
ordersButtonButtonPane = new Pane();
|
||||
ordersButton = addNavButton(ordersButtonButtonPane, "Portfolio", Navigation.Item.ORDERS);
|
||||
ordersButton = addNavButton(ordersButtonButtonPane, "Portfolio", Navigation.Item.PORTFOLIO);
|
||||
leftNavPane.getChildren().add(ordersButtonButtonPane);
|
||||
|
||||
fundsButton = addNavButton(leftNavPane, "Funds", Navigation.Item.FUNDS);
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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.topAnchor="0.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
@ -15,7 +15,7 @@
|
||||
* 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.Navigation;
|
||||
@ -40,8 +40,8 @@ import javafx.scene.control.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OrdersViewCB extends CachedViewCB {
|
||||
private static final Logger log = LoggerFactory.getLogger(OrdersViewCB.class);
|
||||
public class PortfolioViewCB extends CachedViewCB {
|
||||
private static final Logger log = LoggerFactory.getLogger(PortfolioViewCB.class);
|
||||
|
||||
private final Navigation navigation;
|
||||
private final TradeManager tradeManager;
|
||||
@ -57,7 +57,7 @@ public class OrdersViewCB extends CachedViewCB {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
OrdersViewCB(Navigation navigation, TradeManager tradeManager) {
|
||||
PortfolioViewCB(Navigation navigation, TradeManager tradeManager) {
|
||||
super();
|
||||
|
||||
this.navigation = navigation;
|
||||
@ -73,17 +73,18 @@ public class OrdersViewCB extends CachedViewCB {
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
navigationListener = navigationItems -> {
|
||||
if (navigationItems != null && navigationItems.length == 3
|
||||
&& navigationItems[1] == Navigation.Item.ORDERS)
|
||||
&& navigationItems[1] == Navigation.Item.PORTFOLIO)
|
||||
loadView(navigationItems[2]);
|
||||
};
|
||||
|
||||
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||
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)
|
||||
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)
|
||||
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);
|
||||
@ -97,9 +98,9 @@ public class OrdersViewCB extends CachedViewCB {
|
||||
navigation.addListener(navigationListener);
|
||||
|
||||
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
|
||||
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
|
@ -15,7 +15,7 @@
|
||||
* 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;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* 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.trade.Direction;
|
@ -15,7 +15,7 @@
|
||||
* 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.util.BSFormatter;
|
@ -21,7 +21,7 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
@ -15,7 +15,7 @@
|
||||
* 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.components.Popups;
|
@ -15,7 +15,7 @@
|
||||
* 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;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* 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.trade.Direction;
|
@ -15,7 +15,7 @@
|
||||
* 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.util.BSFormatter;
|
@ -21,7 +21,7 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
@ -15,7 +15,7 @@
|
||||
* 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.components.Popups;
|
@ -15,7 +15,7 @@
|
||||
* 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;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* 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.FeePolicy;
|
@ -15,7 +15,7 @@
|
||||
* 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.gui.PresentationModel;
|
@ -27,7 +27,7 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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">
|
||||
|
||||
<ScrollPane fx:id="scrollPane" fitToWidth="true" fitToHeight="true"
|
||||
@ -208,7 +208,7 @@
|
||||
</Label>
|
||||
<TextField fx:id="withdrawAmountTextField" GridPane.rowIndex="10" GridPane.columnIndex="1" editable="false"
|
||||
focusTraversable="false" managed="false" visible="false">
|
||||
<GridPane.margin>
|
||||
<GridPane.margin>
|
||||
<Insets top="60.0"/>
|
||||
</GridPane.margin>
|
||||
</TextField>
|
@ -15,7 +15,7 @@
|
||||
* 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.Navigation;
|
||||
@ -208,7 +208,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
|
||||
presentationModel.removePendingTrade();
|
||||
presentationModel.withdraw(withdrawAddressTextField.getText());
|
||||
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
|
@ -21,7 +21,7 @@ import io.bitsquare.gui.CachedViewCB;
|
||||
import io.bitsquare.gui.Navigation;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
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.trade.Direction;
|
||||
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 final OrderBookInfo orderBookInfo = new OrderBookInfo();
|
||||
private OrderBookViewCB orderBookViewCB;
|
||||
private OfferBookViewCB orderBookViewCB;
|
||||
private CreateOfferViewCB createOfferViewCB;
|
||||
private TakeOfferViewCB takeOfferViewCB;
|
||||
private Node createOfferView;
|
||||
@ -118,7 +118,7 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
|
||||
});
|
||||
|
||||
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")
|
||||
@ -166,7 +166,7 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
|
||||
protected Initializable loadView(Navigation.Item navigationItem) {
|
||||
super.loadView(navigationItem);
|
||||
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.
|
||||
ViewLoader orderBookLoader =
|
||||
new ViewLoader(getClass().getResource(navigationItem.getFxmlUrl()), false);
|
||||
@ -244,14 +244,14 @@ public class TradeViewCB extends CachedViewCB implements TradeNavigator {
|
||||
orderBookViewCB.enableCreateOfferButton();
|
||||
|
||||
// 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() {
|
||||
takeOfferViewCB = null;
|
||||
|
||||
// update the navigation state
|
||||
navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.ORDER_BOOK);
|
||||
navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.OFFER_BOOK);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
|
||||
TabPane tabPane = ((TabPane) (root.getParent().getParent()));
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,13 +15,13 @@
|
||||
* 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.locale.Country;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
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.user.User;
|
||||
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
|
||||
* 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 User user;
|
||||
|
||||
private final ObservableList<OrderBookListItem> orderBookListItems = FXCollections.observableArrayList();
|
||||
private final OrderBookListener orderBookListener;
|
||||
private final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
|
||||
private final OfferBookListener offerBookListener;
|
||||
private final ChangeListener<BankAccount> bankAccountChangeListener;
|
||||
private final ChangeListener<Number> invalidationListener;
|
||||
private String fiatCode;
|
||||
@ -69,14 +69,14 @@ public class OrderBook {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
OrderBook(MessageFacade messageFacade, User user) {
|
||||
OfferBook(MessageFacade messageFacade, User user) {
|
||||
this.messageFacade = messageFacade;
|
||||
this.user = user;
|
||||
|
||||
bankAccountChangeListener = (observableValue, oldValue, newValue) -> setBankAccount(newValue);
|
||||
invalidationListener = (ov, oldValue, newValue) -> requestOffers();
|
||||
|
||||
orderBookListener = new OrderBookListener() {
|
||||
offerBookListener = new OfferBookListener() {
|
||||
@Override
|
||||
public void onOfferAdded(Offer offer) {
|
||||
addOfferToOrderBookListItems(offer);
|
||||
@ -85,13 +85,13 @@ public class OrderBook {
|
||||
@Override
|
||||
public void onOffersReceived(List<Offer> offers) {
|
||||
//TODO use deltas instead replacing the whole list
|
||||
orderBookListItems.clear();
|
||||
offerBookListItems.clear();
|
||||
offers.stream().forEach(e -> addOfferToOrderBookListItems(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ObservableList<OrderBookListItem> getOrderBookListItems() {
|
||||
return orderBookListItems;
|
||||
ObservableList<OfferBookListItem> getOfferBookListItems() {
|
||||
return offerBookListItems;
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ public class OrderBook {
|
||||
if (bankAccount != null) {
|
||||
country = bankAccount.getCountry();
|
||||
fiatCode = bankAccount.getCurrency().getCurrencyCode();
|
||||
orderBookListItems.stream().forEach(e -> e.setBankAccountCountry(country));
|
||||
offerBookListItems.stream().forEach(e -> e.setBankAccountCountry(country));
|
||||
}
|
||||
else {
|
||||
fiatCode = CurrencyUtil.getDefaultCurrency().getCurrencyCode();
|
||||
@ -143,20 +143,20 @@ public class OrderBook {
|
||||
private void addListeners() {
|
||||
log.debug("addListeners ");
|
||||
user.currentBankAccountProperty().addListener(bankAccountChangeListener);
|
||||
messageFacade.addOrderBookListener(orderBookListener);
|
||||
messageFacade.addOrderBookListener(offerBookListener);
|
||||
messageFacade.invalidationTimestampProperty().addListener(invalidationListener);
|
||||
}
|
||||
|
||||
private void removeListeners() {
|
||||
log.debug("removeListeners ");
|
||||
user.currentBankAccountProperty().removeListener(bankAccountChangeListener);
|
||||
messageFacade.removeOrderBookListener(orderBookListener);
|
||||
messageFacade.removeOrderBookListener(offerBookListener);
|
||||
messageFacade.invalidationTimestampProperty().removeListener(invalidationListener);
|
||||
}
|
||||
|
||||
private void addOfferToOrderBookListItems(Offer offer) {
|
||||
if (offer != null) {
|
||||
orderBookListItems.add(new OrderBookListItem(offer, country));
|
||||
offerBookListItems.add(new OfferBookListItem(offer, country));
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* 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.trade.Offer;
|
||||
@ -23,7 +23,7 @@ import io.bitsquare.trade.Offer;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
|
||||
public class OrderBookListItem {
|
||||
public class OfferBookListItem {
|
||||
private final Offer offer;
|
||||
private final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
|
||||
|
||||
@ -32,7 +32,7 @@ public class OrderBookListItem {
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public OrderBookListItem(Offer offer, Country bankAccountCountry) {
|
||||
public OfferBookListItem(Offer offer, Country bankAccountCountry) {
|
||||
this.offer = offer;
|
||||
setBankAccountCountry(bankAccountCountry);
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* 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.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.
|
||||
*/
|
||||
class OrderBookModel extends UIModel {
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderBookModel.class);
|
||||
class OfferBookModel extends UIModel {
|
||||
private static final Logger log = LoggerFactory.getLogger(OfferBookModel.class);
|
||||
|
||||
private final User user;
|
||||
private final OrderBook orderBook;
|
||||
private final OfferBook orderBook;
|
||||
private final Settings settings;
|
||||
private BSFormatter formatter;
|
||||
private final TradeManager tradeManager;
|
||||
|
||||
private final FilteredList<OrderBookListItem> filteredItems;
|
||||
private final SortedList<OrderBookListItem> sortedItems;
|
||||
private final FilteredList<OfferBookListItem> filteredItems;
|
||||
private final SortedList<OfferBookListItem> sortedItems;
|
||||
// private OrderBookInfo orderBookInfo;
|
||||
private ChangeListener<BankAccount> bankAccountChangeListener;
|
||||
|
||||
@ -73,7 +73,7 @@ class OrderBookModel extends UIModel {
|
||||
final StringProperty fiatCode = new SimpleStringProperty();
|
||||
final StringProperty btcCode = new SimpleStringProperty();
|
||||
final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Comparator<OrderBookListItem>> comparator = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Comparator<OfferBookListItem>> comparator = new SimpleObjectProperty<>();
|
||||
private Direction direction;
|
||||
|
||||
|
||||
@ -82,9 +82,9 @@ class OrderBookModel extends UIModel {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
OrderBookModel(User user,
|
||||
OfferBookModel(User user,
|
||||
TradeManager tradeManager,
|
||||
OrderBook orderBook,
|
||||
OfferBook orderBook,
|
||||
Settings settings,
|
||||
BSFormatter formatter) {
|
||||
this.tradeManager = tradeManager;
|
||||
@ -93,7 +93,7 @@ class OrderBookModel extends UIModel {
|
||||
this.settings = settings;
|
||||
this.formatter = formatter;
|
||||
|
||||
filteredItems = new FilteredList<>(orderBook.getOrderBookListItems());
|
||||
filteredItems = new FilteredList<>(orderBook.getOfferBookListItems());
|
||||
sortedItems = new SortedList<>(filteredItems);
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ class OrderBookModel extends UIModel {
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SortedList<OrderBookListItem> getOfferList() {
|
||||
SortedList<OfferBookListItem> getOfferList() {
|
||||
return sortedItems;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* 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.util.BSFormatter;
|
||||
@ -38,8 +38,8 @@ import javafx.collections.transformation.SortedList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
class OrderBookPM extends PresentationModel<OrderBookModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderBookPM.class);
|
||||
class OfferBookPM extends PresentationModel<OfferBookModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(OfferBookPM.class);
|
||||
|
||||
private final OptionalBtcValidator optionalBtcValidator;
|
||||
private BSFormatter formatter;
|
||||
@ -58,7 +58,7 @@ class OrderBookPM extends PresentationModel<OrderBookModel> {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
OrderBookPM(OrderBookModel model,
|
||||
OfferBookPM(OfferBookModel model,
|
||||
OptionalFiatValidator optionalFiatValidator,
|
||||
OptionalBtcValidator optionalBtcValidator,
|
||||
BSFormatter formatter) {
|
||||
@ -161,7 +161,7 @@ class OrderBookPM extends PresentationModel<OrderBookModel> {
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SortedList<OrderBookListItem> getOfferList() {
|
||||
SortedList<OfferBookListItem> getOfferList() {
|
||||
return model.getOfferList();
|
||||
}
|
||||
|
||||
@ -185,21 +185,21 @@ class OrderBookPM extends PresentationModel<OrderBookModel> {
|
||||
return model.isMyOffer(offer);
|
||||
}
|
||||
|
||||
String getAmount(OrderBookListItem item) {
|
||||
String getAmount(OfferBookListItem item) {
|
||||
return (item != null) ? formatter.formatCoin(item.getOffer().getAmount()) +
|
||||
" (" + formatter.formatCoin(item.getOffer().getMinAmount()) + ")" : "";
|
||||
}
|
||||
|
||||
String getPrice(OrderBookListItem item) {
|
||||
String getPrice(OfferBookListItem item) {
|
||||
return (item != null) ? formatter.formatFiat(item.getOffer().getPrice()) : "";
|
||||
}
|
||||
|
||||
String getVolume(OrderBookListItem item) {
|
||||
String getVolume(OfferBookListItem item) {
|
||||
return (item != null) ? formatter.formatFiat(item.getOffer().getOfferVolume()) +
|
||||
" (" + formatter.formatFiat(item.getOffer().getMinOfferVolume()) + ")" : "";
|
||||
}
|
||||
|
||||
String getBankAccountType(OrderBookListItem item) {
|
||||
String getBankAccountType(OfferBookListItem item) {
|
||||
return (item != null) ? BSResources.get(item.getOffer().getBankAccountType().toString()) : "";
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?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"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
@ -15,7 +15,7 @@
|
||||
* 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.Navigation;
|
||||
@ -62,8 +62,8 @@ import static javafx.beans.binding.Bindings.createStringBinding;
|
||||
* TODO: The advanced filters are not impl. yet
|
||||
* The restrictions handling is open from the concept and is only implemented for countries yet.
|
||||
*/
|
||||
public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderBookViewCB.class);
|
||||
public class OfferBookViewCB extends CachedViewCB<OfferBookPM> {
|
||||
private static final Logger log = LoggerFactory.getLogger(OfferBookViewCB.class);
|
||||
|
||||
private final Navigation navigation;
|
||||
private final OverlayManager overlayManager;
|
||||
@ -80,9 +80,9 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
@FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel,
|
||||
volumeFiatLabel, extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel;
|
||||
@FXML InputTextField volumeTextField, amountTextField, priceTextField;
|
||||
@FXML TableView<OrderBookListItem> table;
|
||||
@FXML TableView<OfferBookListItem> table;
|
||||
@FXML Button createOfferButton, showAdvancedSettingsButton, openCountryFilterButton, openPaymentMethodsFilterButton;
|
||||
@FXML TableColumn<OrderBookListItem, OrderBookListItem> priceColumn, amountColumn, volumeColumn,
|
||||
@FXML TableColumn<OfferBookListItem, OfferBookListItem> priceColumn, amountColumn, volumeColumn,
|
||||
directionColumn, countryColumn, bankAccountTypeColumn;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -90,7 +90,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
OrderBookViewCB(OrderBookPM presentationModel,
|
||||
OfferBookViewCB(OfferBookPM presentationModel,
|
||||
Navigation navigation,
|
||||
OverlayManager overlayManager,
|
||||
OptionalBtcValidator optionalBtcValidator,
|
||||
@ -135,7 +135,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
// for irc demo
|
||||
showAdvancedSettingsButton.setVisible(false);
|
||||
showAdvancedSettingsButton.setManaged(false);
|
||||
|
||||
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
super.activate();
|
||||
|
||||
// setOrderBookInfo has been called before
|
||||
SortedList<OrderBookListItem> offerList = presentationModel.getOfferList();
|
||||
SortedList<OfferBookListItem> offerList = presentationModel.getOfferList();
|
||||
table.setItems(offerList);
|
||||
offerList.comparatorProperty().bind(table.comparatorProperty());
|
||||
priceColumn.setSortType((presentationModel.getDirection() == Direction.BUY) ?
|
||||
@ -388,14 +388,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private void setAmountColumnCellFactory() {
|
||||
amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
amountColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem item, boolean empty) {
|
||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
setText(presentationModel.getAmount(item));
|
||||
}
|
||||
@ -407,14 +407,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private void setPriceColumnCellFactory() {
|
||||
priceColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
priceColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem item, boolean empty) {
|
||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
setText(presentationModel.getPrice(item));
|
||||
}
|
||||
@ -426,14 +426,14 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private void setVolumeColumnCellFactory() {
|
||||
volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
volumeColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem item, boolean empty) {
|
||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
setText(presentationModel.getVolume(item));
|
||||
}
|
||||
@ -445,13 +445,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private void setDirectionColumnCellFactory() {
|
||||
directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
directionColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
final ImageView iconView = new ImageView();
|
||||
final Button button = new Button();
|
||||
|
||||
@ -460,7 +460,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
button.setMinWidth(70);
|
||||
}
|
||||
|
||||
private void verifyIfTradable(final OrderBookListItem item) {
|
||||
private void verifyIfTradable(final OfferBookListItem item) {
|
||||
boolean isMatchingRestrictions = presentationModel.isTradable(item
|
||||
.getOffer());
|
||||
button.setDisable(!isMatchingRestrictions);
|
||||
@ -488,7 +488,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem item, boolean empty) {
|
||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null) {
|
||||
@ -529,13 +529,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private void setCountryColumnCellFactory() {
|
||||
countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
countryColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
final HBox hBox = new HBox();
|
||||
|
||||
{
|
||||
@ -545,13 +545,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
public void updateItem(final OfferBookListItem offerBookListItem, boolean empty) {
|
||||
super.updateItem(offerBookListItem, empty);
|
||||
|
||||
hBox.getChildren().clear();
|
||||
if (orderBookListItem != null) {
|
||||
Country country = orderBookListItem.getOffer().getBankAccountCountry();
|
||||
hBox.getChildren().add(ImageUtil.getCountryIconImageView(orderBookListItem
|
||||
if (offerBookListItem != null) {
|
||||
Country country = offerBookListItem.getOffer().getBankAccountCountry();
|
||||
hBox.getChildren().add(ImageUtil.getCountryIconImageView(offerBookListItem
|
||||
.getOffer().getBankAccountCountry()));
|
||||
Tooltip.install(this, new Tooltip(country.getName()));
|
||||
}
|
||||
@ -564,16 +564,16 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
|
||||
private void setBankAccountTypeColumnCellFactory() {
|
||||
bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
bankAccountTypeColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem orderBookListItem, boolean empty) {
|
||||
super.updateItem(orderBookListItem, empty);
|
||||
setText(presentationModel.getBankAccountType(orderBookListItem));
|
||||
public void updateItem(final OfferBookListItem offerBookListItem, boolean empty) {
|
||||
super.updateItem(offerBookListItem, empty);
|
||||
setText(presentationModel.getBankAccountType(offerBookListItem));
|
||||
}
|
||||
};
|
||||
}
|
@ -340,7 +340,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
|
||||
getProperties().put("type", "CLOSE");
|
||||
try {
|
||||
close();
|
||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.ORDERS,
|
||||
navigation.navigationTo(Navigation.Item.MAIN, Navigation.Item.PORTFOLIO,
|
||||
Navigation.Item.PENDING_TRADES);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -23,7 +23,7 @@ import io.bitsquare.msg.listeners.ArbitratorListener;
|
||||
import io.bitsquare.msg.listeners.BootstrapListener;
|
||||
import io.bitsquare.msg.listeners.GetPeerAddressListener;
|
||||
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.trade.Offer;
|
||||
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||
@ -82,7 +82,7 @@ public class MessageFacade implements MessageBroker {
|
||||
private final P2PNode p2pNode;
|
||||
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<IncomingTradeMessageListener> incomingTradeMessageListeners = new ArrayList<>();
|
||||
private final LongProperty invalidationTimestamp = new SimpleLongProperty(0);
|
||||
@ -173,7 +173,7 @@ public class MessageFacade implements MessageBroker {
|
||||
if (future.isSuccess()) {
|
||||
Platform.runLater(() -> {
|
||||
addOfferListener.onComplete();
|
||||
orderBookListeners.stream().forEach(listener -> {
|
||||
offerBookListeners.stream().forEach(listener -> {
|
||||
try {
|
||||
Object offerDataObject = offerData.object();
|
||||
if (offerDataObject instanceof Offer) {
|
||||
@ -231,7 +231,7 @@ public class MessageFacade implements MessageBroker {
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
Platform.runLater(() -> {
|
||||
orderBookListeners.stream().forEach(orderBookListener -> {
|
||||
offerBookListeners.stream().forEach(orderBookListener -> {
|
||||
try {
|
||||
Object offerDataObject = offerData.object();
|
||||
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)));
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ public class MessageFacade implements MessageBroker {
|
||||
final Map<Number640, Data> dataMap = futureGet.dataMap();
|
||||
if (dataMap == null || dataMap.size() == 0) {
|
||||
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<>())));
|
||||
}
|
||||
else {
|
||||
@ -447,12 +447,12 @@ public class MessageFacade implements MessageBroker {
|
||||
// Event Listeners
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void addOrderBookListener(OrderBookListener listener) {
|
||||
orderBookListeners.add(listener);
|
||||
public void addOrderBookListener(OfferBookListener listener) {
|
||||
offerBookListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeOrderBookListener(OrderBookListener listener) {
|
||||
orderBookListeners.remove(listener);
|
||||
public void removeOrderBookListener(OfferBookListener listener) {
|
||||
offerBookListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addArbitratorListener(ArbitratorListener listener) {
|
||||
|
@ -21,7 +21,7 @@ import io.bitsquare.trade.Offer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderBookListener {
|
||||
public interface OfferBookListener {
|
||||
void onOfferAdded(Offer offer);
|
||||
|
||||
void onOffersReceived(List<Offer> offers);
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 906 B After Width: | Height: | Size: 906 B |
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 730 B |
@ -15,7 +15,7 @@
|
||||
* 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.util.ViewLoader;
|
||||
@ -68,7 +68,7 @@ public class PendingTradesUIRunner extends Application {
|
||||
log.debug("re load");
|
||||
pane.getChildren().removeAll();
|
||||
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 {
|
||||
view = loader.load();
|
@ -15,7 +15,7 @@
|
||||
* 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.components.processbar.ProcessStepBar;
|
@ -15,7 +15,7 @@
|
||||
* 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.util.ViewLoader;
|
||||
@ -68,7 +68,7 @@ public class PendingTradesUIMockRunner extends Application {
|
||||
log.debug("re load");
|
||||
pane.getChildren().removeAll();
|
||||
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 {
|
||||
view = loader.load();
|
@ -24,7 +24,7 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
||||
<padding>
|
@ -19,13 +19,13 @@ package io.bitsquare.msg.dhttest;
|
||||
|
||||
import io.bitsquare.BitSquare;
|
||||
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.msg.BootstrappedPeerFactory;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
import io.bitsquare.msg.listeners.AddOfferListener;
|
||||
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.Offer;
|
||||
import io.bitsquare.user.User;
|
||||
@ -58,12 +58,12 @@ public class DHTTestController implements Initializable {
|
||||
private final MessageFacade messageFacade;
|
||||
private BootstrappedPeerFactory bootstrappedPeerFactory;
|
||||
private User user;
|
||||
private final ObservableList<OrderBookListItem> orderBookListItems = FXCollections.observableArrayList();
|
||||
private final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
|
||||
|
||||
@FXML TableView table;
|
||||
@FXML TextArea stateLabel;
|
||||
@FXML TextField toSaveTextField;
|
||||
@FXML TableColumn<OrderBookListItem, OrderBookListItem> idColumn;
|
||||
@FXML TableColumn<OfferBookListItem, OfferBookListItem> idColumn;
|
||||
|
||||
@Inject
|
||||
private DHTTestController(MessageFacade messageFacade, User user,
|
||||
@ -89,7 +89,7 @@ public class DHTTestController implements Initializable {
|
||||
}
|
||||
});
|
||||
|
||||
messageFacade.addOrderBookListener(new OrderBookListener() {
|
||||
messageFacade.addOrderBookListener(new OfferBookListener() {
|
||||
@Override
|
||||
public void onOfferAdded(Offer offer) {
|
||||
log.debug("offer added " + offer.getId());
|
||||
@ -98,22 +98,22 @@ public class DHTTestController implements Initializable {
|
||||
@Override
|
||||
public void onOffersReceived(List<Offer> offers) {
|
||||
//TODO use deltas instead replacing the whole list
|
||||
orderBookListItems.clear();
|
||||
offerBookListItems.clear();
|
||||
offers.stream().forEach(offer -> {
|
||||
if (offer != null) {
|
||||
orderBookListItems.add(new OrderBookListItem(offer, CountryUtil.getDefaultCountry()));
|
||||
offerBookListItems.add(new OfferBookListItem(offer, CountryUtil.getDefaultCountry()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOfferRemoved(Offer offer) {
|
||||
orderBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId()));
|
||||
offerBookListItems.removeIf(item -> item.getOffer().getId().equals(offer.getId()));
|
||||
}
|
||||
});
|
||||
|
||||
setIDColumnCellFactory();
|
||||
table.setItems(orderBookListItems);
|
||||
table.setItems(offerBookListItems);
|
||||
|
||||
bootstrappedPeerFactory.connectionState.addListener((ov, oldValue, newValue) -> {
|
||||
stateLabel.setText(newValue);
|
||||
@ -162,14 +162,14 @@ public class DHTTestController implements Initializable {
|
||||
private void setIDColumnCellFactory() {
|
||||
idColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
idColumn.setCellFactory(
|
||||
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
|
||||
OrderBookListItem>>() {
|
||||
new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem,
|
||||
OfferBookListItem>>() {
|
||||
@Override
|
||||
public TableCell<OrderBookListItem, OrderBookListItem> call(
|
||||
TableColumn<OrderBookListItem, OrderBookListItem> column) {
|
||||
return new TableCell<OrderBookListItem, OrderBookListItem>() {
|
||||
public TableCell<OfferBookListItem, OfferBookListItem> call(
|
||||
TableColumn<OfferBookListItem, OfferBookListItem> column) {
|
||||
return new TableCell<OfferBookListItem, OfferBookListItem>() {
|
||||
@Override
|
||||
public void updateItem(final OrderBookListItem item, boolean empty) {
|
||||
public void updateItem(final OfferBookListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && item.getOffer() != null && item.getOffer().getAmount() != null)
|
||||
setText(item.getOffer().getId());
|
||||
|