List of usage examples for org.dom4j Element addElement
Element addElement(String name);
Element
node with the given name to this branch and returns a reference to the new node. From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeStoreRegister(Element parentElement, StoreRegister storeRegister) { Element element = parentElement.addElement("storeregister"); element.addAttribute("number", Short.toString(storeRegister.getNumber())); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeTry(Element parentElement, Try tryAction) { Element element = parentElement.addElement("try"); if (tryAction.catchInRegister()) { element.addAttribute("catchregister", Short.toString(tryAction.getCatchRegister())); } else {//w w w . j a va2 s. co m element.addAttribute("catchvariable", tryAction.getCatchVariable()); } RecordXMLWriter.writeActionBlock(element.addElement("try"), tryAction.getTryBlock()); if (tryAction.hasCatchBlock()) { RecordXMLWriter.writeActionBlock(element.addElement("catch"), tryAction.getCatchBlock()); } if (tryAction.hasFinallyBlock()) { RecordXMLWriter.writeActionBlock(element.addElement("finally"), tryAction.getFinallyBlock()); } return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeUnknown(Element parentElement, UnknownAction action) { Element element = parentElement.addElement("unknownaction"); element.addAttribute("code", Integer.toString(action.getCode())); element.addText(Base64.encode(action.getData())); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeWaitForFrame(Element parentElement, WaitForFrame waitForFrame) { Element element = parentElement.addElement("waitforframe"); element.addAttribute("frame", Integer.toString(waitForFrame.getFrame())); element.addAttribute("skipcount", Short.toString(waitForFrame.getSkipCount())); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeWaitForFrame2(Element parentElement, WaitForFrame2 waitForFrame2) { Element element = parentElement.addElement("waitforframe2"); element.addAttribute("skipcount", Short.toString(waitForFrame2.getSkipCount())); return element; }
From source file:com.jswiff.xml.ActionXMLWriter.java
License:Open Source License
private static Element writeWith(Element parentElement, With with) { Element element = parentElement.addElement("with"); RecordXMLWriter.writeActionBlock(element, with.getWithBlock()); return element; }
From source file:com.jswiff.xml.RecordXMLWriter.java
License:Open Source License
static void writeActionBlock(Element parentElement, ActionBlock actionBlock) { List actions = actionBlock.getActions(); Element element = parentElement.addElement("actionblock"); for (Iterator it = actions.iterator(); it.hasNext();) { Action action = (Action) it.next(); ActionXMLWriter.writeAction(element, action); }/* ww w . j av a 2 s . c o m*/ }
From source file:com.jswiff.xml.RecordXMLWriter.java
License:Open Source License
static void writeAlignmentZones(Element parentElement, AlignmentZone[] alignmentZones) { Element element = parentElement.addElement("zones"); for (int i = 0; i < alignmentZones.length; i++) { AlignmentZone zone = alignmentZones[i]; Element zoneElement = element.addElement("zone"); if (zone.hasX()) { zoneElement.addAttribute("left", StringUtilities.doubleToString(zone.getLeft())); zoneElement.addAttribute("width", StringUtilities.doubleToString(zone.getWidth())); }//from w ww.ja va2 s .c o m if (zone.hasY()) { zoneElement.addAttribute("baseline", StringUtilities.doubleToString(zone.getBaseline())); zoneElement.addAttribute("height", StringUtilities.doubleToString(zone.getHeight())); } } }
From source file:com.jswiff.xml.RecordXMLWriter.java
License:Open Source License
static void writeButtonCondAction(Element parentElement, ButtonCondAction buttonCondAction) { Element element = parentElement.addElement("buttoncondaction"); if (buttonCondAction.isOutDownToIdle()) { element.addAttribute("outdowntoidle", "true"); }/*from w w w. j a v a 2 s .c o m*/ if (buttonCondAction.isOutDownToOverDown()) { element.addAttribute("outdowntooverdown", "true"); } if (buttonCondAction.isIdleToOverDown()) { element.addAttribute("idletooverdown", "true"); } if (buttonCondAction.isIdleToOverUp()) { element.addAttribute("idletooverup", "true"); } if (buttonCondAction.isOverDownToIdle()) { element.addAttribute("overdowntoidle", "true"); } if (buttonCondAction.isOverDownToOutDown()) { element.addAttribute("overdowntooutdown", "true"); } if (buttonCondAction.isOverDownToOverUp()) { element.addAttribute("overdowntooverup", "true"); } if (buttonCondAction.isOverUpToIdle()) { element.addAttribute("overuptoidle", "true"); } if (buttonCondAction.isOverUpToOverDown()) { element.addAttribute("overuptooverdown", "true"); } byte keyPress = buttonCondAction.getKeyPress(); if (keyPress != 0) { element.addAttribute("keypress", Byte.toString(keyPress)); } RecordXMLWriter.writeActionBlock(element, buttonCondAction.getActions()); }
From source file:com.jswiff.xml.RecordXMLWriter.java
License:Open Source License
static void writeButtonRecord(Element parentElement, ButtonRecord buttonRecord) { Element element = parentElement.addElement("buttonrecord"); element.addAttribute("charid", Integer.toString(buttonRecord.getCharacterId())); element.addAttribute("depth", Integer.toString(buttonRecord.getPlaceDepth())); if (buttonRecord.hasBlendMode()) { element.addAttribute("blendmode", BlendMode.getDescription(buttonRecord.getBlendMode())); }//from w ww . j av a2 s . c om Element state = element.addElement("state"); if (buttonRecord.isUpState()) { state.addAttribute("up", "true"); } if (buttonRecord.isDownState()) { state.addAttribute("down", "true"); } if (buttonRecord.isOverState()) { state.addAttribute("over", "true"); } if (buttonRecord.isHitState()) { state.addAttribute("hit", "true"); } writeMatrix(element, buttonRecord.getPlaceMatrix()); CXformWithAlpha colorTransform = buttonRecord.getColorTransform(); if (colorTransform != null) { writeCXFormWithAlpha(element, colorTransform); } if (buttonRecord.hasFilters()) { RecordXMLWriter.writeFilters(element, buttonRecord.getFilters()); } }