Search in sources :

Example 1 with OptionsBinder

use of com.haulmont.cuba.gui.components.data.options.OptionsBinder in project cuba by cuba-platform.

the class AbstractComponentTestCase method setupGuiInfrastructure.

protected void setupGuiInfrastructure() {
    this.valueBinder = new TestValueBinder(beanLocator, messageTools, metadata.getTools(), beanValidation, security);
    this.optionsBinder = new OptionsBinder();
    new Expectations() {

        {
            AppBeans.get(BackgroundWorker.NAME);
            result = backgroundWorker;
            minTimes = 0;
            AppBeans.get(BackgroundWorker.class);
            result = backgroundWorker;
            minTimes = 0;
            AppBeans.get(BackgroundWorker.NAME, BackgroundWorker.class);
            result = backgroundWorker;
            minTimes = 0;
            applicationContext.getAutowireCapableBeanFactory();
            result = beanFactory;
            minTimes = 0;
            beanFactory.autowireBean(any);
            result = new Delegate() {

                @SuppressWarnings("unused")
                void autowireBean(java.lang.Object o) throws org.springframework.beans.BeansException {
                    autowireUiComponent((Component) o);
                }
            };
            minTimes = 0;
            userSessionSource.getLocale();
            result = Locale.ENGLISH;
            minTimes = 0;
            beanLocator.get(MetadataTools.NAME);
            result = metadata.getTools();
            minTimes = 0;
            beanLocator.get(ValueBinder.NAME);
            result = valueBinder;
            minTimes = 0;
            beanLocator.get(ValueBinder.class);
            result = valueBinder;
            minTimes = 0;
            beanLocator.get(ValueBinder.NAME, ValueBinder.class);
            result = valueBinder;
            minTimes = 0;
            beanLocator.get(OptionsBinder.NAME);
            result = optionsBinder;
            minTimes = 0;
            beanLocator.get(OptionsBinder.NAME, OptionsBinder.class);
            result = optionsBinder;
            minTimes = 0;
            beanLocator.get(Configuration.NAME);
            result = configuration;
            minTimes = 0;
            beanLocator.get(FormatStringsRegistry.NAME);
            result = formatStringsRegistry;
            minTimes = 0;
        }
    };
}
Also used : Expectations(mockit.Expectations) OptionsBinder(com.haulmont.cuba.gui.components.data.options.OptionsBinder) Delegate(mockit.Delegate)

Example 2 with OptionsBinder

use of com.haulmont.cuba.gui.components.data.options.OptionsBinder in project cuba by cuba-platform.

the class WebLookupField method setOptions.

@Override
public void setOptions(Options<V> options) {
    if (this.optionsBinding != null) {
        this.optionsBinding.unbind();
        this.optionsBinding = null;
    }
    if (options != null) {
        OptionsBinder optionsBinder = beanLocator.get(OptionsBinder.NAME);
        this.optionsBinding = optionsBinder.bind(options, this, this::setItemsToPresentation);
        this.optionsBinding.activate();
    }
}
Also used : OptionsBinder(com.haulmont.cuba.gui.components.data.options.OptionsBinder)

Example 3 with OptionsBinder

use of com.haulmont.cuba.gui.components.data.options.OptionsBinder in project cuba by cuba-platform.

the class WebTwinColumn method setOptions.

@Override
public void setOptions(Options<V> options) {
    if (this.optionsBinding != null) {
        this.optionsBinding.unbind();
        this.optionsBinding = null;
    }
    if (options != null) {
        OptionsBinder optionsBinder = beanLocator.get(OptionsBinder.NAME);
        this.optionsBinding = optionsBinder.bind(options, this, this::setItemsToPresentation);
        this.optionsBinding.activate();
    }
}
Also used : OptionsBinder(com.haulmont.cuba.gui.components.data.options.OptionsBinder)

Example 4 with OptionsBinder

use of com.haulmont.cuba.gui.components.data.options.OptionsBinder in project cuba by cuba-platform.

the class WebSearchPickerField method setOptions.

@Override
public void setOptions(Options<V> options) {
    if (this.optionsBinding != null) {
        this.optionsBinding.unbind();
        this.optionsBinding = null;
    }
    if (options != null) {
        OptionsBinder optionsBinder = beanLocator.get(OptionsBinder.NAME);
        this.optionsBinding = optionsBinder.bind(options, this, this::setItemsToPresentation);
        this.optionsBinding.activate();
        if (getMetaClass() == null && options instanceof EntityOptions) {
            setMetaClass(((EntityOptions<V>) options).getEntityMetaClass());
        }
    }
}
Also used : OptionsBinder(com.haulmont.cuba.gui.components.data.options.OptionsBinder) EntityOptions(com.haulmont.cuba.gui.components.data.meta.EntityOptions)

Example 5 with OptionsBinder

use of com.haulmont.cuba.gui.components.data.options.OptionsBinder in project cuba by cuba-platform.

the class WebCheckBoxGroup method setOptions.

@Override
public void setOptions(Options<V> options) {
    if (this.optionsBinding != null) {
        this.optionsBinding.unbind();
        this.optionsBinding = null;
    }
    if (options != null) {
        OptionsBinder optionsBinder = beanLocator.get(OptionsBinder.NAME);
        this.optionsBinding = optionsBinder.bind(options, this, this::setItemsToPresentation);
        this.optionsBinding.activate();
    }
}
Also used : OptionsBinder(com.haulmont.cuba.gui.components.data.options.OptionsBinder)

Aggregations

OptionsBinder (com.haulmont.cuba.gui.components.data.options.OptionsBinder)10 EntityOptions (com.haulmont.cuba.gui.components.data.meta.EntityOptions)2 Delegate (mockit.Delegate)2 Expectations (mockit.Expectations)2 TestValueBinder (com.haulmont.cuba.gui.components.AbstractComponentTestCase.TestValueBinder)1 DefaultComponentGenerationStrategy (com.haulmont.cuba.gui.components.factories.DefaultComponentGenerationStrategy)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1