1 20 package org.enhydra.barracuda.core.comp.renderer.html; 21 22 import java.util.*; 23 24 import org.apache.log4j.*; 25 import org.w3c.dom.*; 26 import org.w3c.dom.html.*; 27 28 29 33 public class NamingHelper { 34 35 protected static final Logger logger = Logger.getLogger(NamingHelper.class.getName()); 36 37 47 public static String getName(Element el) { 48 String name = ""; 49 if (el instanceof HTMLAnchorElement || 50 el instanceof HTMLAppletElement || 51 el instanceof HTMLButtonElement || 52 el instanceof HTMLFormElement || 53 el instanceof HTMLFrameElement || 54 el instanceof HTMLIFrameElement || 55 el instanceof HTMLInputElement || 56 el instanceof HTMLMapElement || 57 el instanceof HTMLMetaElement || 58 el instanceof HTMLObjectElement || 59 el instanceof HTMLParamElement || 60 el instanceof HTMLSelectElement || 61 el instanceof HTMLTextAreaElement) { 62 63 name = el.getAttribute("name"); 64 if (name==null || name.equals("")) { 65 name = "el_"+new Object ().hashCode(); 66 el.setAttribute("name", name); 67 } 68 } 69 return name; 70 } 71 72 } 73 | Popular Tags |