View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.trinidad.change;
20  
21  import javax.faces.component.NamingContainer;
22  import javax.faces.component.UIComponent;
23  import javax.faces.context.FacesContext;
24  
25  
26  /**
27   * Base class for ChangeManager implementations that wrap other ChangeManagers.
28   */
29  abstract public class ChangeManagerWrapper extends ChangeManager
30  {
31    /**
32     * Delegates the addComponentChange() implementation to the wrapped
33     * ChangeManager.
34     */
35    @Override
36    public void addComponentChange(
37      FacesContext context,
38      UIComponent component,
39      ComponentChange change)
40    {
41      getWrappedChangeManager().addComponentChange(context, component, change);
42    }
43  
44    /**
45     * Delegates the addDocumentChange() implementation to the wrapped ChangeManager.
46     * 
47     * @see #addDocumentChangeWithOutcome(FacesContext, UIComponent, DocumnentChange)
48     */
49    @Override
50    @SuppressWarnings("deprecation")
51    public void addDocumentChange(
52      FacesContext context,
53      UIComponent component,
54      DocumentChange change)
55    {
56      getWrappedChangeManager().addDocumentChange(context, component, change);
57    }
58  
59    /**
60     * Delegates the applyComponentChangesForCurrentView() implementation to 
61     * the wrapped ChangeManager.
62     */
63    @Override
64    public void applyComponentChangesForCurrentView(FacesContext context)
65    {
66      getWrappedChangeManager().applyComponentChangesForCurrentView(context);
67    }
68  
69    /**
70     * Delegates the applyComponentChangesForSubtree() implementation to the 
71     * wrapped ChangeManager.
72     */
73    @Override
74    public void applyComponentChangesForSubtree(FacesContext context, NamingContainer root)
75    {
76      getWrappedChangeManager().applyComponentChangesForSubtree(context, root);
77    }
78  
79    /**
80     * Delegates the applySimpleComponentChanges() implementation to the wrapped
81     * ChangeManager.
82     */
83    @Override
84    public void applySimpleComponentChanges(FacesContext context, UIComponent component)
85    {
86      getWrappedChangeManager().applySimpleComponentChanges(context, component);
87    }
88  
89    /**
90     * Delegates the documentChangeApplied() implementation to the wrapped ChangeManager.
91     */
92    @Override
93    public NotificationOutcome documentChangeApplied(
94      FacesContext facesContext, 
95      UIComponent component, 
96      ComponentChange componentChange)
97    {
98      return getWrappedChangeManager().documentChangeApplied(facesContext, 
99                                                             component, 
100                                                            componentChange);
101   }
102 
103   /**
104    * Delegates the addDocumentChangeWithOutcome() implementation to the wrapped ChangeManager.
105    */
106   @Override
107   public ChangeOutcome addDocumentChangeWithOutcome(
108     FacesContext facesContext,
109     UIComponent uiComponent,
110     DocumentChange change)
111   {
112     return getWrappedChangeManager().addDocumentChangeWithOutcome(facesContext, 
113                                                                   uiComponent, 
114                                                                   change);
115   }
116   
117   /**
118    * Delegates the replaceAttributeChangeIfPresent() implementation to the wrapped ChangeManager.
119    */
120   @Override
121   public AttributeComponentChange replaceAttributeChangeIfPresent(
122     FacesContext facesContext,
123     UIComponent uiComponent,
124     AttributeComponentChange attributeComponentChange)
125   {
126     return getWrappedChangeManager().replaceAttributeChangeIfPresent(facesContext,
127                                                                      uiComponent,
128                                                                      attributeComponentChange);
129   }
130 
131   /**  
132    * Returns the wrapped ChangeManager.
133    */  
134   abstract protected ChangeManager getWrappedChangeManager();
135 }