Java 类javafx.util.Builder 实例源码

项目:Gargoyle    文件:GargoyleBuilderFactory.java   
@Override
public Builder<?> getBuilder(Class<?> type) {
    Builder<?> builder = null;

    if (deligator != null) {
        Builder<?> userBuilder = deligator.getBuilder(type);
        if (userBuilder != null) {
            return userBuilder;
        }
    }

    if (type == Button.class) {
        builder = new GargoyleButtonBuilder();
    } else if (type == TableView.class) {
        builder = new GargoyleTableViewBuilder();
    }

    return builder;
}
项目:LIRE-Lab    文件:LireLabBuiderFactory.java   
@Override
public Builder<?> getBuilder(Class<?> type) {
    if(type == ImageGrid.class) {
        return new ImageGridBuilder(imageViewFactory, fileUtils);
    }

    return new JavaFXBuilderFactory().getBuilder(type);
}
项目:Gargoyle    文件:GargoyleBuilderFactory.java   
@Override
public Builder<?> getBuilder(Class<?> type) {
    Builder<?> builder = null;

    if (type == Button.class) {
        builder = new GargoyleButtonBuilder();
    }

    return builder;
}
项目:spring-boot-javafx-sample    文件:SpringJavaFXBuilderFactory.java   
@Override
public Builder<?> getBuilder(Class<?> type) {
    if(packages.stream().anyMatch(p -> type.getPackage().getName().indexOf(p) == 0)) {
        try {
            Object bean = applicationContext.getBean(type);
            return () -> bean;
        } catch(NoSuchBeanDefinitionException ex) {
            return null;
        }
    }
    return null;
}
项目:spring-javafx    文件:FXMLControllerBuilderFactory.java   
@Override
public Builder<?> getBuilder(Class<?> type) {
    Builder<?> builder = builders.computeIfAbsent(type, t -> {
        Map<String, ?> beansOfType = beanFactory.getBeansOfType(type, true, false);
        if (beansOfType.isEmpty()) {
            return NULL_BUILDER;
        }
        return () -> beanFactory.getBean(type);
    });

    return builder == NULL_BUILDER ? null : builder;
}
项目:fx-inject    文件:CdiFXMLLoader.java   
/**
 * Default constructor.
 */
CdiFXMLLoader() {

    super();

    // Uses the currently loaded CDI implementation to look up controller classes
    // that have been specified via "fx:controller='...'" in our FXML files.
    this.setControllerFactory((aClass) -> CDI.current().select(aClass));

    // Initializes the default JavaFX builder factory to be used for non CDI-aware beans.
    this.defaultBuilderFactory = new JavaFXBuilderFactory();

    this.setBuilderFactory((aClass) -> {

        // Uses the default builder factory to retrieve builders where applicable.
        final Builder<?> defaultBuilder = defaultBuilderFactory.getBuilder(aClass);
        if (defaultBuilder != null) {
            return defaultBuilder;
        }

        // Make sure that we use a "null" builder for components that are 'blacklisted'.
        final String packageName = aClass.getPackage().getName();
        for (final String blacklisted : CDI_BLACKLIST) {
            if (packageName.startsWith(blacklisted)) {
                return null;
            }
        }

        return new CdiFXMLComponentBuilder(aClass);

    });

}