org.apache.myfaces.trinidad.change

## Class ChangeManager

- java.lang.Object
- - org.apache.myfaces.trinidad.change.ChangeManager

- Direct Known Subclasses:
    ChangeManagerWrapper, NullChangeManager, SessionChangeManager

      public abstract class ChangeManager
      extends Object

  The base class for all ChangeManagers. A ChangeManager should manage accumulation of Changes and also take care of their persistence.
  Version:
    $Name: $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/change/ChangeManager.java#0 $) $Date: 10-nov-2005.19:09:58 $

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ChangeManager.ChangeOutcome` Indicates the outcome of the attempt to apply a Change.
    `static class` | `ChangeManager.NotificationOutcome` Indicates whether the notification was handled: 1.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChangeManager()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addComponentChange(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, ComponentChange change)` Adds a ComponentChange to the current request for a specified component.
    `void` | `addDocumentChange(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, DocumentChange change)` Deprecated. use `addDocumentChangeWithOutcome(javax.faces.context.FacesContext,javax.faces.component.UIComponent,org.apache.myfaces.trinidad.change.DocumentChange)` instead
    `ChangeManager.ChangeOutcome` | `addDocumentChangeWithOutcome(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, DocumentChange change)` Add a DocumentChange for a specified component, and return the outcome of adding the change.
    `void` | `applyComponentChangesForCurrentView(javax.faces.context.FacesContext facesContext)` Applies all the ComponentChanges added so far for the current view.
    `void` | `applyComponentChangesForSubtree(javax.faces.context.FacesContext facesContext, javax.faces.component.NamingContainer root)` Applies the ComponentChanges added so far for components underneath the specified NamingContainer.
    `void` | `applySimpleComponentChanges(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)` Apply non-cross-component changes to a component in its original location.
    `protected static DocumentChange` | `createDocumentChange(ComponentChange change)` Use the conversion rules to attempt to retrieve the equivalent document change for a ComponentChange
    `ChangeManager.NotificationOutcome` | `documentChangeApplied(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, ComponentChange componentChange)` This method is called on the registered ChangeManager if a ChangeManager in its addComponentChange() implementation automatically creates an equivalent DocumentChange and applies the change.
    `static void` | `registerDocumentFactory(String targetClassName, String converterClassName)`
    `AttributeComponentChange` | `replaceAttributeChangeIfPresent(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, AttributeComponentChange attributeComponentChange)` Replace an AttributeComponentChange if it's present.

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

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

