// Path: fx-cdi/src/main/java/com/cathive/fx/cdi/CdiApplication.java
// public abstract class CdiApplication extends Application {
// 
//     /** CDI loader to be used during application initialization. */
//     private CDILoader fxCdiLoader;
// 
//     /**
//      * Default constructor.
//      * Creates a new CDI-aware JavaFX application instance.
//      */
//     public CdiApplication() {
// 
//         super();
// 
//         // Sets the JavaFX application instance to be used when injecting an instance of this class.
//         JavaFXExtension.setJavaFxApplication(this);
// 
//         // Searches for a FxCdiLoader instance.
//         final ServiceLoader<CDILoader> serviceLoader = ServiceLoader.load(CDILoader.class);
//         final Iterator<CDILoader> loaderIterator = serviceLoader.iterator();
//         if (!loaderIterator.hasNext()) {
//             throw new IllegalStateException("No CDI Loader implementation for JavaFX could be found on your classpath.");
//         }
//         final CDILoader loader = loaderIterator.next();
//         if (loaderIterator.hasNext()) {
//             throw new IllegalStateException("More than one CDI Loader implementation for JavaFX could be found on your classpath.");
//         }
//         this.fxCdiLoader = loader;
// 
//     }
// 
//     @Override
//     public void init() throws Exception {
//         super.init();
//         this.fxCdiLoader.initialize();
//     }
// 
//     @Override
//     public void stop() throws Exception {
//         this.fxCdiLoader.shutdown();
//         JavaFXExtension.setJavaFxApplication(null);
//         super.stop();
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("[CDI-aware] %s", super.toString());
//     }
// 
// }


import com.cathive.fx.cdi.CdiApplication;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import java.util.ResourceBundle;
/*
 * Copyright (C) 2013,2014 The Cat Hive Developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cathive.fx.apps.contacts;



/**
 * Contacts app
 * @author Benjamin P. Jung
 */
@Named("app")
@ApplicationScoped
// Path: fx-cdi/src/main/java/com/cathive/fx/cdi/CdiApplication.java
// public abstract class CdiApplication extends Application {
// 
//     /** CDI loader to be used during application initialization. */
//     private CDILoader fxCdiLoader;
// 
//     /**
//      * Default constructor.
//      * Creates a new CDI-aware JavaFX application instance.
//      */
//     public CdiApplication() {
// 
//         super();
// 
//         // Sets the JavaFX application instance to be used when injecting an instance of this class.
//         JavaFXExtension.setJavaFxApplication(this);
// 
//         // Searches for a FxCdiLoader instance.
//         final ServiceLoader<CDILoader> serviceLoader = ServiceLoader.load(CDILoader.class);
//         final Iterator<CDILoader> loaderIterator = serviceLoader.iterator();
//         if (!loaderIterator.hasNext()) {
//             throw new IllegalStateException("No CDI Loader implementation for JavaFX could be found on your classpath.");
//         }
//         final CDILoader loader = loaderIterator.next();
//         if (loaderIterator.hasNext()) {
//             throw new IllegalStateException("More than one CDI Loader implementation for JavaFX could be found on your classpath.");
//         }
//         this.fxCdiLoader = loader;
// 
//     }
// 
//     @Override
//     public void init() throws Exception {
//         super.init();
//         this.fxCdiLoader.initialize();
//     }
// 
//     @Override
//     public void stop() throws Exception {
//         this.fxCdiLoader.shutdown();
//         JavaFXExtension.setJavaFxApplication(null);
//         super.stop();
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("[CDI-aware] %s", super.toString());
//     }
// 
// }


// Path: fx-inject-examples/addressbook-app/src/main/java/com/cathive/fx/apps/contacts/ContactsApp.java
import com.cathive.fx.cdi.CdiApplication;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import java.util.ResourceBundle;

/*
 * Copyright (C) 2013,2014 The Cat Hive Developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cathive.fx.apps.contacts;



/**
 * Contacts app
 * @author Benjamin P. Jung
 */
@Named("app")
@ApplicationScoped
public class ContactsApp extends CdiApplication {