@Override
 public void render(Context context, SafeHtmlBuilder sb) {
   if (!isEnabled()) {
     if (getValue()) {
       sb.append(INPUT_CHECKED_DISABLED);
     } else {
       sb.append(INPUT_UNCHECKED_DISABLED);
     }
     if (getLabel() != null && !StringUtils.isEmpty(getLabel())) {
       sb.append(SafeHtmlUtils.fromString(getLabel()));
     }
   } else {
     super.render(context, sb);
   }
 }
예제 #2
0
 /**
  * Checks if a String is not empty ("") and not null.
  *
  * <pre>
  * StringUtils.isNotEmpty(null)      = false
  * StringUtils.isNotEmpty("")        = false
  * StringUtils.isNotEmpty(" ")       = true
  * StringUtils.isNotEmpty("bob")     = true
  * StringUtils.isNotEmpty("  bob  ") = true
  * </pre>
  *
  * @param str the String to check, may be null
  * @return <code>true</code> if the String is not empty and not null
  */
 public static boolean isNotEmpty(String str) {
   return !StringUtils.isEmpty(str);
 }