Example usage for javafx.util Builder build

List of usage examples for javafx.util Builder build

Introduction

In this page you can find the example usage for javafx.util Builder build.

Prototype

public T build();

Source Link

Document

Builds and returns the object.

Usage

From source file:io.github.moosbusch.permagon.configuration.builder.spi.AbstractPermagonBuilder.java

@Override
public Object build() {
    Object result;//from   w  ww . ja v  a 2  s  .c o  m
    Class<?> thype = getType();
    BuilderFactory buylderFactory = getBuilderFactory();
    PermagonApplicationContext applicationCtx = getApplicationContext();
    Map<Class<?>, Converter> converterz = getConverters();
    Builder<?> builder = buylderFactory.getBuilder(thype);

    if (builder != null) {
        result = builder.build();
        applicationCtx.getBeanFactory().autowireBean(result);
    } else {
        result = applicationCtx.createBean(thype);
    }

    converterz.entrySet().stream().forEach((converterEntry) -> {
        ConvertUtils.register(converterEntry.getValue(), converterEntry.getKey());
    });

    if (result instanceof Pane) {
        Pane resultPane = (Pane) result;
        buildPane(resultPane);

    } else if (result instanceof ScrollPane) {
        ScrollPane resultPane = (ScrollPane) result;
        buildScrollPane(resultPane);
    } else if (result instanceof SplitPane) {
        SplitPane resultPane = (SplitPane) result;
        buildSplitPane(resultPane);
    } else if (result instanceof TabPane) {
        TabPane resultPane = (TabPane) result;
        buildTabPane(resultPane);
    } else if (result instanceof Tab) {
        Tab resultPane = (Tab) result;
        buildTab(resultPane);
    } else if (result instanceof ButtonBar) {
        ButtonBar resultPane = (ButtonBar) result;
        buildButtonBar(resultPane);
    } else if (result instanceof Accordion) {
        Accordion resultPane = (Accordion) result;
        buildAccordion(resultPane);
    } else if (result instanceof TitledPane) {
        TitledPane resultPane = (TitledPane) result;
        buildTitledPane(resultPane);
    } else if (result instanceof ToolBar) {
        ToolBar resultPane = (ToolBar) result;
        buildToolBar(resultPane);
    } else if (result instanceof MenuBar) {
        MenuBar resultPane = (MenuBar) result;
        buildMenuBar(resultPane);
    }

    try {
        BeanUtils.populate(result, this);
    } catch (IllegalAccessException | InvocationTargetException ex) {
        Logger.getLogger(AbstractPermagonBuilder.class.getName()).log(Level.SEVERE, null, ex);
    }

    return result;
}