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);
return null;
}
}

View file

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

View file

@ -20,12 +20,12 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<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.topAnchor="0.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" tabClosingPolicy="UNAVAILABLE"
xmlns:fx="http://javafx.com/fxml">
<Tab fx:id="offersTab" text="Open offers" closable="false"/>
<Tab fx:id="openTradesTab" text="Open trades" closable="false"/>
<Tab fx:id="closedTradesTab" text="History" closable="false"/>
<Tab fx:id="offersTab" text="Open offers"/>
<Tab fx:id="openTradesTab" text="Open trades"/>
<Tab fx:id="closedTradesTab" text="History"/>
</TabPane>

View file

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