 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.dialog.prefs;
22 import java.awt.Component;
23 import java.awt.GridBagLayout;
24 import java.awt.event.ItemEvent;
25 import java.awt.event.ItemListener;
27 import java.util.Arrays;
28 import javax.swing.Box;
29 import javax.swing.JComboBox;
30 import javax.swing.JComponent;
31 import javax.swing.JFileChooser;
32 import javax.swing.JOptionPane;
33 import javax.swing.JPanel;
34 import javax.swing.border.Border;
35 import javax.swing.border.CompoundBorder;
36 import javax.swing.border.TitledBorder;
45 import net.
sf.japi.swing.action.ActionBuilder;
46 import net.
sf.japi.swing.action.ActionBuilderFactory;
47 import net.
sf.japi.swing.prefs.AbstractPrefs;
48 import net.
sf.japi.util.Arrays2;
49 import org.jetbrains.annotations.NotNull;
50 import org.jetbrains.annotations.Nullable;
69 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
132 public void itemStateChanged(
final ItemEvent e) {
133 if (e.getStateChange() == ItemEvent.SELECTED) {
156 add(Box.createVerticalGlue());
181 final String imageSet = (String)
imageSetBox.getSelectedItem();
185 ACTION_BUILDER.showOnetimeMessageDialog(
this, JOptionPane.WARNING_MESSAGE,
"optionsRestart");
201 final int index = Arrays2.linearEqualitySearch(imageSet,
imageSets);
219 final int index = Arrays2.linearEqualitySearch(
"disabled",
imageSets);
227 final String imageSet;
253 final JComponent panel =
new JPanel(
new GridBagLayout());
277 final JComponent panel =
new JPanel(
new GridBagLayout());
304 Arrays.sort(imageSetNames);
305 imageSets =
new String[imageSetNames.length + 1];
307 System.arraycopy(imageSetNames, 0,
imageSets, 1, imageSetNames.length);
312 final int index = Arrays2.linearEqualitySearch(imageSet,
imageSets);
336 return imageSet ==
null || imageSet.isEmpty() || imageSet.equals(
"none") ?
"disabled" : imageSet;
boolean hasMediaDirectory()
Returns whether a media directory is used.
ConfigSource[] getConfigSources()
Returns all defined configuration sources.
Helper class for preference panes.
String getImageSet()
Returns the image set.
Base package of all Gridarta classes.
Defines common UI constants used in different dialogs.
boolean hasImageSet()
Returns whether an image set is used.
void setMediaDirectory(@NotNull File mediaDirectory)
Sets the media directory.
void setConfigSourceName(@NotNull String configSourceName)
Sets the name of the configuration source.
final EditorSettings editorSettings
The editor settings instance.
JFileField mediaField
TextField for media directory path.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
static final Pattern PATTERN_WHITESPACE
Pattern to match whitespace excluding NL and CR.
ResPreferences(@NotNull final ProjectSettings projectSettings, @NotNull final EditorSettings editorSettings, @NotNull final ConfigSourceFactory configSourceFactory)
Creates a new instance.
Graphical User Interface of Gridarta.
static String convertImageSet(@Nullable final String imageSet)
Returns a human readable name for a given image set.
JFileField mapField
TextField for map directory path.
Possible source locations for configuration files.
final ProjectSettings projectSettings
The project settings instance.
Settings that apply to the editor.
Component buildImageSetBox()
Constructs the combo box for the selection of image sets.
ConfigSource getConfigSource(@NotNull String name)
Returns a ConfigSource by name.
final ItemListener itemListener
The ItemListener attached to configSourceComboBox.
void setArchDirectory(@NotNull File archDirectory)
Sets the archetype directory.
A component for selecting files.
File getArchDirectoryDefault()
Returns the default archetype directory.
JComboBox< ConfigSource > configSourceComboBox
ComboBox for choosing the configuration source.
static Border createTitledBorder(final String titleKey)
Creates a titled border.
void setMapsDirectory(@NotNull File mapsDirectory)
Sets the default maps directory.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Utility class for string manipulation.
String[] imageSets
Contains all supported image sets.
String getConfigSourceName()
Returns the name of the configuration source.
Settings that apply to a project.
Preferences Module for resource preferences.
JComboBox< String > imageSetBox
ComboBox for choosing the image set.
A factory for creating ConfigSources.
String getCurrentImageSet()
Returns the name of the currently selected image set.
JFileField archField
TextField for arch directory path.
File getArchDirectory()
Returns the archetype directory.
File getMapsDirectoryDefault()
Returns the default maps directory.
ConfigSource getDefaultConfigSource()
Returns the default ConfigSource.
static final ActionBuilder ACTION_BUILDER
Action Builder.
Utility class for ActionBuilder related functions.
Component createGlobalPanel()
Creates the sub-panel with the editor settings.
File getMapsDirectory()
Returns the default maps directory.
void setImageSet(@NotNull String imageSet)
Sets the image set.
Component createResourcePanel()
Creates the sub-panel with the resource paths.
void setFile(@NotNull final File file)
Sets the currently selected file.
File getMediaDirectory()
Returns the media directory.
void setEnabled(final boolean enabled)
File getMediaDirectoryDefault()
Returns the default media directory.
File getFile()
Returns the currently selected file.
final ConfigSourceFactory configSourceFactory
The ConfigSourceFactory to use.
Border DIALOG_BORDER
The Border object to be used when creating dialogs.
void addComponent(@NotNull final Component component)
Adds a component to the container.
boolean isArchDirectoryInputFieldEnabled()
Whether the "archetype directory" input field in the settings dialog should be enabled.
static final long serialVersionUID
The serial version UID.