本文整理汇总了Java中com.airhacks.afterburner.injection.Injector类的典型用法代码示例。如果您正苦于以下问题:Java Injector类的具体用法?Java Injector怎么用?Java Injector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Injector类属于com.airhacks.afterburner.injection包,在下文中一共展示了Injector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
});
}
示例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());
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}