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  import org.apache.myfaces.trinidad.change.ChangeManager;
26  import org.apache.myfaces.trinidad.change.ComponentChange;
27  import org.apache.myfaces.trinidad.change.DocumentChange;
28  
29  /**
30   * Base class for ChangeManager implementations that wrap other ChangeManagers.
31   */
32  abstract public class ChangeManagerWrapper extends ChangeManager
33  {
34    /**
35     * Delegates the addComponentChange() implementation to the wrapped
36     * ChangeManager.
37     */
38    @Override
39    public void addComponentChange(
40      FacesContext context,
41      UIComponent component,
42      ComponentChange change)
43    {
44      getWrappedChangeManager().addComponentChange(context, component, change);
45    }
46  
47    /**
48     * Delegates the addDocumentChange() implementation to the wrapped
49     * ChangeManager.
50     */
51    @Override
52    public void addDocumentChange(
53      FacesContext context,
54      UIComponent component,
55      DocumentChange change)
56    {
57      getWrappedChangeManager().addDocumentChange(context, component, change);
58    }
59  
60    /**
61     * Delegates the applyComponentChangesForCurrentView() implementation to 
62     * the wrapped ChangeManager.
63     */
64    @Override
65    public void applyComponentChangesForCurrentView(FacesContext context)
66    {
67      getWrappedChangeManager().applyComponentChangesForCurrentView(context);
68    }
69  
70    /**
71     * Delegates the applyComponentChangesForSubtree() implementation to the 
72     * wrapped ChangeManager.
73     */
74    @Override
75    public void applyComponentChangesForSubtree(FacesContext context, NamingContainer root)
76    {
77      getWrappedChangeManager().applyComponentChangesForSubtree(context, root);
78    }
79  
80    /**
81     * Delegates the applySimpleComponentChanges() implementation to the wrapped
82     * ChangeManager.
83     */
84    @Override
85    public void applySimpleComponentChanges(FacesContext context, UIComponent component)
86    {
87      getWrappedChangeManager().applySimpleComponentChanges(context, component);
88    }
89  
90    /**  
91     * Returns the wrapped ChangeManager.
92     */  
93    abstract protected ChangeManager getWrappedChangeManager();
94  }