Gridarta Editor
DefaultExitConnectorModel.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
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 2 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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.exitconnector;
21 
22 import java.util.prefs.Preferences;
23 import net.sf.gridarta.MainControl;
24 import org.jetbrains.annotations.NotNull;
25 
32 
36  private static final String PASTE_EXIT_NAME_KEY = "exitConnectorPasteExitName";
37 
41  private static final boolean PASTE_EXIT_NAME_DEFAULT = true;
42 
46  private static final String AUTO_CREATE_EXIT_KEY = "exitConnectorAutoCreateExit";
47 
51  private static final boolean AUTO_CREATE_EXIT_DEFAULT = true;
52 
56  private static final String EXIT_ARCHETYPE_NAME_KEY = "exitConnectorExitArchetypeName";
57 
61  private static final String EXIT_ARCHETYPE_NAME_DEFAULT = "invis_exit";
62 
66  private static final Preferences PREFERENCES = Preferences.userNodeForPackage(MainControl.class);
67 
68  @Override
69  protected boolean loadPasteExitName() {
70  return PREFERENCES.getBoolean(PASTE_EXIT_NAME_KEY, PASTE_EXIT_NAME_DEFAULT);
71  }
72 
73  @Override
74  protected void savePasteExitName(final boolean pasteExitName) {
75  PREFERENCES.putBoolean(PASTE_EXIT_NAME_KEY, pasteExitName);
76  }
77 
78  @Override
79  protected boolean loadAutoCreateExit() {
80  return PREFERENCES.getBoolean(AUTO_CREATE_EXIT_KEY, AUTO_CREATE_EXIT_DEFAULT);
81  }
82 
83  @Override
84  protected void saveAutoCreateExit(final boolean autoCreateExit) {
85  PREFERENCES.putBoolean(AUTO_CREATE_EXIT_KEY, autoCreateExit);
86  }
87 
88  @NotNull
89  @Override
90  protected String loadExitArchetypeName() {
91  return PREFERENCES.get(EXIT_ARCHETYPE_NAME_KEY, EXIT_ARCHETYPE_NAME_DEFAULT);
92  }
93 
94  @Override
95  protected void saveExitArchetypeName(@NotNull final String exitArchetypeName) {
96  PREFERENCES.put(EXIT_ARCHETYPE_NAME_KEY, exitArchetypeName);
97  }
98 
99 }
static final boolean AUTO_CREATE_EXIT_DEFAULT
The default value for AUTO_CREATE_EXIT_KEY.
static final String EXIT_ARCHETYPE_NAME_KEY
The preferences key for "exit archetype".
static final String EXIT_ARCHETYPE_NAME_DEFAULT
The default value for EXIT_ARCHETYPE_NAME_KEY.
void saveExitArchetypeName(@NotNull final String exitArchetypeName)
static final boolean PASTE_EXIT_NAME_DEFAULT
The default value for PASTE_EXIT_NAME_KEY.
Base package of all Gridarta classes.
boolean autoCreateExit
Whether exit game objects should be auto-created when needed.
Interface used as preferences location.
static final String AUTO_CREATE_EXIT_KEY
The preferences key for "auto create exit".
static final String PASTE_EXIT_NAME_KEY
The preferences key for "paste exit name".
String exitArchetypeName
The archetype to insert when creating new exit game objects.
boolean pasteExitName
Whether the exit's name should be set when pasted.