mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Remove ChildView
This commit is contained in:
parent
3b75cc2fd0
commit
5f8f7446e3
12 changed files with 68 additions and 67 deletions
|
@ -37,7 +37,7 @@ public class ChangePasswordView extends InitializableView<GridPane, ChangePasswo
|
||||||
@FXML Button saveButton, skipButton;
|
@FXML Button saveButton, skipButton;
|
||||||
@FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField;
|
@FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ChangePasswordView(ChangePasswordViewModel model) {
|
private ChangePasswordView(ChangePasswordViewModel model) {
|
||||||
|
@ -53,8 +53,8 @@ public class ChangePasswordView extends InitializableView<GridPane, ChangePasswo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,7 +65,7 @@ public class ChangePasswordView extends InitializableView<GridPane, ChangePasswo
|
||||||
@FXML
|
@FXML
|
||||||
private void onSaved() {
|
private void onSaved() {
|
||||||
if (model.requestSavePassword())
|
if (model.requestSavePassword())
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
else
|
else
|
||||||
log.debug(model.getErrorMessage()); // TODO use validating TF
|
log.debug(model.getErrorMessage()); // TODO use validating TF
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class ChangePasswordView extends InitializableView<GridPane, ChangePasswo
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onSkipped() {
|
private void onSkipped() {
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
|
||||||
@FXML ComboBox<BankAccountType> typesComboBox;
|
@FXML ComboBox<BankAccountType> typesComboBox;
|
||||||
@FXML ComboBox<Currency> currencyComboBox;
|
@FXML ComboBox<Currency> currencyComboBox;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,7 +151,7 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
void onCompleted() {
|
void onCompleted() {
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
|
@ -29,8 +29,8 @@ import java.util.Currency;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import viewfx.view.FxmlView;
|
import viewfx.view.FxmlView;
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
|
||||||
import viewfx.view.Wizard;
|
import viewfx.view.Wizard;
|
||||||
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -50,7 +50,7 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
|
||||||
@FXML ComboBox<BankAccountType> typesComboBox;
|
@FXML ComboBox<BankAccountType> typesComboBox;
|
||||||
@FXML ComboBox<Currency> currencyComboBox;
|
@FXML ComboBox<Currency> currencyComboBox;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public IrcAccountView(IrcAccountViewModel model) {
|
public IrcAccountView(IrcAccountViewModel model) {
|
||||||
|
@ -132,8 +132,8 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -153,7 +153,7 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
|
||||||
@FXML
|
@FXML
|
||||||
void onSave() {
|
void onSave() {
|
||||||
if (model.requestSaveBankAccount().isValid)
|
if (model.requestSaveBankAccount().isValid)
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PasswordView extends InitializableView<GridPane, PasswordViewModel>
|
||||||
@FXML Button saveButton, skipButton;
|
@FXML Button saveButton, skipButton;
|
||||||
@FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField;
|
@FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PasswordView(PasswordViewModel model) {
|
private PasswordView(PasswordViewModel model) {
|
||||||
|
@ -53,8 +53,8 @@ public class PasswordView extends InitializableView<GridPane, PasswordViewModel>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,14 +65,14 @@ public class PasswordView extends InitializableView<GridPane, PasswordViewModel>
|
||||||
@FXML
|
@FXML
|
||||||
private void onSaved() {
|
private void onSaved() {
|
||||||
if (model.requestSavePassword())
|
if (model.requestSavePassword())
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
else
|
else
|
||||||
log.debug(model.getErrorMessage()); // TODO use validating passwordTF
|
log.debug(model.getErrorMessage()); // TODO use validating passwordTF
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onSkipped() {
|
private void onSkipped() {
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class RegistrationView extends InitializableView<GridPane, RegistrationVi
|
||||||
@FXML Label paymentSpinnerInfoLabel;
|
@FXML Label paymentSpinnerInfoLabel;
|
||||||
@FXML ProgressIndicator paymentSpinner;
|
@FXML ProgressIndicator paymentSpinner;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class RegistrationView extends InitializableView<GridPane, RegistrationVi
|
||||||
public void handle(ActionEvent actionEvent) {
|
public void handle(ActionEvent actionEvent) {
|
||||||
getProperties().put("type", "CLOSE");
|
getProperties().put("type", "CLOSE");
|
||||||
try {
|
try {
|
||||||
parent.nextStep(RegistrationView.this);
|
wizard.nextStep(RegistrationView.this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,8 @@ public class RegistrationView extends InitializableView<GridPane, RegistrationVi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,8 +33,8 @@ import viewfx.view.FxmlView;
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.ViewLoader;
|
import viewfx.view.ViewLoader;
|
||||||
import viewfx.view.Wizard;
|
import viewfx.view.Wizard;
|
||||||
import viewfx.view.support.CachingViewLoader;
|
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
import viewfx.view.support.CachingViewLoader;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.*;
|
import javafx.scene.*;
|
||||||
|
@ -57,7 +57,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
||||||
@FXML ComboBox<Country> countryComboBox;
|
@FXML ComboBox<Country> countryComboBox;
|
||||||
@FXML Button completedButton, addAllEuroCountriesButton;
|
@FXML Button completedButton, addAllEuroCountriesButton;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
private final ViewLoader viewLoader;
|
private final ViewLoader viewLoader;
|
||||||
private final Stage primaryStage;
|
private final Stage primaryStage;
|
||||||
|
@ -86,8 +86,8 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -130,8 +130,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onCompleted() {
|
private void onCompleted() {
|
||||||
if (parent instanceof Wizard)
|
wizard.nextStep(this);
|
||||||
((Wizard) parent).nextStep(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class SeedWordsView extends InitializableView<GridPane, SeedWordsViewMode
|
||||||
@FXML Button completedButton;
|
@FXML Button completedButton;
|
||||||
@FXML TextArea seedWordsTextArea;
|
@FXML TextArea seedWordsTextArea;
|
||||||
|
|
||||||
private Wizard parent;
|
private Wizard wizard;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SeedWordsView(SeedWordsViewModel model) {
|
private SeedWordsView(SeedWordsViewModel model) {
|
||||||
|
@ -49,8 +49,8 @@ public class SeedWordsView extends InitializableView<GridPane, SeedWordsViewMode
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParent(Wizard parent) {
|
public void setWizard(Wizard wizard) {
|
||||||
this.parent = parent;
|
this.wizard = wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,7 +60,7 @@ public class SeedWordsView extends InitializableView<GridPane, SeedWordsViewMode
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onCompleted() {
|
private void onCompleted() {
|
||||||
parent.nextStep(this);
|
wizard.nextStep(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class AccountSetupWizard extends ActivatableView implements Wizard {
|
||||||
View view = viewLoader.load(viewClass);
|
View view = viewLoader.load(viewClass);
|
||||||
content.getChildren().setAll(view.getRoot());
|
content.getChildren().setAll(view.getRoot());
|
||||||
if (view instanceof Wizard.Step)
|
if (view instanceof Wizard.Step)
|
||||||
((Step) view).setParent(this);
|
((Step) view).setWizard(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ public abstract class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
navigation.removeListener(listener);
|
navigation.removeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createOffer(Coin amount, Fiat price) {
|
public void createOffer(Coin amount, Fiat price) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.price = price;
|
this.price = price;
|
||||||
|
@ -128,7 +127,26 @@ public abstract class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
tab.setContent(view.getRoot());
|
tab.setContent(view.getRoot());
|
||||||
tabPane.getTabs().add(tab);
|
tabPane.getTabs().add(tab);
|
||||||
offerBookView = (OfferBookView) view;
|
offerBookView = (OfferBookView) view;
|
||||||
offerBookView.setParent(this);
|
|
||||||
|
OfferActionHandler offerActionHandler = new OfferActionHandler() {
|
||||||
|
@Override
|
||||||
|
public void createOffer(Coin amount, Fiat price) {
|
||||||
|
TradeView.this.amount = amount;
|
||||||
|
TradeView.this.price = price;
|
||||||
|
TradeView.this.navigation.navigateTo(MainView.class, TradeView.this.getClass(),
|
||||||
|
CreateOfferView.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void takeOffer(Coin amount, Fiat price, Offer offer) {
|
||||||
|
TradeView.this.amount = amount;
|
||||||
|
TradeView.this.price = price;
|
||||||
|
TradeView.this.offer = offer;
|
||||||
|
TradeView.this.navigation.navigateTo(MainView.class, TradeView.this.getClass(),
|
||||||
|
TakeOfferView.class);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
offerBookView.setOfferActionHandler(offerActionHandler);
|
||||||
|
|
||||||
offerBookView.setDirection(direction);
|
offerBookView.setDirection(direction);
|
||||||
|
|
||||||
|
@ -177,5 +195,11 @@ public abstract class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
// update the navigation state
|
// update the navigation state
|
||||||
navigation.navigateTo(MainView.class, this.getClass(), OfferBookView.class);
|
navigation.navigateTo(MainView.class, this.getClass(), OfferBookView.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OfferActionHandler {
|
||||||
|
void createOffer(Coin amount, Fiat price);
|
||||||
|
|
||||||
|
void takeOffer(Coin amount, Fiat price, Offer offer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import viewfx.view.ChildView;
|
|
||||||
import viewfx.view.FxmlView;
|
import viewfx.view.FxmlView;
|
||||||
import viewfx.view.support.ActivatableViewAndModel;
|
import viewfx.view.support.ActivatableViewAndModel;
|
||||||
|
|
||||||
|
@ -61,8 +60,7 @@ import org.controlsfx.dialog.Dialog;
|
||||||
import static javafx.beans.binding.Bindings.createStringBinding;
|
import static javafx.beans.binding.Bindings.createStringBinding;
|
||||||
|
|
||||||
@FxmlView
|
@FxmlView
|
||||||
public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookViewModel>
|
public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookViewModel> {
|
||||||
implements ChildView<TradeView> {
|
|
||||||
|
|
||||||
@FXML CheckBox showOnlyMatchingCheckBox;
|
@FXML CheckBox showOnlyMatchingCheckBox;
|
||||||
@FXML TableView<OfferBookListItem> table;
|
@FXML TableView<OfferBookListItem> table;
|
||||||
|
@ -73,7 +71,6 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
@FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel, volumeFiatLabel,
|
@FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel, volumeFiatLabel,
|
||||||
extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel;
|
extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel;
|
||||||
|
|
||||||
private TradeView parent;
|
|
||||||
private ImageView expand;
|
private ImageView expand;
|
||||||
private ImageView collapse;
|
private ImageView collapse;
|
||||||
|
|
||||||
|
@ -85,6 +82,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
private final OverlayManager overlayManager;
|
private final OverlayManager overlayManager;
|
||||||
private final OptionalBtcValidator optionalBtcValidator;
|
private final OptionalBtcValidator optionalBtcValidator;
|
||||||
private final OptionalFiatValidator optionalFiatValidator;
|
private final OptionalFiatValidator optionalFiatValidator;
|
||||||
|
private TradeView.OfferActionHandler offerActionHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OfferBookView(OfferBookViewModel model,
|
OfferBookView(OfferBookViewModel model,
|
||||||
|
@ -163,7 +161,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
void createOffer() {
|
void createOffer() {
|
||||||
if (model.isRegistered()) {
|
if (model.isRegistered()) {
|
||||||
createOfferButton.setDisable(true);
|
createOfferButton.setDisable(true);
|
||||||
parent.createOffer(model.getAmountAsCoin(), model.getPriceAsCoin());
|
offerActionHandler.createOffer(model.getAmountAsCoin(), model.getPriceAsCoin());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
openSetupScreen();
|
openSetupScreen();
|
||||||
|
@ -222,7 +220,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
|
|
||||||
if (model.isRegistered()) {
|
if (model.isRegistered()) {
|
||||||
if (offer.getDirection() == Direction.BUY) {
|
if (offer.getDirection() == Direction.BUY) {
|
||||||
parent.takeOffer(model.getAmountAsCoin(), model.getPriceAsCoin(), offer);
|
offerActionHandler.takeOffer(model.getAmountAsCoin(), model.getPriceAsCoin(), offer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Popups.openInfoPopup("Not implemented yet",
|
Popups.openInfoPopup("Not implemented yet",
|
||||||
|
@ -350,8 +348,8 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
.getBankAccountType()));
|
.getBankAccountType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent(TradeView parent) {
|
public void setOfferActionHandler(TradeView.OfferActionHandler offerActionHandler) {
|
||||||
this.parent = parent;
|
this.offerActionHandler = offerActionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAmountColumnCellFactory() {
|
private void setAmountColumnCellFactory() {
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Bitsquare.
|
|
||||||
*
|
|
||||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package viewfx.view;
|
|
||||||
|
|
||||||
public interface ChildView<Parent extends View> extends View {
|
|
||||||
void setParent(Parent parent);
|
|
||||||
}
|
|
|
@ -20,7 +20,9 @@ package viewfx.view;
|
||||||
public interface Wizard extends View {
|
public interface Wizard extends View {
|
||||||
void nextStep(Step currentStep);
|
void nextStep(Step currentStep);
|
||||||
|
|
||||||
public interface Step extends ChildView<Wizard> {
|
public interface Step {
|
||||||
void hideWizardNavigation();
|
void hideWizardNavigation();
|
||||||
|
|
||||||
|
void setWizard(Wizard wizard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue