Remove static access to BitsquareUI#getPrimaryStage

- Bind BitsquareUI#start's primaryStage for DI
 - Statically inject primaryStage directly into Help and Popups
This commit is contained in:
Chris Beams 2014-11-04 18:55:17 +01:00
parent f6368754b9
commit 6f27c5ce29
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
9 changed files with 54 additions and 43 deletions

View file

@ -34,6 +34,8 @@ import com.google.inject.name.Names;
import java.util.Properties;
import javafx.stage.Stage;
import net.tomp2p.connection.Ports;
import org.slf4j.Logger;
@ -45,13 +47,15 @@ import scala.concurrent.duration.Duration;
public class BitsquareModule extends AbstractBitsquareModule {
private static final Logger log = LoggerFactory.getLogger(BitsquareModule.class);
private final Stage primaryStage;
public BitsquareModule() {
this(ConfigLoader.loadConfig());
public BitsquareModule(Stage primaryStage) {
this(primaryStage, ConfigLoader.loadConfig());
}
public BitsquareModule(Properties properties) {
public BitsquareModule(Stage primaryStage, Properties properties) {
super(properties);
this.primaryStage = primaryStage;
}
@Override
@ -89,7 +93,7 @@ public class BitsquareModule extends AbstractBitsquareModule {
}
protected GuiModule guiModule() {
return new GuiModule(properties);
return new GuiModule(properties, primaryStage);
}
@Override