FileDocCategorySizeDatePackage
LocalizedNode.javaAPI DocGlassfish v2 API4279Fri May 04 22:31:38 BST 2007com.sun.enterprise.deployment.node

LocalizedNode

public class LocalizedNode extends DeploymentDescriptorNode
This class is responsible for handling the xml lang attribute of an xml element
author
Jerome Dochez

Fields Summary
protected String
lang
protected String
localizedValue
Constructors Summary
Methods Summary
public java.lang.ObjectgetDescriptor()

return
the descriptor for this node

    
               
       
        return getParentNode().getDescriptor();
    
public voidsetElementValue(XMLElement element, java.lang.String value)
receives notification of the value for a particular tag

param
element the xml element
param
value it's associated value

        if (element.equals(getXMLRootTag())) {
            localizedValue=value;
        } else 
            super.setElementValue(element, value);        
    
public voidstartElement(XMLElement element, org.xml.sax.Attributes attributes)
notification of element start with attributes.

        if (attributes.getLength()>0) {
            for (int i=0;i<attributes.getLength();i++) {
                if (attributes.getLocalName(i).equals(TagNames.LANG)) {
                    lang = attributes.getValue(i);
                }
            } 
        }
    
public voidwriteLocalizedMap(org.w3c.dom.Node parentNode, java.lang.String tagName, java.util.Map localizedMap)
writes all the localized map element usign the tagname with the lang attribute to a DOM node

        if (localizedMap!=null) {
            for (Iterator itr = localizedMap.keySet().iterator();itr.hasNext();) {
                String lang = (String) itr.next();
                Element aLocalizedNode = (Element) appendTextChild(parentNode, tagName, (String) localizedMap.get(lang));
                if (aLocalizedNode!=null && lang!=Locale.getDefault().getLanguage()) { 
		    aLocalizedNode.setAttributeNS(TagNames.XML_NAMESPACE, TagNames.XML_NAMESPACE_PREFIX + TagNames.LANG, lang);
 		 } 
            }
        }