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.

HasComponentsConnector.java 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.client;
  17. import java.util.List;
  18. import com.google.gwt.event.shared.HandlerRegistration;
  19. import com.google.gwt.user.client.ui.HasWidgets;
  20. import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler;
  21. import com.vaadin.ui.HasComponents;
  22. /**
  23. * An interface used by client-side connectors whose widget is a component
  24. * container (implements {@link HasWidgets}).
  25. */
  26. public interface HasComponentsConnector extends ServerConnector {
  27. /**
  28. * Update child components caption, description and error message.
  29. *
  30. * <p>
  31. * Each component is responsible for maintaining its caption, description
  32. * and error message. In most cases components doesn't want to do that and
  33. * those elements reside outside of the component. Because of this layouts
  34. * must provide service for it's childen to show those elements for them.
  35. * </p>
  36. *
  37. * @param connector
  38. * Child component for which service is requested.
  39. */
  40. void updateCaption(ComponentConnector connector);
  41. /**
  42. * Returns the child components for this connector.
  43. * <p>
  44. * The children for this connector are defined as all {@link HasComponents}s
  45. * whose parent is this {@link HasComponentsConnector}.
  46. * <p>
  47. * Note that the method {@link ServerConnector#getChildren()} can return a
  48. * larger list of children including both the child components and any
  49. * extensions registered for the connector.
  50. *
  51. * @return A collection of child components for this connector. An empty
  52. * collection if there are no children. Never returns null.
  53. */
  54. public List<ComponentConnector> getChildComponents();
  55. /**
  56. * Sets the children for this connector. This method should only be called
  57. * by the framework to ensure that the connector hierarchy on the client
  58. * side and the server side are in sync.
  59. * <p>
  60. * Note that calling this method does not call
  61. * {@link ConnectorHierarchyChangeHandler#onConnectorHierarchyChange(ConnectorHierarchyChangeEvent)}
  62. * . The event method is called only when the hierarchy has been updated for
  63. * all connectors.
  64. * <p>
  65. * Note that this method is separate from
  66. * {@link ServerConnector#setChildren(List)} and contains only child
  67. * components. Both methods are called separately by the framework if the
  68. * connector implements {@link HasComponentsConnector}.
  69. *
  70. * @param children
  71. * The new child connectors (components only)
  72. */
  73. public void setChildComponents(List<ComponentConnector> children);
  74. /**
  75. * Adds a handler that is called whenever the child hierarchy of this
  76. * connector has been updated by the server.
  77. *
  78. * @param handler
  79. * The handler that should be added.
  80. * @return A handler registration reference that can be used to unregister
  81. * the handler
  82. */
  83. public HandlerRegistration addConnectorHierarchyChangeHandler(
  84. ConnectorHierarchyChangeHandler handler);
  85. }