/** * writes all the localized map element usign the tagname with * the lang attribute to a DOM node */ public void writeLocalizedMap(Node parentNode, String tagName, Map localizedMap) { 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); } } } }
/** * @return the descriptor for this node */ public Object getDescriptor() { return getParentNode().getDescriptor(); }
/** * write the localized descriptions, display-names and icons info * * @param the node to write the info to * @param the descriptor containing the displayable information */ public void writeDisplayableComponentInfo(Node node, T descriptor) { LocalizedNode localizedNode = new LocalizedNode(); localizedNode.writeLocalizedMap(node, TagNames.DESCRIPTION, descriptor.getLocalizedDescriptions()); localizedNode.writeLocalizedMap(node, TagNames.NAME, descriptor.getLocalizedDisplayNames()); IconNode iconNode = new IconNode(); iconNode.writeLocalizedInfo(node, descriptor); } }
/** * receives notification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { if (element.equals(getXMLRootTag())) { localizedValue=value; } else super.setElementValue(element, value); }
/** * write the localized descriptions, display-names and icons info * * @param the node to write the info to * @param the descriptor containing the displayable information */ protected void writeDisplayableComponentInfo(Node node, T descriptor) { LocalizedNode localizedNode = new LocalizedNode(); localizedNode.writeLocalizedMap(node, TagNames.DESCRIPTION, descriptor.getLocalizedDescriptions()); localizedNode.writeLocalizedMap(node, TagNames.NAME, descriptor.getLocalizedDisplayNames()); IconNode iconNode = new IconNode(); iconNode.writeLocalizedInfo(node, descriptor); } }
/** * receives notification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { if (element.equals(getXMLRootTag())) { localizedValue=value; } else super.setElementValue(element, value); }
/** * @return the descriptor for this node */ public Object getDescriptor() { return getParentNode().getDescriptor(); }
/** * writes all the localized map element usign the tagname with * the lang attribute to a DOM node */ public void writeLocalizedMap(Node parentNode, String tagName, Map localizedMap) { if (localizedMap!=null) { Set<Map.Entry> entrySet = localizedMap.entrySet(); Iterator<Map.Entry> entryIt = entrySet.iterator(); while (entryIt.hasNext()) { Map.Entry entry = entryIt.next(); String lang = (String)entry.getKey(); Element aLocalizedNode = (Element) appendTextChild(parentNode, tagName, (String) entry.getValue()); if ((aLocalizedNode!=null) && (Locale.getDefault().getLanguage().equals(lang))) { aLocalizedNode.setAttributeNS(TagNames.XML_NAMESPACE, TagNames.XML_NAMESPACE_PREFIX + TagNames.LANG, lang); } } } }