Search in sources :

Example 1 with DataAwareComponentsTools

use of io.jmix.ui.component.data.DataAwareComponentsTools in project jmix by jmix-framework.

the class DateFieldImpl method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        EntityValueSource entityValueSource = (EntityValueSource) valueSource;
        DataAwareComponentsTools dataAwareComponentsTools = applicationContext.getBean(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupDateFormat(this, entityValueSource);
        dataAwareComponentsTools.setupZoneId(this, entityValueSource);
        if (valueSourceStateChangeSubscription != null) {
            valueSourceStateChangeSubscription.remove();
        }
        // setup dateRange after valueSource is activated and value is set because
        // Vaadin dateField rejects value if it is not in range
        valueSourceStateChangeSubscription = valueSource.addStateChangeListener(event -> {
            if (event.getState() == BindingState.ACTIVE) {
                dataAwareComponentsTools.setupDateRange(this, entityValueSource);
            }
        });
    }
}
Also used : java.util(java.util) Preconditions(io.jmix.core.common.util.Preconditions) WrapperUtils.toVaadinTimeMode(io.jmix.ui.component.impl.WrapperUtils.toVaadinTimeMode) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) InitializingBean(org.springframework.beans.factory.InitializingBean) Messages(io.jmix.core.Messages) Notifications(io.jmix.ui.Notifications) DataAwareComponentsTools(io.jmix.ui.component.data.DataAwareComponentsTools) java.time(java.time) HasValue(com.vaadin.data.HasValue) TestIdManager(io.jmix.ui.sys.TestIdManager) ConversionException(io.jmix.ui.component.data.ConversionException) DateResolution(com.vaadin.shared.ui.datefield.DateResolution) JmixCssActionsLayout(io.jmix.ui.widget.JmixCssActionsLayout) Nullable(javax.annotation.Nullable) Preconditions.checkNotNullArgument(io.jmix.core.common.util.Preconditions.checkNotNullArgument) CurrentAuthentication(io.jmix.core.security.CurrentAuthentication) FormatStringsRegistry(io.jmix.core.metamodel.datatype.FormatStringsRegistry) Subscription(io.jmix.core.common.event.Subscription) ValueSource(io.jmix.ui.component.data.ValueSource) ThemeConstants(io.jmix.ui.theme.ThemeConstants) EntityValueSource(io.jmix.ui.component.data.meta.EntityValueSource) ErrorMessage(com.vaadin.server.ErrorMessage) Datatype(io.jmix.core.metamodel.datatype.Datatype) JmixTimeFieldWrapper(io.jmix.ui.widget.JmixTimeFieldWrapper) Validator(io.jmix.ui.component.validation.Validator) AbstractComponent(com.vaadin.ui.AbstractComponent) AppUI(io.jmix.ui.AppUI) App(io.jmix.ui.App) WrapperUtils.fromVaadinTimeMode(io.jmix.ui.component.impl.WrapperUtils.fromVaadinTimeMode) UserError(com.vaadin.server.UserError) JmixDateField(io.jmix.ui.widget.JmixDateField) MetaProperty(io.jmix.core.metamodel.model.MetaProperty) BindingState(io.jmix.ui.component.data.BindingState) DateTimeTransformations(io.jmix.core.DateTimeTransformations) io.jmix.ui.component(io.jmix.ui.component) EntityValueSource(io.jmix.ui.component.data.meta.EntityValueSource) DataAwareComponentsTools(io.jmix.ui.component.data.DataAwareComponentsTools)

Example 2 with DataAwareComponentsTools

use of io.jmix.ui.component.data.DataAwareComponentsTools in project jmix by jmix-framework.

the class CheckBoxGroupImpl method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<Collection<V>> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = applicationContext.getBean(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(io.jmix.ui.component.data.meta.EntityValueSource) DataAwareComponentsTools(io.jmix.ui.component.data.DataAwareComponentsTools)

Example 3 with DataAwareComponentsTools

use of io.jmix.ui.component.data.DataAwareComponentsTools in project jmix by jmix-framework.

the class ComboBoxImpl method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = applicationContext.getBean(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(io.jmix.ui.component.data.meta.EntityValueSource) DataAwareComponentsTools(io.jmix.ui.component.data.DataAwareComponentsTools)

Example 4 with DataAwareComponentsTools

use of io.jmix.ui.component.data.DataAwareComponentsTools in project jmix by jmix-framework.

the class AbstractSelectList method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = applicationContext.getBean(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(io.jmix.ui.component.data.meta.EntityValueSource) DataAwareComponentsTools(io.jmix.ui.component.data.DataAwareComponentsTools)

Example 5 with DataAwareComponentsTools

use of io.jmix.ui.component.data.DataAwareComponentsTools in project jmix by jmix-framework.

the class WebOptionsGroup method valueBindingConnected.

@SuppressWarnings("unchecked")
@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = applicationContext.getBean(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(io.jmix.ui.component.data.meta.EntityValueSource) DataAwareComponentsTools(io.jmix.ui.component.data.DataAwareComponentsTools)

Aggregations

DataAwareComponentsTools (io.jmix.ui.component.data.DataAwareComponentsTools)11 EntityValueSource (io.jmix.ui.component.data.meta.EntityValueSource)11 HasValue (com.vaadin.data.HasValue)1 ErrorMessage (com.vaadin.server.ErrorMessage)1 UserError (com.vaadin.server.UserError)1 DateResolution (com.vaadin.shared.ui.datefield.DateResolution)1 AbstractComponent (com.vaadin.ui.AbstractComponent)1 DateTimeTransformations (io.jmix.core.DateTimeTransformations)1 Messages (io.jmix.core.Messages)1 Subscription (io.jmix.core.common.event.Subscription)1 Preconditions (io.jmix.core.common.util.Preconditions)1 Preconditions.checkNotNullArgument (io.jmix.core.common.util.Preconditions.checkNotNullArgument)1 Datatype (io.jmix.core.metamodel.datatype.Datatype)1 FormatStringsRegistry (io.jmix.core.metamodel.datatype.FormatStringsRegistry)1 MetaProperty (io.jmix.core.metamodel.model.MetaProperty)1 CurrentAuthentication (io.jmix.core.security.CurrentAuthentication)1 App (io.jmix.ui.App)1 AppUI (io.jmix.ui.AppUI)1 Notifications (io.jmix.ui.Notifications)1 io.jmix.ui.component (io.jmix.ui.component)1