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

Java Injector类代码示例

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

本文整理汇总了Java中com.airhacks.afterburner.injection.Injector的典型用法代码示例。如果您正苦于以下问题:Java Injector类的具体用法?Java Injector怎么用?Java Injector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Injector类属于com.airhacks.afterburner.injection包,在下文中一共展示了Injector类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();

}
 
开发者ID:dainesch,项目名称:HueSense,代码行数:35,代码来源:Launcher.java


示例2: onCloseRequest

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
private void onCloseRequest() {
    final char borderSign = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__BORDER_SIGN).charAt(0);
    final String message = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__MESSAGE_STOP);
    final String title = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__TITLE);
    LoggerFacade.getDefault().message(borderSign, 80, message + title);
    
    try {
        TestdataFacade.getDefault().shutdown();
    } catch (InterruptedException e) {
    }
    
    Injector.forgetAll();
    DatabaseFacade.getDefault().shutdown();
    
    final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:21,代码来源:TestdataApplication.java


示例3: onCloseRequest

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
private void onCloseRequest() {
    // afterburner.fx
    Injector.forgetAll();
    
    // Database
    DatabaseFacade.getDefault().shutdown();
    
    // Message
    final char borderSign = Properties.getPropertyForApplication(KEY__APPLICATION__BORDER_SIGN).charAt(0);
    final String message = Properties.getPropertyForApplication(KEY__APPLICATION__MESSAGE_STOP);
    final String title = Properties.getPropertyForApplication(KEY__APPLICATION__TITLE)
            + Properties.getPropertyForApplication(KEY__APPLICATION__VERSION);
    LoggerFacade.getDefault().message(borderSign, 80, String.format(message, title));
    
    // Timer
    final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:22,代码来源:StartApplication.java


示例4: onCloseRequest

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
private void onCloseRequest() {
    // afterburner.fx
    Injector.forgetAll();
    
    // Database
    DatabaseFacade.getDefault().shutdown();
    
    // Message
    final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
    final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
    final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION);
    LoggerFacade.getDefault().message(borderSign, 80, String.format(message, title));
    
    // Timer
    final PauseTransition pt = new PauseTransition(DURATION__125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
开发者ID:Naoghuman,项目名称:Project-Templates,代码行数:21,代码来源:StartApplication.java


示例5: onCloseRequest

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
private void onCloseRequest() {
    // afterburner.fx
    Injector.forgetAll();
    
    // Database
    DatabaseFacade.INSTANCE.shutdown();
    
    // Message
    final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
    final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
    final String title = this.getProperty(KEY__APPLICATION__TITLE);
    LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title));
    
    // Timer
    final PauseTransition pt = new PauseTransition(DURATION__125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:21,代码来源:StartApplication.java


示例6: onCloseRequest

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
private void onCloseRequest() {
    // afterburner.fx
    Injector.forgetAll();
    
    // Database
    DatabaseFacade.INSTANCE.shutdown();
    
    // Message
    final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
    final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
    final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION);
    LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title));
    
    // Timer
    final PauseTransition pt = new PauseTransition(DURATION__125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:21,代码来源:StartApplication.java


示例7: retrieveScheduledSessions

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
@Override
public ObservableList<Session> retrieveScheduledSessions() {
    if (!isAuthenticated()) {
        throw new IllegalStateException("An authenticated user must be available when calling this method.");
    }

    if (scheduledSessions == null) {
        OTNNotifications notifications = Injector.instantiateModelOrService(OTNNotifications.class);
        // stop recreating notifications, after the list of scheduled sessions is fully retrieved
        scheduledSessions = internalRetrieveScheduledSessions(notifications::stopPreloadingScheduledSessions);
        // start recreating notifications as soon as the scheduled sessions are being retrieved
        notifications.preloadScheduledSessions();
        
    }

    return scheduledSessions;
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:18,代码来源:BaseService.java


示例8: init

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
@Override
public void init() {

    // Config logging
    OTNLogging.config();

    // start service data preloading as soon as possible
    Injector.instantiateModelOrService(Service.class);

    // check if the app starts from a notification
    otnNotifications = Injector.instantiateModelOrService(OTNNotifications.class);
    otnNotifications.findNotificationIdAtStartup(getParameters().getNamed());

    for (AppView view : OTNView.registry.getViews()) {
        view.registerView(this);
    }
    
    addLayerFactory(MENU_LAYER, () -> {
        SidePopupView sidePopupView = new SidePopupView(drawerPresenter.getDrawer());
        drawerPresenter.setSidePopupView(sidePopupView);
        return sidePopupView;
    });
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:24,代码来源:OTNApplication.java


示例9: DrawerManager

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
public DrawerManager(MobileApplication app, Node header, Collection<AppView> views) {
    super(app, header, views);
    
    service = Injector.instantiateModelOrService(Service.class);
    
    for (Node item : getDrawer().getItems()) {
        if (item instanceof NavigationDrawer.ViewItem && 
                ((NavigationDrawer.ViewItem) item).getViewName().equals(EDITION_VIEW.getId())) {
            item.disableProperty().bind(service.userProperty().isNull());
            break;
        }
    }
    
    service.userProperty().addListener((obs, ov, nv) -> avatar.setImage(getAvatarImage()));
    avatar.setImage(getAvatarImage());
}
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:17,代码来源:AppViewManager.java


示例10: 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();
}
 
开发者ID:RiceKab,项目名称:tos-keybinds,代码行数:20,代码来源:Launch.java


示例11: 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();
}
 
开发者ID:McFoggy,项目名称:fxnav-interceptor,代码行数:25,代码来源:App.java


示例12: 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();
}
 
