From 4eb1b3994e42922e2385031f26d09878edac2b39 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Sun, 23 Nov 2014 05:17:09 +0100 Subject: [PATCH] Eliminate *CB suffixes on View variable names --- .../arbitrator/ArbitratorSettingsView.java | 8 +-- .../browser/ArbitratorBrowserView.java | 16 ++--- .../bitsquare/gui/main/trade/TradeView.java | 59 +++++++++---------- .../trade/createoffer/CreateOfferView.java | 2 +- .../main/trade/takeoffer/TakeOfferView.java | 2 +- 5 files changed, 43 insertions(+), 44 deletions(-) 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 051a8b741e..ec1a0b1114 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 @@ -37,7 +37,7 @@ public class ArbitratorSettingsView extends AbstractView { private final Navigation navigation; private final Stage primaryStage; - private ArbitratorRegistrationView arbitratorRegistrationViewCB; + private ArbitratorRegistrationView arbitratorRegistrationView; /////////////////////////////////////////////////////////////////////////////////////////// @@ -60,7 +60,7 @@ public class ArbitratorSettingsView extends AbstractView { @Override protected View loadView(Navigation.Item navigationItem) { ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl(), false); - arbitratorRegistrationViewCB = (ArbitratorRegistrationView) loaded.controller; + arbitratorRegistrationView = (ArbitratorRegistrationView) loaded.controller; final Stage stage = new Stage(); stage.setTitle("Arbitrator"); @@ -76,7 +76,7 @@ public class ArbitratorSettingsView extends AbstractView { stage.setScene(scene); stage.show(); - return arbitratorRegistrationViewCB; + return arbitratorRegistrationView; } @@ -92,7 +92,7 @@ public class ArbitratorSettingsView extends AbstractView { @FXML public void onArbitratorEdit() { loadView(Navigation.Item.ARBITRATOR_REGISTRATION); - arbitratorRegistrationViewCB.setEditMode(true); + arbitratorRegistrationView.setEditMode(true); } } 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 1e60f48bf3..c293a2616b 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 @@ -50,7 +50,7 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator private final List allArbitrators = new ArrayList<>(); private Arbitrator currentArbitrator; - private ArbitratorProfileView arbitratorProfileViewCB; + private ArbitratorProfileView arbitratorProfileView; private int index = -1; @FXML Button prevButton, nextButton, selectButton, closeButton; @@ -92,11 +92,11 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator final ViewLoader loader = new ViewLoader(getClass().getResource(item.getFxmlUrl())); try { final Node view = loader.load(); - arbitratorProfileViewCB = loader.getController(); - arbitratorProfileViewCB.setParentController(this); + arbitratorProfileView = loader.getController(); + arbitratorProfileView.setParentController(this); ((Pane) root).getChildren().set(0, view); - return arbitratorProfileViewCB; + return arbitratorProfileView; } catch (IOException e) { e.printStackTrace(); } @@ -112,7 +112,7 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator protected View loadView(Navigation.Item navigationItem) { ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl()); ((Pane) root).getChildren().set(0, loaded.view); - return arbitratorProfileViewCB = (ArbitratorProfileView) loaded.controller; + return arbitratorProfileView = (ArbitratorProfileView) loaded.controller; } /////////////////////////////////////////////////////////////////////////////////////////// @@ -131,7 +131,7 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator if (!allArbitrators.isEmpty()) { index = 0; currentArbitrator = allArbitrators.get(index); - arbitratorProfileViewCB.applyArbitrator(currentArbitrator); + arbitratorProfileView.applyArbitrator(currentArbitrator); checkButtonState(); } } @@ -150,7 +150,7 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator if (index > 0) { index--; currentArbitrator = allArbitrators.get(index); - arbitratorProfileViewCB.applyArbitrator(currentArbitrator); + arbitratorProfileView.applyArbitrator(currentArbitrator); } checkButtonState(); } @@ -160,7 +160,7 @@ public class ArbitratorBrowserView extends ActivatableView implements Arbitrator if (index < allArbitrators.size() - 1) { index++; currentArbitrator = allArbitrators.get(index); - arbitratorProfileViewCB.applyArbitrator(currentArbitrator); + arbitratorProfileView.applyArbitrator(currentArbitrator); } checkButtonState(); } diff --git a/src/main/java/io/bitsquare/gui/main/trade/TradeView.java b/src/main/java/io/bitsquare/gui/main/trade/TradeView.java index a0b1cb24e6..e4f6a90a0a 100644 --- a/src/main/java/io/bitsquare/gui/main/trade/TradeView.java +++ b/src/main/java/io/bitsquare/gui/main/trade/TradeView.java @@ -44,11 +44,11 @@ import org.slf4j.LoggerFactory; public class TradeView extends ActivatableView { private static final Logger log = LoggerFactory.getLogger(TradeView.class); - private OfferBookView offerBookViewCB; - private CreateOfferView createOfferViewCB; - private TakeOfferView takeOfferViewCB; - private Node createOfferView; - private Node takeOfferView; + private OfferBookView offerBookView; + private CreateOfferView createOfferView; + private TakeOfferView takeOfferView; + private Node createOfferRoot; + private Node takeOfferRoot; private Navigation.Listener listener; private Navigation.Item navigationItem; private Direction direction; @@ -101,9 +101,9 @@ public class TradeView extends ActivatableView { change.next(); List removedTabs = change.getRemoved(); if (removedTabs.size() == 1) { - if (removedTabs.get(0).getContent().equals(createOfferView)) + if (removedTabs.get(0).getContent().equals(createOfferRoot)) onCreateOfferViewRemoved(); - else if (removedTabs.get(0).getContent().equals(takeOfferView)) + else if (removedTabs.get(0).getContent().equals(takeOfferRoot)) onTakeOfferViewRemoved(); } }); @@ -139,49 +139,48 @@ public class TradeView extends ActivatableView { @Override protected View loadView(Navigation.Item navigationItem) { TabPane tabPane = (TabPane) root; - if (navigationItem == Navigation.Item.OFFER_BOOK && offerBookViewCB == null) { + if (navigationItem == Navigation.Item.OFFER_BOOK && offerBookView == null) { // Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens. ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl(), false); final Tab tab = new Tab(direction == Direction.BUY ? "Buy Bitcoin" : "Sell Bitcoin"); tab.setClosable(false); tab.setContent(loaded.view); tabPane.getTabs().add(tab); - offerBookViewCB = (OfferBookView) loaded.controller; - offerBookViewCB.setParent(this); + offerBookView = (OfferBookView) loaded.controller; + offerBookView.setParent(this); - offerBookViewCB.setDirection(direction); - // offerBookViewCB.setNavigationListener(n -> loadView(n)); + offerBookView.setDirection(direction); - return offerBookViewCB; + return offerBookView; } - else if (navigationItem == Navigation.Item.CREATE_OFFER && createOfferViewCB == null) { + else if (navigationItem == Navigation.Item.CREATE_OFFER && createOfferView == null) { // CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times // in different graphs ViewLoader.Item loaded = viewLoader.load(navigationItem.getFxmlUrl(), false); - createOfferView = loaded.view; - createOfferViewCB = (CreateOfferView) loaded.controller; - createOfferViewCB.initWithData(direction, amount, price); + createOfferRoot = loaded.view; + createOfferView = (CreateOfferView) loaded.controller; + createOfferView.initWithData(direction, amount, price); final Tab tab = new Tab("Create offer"); - createOfferViewCB.configCloseHandlers(tab.closableProperty()); - tab.setContent(createOfferView); + createOfferView.configCloseHandlers(tab.closableProperty()); + tab.setContent(createOfferRoot); tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); - return createOfferViewCB; + return createOfferView; } - else if (navigationItem == Navigation.Item.TAKE_OFFER && takeOfferViewCB == null && + else if (navigationItem == Navigation.Item.TAKE_OFFER && takeOfferView == null && offer != null) { // CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times // in different graphs ViewLoader.Item loaded = viewLoader.load(Navigation.Item.TAKE_OFFER.getFxmlUrl(), false); - takeOfferView = loaded.view; - takeOfferViewCB = (TakeOfferView) loaded.controller; - takeOfferViewCB.initWithData(direction, amount, offer); + takeOfferRoot = loaded.view; + takeOfferView = (TakeOfferView) loaded.controller; + takeOfferView.initWithData(direction, amount, offer); final Tab tab = new Tab("Take offer"); - takeOfferViewCB.configCloseHandlers(tab.closableProperty()); - tab.setContent(takeOfferView); + takeOfferView.configCloseHandlers(tab.closableProperty()); + tab.setContent(takeOfferRoot); tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); - return takeOfferViewCB; + return takeOfferView; } return null; } @@ -197,15 +196,15 @@ public class TradeView extends ActivatableView { /////////////////////////////////////////////////////////////////////////////////////////// private void onCreateOfferViewRemoved() { - createOfferViewCB = null; - offerBookViewCB.enableCreateOfferButton(); + createOfferView = null; + offerBookView.enableCreateOfferButton(); // update the navigation state navigation.navigationTo(Navigation.Item.MAIN, navigationItem, Navigation.Item.OFFER_BOOK); } private void onTakeOfferViewRemoved() { - takeOfferViewCB = null; + takeOfferView = null; // 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 8b694ca1ec..69f37aa39a 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 @@ -139,7 +139,7 @@ public class CreateOfferView extends ActivatableViewAndModel { } /////////////////////////////////////////////////////////////////////////////////////////// - // Public methods (called form other views/CB) + // Public methods (called form other views) /////////////////////////////////////////////////////////////////////////////////////////// public void initWithData(Direction direction, Coin amount, Offer offer) {