org.barracudamvc.core.comp.renderer.html
Class NamingHelper

java.lang.Object
  extended by org.barracudamvc.core.comp.renderer.html.NamingHelper

public class NamingHelper
extends Object

Simple helper class to assist with determining an elements name. Created csc_100201.2


Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
NamingHelper()
           
 
Method Summary
static String getName(Element el)
          Simple helper method to get a name for an element.
static boolean hasNameAttribute(Element el)
          Simple helper method to check if an element has the "name" attribute without having to manually perform a null check on the element.
static void setName(Element el, String value)
          Simple helper method to set the name attribute for an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

NamingHelper

public NamingHelper()
Method Detail

getName

public static String getName(Element el)
Simple helper method to get a name for an element. If the name is not set, a unique name will be generated, and the name attribute in the element will be set accordingly. Only works for HTML elements that actually support the name attribute (otherwise just returns "")

Parameters:
el - a target element
Returns:
the String value of the name of the passed in Element

setName

public static void setName(Element el,
                           String value)
Simple helper method to set the name attribute for an element. Only sets the attribute if both parameters are non-null and hasNameAttribute returns true.

Parameters:
el - a target element
value - the desired value of the name attribute

hasNameAttribute

public static boolean hasNameAttribute(Element el)
Simple helper method to check if an element has the "name" attribute without having to manually perform a null check on the element.

Parameters:
el - a target element
Returns:
true if el has a name attribute, false if not


Copyright © 2006 BarracudaMVC.org All Rights Reserved.