Fix tx history update bug (#234)

This commit is contained in:
Manfred Karrer 2014-11-13 02:00:40 +01:00
parent a86add2d9b
commit e459ce8419
2 changed files with 14 additions and 17 deletions

View File

@ -44,6 +44,7 @@ public class FundsViewCB extends CachedViewCB {
private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;
private Tab currentTab;
@FXML Tab withdrawalTab, transactionsTab;
@ -103,12 +104,6 @@ public class FundsViewCB extends CachedViewCB {
navigation.removeListener(navigationListener);
}
@SuppressWarnings("EmptyMethod")
@Override
public void terminate() {
super.terminate();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Navigation
@ -118,19 +113,22 @@ public class FundsViewCB extends CachedViewCB {
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem);
// we want to get activate/deactivate called, so we remove the old view on tab change
if (currentTab != null)
currentTab.setContent(null);
final ViewLoader loader = new ViewLoader(navigationItem);
Node view = loader.load();
Tab tab = null;
switch (navigationItem) {
case WITHDRAWAL:
tab = withdrawalTab;
currentTab = withdrawalTab;
break;
case TRANSACTIONS:
tab = transactionsTab;
currentTab = transactionsTab;
break;
}
tab.setContent(view);
((TabPane) root).getSelectionModel().select(tab);
currentTab.setContent(view);
((TabPane) root).getSelectionModel().select(currentTab);
Initializable childController = loader.getController();
((ViewCB) childController).setParent(this);

View File

@ -44,12 +44,11 @@ public class PortfolioViewCB extends CachedViewCB {
private final Navigation navigation;
private final TradeManager tradeManager;
private Tab currentTab;
private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;
@FXML Tab offersTab, openTradesTab, closedTradesTab;
private Parent currentView;
private Tab currentTab;
///////////////////////////////////////////////////////////////////////////////////////////
@ -125,14 +124,14 @@ public class PortfolioViewCB extends CachedViewCB {
@Override
protected Initializable loadView(Navigation.Item navigationItem) {
super.loadView(navigationItem);
// we want to get activate/deactivate called, so we remove the old view on tab change
if (currentTab != null)
currentTab.setContent(null);
super.loadView(navigationItem);
final ViewLoader loader = new ViewLoader(navigationItem);
currentView = loader.load();
Node view = loader.load();
switch (navigationItem) {
case OFFERS:
currentTab = offersTab;
@ -144,7 +143,7 @@ public class PortfolioViewCB extends CachedViewCB {
currentTab = closedTradesTab;
break;
}
currentTab.setContent(currentView);
currentTab.setContent(view);
((TabPane) root).getSelectionModel().select(currentTab);
Initializable childController = loader.getController();
((ViewCB) childController).setParent(this);