001package com.hfg.html; 002 003 004import com.hfg.xml.XMLNode; 005 006//------------------------------------------------------------------------------ 007/** 008 * Represents an image map (<map>) tag. Named ImageMap to avoid colliding with 009 * java.util.Map. 010 * <p> 011 * Note: HTML references imagemaps by the 'name' attribute while XHTML uses the 'id' 012 * attribute. 013 * </p> 014 * @author J. Alex Taylor, hairyfatguy.com 015 */ 016//------------------------------------------------------------------------------ 017// com.hfg XML/HTML Coding Library 018// 019// This library is free software; you can redistribute it and/or 020// modify it under the terms of the GNU Lesser General Public 021// License as published by the Free Software Foundation; either 022// version 2.1 of the License, or (at your option) any later version. 023// 024// This library is distributed in the hope that it will be useful, 025// but WITHOUT ANY WARRANTY; without even the implied warranty of 026// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 027// Lesser General Public License for more details. 028// 029// You should have received a copy of the GNU Lesser General Public 030// License along with this library; if not, write to the Free Software 031// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 032// 033// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 034// jataylor@hairyfatguy.com 035//------------------------------------------------------------------------------ 036 037public class ImageMap extends HTMLTagWithCoreEvents 038{ 039 //########################################################################## 040 // CONSTRUCTORS 041 //########################################################################## 042 043 //-------------------------------------------------------------------------- 044 public ImageMap() 045 { 046 super(HTML.MAP); 047 } 048 049 //-------------------------------------------------------------------------- 050 public ImageMap(String inName) 051 { 052 this(); 053 setName(inName); 054 } 055 056 //-------------------------------------------------------------------------- 057 public ImageMap(XMLNode inXMLNode) 058 { 059 this(); 060 initFromXMLNode(inXMLNode); 061 } 062 063 //########################################################################## 064 // PUBLIC METHODS 065 //########################################################################## 066 067 //-------------------------------------------------------------------------- 068 public Area addArea() 069 { 070 Area area = new Area(); 071 // Using addSubtag() instead of addSubtag() because content (text) 072 // may flow around embedded subtags. 073 addSubtag(area); 074 075 return area; 076 } 077 078 //-------------------------------------------------------------------------- 079 public ImageMap setName(String inValue) 080 { 081 setAttribute(HTML.NAME, inValue); 082 return this; 083 } 084 085 // Overrides for HTMLTag setters to allow method chaining. 086 087 //-------------------------------------------------------------------------- 088 @Override 089 public ImageMap setId(String inValue) 090 { 091 return (ImageMap) super.setId(inValue); 092 } 093 094 // Overrides for HTMLTagWithCoreEvents setters to allow method chaining. 095 096 //-------------------------------------------------------------------------- 097 @Override 098 public ImageMap setOnClick(String inValue) 099 { 100 return (ImageMap) super.setOnClick(inValue); 101 } 102 103 //-------------------------------------------------------------------------- 104 @Override 105 public ImageMap setOnDblClick(String inValue) 106 { 107 return (ImageMap) super.setOnDblClick(inValue); 108 } 109 110 //-------------------------------------------------------------------------- 111 @Override 112 public ImageMap setOnMouseDown(String inValue) 113 { 114 return (ImageMap) super.setOnMouseDown(inValue); 115 } 116 117 //-------------------------------------------------------------------------- 118 @Override 119 public ImageMap setOnMouseMove(String inValue) 120 { 121 return (ImageMap) super.setOnMouseMove(inValue); 122 } 123 124 //-------------------------------------------------------------------------- 125 @Override 126 public ImageMap setOnMouseOut(String inValue) 127 { 128 return (ImageMap) super.setOnMouseOut(inValue); 129 } 130 131 //-------------------------------------------------------------------------- 132 @Override 133 public ImageMap setOnMouseOver(String inValue) 134 { 135 return (ImageMap) super.setOnMouseOver(inValue); 136 } 137 138 //-------------------------------------------------------------------------- 139 @Override 140 public ImageMap setOnMouseUp(String inValue) 141 { 142 return (ImageMap) super.setOnMouseUp(inValue); 143 } 144 145 //-------------------------------------------------------------------------- 146 @Override 147 public ImageMap setOnKeyDown(String inValue) 148 { 149 return (ImageMap) super.setOnKeyDown(inValue); 150 } 151 152 //-------------------------------------------------------------------------- 153 @Override 154 public ImageMap setOnKeyPress(String inValue) 155 { 156 return (ImageMap) super.setOnKeyPress(inValue); 157 } 158 159 //-------------------------------------------------------------------------- 160 @Override 161 public ImageMap setOnKeyUp(String inValue) 162 { 163 return (ImageMap) super.setOnKeyUp(inValue); 164 } 165 166}