update world in EMDNUpdater on reinit app
This commit is contained in:
@@ -15,9 +15,11 @@ import java.util.function.Consumer;
|
|||||||
public class EMDNUpdater {
|
public class EMDNUpdater {
|
||||||
private final static Logger LOG = LoggerFactory.getLogger(EMDNUpdater.class);
|
private final static Logger LOG = LoggerFactory.getLogger(EMDNUpdater.class);
|
||||||
private static EMDN emdn;
|
private static EMDN emdn;
|
||||||
|
private static MarketUpdater updater;
|
||||||
|
|
||||||
static void init(){
|
static void init(){
|
||||||
emdn = new EMDN(Main.SETTINGS.getEMDNSub(), new MarketUpdater(MainController.getWorld()));
|
updater = new MarketUpdater(MainController.getWorld());
|
||||||
|
emdn = new EMDN(Main.SETTINGS.getEMDNSub(), updater);
|
||||||
setActivate(Main.SETTINGS.getEMDNActive());
|
setActivate(Main.SETTINGS.getEMDNActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,16 +39,27 @@ public class EMDNUpdater {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setWorld(MarketModel world){
|
||||||
|
if (updater != null){
|
||||||
|
updater.setWorld(world);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class MarketUpdater implements Consumer<Message> {
|
private static class MarketUpdater implements Consumer<Message> {
|
||||||
private final StationUpdater updater;
|
private StationUpdater updater;
|
||||||
private final MarketModel world;
|
private MarketModel world;
|
||||||
|
|
||||||
public MarketUpdater(MarketModel world) {
|
public MarketUpdater(MarketModel world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.updater = new StationUpdater(world);
|
this.updater = new StationUpdater(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWorld(MarketModel world){
|
||||||
|
this.updater = new StationUpdater(world);
|
||||||
|
this.world = world;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(Message message) {
|
public void accept(Message message) {
|
||||||
if (world == null || message == null) return;
|
if (world == null || message == null) return;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import javafx.scene.layout.GridPane;
|
|||||||
import javafx.scene.layout.Priority;
|
import javafx.scene.layout.Priority;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
|
import ru.trader.EMDNUpdater;
|
||||||
import ru.trader.core.Engine;
|
import ru.trader.core.Engine;
|
||||||
import ru.trader.core.MarketFilter;
|
import ru.trader.core.MarketFilter;
|
||||||
import ru.trader.core.VendorFilter;
|
import ru.trader.core.VendorFilter;
|
||||||
@@ -368,6 +369,7 @@ public class Screeners {
|
|||||||
filterController.init();
|
filterController.init();
|
||||||
vFilterController.init();
|
vFilterController.init();
|
||||||
dbEditorController.init();
|
dbEditorController.init();
|
||||||
|
EMDNUpdater.setWorld(MainController.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user