From 68a1140a6dc0eefc96ea3336cf8db6f277fb3e58 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Sun, 23 Nov 2014 07:06:51 +0100 Subject: [PATCH] Polish whitespace and field ordering in view classes --- .../gui/ActivatableViewAndModel.java | 2 - .../gui/main/account/AccountView.java | 6 +- .../arbitrator/ArbitratorSettingsView.java | 8 +-- .../browser/ArbitratorBrowserView.java | 16 +++-- .../profile/ArbitratorProfileView.java | 24 ++------ .../ArbitratorRegistrationView.java | 38 +++++------- .../changepassword/ChangePasswordView.java | 9 --- .../account/content/fiat/FiatAccountView.java | 11 +--- .../account/content/irc/IrcAccountView.java | 19 +----- .../content/password/PasswordView.java | 16 +---- .../registration/RegistrationView.java | 12 +--- .../restrictions/RestrictionsView.java | 33 +---------- .../content/seedwords/SeedWordsView.java | 8 +-- .../account/settings/AccountSettingsView.java | 9 +-- .../account/setup/AccountSetupWizard.java | 17 ++---- .../bitsquare/gui/main/funds/FundsView.java | 11 +--- .../funds/transactions/TransactionsView.java | 16 +---- .../main/funds/withdrawal/WithdrawalView.java | 19 ++---- .../io/bitsquare/gui/main/msg/MsgView.java | 13 ----- .../gui/main/portfolio/PortfolioView.java | 12 +--- .../portfolio/closed/ClosedTradesView.java | 12 +--- .../gui/main/portfolio/offer/OffersView.java | 13 +---- .../portfolio/pending/PendingTradesView.java | 45 ++++++-------- .../gui/main/settings/SettingsView.java | 17 ++---- .../settings/application/PreferencesView.java | 11 +--- .../bitsquare/gui/main/trade/TradeView.java | 11 ---- .../trade/createoffer/CreateOfferView.java | 51 ++++++---------- .../main/trade/offerbook/OfferBookView.java | 58 ++++++------------- .../main/trade/takeoffer/TakeOfferView.java | 54 ++++++----------- 29 files changed, 146 insertions(+), 425 deletions(-) diff --git a/src/main/java/io/bitsquare/gui/ActivatableViewAndModel.java b/src/main/java/io/bitsquare/gui/ActivatableViewAndModel.java index 77dd28f87e..3fca65258b 100644 --- a/src/main/java/io/bitsquare/gui/ActivatableViewAndModel.java +++ b/src/main/java/io/bitsquare/gui/ActivatableViewAndModel.java @@ -31,7 +31,6 @@ public abstract class ActivatableViewAndModel { + @FXML Tab accountSettingsTab, arbitratorSettingsTab; + private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; - @FXML Tab accountSettingsTab, arbitratorSettingsTab; - private final ViewLoader viewLoader; private final Navigation navigation; - @Inject private AccountView(AccountViewModel model, ViewLoader viewLoader, Navigation navigation) { super(model); @@ -46,7 +45,6 @@ public class AccountView extends ActivatableView { this.navigation = navigation; } - @Override public void initialize() { navigationListener = navigationItems -> { diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsView.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsView.java index 0837bc88e7..e20d7bc88c 100644 --- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsView.java +++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/ArbitratorSettingsView.java @@ -33,13 +33,12 @@ import javafx.stage.Stage; // TODO Arbitration is very basic yet public class ArbitratorSettingsView extends AbstractView { + private ArbitratorRegistrationView arbitratorRegistrationView; + private final ViewLoader viewLoader; private final Navigation navigation; private final Stage primaryStage; - private ArbitratorRegistrationView arbitratorRegistrationView; - - @Inject private ArbitratorSettingsView(ViewLoader viewLoader, Navigation navigation, Stage primaryStage) { this.viewLoader = viewLoader; @@ -47,8 +46,6 @@ public class ArbitratorSettingsView extends AbstractView { this.primaryStage = primaryStage; } - - @Override protected View loadView(Navigation.Item navigationItem) { ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl(), false); @@ -71,7 +68,6 @@ public class ArbitratorSettingsView extends AbstractView { return arbitratorRegistrationView; } - @FXML public void onArbitratorRegistration() { loadView(Navigation.Item.ARBITRATOR_REGISTRATION); diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserView.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserView.java index aa670125cc..329f11ffc6 100644 --- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserView.java +++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/browser/ArbitratorBrowserView.java @@ -42,20 +42,19 @@ import javafx.stage.Stage; // TODO Arbitration is very basic yet public class ArbitratorBrowserView extends ActivatableView implements ArbitratorListener { - private final ViewLoader viewLoader; - private final AccountSettings accountSettings; - private final Persistence persistence; - private final MessageService messageService; - - private final List allArbitrators = new ArrayList<>(); + @FXML Button prevButton, nextButton, selectButton, closeButton; + @FXML Pane arbitratorProfile; private Arbitrator currentArbitrator; private ArbitratorProfileView arbitratorProfileView; private int index = -1; - @FXML Button prevButton, nextButton, selectButton, closeButton; - @FXML Pane arbitratorProfile; + private final List allArbitrators = new ArrayList<>(); + private final ViewLoader viewLoader; + private final AccountSettings accountSettings; + private final Persistence persistence; + private final MessageService messageService; @Inject public ArbitratorBrowserView(ViewLoader viewLoader, AccountSettings accountSettings, Persistence persistence, @@ -66,7 +65,6 @@ public class ArbitratorBrowserView extends ActivatableView implement this.messageService = messageService; } - @Override public void initialize() { messageService.addArbitratorListener(this); diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileView.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileView.java index 08fdc33d77..5f86c7dd10 100644 --- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileView.java +++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/profile/ArbitratorProfileView.java @@ -31,33 +31,22 @@ import javafx.scene.control.*; // TODO Arbitration is very basic yet public class ArbitratorProfileView extends AbstractView { - private final Preferences preferences; + @FXML Label nameLabel; + @FXML TextArea descriptionTextArea; + @FXML TextField nameTextField, languagesTextField, reputationTextField, feeTextField, methodsTextField, + passiveServiceFeeTextField, idVerificationsTextField, webPageTextField, maxTradeVolumeTextField; + private final Preferences preferences; private final Persistence persistence; private final BSFormatter formatter; - - @FXML Label nameLabel; - @FXML TextField nameTextField, languagesTextField, reputationTextField, - feeTextField, methodsTextField, passiveServiceFeeTextField, - idVerificationsTextField, webPageTextField, maxTradeVolumeTextField; - @FXML TextArea descriptionTextArea; - - @Inject - public ArbitratorProfileView(Preferences preferences, Persistence persistence, - BSFormatter formatter) { + public ArbitratorProfileView(Preferences preferences, Persistence persistence, BSFormatter formatter) { this.preferences = preferences; this.persistence = persistence; - - // ApplicationPreferences persistedApplicationPreferences = (ApplicationPreferences) storage - // .read(settings.getClass().getName()); - // settings.applyPersistedSettings(persistedApplicationPreferences); this.formatter = formatter; } - - public void applyArbitrator(Arbitrator arbitrator) { if (arbitrator != null && arbitrator.getIdType() != null) { String name = ""; @@ -85,6 +74,5 @@ public class ArbitratorProfileView extends AbstractView { descriptionTextArea.setText(arbitrator.getDescription()); } } - } diff --git a/src/main/java/io/bitsquare/gui/main/account/arbitrator/registration/ArbitratorRegistrationView.java b/src/main/java/io/bitsquare/gui/main/account/arbitrator/registration/ArbitratorRegistrationView.java index fffcaea04e..1c8bc053e8 100644 --- a/src/main/java/io/bitsquare/gui/main/account/arbitrator/registration/ArbitratorRegistrationView.java +++ b/src/main/java/io/bitsquare/gui/main/account/arbitrator/registration/ArbitratorRegistrationView.java @@ -58,36 +58,34 @@ import de.jensd.fx.fontawesome.AwesomeIcon; // TODO Arbitration is very basic yet public class ArbitratorRegistrationView extends ActivatableView { - private final Persistence persistence; - private final WalletService walletService; - private final MessageService messageService; - private final User user; - private final BSFormatter formatter; - private Arbitrator arbitrator = new Arbitrator(); - private boolean isEditMode; - - private List languageList = new ArrayList<>(); - - private List methodList = new ArrayList<>(); - - private List idVerificationList = new ArrayList<>(); - private Arbitrator.ID_TYPE idType; - @FXML Accordion accordion; - @FXML TitledPane profileTitledPane, paySecurityDepositTitledPane; + @FXML TextArea descriptionTextArea; @FXML Button saveProfileButton, paymentDoneButton; @FXML Label nameLabel, infoLabel, copyIcon, confirmationLabel; @FXML ComboBox languageComboBox; @FXML ComboBox idTypeComboBox; @FXML ComboBox methodsComboBox; + @FXML ConfidenceProgressIndicator progressIndicator; @FXML ComboBox idVerificationsComboBox; + @FXML TitledPane profileTitledPane, paySecurityDepositTitledPane; @FXML TextField nameTextField, idTypeTextField, languagesTextField, maxTradeVolumeTextField, passiveServiceFeeTextField, minPassiveServiceFeeTextField, arbitrationFeeTextField, minArbitrationFeeTextField, methodsTextField, idVerificationsTextField, webPageTextField, securityDepositAddressTextField, balanceTextField; - @FXML TextArea descriptionTextArea; - @FXML ConfidenceProgressIndicator progressIndicator; + private boolean isEditMode; + private Arbitrator.ID_TYPE idType; + + private List languageList = new ArrayList<>(); + private List methodList = new ArrayList<>(); + private List idVerificationList = new ArrayList<>(); + private Arbitrator arbitrator = new Arbitrator(); + + private final Persistence persistence; + private final WalletService walletService; + private final MessageService messageService; + private final User user; + private final BSFormatter formatter; @Inject private ArbitratorRegistrationView(Persistence persistence, WalletService walletService, @@ -99,7 +97,6 @@ public class ArbitratorRegistrationView extends ActivatableView implements Wizard.Step { - private static final Logger log = LoggerFactory.getLogger(ChangePasswordView.class); - @FXML HBox buttonsHBox; @FXML Button saveButton, skipButton; @FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField; private Wizard parent; - @Inject private ChangePasswordView(ChangePasswordViewModel model) { super(model); } - @Override public void initialize() { passwordField.textProperty().bindBidirectional(model.passwordField); @@ -66,7 +59,6 @@ public class ChangePasswordView extends InitializableView typesComboBox; @FXML ComboBox currencyComboBox; - private final OverlayManager overlayManager; - private Wizard parent; + private final OverlayManager overlayManager; @Inject - FiatAccountView(FiatAccountViewModel model, OverlayManager overlayManager) { + public FiatAccountView(FiatAccountViewModel model, OverlayManager overlayManager) { super(model); - this.overlayManager = overlayManager; } - @Override public void initialize() { typesComboBox.setItems(model.getAllTypes()); @@ -98,8 +95,6 @@ public class FiatAccountView extends ActivatableViewAndModel (selectionComboBox.getSelectionModel().selectedIndexProperty().get() == -1), selectionComboBox.getSelectionModel().selectedIndexProperty())); - } } diff --git a/src/main/java/io/bitsquare/gui/main/account/content/irc/IrcAccountView.java b/src/main/java/io/bitsquare/gui/main/account/content/irc/IrcAccountView.java index 6473d5040f..23a286905b 100644 --- a/src/main/java/io/bitsquare/gui/main/account/content/irc/IrcAccountView.java +++ b/src/main/java/io/bitsquare/gui/main/account/content/irc/IrcAccountView.java @@ -36,16 +36,11 @@ import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.util.Callback; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/* -Just temporary for giving the user a possibility to test the app via simulating the bank transfer in a IRC chat. +/** + * Just temporary for giving the user a possibility to test the app via simulating the bank transfer in a IRC chat. */ public class IrcAccountView extends ActivatableViewAndModel implements Wizard.Step { - private static final Logger log = LoggerFactory.getLogger(IrcAccountView.class); - @FXML HBox buttonsHBox; @FXML InputTextField ircNickNameTextField; @FXML Button saveButton; @@ -54,13 +49,11 @@ public class IrcAccountView extends ActivatableViewAndModel { if (newValue != null) @@ -201,7 +190,5 @@ public class IrcAccountView extends ActivatableViewAndModel implements Wizard.Step { - private static final Logger log = LoggerFactory.getLogger(PasswordView.class); - @FXML HBox buttonsHBox; @FXML Button saveButton, skipButton; @FXML PasswordField oldPasswordField, passwordField, repeatedPasswordField; private Wizard parent; - - @Inject private PasswordView(PasswordViewModel model) { super(model); } - - @Override public void initialize() { passwordField.textProperty().bindBidirectional(model.passwordField); @@ -58,8 +49,6 @@ public class PasswordView extends InitializableView saveButton.disableProperty().bind(model.saveButtonDisabled); } - - @Override public void setParent(Wizard parent) { this.parent = parent; @@ -70,15 +59,12 @@ public class PasswordView extends InitializableView buttonsHBox.getChildren().remove(skipButton); } - - @FXML private void onSaved() { if (model.requestSavePassword()) parent.nextStep(this); else - // TODO use validating passwordTF - log.debug(model.getErrorMessage()); + log.debug(model.getErrorMessage()); // TODO use validating passwordTF } @FXML diff --git a/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationView.java b/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationView.java index d7e58e91b8..126f964677 100644 --- a/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationView.java +++ b/src/main/java/io/bitsquare/gui/main/account/content/registration/RegistrationView.java @@ -43,8 +43,6 @@ import org.controlsfx.dialog.Dialog; public class RegistrationView extends InitializableView implements Wizard.Step { - private final OverlayManager overlayManager; - @FXML TextField feeTextField; @FXML AddressTextField addressTextField; @FXML BalanceTextField balanceTextField; @@ -54,7 +52,7 @@ public class RegistrationView extends InitializableView countryComboBox; @FXML Button completedButton, addAllEuroCountriesButton; - private final ViewLoader viewLoader; - private final Stage primaryStage; - private Wizard parent; - + private final ViewLoader viewLoader; + private final Stage primaryStage; @Inject private RestrictionsView(RestrictionsViewModel model, ViewLoader viewLoader, Stage primaryStage) { @@ -67,8 +65,6 @@ public class RestrictionsView extends ActivatableViewAndModel implements Wizard.Step { - private Wizard parent; - @FXML Button completedButton; @FXML TextArea seedWordsTextArea; - + private Wizard parent; @Inject private SeedWordsView(SeedWordsViewModel model) { super(model); } - - @Override public void initialize() { seedWordsTextArea.setText(model.seedWords.get()); @@ -59,8 +55,6 @@ public class SeedWordsView extends InitializableView { @@ -111,8 +107,6 @@ public class AccountSettingsView extends ActivatableViewAndModel { navigation.removeListener(listener); } - - @Override protected View loadView(Navigation.Item navigationItem) { ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl()); @@ -123,8 +117,6 @@ public class AccountSettingsView extends ActivatableViewAndModel { return child; } - - private void selectMainMenuButton(Navigation.Item item) { switch (item) { case SEED_WORDS: @@ -149,6 +141,7 @@ public class AccountSettingsView extends ActivatableViewAndModel { } } + class MenuItem extends ToggleButton { MenuItem(Navigation navigation, String title, Navigation.Item navigationItem, diff --git a/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupWizard.java b/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupWizard.java index 1fff0cd6ad..d2dab08742 100644 --- a/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupWizard.java +++ b/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupWizard.java @@ -36,30 +36,23 @@ import javafx.scene.control.*; import javafx.scene.image.*; import javafx.scene.layout.*; -/** - * This UI is not cached as it is normally only needed once. - */ public class AccountSetupWizard extends ActivatableView implements Wizard { - private WizardItem seedWords, password, fiatAccount, restrictions, registration; - private Navigation.Listener listener; - @FXML VBox leftVBox; @FXML AnchorPane content; + private WizardItem seedWords, password, fiatAccount, restrictions, registration; + private Navigation.Listener listener; + private final ViewLoader viewLoader; private final Navigation navigation; - - @Inject private AccountSetupWizard(ViewLoader viewLoader, Navigation navigation) { this.viewLoader = viewLoader; this.navigation = navigation; } - - @Override public void initialize() { listener = navigationItems -> { @@ -130,7 +123,6 @@ public class AccountSetupWizard extends ActivatableView implements Wizard { navigation.removeListener(listener); } - @Override public void nextStep(Step currentStep) { if (currentStep instanceof SeedWordsView) { @@ -159,8 +151,6 @@ public class AccountSetupWizard extends ActivatableView implements Wizard { } } - - @Override protected View loadView(Navigation.Item navigationItem) { ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl()); @@ -172,6 +162,7 @@ public class AccountSetupWizard extends ActivatableView implements Wizard { } } + class WizardItem extends HBox { private final ImageView imageView; diff --git a/src/main/java/io/bitsquare/gui/main/funds/FundsView.java b/src/main/java/io/bitsquare/gui/main/funds/FundsView.java index ba9122b13b..1cd3c9143d 100644 --- a/src/main/java/io/bitsquare/gui/main/funds/FundsView.java +++ b/src/main/java/io/bitsquare/gui/main/funds/FundsView.java @@ -31,25 +31,21 @@ import javafx.scene.control.*; public class FundsView extends ActivatableViewAndModel { + @FXML Tab withdrawalTab, transactionsTab; + private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; private Tab currentTab; - @FXML Tab withdrawalTab, transactionsTab; - private final ViewLoader viewLoader; private final Navigation navigation; - - @Inject FundsView(ViewLoader viewLoader, Navigation navigation) { this.viewLoader = viewLoader; this.navigation = navigation; } - - @Override public void initialize() { navigationListener = navigationItems -> { @@ -83,8 +79,6 @@ public class FundsView extends ActivatableViewAndModel { navigation.removeListener(navigationListener); } - - @Override protected View loadView(Navigation.Item navigationItem) { // we want to get activate/deactivate called, so we remove the old view on tab change @@ -104,6 +98,5 @@ public class FundsView extends ActivatableViewAndModel { root.getSelectionModel().select(currentTab); return (View) loaded.controller; } - } diff --git a/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java b/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java index b69ac33795..516757edcb 100644 --- a/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java +++ b/src/main/java/io/bitsquare/gui/main/funds/transactions/TransactionsView.java @@ -38,15 +38,14 @@ import javafx.util.Callback; public class TransactionsView extends ActivatableViewAndModel { - private final WalletService walletService; - private final BSFormatter formatter; - private ObservableList transactionsListItems; - @FXML TableView table; @FXML TableColumn dateColumn, addressColumn, amountColumn, typeColumn, confidenceColumn; + private ObservableList transactionsListItems; + private final WalletService walletService; + private final BSFormatter formatter; @Inject private TransactionsView(WalletService walletService, BSFormatter formatter) { @@ -54,8 +53,6 @@ public class TransactionsView extends ActivatableViewAndModel { this.formatter = formatter; } - - @Override public void initialize() { table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); @@ -81,10 +78,6 @@ public class TransactionsView extends ActivatableViewAndModel { transactionsListItem.cleanup(); } - - - - private void openTxDetails(TransactionsListItem item) { // TODO Open popup with details view log.debug("openTxDetails " + item); @@ -93,8 +86,6 @@ public class TransactionsView extends ActivatableViewAndModel { "This will open a details popup but that is not implemented yet."); } - - private void setAddressColumnCellFactory() { addressColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue())); addressColumn.setCellFactory( @@ -154,6 +145,5 @@ public class TransactionsView extends ActivatableViewAndModel { } }); } - } diff --git a/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java b/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java index cd41bd3181..52598dc149 100644 --- a/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java +++ b/src/main/java/io/bitsquare/gui/main/funds/withdrawal/WithdrawalView.java @@ -55,18 +55,16 @@ import org.jetbrains.annotations.NotNull; public class WithdrawalView extends ActivatableViewAndModel { + @FXML TableView table; + @FXML Button addNewAddressButton; + @FXML TextField withdrawFromTextField, withdrawToTextField, amountTextField; + @FXML TableColumn labelColumn, addressColumn, balanceColumn, copyColumn, + confidenceColumn; + private final WalletService walletService; private final BSFormatter formatter; private final ObservableList addressList = FXCollections.observableArrayList(); - @FXML TableView table; - @FXML TableColumn labelColumn, addressColumn, balanceColumn, copyColumn, - confidenceColumn; - @FXML Button addNewAddressButton; - @FXML TextField withdrawFromTextField, withdrawToTextField, amountTextField; - - - @Inject private WithdrawalView(WalletService walletService, BSFormatter formatter) { this.walletService = walletService; @@ -120,8 +118,6 @@ public class WithdrawalView extends ActivatableViewAndModel { item.cleanup(); } - - @FXML public void onWithdraw() { Coin amount = formatter.parseToCoin(amountTextField.getText()); @@ -178,8 +174,6 @@ public class WithdrawalView extends ActivatableViewAndModel { } - - private void fillList() { addressList.clear(); List addressEntryList = walletService.getAddressEntryList(); @@ -189,7 +183,6 @@ public class WithdrawalView extends ActivatableViewAndModel { .collect(Collectors.toList())); } - private void setLabelColumnCellFactory() { labelColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue())); labelColumn.setCellFactory(new Callback, diff --git a/src/main/java/io/bitsquare/gui/main/msg/MsgView.java b/src/main/java/io/bitsquare/gui/main/msg/MsgView.java index c2893a14bc..6cfe8a977f 100644 --- a/src/main/java/io/bitsquare/gui/main/msg/MsgView.java +++ b/src/main/java/io/bitsquare/gui/main/msg/MsgView.java @@ -23,18 +23,5 @@ import javax.inject.Inject; // will be probably only used for arbitration communication, will be renamed and the icon changed public class MsgView extends AbstractView { - - - @Inject - private MsgView() { - } - - - - - - - - } diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java b/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java index 798fad9cf4..f72191760d 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/PortfolioView.java @@ -32,27 +32,23 @@ import javafx.scene.control.*; public class PortfolioView extends ActivatableViewAndModel { + @FXML Tab offersTab, openTradesTab, closedTradesTab; + private Tab currentTab; private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; - @FXML Tab offersTab, openTradesTab, closedTradesTab; - private final ViewLoader viewLoader; private final Navigation navigation; private final TradeManager tradeManager; - - @Inject - PortfolioView(ViewLoader viewLoader, Navigation navigation, TradeManager tradeManager) { + public PortfolioView(ViewLoader viewLoader, Navigation navigation, TradeManager tradeManager) { this.viewLoader = viewLoader; this.navigation = navigation; this.tradeManager = tradeManager; } - - @Override public void initialize() { navigationListener = navigationItems -> { @@ -90,8 +86,6 @@ public class PortfolioView extends ActivatableViewAndModel currentTab = null; } - - @Override protected View loadView(Navigation.Item navigationItem) { diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesView.java b/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesView.java index e1b014f675..3d82dad19b 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesView.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/closed/ClosedTradesView.java @@ -30,19 +30,15 @@ import javafx.util.Callback; public class ClosedTradesView extends ActivatableViewAndModel { + @FXML TableView table; @FXML TableColumn priceColumn, amountColumn, volumeColumn, directionColumn, dateColumn, tradeIdColumn; - @FXML TableView table; - - @Inject - private ClosedTradesView(ClosedTradesViewModel model) { + public ClosedTradesView(ClosedTradesViewModel model) { super(model); } - - @Override public void initialize() { setTradeIdColumnCellFactory(); @@ -61,8 +57,6 @@ public class ClosedTradesView extends ActivatableViewAndModel new ReadOnlyObjectWrapper<>(offerListItem.getValue())); tradeIdColumn.setCellFactory( diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersView.java b/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersView.java index 580b029803..01b4d139cc 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersView.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/offer/OffersView.java @@ -32,19 +32,15 @@ import javafx.util.Callback; public class OffersView extends ActivatableViewAndModel { + @FXML TableView table; @FXML TableColumn priceColumn, amountColumn, volumeColumn, directionColumn, dateColumn, offerIdColumn, removeItemColumn; - @FXML TableView table; - - @Inject - private OffersView(OffersViewModel model) { + public OffersView(OffersViewModel model) { super(model); } - - @Override public void initialize() { setOfferIdColumnCellFactory(); @@ -64,7 +60,6 @@ public class OffersView extends ActivatableViewAndModel new ReadOnlyObjectWrapper<>(offerListItem.getValue())); offerIdColumn.setCellFactory( @@ -135,7 +128,6 @@ public class OffersView extends ActivatableViewAndModel new ReadOnlyObjectWrapper<>(offer.getValue())); amountColumn.setCellFactory( @@ -215,7 +207,6 @@ public class OffersView extends ActivatableViewAndModel new ReadOnlyObjectWrapper<>(offerListItem.getValue())); removeItemColumn.setCellFactory( diff --git a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java index 5546ba547e..da88e9531b 100644 --- a/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java +++ b/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java @@ -54,29 +54,21 @@ import javafx.util.StringConverter; public class PendingTradesView extends ActivatableViewAndModel { - private ChangeListener selectedItemChangeListener; - private ListChangeListener listChangeListener; - private ChangeListener txIdChangeListener; - private ChangeListener offererStateChangeListener; - private ChangeListener takerStateChangeListener; - private ChangeListener faultChangeListener; - private final Navigation navigation; - - @FXML ScrollPane scrollPane; @FXML GridPane gridPane; - @FXML TitledGroupBg titledGroupBg, paymentsGroupBg, summaryGroupBg, withdrawGroupBg; + @FXML ScrollPane scrollPane; @FXML ProcessStepBar processBar; + @FXML TxIdTextField txIdTextField; + @FXML TableView table; + @FXML InputTextField withdrawAddressTextField; + @FXML InfoDisplay infoDisplay, paymentsInfoDisplay, summaryInfoDisplay; + @FXML Button confirmPaymentReceiptButton, paymentsButton, withdrawButton; + @FXML TitledGroupBg titledGroupBg, paymentsGroupBg, summaryGroupBg, withdrawGroupBg; + @FXML TextFieldWithCopyIcon fiatAmountTextField, holderNameTextField, secondaryIdTextField, primaryIdTextField; + @FXML TextField statusTextField, paymentMethodTextField, btcTradeAmountTextField, fiatTradeAmountTextField, + feesTextField, securityDepositTextField, withdrawAmountTextField; @FXML Label statusLabel, txIdLabel, paymentMethodLabel, fiatAmountLabel, holderNameLabel, primaryIdLabel, secondaryIdLabel, btcTradeAmountLabel, fiatTradeAmountLabel, feesLabel, securityDepositLabel, withdrawAmountLabel, withdrawAddressLabel; - @FXML TextField statusTextField, paymentMethodTextField, btcTradeAmountTextField, fiatTradeAmountTextField, - feesTextField, securityDepositTextField, withdrawAmountTextField; - @FXML InputTextField withdrawAddressTextField; - @FXML TxIdTextField txIdTextField; - @FXML InfoDisplay infoDisplay, paymentsInfoDisplay, summaryInfoDisplay; - @FXML Button confirmPaymentReceiptButton, paymentsButton, withdrawButton; - @FXML TextFieldWithCopyIcon fiatAmountTextField, holderNameTextField, secondaryIdTextField, primaryIdTextField; - @FXML TableView table; @FXML TableColumn priceColumn; @FXML TableColumn tradeVolumeColumn; @@ -85,17 +77,22 @@ public class PendingTradesView extends ActivatableViewAndModel dateColumn; @FXML TableColumn tradeAmountColumn; + private ChangeListener selectedItemChangeListener; + private ListChangeListener listChangeListener; + private ChangeListener txIdChangeListener; + private ChangeListener offererStateChangeListener; + private ChangeListener takerStateChangeListener; + private ChangeListener faultChangeListener; + private final Navigation navigation; @Inject - PendingTradesView(PendingTradesViewModel model, Navigation navigation) { + public PendingTradesView(PendingTradesViewModel model, Navigation navigation) { super(model); this.navigation = navigation; } - - @Override public void initialize() { setTradeIdColumnCellFactory(); @@ -167,8 +164,6 @@ public class PendingTradesView extends ActivatableViewAndModel scrollPane.setVvalue(visible ? scrollPane.getVmax() : 0)); } - - private void setTradeIdColumnCellFactory() { idColumn.setCellFactory( new Callback, TableCell>() { @@ -540,7 +532,6 @@ public class PendingTradesView extends ActivatableViewAndModelforTableColumn( new StringConverter() { diff --git a/src/main/java/io/bitsquare/gui/main/settings/SettingsView.java b/src/main/java/io/bitsquare/gui/main/settings/SettingsView.java index 1a545fc7e3..ebc063e6de 100644 --- a/src/main/java/io/bitsquare/gui/main/settings/SettingsView.java +++ b/src/main/java/io/bitsquare/gui/main/settings/SettingsView.java @@ -32,26 +32,22 @@ import javafx.scene.control.*; public class SettingsView extends ActivatableViewAndModel { - private final ViewLoader viewLoader; - private final Navigation navigation; - private Preferences preferences; + @FXML Tab preferencesTab, networkSettingsTab; + private Preferences preferences; private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; - @FXML Tab preferencesTab, networkSettingsTab; - - + private final ViewLoader viewLoader; + private final Navigation navigation; @Inject - SettingsView(ViewLoader viewLoader, Navigation navigation, Preferences preferences) { + public SettingsView(ViewLoader viewLoader, Navigation navigation, Preferences preferences) { this.viewLoader = viewLoader; this.navigation = navigation; this.preferences = preferences; } - - @Override public void initialize() { navigationListener = navigationItems -> { @@ -91,8 +87,6 @@ public class SettingsView extends ActivatableViewAndModel navigation.removeListener(navigationListener); } - - @Override protected View loadView(Navigation.Item navigationItem) { ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl()); @@ -111,6 +105,5 @@ public class SettingsView extends ActivatableViewAndModel root.getSelectionModel().select(tab); return (View) loaded.controller; } - } diff --git a/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java b/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java index 642bacc28f..98ec8457ef 100644 --- a/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java +++ b/src/main/java/io/bitsquare/gui/main/settings/application/PreferencesView.java @@ -25,23 +25,16 @@ import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.layout.*; -/** - * This UI is not cached as it is normally only needed once. - */ public class PreferencesView extends ActivatableViewAndModel { @FXML ComboBox btcDenominationComboBox; @FXML CheckBox useAnimationsCheckBox, useEffectsCheckBox; - - @Inject - private PreferencesView(PreferencesViewModel model) { + public PreferencesView(PreferencesViewModel model) { super(model); } - - @Override public void doActivate() { btcDenominationComboBox.setItems(model.getBtcDenominationItems()); @@ -58,8 +51,6 @@ public class PreferencesView extends ActivatableViewAndModel { private final ViewLoader viewLoader; private final Navigation navigation; - - protected TradeView(ViewLoader viewLoader, Navigation navigation) { this.viewLoader = viewLoader; this.navigation = navigation; } - - @Override protected void initialize() { direction = (this instanceof BuyView) ? Direction.BUY : Direction.SELL; @@ -121,8 +117,6 @@ public class TradeView extends ActivatableView { navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.TAKE_OFFER); } - - @Override protected View loadView(Navigation.Item navigationItem) { TabPane tabPane = root; @@ -172,10 +166,6 @@ public class TradeView extends ActivatableView { return null; } - - - - private void onCreateOfferViewRemoved() { createOfferView = null; offerBookView.enableCreateOfferButton(); @@ -190,6 +180,5 @@ public class TradeView extends ActivatableView { // update the navigation state navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.OFFER_BOOK); } - } diff --git a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferView.java b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferView.java index 7e4cf403b4..6aecc7424c 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferView.java +++ b/src/main/java/io/bitsquare/gui/main/trade/createoffer/CreateOfferView.java @@ -67,40 +67,34 @@ import static javafx.beans.binding.Bindings.createStringBinding; // priceAmountHBox is too large after redesign as to be used as layoutReference. public class CreateOfferView extends ActivatableViewAndModel { - private final Navigation navigation; - private final OverlayManager overlayManager; - - private BooleanProperty tabIsClosable; - - private boolean detailsVisible; - private boolean advancedScreenInited; - - private ImageView expand; - private ImageView collapse; - private PopOver totalToPayInfoPopover; - - @FXML InfoDisplay advancedInfoDisplay, fundsBoxInfoDisplay; @FXML ScrollPane scrollPane; @FXML ImageView imageView; + @FXML AddressTextField addressTextField; + @FXML BalanceTextField balanceTextField; + @FXML ProgressIndicator placeOfferSpinner; + @FXML InfoDisplay advancedInfoDisplay, fundsBoxInfoDisplay; @FXML TitledGroupBg priceAmountPane, payFundsPane, showDetailsPane; - @FXML Label buyLabel, addressLabel, - balanceLabel, totalToPayLabel, totalToPayInfoIconLabel, - bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel, - acceptedCountriesLabel, acceptedCountriesLabelIcon, acceptedLanguagesLabel, acceptedLanguagesLabelIcon, - acceptedArbitratorsLabel, acceptedArbitratorsLabelIcon, amountBtcLabel, - priceFiatLabel, volumeFiatLabel, minAmountBtcLabel, priceDescriptionLabel, volumeDescriptionLabel, - placeOfferSpinnerInfoLabel; @FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, placeOfferButton; - @FXML InputTextField amountTextField, minAmountTextField, priceTextField, volumeTextField; @FXML TextField acceptedArbitratorsTextField, totalToPayTextField, bankAccountTypeTextField, bankAccountCurrencyTextField, bankAccountCountyTextField, acceptedCountriesTextField, acceptedLanguagesTextField; - @FXML AddressTextField addressTextField; - @FXML BalanceTextField balanceTextField; - @FXML ProgressIndicator placeOfferSpinner; + @FXML Label buyLabel, addressLabel, balanceLabel, totalToPayLabel, totalToPayInfoIconLabel, bankAccountTypeLabel, + bankAccountCurrencyLabel, bankAccountCountyLabel, acceptedCountriesLabel, acceptedCountriesLabelIcon, + acceptedLanguagesLabel, acceptedLanguagesLabelIcon, acceptedArbitratorsLabel, + acceptedArbitratorsLabelIcon, amountBtcLabel, priceFiatLabel, volumeFiatLabel, minAmountBtcLabel, + priceDescriptionLabel, volumeDescriptionLabel, + placeOfferSpinnerInfoLabel; + private ImageView expand; + private ImageView collapse; + private PopOver totalToPayInfoPopover; + private BooleanProperty tabIsClosable; + private boolean detailsVisible; + private boolean advancedScreenInited; + private final Navigation navigation; + private final OverlayManager overlayManager; @Inject private CreateOfferView(CreateOfferViewModel model, Navigation navigation, @@ -110,8 +104,6 @@ public class CreateOfferView extends ActivatableViewAndModel InputTextField.hideErrorMessageDisplay()); diff --git a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookView.java b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookView.java index f309783f33..beb143c10f 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookView.java +++ b/src/main/java/io/bitsquare/gui/main/trade/offerbook/OfferBookView.java @@ -53,36 +53,31 @@ import org.controlsfx.dialog.Dialog; 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 OfferBookView extends ActivatableViewAndModel implements - ChildView { +public class OfferBookView extends ActivatableViewAndModel + implements ChildView { + + @FXML CheckBox showOnlyMatchingCheckBox; + @FXML TableView table; + @FXML InputTextField volumeTextField, amountTextField, priceTextField; + @FXML Button createOfferButton, showAdvancedSettingsButton, openCountryFilterButton, openPaymentMethodsFilterButton; + @FXML TableColumn priceColumn, amountColumn, volumeColumn, directionColumn, + countryColumn, bankAccountTypeColumn; + @FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel, volumeFiatLabel, + extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel; + + private TradeView parent; + private ImageView expand; + private ImageView collapse; + + private boolean detailsVisible; + private boolean advancedScreenInited; + private final Navigation navigation; private final OverlayManager overlayManager; private final OptionalBtcValidator optionalBtcValidator; private final OptionalFiatValidator optionalFiatValidator; - private boolean detailsVisible; - private boolean advancedScreenInited; - - private ImageView expand; - private ImageView collapse; - - @FXML CheckBox showOnlyMatchingCheckBox; - @FXML Label amountBtcLabel, priceDescriptionLabel, priceFiatLabel, volumeDescriptionLabel, - volumeFiatLabel, extendedButton1Label, extendedButton2Label, extendedCheckBoxLabel; - @FXML InputTextField volumeTextField, amountTextField, priceTextField; - @FXML TableView table; - @FXML Button createOfferButton, showAdvancedSettingsButton, openCountryFilterButton, openPaymentMethodsFilterButton; - @FXML TableColumn priceColumn, amountColumn, volumeColumn, - directionColumn, countryColumn, bankAccountTypeColumn; - - private TradeView parent; - - @Inject OfferBookView(OfferBookViewModel model, Navigation navigation, @@ -97,8 +92,6 @@ public class OfferBookView extends ActivatableViewAndModel actions = new ArrayList<>(); @@ -309,8 +294,6 @@ public class OfferBookView extends ActivatableViewAndModel new ReadOnlyObjectWrapper<>(offer.getValue())); amountColumn.setCellFactory( diff --git a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.java b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.java index 2b9e0e569d..b571c923d3 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.java +++ b/src/main/java/io/bitsquare/gui/main/trade/takeoffer/TakeOfferView.java @@ -64,40 +64,32 @@ import org.controlsfx.dialog.Dialog; public class TakeOfferView extends ActivatableViewAndModel { - private final Navigation navigation; - private final OverlayManager overlayManager; - private BooleanProperty tabIsClosable; + @FXML ScrollPane scrollPane; + @FXML ImageView imageView; + @FXML InputTextField amountTextField; + @FXML AddressTextField addressTextField; + @FXML BalanceTextField balanceTextField; + @FXML ProgressIndicator takeOfferSpinner; + @FXML InfoDisplay advancedInfoDisplay, fundsBoxInfoDisplay; + @FXML TitledGroupBg priceAmountPane, payFundsPane, showDetailsPane; + @FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, takeOfferButton; + @FXML TextField priceTextField, volumeTextField, acceptedArbitratorsTextField, totalToPayTextField, + bankAccountTypeTextField, bankAccountCurrencyTextField, bankAccountCountyTextField, + acceptedCountriesTextField, acceptedLanguagesTextField; + @FXML Label buyLabel, addressLabel, amountRangeTextField, balanceLabel, totalToPayLabel, totalToPayInfoIconLabel, + bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel, acceptedCountriesLabel, + acceptedLanguagesLabel, acceptedArbitratorsLabel, amountBtcLabel, priceDescriptionLabel, + volumeDescriptionLabel, takeOfferSpinnerInfoLabel; + private BooleanProperty tabIsClosable; private boolean detailsVisible; private boolean advancedScreenInited; - private ImageView expand; private ImageView collapse; private PopOver totalToPayInfoPopover; - @FXML InfoDisplay advancedInfoDisplay, fundsBoxInfoDisplay; - @FXML ScrollPane scrollPane; - @FXML ImageView imageView; - @FXML TitledGroupBg priceAmountPane, payFundsPane, showDetailsPane; - @FXML Label buyLabel, addressLabel, amountRangeTextField, - balanceLabel, totalToPayLabel, totalToPayInfoIconLabel, - bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel, - acceptedCountriesLabel, acceptedLanguagesLabel, - acceptedArbitratorsLabel, amountBtcLabel, - priceDescriptionLabel, volumeDescriptionLabel, takeOfferSpinnerInfoLabel; - @FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, takeOfferButton; - - @FXML InputTextField amountTextField; - @FXML TextField priceTextField, volumeTextField, acceptedArbitratorsTextField, - totalToPayTextField, - bankAccountTypeTextField, - bankAccountCurrencyTextField, bankAccountCountyTextField, acceptedCountriesTextField, - acceptedLanguagesTextField; - @FXML AddressTextField addressTextField; - @FXML BalanceTextField balanceTextField; - @FXML ProgressIndicator takeOfferSpinner; - - + private final Navigation navigation; + private final OverlayManager overlayManager; @Inject private TakeOfferView(TakeOfferViewModel model, Navigation navigation, @@ -108,15 +100,12 @@ public class TakeOfferView extends ActivatableViewAndModel InputTextField.hideErrorMessageDisplay());