use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class DesktopFileMultiUploadField method notifyFileSizeExceedLimit.
protected void notifyFileSizeExceedLimit(File file) {
Messages messages = AppBeans.get(Messages.NAME);
String warningMsg = messages.formatMainMessage("upload.fileTooBig.message", file.getName(), getFileSizeLimitString());
getFrame().showNotification(warningMsg, Frame.NotificationType.WARNING);
}
use of com.haulmont.cuba.core.global.Messages 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());
}
use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class BeanValidator method getDefaultErrorMessage.
public String getDefaultErrorMessage() {
Messages messages = AppBeans.get(Messages.NAME);
Metadata metadata = AppBeans.get(Metadata.NAME);
MetaClass metaClass = metadata.getClass(beanClass);
return messages.formatMainMessage("validation.defaultMsg", messages.getTools().getPropertyCaption(metaClass, beanProperty));
}
use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class EntityLogTest method testEnumDisplayValue.
@Test
public void testEnumDisplayValue() throws Exception {
Transaction tx = cont.persistence().createTransaction();
try {
EntityManager em = cont.persistence().getEntityManager();
Role role = new Role();
roleId = role.getId();
role.setName("role1");
role.setType(RoleType.READONLY);
em.persist(role);
tx.commit();
} finally {
tx.end();
}
List<EntityLogItem> items;
tx = cont.persistence().createTransaction();
try {
EntityManager em = cont.persistence().getEntityManager();
TypedQuery<EntityLogItem> query = em.createQuery("select i from sec$EntityLog i where i.entity = ?1 and i.entityRef.entityId = ?2", EntityLogItem.class);
query.setParameter(1, "sec$Role");
query.setParameter(2, roleId);
items = query.getResultList();
tx.commit();
} finally {
tx.end();
}
assertNotNull(items);
assertEquals(1, items.size());
assertNotNull(items.get(0).getAttributes());
assertEquals(1, items.get(0).getAttributes().size());
EntityLogAttr attr = items.get(0).getAttributes().iterator().next();
Messages messages = AppBeans.get(Messages.NAME);
assertEquals(messages.getMessage(RoleType.READONLY), attr.getDisplayValue());
}
use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class DesktopTimeField method showValidationMessage.
private void showValidationMessage() {
Messages messages = AppBeans.get(Messages.NAME);
DesktopComponentsHelper.getTopLevelFrame(this).showNotification(messages.getMainMessage("validationFail"), com.haulmont.cuba.gui.components.Frame.NotificationType.TRAY);
}
Aggregations