Class InitialPropertiesHandler


  • public class InitialPropertiesHandler
    extends Object
    Handles server initial property values with the purpose to prevent change their values from the client side.

    Initial property values have to be set from the server side. Client side may have default values which override server side values and those values are sent to the server (overriding server side values). This class prevents this. Only properties that have not been set form the server are sent from the client to the server. Properties that have been set from the server overrides any client side default value.

    Since:
    1.0
    Author:
    Vaadin Ltd
    See Also:
    StateTree.sendNodePropertySyncToServer(MapProperty)
    • Constructor Detail

      • InitialPropertiesHandler

        public InitialPropertiesHandler​(Registry registry)
        Creates a new instance connected to the given registry.
        Parameters:
        registry - the global registry
    • Method Detail

      • flushPropertyUpdates

        public void flushPropertyUpdates()
        Flushes collected property update queue (requested to be sent from the client to the server).

        Supposed to be called in the end of TreeChangeProcessor changes processing.

      • nodeRegistered

        public void nodeRegistered​(StateNode node)
        Notifies the handler about registered node.

        The method is called for the newly created node which is registered in the StateTree.

        Parameters:
        node - the registered node
      • handlePropertyUpdate

        public boolean handlePropertyUpdate​(MapProperty property)
        Handles property update request before it's sent to the server via RPC.

        The method returns true for the property which shouldn't be sent to the server because it's going to be handled by the handler (queued and sent later on if allowed).

        Parameters:
        property - property to handle
        Returns:
        true if property is handled by the handler, false otherwise