本文整理汇总了Java中com.airhacks.afterburner.injection.Injector.instantiateModelOrService方法的典型用法代码示例。如果您正苦于以下问题:Java Injector.instantiateModelOrService方法的具体用法?Java Injector.instantiateModelOrService怎么用?Java Injector.instantiateModelOrService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.airhacks.afterburner.injection.Injector
的用法示例。
在下文中一共展示了Injector.instantiateModelOrService方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
});
}
示例3: 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());
}
示例4: 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();
}
示例5: 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();
}
示例6: 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);
}
}
});
}
示例7: 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();
}
示例8: start
import com.airhacks.afterburner.injection.Injector; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
stageRef = stage;
stage.titleProperty().bind(headerExpr);
stage.setResizable(true);
offlineImg = new Image(VncClientApp.class.getResourceAsStream("icon.png"));
onlineImg = new Image(VncClientApp.class.getResourceAsStream("icon_green.png"));
Injector.setLogger(logger::trace);
VncRenderService vncService = Injector.instantiateModelOrService(VncRenderService.class);
vncService.fullSceenProperty().addListener((l, a, b) -> Platform.runLater(() -> stage.setFullScreen(b)));
vncService.restartProperty().addListener(l -> restart());
vncService.connectInfoProperty().addListener((l, a, b) -> Platform.runLater(() -> headerProperty.set(b.getServerName())));
vncService.onlineProperty().addListener((l, a, b) -> Platform.runLater(() -> {
stage.getIcons().add(b ? onlineImg : offlineImg);
stage.getIcons().remove(!b ? onlineImg : offlineImg);
}));
// update property on exit full screen by key combination
stage.fullScreenProperty().addListener((l, a, b) -> vncService.fullSceenProperty().set(b));
SessionContext session = Injector.instantiateModelOrService(SessionContext.class);
session.setSession("jfxvnc.app");
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);
stage.getIcons().add(offlineImg);
stage.show();
}