Interface ServerConnector

    • Method Detail

      • isEnabled

        boolean isEnabled()
        Tests whether the connector is enabled or not. This method checks that the connector is enabled in context, i.e. if the parent connector is disabled, this method must return false.
        Returns:
        true if the connector is enabled, false otherwise
      • doInit

        void doInit​(String connectorId,
                    ApplicationConnection connection)
        Called once by the framework to initialize the connector.

        Note that the shared state is not yet available at this point nor any hierarchy information.

      • getRpcImplementations

        <T extends ClientRpcCollection<T> getRpcImplementations​(String rpcInterfaceId)
        For internal use by the framework: returns the registered RPC implementations for an RPC interface identifier. TODO interface identifier type or format may change
        Parameters:
        rpcInterfaceId - RPC interface identifier: fully qualified interface type name
        Returns:
        RPC interface implementations registered for an RPC interface, not null
      • addStateChangeHandler

        com.google.web.bindery.event.shared.HandlerRegistration addStateChangeHandler​(StateChangeEvent.StateChangeHandler handler)
        Adds a handler that is called whenever any part of the state has been updated by the server.
        Parameters:
        handler - The handler that should be added.
        Returns:
        A handler registration reference that can be used to unregister the handler
      • removeStateChangeHandler

        void removeStateChangeHandler​(StateChangeEvent.StateChangeHandler handler)
        Removes a handler that is called whenever any part of the state has been updated by the server.
        Parameters:
        handler - The handler that should be removed.
      • addStateChangeHandler

        com.google.web.bindery.event.shared.HandlerRegistration addStateChangeHandler​(String propertyName,
                                                                                      StateChangeEvent.StateChangeHandler handler)
        Adds a handler that is called whenever the given part of the state has been updated by the server.
        Parameters:
        propertyName - the name of the property for which the handler should be called
        handler - The handler that should be added.
        Returns:
        A handler registration reference that can be used to unregister the handler
      • removeStateChangeHandler

        void removeStateChangeHandler​(String propertyName,
                                      StateChangeEvent.StateChangeHandler handler)
        Removes a handler that is called whenever any part of the state has been updated by the server.
        Parameters:
        propertyName - the name of the property for which the handler should be called
        handler - The handler that should be removed.
      • fireEvent

        void fireEvent​(com.google.gwt.event.shared.GwtEvent<?> event)
        Sends the given event to all registered handlers.
        Parameters:
        event - The event to send.
      • onUnregister

        void onUnregister()
        Event called when connector has been unregistered.
      • setParent

        void setParent​(ServerConnector parent)
        Sets the parent for this connector. This method should only be called by the framework to ensure that the connector hierarchy on the client side and the server side are in sync.

        Note that calling this method does not fire a ConnectorHierarchyChangeEvent. The event is fired only when the whole hierarchy has been updated.

        Parameters:
        parent - The new parent of the connector
      • updateEnabledState

        void updateEnabledState​(boolean enabledState)
      • setChildren

        void setChildren​(List<ServerConnector> children)
        Sets the children for this connector. This method should only be called by the framework to ensure that the connector hierarchy on the client side and the server side are in sync.

        Note that this method is separate from HasComponentsConnector.setChildComponents(List) and takes both extensions and child components. Both methods are called separately by the framework if the connector can have child components.

        Parameters:
        children - The new child connectors (extensions and/or components)
      • getChildren

        List<ServerConnector> getChildren()
        Returns the child connectors for this connector (child components and extensions).

        Note that the method HasComponentsConnector.getChildComponents() can be used to obtain the subset of child connectors that correspond to components and not extensions.

        Returns:
        A collection of child connectors (components or extensions) for this connector. An empty collection if there are no children. Never returns null.
      • getState

        SharedState getState()
        Gets the current shared state of the connector. Note that state is considered an internal part of the connector. You should not rely on the state object outside of the connector who owns it. If you depend on the state of other connectors you should use their public API instead of their state object directly.
        Returns:
        state The shared state object. Can be any sub type of SharedState. Never null.
        Since:
        7.0.
      • hasEventListener

        boolean hasEventListener​(String eventIdentifier)
        Checks if an event listener has been registered on the server side for the given event identifier.
        Parameters:
        eventIdentifier - The identifier for the event
        Returns:
        true if a listener has been registered on the server side, false otherwise