| 1 | /* |
| 2 | * Copyright (c) 2005 The PseudoQ Project. |
| 3 | * |
| 4 | * This file is part of PseudoQ. |
| 5 | * |
| 6 | * PseudoQ is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Lesser General Public License as published by |
| 8 | * the Free Software Foundation; either version 2.1 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * PseudoQ is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public License |
| 17 | * along with PseudoQ; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | package net.sourceforge.pseudoq.gui; |
| 22 | |
| 23 | import java.awt.Component; |
| 24 | |
| 25 | import net.sourceforge.pseudoq.model.PuzzleTypeEnum; |
| 26 | |
| 27 | import org.pietschy.wizard.Wizard; |
| 28 | import org.pietschy.wizard.models.StaticModel; |
| 29 | |
| 30 | /** |
| 31 | * Options wizard for generating (or designing) a new puzzle. |
| 32 | * @author <a href="http://sourceforge.net/users/stevensa">Andrew Stevens</a> |
| 33 | */ |
| 34 | public class NewPuzzleWizard |
| 35 | { |
| 36 | Model model = null; |
| 37 | Wizard wizard = null; |
| 38 | |
| 39 | /** Creates a new instance of NewPuzzleWizard */ |
| 40 | public NewPuzzleWizard() { |
| 41 | model = new Model(); |
| 42 | model.add(new NewPuzzleWizardStep1()); |
| 43 | model.add(new NewPuzzleWizardStep2()); |
| 44 | wizard = new Wizard(model); |
| 45 | wizard.setDefaultExitMode(Wizard.EXIT_ON_FINISH); |
| 46 | } |
| 47 | |
| 48 | public boolean wasCanceled() { |
| 49 | return wizard.wasCanceled(); |
| 50 | } |
| 51 | |
| 52 | public PuzzleTypeEnum getPuzzleType() { |
| 53 | return model.getPuzzleType(); |
| 54 | } |
| 55 | |
| 56 | public boolean isGenerate() { |
| 57 | return model.isGenerate(); |
| 58 | } |
| 59 | |
| 60 | public void showInDialog(String title, Component parent, boolean modal) { |
| 61 | wizard.showInDialog(title, parent, modal); |
| 62 | } |
| 63 | |
| 64 | public static class Model extends StaticModel |
| 65 | { |
| 66 | /** |
| 67 | * Holds value of property puzzleType. |
| 68 | */ |
| 69 | private PuzzleTypeEnum puzzleType; |
| 70 | |
| 71 | /** |
| 72 | * Getter for property puzzleType. |
| 73 | * @return Value of property puzzleType. |
| 74 | */ |
| 75 | public PuzzleTypeEnum getPuzzleType() { |
| 76 | return this.puzzleType; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Setter for property puzzleType. |
| 81 | * @param puzzleType New value of property puzzleType. |
| 82 | */ |
| 83 | public void setPuzzleType(PuzzleTypeEnum puzzleType) { |
| 84 | this.puzzleType = puzzleType; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Holds value of property generate. |
| 89 | */ |
| 90 | private boolean generate; |
| 91 | |
| 92 | /** |
| 93 | * Getter for property generate. |
| 94 | * @return Value of property generate. |
| 95 | */ |
| 96 | public boolean isGenerate() { |
| 97 | return this.generate; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Setter for property generate. |
| 102 | * @param generate New value of property generate. |
| 103 | */ |
| 104 | public void setGenerate(boolean generate) { |
| 105 | this.generate = generate; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Holds value of property symmetrical. |
| 110 | */ |
| 111 | private boolean symmetrical; |
| 112 | |
| 113 | /** |
| 114 | * Getter for property symmetrical. |
| 115 | * @return Value of property symmetrical. |
| 116 | */ |
| 117 | public boolean isSymmetrical() { |
| 118 | return this.symmetrical; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Setter for property symmetrical. |
| 123 | * @param symmetrical New value of property symmetrical. |
| 124 | */ |
| 125 | public void setSymmetrical(boolean symmetrical) { |
| 126 | this.symmetrical = symmetrical; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Holds value of property difficulty. |
| 131 | */ |
| 132 | private int difficulty; |
| 133 | |
| 134 | /** |
| 135 | * Getter for property difficulty. |
| 136 | * @return Value of property difficulty. |
| 137 | */ |
| 138 | public int getDifficulty() { |
| 139 | return this.difficulty; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Setter for property difficulty. |
| 144 | * @param difficulty New value of property difficulty. |
| 145 | */ |
| 146 | public void setDifficulty(int difficulty) { |
| 147 | this.difficulty = difficulty; |
| 148 | } |
| 149 | |
| 150 | } |
| 151 | |
| 152 | } |