1 43 44 package org.jfree.xml.writer.coretypes; 45 46 import java.awt.Insets ; 47 import java.io.IOException ; 48 49 import org.jfree.xml.writer.AbstractXmlWriteHandler; 50 import org.jfree.xml.writer.AttributeList; 51 import org.jfree.xml.writer.XMLWriter; 52 import org.jfree.xml.writer.XMLWriterException; 53 import org.jfree.xml.writer.XMLWriterSupport; 54 55 58 public class InsetsWriteHandler extends AbstractXmlWriteHandler { 59 60 63 public InsetsWriteHandler() { 64 super(); 65 } 66 67 79 public void write(final String tagName, final Object object, final XMLWriter writer, 80 final String mPlexAttribute, final String mPlexValue) 81 throws IOException , XMLWriterException { 82 final AttributeList attribs = new AttributeList(); 83 if (mPlexAttribute != null) { 84 attribs.setAttribute(mPlexAttribute, mPlexValue); 85 } 86 final Insets i = (Insets ) object; 87 attribs.setAttribute("top", String.valueOf(i.top)); 88 attribs.setAttribute("left", String.valueOf(i.left)); 89 attribs.setAttribute("bottom", String.valueOf(i.bottom)); 90 attribs.setAttribute("right", String.valueOf(i.right)); 91 writer.writeTag(tagName, attribs, XMLWriterSupport.CLOSE); 92 } 93 } 94 | Popular Tags |