Coverage Report - org.seasar.teeda.core.mock.MockUIComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
MockUIComponent
59%
39/66
50%
1/2
1.023
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.teeda.core.mock;
 17  
 
 18  
 import java.io.IOException;
 19  
 import java.util.ArrayList;
 20  
 import java.util.HashMap;
 21  
 import java.util.Iterator;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 import javax.faces.component.UIComponent;
 26  
 import javax.faces.context.FacesContext;
 27  
 import javax.faces.el.ValueBinding;
 28  
 import javax.faces.event.AbortProcessingException;
 29  
 import javax.faces.event.FacesEvent;
 30  
 import javax.faces.event.FacesListener;
 31  
 import javax.faces.internal.ComponentFacetAndChildrenIterator;
 32  
 import javax.faces.render.Renderer;
 33  
 
 34  1022
 public class MockUIComponent extends UIComponent {
 35  
 
 36  
     public static final String COMPONENT_FAMILY = "javax.faces.mock";
 37  
 
 38  
     public static final String COMPONENT_TYPE = "javax.faces.mock";
 39  
 
 40  1022
     private UIComponent parent_ = null;
 41  
 
 42  
     private FacesEvent event_;
 43  
 
 44  
     private String id_;
 45  
 
 46  1022
     private String clientId_ = null;
 47  
 
 48  1022
     private Map facets_ = new HashMap();
 49  
 
 50  1022
     private String family_ = COMPONENT_FAMILY;
 51  
 
 52  1022
     private String type_ = COMPONENT_TYPE;
 53  
 
 54  1022
     private boolean rendered_ = true;
 55  
 
 56  1022
     private FacesContext context_ = null;
 57  
 
 58  1022
     private Map valueBindingMap_ = new HashMap();
 59  
 
 60  1022
     private List children_ = new ArrayList();
 61  
 
 62  1022
     private Map attributesMap_ = new HashMap();
 63  
 
 64  
     public Map getAttributes() {
 65  48
         return attributesMap_;
 66  
     }
 67  
 
 68  
     public ValueBinding getValueBinding(String name) {
 69  5
         return (ValueBinding) valueBindingMap_.get(name);
 70  
     }
 71  
 
 72  
     public void setValueBinding(String s, ValueBinding valueBinding) {
 73  5
         valueBindingMap_.put(s, valueBinding);
 74  5
     }
 75  
 
 76  
     public String getClientId(FacesContext context) {
 77  9
         return clientId_;
 78  
     }
 79  
 
 80  
     public void setClientId(String clientId) {
 81  9
         clientId_ = clientId;
 82  9
     }
 83  
 
 84  
     public String getFamily() {
 85  4
         return family_;
 86  
     }
 87  
 
 88  
     public void setFamily(String family) {
 89  6
         family_ = family;
 90  6
     }
 91  
 
 92  
     public String getId() {
 93  292
         return id_;
 94  
     }
 95  
 
 96  
     public void setId(String id) {
 97  365
         id_ = id;
 98  365
     }
 99  
 
 100  
     public UIComponent getParent() {
 101  127
         return parent_;
 102  
     }
 103  
 
 104  
     public void setParent(UIComponent parent) {
 105  764
         parent_ = parent;
 106  764
     }
 107  
 
 108  
     public boolean isRendered() {
 109  30
         return rendered_;
 110  
     }
 111  
 
 112  
     public void setRendered(boolean flag) {
 113  0
         rendered_ = flag;
 114  0
     }
 115  
 
 116  
     public String getRendererType() {
 117  0
         return type_;
 118  
     }
 119  
 
 120  
     public void setRendererType(String type) {
 121  0
         type_ = type;
 122  0
     }
 123  
 
 124  
     public boolean getRendersChildren() {
 125  0
         return false;
 126  
     }
 127  
 
 128  
     public List getChildren() {
 129  30
         return children_;
 130  
     }
 131  
 
 132  
     public int getChildCount() {
 133  10
         return getChildren().size();
 134  
     }
 135  
 
 136  
     public UIComponent findComponent(String expr) {
 137  0
         return null;
 138  
     }
 139  
 
 140  
     public Map getFacets() {
 141  10
         return facets_;
 142  
     }
 143  
 
 144  
     public UIComponent getFacet(String s) {
 145  0
         return (UIComponent) facets_.get(s);
 146  
     }
 147  
 
 148  
     public Iterator getFacetsAndChildren() {
 149  216
         return new ComponentFacetAndChildrenIterator(facets_, children_);
 150  
     }
 151  
 
 152  
     public void broadcast(FacesEvent event) throws AbortProcessingException {
 153  0
     }
 154  
 
 155  
     public void decode(FacesContext context) {
 156  0
     }
 157  
 
 158  
     public void encodeBegin(FacesContext context) throws IOException {
 159  0
     }
 160  
 
 161  
     public void encodeChildren(FacesContext context) throws IOException {
 162  0
     }
 163  
 
 164  
     public void encodeEnd(FacesContext context) throws IOException {
 165  0
     }
 166  
 
 167  
     protected void addFacesListener(FacesListener listener) {
 168  0
     }
 169  
 
 170  
     protected FacesListener[] getFacesListeners(Class clazz) {
 171  0
         return null;
 172  
     }
 173  
 
 174  
     protected void removeFacesListener(FacesListener listener) {
 175  0
     }
 176  
 
 177  
     public void queueEvent(FacesEvent event) {
 178  43
         event_ = event;
 179  43
     }
 180  
 
 181  
     public void processRestoreState(FacesContext context, Object state) {
 182  0
     }
 183  
 
 184  
     public void processDecodes(FacesContext context) {
 185  0
     }
 186  
 
 187  
     public void processValidators(FacesContext context) {
 188  0
     }
 189  
 
 190  
     public void processUpdates(FacesContext context) {
 191  0
     }
 192  
 
 193  
     public Object processSaveState(FacesContext context) {
 194  0
         return null;
 195  
     }
 196  
 
 197  
     protected FacesContext getFacesContext() {
 198  2
         if (context_ == null) {
 199  2
             context_ = FacesContext.getCurrentInstance();
 200  
         }
 201  2
         return context_;
 202  
     }
 203  
 
 204  
     protected Renderer getRenderer(FacesContext context) {
 205  0
         return null;
 206  
     }
 207  
 
 208  
     public boolean isTransient() {
 209  4
         return false;
 210  
     }
 211  
 
 212  
     public void setTransient(boolean transientValue) {
 213  0
     }
 214  
 
 215  
     public Object saveState(FacesContext context) {
 216  0
         return null;
 217  
     }
 218  
 
 219  
     public void restoreState(FacesContext context, Object state) {
 220  0
     }
 221  
 
 222  
     public FacesEvent getQueueEvent() {
 223  83
         return event_;
 224  
     }
 225  
 
 226  
     public void setFacesContext(FacesContext context) {
 227  0
         context_ = context;
 228  0
     }
 229  
 
 230  
 }