Examples of FXMLLoaderParams


Examples of com.cathive.fx.cdi.FXMLLoaderParams

        loader.setControllerFactory((aClass) -> CDI.current().select(aClass));

        // If an annotation of type @FXMLLoaderParams can be found, use it's parameters
        // to configure the FXMLLoader instance that shall be used to perform the loading
        // of the FXML file.
        final FXMLLoaderParams fxmlLoaderParams = annotated.getAnnotation(FXMLLoaderParams.class);
        if (fxmlLoaderParams != null) {

            // Checks the location that has been specified (if any) and uses the default
            // class loader to create an URL that points to a FXML file on the classpath.
            final String location = fxmlLoaderParams.location();
            if (! location.equals(FXMLLoaderParams.LOCATION_UNSPECIFIED)) {
                loader.setLocation(declaringClass.getResource(location));
            }

            final String charset = fxmlLoaderParams.charset();
            if (! charset.equals(FXMLLoaderParams.CHARSET_UNSPECIFIED)) {
                loader.setCharset(Charset.forName(fxmlLoaderParams.charset()));
            }

            final String resources = fxmlLoaderParams.resources();
            if (!resources.equals(FXMLLoaderParams.RESOURCES_UNSPECIFIED)) {
                loader.setResources(ResourceBundle.getBundle(resources));
            }

        }
View Full Code Here

Examples of com.cathive.fx.inject.core.FXMLLoaderParams

    FXMLLoader createCdiFXMLLoader(final InjectionPoint injectionPoint) {
        final CdiFXMLLoader fxmlLoader = new CdiFXMLLoader();
        final Annotated annotated = injectionPoint.getAnnotated();
        final Class<?> declaringClass = injectionPoint.getMember().getDeclaringClass();
        if (annotated.isAnnotationPresent(FXMLLoaderParams.class)) {
            final FXMLLoaderParams annotation = annotated.getAnnotation(FXMLLoaderParams.class);
            initializeFXMLLoader(fxmlLoader, declaringClass, annotation.location(), annotation.resources(), annotation.charset());
        }
        return fxmlLoader;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.