本文整理汇总了Java中com.airhacks.afterburner.injection.Injector.setConfigurationSource方法的典型用法代码示例。如果您正苦于以下问题:Java Injector.setConfigurationSource方法的具体用法?Java Injector.setConfigurationSource怎么用?Java Injector.setConfigurationSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.airhacks.afterburner.injection.Injector
的用法示例。
在下文中一共展示了Injector.setConfigurationSource方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Platform.setImplicitExit(false);
Injector.setConfigurationSource(config::getInjectionValue);
Injector.setLogger(s -> LOG.info(s));
Injector.setModelOrService(Logger.class, LOG);
Injector.setModelOrService(HueSenseConfig.class, config);
Injector.setModelOrService(DBManager.class, dbMan);
Injector.setModelOrService(DataStore.class, store);
Injector.setModelOrService(HueComm.class, hue);
Injector.setModelOrService(LanComm.class, lan);
Injector.setModelOrService(MailService.class, mailServ);
ConnectingView connView = new ConnectingView();
Scene scene = new Scene(connView.getView());
scene.setFill(Color.WHITE);
stage.setTitle("HueSense");
final String uri = Thread.currentThread().getContextClassLoader().getResource("global.css").toExternalForm();
scene.getStylesheets().add(uri);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.setResizable(false);
stage.centerOnScreen();
UIUtils.setIcon(stage);
stage.show();
hue.startConnecting();
}
示例2: start
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
KeyService service = new KeyService();
// Have to read a default file to populate the main view
service.readKeybindings(new File(System.getProperty("user.dir") + "\\hotkey_default.xml"));
Map<Object, Object> injectorSource = new HashMap<Object, Object>();
injectorSource.put("keyService", service);
Injector.setConfigurationSource(injectorSource::get);
FXMLView view = new MainView();
stage.setTitle("Tree of Savior key binder");
stage.setScene(new Scene(view.getView()));
stage.show();
// Open dialog to select xml file
MainPresenter presenter = (MainPresenter)view.getPresenter();
presenter.menubarController.openHotkeyFile();
}
示例3: start
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Injector.setConfigurationSource(t -> Optional.ofNullable(getParameters().getNamed().get(t)).orElse(defaultsParameters.get(t)));
Logger sysoutLogger = new SysoutLogger();
Injector.setModelOrService(Logger.class, sysoutLogger);
final EmbeddedWebServer server = (EmbeddedWebServer) Injector.instantiateModelOrService(EmbeddedWebServer.class);
server.start();
stage.setOnCloseRequest((e) -> {
try {
server.stop();
} catch (Exception ex) {
// ignored
}
});
BrowserView main = new BrowserView();
Scene scene = new Scene(main.getView(), 400, 300);
stage.setScene(scene);
stage.show();
}
示例4: start
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
/*
* Properties of any type can be easily injected.
*/
LocalDate date = LocalDate.of(4242, Month.JULY, 21);
Map<Object, Object> customProperties = new HashMap<>();
customProperties.put("date", date);
/*
* any function which accepts an Object as key and returns
* and return an Object as result can be used as source.
*/
Injector.setConfigurationSource(customProperties::get);
System.setProperty("happyEnding", " Enjoy the flight!");
DashboardView appView = new DashboardView();
Scene scene = new Scene(appView.getView());
stage.setTitle("followme.fx");
final String uri = getClass().getResource("app.css").toExternalForm();
scene.getStylesheets().add(uri);
stage.setScene(scene);
stage.show();
}
示例5: start
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
Locale.setDefault(settings.getLanguage());
systemTrayInUse = settings.getUseSystemTray();
// Starts the Executors thread
executor.start();
// Dependency injection with afterburner.fx
//
// key is name of injected variable & value is injected object
Map<String, Object> customProperties = new HashMap<>();
customProperties.put("client", client); // This corresponds to the line @Inject Client client; in the Presenters
customProperties.put("settings", settings);
customProperties.put("executor", executor);
customProperties.put("eventBus", eventBus);
Injector.setConfigurationSource(customProperties::get);
RootView rootView = new RootView();
Scene scene = new Scene(rootView.getView());
final String cssMain = getClass().getResource("main.css").toExternalForm();
final String cssScroll = getClass().getResource("scrollbars.css").toExternalForm();
scene.getStylesheets().add(cssMain);
scene.getStylesheets().add(cssScroll);
scene.getStylesheets().add("bootstrapfx.css");
primaryStage.setTitle("Cypher");
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icon.png")));
primaryStage.setScene(scene);
if (settings.getMaximized()) {
primaryStage.setMaximized(true);
} else {
if (settings.getLastWindowPosX() != -1 && settings.getLastWindowPosY() != -1) {
primaryStage.setX(settings.getLastWindowPosX());
primaryStage.setY(settings.getLastWindowPosY());
}
if (settings.getLastWindowWidth() != -1 && settings.getLastWindowHeight() != -1) {
primaryStage.setWidth(settings.getLastWindowWidth());
primaryStage.setHeight(settings.getLastWindowHeight());
}
}
primaryStage.setMinWidth(MIN_WINDOW_WIDTH);
primaryStage.setMinHeight(MIN_WINDOW_HEIGHT);
// addSystemTray sets its own "onCloseRequest" on the primaryStage
if (useSystemTray()) {
addSystemTray(primaryStage);
} else {
primaryStage.setOnCloseRequest(event -> {
exit(primaryStage);
});
}
primaryStage.show();
}
示例6: initializeInject
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
private void initializeInject() {
ActionPlaces places = new ActionPlaces(
CreateFilePlace.create(),
CreateFolderPlace.create(),
RenameFilePlace.create(),
RenameFolderPlace.create());
Map<Object, Object> customProperties = new HashMap<>();
customProperties.put("project", project);
customProperties.put("executorCommand", executorCommand);
customProperties.put("errorProcess", errorProcess);
customProperties.put("places", places);
Injector.setConfigurationSource(customProperties::get);
}
示例7: initializeInjection
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
private void initializeInjection() {
Map<Object, Object> customProperties = new HashMap<>();
customProperties.put("createProjectPlace", createProjectPlace);
customProperties.put("startPlace", startPlace);
customProperties.put("projects", Projects.create());
Injector.setConfigurationSource(customProperties::get);
}
示例8: initializeInjection
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
private void initializeInjection() {
Map<Object, Object> customProperties = new HashMap<>();
customProperties.put("startPlace", this);
Injector.setConfigurationSource(customProperties::get);
}