001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.components; 016 017 /** 018 * Different types of JavaScript events that an {@link ILinkComponent} can provide handlers for. 019 * 020 * @author Howard Lewis Ship 021 * @since 0.2.9 022 */ 023 024 public class LinkEventType 025 { 026 /** 027 * Type for <code>onMouseOver</code>. This may also be called "focus". 028 */ 029 030 public static final LinkEventType MOUSE_OVER = new LinkEventType("MOUSE_OVER", "onMouseOver"); 031 032 /** 033 * Type for <code>onMouseOut</code>. This may also be called "blur". 034 */ 035 036 public static final LinkEventType MOUSE_OUT = new LinkEventType("MOUSE_OUT", "onMouseOut"); 037 038 /** 039 * Type for <code>onClick</code>. 040 * 041 * @since 1.0.1 042 */ 043 044 public static final LinkEventType CLICK = new LinkEventType("CLICK", "onClick"); 045 046 /** 047 * Type for <code>onDblClick</code>. 048 * 049 * @since 1.0.1 050 */ 051 052 public static final LinkEventType DOUBLE_CLICK = new LinkEventType("DOUBLE_CLICK", "onDblClick"); 053 054 /** 055 * Type for <code>onMouseDown</code>. 056 * 057 * @since 1.0.1. 058 */ 059 060 public static final LinkEventType MOUSE_DOWN = new LinkEventType("MOUSE_DOWN", "onMouseDown"); 061 062 /** 063 * Type for <code>onMouseUp</code>. 064 * 065 * @since 1.0.1 066 */ 067 068 public static final LinkEventType MOUSE_UP = new LinkEventType("MOUSE_UP", "onMouseUp"); 069 070 private final String _name; 071 072 private final String _attributeName; 073 074 /** 075 * Constructs a new type of event. The name should match the static final variable (i.e., 076 * MOUSE_OVER) and the attributeName is the name of the HTML attribute to be managed (i.e., 077 * "onMouseOver"). 078 * <p> 079 * This method is protected so that subclasses can be created to provide additional managed 080 * event types. 081 */ 082 083 protected LinkEventType(String name, String attributeName) 084 { 085 086 _name = name; 087 _attributeName = attributeName; 088 } 089 090 /** 091 * Returns the name of the HTML attribute corresponding to this type. 092 */ 093 094 public String getAttributeName() 095 { 096 return _attributeName; 097 } 098 099 public String toString() 100 { 101 return "LinkEventType[" + _name + "]"; 102 } 103 }