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 MismatchedUserSessionHandler method showMismatchedSessionDialog.
protected void showMismatchedSessionDialog(AppUI ui) {
Messages messages = beanLocator.get(Messages.class);
Connection connection = ui.getApp().getConnection();
// noinspection ConstantConditions
Locale locale = connection.getSession().getLocale();
Window dialog = new MismatchedUserSessionExceptionDialog();
dialog.setStyleName("c-sessionchanged-dialog");
dialog.setCaption(messages.getMainMessage("dialogs.Information", locale));
dialog.setClosable(false);
dialog.setResizable(false);
dialog.setModal(true);
CubaLabel messageLab = new CubaLabel();
messageLab.setWidthUndefined();
messageLab.setValue(messages.getMainMessage("sessionChangedMsg", locale));
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(false);
layout.setWidthUndefined();
layout.setStyleName("c-sessionchanged-dialog-layout");
layout.setSpacing(true);
dialog.setContent(layout);
CubaButton reloginBtn = new CubaButton();
reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME);
reloginBtn.setCaption(messages.getMainMessage(DialogAction.Type.OK.getMsgKey(), locale));
reloginBtn.addClickListener(event -> ui.getApp().recreateUi(ui));
String iconName = beanLocator.get(Icons.class).get(DialogAction.Type.OK.getIconKey());
reloginBtn.setIcon(beanLocator.get(IconResolver.class).getIconResource(iconName));
ClientConfig clientConfig = beanLocator.get(Configuration.class).getConfig(ClientConfig.class);
setClickShortcut(reloginBtn, clientConfig.getCommitShortcut());
reloginBtn.focus();
layout.addComponent(messageLab);
layout.addComponent(reloginBtn);
layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT);
ui.addWindow(dialog);
dialog.center();
if (ui.isTestMode()) {
dialog.setCubaId("optionDialog");
reloginBtn.setCubaId("reloginBtn");
}
if (ui.isPerformanceTestMode()) {
dialog.setId(ui.getTestIdManager().getTestId("optionDialog"));
reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn"));
}
}
use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class ShowLinkAction method actionPerform.
@Override
public void actionPerform(com.haulmont.cuba.gui.components.Component component) {
if (ds == null) {
return;
}
Messages messages = AppBeans.get(Messages.NAME);
WindowManager wm = App.getInstance().getWindowManager();
wm.showMessageDialog(messages.getMainMessage("table.showLinkAction"), compileLink(ds), Frame.MessageType.CONFIRMATION_HTML);
}
use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class ShowLinkAction method compileLink.
protected String compileLink(CollectionDatasource ds) {
StringBuilder sb = new StringBuilder();
Messages messages = AppBeans.get(Messages.NAME);
sb.append(messages.getMainMessage("table.showLinkAction.link")).append("<br/>");
sb.append("<textarea class=\"c-table-showlink-textarea\" autofocus=\"true\" readonly=\"true\">").append(handler.makeLink(ds.getItem()).replace("&", "&")).append("</textarea>");
return sb.toString();
}
use of com.haulmont.cuba.core.global.Messages in project cuba by cuba-platform.
the class CronValidator method validate.
@Override
public void validate(Object value) throws ValidationException {
if (value != null) {
ServerInfoService serverInfoService = AppBeans.get(ServerInfoService.NAME);
Messages messages = AppBeans.get(Messages.NAME);
try {
new CronSequenceGenerator(value.toString(), serverInfoService.getTimeZone());
} catch (Exception e) {
throw new ValidationException(messages.getMessage(CronValidator.class, "validation.cronInvalid"));
}
}
}
Aggregations