mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Move Create offer to new package structure
This commit is contained in:
parent
08dba76d9e
commit
cd606d4b96
@ -36,7 +36,7 @@ public enum NavigationItem {
|
||||
ORDER_BOOK("/io/bitsquare/gui/trade/orderbook/OrderBookView.fxml"),
|
||||
BUY("/io/bitsquare/gui/trade/BuyView.fxml", ImageUtil.NAV_BUY, ImageUtil.NAV_BUY_ACTIVE),
|
||||
SELL("/io/bitsquare/gui/trade/SellView.fxml", ImageUtil.NAV_SELL, ImageUtil.NAV_SELL_ACTIVE),
|
||||
CREATE_OFFER("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"),
|
||||
CREATE_OFFER("/io/bitsquare/gui/view/trade/CreateOfferView.fxml"),
|
||||
TAKE_OFFER("/io/bitsquare/gui/trade/takeoffer/TakeOfferView.fxml"),
|
||||
|
||||
// orders
|
||||
|
@ -15,7 +15,7 @@
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.trade.createoffer;
|
||||
package io.bitsquare.gui.model.trade;
|
||||
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
@ -64,7 +64,7 @@ import static io.bitsquare.gui.util.BSFormatter.reduceTo4Decimals;
|
||||
* Note that the create offer domain has a deeper scope in the application domain (TradeManager).
|
||||
* That model is just responsible for the domain specific parts displayed needed in that UI element.
|
||||
*/
|
||||
class CreateOfferModel extends UIModel {
|
||||
public class CreateOfferModel extends UIModel {
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateOfferModel.class);
|
||||
|
||||
private final TradeManager tradeManager;
|
||||
@ -75,42 +75,43 @@ class CreateOfferModel extends UIModel {
|
||||
private final String offerId;
|
||||
@Nullable private Direction direction = null;
|
||||
|
||||
AddressEntry addressEntry;
|
||||
public AddressEntry addressEntry;
|
||||
|
||||
final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
|
||||
final StringProperty transactionId = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCurrency = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCounty = new SimpleStringProperty();
|
||||
final StringProperty bankAccountType = new SimpleStringProperty();
|
||||
final StringProperty fiatCode = new SimpleStringProperty();
|
||||
final StringProperty btcCode = new SimpleStringProperty();
|
||||
public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
|
||||
public final StringProperty transactionId = new SimpleStringProperty();
|
||||
public final StringProperty bankAccountCurrency = new SimpleStringProperty();
|
||||
public final StringProperty bankAccountCounty = new SimpleStringProperty();
|
||||
public final StringProperty bankAccountType = new SimpleStringProperty();
|
||||
public final StringProperty fiatCode = new SimpleStringProperty();
|
||||
public final StringProperty btcCode = new SimpleStringProperty();
|
||||
|
||||
final LongProperty collateralAsLong = new SimpleLongProperty();
|
||||
public final LongProperty collateralAsLong = new SimpleLongProperty();
|
||||
|
||||
final BooleanProperty requestPlaceOfferSuccess = new SimpleBooleanProperty();
|
||||
final BooleanProperty isWalletFunded = new SimpleBooleanProperty();
|
||||
final BooleanProperty useMBTC = new SimpleBooleanProperty();
|
||||
public final BooleanProperty requestPlaceOfferSuccess = new SimpleBooleanProperty();
|
||||
public final BooleanProperty isWalletFunded = new SimpleBooleanProperty();
|
||||
public final BooleanProperty useMBTC = new SimpleBooleanProperty();
|
||||
|
||||
final ObjectProperty<Coin> amountAsCoin = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Coin> minAmountAsCoin = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Fiat> priceAsFiat = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Fiat> volumeAsFiat = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Coin> totalToPayAsCoin = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Coin> collateralAsCoin = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Coin> offerFeeAsCoin = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Coin> networkFeeAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> amountAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> minAmountAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Fiat> priceAsFiat = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Fiat> volumeAsFiat = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> totalToPayAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> collateralAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> offerFeeAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> networkFeeAsCoin = new SimpleObjectProperty<>();
|
||||
|
||||
final ObservableList<Country> acceptedCountries = FXCollections.observableArrayList();
|
||||
final ObservableList<Locale> acceptedLanguages = FXCollections.observableArrayList();
|
||||
final ObservableList<Arbitrator> acceptedArbitrators = FXCollections.observableArrayList();
|
||||
public final ObservableList<Country> acceptedCountries = FXCollections.observableArrayList();
|
||||
public final ObservableList<Locale> acceptedLanguages = FXCollections.observableArrayList();
|
||||
public final ObservableList<Arbitrator> acceptedArbitrators = FXCollections.observableArrayList();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// non private for testing
|
||||
@Inject
|
||||
CreateOfferModel(TradeManager tradeManager, WalletFacade walletFacade, Settings settings, User user) {
|
||||
public CreateOfferModel(TradeManager tradeManager, WalletFacade walletFacade, Settings settings, User user) {
|
||||
this.tradeManager = tradeManager;
|
||||
this.walletFacade = walletFacade;
|
||||
this.settings = settings;
|
||||
@ -186,10 +187,10 @@ class CreateOfferModel extends UIModel {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods
|
||||
// Public
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void placeOffer() {
|
||||
public void placeOffer() {
|
||||
// data validation is done in the trade domain
|
||||
tradeManager.requestPlaceOffer(offerId,
|
||||
direction,
|
||||
@ -204,7 +205,7 @@ class CreateOfferModel extends UIModel {
|
||||
);
|
||||
}
|
||||
|
||||
void calculateVolume() {
|
||||
public void calculateVolume() {
|
||||
try {
|
||||
if (priceAsFiat.get() != null && amountAsCoin.get() != null && !amountAsCoin.get().isZero() && !priceAsFiat
|
||||
.get().isZero()) {
|
||||
@ -216,7 +217,7 @@ class CreateOfferModel extends UIModel {
|
||||
}
|
||||
}
|
||||
|
||||
void calculateAmount() {
|
||||
public void calculateAmount() {
|
||||
try {
|
||||
if (volumeAsFiat.get() != null && priceAsFiat.get() != null && !volumeAsFiat.get().isZero() && !priceAsFiat
|
||||
.get().isZero()) {
|
||||
@ -233,7 +234,7 @@ class CreateOfferModel extends UIModel {
|
||||
}
|
||||
}
|
||||
|
||||
void calculateTotalToPay() {
|
||||
public void calculateTotalToPay() {
|
||||
calculateCollateral();
|
||||
try {
|
||||
if (collateralAsCoin.get() != null) {
|
||||
@ -245,7 +246,7 @@ class CreateOfferModel extends UIModel {
|
||||
}
|
||||
}
|
||||
|
||||
void calculateCollateral() {
|
||||
public void calculateCollateral() {
|
||||
try {
|
||||
|
||||
if (amountAsCoin.get() != null)
|
||||
@ -256,43 +257,44 @@ class CreateOfferModel extends UIModel {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Validation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
boolean isMinAmountLessOrEqualAmount() {
|
||||
public boolean isMinAmountLessOrEqualAmount() {
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (minAmountAsCoin.get() != null && amountAsCoin.get() != null)
|
||||
return !minAmountAsCoin.get().isGreaterThan(amountAsCoin.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateBalance(@NotNull Coin balance) {
|
||||
isWalletFunded.set(totalToPayAsCoin.get() != null && balance.compareTo(totalToPayAsCoin.get()) >= 0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setter/Getter
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Nullable
|
||||
Direction getDirection() {
|
||||
public Direction getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
void setDirection(Direction direction) {
|
||||
public void setDirection(Direction direction) {
|
||||
// direction can not be changed once it is initially set
|
||||
checkArgument(this.direction == null);
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
WalletFacade getWalletFacade() {
|
||||
public WalletFacade getWalletFacade() {
|
||||
return walletFacade;
|
||||
}
|
||||
|
||||
String getOfferId() {
|
||||
public String getOfferId() {
|
||||
return offerId;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private void updateBalance(@NotNull Coin balance) {
|
||||
isWalletFunded.set(totalToPayAsCoin.get() != null && balance.compareTo(totalToPayAsCoin.get()) >= 0);
|
||||
}
|
||||
}
|
@ -15,10 +15,11 @@
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.trade.createoffer;
|
||||
package io.bitsquare.gui.pm.trade;
|
||||
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.model.trade.CreateOfferModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.validation.BtcValidator;
|
||||
import io.bitsquare.gui.util.validation.FiatValidator;
|
||||
@ -49,61 +50,63 @@ import org.slf4j.LoggerFactory;
|
||||
import static io.bitsquare.gui.util.BSFormatter.*;
|
||||
import static javafx.beans.binding.Bindings.createStringBinding;
|
||||
|
||||
class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
public class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateOfferPM.class);
|
||||
|
||||
private final BtcValidator btcValidator = new BtcValidator();
|
||||
private final FiatValidator fiatValidator = new FiatValidator();
|
||||
|
||||
final StringProperty amount = new SimpleStringProperty();
|
||||
final StringProperty minAmount = new SimpleStringProperty();
|
||||
final StringProperty price = new SimpleStringProperty();
|
||||
final StringProperty volume = new SimpleStringProperty();
|
||||
final StringProperty collateral = new SimpleStringProperty();
|
||||
final StringProperty totalToPay = new SimpleStringProperty();
|
||||
final StringProperty directionLabel = new SimpleStringProperty();
|
||||
final StringProperty collateralLabel = new SimpleStringProperty();
|
||||
final StringProperty offerFee = new SimpleStringProperty();
|
||||
final StringProperty networkFee = new SimpleStringProperty();
|
||||
final StringProperty bankAccountType = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCurrency = new SimpleStringProperty();
|
||||
final StringProperty bankAccountCounty = new SimpleStringProperty();
|
||||
final StringProperty acceptedCountries = new SimpleStringProperty();
|
||||
final StringProperty acceptedLanguages = new SimpleStringProperty();
|
||||
final StringProperty acceptedArbitrators = new SimpleStringProperty();
|
||||
final StringProperty addressAsString = new SimpleStringProperty();
|
||||
final StringProperty paymentLabel = new SimpleStringProperty();
|
||||
final StringProperty transactionId = new SimpleStringProperty();
|
||||
final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
|
||||
final StringProperty btcCode = new SimpleStringProperty();
|
||||
final StringProperty fiatCode = new SimpleStringProperty();
|
||||
public final StringProperty amount = new SimpleStringProperty();
|
||||
public final StringProperty minAmount = new SimpleStringProperty();
|
||||
public final StringProperty price = new SimpleStringProperty();
|
||||
public final StringProperty volume = new SimpleStringProperty();
|
||||
public final StringProperty collateral = new SimpleStringProperty();
|
||||
public final StringProperty totalToPay = new SimpleStringProperty();
|
||||
public final StringProperty directionLabel = new SimpleStringProperty();
|
||||
public final StringProperty collateralLabel = new SimpleStringProperty();
|
||||
public final StringProperty offerFee = new SimpleStringProperty();
|
||||
public final StringProperty networkFee = new SimpleStringProperty();
|
||||
public final StringProperty bankAccountType = new SimpleStringProperty();
|
||||
public final StringProperty bankAccountCurrency = new SimpleStringProperty();
|
||||
public final StringProperty bankAccountCounty = new SimpleStringProperty();
|
||||
public final StringProperty acceptedCountries = new SimpleStringProperty();
|
||||
public final StringProperty acceptedLanguages = new SimpleStringProperty();
|
||||
public final StringProperty acceptedArbitrators = new SimpleStringProperty();
|
||||
public final StringProperty addressAsString = new SimpleStringProperty();
|
||||
public final StringProperty paymentLabel = new SimpleStringProperty();
|
||||
public final StringProperty transactionId = new SimpleStringProperty();
|
||||
public final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
|
||||
public final StringProperty btcCode = new SimpleStringProperty();
|
||||
public final StringProperty fiatCode = new SimpleStringProperty();
|
||||
|
||||
final BooleanProperty isPlaceOfferButtonVisible = new SimpleBooleanProperty(false);
|
||||
final BooleanProperty isPlaceOfferButtonDisabled = new SimpleBooleanProperty(true);
|
||||
final BooleanProperty showWarningAdjustedVolume = new SimpleBooleanProperty();
|
||||
final BooleanProperty showWarningInvalidFiatDecimalPlaces = new SimpleBooleanProperty();
|
||||
final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty();
|
||||
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
|
||||
public final BooleanProperty isPlaceOfferButtonVisible = new SimpleBooleanProperty(false);
|
||||
public final BooleanProperty isPlaceOfferButtonDisabled = new SimpleBooleanProperty(true);
|
||||
public final BooleanProperty showWarningAdjustedVolume = new SimpleBooleanProperty();
|
||||
public final BooleanProperty showWarningInvalidFiatDecimalPlaces = new SimpleBooleanProperty();
|
||||
public final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty();
|
||||
public final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
|
||||
|
||||
final ObjectProperty<InputValidator.ValidationResult> amountValidationResult = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<InputValidator.ValidationResult> minAmountValidationResult = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<InputValidator.ValidationResult> priceValidationResult = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<InputValidator.ValidationResult> volumeValidationResult = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<InputValidator.ValidationResult> amountValidationResult = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<InputValidator.ValidationResult> minAmountValidationResult = new
|
||||
SimpleObjectProperty<>();
|
||||
public final ObjectProperty<InputValidator.ValidationResult> priceValidationResult = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<InputValidator.ValidationResult> volumeValidationResult = new SimpleObjectProperty<>();
|
||||
|
||||
// Those are needed for the addressTextField
|
||||
final ObjectProperty<Coin> totalToPayAsCoin = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Address> address = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Coin> totalToPayAsCoin = new SimpleObjectProperty<>();
|
||||
public final ObjectProperty<Address> address = new SimpleObjectProperty<>();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// non private for testing
|
||||
@Inject
|
||||
CreateOfferPM(CreateOfferModel model) {
|
||||
super(model);
|
||||
|
||||
// Node: Don't do setup in constructor to make object creation faster
|
||||
// Note: Don't do setup in constructor to make object creation faster
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +154,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// setOrderBookFilter is a one time call
|
||||
void setOrderBookFilter(@NotNull OrderBookFilter orderBookFilter) {
|
||||
public void setOrderBookFilter(@NotNull OrderBookFilter orderBookFilter) {
|
||||
model.setDirection(orderBookFilter.getDirection());
|
||||
directionLabel.set(model.getDirection() == Direction.BUY ? BSResources.get("shared.buy") : BSResources.get
|
||||
("shared.sell"));
|
||||
@ -173,7 +176,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
// UI actions (called by CB)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void onPlaceOffer() {
|
||||
public void onPlaceOffer() {
|
||||
model.requestPlaceOfferErrorMessage.set(null);
|
||||
model.requestPlaceOfferSuccess.set(false);
|
||||
|
||||
@ -192,7 +195,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
}
|
||||
|
||||
// On focus out we do validation and apply the data to the model
|
||||
void onFocusOutAmountTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
public void onFocusOutAmountTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
if (oldValue && !newValue) {
|
||||
InputValidator.ValidationResult result = isBtcInputValid(amount.get());
|
||||
amountValidationResult.set(result);
|
||||
@ -219,7 +222,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
}
|
||||
}
|
||||
|
||||
void onFocusOutMinAmountTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
public void onFocusOutMinAmountTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
if (oldValue && !newValue) {
|
||||
InputValidator.ValidationResult result = isBtcInputValid(minAmount.get());
|
||||
minAmountValidationResult.set(result);
|
||||
@ -241,7 +244,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
}
|
||||
}
|
||||
|
||||
void onFocusOutPriceTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
public void onFocusOutPriceTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
if (oldValue && !newValue) {
|
||||
InputValidator.ValidationResult result = isFiatInputValid(price.get());
|
||||
boolean isValid = result.isValid;
|
||||
@ -256,7 +259,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
}
|
||||
}
|
||||
|
||||
void onFocusOutVolumeTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
public void onFocusOutVolumeTextField(Boolean oldValue, Boolean newValue, String userInput) {
|
||||
if (oldValue && !newValue) {
|
||||
InputValidator.ValidationResult result = isBtcInputValid(volume.get());
|
||||
volumeValidationResult.set(result);
|
||||
@ -280,7 +283,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||
// Getters (called by CB)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
WalletFacade getWalletFacade() {
|
||||
public WalletFacade getWalletFacade() {
|
||||
return model.getWalletFacade();
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ package io.bitsquare.gui.trade;
|
||||
import io.bitsquare.gui.CachedViewController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.trade.createoffer.CreateOfferCB;
|
||||
import io.bitsquare.gui.trade.orderbook.OrderBookController;
|
||||
import io.bitsquare.gui.trade.takeoffer.TakeOfferController;
|
||||
import io.bitsquare.gui.view.trade.CreateOfferCB;
|
||||
import io.bitsquare.trade.Direction;
|
||||
import io.bitsquare.util.BSFXMLLoader;
|
||||
|
||||
|
@ -25,10 +25,10 @@ import io.bitsquare.gui.MainController;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.ViewController;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.trade.createoffer.CreateOfferCB;
|
||||
import io.bitsquare.gui.trade.takeoffer.TakeOfferController;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.trade.CreateOfferCB;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
|
@ -22,6 +22,7 @@ import io.bitsquare.gui.CodeBehind;
|
||||
import io.bitsquare.gui.NavigationItem;
|
||||
import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.pm.account.AccountSettingsPM;
|
||||
import io.bitsquare.gui.view.account.content.AdjustableAccountContent;
|
||||
import io.bitsquare.util.BSFXMLLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -195,6 +196,7 @@ class MenuItem extends ToggleButton {
|
||||
((AnchorPane) content).getChildren().setAll(view);
|
||||
childController = loader.getController();
|
||||
childController.setParentController(parentCB);
|
||||
((AdjustableAccountContent) childController).isSettingsMode(true);
|
||||
} catch (IOException e) {
|
||||
log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
|
||||
e.getStackTrace();
|
||||
|
@ -24,6 +24,7 @@ import io.bitsquare.gui.PresentationModel;
|
||||
import io.bitsquare.gui.pm.account.AccountSetupPM;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.AccountCB;
|
||||
import io.bitsquare.gui.view.account.content.AdjustableAccountContent;
|
||||
import io.bitsquare.gui.view.account.content.FiatAccountCB;
|
||||
import io.bitsquare.gui.view.account.content.PasswordCB;
|
||||
import io.bitsquare.gui.view.account.content.RegistrationCB;
|
||||
@ -247,6 +248,7 @@ class WizardItem extends HBox {
|
||||
((AnchorPane) content).getChildren().setAll(view);
|
||||
childController = loader.getController();
|
||||
childController.setParentController(parentCB);
|
||||
((AdjustableAccountContent) childController).isSettingsMode(false);
|
||||
} catch (IOException e) {
|
||||
log.error("Loading view failed. FxmlUrl = " + navigationItem.getFxmlUrl());
|
||||
e.getStackTrace();
|
||||
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.view.account.content;
|
||||
|
||||
public interface AdjustableAccountContent {
|
||||
void isSettingsMode(boolean isSettingsMode);
|
||||
}
|
@ -21,7 +21,6 @@ import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.ChangePasswordPM;
|
||||
import io.bitsquare.gui.view.account.AccountSettingsCB;
|
||||
import io.bitsquare.gui.view.account.AccountSetupCB;
|
||||
|
||||
import java.net.URL;
|
||||
@ -31,14 +30,13 @@ import java.util.ResourceBundle;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> {
|
||||
public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> implements AdjustableAccountContent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ChangePasswordCB.class);
|
||||
|
||||
@ -91,17 +89,16 @@ public class ChangePasswordCB extends CachedCodeBehind<ChangePasswordPM> {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Override from CodeBehind
|
||||
// Override
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(Initializable parentController) {
|
||||
super.setParentController(parentController);
|
||||
if (parentController instanceof AccountSettingsCB) {
|
||||
public void isSettingsMode(boolean isSettingsMode) {
|
||||
if (isSettingsMode)
|
||||
buttonsHBox.getChildren().remove(skipButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -26,7 +26,6 @@ import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.FiatAccountPm;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.gui.view.account.AccountSettingsCB;
|
||||
import io.bitsquare.gui.view.account.AccountSetupCB;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.Region;
|
||||
@ -42,7 +41,6 @@ import javax.inject.Inject;
|
||||
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
|
||||
@ -54,7 +52,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import static javafx.beans.binding.Bindings.createBooleanBinding;
|
||||
|
||||
public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
|
||||
public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> implements AdjustableAccountContent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FiatAccountCB.class);
|
||||
|
||||
@ -124,15 +122,13 @@ public class FiatAccountCB extends CachedCodeBehind<FiatAccountPm> {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Override from CodeBehind
|
||||
// Override
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(Initializable parentController) {
|
||||
super.setParentController(parentController);
|
||||
if (parentController instanceof AccountSettingsCB) {
|
||||
public void isSettingsMode(boolean isSettingsMode) {
|
||||
if (isSettingsMode)
|
||||
buttonsHBox.getChildren().remove(completedButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,7 +21,6 @@ import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.PasswordPM;
|
||||
import io.bitsquare.gui.view.account.AccountSettingsCB;
|
||||
import io.bitsquare.gui.view.account.AccountSetupCB;
|
||||
|
||||
import java.net.URL;
|
||||
@ -31,14 +30,13 @@ import java.util.ResourceBundle;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PasswordCB extends CachedCodeBehind<PasswordPM> {
|
||||
public class PasswordCB extends CachedCodeBehind<PasswordPM> implements AdjustableAccountContent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PasswordCB.class);
|
||||
|
||||
@ -91,15 +89,13 @@ public class PasswordCB extends CachedCodeBehind<PasswordPM> {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Override from CodeBehind
|
||||
// Override
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(Initializable parentController) {
|
||||
super.setParentController(parentController);
|
||||
if (parentController instanceof AccountSettingsCB) {
|
||||
public void isSettingsMode(boolean isSettingsMode) {
|
||||
if (isSettingsMode)
|
||||
buttonsHBox.getChildren().remove(skipButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,6 @@ import io.bitsquare.gui.components.btc.BalanceTextField;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.RegistrationPM;
|
||||
import io.bitsquare.gui.view.account.AccountSettingsCB;
|
||||
import io.bitsquare.gui.view.account.AccountSetupCB;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
||||
@ -39,7 +38,6 @@ import javax.inject.Inject;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.*;
|
||||
|
||||
@ -50,7 +48,7 @@ import org.controlsfx.dialog.Dialog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RegistrationCB extends CachedCodeBehind<RegistrationPM> {
|
||||
public class RegistrationCB extends CachedCodeBehind<RegistrationPM> implements AdjustableAccountContent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RegistrationCB.class);
|
||||
|
||||
@ -153,18 +151,17 @@ public class RegistrationCB extends CachedCodeBehind<RegistrationPM> {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Override from CodeBehind
|
||||
// Override
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(Initializable parentController) {
|
||||
super.setParentController(parentController);
|
||||
if (parentController instanceof AccountSettingsCB) {
|
||||
//TODO
|
||||
// ((GridPane) root).getChildren().remove(completedButton);
|
||||
public void isSettingsMode(boolean isSettingsMode) {
|
||||
if (isSettingsMode) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI handlers
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -25,7 +25,6 @@ import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.RestrictionsPM;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.gui.view.account.AccountSettingsCB;
|
||||
import io.bitsquare.gui.view.account.AccountSetupCB;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.Region;
|
||||
@ -54,7 +53,7 @@ import javafx.util.StringConverter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
|
||||
public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> implements AdjustableAccountContent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RestrictionsCB.class);
|
||||
|
||||
@ -113,15 +112,13 @@ public class RestrictionsCB extends CachedCodeBehind<RestrictionsPM> {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Override from CodeBehind
|
||||
// Override
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(Initializable parentController) {
|
||||
super.setParentController(parentController);
|
||||
if (parentController instanceof AccountSettingsCB) {
|
||||
public void isSettingsMode(boolean isSettingsMode) {
|
||||
if (isSettingsMode)
|
||||
((GridPane) root).getChildren().remove(completedButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,7 +21,6 @@ import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.account.content.SeedWordsPM;
|
||||
import io.bitsquare.gui.view.account.AccountSettingsCB;
|
||||
import io.bitsquare.gui.view.account.AccountSetupCB;
|
||||
|
||||
import java.net.URL;
|
||||
@ -31,14 +30,13 @@ import java.util.ResourceBundle;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> {
|
||||
public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> implements AdjustableAccountContent {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SeedWordsCB.class);
|
||||
|
||||
@ -87,15 +85,13 @@ public class SeedWordsCB extends CachedCodeBehind<SeedWordsPM> {
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Override from CodeBehind
|
||||
// Override
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void setParentController(Initializable parentController) {
|
||||
super.setParentController(parentController);
|
||||
if (parentController instanceof AccountSettingsCB) {
|
||||
public void isSettingsMode(boolean isSettingsMode) {
|
||||
if (isSettingsMode)
|
||||
((GridPane) root).getChildren().remove(completedButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.trade.createoffer;
|
||||
package io.bitsquare.gui.view.trade;
|
||||
|
||||
import io.bitsquare.gui.CachedCodeBehind;
|
||||
import io.bitsquare.gui.MainController;
|
||||
@ -27,6 +27,7 @@ import io.bitsquare.gui.components.btc.AddressTextField;
|
||||
import io.bitsquare.gui.components.btc.BalanceTextField;
|
||||
import io.bitsquare.gui.help.Help;
|
||||
import io.bitsquare.gui.help.HelpId;
|
||||
import io.bitsquare.gui.pm.trade.CreateOfferPM;
|
||||
import io.bitsquare.gui.trade.TradeController;
|
||||
import io.bitsquare.gui.util.ImageUtil;
|
||||
import io.bitsquare.locale.BSResources;
|
@ -26,7 +26,7 @@
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.trade.createoffer.CreateOfferCB"
|
||||
<AnchorPane fx:id="root" fx:controller="io.bitsquare.gui.view.trade.CreateOfferCB"
|
||||
AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0"
|
||||
AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"
|
||||
xmlns:fx="http://javafx.com/fxml">
|
@ -18,7 +18,7 @@
|
||||
package io.bitsquare;
|
||||
|
||||
import io.bitsquare.btc.RestrictionsTest;
|
||||
import io.bitsquare.gui.trade.createoffer.CreateOfferPMTest;
|
||||
import io.bitsquare.gui.pm.trade.CreateOfferPMTest;
|
||||
import io.bitsquare.gui.util.BSFormatterTest;
|
||||
import io.bitsquare.gui.util.BitSquareConverterTest;
|
||||
import io.bitsquare.gui.util.BitSquareNumberValidatorTest;
|
||||
|
@ -15,9 +15,10 @@
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.trade.createoffer;
|
||||
package io.bitsquare.gui.pm.trade;
|
||||
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.gui.model.trade.CreateOfferModel;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.locale.Country;
|
||||
|
@ -68,7 +68,7 @@ public class CreateOfferUITestRunner extends Application {
|
||||
log.debug("re load");
|
||||
pane.getChildren().removeAll();
|
||||
BSFXMLLoader loader = new BSFXMLLoader(
|
||||
getUrl("/io/bitsquare/gui/trade/createoffer/CreateOfferView.fxml"), false);
|
||||
getUrl("/io/bitsquare/gui/view/trade/CreateOfferView.fxml"), false);
|
||||
try {
|
||||
view = loader.load();
|
||||
pane.getChildren().setAll(view);
|
||||
|
Loading…
Reference in New Issue
Block a user