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.

ConnectorHierarchyChangeEvent.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.io.Serializable;
  18. import java.util.List;
  19. import com.google.gwt.event.shared.EventHandler;
  20. import com.google.gwt.event.shared.GwtEvent;
  21. import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler;
  22. import com.vaadin.client.communication.AbstractServerConnectorEvent;
  23. /**
  24. * Event for containing data related to a change in the {@link ServerConnector}
  25. * hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update
  26. * from the server has been fully processed and all hierarchy updates have been
  27. * completed.
  28. *
  29. * @author Vaadin Ltd
  30. * @since 7.0.0
  31. *
  32. */
  33. public class ConnectorHierarchyChangeEvent extends
  34. AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> {
  35. /**
  36. * Type of this event, used by the event bus.
  37. */
  38. public static final Type<ConnectorHierarchyChangeHandler> TYPE = new Type<ConnectorHierarchyChangeHandler>();
  39. List<ComponentConnector> oldChildren;
  40. private HasComponentsConnector parent;
  41. public ConnectorHierarchyChangeEvent() {
  42. }
  43. /**
  44. * Returns a collection of the old children for the connector. This was the
  45. * state before the update was received from the server.
  46. *
  47. * @return A collection of old child connectors. Never returns null.
  48. */
  49. public List<ComponentConnector> getOldChildren() {
  50. return oldChildren;
  51. }
  52. /**
  53. * Sets the collection of the old children for the connector.
  54. *
  55. * @param oldChildren
  56. * The old child connectors. Must not be null.
  57. */
  58. public void setOldChildren(List<ComponentConnector> oldChildren) {
  59. this.oldChildren = oldChildren;
  60. }
  61. /**
  62. * Returns the {@link HasComponentsConnector} for which this event occurred.
  63. *
  64. * @return The {@link HasComponentsConnector} whose child collection has
  65. * changed. Never returns null.
  66. */
  67. public HasComponentsConnector getParent() {
  68. return parent;
  69. }
  70. /**
  71. * Sets the {@link HasComponentsConnector} for which this event occurred.
  72. *
  73. * @param The
  74. * {@link HasComponentsConnector} whose child collection has
  75. * changed.
  76. */
  77. public void setParent(HasComponentsConnector parent) {
  78. this.parent = parent;
  79. }
  80. public interface ConnectorHierarchyChangeHandler extends Serializable,
  81. EventHandler {
  82. public void onConnectorHierarchyChange(
  83. ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent);
  84. }
  85. @Override
  86. public void dispatch(ConnectorHierarchyChangeHandler handler) {
  87. handler.onConnectorHierarchyChange(this);
  88. }
  89. @Override
  90. public GwtEvent.Type<ConnectorHierarchyChangeHandler> getAssociatedType() {
  91. return TYPE;
  92. }
  93. }