Search in sources :

Example 1 with MetaProperty

use of com.haulmont.chile.core.annotations.MetaProperty in project cuba by cuba-platform.

the class EntitySnapshot method getLabel.

@MetaProperty(related = { "snapshotDate,author" })
public String getLabel() {
    String name = "";
    if (author != null && StringUtils.isNotEmpty(this.author.getCaption())) {
        name += this.author.getCaption() + " ";
    }
    Datatype datatype = Datatypes.getNN(Date.class);
    UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
    if (userSessionSource != null && userSessionSource.checkCurrentUserSession()) {
        name += datatype.format(snapshotDate, userSessionSource.getLocale());
    }
    return StringUtils.trim(name);
}
Also used : UserSessionSource(com.haulmont.cuba.core.global.UserSessionSource) Datatype(com.haulmont.chile.core.datatypes.Datatype) MetaProperty(com.haulmont.chile.core.annotations.MetaProperty)

Example 2 with MetaProperty

use of com.haulmont.chile.core.annotations.MetaProperty in project cuba by cuba-platform.

the class EntityLogAttr method getDisplayName.

@MetaProperty
public String getDisplayName() {
    String entityName = getLogItem().getEntity();
    String message;
    com.haulmont.chile.core.model.MetaClass metaClass = getClassFromEntityName(entityName);
    if (metaClass != null) {
        Messages messages = AppBeans.get(Messages.NAME);
        message = messages.getTools().getPropertyCaption(metaClass, getName());
    } else {
        return getName();
    }
    return (message != null ? message : getName());
}
Also used : Messages(com.haulmont.cuba.core.global.Messages) MetaProperty(com.haulmont.chile.core.annotations.MetaProperty)

Example 3 with MetaProperty

use of com.haulmont.chile.core.annotations.MetaProperty in project cuba by cuba-platform.

the class ScheduledTask method getMethodParametersString.

@MetaProperty
public String getMethodParametersString() {
    StringBuilder sb = new StringBuilder();
    int count = 0;
    List<MethodParameterInfo> parameters = getMethodParameters();
    for (MethodParameterInfo param : parameters) {
        sb.append(param.getType().getSimpleName()).append(" ").append(param.getName()).append(" = ").append(param.getValue());
        if (++count != parameters.size())
            sb.append(", ");
    }
    return sb.toString();
}
Also used : MethodParameterInfo(com.haulmont.cuba.core.app.scheduled.MethodParameterInfo) MetaProperty(com.haulmont.chile.core.annotations.MetaProperty)

Aggregations

MetaProperty (com.haulmont.chile.core.annotations.MetaProperty)3 Datatype (com.haulmont.chile.core.datatypes.Datatype)1 MethodParameterInfo (com.haulmont.cuba.core.app.scheduled.MethodParameterInfo)1 Messages (com.haulmont.cuba.core.global.Messages)1 UserSessionSource (com.haulmont.cuba.core.global.UserSessionSource)1