- - ### Constructor Detail

    - #### ChangeManager

          public ChangeManager()

  - ### Method Detail

    - #### registerDocumentFactory

          public static void registerDocumentFactory(String targetClassName,
                                     String converterClassName)

    - #### createDocumentChange

          protected static DocumentChange createDocumentChange(ComponentChange change)

      Use the conversion rules to attempt to retrieve the equivalent document change for a ComponentChange
      Parameters:
        `change` - to convert

    - #### addComponentChange

          public abstract void addComponentChange(javax.faces.context.FacesContext facesContext,
                                javax.faces.component.UIComponent uiComponent,
                                ComponentChange change)

      Adds a ComponentChange to the current request for a specified component. Component changes cannot be added for stamped children of an UIXIterator. A DocumentChange will be automatically created and applied on the ChangeManager registered for this application if the following conditions are met: 1. The ChangeManager registered for the application supports document change persistence 2. DocumentChange corresponding to the supplied ComponentChange can be created with the help of any registered DocumentChangeFactory When such a DocumentChange is added, the ChangeManager registered for the application is notified by means of calling its documentChangeApplied() method. This is to give the registered ChangeManager an opportunity to take any necessary action. For example, Session based ChangeManager implementations may choose to remove the ComponentChange, if any added earlier. Custom ChangeManager implementations should notify likewise if it automatically creates and adds a DocumentChange.
      Throws:
        `IllegalArgumentException` - if any of the supplied parameters were to be null.
      See Also:
        `DocumentChangeFactory`, `#documentChangeApplied(FacesContext, UIComponent, ComponentChange`

    - #### replaceAttributeChangeIfPresent

          public AttributeComponentChange replaceAttributeChangeIfPresent(javax.faces.context.FacesContext facesContext,
                                                                 javax.faces.component.UIComponent uiComponent,
                                                                 AttributeComponentChange attributeComponentChange)

      Replace an AttributeComponentChange if it's present.
      Parameters:
        `facesContext` -
        `uiComponent` -
        `attributeComponentChange` -
      Returns:
        the old change instance

    - #### addDocumentChange

          @Deprecated
          public void addDocumentChange(javax.faces.context.FacesContext facesContext,
                                          javax.faces.component.UIComponent uiComponent,
                                          DocumentChange change)

      Deprecated. use `addDocumentChangeWithOutcome(javax.faces.context.FacesContext,javax.faces.component.UIComponent,org.apache.myfaces.trinidad.change.DocumentChange)` instead
      Add a DocumentChange to this current request for a specified component. When called we will allow changes even if the component or its any ancestor is a stamped component by UIXIterator.
      Throws:
        `IllegalArgumentException` - if any of the supplied parameters were to be null.

    - #### addDocumentChangeWithOutcome

          public ChangeManager.ChangeOutcome addDocumentChangeWithOutcome(javax.faces.context.FacesContext facesContext,
                                                                 javax.faces.component.UIComponent uiComponent,
                                                                 DocumentChange change)

      Add a DocumentChange for a specified component, and return the outcome of adding the change.
      Parameters:
        `facesContext` - The FacesContext instance for the current request
        `uiComponent` - The UIComponent instance for which the DocumentChange is to be added
        `change` - The DocumentChange to be added
      Returns:
        The outcome of adding the document change
      Throws:
        `IllegalArgumentException` - if any of the supplied parameters were to be null.
      See Also:
        `ChangeManager.ChangeOutcome`

    - #### documentChangeApplied

          public ChangeManager.NotificationOutcome documentChangeApplied(javax.faces.context.FacesContext facesContext,
                                                                javax.faces.component.UIComponent component,
                                                                ComponentChange componentChange)

      This method is called on the registered ChangeManager if a ChangeManager in its addComponentChange() implementation automatically creates an equivalent DocumentChange and applies the change. The registered ChangeManager may choose to take some action based on the outcome of applying the document change. For example, session based ChangeManager implementations may choose to remove any earlier added ComponentChange if an equivalent document change is now successfully applied
      Parameters:
        `component` - The target UIComponent instance for which the DocumentChange was applied
        `componentChange` - The ComponentChange for which an equivalent DocumentChange was applied
      Returns:
        The outcome of handling this notification
      Throws:
        `IllegalArgumentException` - if the supplied ComponentChange is null. *

    - #### applyComponentChangesForCurrentView

          public void applyComponentChangesForCurrentView(javax.faces.context.FacesContext facesContext)

      Applies all the ComponentChanges added so far for the current view. Developers should not need to call this method. Internal implementation will call it as the component tree is built and is ready to take changes.
      Parameters:
        `facesContext` - The FacesContext instance for the current request.

    - #### applyComponentChangesForSubtree

          public void applyComponentChangesForSubtree(javax.faces.context.FacesContext facesContext,
                                             javax.faces.component.NamingContainer root)

      Applies the ComponentChanges added so far for components underneath the specified NamingContainer. Developers should not need to call this method. Internal implementation will call it as the component tree is built and is ready to take changes.
      Parameters:
        `facesContext` - The FacesContext instance for the current request.
        `root` - The NamingContainer that contains the component subtree to which ComponentChanges should be applied. If null, all changes are applied.
      Throws:
        `IllegalArgumentException` - if the root NamingContainer is not a UIComponent instance.

    - #### applySimpleComponentChanges

          public void applySimpleComponentChanges(javax.faces.context.FacesContext context,
                                         javax.faces.component.UIComponent component)

      Apply non-cross-component changes to a component in its original location. This is typically only called by tags that need to ensure that a newly created component instance is as up-to-date as possible.
      Parameters:
        `context` -
        `component` - Component to apply the simple changes to

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.