• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EasyDI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TokenResponse类代码示例发布时间:2022-05-23
下一篇:
Java InputStats类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap