mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-29 00:57:17 -04:00
Only load on demand
This commit is contained in:
parent
75a41ee7bc
commit
87d81f02bf
1 changed files with 7 additions and 4 deletions
|
@ -118,9 +118,10 @@ public abstract class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
|
|
||||||
private View loadView(Class<? extends View> viewClass) {
|
private View loadView(Class<? extends View> viewClass) {
|
||||||
TabPane tabPane = root;
|
TabPane tabPane = root;
|
||||||
View view = viewLoader.load(viewClass);
|
View view;
|
||||||
|
|
||||||
if (view instanceof OfferBookView && offerBookView == null) {
|
if (viewClass == OfferBookView.class && offerBookView == null) {
|
||||||
|
view = viewLoader.load(viewClass);
|
||||||
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
|
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
|
||||||
final Tab tab = new Tab(direction == Direction.BUY ? "Buy Bitcoin" : "Sell Bitcoin");
|
final Tab tab = new Tab(direction == Direction.BUY ? "Buy Bitcoin" : "Sell Bitcoin");
|
||||||
tab.setClosable(false);
|
tab.setClosable(false);
|
||||||
|
@ -159,7 +160,8 @@ public abstract class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
|
|
||||||
return offerBookView;
|
return offerBookView;
|
||||||
}
|
}
|
||||||
else if (view instanceof CreateOfferView && createOfferView == null) {
|
else if (viewClass == CreateOfferView.class && createOfferView == null) {
|
||||||
|
view = viewLoader.load(viewClass);
|
||||||
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
|
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
|
||||||
// in different graphs
|
// in different graphs
|
||||||
createOfferView = (CreateOfferView) view;
|
createOfferView = (CreateOfferView) view;
|
||||||
|
@ -172,7 +174,8 @@ public abstract class TradeView extends ActivatableView<TabPane, Void> {
|
||||||
tabPane.getSelectionModel().select(tab);
|
tabPane.getSelectionModel().select(tab);
|
||||||
return createOfferView;
|
return createOfferView;
|
||||||
}
|
}
|
||||||
else if (view instanceof TakeOfferView && takeOfferView == null && offer != null) {
|
else if (viewClass == TakeOfferView.class && takeOfferView == null && offer != null) {
|
||||||
|
view = viewLoader.load(viewClass);
|
||||||
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
|
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
|
||||||
// in different graphs
|
// in different graphs
|
||||||
takeOfferView = (TakeOfferView) view;
|
takeOfferView = (TakeOfferView) view;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue