Example usage for org.dom4j Element addElement

List of usage examples for org.dom4j Element addElement

Introduction

In this page you can find the example usage for org.dom4j Element addElement.

Prototype

Element addElement(String name);

Source Link

Document

Adds a new Element node with the given name to this branch and returns a reference to the new node.

Usage

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;//from   w w  w. j av a2  s.  c om
    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 writeDoAction(Element parentElement, DoAction tag) {
    Element element = parentElement.addElement("doaction");
    RecordXMLWriter.writeActionBlock(element, tag.getActions());
}

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);
    }/*w  w w .ja  v  a  2 s  .  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);
    }//from www  .ja va 2  s.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());
    }/* w w w.  j  av a2 s.  c o 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;/*from w  w  w.ja  v  a2s .com*/
    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   ww  w.j  a v  a2 s .c om
}

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()));
    }/*from   w  w  w.ja va 2 s.co  m*/
}