Coverage Report - javax.faces.component.behavior.ClientBehaviorContext
 
Classes in this File Line Coverage Branch Coverage Complexity
ClientBehaviorContext
0%
0/9
0%
0/6
1.533
ClientBehaviorContext$ClientBehaviorContextImpl
0%
0/12
N/A
1.533
ClientBehaviorContext$Parameter
0%
0/8
0%
0/2
1.533
 
 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 javax.faces.component.behavior;
 20  
 
 21  
 import java.util.Collection;
 22  
 
 23  
 import javax.faces.component.UIComponent;
 24  
 import javax.faces.context.FacesContext;
 25  
 
 26  
 /**
 27  
  * @since 2.0
 28  
  */
 29  0
 public abstract class ClientBehaviorContext
 30  
 {
 31  
 
 32  
     public static ClientBehaviorContext createClientBehaviorContext(FacesContext context,
 33  
                                                                     UIComponent component,
 34  
                                                                     String eventName,
 35  
                                                                     String sourceId,
 36  
                                                                     Collection<Parameter> parameters)
 37  
     {
 38  
         // This method is weird... Creating a dummy impl class seems stupid, yet I don't see any other way...
 39  0
         if(context == null)
 40  
         {
 41  0
             throw new NullPointerException("context argument must not be null");
 42  
         }
 43  0
         if(component == null)
 44  
         {
 45  0
             throw new NullPointerException("component argument must not be null");
 46  
         }
 47  0
         if(eventName == null)
 48  
         {
 49  0
             throw new NullPointerException("eventName argument must not be null");
 50  
         }
 51  
 
 52  0
         return new ClientBehaviorContextImpl(context,component,eventName,sourceId, parameters);
 53  
     }
 54  
 
 55  
     public abstract UIComponent getComponent();
 56  
 
 57  
     public abstract String getEventName();
 58  
 
 59  
     public abstract FacesContext getFacesContext();
 60  
 
 61  
     public abstract Collection<Parameter> getParameters();
 62  
 
 63  
     public abstract String getSourceId();
 64  
 
 65  
     /**
 66  
      * @since 2.0
 67  
      */
 68  
     public static class Parameter
 69  
     {
 70  
         private String _name;
 71  
         private Object _value;
 72  
 
 73  
         public Parameter(String name, Object value)
 74  0
         {
 75  0
             if (name == null)
 76  
             {
 77  0
                 throw new NullPointerException("name");
 78  
             }
 79  
 
 80  0
             _name = name;
 81  0
             _value = value;
 82  0
         }
 83  
 
 84  
         public String getName()
 85  
         {
 86  0
             return _name;
 87  
         }
 88  
 
 89  
         public Object getValue()
 90  
         {
 91  0
             return _value;
 92  
         }
 93  
     }
 94  
     
 95  0
     private static final class ClientBehaviorContextImpl extends ClientBehaviorContext
 96  
     {
 97  
         private FacesContext _facesContext;
 98  
         private UIComponent _component;
 99  
         private String _eventName;
 100  
         private String _sourceId;
 101  
         private Collection<ClientBehaviorContext.Parameter> _parameters;
 102  
         
 103  
         public ClientBehaviorContextImpl(FacesContext context, UIComponent component, String eventName,
 104  
                 String sourceId, Collection<ClientBehaviorContext.Parameter> parameters)
 105  0
         {
 106  0
             _facesContext = context;
 107  0
             _component = component;
 108  0
             _eventName = eventName;
 109  0
             _sourceId = sourceId;
 110  0
             _parameters = parameters;            
 111  0
         }
 112  
 
 113  
         @Override
 114  
         public UIComponent getComponent()
 115  
         {
 116  0
             return _component;
 117  
         }
 118  
 
 119  
         @Override
 120  
         public String getEventName()
 121  
         {
 122  0
             return _eventName;
 123  
         }
 124  
 
 125  
         @Override
 126  
         public FacesContext getFacesContext()
 127  
         {
 128  0
             return _facesContext;
 129  
         }
 130  
 
 131  
         @Override
 132  
         public Collection<Parameter> getParameters()
 133  
         {
 134  0
             return _parameters;
 135  
         }
 136  
 
 137  
         @Override
 138  
         public String getSourceId()
 139  
         {
 140  0
             return _sourceId;
 141  
         }
 142  
     }
 143  
 }