| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
package com.buckosoft.PicMan.dom; |
| 9 | |
|
| 10 | |
import java.util.Iterator; |
| 11 | |
import java.util.List; |
| 12 | |
|
| 13 | |
import org.dom4j.Document; |
| 14 | |
import org.dom4j.DocumentHelper; |
| 15 | |
import org.dom4j.Element; |
| 16 | |
|
| 17 | |
import com.buckosoft.PicMan.business.PicManFacade; |
| 18 | |
import com.buckosoft.PicMan.domain.MosaicTile; |
| 19 | |
|
| 20 | 0 | public class MosaicTilesDom { |
| 21 | |
static public Document createDocument(PicManFacade pmf, int mid) { |
| 22 | 0 | Document document = DocumentHelper.createDocument(); |
| 23 | 0 | Element root = document.addElement("MosaicTiles"); |
| 24 | 0 | List<MosaicTile> list = pmf.getDB().getMosaicTiles(mid); |
| 25 | 0 | Iterator<MosaicTile> iter = list.iterator(); |
| 26 | 0 | while (iter.hasNext()) { |
| 27 | 0 | MosaicTile mt = iter.next(); |
| 28 | 0 | Element ele = DocumentHelper.createElement("MosaicTiles"); |
| 29 | 0 | ele.addElement("x").addText(((Integer)mt.getX()).toString()); |
| 30 | 0 | ele.addElement("y").addText(((Integer)mt.getY()).toString()); |
| 31 | 0 | ele.addElement("w").addText(((Integer)mt.getWidth()).toString()); |
| 32 | 0 | ele.addElement("h").addText(((Integer)mt.getHeight()).toString()); |
| 33 | 0 | ele.addElement("pid").addText(((Integer)mt.getPid()).toString()); |
| 34 | 0 | root.add(ele); |
| 35 | 0 | } |
| 36 | 0 | return document; |
| 37 | |
} |
| 38 | |
} |