-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gridRegion' into gridPK
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/edu/rpi/legup/puzzle/rippleeffect/RippleEffectExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} | ||
} |