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.

ServerConnector.java 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client;
  5. import java.util.Collection;
  6. import com.google.gwt.event.shared.GwtEvent;
  7. import com.google.gwt.event.shared.HandlerRegistration;
  8. import com.vaadin.terminal.gwt.client.communication.ClientRpc;
  9. import com.vaadin.terminal.gwt.client.communication.SharedState;
  10. import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler;
  11. /**
  12. * Interface implemented by all client side classes that can be communicate with
  13. * the server. Classes implementing this interface are initialized by the
  14. * framework when needed and have the ability to communicate with the server.
  15. *
  16. * @author Vaadin Ltd
  17. * @version @VERSION@
  18. * @since 7.0.0
  19. */
  20. public interface ServerConnector extends Connector {
  21. /**
  22. * Sets a new state for the connector.
  23. *
  24. * @param state
  25. * The new state
  26. * @deprecated This should be removed. Framework should update what is
  27. * returned by getState() instead of setting a new state object.
  28. * Note that this must be done either so that setState accepts a
  29. * state object once (first time received from the server) or
  30. * getState() in AbstractConnector uses a generated class to
  31. * create the state object (like RpcProy.craete())
  32. */
  33. @Deprecated
  34. public void setState(SharedState state);
  35. /**
  36. * Gets ApplicationConnection instance that created this connector.
  37. *
  38. * @return The ApplicationConnection as set by
  39. * {@link #doInit(String, ApplicationConnection)}
  40. */
  41. public ApplicationConnection getConnection();
  42. /**
  43. * Tests whether the connector is enabled or not. Disabled connectors will
  44. * ignore all attempts at communications. Received messages will be
  45. * discarded. This method must check that the connector is enabled in
  46. * context, that is if it's parent is disabled, this method must return
  47. * false.
  48. *
  49. * @return true if the connector is enabled, false otherwise
  50. */
  51. public boolean isEnabled();
  52. /**
  53. *
  54. * Called once by the framework to initialize the connector.
  55. * <p>
  56. * Note that the shared state is not yet available at this point nor any
  57. * hierarchy information.
  58. */
  59. public void doInit(String connectorId, ApplicationConnection connection);
  60. /**
  61. * For internal use by the framework: returns the registered RPC
  62. * implementations for an RPC interface identifier.
  63. *
  64. * TODO interface identifier type or format may change
  65. *
  66. * @param rpcInterfaceId
  67. * RPC interface identifier: fully qualified interface type name
  68. * @return RPC interface implementations registered for an RPC interface,
  69. * not null
  70. */
  71. public <T extends ClientRpc> Collection<T> getRpcImplementations(
  72. String rpcInterfaceId);
  73. /**
  74. * Adds a handler that is called whenever some part of the state has been
  75. * updated by the server.
  76. *
  77. * @param handler
  78. * The handler that should be added.
  79. * @return A handler registration reference that can be used to unregister
  80. * the handler
  81. */
  82. public HandlerRegistration addStateChangeHandler(StateChangeHandler handler);
  83. /**
  84. * Sends the given event to all registered handlers.
  85. *
  86. * @param event
  87. * The event to send.
  88. */
  89. public void fireEvent(GwtEvent<?> event);
  90. /**
  91. * Event called when connector has been unregistered.
  92. */
  93. public void onUnregister();
  94. }