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.

SingleComponentContainer.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2000-2018 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.ui.HasComponents.ComponentAttachDetachNotifier;
  18. /**
  19. * Interface for component containers that have one child component and do not
  20. * support adding or removing components.
  21. *
  22. * For component containers that support multiple children, see
  23. * {@link ComponentContainer} instead.
  24. *
  25. * @since 7.0
  26. */
  27. public interface SingleComponentContainer
  28. extends HasComponents, ComponentAttachDetachNotifier {
  29. /**
  30. * Gets the number of children this {@link SingleComponentContainer} has.
  31. * This must be symmetric with what {@link #iterator()} returns and thus
  32. * typically return 1 if the content is set, 0 otherwise.
  33. *
  34. * @return The number of child components this container has.
  35. */
  36. public int getComponentCount();
  37. /**
  38. * Gets the content of this container. The content is a component that
  39. * serves as the outermost item of the visual contents.
  40. *
  41. * @return a component to use as content
  42. *
  43. * @see #setContent(Component)
  44. */
  45. public Component getContent();
  46. /**
  47. * Sets the content of this container. The content is a component that
  48. * serves as the outermost item of the visual contents.
  49. *
  50. * The content should always be set, either as a constructor parameter or by
  51. * calling this method.
  52. *
  53. */
  54. public void setContent(Component content);
  55. }