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

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

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

Messages.getMainMessagePack介绍

暂无

代码示例

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

/**
 * Main messages pack used by GenericUI components and application code.
 * <br> Set up through app property {@code cuba.messagePack} depending on the client type and set of base projects.
 *
 * <br> This method is outdated but not deprecated because it is used in lots of places. Preferred method to
 * obtain the main message pack is {@link com.haulmont.cuba.core.global.Messages#getMainMessagePack()}.
 *
 * <br> To obtain a message from the main message pack use {@link com.haulmont.cuba.core.global.Messages#getMainMessage(String)}.
 */
public static String getMessagesPack() {
  Messages messages = AppBeans.get(Messages.NAME);
  return messages.getMainMessagePack();
}

代码示例来源:origin: com.haulmont.reports/reports-core

protected void appendFreeMarkerSettings(StringBuilder templateBody) {
  Messages messages = AppBeans.get(Messages.NAME);
  templateBody.append("\n<#setting boolean_format=\"").
      append(messages.getMessage(messages.getMainMessagePack(), "trueString")).
      append(",").
      append(messages.getMessage(messages.getMainMessagePack(), "falseString")).
      append("\">");
}

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

@Override
protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
  Pattern pattern = Pattern.compile("Class> (.+)");
  Matcher matcher = pattern.matcher(message);
  String entityClassName = "";
  if (matcher.find()) {
    entityClassName = matcher.group(1);
  }
  String msg;
  if (entityClassName.contains(".")) {
    String entityName = entityClassName.substring(entityClassName.lastIndexOf(".") + 1);
    String packageName = entityClassName.substring(0, entityClassName.lastIndexOf("."));
    String localizedEntityName = messages.getMessage(packageName, entityName);
    msg = messages.formatMessage(messages.getMainMessagePack(),
        "optimisticException.message", "\"" + localizedEntityName + "\"");
  } else {
    msg = messages.getMessage(messages.getMainMessagePack(), "optimisticExceptionUnknownObject.message");
  }
  windowManager.showNotification(msg, Frame.NotificationType.ERROR);
}

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

protected String getDefaultRequiredMessage(String name) {
    Messages messages = AppBeans.get(Messages.NAME);
        return messages.formatMessage(messages.getMainMessagePack(),
        "validation.required.defaultMsg", name);
  }
}

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

protected String loadResourceString(String caption) {
  return messages.getTools().loadString(messages.getMainMessagePack(), caption);
}

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

/**
 * @deprecated Use {@link #getDefaultRequiredMessage(MetaClass, String)}
 * @return default required message for specified property.
 */
@Deprecated
public String getDefaultRequiredMessage(MetaProperty metaProperty) {
  String notNullMessage = getNotNullMessage(metaProperty);
  if (notNullMessage != null) {
    return notNullMessage;
  }
  return messages.formatMessage(messages.getMainMessagePack(),
      "validation.required.defaultMsg", getPropertyCaption(metaProperty));
}

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

/**
 * Get default required message for specified property of MetaClass.
 *
 * @param metaClass     MetaClass containing the property
 * @param propertyName  property's name
 * @return default required message for specified property of MetaClass
 */
public String getDefaultRequiredMessage(MetaClass metaClass, String propertyName) {
  MetaPropertyPath propertyPath = metaClass.getPropertyPath(propertyName);
  if (propertyPath != null) {
    String notNullMessage = getNotNullMessage(propertyPath.getMetaProperty());
    if (notNullMessage != null) {
      return notNullMessage;
    }
  }
  return messages.formatMessage(messages.getMainMessagePack(),
      "validation.required.defaultMsg", getPropertyCaption(metaClass, propertyName));
}

代码示例来源:origin: com.haulmont.reports/reports-core

switch (temporal.value()) {
  case DATE:
    dateMask = messages.getMessage(messages.getMainMessagePack(), "dateFormat");
    break;
  case TIME:
    dateMask = messages.getMessage(messages.getMainMessagePack(), "timeFormat");
    break;
  default:
    dateMask = messages.getMessage(messages.getMainMessagePack(), "dateTimeFormat");
dateMask = messages.getMessage(messages.getMainMessagePack(), "dateTimeFormat");

相关文章