List of usage examples for org.dom4j Element addAttribute
Element addAttribute(QName qName, String value);
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineText2(Element parentElement, DefineText2 tag) { Element element = parentElement.addElement("definetext2"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); RecordXMLWriter.writeRect(element, "bounds", tag.getTextBounds()); RecordXMLWriter.writeMatrix(element, "matrix", tag.getTextMatrix()); Element textRecordsElement = element.addElement("textrecords"); TextRecord[] textRecords = tag.getTextRecords(); for (int i = 0; i < textRecords.length; i++) { RecordXMLWriter.writeTextRecord(textRecordsElement, textRecords[i]); }/*from ww w.j a va 2 s .c om*/ }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDefineVideoStream(Element parentElement, DefineVideoStream tag) { Element element = parentElement.addElement("definevideostream"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); element.addAttribute("numframes", Integer.toString(tag.getNumFrames())); element.addAttribute("width", Integer.toString(tag.getWidth())); element.addAttribute("height", Integer.toString(tag.getHeight())); switch (tag.getDeblocking()) { case DefineVideoStream.DEBLOCKING_OFF: element.addAttribute("deblocking", "off"); break;/* w ww .j a v a 2 s . c o m*/ case DefineVideoStream.DEBLOCKING_ON: element.addAttribute("deblocking", "on"); break; case DefineVideoStream.DEBLOCKING_PACKET: element.addAttribute("deblocking", "packet"); break; default: throw new IllegalArgumentException("Illegal video deblocking setting: " + tag.getDeblocking()); } if (tag.isSmoothing()) { element.addAttribute("smoothing", "true"); } switch (tag.getCodecId()) { case DefineVideoStream.CODEC_SCREEN_VIDEO: element.addAttribute("codec", "screenvideo"); break; case DefineVideoStream.CODEC_SORENSON_H263: element.addAttribute("codec", "h263"); break; case DefineVideoStream.CODEC_VP6: element.addAttribute("codec", "vp6"); break; case DefineVideoStream.CODEC_VP6_ALPHA: element.addAttribute("codec", "vp6alpha"); break; case DefineVideoStream.CODEC_SCREEN_VIDEO_V2: element.addAttribute("codec", "screenvideov2"); break; case DefineVideoStream.CODEC_UNDEFINED: element.addAttribute("codec", "undefined"); break; default: throw new IllegalArgumentException("Illegal video codec ID: " + tag.getCodecId()); } }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeDoInitAction(Element parentElement, DoInitAction tag) { Element element = parentElement.addElement("doinitaction"); element.addAttribute("spriteid", Integer.toString(tag.getSpriteId())); RecordXMLWriter.writeActionBlock(element, tag.getInitActions()); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeEnableDebugger(Element parentElement, EnableDebugger tag) { Element element = parentElement.addElement("enabledebugger"); String password = tag.getPassword(); if (password != null) { element.addAttribute("password", password); }//from w w w.j a v a 2s .c o m }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeEnableDebugger2(Element parentElement, EnableDebugger2 tag) { Element element = parentElement.addElement("enabledebugger2"); String password = tag.getPassword(); if (password != null) { element.addAttribute("password", password); }//w w w . j a va 2s.c om }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeExportAssets(Element parentElement, ExportAssets tag) { Element element = parentElement.addElement("exportassets"); ExportAssets.ExportMapping[] mappings = tag.getExportMappings(); for (int i = 0; i < mappings.length; i++) { ExportAssets.ExportMapping mapping = mappings[i]; Element mappingElement = element.addElement("exportmapping"); mappingElement.addAttribute("charid", Integer.toString(mapping.getCharacterId())); mappingElement.addAttribute("name", mapping.getName()); }//from w w w . j a va2 s. co m }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeFlashTypeSettings(Element parentElement, FlashTypeSettings tag) { Element element = parentElement.addElement("flashtypesettings"); element.addAttribute("textid", Integer.toString(tag.getTextId())); element.addAttribute("flashtype", Boolean.toString(tag.isFlashType())); switch (tag.getGridFit()) { case FlashTypeSettings.GRID_FIT_NONE: element.addAttribute("gridfit", "none"); break;//www .j a v a2s. c o m case FlashTypeSettings.GRID_FIT_PIXEL: element.addAttribute("gridfit", "pixel"); break; case FlashTypeSettings.GRID_FIT_SUBPIXEL: element.addAttribute("gridfit", "subpixel"); break; } element.addAttribute("thickness", StringUtilities.doubleToString(tag.getThickness())); element.addAttribute("sharpness", StringUtilities.doubleToString(tag.getSharpness())); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeFrameLabel(Element parentElement, FrameLabel tag) { Element element = parentElement.addElement("framelabel"); element.addAttribute("name", tag.getName()); if (tag.isNamedAnchor()) { element.addAttribute("namedanchor", "true"); }/*from w ww. ja v a 2 s . c o m*/ }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeFreeCharacter(Element parentElement, FreeCharacter tag) { Element element = parentElement.addElement("freecharacter"); element.addAttribute("charid", Integer.toString(tag.getCharacterId())); }
From source file:com.jswiff.xml.TagXMLWriter.java
License:Open Source License
private static void writeImportAssets(Element parentElement, ImportAssets tag) { Element element = parentElement.addElement("importassets"); element.addAttribute("url", tag.getUrl()); ImportAssets.ImportMapping[] mappings = tag.getImportMappings(); for (int i = 0; i < mappings.length; i++) { ImportAssets.ImportMapping mapping = mappings[i]; Element mappingElement = element.addElement("importmapping"); mappingElement.addAttribute("name", mapping.getName()); mappingElement.addAttribute("charid", Integer.toString(mapping.getCharacterId())); }//w w w.ja v a 2 s .c om }