Package org.openquark.util.attributes

Examples of org.openquark.util.attributes.AttributeSet


     * @see org.openquark.util.xml.XMLElementSerializer#loadFromElement(org.openquark.util.xml.XMLSerializationManager, org.w3c.dom.Element)
     */
    public Object loadFromElement(XMLSerializationManager manager, Element element) {
        List<Attribute> attributes = new ArrayList<Attribute>();
        manager.loadFromChildElements(element, attributes);
        return new AttributeSet(attributes);
    }
View Full Code Here


   
    /**
     * @see org.openquark.util.xml.XMLElementSerializer#storeToElement(org.openquark.util.xml.XMLSerializationManager, org.w3c.dom.Element, java.lang.Object)
     */
    public void storeToElement(XMLSerializationManager manager, Element element, Object value) {
        AttributeSet attributes = (AttributeSet) value;
        Document doc = element.getOwnerDocument();
        Element attrElement = doc.createElement(ROOT_TAG);
        element.appendChild(attrElement);
        manager.storeToElement(attrElement, attributes.getAllAttributes());
    }
View Full Code Here

       
        /**
         * @see org.openquark.util.xml.XMLElementSerializer#loadFromElement(org.openquark.util.xml.XMLSerializationManager, org.w3c.dom.Element)
         */
        public Object loadFromElement(XMLSerializationManager manager, Element element) {
            AttributeSet attributes = createNewAttributeSet();
            List<Element> children = XMLPersistenceHelper.getChildElements(element);
            for (Element childElem : children) {
                Object data = manager.loadFromElement(childElem);
                if (data instanceof Attribute) {
                    attributes.setAttribute((Attribute) data);
                }
            }
            return attributes;
        }
View Full Code Here

                element = attributeSetElement;
            }
           
            // Sort the attributes alphabetically so that they will be saved in a consistent
            // order each time
            AttributeSet attributes = (AttributeSet)value;
            List<Attribute> sortedAttrs = attributes.getAttributesAsList();
            Collections.sort(sortedAttrs, Attribute.getNameComparator());
            for (Attribute attribute : sortedAttrs) {
                manager.storeToElement(element, attribute);
            }
        }
View Full Code Here

         * <p>
         * Subclasses can override this method.
         * @return AttributeSet
         */
        protected AttributeSet createNewAttributeSet() {
            return new AttributeSet();
        }
View Full Code Here

TOP

Related Classes of org.openquark.util.attributes.AttributeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.