MyFaces Trinidad
  1. MyFaces Trinidad
  2. TRINIDAD-2239

Improve the ancestor based change filtering mechanism by introducing a formal ComponentChangeFilter

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.2-core
    • Fix Version/s: 2.0.2-core, 2.1.1-core
    • Component/s: Components
    • Labels:
      None

      Description

      TRINIDAD-2221 provided mechanism for ancestors to decide if ComponentChange targeting one of its descendants should be added to ChangeManager.

      This one is asking for further improvement to this mechanism, by formalizing the contract more. Proposal is to add the following API:

      1. An abstract class 'org.apache.myfaces.trinidad.change.ComponentChangeFilter' that clients / listeners can implement specializations to accept / reject certain changes on certain components, and then add to the components.

      public abstract class ComponentChangeFilter
      {
      public abstract Result accept(ComponentChange componentChange, UIComponent changeTargetComponent);

      public enum Result

      { ACCEPT, REJECT }

      }

      2. An abstract implementation 'org.apache.myfaces.trinidad.change.ComponentReferencingComponentChangeFilter' to solve usecases where such a filter needs to hold component reference.
      One such usecase is where ComponentChanges belonging to certain component subtree is rejected, by keeping a reference to the subtree root component. We leverage on 'org.apache.myfaces.trinidad.util.ComponentReference' for this implementation.

      3. The following methods on UIXComponentBase to be able to attach / detach ComponentChangeFilters to the components:

      public final void addComponentChangeFilter(ComponentChangeFilter componentChangeFilter)
      public final void removeComponentChangeFilter(ComponentChangeFilter componentChangeFilter)
      public final ComponentChangeFilter[] getComponentChangeFilters()

      ------------

      Implementation:

      In implementation of UIXComponentBase.addComponentChange(UIComponent component, ComponentChange change), we will not add a ComponentChange if any of the ComponentChangeFilters that is attached to the target component itself or any of its ancestors rejects the ComponentChange.

        Activity

          People

          • Assignee:
            Scott O'Bryan
            Reporter:
            Prakash Udupa
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 24h
              24h
              Remaining:
              Remaining Estimate - 24h
              24h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development