Search in sources :

Example 1 with CurrencyValue

use of com.haulmont.cuba.core.entity.annotation.CurrencyValue in project cuba by cuba-platform.

the class WebCurrencyField method setDatasource.

@Override
public void setDatasource(Datasource datasource, String property) {
    textField.setDatasource(datasource, property);
    if (datasource != null && !DynamicAttributesUtils.isDynamicAttribute(property)) {
        MetaProperty metaProperty = datasource.getMetaClass().getPropertyNN(property);
        Object obj = metaProperty.getAnnotations().get(CurrencyValue.class.getName());
        if (obj == null)
            return;
        // noinspection unchecked
        Map<String, Object> currencyValue = (Map<String, Object>) obj;
        String currencyName = (String) currencyValue.get("currency");
        component.setCurrency(currencyName);
    }
}
Also used : CurrencyValue(com.haulmont.cuba.core.entity.annotation.CurrencyValue) MetaProperty(com.haulmont.chile.core.model.MetaProperty) Map(java.util.Map)

Aggregations

MetaProperty (com.haulmont.chile.core.model.MetaProperty)1 CurrencyValue (com.haulmont.cuba.core.entity.annotation.CurrencyValue)1 Map (java.util.Map)1