本文整理汇总了Java中eu.lestard.easydi.EasyDI类的典型用法代码示例。如果您正苦于以下问题:Java EasyDI类的具体用法?Java EasyDI怎么用?Java EasyDI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EasyDI类属于eu.lestard.easydi包,在下文中一共展示了EasyDI类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
EasyDI context = new EasyDI();
ViewLoader.setDependencyInjector(context::getInstance);
final Parent root = ViewLoader.load(MainView.class);
stage.setScene(new Scene(root, 500, 100));
stage.sizeToScene();
stage.show();
timer.schedule(new TimerTask() {
@Override
public void run() {
final LocalDateTime now = LocalDateTime.now();
Dispatcher.getInstance().dispatchOnFxThread(new UpdateAction(now));
}
}, 1l, 1000l);
}
开发者ID:lestard,项目名称:FluxFX,代码行数:23,代码来源:App.java
示例2: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("TodoMVVM");
EasyDI diContext = new EasyDI();
diContext.markAsSingleton(TodoItemStore.class);
MvvmFX.setCustomDependencyInjector(diContext::getInstance);
final Parent parent = FluentViewLoader.fxmlView(MainView.class).load().getView();
final Scene scene = new Scene(parent);
stage.setScene(scene);
stage.show();
}
开发者ID:lestard,项目名称:todomvcFX,代码行数:16,代码来源:MvvmfxApp.java
示例3: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
EasyDI context = new EasyDI();
ViewLoader.setDependencyInjector(context::getInstance);
final Parent parent = ViewLoader.load(MainView.class);
stage.setScene(new Scene(parent));
stage.show();
}
开发者ID:lestard,项目名称:todomvcFX,代码行数:12,代码来源:FluxFxApp.java
示例4: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
EasyDI context = new EasyDI();
ViewLoader.setDependencyInjector(context::getInstance);
final Parent parent = ViewLoader.load(MainView.class);
stage.setScene(new Scene(parent, 500, 600));
stage.show();
}
开发者ID:lestard,项目名称:FluxFX,代码行数:12,代码来源:App.java
示例5: main
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
public static void main(String...args){
EasyDI easyDI = new EasyDI();
easyDI.bindInterface(WaterSupply.class, WaterTank.class);
easyDI.bindProvider(BeanContainer.class, () -> {
final BeanContainer beanContainer = new BeanContainer();
beanContainer.setAmount(100);
return beanContainer;
});
CoffeeMachine coffeeMachine = easyDI.getInstance(CoffeeMachine.class);
coffeeMachine.makeCoffee();
}
开发者ID:lestard,项目名称:EasyDI,代码行数:15,代码来源:CoffeeApp.java
示例6: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
EasyDI easyDI = new EasyDI();
MvvmFX.setCustomDependencyInjector(easyDI::getInstance);
final ViewTuple<MainView, MainViewModel> viewTuple = FluentViewLoader.fxmlView(MainView.class).load();
primaryStage.setScene(new Scene(viewTuple.getView(), 600, 600));
primaryStage.show();
}
开发者ID:lestard,项目名称:nonogram,代码行数:12,代码来源:Launcher.java
示例7: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
EasyDI context = new EasyDI();
final String pathToMainFxml = "/Main.fxml";
final URL mainFxmlUrl = this.getClass().getResource(pathToMainFxml);
if(mainFxmlUrl == null) {
throw new IllegalStateException("Can't find Main.fxml file with path: " + pathToMainFxml);
}
FXMLLoader fxmlLoader = new FXMLLoader(mainFxmlUrl);
fxmlLoader.setControllerFactory(context::getInstance);
fxmlLoader.load();
Parent root = fxmlLoader.getRoot();
stage.setScene(new Scene(root));
stage.show();
}
开发者ID:lestard,项目名称:todomvcFX,代码行数:26,代码来源:ReferenceApp.java
示例8: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
EasyDI context = new EasyDI();
EventSource<Action> actionStream = new EventSource<>();
context.bindInstance(EventStream.class, actionStream);
context.bindInstance(EventSource.class, actionStream);
ViewLoader.setDependencyInjector(context::getInstance);
final Parent root = ViewLoader.load(CounterView.class);
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
开发者ID:lestard,项目名称:FluxFX,代码行数:19,代码来源:CounterApp.java
示例9: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("ColorPuzzleFX");
EasyDI context = new EasyDI();
context.bindInterface(Solver.class, BogoSolver.class);
MvvmFX.setCustomDependencyInjector(context::getInstance);
final ViewTuple<MainView, MainViewModel> viewTuple = FluentViewLoader.fxmlView(MainView.class).load();
stage.setScene(new Scene(viewTuple.getView()));
stage.sizeToScene();
stage.show();
}
开发者ID:lestard,项目名称:ColorPuzzleFX,代码行数:18,代码来源:App.java
示例10: start
import eu.lestard.easydi.EasyDI; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
// Setup the initial state
final AppState initialState = AppState.create();
// Setup the ReduxFX-store passing the initialState and the update-function
final ReduxFXStore<AppState> store = new ReduxFXStore<>(initialState, Updater::update, new LoggingMiddleware<>());
// Create an instance of ReduxFxml
ReduxFxml<AppState> reduxFxml = ReduxFxml.create(store);
// Setup dependency injection context
final EasyDI diContext = new EasyDI();
// When an instance of Selector needs to be injected, use the reduxFxml instance
diContext.bindInstance(Selector.class, reduxFxml);
// When an instance of Dispatcher needs to be injected, use the reduxFxml instance
diContext.bindInstance(Dispatcher.class, reduxFxml);
// ViewLoad is a util that can load Fxml hierarchies without having to handling path URLs.
// Instead it is based naming convention and class types.
// Tell ViewLoader how dependency injection should be done
ViewLoader.setDependencyInjector(diContext::getInstance);
// ViewLoader.load() loads the FXML-file and sets up the controller
final Parent root = ViewLoader.load(MainView.class);
// Notice: Using the ViewLoader is optional and not required to use ReduxFxml.
// You can also use the standard FxmlLoader like this:
/*
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setControllerFactory(diContext::getInstance);
fxmlLoader.setLocation(this.getClass().getResource("/com/netopyr/reduxfx/examples/fxml/view/MainView.fxml"));
final Parent root = fxmlLoader.load();
*/
// Setup the stage and show it
primaryStage.setScene(new Scene(root));
primaryStage.setTitle("FXML Example");
primaryStage.show();
}
开发者ID:netopyr,项目名称:reduxfx,代码行数:50,代码来源:FxmlExample.java
注:本文中的eu.lestard.easydi.EasyDI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论