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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright 2000-2014 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 children 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. *
  48. * @return A collection of children for this connector. An empty collection
  49. * if there are no children. Never returns null.
  50. */
  51. public List<ComponentConnector> getChildComponents();
  52. /**
  53. * Sets the children for this connector. This method should only be called
  54. * by the framework to ensure that the connector hierarchy on the client
  55. * side and the server side are in sync.
  56. * <p>
  57. * Note that calling this method does not call
  58. * {@link ConnectorHierarchyChangeHandler#onConnectorHierarchyChange(ConnectorHierarchyChangeEvent)}
  59. * . The event method is called only when the hierarchy has been updated for
  60. * all connectors.
  61. *
  62. * @param children
  63. * The new child connectors
  64. */
  65. public void setChildComponents(List<ComponentConnector> children);
  66. /**
  67. * Adds a handler that is called whenever the child hierarchy of this
  68. * connector has been updated by the server.
  69. *
  70. * @param handler
  71. * The handler that should be added.
  72. * @return A handler registration reference that can be used to unregister
  73. * the handler
  74. */
  75. public HandlerRegistration addConnectorHierarchyChangeHandler(
  76. ConnectorHierarchyChangeHandler handler);
  77. }