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 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.customfield;
  17. import com.vaadin.server.VaadinRequest;
  18. import com.vaadin.tests.components.AbstractTestUI;
  19. import com.vaadin.ui.Component;
  20. import com.vaadin.ui.CustomField;
  21. import com.vaadin.ui.TextField;
  22. import com.vaadin.ui.VerticalLayout;
  23. /**
  24. *
  25. * @since
  26. * @author Vaadin Ltd
  27. */
  28. public class CustomFieldSize extends AbstractTestUI {
  29. @Override
  30. protected void setup(VaadinRequest request) {
  31. VerticalLayout layout = new VerticalLayout();
  32. setContent(layout);
  33. layout.setWidth("50px");
  34. layout.addComponent(new TextField());
  35. layout.addComponent(new TestCustomField());
  36. }
  37. @Override
  38. protected String getTestDescription() {
  39. 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";
  40. }
  41. @Override
  42. protected Integer getTicketNumber() {
  43. return 12482;
  44. }
  45. private static class TestCustomField extends CustomField<String> {
  46. private TextField field = new TextField();
  47. @Override
  48. protected Component initContent() {
  49. return field;
  50. }
  51. @Override
  52. public String getValue() {
  53. return field.getValue();
  54. }
  55. @Override
  56. protected void doSetValue(String value) {
  57. field.setValue(value);
  58. }
  59. }
  60. }