org.apache.myfaces.trinidad.change

## Class MoveChildComponentChange

- java.lang.Object
- - org.apache.myfaces.trinidad.change.ComponentChange
  - - org.apache.myfaces.trinidad.change.MoveChildComponentChange

- All Implemented Interfaces:
    Serializable, DocumentChange

      public final class MoveChildComponentChange
      extends ComponentChange
      implements DocumentChange

  Change specialization for moving a child from one container to another. MoveChildComponent should be registered on a parent component that is common to the child being moved and the container component at destination. In other words, while calling addComponentChange() or addDocumentChange() methods on the ChangeManager to add a MoveChildComponentChange, the common parent component instance must be passed as an argument. The add() utility method in this class can be alternatively used to conveniently register the change against the common parent. While applying this change, if a child with the same id as the movable child were to be already present in the destination container, the move operation is aborted.
  See Also:
    `add(FacesContext, ChangeManager)`, `ChangeManager.addComponentChange(FacesContext, UIComponent, ComponentChange)`, `ChangeManager.addDocumentChange(FacesContext, UIComponent, DocumentChange)`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MoveChildComponentChange(javax.faces.component.UIComponent movableChild, javax.faces.component.UIComponent destinationContainer)` Constructs a MoveChildComponentChange.
    `MoveChildComponentChange(javax.faces.component.UIComponent movableChild, javax.faces.component.UIComponent destinationContainer, javax.faces.component.UIComponent insertBeforeComponent)` Constructs a MoveChildComponentChange.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.faces.component.UIComponent` | `add(javax.faces.context.FacesContext facesContext, ChangeManager changeManager)` Convenience method to add this MoveChildComponentChange to the supplied ChangeManager.
    `void` | `changeComponent(javax.faces.component.UIComponent changeTargetComponent)` Apply this change to the specified component.
    `void` | `changeDocument(Node changeTargetNode)` Given the DOM Node representing a Component, apply any necessary DOM changes.
    `boolean` | `equals(Object o)`
    `String` | `getDestinationLogicalScopedId()` Returns the absolute logical scopedId of the movable component as it would be after the move.
    `String` | `getDestinationScopedId()` Returns the absolute scopedId (relative to the ViewRoot) of the movable component as it would be after the move
    `boolean` | `getForcesDocumentReload()` Returns true if adding the DocumentChange should force the JSP Document to reload
    `String` | `getSourceLogicalScopedId()` Returns the absolute logical scopedId of the movable component as it is before the move.
    `String` | `getSourceScopedId()` Returns the absolute scopedId (relative to the ViewRoot) of the movable component as it is before the move
    `int` | `hashCode()`
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MoveChildComponentChange

          public MoveChildComponentChange(javax.faces.component.UIComponent movableChild,
                                  javax.faces.component.UIComponent destinationContainer)

      Constructs a MoveChildComponentChange. The child will be appended to the list of children of the destinationContainer.
      Parameters:
        `movableChild` - The child component to be moved.
        `destinationContainer` - The destination component into which the child component is to be moved.
      Throws:
        `IllegalArgumentException` - If movableChild or destinationContainer is null

    - #### MoveChildComponentChange

          public MoveChildComponentChange(javax.faces.component.UIComponent movableChild,
                                  javax.faces.component.UIComponent destinationContainer,
                                  javax.faces.component.UIComponent insertBeforeComponent)

      Constructs a MoveChildComponentChange. The child will be inserted to the list of children of the destinationContainer, before the supplied insertBeforecomponent. If the supplied insertBeforeComponent is null, the child will be appended to the list of children of the destinationContainer. If the insertBeforeComponent is non-null, and if it were not to be found while applying this change, the movableChild will not be moved.
      Parameters:
        `movableChild` - The child component to be moved.
        `destinationContainer` - The destination component into which the child component is to be moved. This should not be null if the insertBeforeComponent is null.
        `insertBeforeComponent` - The component before which the moved child is to be inserted. This can be null, in which case the movableChild is appended.
      Throws:
        `IllegalArgumentException` - If movableChild is null or destinationContainer and insertBeforeComponent is null, or if a parent component common to movableChild and destinationContainer could not be found.

  - ### Method Detail

    - #### add

          public javax.faces.component.UIComponent add(javax.faces.context.FacesContext facesContext,
                                              ChangeManager changeManager)

      Convenience method to add this MoveChildComponentChange to the supplied ChangeManager. The change will be registered against a parent component that is common to the child being moved and the container component at destination.
      Parameters:
        `facesContext` - The FacesContext instance for the current request
        `changeManager` - The ChangeManager instance on which this MoveChildComponentChange is to be added.
      Returns:
        The common parent component against which this MoveChildComponentChange was registered.

    - #### changeComponent

          public void changeComponent(javax.faces.component.UIComponent changeTargetComponent)

      Apply this change to the specified component.
      Specified by:
        `changeComponent` in class `ComponentChange`
      Parameters:
        `changeTargetComponent` - The component that is a common parent to the movable child and the destination container.
      Throws:
        `IllegalArgumentException` - If the supplied changeTargetComponent is null.

    - #### changeDocument

          public void changeDocument(Node changeTargetNode)

      Given the DOM Node representing a Component, apply any necessary DOM changes. The node passed will be the Node that is a common parent for the movable child and the destination container. There is a limitation with the document change, that the movable child Node, destination container Node, and the common parent Node have to belong to the same document.
      Specified by:
        `changeDocument` in interface `DocumentChange`
      Parameters:
        `changeTargetNode` - DOM Node that is a common parent for the movable child and the destination container.
      Throws:
        `IllegalArgumentException` - If changeTargeNode were to be null.

    - #### getForcesDocumentReload

          public boolean getForcesDocumentReload()

      Returns true if adding the DocumentChange should force the JSP Document to reload
      Specified by:
        `getForcesDocumentReload` in interface `DocumentChange`
      Returns:
        true Since moving of components should force the document to reload

    - #### getSourceScopedId

          public String getSourceScopedId()

      Returns the absolute scopedId (relative to the ViewRoot) of the movable component as it is before the move

    - #### getDestinationScopedId

          public String getDestinationScopedId()

      Returns the absolute scopedId (relative to the ViewRoot) of the movable component as it would be after the move

    - #### getSourceLogicalScopedId

          public String getSourceLogicalScopedId()

      Returns the absolute logical scopedId of the movable component as it is before the move. The id returned here will be in context of the document where the component is defined. For example, consider a component that is defined in a base document and is relocated to a different component subtree as in included template (included by an UIXInclude component) via. its facet. In this case the logical id of the move component will be in context of base document (as if it was never relocated) and not the document that defines the including component.
      See Also:
        `getSourceScopedId()`

    - #### getDestinationLogicalScopedId

          public String getDestinationLogicalScopedId()

      Returns the absolute logical scopedId of the movable component as it would be after the move. The id returned here will be in context of the document where the component is defined. For example, consider a component that is defined in a base document and is relocated to a different component subtree as in included template (included by an UIXInclude component) via. its facet. In this case the logical id of the move component will be in context of base document (as if it was never relocated) and not the document that defines the including component.
      See Also:
        `getDestinationScopedId()`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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