You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Field.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.ui;
  5. import com.vaadin.data.BufferedValidatable;
  6. import com.vaadin.data.Property;
  7. import com.vaadin.ui.Component.Focusable;
  8. /**
  9. * TODO document
  10. *
  11. * @author Vaadin Ltd.
  12. *
  13. * @param T
  14. * the type of values in the field, which might not be the same type
  15. * as that of the data source if converters are used
  16. *
  17. * @author IT Mill Ltd.
  18. */
  19. public interface Field<T> extends Component, BufferedValidatable, Property<T>,
  20. Property.ValueChangeNotifier, Property.ValueChangeListener,
  21. Property.Editor, Focusable {
  22. /**
  23. * Is this field required.
  24. *
  25. * Required fields must filled by the user.
  26. *
  27. * @return <code>true</code> if the field is required,otherwise
  28. * <code>false</code>.
  29. * @since 3.1
  30. */
  31. public boolean isRequired();
  32. /**
  33. * Sets the field required. Required fields must filled by the user.
  34. *
  35. * @param required
  36. * Is the field required.
  37. * @since 3.1
  38. */
  39. public void setRequired(boolean required);
  40. /**
  41. * Sets the error message to be displayed if a required field is empty.
  42. *
  43. * @param requiredMessage
  44. * Error message.
  45. * @since 5.2.6
  46. */
  47. public void setRequiredError(String requiredMessage);
  48. /**
  49. * Gets the error message that is to be displayed if a required field is
  50. * empty.
  51. *
  52. * @return Error message.
  53. * @since 5.2.6
  54. */
  55. public String getRequiredError();
  56. /**
  57. * An <code>Event</code> object specifying the Field whose value has been
  58. * changed.
  59. *
  60. * @author Vaadin Ltd.
  61. * @version
  62. * @VERSION@
  63. * @since 3.0
  64. */
  65. @SuppressWarnings("serial")
  66. public static class ValueChangeEvent extends Component.Event implements
  67. Property.ValueChangeEvent {
  68. /**
  69. * Constructs a new event object with the specified source field object.
  70. *
  71. * @param source
  72. * the field that caused the event.
  73. */
  74. public ValueChangeEvent(Field source) {
  75. super(source);
  76. }
  77. /**
  78. * Gets the Property which triggered the event.
  79. *
  80. * @return the Source Property of the event.
  81. */
  82. public Property getProperty() {
  83. return (Property) getSource();
  84. }
  85. }
  86. }