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

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

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

Messages.getMainMessage介绍

[英]Returns localized message using main message pack.
Locale is determined by the current user session.
[中]使用主消息包返回本地化消息。
区域设置由当前用户会话决定。

代码示例

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

@Override
  public String getCaption() {
    return messages.getMainMessage("actions.Ok");
  }
});

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

/**
   * @param temporalType a temporal type
   * @return default date format string for passed temporal type
   */
  public String getDefaultDateFormat(TemporalType temporalType) {
    return temporalType == TemporalType.DATE
        ? messages.getMainMessage("dateFormat")
        : messages.getMainMessage("dateTimeFormat");
  }
}

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

@Override
  public String getCaption() {
    return messages.getMainMessage("action.switch");
  }
},

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

@Inject
protected void setMessages(Messages messages) {
  this.messages = messages;
  this.caption = messages.getMainMessage("actions.BulkEdit");
}

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

/**
 * Provides confirmation dialog title.
 * @return  localized title
 */
public String getConfirmationTitle() {
  if (confirmationTitle != null)
    return confirmationTitle;
  else {
    Messages messages = AppBeans.get(Messages.NAME);
    return messages.getMainMessage("dialogs.Confirmation");
  }
}

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

@Override
public String getCaption() {
  Messages messages = AppBeans.get(Messages.NAME);
  return messages.getMainMessage(name);
}

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

@Inject
public void setMessages(Messages messages) {
  this.messages = messages;
  component.setClearButtonCaption(messages.getMainMessage("FileUploadField.clearButtonCaption"));
  component.setFileNotSelectedMessage(messages.getMainMessage("FileUploadField.fileNotSelected"));
}

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

protected void showUnhandledExceptionOnLogin(@SuppressWarnings("unused") Exception e) {
  String title = messages.getMainMessage("loginWindow.loginFailed", app.getLocale());
  String message = messages.getMainMessage("loginWindow.pleaseContactAdministrator", app.getLocale());
  showNotification(title, message, NotificationType.ERROR);
}

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

public DynamicAttributesConditionCreator(String filterComponentName, com.haulmont.chile.core.model.MetaClass metaClass,
                     String propertyPath, String entityAlias) {
  super(RandomStringUtils.randomAlphabetic(10), filterComponentName, metaClass, entityAlias);
  this.propertyPath = propertyPath;
  Messages messages = AppBeans.get(Messages.NAME);
  locCaption = messages.getMainMessage("filter.dynamicAttributeConditionCreator");
  showImmediately = true;
}

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

protected void setupSerialChartDefaults(AbstractSerialChart chart) {
  chart.setDataDateFormat(ChartJsonSerializationContext.DEFAULT_JS_DATE_FORMAT);
  String format = messages.getMainMessage("amcharts.serialChart.balloonDateFormat");
  chart.setBalloonDateFormat(format);
}

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

@MetaProperty
  public String getDatatypeCaption() {
    Messages messages = AppBeans.get(Messages.NAME);
    return messages.getMainMessage("Datatype." + datatype);
  }
}

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

protected void initLogoImage() {
  String loginLogoImagePath = messages.getMainMessage("loginWindow.logoImage", app.getLocale());
  if (StringUtils.isBlank(loginLogoImagePath) || "loginWindow.logoImage".equals(loginLogoImagePath)) {
    logoImage.setVisible(false);
  } else {
    logoImage.setSource(ThemeResource.class).setPath(loginLogoImagePath);
  }
}

代码示例来源: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

@Override
public void refreshState() {
  if (target != null) {
    CollectionDatasource ds = target.getDatasource();
    if (ds != null && !captionInitialized) {
      setCaption(messages.getMainMessage("actions.Edit"));
    }
  }
  super.refreshState();
}

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

protected void showLoginException(String message) {
  String title = messages.getMainMessage("loginWindow.loginFailed", app.getLocale());
  showNotification(title, message, NotificationType.ERROR);
  if (loginByRememberMe) {
    loginByRememberMe = false;
    loginField.removeValueChangeListener(loginChangeListener);
    passwordField.removeValueChangeListener(loginChangeListener);
  }
}

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

public PaletteButton createGridLayoutButton() {
  PaletteButton button = createCommonButton();
  button.setCaption(messages.getMainMessage("gridLayout"));
  button.setIconFromSet(DashboardIcon.GRID_LAYOUT_ICON);
  button.setLayout(metadata.create(GridLayout.class));
  button.getLayout().setUuid(null);
  button.setDescription(messages.getMainMessage("gridLayout"));
  return button;
}

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

protected void initTimeZoneColumn() {
  usersTable.addGeneratedColumn("timeZone", entity -> {
    Label<String> label = uiComponents.create(Label.TYPE_DEFAULT);
    if (Boolean.TRUE.equals(entity.getTimeZoneAuto())) {
      label.setValue(messages.getMainMessage("timeZone.auto"));
    } else if (entity.getTimeZone() != null) {
      label.setValue(entity.getTimeZone());
    }
    return label;
  });
}

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

@Override
protected void initComponent(CubaPickerField<V> component) {
  Messages messages = beanLocator.get(Messages.NAME);
  setInputPrompt(messages.getMainMessage("searchPickerField.inputPrompt"));
  getComponent().setItemCaptionGenerator(this::generateItemCaption);
  getComponent().setFilterHandler(this::executeSearch);
}

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

@Override
  public Field createField(ReportInputParameter parameter) {
    DateField dateField = componentsFactory.createComponent(DateField.class);
    dateField.setResolution(DateField.Resolution.MIN);
    dateField.setDateFormat(messages.getMainMessage("dateTimeFormat"));
    if (BooleanUtils.isTrue(parameter.getDefaultDateIsCurrent())) {
      setCurrentDateAsNow(parameter, dateField);
    }
    return dateField;
  }
}

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

protected Component createTimeField(Class javaClass, final ValueProperty valueProperty) {
  TimeField<Object> timeField = componentsFactory.createComponent(TimeField.NAME);
  timeField.setDatatype(datatypeRegistry.get(javaClass));
  String formatStr = messages.getMainMessage("timeFormat");
  timeField.setFormat(formatStr);
  timeField.addValueChangeListener(e -> _setValue(e.getValue(), valueProperty));
  timeField.setValue(_getValue(valueProperty));
  timeField.setWidth(theme.get("cuba.gui.filter.Param.timeComponent.width"));
  return timeField;
}

相关文章