Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper |
|
| 1.3333333333333333;1.333 |
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.view.facelets.tag.composite; | |
20 | ||
21 | import javax.faces.FacesWrapper; | |
22 | import javax.faces.component.UIComponent; | |
23 | import javax.faces.context.FacesContext; | |
24 | import javax.faces.view.BehaviorHolderAttachedObjectHandler; | |
25 | ||
26 | /** | |
27 | * This wrapper is used in | |
28 | * FaceletViewDeclarationLanguage#retargetAttachedObjects(FacesContext, UIComponent, List<AttachedObjectHandler>) | |
29 | * to redirect the client behavior attached object when there is a chain of composite components. | |
30 | * | |
31 | * @author Leonardo Uribe (latest modification by $Author$) | |
32 | * @version $Revision$ $Date$ | |
33 | */ | |
34 | 0 | public class ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper |
35 | implements BehaviorHolderAttachedObjectHandler, FacesWrapper<BehaviorHolderAttachedObjectHandler> | |
36 | { | |
37 | ||
38 | private final BehaviorHolderAttachedObjectHandler _delegate; | |
39 | private final String _eventName; | |
40 | ||
41 | public ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper( | |
42 | BehaviorHolderAttachedObjectHandler delegate, String eventName) | |
43 | { | |
44 | 0 | super(); |
45 | 0 | _delegate = delegate; |
46 | 0 | _eventName = eventName; |
47 | 0 | } |
48 | ||
49 | public void applyAttachedObject(FacesContext context, UIComponent parent) | |
50 | { | |
51 | 0 | _delegate.applyAttachedObject(context, parent); |
52 | 0 | } |
53 | ||
54 | public String getEventName() | |
55 | { | |
56 | 0 | return _eventName; |
57 | } | |
58 | ||
59 | public String getWrappedEventName() | |
60 | { | |
61 | 0 | if (_delegate instanceof ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper) |
62 | { | |
63 | 0 | return ((ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper) _delegate).getWrappedEventName(); |
64 | } | |
65 | else | |
66 | { | |
67 | 0 | return _delegate.getEventName(); |
68 | } | |
69 | } | |
70 | ||
71 | public String getFor() | |
72 | { | |
73 | 0 | return _delegate.getFor(); |
74 | } | |
75 | ||
76 | public BehaviorHolderAttachedObjectHandler getWrapped() | |
77 | { | |
78 | 0 | return _delegate; |
79 | } | |
80 | } |