org.carewebframework.common.StrUtil.getLabel()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(99)

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

StrUtil.getLabel介绍

[英]Returns a formatted message given a label identifier. Recognizes line continuation with backslash characters.
[中]返回给定标签标识符的格式化消息。识别带有反斜杠字符的行继续。

代码示例

代码示例来源:origin: org.carewebframework/org.carewebframework.common

/**
 * Returns a formatted message given a label identifier.
 * 
 * @param id A label identifier.
 * @param args Optional replaceable parameters.
 * @return The formatted label.
 */
public static String getLabel(String id, Object... args) {
  return getLabel(id, null, args);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Invoked when inactivity timeout has occurred.
 */
public void onTimer$timer() {
  close(StrUtil.getLabel(Constants.LBL_LOGIN_FORM_TIMEOUT_MESSAGE));
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Returns the minimum length for random password.
 * 
 * @return Minimum length for random password.
 */
protected int getRandomPasswordLength() {
  return NumberUtils.toInt(StrUtil.getLabel(Constants.LBL_PASSWORD_RANDOM_LENGTH), 12);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.common

/**
 * Formats a message. If the message begins with "@", the remainder is assumed to be a label
 * name that is resolved.
 * 
 * @param msg Message to format or, if starts with "@", a label reference.
 * @param locale Optional locale
 * @param args Optional replaceable parameters.
 * @return The formatted message.
 */
public static String formatMessage(String msg, Locale locale, Object... args) {
  if (msg == null || msg.isEmpty()) {
    return msg;
  }
  
  String message = msg.startsWith("@") ? getLabel(msg, locale, args) : null;
  
  if (message == null && args != null && args.length > 0) {
    message = String.format(locale == null ? Localizer.getDefaultLocale() : locale, msg, args);
  }
  
  return message == null ? msg : message;
}

代码示例来源:origin: org.carewebframework/org.carewebframework.web.highcharts

/**
   * Load global settings into the specified options object.
   * 
   * @param cat This is the category prefix for the options.
   * @param options The options instance to receive the settings.
   */
  private void loadSettings(String cat, Options options) {
    for (Field field : options.getClass().getFields()) {
      try {
        String value = StrUtil.getLabel(LABEL_PREFIX + cat + field.getName());
        
        if (value != null && !value.isEmpty()) {
          Class<?> type = field.getType();
          
          if (type.isArray()) {
            field.set(options, value.split("\\,"));
          } else if (type == Boolean.class) {
            field.set(options, Boolean.valueOf(value));
          } else {
            field.set(options, value);
          }
        }
      } catch (Exception e) {}
    }
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Generates a new random password Length of password dictated by
 * {@link Constants#LBL_PASSWORD_RANDOM_LENGTH} and
 * {@link Constants#LBL_PASSWORD_RANDOM_CONSTRAINTS}
 * 
 * @return String The generated password
 */
@Override
public String generateRandomPassword() {
  int len = getRandomPasswordLength();
  return SecurityUtil.generateRandomPassword(len, len, StrUtil.getLabel(Constants.LBL_PASSWORD_RANDOM_CONSTRAINTS)
      .split("\n"));
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * @see org.carewebframework.api.security.ISecurityService#changePassword()
 */
@Override
public void changePassword() {
  if (canChangePassword()) {
    if (PopupDialog.popup(passwordChangeUrl, false, false) == null) {
      PromptDialog.showError(StrUtil.getLabel("password.change.dialog.unavailable"));
    }
    
  } else {
    PromptDialog.showWarning(StrUtil.getLabel(Constants.LBL_PASSWORD_CHANGE_UNAVAILABLE));
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

@Override
public void doAfterCompose(Component comp) throws Exception {
  super.doAfterCompose(comp);
  panel = comp;
  forced = !FrameworkUtil.isInitialized();
  String title;
  String label;
  
  if (!forced) {
    user = UserContext.getActiveUser();
    title = "password.change.dialog.panel.title";
    label = "password.change.dialog.label";
  } else {
    user = (IUser) arg.get("user");
    title = "password.change.dialog.expired.panel.title";
    label = "password.change.dialog.expired.label";
  }
  
  if (user == null) {
    doCancel();
  } else {
    lblTitle.setValue(StrUtil.getLabel(title) + " - " + user.getFullName());
    lblInfo.setValue(StrUtil.getLabel(label, MESSAGE_PASSWORD_RULES));
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Cancel the password change request.
 */
private void doCancel() {
  if (!forced) {
    panel.getRoot().detach();
  } else {
    Events.sendEvent(Events.ON_CLOSE, panel.getRoot(),
      StrUtil.getLabel("password.change.dialog.password.change.canceled"));
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.notification

String msg = StrUtil.getLabel("vistanotification.main.delete.confirm.prompt", s);
String msg = StrUtil.getLabel("vistanotification.main.delete.unable.prompt", s);

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.notification

/**
 * Process the next notification. If there are no more notifications, cancel processing. If this
 * is the last notification, hide this dialog before processing the notification.
 */
private void doNext() {
  if (iterator == null || !iterator.hasNext()) {
    cancelProcessing();
    return;
  }
  
  Notification notification = iterator.next();
  caption.setLabel(StrUtil.getLabel("vistanotification.processing.caption", ++currentIndex, total));
  caption.setTooltiptext(notification.getDisplayText());
  
  if (!iterator.hasNext()) {
    close();
  } else {
    root.setVisible(true);
  }
  
  process(notification);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.common

@Test
public void testBundle() {
  Localizer.registerMessageSource(new BundleMessageSource());
  Locale locale1 = new Locale("en");
  Locale locale2 = new Locale("fr");
  assertEquals("keyboard", StrUtil.getLabel("message.test1", locale1));
  assertEquals("clavier", StrUtil.getLabel("message.test1", locale2));
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * Submits the authentication request.
 */
public void onSubmit() {
  showMessage("");
  ISecurityDomain securityDomain = getSelectedSecurityDomain();
  String securityDomainId = securityDomain == null ? null : securityDomain.getLogicalId();
  String username = txtUsername.getValue().trim();
  String password = txtPassword.getValue();
  
  if (username.contains("\\")) {
    String[] pcs = username.split("\\\\", 2);
    securityDomainId = pcs[0];
    username = pcs[1];
  }
  
  if (!username.isEmpty() && !password.isEmpty() && !securityDomainId.isEmpty()) {
    session.setAttribute(Constants.DEFAULT_SECURITY_DOMAIN, securityDomainId);
    FrameworkWebSupport.setCookie(Constants.DEFAULT_SECURITY_DOMAIN, securityDomainId);
    session.setAttribute(Constants.DEFAULT_USERNAME, username);
    txtUsername.setValue(securityDomainId + "\\" + username);
    showStatus(StrUtil.getLabel(Constants.LBL_LOGIN_PROGRESS));
    session.setAttribute(org.carewebframework.security.spring.Constants.SAVED_REQUEST, savedRequest);
    Events.sendEvent("onSubmit", loginRoot.getRoot(), null);
  } else {
    showMessage(StrUtil.getLabel(Constants.LBL_LOGIN_REQUIRED_FIELDS));
    pane.setVisible(true);
  }
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

/**
 * @see org.zkoss.zk.ui.util.GenericAutowireComposer#doAfterCompose(org.zkoss.zk.ui.Component)
 */
@Override
public void doAfterCompose(HtmlBasedComponent comp) throws Exception {
  super.doAfterCompose(comp);
  lblMessage.setValue(AbstractSecurityService.getLogoutAttribute(Constants.LOGOUT_WARNING_ATTR,
    StrUtil.getLabel(Constants.LBL_LOGOUT_MESSAGE_DEFAULT)));
  btnLogin.setHref(AbstractSecurityService.getLogoutAttribute(Constants.LOGOUT_TARGET_ATTR, "/"));
  // Unregister this desktop to allow session to auto-invalidate if appropriate.
  Application.getInstance().register(desktop, false);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

getPage().setTitle(StrUtil.getLabel(title));
resetTimer();

代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core

savedRequest = (SavedRequest) arg.get("savedRequest");
AuthenticationException authError = (AuthenticationException) arg.get("authError");
String loginFailureMessage = StrUtil.getLabel(Constants.LBL_LOGIN_ERROR);//reset back to default
  loginFailureMessage = StrUtil.getLabel(Constants.LBL_LOGIN_ERROR_EXPIRED_USER);//override generic UserLoginException default
} else if (LoginWindowController.getException(authError, DisabledException.class) != null) {
    showStatus(StrUtil.getLabel(Constants.LBL_LOGIN_NO_VALID_DOMAINS));
    return;

代码示例来源:origin: org.hspconsortium.carewebframework/cwf-ui-patientheader

addDetail(StrUtil.getLabel("cwfpatientheader.nodetail.label"), null);

代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.notification

StrUtil.getLabel("vistanotification.processing.nohandler", notification.getType()));

相关文章