20 package net.sf.gridarta.model.settings;
23 import java.util.prefs.PreferenceChangeEvent;
24 import java.util.prefs.PreferenceChangeListener;
25 import java.util.prefs.Preferences;
28 import net.
sf.japi.swing.action.ActionBuilder;
29 import net.
sf.japi.swing.action.ActionBuilderFactory;
30 import org.jetbrains.annotations.NotNull;
42 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
107 final PreferenceChangeListener preferenceChangeListener =
new PreferenceChangeListener() {
110 public void preferenceChange(
final PreferenceChangeEvent evt) {
111 if (evt.getKey().equals(SHOW_MAIN_TOOLBAR_KEY)) {
117 PREFERENCES.addPreferenceChangeListener(preferenceChangeListener);
123 return new File(archDirectoryDefault);
129 return new File(mapsDirectoryDefault);
140 return new File(mediaDirectoryDefault);
161 PREFERENCES.putBoolean(SHOW_MAIN_TOOLBAR_KEY, selected);
172 return PREFERENCES.get(key.getKey(), defaultValue);
177 PREFERENCES.put(key.getKey(), value);
DefaultEditorSettings()
Creates a new instance.
void setKey(@NotNull final EditorSettingsKey key, @NotNull final String value)
Saves a settings value.
String getImageSetDefault()
Returns the default image set.
boolean hasMediaDirectory()
Returns whether a media directory is used.
Default implementation of EditorSettings.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
void fireShowMainToolbarChanged()
Notifies all listeners about a changed visibility of the main toolbar.
Base package of all Gridarta classes.
File getMediaDirectoryDefault()
Returns the default media directory.
static final String SHOW_MAIN_TOOLBAR_KEY
Key for info whether the main window's toolbar is shown.
final String archDirectoryDefault
The default value for the archetype directory.
boolean SHOW_MAIN_TOOLBAR_DEFAULT
Default value for whether the main window's toolbar is shown.
final boolean hasMediaDirectory
Whether a media directory is used.
Interface used as preferences location.
static final String PREFERENCES_USER_NAME_DEFAULT
Preferences default value for user name.
Utility class for ActionBuilder related functions.
File getMapsDirectoryDefault()
Returns the default maps directory.
boolean isShowMainToolbar()
Returns whether the main toolbar should be shown.
void setShowMainToolbar(final boolean selected)
Sets whether the main toolbar should be shown.
Abstract base class for EditorSettings implementations.
Possible keys for saving values in the EditorSettings.
final boolean hasImageSet
Whether an image set is used.
static final ActionBuilder ACTION_BUILDER
The ActionBuilder.
final String mediaDirectoryDefault
The default value for the media directory.
String getKey(@NotNull final EditorSettingsKey key, @NotNull final String defaultValue)
Returns a settings value.
static boolean getBoolean(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Returns the value of a key as a.
final String imageSetDefault
The default value for the image set.
boolean hasImageSet()
Returns whether an image set is used.
final String mapsDirectoryDefault
The default value for the maps directory.
String getUserNameDefault()
Returns the default user name.
File getArchDirectoryDefault()
Returns the default archetype directory.
static final Preferences PREFERENCES
Preferences.