-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathRippleEffectExporter.java
More file actions
39 lines (32 loc) · 1.47 KB
/
RippleEffectExporter.java
File metadata and controls
39 lines (32 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package edu.rpi.legup.puzzle.rippleeffect;
import edu.rpi.legup.model.PuzzleExporter;
import edu.rpi.legup.model.gameboard.PuzzleElement;
import org.w3c.dom.Document;
public class RippleEffectExporter extends PuzzleExporter {
public RippleEffectExporter(RippleEffect rippleEffect) {
super(rippleEffect);
}
@Override
protected org.w3c.dom.Element createBoardElement(Document newDocument) {
RippleEffectBoard board;
if (puzzle.getTree() != null) {
board = (RippleEffectBoard) puzzle.getTree().getRootNode().getBoard();
}
else {
board = (RippleEffectBoard) puzzle.getBoardView().getBoard();
}
org.w3c.dom.Element boardElement = newDocument.createElement("board");
boardElement.setAttribute("width", String.valueOf(board.getWidth()));
boardElement.setAttribute("height", String.valueOf(board.getHeight()));
org.w3c.dom.Element cellsElement = newDocument.createElement("cells");
for (PuzzleElement puzzleElement : board.getPuzzleElements()) {
RippleEffectCell cell = (RippleEffectCell) puzzleElement;
// if (cell.getData() != -2) {
// org.w3c.dom.Element cellElement = puzzle.getFactory().exportCell(newDocument, puzzleElement);
// cellsElement.appendChild(cellElement);
// }
}
boardElement.appendChild(cellsElement);
return boardElement;
}
}