开发者ID:Zavael,项目名称:beehive-tracker,代码行数:24,代码来源:App.java


示例13: 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();
}
 
开发者ID:Gurgy,项目名称:Cypher,代码行数:59,代码来源:Main.java


示例14: 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);
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:15,代码来源:WorkPlace.java


示例15: 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);
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:8,代码来源:StartPresenter.java


示例16: start

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

    String version = Mokka7App.class.getPackage().getImplementationVersion();

    stage.setTitle(String.format("Mokka7 client v.%s", version != null ? version : "DEV"));
    stage.setResizable(true);

    Injector.setLogger((t) -> logger.trace(t));

    Injector.setModelOrService(MonitoredS7Client.class, new MonitoredS7Client());

    SessionManager session = Injector.instantiateModelOrService(SessionManager.class);
    session.setSession(getClass().getName().toLowerCase());
    session.loadSession();

    session.bind(sceneWidthProperty, "scene.width");
    session.bind(sceneHeightProperty, "scene.height");

    MainView main = new MainView();

    final Scene scene = new Scene(main.getView(), sceneWidthProperty.get(), sceneHeightProperty.get());
    stage.setOnCloseRequest((e) -> {
        sceneWidthProperty.set(scene.getWidth());
        sceneHeightProperty.set(scene.getHeight());
        Injector.forgetAll();
        System.exit(0);
    });
    stage.setScene(scene);
    Image icon16 = new Image(getClass().getResourceAsStream("icon-16x16.png"));
    Image icon32 = new Image(getClass().getResourceAsStream("icon-32x32.png"));
    Image icon48 = new Image(getClass().getResourceAsStream("icon-48x48.png"));

    stage.getIcons().addAll(icon16, icon32, icon48);

    stage.show();

}
 
开发者ID:comtel2000,项目名称:mokka7,代码行数:39,代码来源:Mokka7App.java


示例17: postInit

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
@Override
public void postInit(Scene scene) {
    String formFactorSuffix = Services.get(DisplayService.class)
            .map(s -> s.isTablet() ? "_tablet" : "")
            .orElse("");

    String stylesheetName = String.format("javaone_%s%s.css",
            Platform.getCurrent().name().toLowerCase(Locale.ROOT),
            formFactorSuffix);
    scene.getStylesheets().add(OTNApplication.class.getResource(stylesheetName).toExternalForm());
    
    if (Platform.isDesktop()) {
        Window window = scene.getWindow();
        ((Stage) window).getIcons().add(new Image(OTNApplication.class.getResourceAsStream("/icon.png")));
        window.setWidth(350);
        window.setHeight(700);
    }
    
    drawerPresenter = Injector.instantiateModelOrService(OTNDrawerPresenter.class);

    scene.getWindow().showingProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                initConnectivityServices();
                scene.getWindow().showingProperty().removeListener(this);
            }
        }
    });
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:31,代码来源:OTNApplication.java


示例18: onCloseRequest

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
private void onCloseRequest() {
    // Cleanup for next start
    PreferencesFacade.INSTANCE.putBoolean(
            IGameConfiguration.PROP__GAMEVIEW_IS_INITIALZE,
            Boolean.FALSE);
    PreferencesFacade.INSTANCE.putBoolean(
            IGameConfiguration.PROP__KEY_RELEASED__FOR_GAMEVIEW,
            Boolean.FALSE);
    PreferencesFacade.INSTANCE.putBoolean(
            IMainMenuConfiguration.PROP__MAIN_MENU_IS_SHOWN,
            Boolean.FALSE);
    
    // afterburner.fx
    Injector.forgetAll();
    
    // Message
    final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0);
    final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP);
    final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION);
    LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title));
    
    // Timer
    final PauseTransition pt = new PauseTransition(DURATION__125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
开发者ID:Naoghuman,项目名称:SokubanFX,代码行数:29,代码来源:StartApplication.java


示例19: start

import com.airhacks.afterburner.injection.Injector; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  stage.setTitle("OPC-UA client.fx (" + System.getProperty("javafx.runtime.version") + ")");
  stage.setResizable(true);

  Injector.setLogger(logger::trace);

  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  lc.getLogger("org.eclipse.milo.opcua.sdk.client.subscriptions").setLevel(Level.INFO);

  PersistenceService session = Injector.instantiateModelOrService(PersistenceService.class);

  Injector.instantiateModelOrService(OpcUaClientConnector.class);

  session.bind(sceneWidthProperty, "scene.width");
  session.bind(sceneHeightProperty, "scene.height");

  MainView main = new MainView();

  final Scene scene = new Scene(main.getView(), sceneWidthProperty.get(), sceneHeightProperty.get());
  stage.setOnCloseRequest((e) -> {
    sceneWidthProperty.set(scene.getWidth());
    sceneHeightProperty.set(scene.getHeight());
    Injector.forgetAll();
    System.exit(0);
  });
  stage.setScene(scene);
  stage.getIcons().add(new Image(OpcUAClient.class.getResourceAsStream("icon.png")));
  stage.show();

}
 
开发者ID:comtel2000,项目名称:opc-ua-client,代码行数:33,代码来源:OpcUAClient.java



注:本文中的com.airhacks.afterburner.injection.Injector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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