Allow ancestor components to transform and filter ComponentChanges added by 
their descendants
---------------------------------------------------------------------------------------------

                 Key: TRINIDAD-2221
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2221
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 2.0.0-beta-2
            Reporter: Blake Sullivan
            Assignee: Blake Sullivan
            Priority: Minor


Components currently directly add changes to the ChangeManager.  This causes 
issues with composition, where an ancestor may wish to modify the behavior of 
its implementation children.  The proposal is to add new protected and public 
apis to UIXComponentBase:

  /**
   * Adds a change for a Component, or the Component's subtree, returning the 
change actually added,
   * or <code>null</code>, if no change was added.  The proposed change may be 
rejected by the
   * component itself, one of its ancestors, or the ChangeManager 
implementation.
   * @param change     The change to add for this component
   * @return The ComponentChange actually added, or
   * <code>null</code> if no change was added.
   */
  public final ComponentChange addComponentChange(ComponentChange change)
  {
    return addComponentChange(this, change);
  }

  /**
   * Called when adding a change to a Component, or the Component's subtree.
   * The default implementation delegates the call to the parent, if possible, 
otherwise
   * it adds the change to the ChangeManager directly.
   * Subclasses can override this method to among other things, filter or 
transform the changes.
   * @param component  The component that the change is for
   * @param change     The change to add for this component
   * @return The ComponentChange actually added, or
   * <code>null</code> if no change was added.
   */
  protected ComponentChange addComponentChange(UIComponent component, 
ComponentChange change)

The also make the current addAttributeChange a convenience function:

  /**
   * Convenience function for
   * <code>addComponentChange(new AttributeComponentChange(attributeName, 
attributeValue));</code>
   * This function is not <code>final</code> for backwards compatibility 
reasons, however,
   * existing subclassers whould override <code>addComponentChange</code> 
instead.
   * @param attributeName
   * @param attributeValue
   * @see #addComponentChange(UIComponent, ComponentChange)
   */
  protected void addAttributeChange(
    String attributeName,
    Object attributeValue)
  {
    addComponentChange(new AttributeComponentChange(attributeName, 
attributeValue));
  }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to