Package org.apache.tapestry5.internal.services

## Class ClientPersistentFieldStrategy

- java.lang.Object
- - org.apache.tapestry5.internal.services.ClientPersistentFieldStrategy

- All Implemented Interfaces:
    `LinkCreationListener2`, `PersistentFieldStrategy`

      public class ClientPersistentFieldStrategy
      extends java.lang.Object
      implements PersistentFieldStrategy, LinkCreationListener2

  Implements simple client-persistent properties. Most of the logic is delegated to an instance of `ClientPersistentFieldStorage`. This division of layer allows this service to be a true singleton, and a listener to the `LinkSource`, and allow per-request state to be isolated inside the other service.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ClientPersistentFieldStrategy​(ClientPersistentFieldStorage storage)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `createdComponentEventLink​(Link link, ComponentEventRequestParameters parameters)` | Invoked when an action link (a link that asks a component to perform an action) is created.
    `void` | `createdPageRenderLink​(Link link, PageRenderRequestParameters parameters)` | Invoked when a page link (a link that renders a page) is created.
    `void` | `discardChanges​(java.lang.String pageName)` | Discards any saved changes for the name page.
    `java.util.Collection<PersistentFieldChange>` | `gatherFieldChanges​(java.lang.String pageName)` | Finds all persistent changes previously stored for the named page (for the current active session or client).
    `void` | `postChange​(java.lang.String pageName, java.lang.String componentId, java.lang.String fieldName, java.lang.Object newValue)` | Posts a change of a persistent property.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientPersistentFieldStrategy

          public ClientPersistentFieldStrategy​(ClientPersistentFieldStorage storage)

  - ### Method Detail

    - #### gatherFieldChanges

          public java.util.Collection<PersistentFieldChange> gatherFieldChanges​(java.lang.String pageName)

      Description copied from interface: `PersistentFieldStrategy`
      Finds all persistent changes previously stored for the named page (for the current active session or client).
      Specified by:
        `gatherFieldChanges` in interface `PersistentFieldStrategy`

    - #### postChange

          public void postChange​(java.lang.String pageName,
                                 java.lang.String componentId,
                                 java.lang.String fieldName,
                                 java.lang.Object newValue)

      Description copied from interface: `PersistentFieldStrategy`
      Posts a change of a persistent property.
      Specified by:
        `postChange` in interface `PersistentFieldStrategy`
      Parameters:
        `pageName` - the name of the page containing the component
        `componentId` - the nested id path of the component (or null for the page's root component)
        `fieldName` - the name of the field whose persistent value has changed
        `newValue` - the new value for the field, possibly null

    - #### createdComponentEventLink

          public void createdComponentEventLink​(Link link,
                                                ComponentEventRequestParameters parameters)

      Description copied from interface: `LinkCreationListener2`
      Invoked when an action link (a link that asks a component to perform an action) is created. The listener may decide to encode additional query parameters into the link (via `Link.addParameter(String, String)`).
      Specified by:
        `createdComponentEventLink` in interface `LinkCreationListener2`
      Parameters:
        `link` - the newly created link
        `parameters` - information encoded into the link

    - #### createdPageRenderLink

          public void createdPageRenderLink​(Link link,
                                            PageRenderRequestParameters parameters)

      Description copied from interface: `LinkCreationListener2`
      Invoked when a page link (a link that renders a page) is created. The listener may decide to encode additional query parameters into the link (via `Link.addParameter(String, String)`).
      Specified by:
        `createdPageRenderLink` in interface `LinkCreationListener2`
      Parameters:
        `link` - the newly created link
        `parameters` - information encoded into the link

    - #### discardChanges

          public void discardChanges​(java.lang.String pageName)

      Description copied from interface: `PersistentFieldStrategy`
      Discards any saved changes for the name page. There is no expectation that data already gathered from the strategy and presumably dumped into component instance fields will be affected, but future field access (within this request or a later one) will show no data for the indicated page.
      Specified by:
        `discardChanges` in interface `PersistentFieldStrategy`
      Parameters:
        `pageName` - logical name of page whose field persistent data should be discarded