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 2.9KB

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