Fix missing update in open trade screen (#244)

This commit is contained in:
Manfred Karrer 2014-11-13 01:43:48 +01:00
parent f92f7de138
commit 19e0763ff5
4 changed files with 23 additions and 24 deletions

View file

@ -103,5 +103,4 @@ public class ViewCB<T extends PresentationModel> implements Initializable {
"= " + navigationItem); "= " + navigationItem);
return null; return null;
} }
} }

View file

@ -80,14 +80,6 @@ public class TransactionsViewCB extends CachedViewCB {
setConfidenceColumnCellFactory(); setConfidenceColumnCellFactory();
} }
@Override
public void deactivate() {
super.deactivate();
for (TransactionsListItem transactionsListItem : transactionsListItems)
transactionsListItem.cleanup();
}
@Override @Override
public void activate() { public void activate() {
super.activate(); super.activate();
@ -100,10 +92,12 @@ public class TransactionsViewCB extends CachedViewCB {
table.setItems(transactionsListItems); table.setItems(transactionsListItems);
} }
@SuppressWarnings("EmptyMethod")
@Override @Override
public void terminate() { public void deactivate() {
super.terminate(); super.deactivate();
for (TransactionsListItem transactionsListItem : transactionsListItems)
transactionsListItem.cleanup();
} }

View file

@ -20,12 +20,12 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<TabPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.PortfolioViewCB" <TabPane fx:id="root" fx:controller="io.bitsquare.gui.main.portfolio.PortfolioViewCB"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" tabClosingPolicy="UNAVAILABLE"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<Tab fx:id="offersTab" text="Open offers" closable="false"/> <Tab fx:id="offersTab" text="Open offers"/>
<Tab fx:id="openTradesTab" text="Open trades" closable="false"/> <Tab fx:id="openTradesTab" text="Open trades"/>
<Tab fx:id="closedTradesTab" text="History" closable="false"/> <Tab fx:id="closedTradesTab" text="History"/>
</TabPane> </TabPane>

View file

@ -48,6 +48,8 @@ public class PortfolioViewCB extends CachedViewCB {
private ChangeListener<Tab> tabChangeListener; private ChangeListener<Tab> tabChangeListener;
@FXML Tab offersTab, openTradesTab, closedTradesTab; @FXML Tab offersTab, openTradesTab, closedTradesTab;
private Parent currentView;
private Tab currentTab;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -107,6 +109,7 @@ public class PortfolioViewCB extends CachedViewCB {
((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener); ((TabPane) root).getSelectionModel().selectedItemProperty().removeListener(tabChangeListener);
navigation.removeListener(navigationListener); navigation.removeListener(navigationListener);
currentTab = null;
} }
@SuppressWarnings("EmptyMethod") @SuppressWarnings("EmptyMethod")
@ -122,24 +125,27 @@ public class PortfolioViewCB extends CachedViewCB {
@Override @Override
protected Initializable loadView(Navigation.Item navigationItem) { protected Initializable loadView(Navigation.Item 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); super.loadView(navigationItem);
final ViewLoader loader = new ViewLoader(navigationItem); final ViewLoader loader = new ViewLoader(navigationItem);
Parent view = loader.load(); currentView = loader.load();
Tab tab = null;
switch (navigationItem) { switch (navigationItem) {
case OFFERS: case OFFERS:
tab = offersTab; currentTab = offersTab;
break; break;
case PENDING_TRADES: case PENDING_TRADES:
tab = openTradesTab; currentTab = openTradesTab;
break; break;
case CLOSED_TRADES: case CLOSED_TRADES:
tab = closedTradesTab; currentTab = closedTradesTab;
break; break;
} }
tab.setContent(view); currentTab.setContent(currentView);
((TabPane) root).getSelectionModel().select(tab); ((TabPane) root).getSelectionModel().select(currentTab);
Initializable childController = loader.getController(); Initializable childController = loader.getController();
((ViewCB) childController).setParent(this); ((ViewCB) childController).setParent(this);