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.

ErrorMessages.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.vaadin.tests.components;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import com.vaadin.legacy.ui.LegacyTextField;
  5. import com.vaadin.server.CompositeErrorMessage;
  6. import com.vaadin.server.UserError;
  7. import com.vaadin.ui.Button;
  8. import com.vaadin.ui.ComboBox;
  9. public class ErrorMessages extends TestBase {
  10. @Override
  11. protected void setup() {
  12. Button bb = new Button("Button with CompositeError");
  13. List<UserError> errors = new ArrayList<UserError>();
  14. errors.add(new UserError("Error 1"));
  15. errors.add(new UserError("Error 2"));
  16. bb.setComponentError(new CompositeErrorMessage(errors));
  17. addComponent(bb);
  18. LegacyTextField tf = new LegacyTextField("", "Textfield with UserError");
  19. tf.setComponentError(new UserError("This is a failure"));
  20. addComponent(tf);
  21. ComboBox cb = new ComboBox("ComboBox with description and UserError");
  22. cb.setDescription("This is a combobox");
  23. cb.setComponentError(new UserError("This is a failure"));
  24. addComponent(cb);
  25. }
  26. @Override
  27. protected String getDescription() {
  28. return "The components all have error messages that should appear when hovering them";
  29. }
  30. @Override
  31. protected Integer getTicketNumber() {
  32. return 3712;
  33. }
  34. }