| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EditorDesktop |
|
| 1.0;1 |
| 1 | /* $Id: EditorDesktop.java 15 2008-12-08 19:13:26Z mihlon $ */ | |
| 2 | ||
| 3 | ////////////////////////////////////////////////////////////////////////////// | |
| 4 | // // | |
| 5 | // This program is free software: you can redistribute it and/or modify // | |
| 6 | // it under the terms of the GNU General Public License as published by // | |
| 7 | // the Free Software Foundation, either version 3 of the License, or // | |
| 8 | // at your option any later version. // | |
| 9 | // // | |
| 10 | // This program is distributed in the hope that it will be useful, // | |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // | |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // | |
| 13 | // GNU General Public License for more details. // | |
| 14 | // // | |
| 15 | // You should have received a copy of the GNU General Public License // | |
| 16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. // | |
| 17 | // // | |
| 18 | ////////////////////////////////////////////////////////////////////////////// | |
| 19 | ||
| 20 | package cs.pancava.caltha.desktop; | |
| 21 | ||
| 22 | import cs.pancava.caltha.worlds.World; | |
| 23 | import javax.swing.JPanel; | |
| 24 | ||
| 25 | /** | |
| 26 | * <p><b>Tato abstraktni trida definuje vzhled editoru pro danou hru.</b></p> | |
| 27 | * | |
| 28 | * @author Milan Vaclavik<br /> | |
| 29 | * @version $Revision: 15 $<br /> | |
| 30 | * $LastChangedBy: mihlon $<br /> | |
| 31 | */ | |
| 32 | public abstract class EditorDesktop extends JPanel | |
| 33 | { | |
| 34 | /** | |
| 35 | * Zadny editor - prazdna plocha. | |
| 36 | */ | |
| 37 | public static final int EDITOR_NONE = 0; | |
| 38 | ||
| 39 | /** | |
| 40 | * Editor pro tvorbu textovych her. | |
| 41 | */ | |
| 42 | public static final int EDITOR_TEXT_BASED_GAMES = 1; | |
| 43 | ||
| 44 | /** | |
| 45 | * Identifikace tridy - datum vzniku tridy :). | |
| 46 | */ | |
| 47 | private static final long serialVersionUID = 20080730134426L; | |
| 48 | ||
| 49 | /** | |
| 50 | * Hlavni panel editoru, ktery obsahuje jednotliva okna vytvarejici editor. | |
| 51 | */ | |
| 52 | private JPanel mainDesktop; | |
| 53 | ||
| 54 | /** | |
| 55 | * Urcuje, jaka zakladni plocha editoru se ma vykreslit pro dany typ editoru. | |
| 56 | */ | |
| 57 | private int druhEditoru; | |
| 58 | ||
| 59 | /** | |
| 60 | * Obekt, obsahujici dany svet. | |
| 61 | */ | |
| 62 | private World world; | |
| 63 | ||
| 64 | /** | |
| 65 | * Definuje vzhled jednotlivych funkcnich oken editoru (okno pro vytvareni | |
| 66 | * sveta, zobrazeni atributu jednotlivych casti sveta a zobrazovani | |
| 67 | * podrobnejsich informaci. | |
| 68 | * @param dEditoru int : Urcuje typ editoru pro dany typ hry. | |
| 69 | */ | |
| 70 | public EditorDesktop(final int dEditoru) | |
| 71 | 0 | { |
| 72 | 0 | this.druhEditoru = dEditoru; |
| 73 | ||
| 74 | 0 | this.createDesktop(); |
| 75 | ||
| 76 | 0 | this.world = new World("Verze 1"); |
| 77 | 0 | } |
| 78 | ||
| 79 | /** | |
| 80 | * Vraci referenci na funkcni okna editoru. | |
| 81 | * @return Container : Panel obsahujici funkcni okna editoru. | |
| 82 | */ | |
| 83 | public final JPanel getMainDesktop() | |
| 84 | { | |
| 85 | 0 | return this.mainDesktop; |
| 86 | } | |
| 87 | ||
| 88 | /** | |
| 89 | * Vraci referenci na prave vytvoreny svet. | |
| 90 | * @return World : Prave vytvoreny svet. | |
| 91 | */ | |
| 92 | public final World getWorld() | |
| 93 | { | |
| 94 | 0 | return this.world; |
| 95 | } | |
| 96 | ||
| 97 | /** | |
| 98 | * Nastavi referenci na funkcni okna editoru. | |
| 99 | * @param desktop JPanel : Panel obsahujici funkcni okna editoru. | |
| 100 | */ | |
| 101 | protected final void setMainDesktop(final JPanel desktop) | |
| 102 | { | |
| 103 | 0 | this.mainDesktop = desktop; |
| 104 | 0 | } |
| 105 | ||
| 106 | /** | |
| 107 | * Vytvori zakladni plochu pro dany typ editoru. | |
| 108 | * Vsechny desktopy dedici tuto tridu museji implementovat tuto metodu. | |
| 109 | */ | |
| 110 | public abstract void createDesktop(); | |
| 111 | ||
| 112 | /** | |
| 113 | * Zajisti spravne vykresleni plochy editoru pri zmene velikosti okna programu. | |
| 114 | */ | |
| 115 | public abstract void resizeWin(); | |
| 116 | } |