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

IconNode

public class IconNode extends LocalizedNode
author
dochez

Fields Summary
private String
smallIcon
private String
largeIcon
Constructors Summary
Methods Summary
private voidaddIconInfo(org.w3c.dom.Node node, java.lang.String lang, java.lang.String smallIconUri, java.lang.String largeIconUri)
writes xml tag and fragment for a particular icon information

        
        Element iconNode =appendChild(node, TagNames.ICON);
        if (lang!=Locale.ENGLISH.getLanguage()) {
	    iconNode.setAttributeNS(TagNames.XML_NAMESPACE, TagNames.XML_NAMESPACE_PREFIX + TagNames.LANG, lang);
	}
        appendTextChild(iconNode, TagNames.SMALL_ICON, smallIconUri);
        appendTextChild(iconNode, TagNames.LARGE_ICON, largeIconUri);
    
public java.lang.ObjectgetDescriptor()

return
the descriptor for this node

    
               
       
        return null;
    
public voidpostParsing()
notification of the end of XML parsing for this node

        Object o = getParentNode().getDescriptor();    
        if (o!=null && o instanceof Descriptor) {
            Descriptor descriptor = (Descriptor) o;
            if (largeIcon!=null) {
                descriptor.setLocalizedLargeIconUri(lang, largeIcon);
            }
            if (smallIcon!=null) {
                descriptor.setLocalizedSmallIconUri(lang, smallIcon);
            }            
        }
    
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.getQName().equals(TagNames.SMALL_ICON)) {
            smallIcon = value;
        } else 
        if (element.getQName().equals(TagNames.LARGE_ICON)) {
            largeIcon = value;
        }        
    
public voidwriteLocalizedInfo(org.w3c.dom.Node parentNode, com.sun.enterprise.deployment.Descriptor descriptor)
writes all localized icon information

param
parentNode for all icon xml fragments
param
descriptor containing the icon information

        Map largeIcons = descriptor.getLocalizedLargeIconUris();
        Map smallIcons = descriptor.getLocalizedSmallIconUris();
        if (largeIcons==null && smallIcons==null) {
            return;
        }
        if (smallIcons!=null) {
            for (Iterator smallItr = smallIcons.keySet().iterator();smallItr.hasNext();) {
                String lang = (String) smallItr.next();
                String smallIconUri = (String) smallIcons.get(lang);                
                String largeIconUri = null;
                if (largeIcons!=null) {
                    largeIconUri = (String) largeIcons.get(lang);
                }
                addIconInfo(parentNode, lang, smallIconUri, largeIconUri);
            }
        } 
        if (largeIcons!=null) {
            for (Iterator largeItr = largeIcons.keySet().iterator();largeItr.hasNext();) {
                String lang = (String) largeItr.next();
                String largeIconUri = (String) largeIcons.get(lang);
                if (smallIcons!=null && smallIcons.get(lang)!=null) {
                    // we already wrote this icon info in the previous loop
                    continue;
                }
                addIconInfo(parentNode, lang, null, largeIconUri);
            }
        }