@Component(value="cuba_DynamicAttributesGuiTools")
public class DynamicAttributesGuiTools
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected BeanLocator |
beanLocator |
protected DataManager |
dataManager |
protected DynamicAttributes |
dynamicAttributes |
protected GuiActionSupport |
guiActionSupport |
protected Metadata |
metadata |
static java.lang.String |
NAME |
protected static java.lang.ThreadLocal<java.lang.Boolean> |
recalculationInProgress |
protected DynamicAttributesRecalculationTools |
recalculationTools |
protected ReferenceToEntitySupport |
referenceToEntitySupport |
protected ScreensHelper |
screensHelper |
protected Security |
security |
protected UserSessionSource |
userSessionSource |
protected WindowConfig |
windowConfig |
Constructor and Description |
---|
DynamicAttributesGuiTools() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
attributeShouldBeShownOnTheScreen(java.lang.String screen,
java.lang.String component,
CategoryAttribute attribute) |
protected boolean |
checkUserPermissionForAttribute(CategoryAttribute attribute) |
protected java.util.Set<java.lang.Class> |
collectEntityClasses(View view,
java.util.Set<View> visited) |
protected java.util.Set<java.lang.Class> |
collectEntityClassesWithDynamicAttributes(View view) |
protected java.util.Collection<java.util.function.Consumer<?>> |
createDecimalValidators(CategoryAttribute attribute) |
protected java.util.Collection<java.util.function.Consumer<?>> |
createDoubleValidators(CategoryAttribute attribute) |
protected java.util.Collection<java.util.function.Consumer<?>> |
createIntegerValidators(CategoryAttribute attribute) |
PickerField.LookupAction |
createLookupAction(PickerField pickerField,
java.lang.String joinClause,
java.lang.String whereClause)
Creates the lookup action that will open the lookup screen with the dynamic filter applied.
|
CollectionDatasource |
createOptionsDatasourceForLookup(MetaClass metaClass,
java.lang.String joinClause,
java.lang.String whereClause)
Creates the collection datasource that is used for selecting the dynamic attribute value.
|
java.util.Collection<java.util.function.Consumer<?>> |
createValidators(CategoryAttribute attribute)
Returns validators for a dynamic attribute
|
java.util.Set<CategoryAttribute> |
getAttributesToShowOnTheScreen(MetaClass metaClass,
java.lang.String screen,
java.lang.String component)
Get attributes which should be added automatically to the screen and component.
|
java.lang.String |
getColumnCapture(CategoryAttribute attribute)
Returns column capture for dynamic attribute
|
Datatype |
getCustomNumberDatatype(CategoryAttribute attribute)
Returns custom
AdaptiveNumberDatatype for dynamic attribute with specified NumberFormatPattern |
java.text.DecimalFormat |
getDecimalFormat(CategoryAttribute attribute)
Returns custom DecimalFormat for dynamic attribute with specified
NumberFormatPattern |
java.util.List<CategoryAttribute> |
getSortedAttributesToShowOnTheScreen(MetaClass metaClass,
java.lang.String screen,
java.lang.String component)
Get attributes which should be added automatically to the screen and component.
|
java.util.function.Consumer<HasValue.ValueChangeEvent> |
getValueChangeEventListener(CategoryAttribute attribute)
Returns
ValueChangeEventListener for dynamic attribute that has one or more dependent attributes. |
void |
initDefaultAttributeValues(BaseGenericIdEntity item,
MetaClass metaClass) |
void |
initEntityPickerField(PickerField pickerField,
CategoryAttribute categoryAttribute)
Initializes the pickerField for selecting the dynamic attribute value.
|
protected void |
initLegacyPickerField(PickerField.LookupAction lookupAction,
java.lang.String screen,
MetaClass metaClass,
java.lang.Class javaClass) |
protected void |
initPickerField(LookupAction<?> lookupAction,
java.lang.String screen,
MetaClass metaClass,
java.lang.Class javaClass) |
void |
listenCategoryChanges(Datasource ds) |
void |
listenDynamicAttributesChanges(Datasource datasource)
Enforce the datasource to change modified status if dynamic attribute is changed
|
void |
reloadDynamicAttributes(BaseGenericIdEntity entity)
Reload dynamic attributes on the entity
|
boolean |
screenContainsDynamicAttributes(View mainDatasourceView,
java.lang.String screenId)
Method checks whether any class in the view hierarchy contains dynamic attributes that must be displayed on
the current screen
|
protected void |
setDefaultAttributeValue(BaseGenericIdEntity item,
CategoryAttribute categoryAttribute,
boolean entityIsCategorized,
java.time.ZonedDateTime currentTimestamp) |
public static final java.lang.String NAME
@Inject protected DynamicAttributes dynamicAttributes
@Inject protected WindowConfig windowConfig
@Inject protected Metadata metadata
@Inject protected ReferenceToEntitySupport referenceToEntitySupport
@Inject protected DataManager dataManager
@Inject protected ScreensHelper screensHelper
@Inject protected Security security
@Inject protected BeanLocator beanLocator
@Inject protected UserSessionSource userSessionSource
@Inject protected DynamicAttributesRecalculationTools recalculationTools
@Inject protected GuiActionSupport guiActionSupport
protected static final java.lang.ThreadLocal<java.lang.Boolean> recalculationInProgress
public void listenDynamicAttributesChanges(Datasource datasource)
public java.util.Set<CategoryAttribute> getAttributesToShowOnTheScreen(MetaClass metaClass, java.lang.String screen, @Nullable java.lang.String component)
public java.util.List<CategoryAttribute> getSortedAttributesToShowOnTheScreen(MetaClass metaClass, java.lang.String screen, @Nullable java.lang.String component)
public boolean screenContainsDynamicAttributes(View mainDatasourceView, java.lang.String screenId)
protected java.util.Set<java.lang.Class> collectEntityClassesWithDynamicAttributes(@Nullable View view)
protected java.util.Set<java.lang.Class> collectEntityClasses(View view, java.util.Set<View> visited)
public void initDefaultAttributeValues(BaseGenericIdEntity item, MetaClass metaClass)
protected void setDefaultAttributeValue(BaseGenericIdEntity item, CategoryAttribute categoryAttribute, boolean entityIsCategorized, java.time.ZonedDateTime currentTimestamp)
public void listenCategoryChanges(Datasource ds)
protected boolean attributeShouldBeShownOnTheScreen(java.lang.String screen, java.lang.String component, CategoryAttribute attribute)
protected boolean checkUserPermissionForAttribute(CategoryAttribute attribute)
public void initEntityPickerField(PickerField pickerField, CategoryAttribute categoryAttribute)
pickerField
- PickerField component whose lookup action must be initializedcategoryAttribute
- CategoryAttribute that is represented by the pickerFieldprotected void initPickerField(LookupAction<?> lookupAction, @Nullable java.lang.String screen, MetaClass metaClass, java.lang.Class javaClass)
protected void initLegacyPickerField(PickerField.LookupAction lookupAction, @Nullable java.lang.String screen, MetaClass metaClass, java.lang.Class javaClass)
public CollectionDatasource createOptionsDatasourceForLookup(MetaClass metaClass, java.lang.String joinClause, java.lang.String whereClause)
public PickerField.LookupAction createLookupAction(PickerField pickerField, java.lang.String joinClause, java.lang.String whereClause)
public void reloadDynamicAttributes(BaseGenericIdEntity entity)
public java.util.Collection<java.util.function.Consumer<?>> createValidators(CategoryAttribute attribute)
protected java.util.Collection<java.util.function.Consumer<?>> createIntegerValidators(CategoryAttribute attribute)
protected java.util.Collection<java.util.function.Consumer<?>> createDoubleValidators(CategoryAttribute attribute)
protected java.util.Collection<java.util.function.Consumer<?>> createDecimalValidators(CategoryAttribute attribute)
@Nullable public java.text.DecimalFormat getDecimalFormat(CategoryAttribute attribute)
NumberFormatPattern
@Nullable public Datatype getCustomNumberDatatype(CategoryAttribute attribute)
AdaptiveNumberDatatype
for dynamic attribute with specified NumberFormatPattern
public java.lang.String getColumnCapture(CategoryAttribute attribute)
public java.util.function.Consumer<HasValue.ValueChangeEvent> getValueChangeEventListener(CategoryAttribute attribute)
ValueChangeEventListener
for dynamic attribute that has one or more dependent attributes.
This listener recalculates values for all dependent dynamic attributes hierarchically. The listener uses
recalculationInProgress
ThreadLocal variable to avoid unnecessary calculation.