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.

CustomFieldSize.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package com.vaadin.tests.components.customfield;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractReindeerTestUI;
  4. import com.vaadin.ui.Component;
  5. import com.vaadin.ui.CustomField;
  6. import com.vaadin.ui.TextField;
  7. import com.vaadin.ui.VerticalLayout;
  8. public class CustomFieldSize extends AbstractReindeerTestUI {
  9. @Override
  10. protected void setup(VaadinRequest request) {
  11. VerticalLayout layout = new VerticalLayout();
  12. layout.setMargin(false);
  13. layout.setSpacing(false);
  14. setContent(layout);
  15. layout.setWidth("50px");
  16. layout.addComponent(new TextField());
  17. layout.addComponent(new TestCustomField());
  18. }
  19. @Override
  20. protected String getTestDescription() {
  21. return "Any part of a TextField wrapped in a CustomField should not be cut off even when the dimensions of the TextField exceed those of the CustomField";
  22. }
  23. @Override
  24. protected Integer getTicketNumber() {
  25. return 12482;
  26. }
  27. private static class TestCustomField extends CustomField<String> {
  28. private TextField field = new TextField();
  29. @Override
  30. protected Component initContent() {
  31. return field;
  32. }
  33. @Override
  34. public String getValue() {
  35. return field.getValue();
  36. }
  37. @Override
  38. protected void doSetValue(String value) {
  39. field.setValue(value);
  40. }
  41. }
  42. }