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