Guest User

Untitled

a guest
Jan 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. FruitOption
  2. "No fruit chosen"
  3. Orange
  4. Banana
  5.  
  6. AnimalOption
  7. "No animal chosen"
  8. Dog
  9. Cat
  10.  
  11. /**
  12. * Returns the display value for the null value.
  13. * The default behavior is to look the value up by
  14. * using the key retrieved by calling: <code>getNullValidKey()</code>.
  15. *
  16. * @return The value to display for null
  17. */
  18. protected String getNullValidDisplayValue() {
  19. String option =
  20. getLocalizer().getStringIgnoreSettings(getNullValidKey(), this, null, null);
  21. if (Strings.isEmpty(option)) {
  22. option = getLocalizer().getString("nullValid", this, "");
  23. }
  24. return option;
  25. }
  26.  
  27. /**
  28. * Return the localization key for the nullValid value
  29. *
  30. * @return getId() + ".nullValid"
  31. */
  32. protected String getNullValidKey() {
  33. return getId() + ".nullValid";
  34. }
  35.  
  36. /**
  37. * Returns the display value if null is not valid but is selected.
  38. * The default behavior is to look the value up by using the key
  39. * retrieved by calling: <code>getNullKey()</code>.
  40. *
  41. * @return The value to display if null is not valid but is
  42. * selected, e.g. "Choose One"
  43. */
  44. protected String getNullKeyDisplayValue() {
  45. String option =
  46. getLocalizer().getStringIgnoreSettings(getNullKey(), this, null, null);
  47.  
  48. if (Strings.isEmpty(option)) {
  49. option = getLocalizer().getString("null", this, CHOOSE_ONE);
  50. }
  51. return option;
  52. }
  53.  
  54. /**
  55. * Return the localization key for null value
  56. *
  57. * @return getId() + ".null"
  58. */
  59. protected String getNullKey() {
  60. return getId() + ".null";
  61. }
Add Comment
Please, Sign In to add comment