use of io.jmix.ui.action.valuepicker.ValueClearAction in project jmix by jmix-framework.
the class JpqlFilterComponentGenerationStrategy method createCollectionField.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Component createCollectionField(ComponentGenerationContext context) {
JpqlFilterComponentGenerationContext cfContext = (JpqlFilterComponentGenerationContext) context;
Class parameterClass = cfContext.getParameterClass();
ValuesPicker valuesPicker = uiComponents.create(ValuesPicker.class);
setValueSource(valuesPicker, cfContext);
ValuesSelectAction selectAction = actions.create(ValuesSelectAction.class);
if (Entity.class.isAssignableFrom(parameterClass)) {
MetaClass metaClass = metadata.getClass(cfContext.getParameterClass());
selectAction.setEntityName(metaClass.getName());
} else if (EnumClass.class.isAssignableFrom(parameterClass)) {
selectAction.setEnumClass(parameterClass);
} else if (datatypeRegistry.find(parameterClass) != null) {
Datatype datatype = datatypeRegistry.get(parameterClass);
selectAction.setJavaClass(datatype.getJavaClass());
}
valuesPicker.addAction(selectAction);
ValueClearAction valueClearAction = actions.create(ValueClearAction.class);
valuesPicker.addAction(valueClearAction);
return valuesPicker;
}
use of io.jmix.ui.action.valuepicker.ValueClearAction in project jmix by jmix-framework.
the class DynAttrComponentGenerationStrategy method createCollectionField.
protected Component createCollectionField(ComponentGenerationContext context, AttributeDefinition attribute) {
ValuesPicker valuesPicker = uiComponents.create(ValuesPicker.NAME);
setValidators(valuesPicker, attribute);
setValueSource(valuesPicker, context);
ValuesSelectAction selectAction = actions.create(ValuesSelectAction.class);
initValuesSelectActionByAttribute(selectAction, attribute);
if (valuesPicker.getValueSource() instanceof ContainerValueSource && attribute.getConfiguration().isLookup()) {
ContainerValueSource valueSource = (ContainerValueSource) valuesPicker.getValueSource();
setValuesPickerOptionsLoader(valuesPicker, attribute, valueSource);
}
valuesPicker.addAction(selectAction);
ValueClearAction valueClearAction = actions.create(ValueClearAction.class);
valuesPicker.addAction(valueClearAction);
return valuesPicker;
}
use of io.jmix.ui.action.valuepicker.ValueClearAction in project jmix by jmix-framework.
the class AbstractComponentGenerationStrategy method createCollectionField.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Component createCollectionField(ComponentGenerationContext context, MetaPropertyPath mpp) {
ValuesPicker valuesPicker = uiComponents.create(ValuesPicker.class);
setValueSource(valuesPicker, context);
ValuesSelectAction selectAction = actions.create(ValuesSelectAction.class);
Range range = mpp.getRange();
if (range.isClass()) {
selectAction.setEntityName(range.asClass().getName());
} else if (range.isDatatype()) {
selectAction.setJavaClass(range.asDatatype().getJavaClass());
} else if (range.isEnum()) {
selectAction.setEnumClass(range.asEnumeration().getJavaClass());
}
valuesPicker.addAction(selectAction);
ValueClearAction valueClearAction = actions.create(ValueClearAction.class);
valuesPicker.addAction(valueClearAction);
return valuesPicker;
}
Aggregations