Coverage Report - org.apache.myfaces.shared.renderkit.html.CommonEventConstants
 
Classes in this File Line Coverage Branch Coverage Complexity
CommonEventConstants
0%
0/29
0%
0/4
4
 
 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.shared.renderkit.html;
 20  
 
 21  
 import java.util.HashMap;
 22  
 import java.util.Map;
 23  
 import javax.faces.component.UIComponent;
 24  
 
 25  0
 public class CommonEventConstants
 26  
 {
 27  
     public static final String COMMON_EVENTS_MARKED = "oam.COMMON_EVENTS_MARKED";
 28  
     
 29  
     public static final long ACTION_EVENT        = 0x1L;
 30  
     public static final long CLICK_EVENT         = 0x2L;
 31  
     public static final long DBLCLICK_EVENT      = 0x4L;
 32  
     public static final long MOUSEDOWN_EVENT     = 0x8L;
 33  
     public static final long MOUSEUP_EVENT       = 0x10L;
 34  
     public static final long MOUSEOVER_EVENT     = 0x20L;
 35  
     public static final long MOUSEMOVE_EVENT     = 0x40L;
 36  
     public static final long MOUSEOUT_EVENT      = 0x80L;
 37  
     public static final long KEYPRESS_EVENT      = 0x100L;
 38  
     public static final long KEYDOWN_EVENT       = 0x200L;
 39  
     public static final long KEYUP_EVENT         = 0x400L;
 40  
     public static final long FOCUS_EVENT         = 0x800L;
 41  
     public static final long BLUR_EVENT          = 0x1000L;
 42  
     public static final long SELECT_EVENT        = 0x2000L;
 43  
     public static final long CHANGE_EVENT        = 0x4000L;
 44  
     public static final long VALUECHANGE_EVENT   = 0x8000L;
 45  
     public static final long LOAD_EVENT          = 0x10000L;
 46  
     public static final long UNLOAD_EVENT        = 0x20000L;
 47  
     
 48  0
     public static final Map<String, Long> COMMON_EVENTS_KEY_BY_NAME = new HashMap<String, Long>(24,1);
 49  
     
 50  
     static
 51  
     {
 52  
         //EVENTS
 53  0
         COMMON_EVENTS_KEY_BY_NAME.put("change",   CHANGE_EVENT);
 54  0
         COMMON_EVENTS_KEY_BY_NAME.put("select",   SELECT_EVENT);
 55  0
         COMMON_EVENTS_KEY_BY_NAME.put("click",    CLICK_EVENT);
 56  0
         COMMON_EVENTS_KEY_BY_NAME.put("dblclick", DBLCLICK_EVENT);
 57  0
         COMMON_EVENTS_KEY_BY_NAME.put("mousedown",MOUSEDOWN_EVENT);
 58  0
         COMMON_EVENTS_KEY_BY_NAME.put("mouseup",  MOUSEUP_EVENT);
 59  0
         COMMON_EVENTS_KEY_BY_NAME.put("mouseover",MOUSEOVER_EVENT);
 60  0
         COMMON_EVENTS_KEY_BY_NAME.put("mousemove",MOUSEMOVE_EVENT);
 61  0
         COMMON_EVENTS_KEY_BY_NAME.put("mouseout", MOUSEOUT_EVENT);
 62  0
         COMMON_EVENTS_KEY_BY_NAME.put("keypress", KEYPRESS_EVENT);
 63  0
         COMMON_EVENTS_KEY_BY_NAME.put("keydown",  KEYDOWN_EVENT);
 64  0
         COMMON_EVENTS_KEY_BY_NAME.put("keyup",    KEYUP_EVENT);
 65  0
         COMMON_EVENTS_KEY_BY_NAME.put("focus",    FOCUS_EVENT);
 66  0
         COMMON_EVENTS_KEY_BY_NAME.put("blur",     BLUR_EVENT);
 67  0
         COMMON_EVENTS_KEY_BY_NAME.put("load",     LOAD_EVENT);
 68  0
         COMMON_EVENTS_KEY_BY_NAME.put("unload",   UNLOAD_EVENT);
 69  
         //virtual
 70  0
         COMMON_EVENTS_KEY_BY_NAME.put("valueChange", VALUECHANGE_EVENT);
 71  0
         COMMON_EVENTS_KEY_BY_NAME.put("action", ACTION_EVENT);
 72  0
     }
 73  
     
 74  
     public static void markEvent(UIComponent component, String name)
 75  
     {
 76  0
         Long propertyConstant = COMMON_EVENTS_KEY_BY_NAME.get(name);
 77  0
         if (propertyConstant == null)
 78  
         {
 79  0
             return;
 80  
         }
 81  0
         Long commonPropertiesSet = (Long) component.getAttributes().get(COMMON_EVENTS_MARKED);
 82  0
         if (commonPropertiesSet == null)
 83  
         {
 84  0
             commonPropertiesSet = 0L;
 85  
         }
 86  0
         component.getAttributes().put(COMMON_EVENTS_MARKED, commonPropertiesSet | propertyConstant);
 87  0
     }
 88  
 }