Search in sources :

Example 1 with DataAwareComponentsTools

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

the class WebOptionsGroup method valueBindingConnected.

@SuppressWarnings("unchecked")
@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = beanLocator.get(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(com.haulmont.cuba.gui.components.data.meta.EntityValueSource) DataAwareComponentsTools(com.haulmont.cuba.gui.components.data.DataAwareComponentsTools)

Example 2 with DataAwareComponentsTools

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

the class WebTextField method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = beanLocator.get(DataAwareComponentsTools.class);
        EntityValueSource entityValueSource = (EntityValueSource) valueSource;
        dataAwareComponentsTools.setupCaseConversion(this, entityValueSource);
        dataAwareComponentsTools.setupMaxLength(this, entityValueSource);
    }
}
Also used : EntityValueSource(com.haulmont.cuba.gui.components.data.meta.EntityValueSource) DataAwareComponentsTools(com.haulmont.cuba.gui.components.data.DataAwareComponentsTools)

Example 3 with DataAwareComponentsTools

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

the class WebLookupField method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = beanLocator.get(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(com.haulmont.cuba.gui.components.data.meta.EntityValueSource) DataAwareComponentsTools(com.haulmont.cuba.gui.components.data.DataAwareComponentsTools)

Example 4 with DataAwareComponentsTools

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

the class WebOptionsList method valueBindingConnected.

@SuppressWarnings("unchecked")
@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        DataAwareComponentsTools dataAwareComponentsTools = beanLocator.get(DataAwareComponentsTools.class);
        dataAwareComponentsTools.setupOptions(this, (EntityValueSource) valueSource);
    }
}
Also used : EntityValueSource(com.haulmont.cuba.gui.components.data.meta.EntityValueSource) DataAwareComponentsTools(com.haulmont.cuba.gui.components.data.DataAwareComponentsTools)

Example 5 with DataAwareComponentsTools

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

the class WebDateField method valueBindingConnected.

@Override
protected void valueBindingConnected(ValueSource<V> valueSource) {
    super.valueBindingConnected(valueSource);
    if (valueSource instanceof EntityValueSource) {
        EntityValueSource entityValueSource = (EntityValueSource) valueSource;
        DataAwareComponentsTools dataAwareComponentsTools = beanLocator.get(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 : CubaCssActionsLayout(com.haulmont.cuba.web.widgets.CubaCssActionsLayout) java.util(java.util) TimeMode(com.haulmont.cuba.gui.components.TimeField.TimeMode) ConversionException(com.haulmont.cuba.gui.components.data.ConversionException) CubaDateField(com.haulmont.cuba.web.widgets.CubaDateField) LoggerFactory(org.slf4j.LoggerFactory) StringUtils(org.apache.commons.lang3.StringUtils) InitializingBean(org.springframework.beans.factory.InitializingBean) Inject(javax.inject.Inject) Pair(com.haulmont.bali.datastruct.Pair) java.time(java.time) Datatype(com.haulmont.chile.core.datatypes.Datatype) HasValue(com.vaadin.data.HasValue) Subscription(com.haulmont.bali.events.Subscription) DataAwareComponentsTools(com.haulmont.cuba.gui.components.data.DataAwareComponentsTools) FormatStringsRegistry(com.haulmont.chile.core.datatypes.FormatStringsRegistry) AppUI(com.haulmont.cuba.web.AppUI) EntityValueSource(com.haulmont.cuba.gui.components.data.meta.EntityValueSource) WebWrapperUtils.fromVaadinTimeMode(com.haulmont.cuba.web.gui.components.WebWrapperUtils.fromVaadinTimeMode) DateTimeTransformations(com.haulmont.cuba.core.global.DateTimeTransformations) DateResolution(com.vaadin.shared.ui.datefield.DateResolution) Preconditions.checkNotNullArgument(com.haulmont.bali.util.Preconditions.checkNotNullArgument) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components) MetaProperty(com.haulmont.chile.core.model.MetaProperty) WebWrapperUtils.toVaadinTimeMode(com.haulmont.cuba.web.gui.components.WebWrapperUtils.toVaadinTimeMode) ValueSource(com.haulmont.cuba.gui.components.data.ValueSource) App(com.haulmont.cuba.web.App) Messages(com.haulmont.cuba.core.global.Messages) ErrorMessage(com.vaadin.server.ErrorMessage) UserSessionSource(com.haulmont.cuba.core.global.UserSessionSource) Preconditions(com.haulmont.bali.util.Preconditions) CubaTimeFieldWrapper(com.haulmont.cuba.web.widgets.CubaTimeFieldWrapper) TestIdManager(com.haulmont.cuba.gui.sys.TestIdManager) Consumer(java.util.function.Consumer) AbstractComponent(com.vaadin.ui.AbstractComponent) BindingState(com.haulmont.cuba.gui.components.data.BindingState) ThemeConstants(com.haulmont.cuba.gui.theme.ThemeConstants) Notifications(com.haulmont.cuba.gui.Notifications) UserError(com.vaadin.server.UserError) ComponentsHelper(com.haulmont.cuba.gui.ComponentsHelper) EntityValueSource(com.haulmont.cuba.gui.components.data.meta.EntityValueSource) DataAwareComponentsTools(com.haulmont.cuba.gui.components.data.DataAwareComponentsTools)

Aggregations

DataAwareComponentsTools (com.haulmont.cuba.gui.components.data.DataAwareComponentsTools)10 EntityValueSource (com.haulmont.cuba.gui.components.data.meta.EntityValueSource)10 Pair (com.haulmont.bali.datastruct.Pair)1 Subscription (com.haulmont.bali.events.Subscription)1 Preconditions (com.haulmont.bali.util.Preconditions)1 Preconditions.checkNotNullArgument (com.haulmont.bali.util.Preconditions.checkNotNullArgument)1 Datatype (com.haulmont.chile.core.datatypes.Datatype)1 FormatStringsRegistry (com.haulmont.chile.core.datatypes.FormatStringsRegistry)1 MetaProperty (com.haulmont.chile.core.model.MetaProperty)1 DateTimeTransformations (com.haulmont.cuba.core.global.DateTimeTransformations)1 Messages (com.haulmont.cuba.core.global.Messages)1 UserSessionSource (com.haulmont.cuba.core.global.UserSessionSource)1 ComponentsHelper (com.haulmont.cuba.gui.ComponentsHelper)1 Notifications (com.haulmont.cuba.gui.Notifications)1 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)1 TimeMode (com.haulmont.cuba.gui.components.TimeField.TimeMode)1 BindingState (com.haulmont.cuba.gui.components.data.BindingState)1 ConversionException (com.haulmont.cuba.gui.components.data.ConversionException)1 ValueSource (com.haulmont.cuba.gui.components.data.ValueSource)1 TestIdManager (com.haulmont.cuba.gui.sys.TestIdManager)1