com.haulmont.cuba.core.global.Messages.formatMainMessage()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中com.haulmont.cuba.core.global.Messages.formatMainMessage()方法的一些代码示例,展示了Messages.formatMainMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Messages.formatMainMessage()方法的具体详情如下:
包路径:com.haulmont.cuba.core.global.Messages
类名称:Messages
方法名:formatMainMessage

Messages.formatMainMessage介绍

[英]Get localized message from main message pack and use it as a format string for parameters provided.
Locale is determined by the current user session.
[中]从主消息包获取本地化消息,并将其用作所提供参数的格式字符串。
区域设置由当前用户会话决定。

代码示例

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected String formatMainMessage(String key, Object... params) {
  return messages.formatMainMessage(key, params);
}

代码示例来源:origin: com.haulmont.cuba/cuba-portal

@Override
public String getMessage(@Nonnull String code, Object[] args, String defaultMessage, @Nonnull Locale locale) {
  if (args != null && args.length > 0) {
    return messages.formatMainMessage(code, args, locale);
  }
  return messages.getMainMessage(code, locale);
}

代码示例来源:origin: com.haulmont.cuba/cuba-portal

@Nonnull
@Override
public String getMessage(@Nonnull String code, Object[] args, @Nonnull Locale locale) throws NoSuchMessageException {
  if (args != null && args.length > 0) {
    return messages.formatMainMessage(code, args, locale);
  }
  return messages.getMainMessage(code, locale);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

protected String getDialogMessage(User user) {
  return messages.formatMainMessage(
      "toSubstitutedUser.msg",
      StringUtils.isBlank(user.getName()) ? user.getLogin() : user.getName()
  );
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

protected String getWarningMessage(User user) {
  if (user == null)
    return messages.getMainMessage("warning.userNotFound");
  return messages.formatMainMessage(
      "warning.msg",
      StringUtils.isBlank(user.getName()) ? user.getLogin() : user.getName()
  );
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

public String getDefaultErrorMessage() {
  MetaClass metaClass = metadata.getClass(beanClass);
  return messages.formatMainMessage("validation.defaultMsg",
      messages.getTools().getPropertyCaption(metaClass, beanProperty));
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected void loadRequired(FieldGroup fieldGroup, FieldGroup.FieldConfig field) {
  CategoryAttribute attribute = dynamicAttributes.getAttributeForMetaClass(rds.resolveCategorizedEntityClass(), field.getId());
  if (attribute != null) {
    String requiredMessage = messages.formatMainMessage(
        "validation.required.defaultMsg",
        attribute.getName()
    );
    field.setRequired(Boolean.TRUE.equals(attribute.getRequired()) && requiredControlEnabled);
    field.setRequiredMessage(requiredMessage);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

userMessage = customMessage;
  } else {
    userMessage = messages.formatMainMessage("rowLevelSecurity.entityAndOperationMessage",
        messages.getMessage(operationType), entityCaption);
  userMessage = customMessage;
} else {
  userMessage = messages.formatMainMessage("rowLevelSecurity.entityMessage", entityCaption);

代码示例来源:origin: com.haulmont.cuba/cuba-web

ui.getNotifications()
    .create(NotificationType.WARNING)
    .withCaption(messages.formatMainMessage("tooManyOpenTabs.message", maxTabCount))
    .show();

代码示例来源:origin: com.haulmont.cuba/cuba-idp

if (!authenticateInLdap(auth)) {
  throw new LoginException(
      messages.formatMainMessage("LoginException.InvalidLoginOrPassword",
          sessionLocale, auth.getUsername()));
    messages.formatMainMessage("LoginException.InvalidLoginOrPassword",
        sessionLocale, auth.getUsername()));

代码示例来源:origin: com.haulmont.cuba/cuba-gui

((Field) dynamicAttrComponent).setRequired(attribute.getRequired());
((Field) dynamicAttrComponent).setRequiredMessage(getMessages()
    .formatMainMessage("validation.required.defaultMsg", attribute.getLocaleName()));

代码示例来源:origin: com.haulmont.cuba/cuba-gui

/**
 * Hook to be implemented in subclasses. Called by the framework after committing datasources.
 * The default implementation notifies about commit and calls {@link #postInit()} if the window is not closing.
 *
 * @param committed whether any data were actually changed and committed
 * @param close     whether the window is going to be closed
 * @return true to continue, false to abort
 */
protected boolean postCommit(boolean committed, boolean close) {
  if (committed && !close) {
    if (showSaveNotification) {
      Entity entity = getItem();
      MetadataTools metadataTools = getBeanLocator().get(MetadataTools.class);
      showNotification(
          messages.formatMainMessage("info.EntitySave",
              messages.getTools().getEntityCaption(entity.getMetaClass()),
              metadataTools.getInstanceName(entity)),
          NotificationType.TRAY);
    }
    postInit();
    afterWindowApplyPostInit();
  }
  return true;
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

.withMessage(messages.formatMainMessage("substUserSelectDialog.msg", newUserName))
.withType(Dialogs.MessageType.WARNING)
.withActions(

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Override
public void actionPerform(com.haulmont.cuba.gui.components.Component component) {
  AppUI ui = AppUI.getCurrent();
  WebScreens screens = (WebScreens) ui.getScreens();
  screens.checkModificationsAndCloseAll()
      .then(() -> {
        App app = ui.getApp();
        try {
          app.getConnection().substituteUser(user);
          doAfterChangeUser();
        } catch (javax.persistence.NoResultException e) {
          Messages messages = AppBeans.get(Messages.NAME);
          app.getWindowManager().showNotification(
              messages.formatMainMessage("substitutionNotPerformed", user.getName()),
              Frame.NotificationType.WARNING
          );
          doRevert();
        }
      })
      .otherwise(this::doRevert);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

messages.formatMainMessage("multiupload.filesizeLimitExceed",
              e.getFileName(), getFileSizeLimitString())
      .withCaption(messages.formatMainMessage("upload.fileIncorrectExtension.message", e.getFileName()))
      .show();
});

代码示例来源:origin: com.haulmont.cuba/cuba-gui

field.setDatasource(ds);
field.setRequired(attribute.getRequired());
field.setRequiredMessage(getMessages().formatMainMessage(
    "validation.required.defaultMsg",
    attribute.getLocaleName()));

代码示例来源:origin: com.haulmont.cuba/cuba-web

.withCaption(messages.formatMainMessage("upload.fileTooBig.message", e.getFileName(), getFileSizeLimitString()))
      .show();
});
      .withCaption(messages.formatMainMessage("upload.fileIncorrectExtension.message", e.getFileName()))
      .show();
});

代码示例来源:origin: com.haulmont.cuba/cuba-gui

log.error("Exception on loading default filter '{}'", defaultFilter.getName(), e);
windowManager.showNotification(
    messages.formatMainMessage("filter.errorLoadingDefaultFilter", defaultFilter.getName()),
    Frame.NotificationType.ERROR);
defaultFilter = adHocFilter;

代码示例来源:origin: com.haulmont.cuba/cuba-gui

.withCaption(messages.getMainMessage("entityLocked.msg"))
.withDescription(
    messages.formatMainMessage("entityLocked.desc",
        lockInfo.getUser().getLogin(),
        datatypeFormatter.formatDateTime(lockInfo.getSince())

代码示例来源:origin: com.haulmont.cuba/cuba-web

component.getLabel().setValue(messages.formatMainMessage(msgKey, countValue));

相关文章