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.

FormLayout.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.ui;
  17. import com.vaadin.shared.ui.MarginInfo;
  18. import com.vaadin.shared.ui.orderedlayout.FormLayoutState;
  19. /**
  20. * FormLayout is used to layout fields.
  21. *
  22. * FormLayout is a close relative of {@link VerticalLayout}, but in FormLayout
  23. * captions are rendered to the left of their respective components. Required
  24. * and validation indicators are shown between the captions and the fields.
  25. *
  26. * FormLayout by default has component spacing on. Also margin top and margin
  27. * bottom are by default on.
  28. *
  29. */
  30. public class FormLayout extends AbstractOrderedLayout {
  31. public FormLayout() {
  32. super();
  33. setSpacing(true);
  34. setMargin(new MarginInfo(true, false));
  35. setWidth(100, UNITS_PERCENTAGE);
  36. }
  37. /**
  38. * Constructs a FormLayout and adds the given components to it.
  39. *
  40. * @see AbstractOrderedLayout#addComponents(Component...)
  41. *
  42. * @param children
  43. * Components to add to the FormLayout
  44. */
  45. public FormLayout(Component... children) {
  46. this();
  47. addComponents(children);
  48. }
  49. /**
  50. * @deprecated This method currently has no effect as expand ratios are not
  51. * implemented in FormLayout
  52. */
  53. @Override
  54. @Deprecated
  55. public void setExpandRatio(Component component, float ratio) {
  56. super.setExpandRatio(component, ratio);
  57. }
  58. /**
  59. * @deprecated This method currently has no effect as expand ratios are not
  60. * implemented in FormLayout
  61. */
  62. @Override
  63. @Deprecated
  64. public float getExpandRatio(Component component) {
  65. return super.getExpandRatio(component);
  66. }
  67. @Override
  68. protected FormLayoutState getState() {
  69. return (FormLayoutState) super.getState();
  70. }
  71. }