Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ConnectorHierarchyChangeEvent.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright 2011 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 ComponentContainerConnector 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 ComponentContainerConnector} for which this event
  63. * occurred.
  64. *
  65. * @return The {@link ComponentContainerConnector} whose child collection
  66. * has changed. Never returns null.
  67. */
  68. public ComponentContainerConnector getParent() {
  69. return parent;
  70. }
  71. /**
  72. * Sets the {@link ComponentContainerConnector} for which this event
  73. * occurred.
  74. *
  75. * @param The
  76. * {@link ComponentContainerConnector} whose child collection has
  77. * changed.
  78. */
  79. public void setParent(ComponentContainerConnector parent) {
  80. this.parent = parent;
  81. }
  82. public interface ConnectorHierarchyChangeHandler extends Serializable,
  83. EventHandler {
  84. public void onConnectorHierarchyChange(
  85. ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent);
  86. }
  87. @Override
  88. public void dispatch(ConnectorHierarchyChangeHandler handler) {
  89. handler.onConnectorHierarchyChange(this);
  90. }
  91. @Override
  92. public GwtEvent.Type<ConnectorHierarchyChangeHandler> getAssociatedType() {
  93. return TYPE;
  94. }
  95. }