当前位置: 首页>>代码示例>>Java>>正文


Java Injector.instantiateModelOrService方法代码示例

本文整理汇总了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;
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:18,代码来源:BaseService.java

示例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;
    });
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:24,代码来源:OTNApplication.java

示例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());
}
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:17,代码来源:AppViewManager.java

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

示例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();

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

示例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);
            }
        }
    });
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:31,代码来源:OTNApplication.java

示例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();

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

示例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();
}
 
开发者ID:comtel2000,项目名称:jfxvnc,代码行数:44,代码来源:VncClientApp.java


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