 |
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.Container;
24 import java.awt.GridBagLayout;
25 import java.util.Arrays;
26 import java.util.Comparator;
27 import java.util.Locale;
28 import java.util.Objects;
29 import java.util.prefs.Preferences;
30 import javax.swing.AbstractButton;
31 import javax.swing.Box;
32 import javax.swing.JCheckBox;
33 import javax.swing.JComboBox;
34 import javax.swing.JComponent;
35 import javax.swing.JPanel;
36 import javax.swing.border.Border;
37 import javax.swing.border.CompoundBorder;
38 import javax.swing.border.TitledBorder;
44 import net.
sf.japi.swing.action.ActionBuilder;
45 import net.
sf.japi.swing.action.ActionBuilderFactory;
46 import net.
sf.japi.swing.misc.LocaleListCellRenderer;
47 import net.
sf.japi.swing.prefs.AbstractPrefs;
48 import net.
sf.japi.util.LocaleComparator;
49 import org.jetbrains.annotations.NotNull;
72 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
114 private final Comparator<Locale>
comp =
new LocaleComparator();
128 add(Box.createVerticalGlue());
143 final Locale loc = (Locale)
localeBox.getSelectedItem();
155 localeBox.setSelectedIndex(Arrays.binarySearch(
locales, current ==
null ?
null :
new Locale(current),
comp));
167 final Locale loc = (Locale)
localeBox.getSelectedItem();
169 final Locale current = currentName ==
null ? null :
new Locale(currentName);
179 final Container lineLayout = Box.createHorizontalBox();
181 final CharSequence availableLocales =
ACTION_BUILDER.getString(
"availableLocales");
183 locales =
new Locale[locNames.length + 1];
185 for (
int i = 0; i < locNames.length; i++) {
186 locales[i + 1] =
new Locale(locNames[i]);
193 localeBox.setRenderer(
new LocaleListCellRenderer());
196 localeBox.setSelectedIndex(Arrays.binarySearch(
locales, current ==
null ?
null :
new Locale(current),
comp));
208 final JComponent panel =
new JPanel(
new GridBagLayout());
223 final JComponent panel =
new JPanel(
new GridBagLayout());
final EditorSettings editorSettings
The EditorSettings to use.
boolean SHOW_MAIN_TOOLBAR_DEFAULT
Default value for whether the main window's toolbar is shown.
Helper class for preference panes.
Preferences Module for user interface preferences.
Base package of all Gridarta classes.
Defines common UI constants used in different dialogs.
AbstractButton showMainToolbar
Whether to show the main window's toolbar.
static final Preferences PREFERENCES
Preferences.
boolean isShowMainToolbar()
Returns whether the main toolbar should be shown.
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.
Graphical User Interface of Gridarta.
void setShowMainToolbar(boolean selected)
Sets whether the main toolbar should be shown.
Settings that apply to the editor.
static final ActionBuilder ACTION_BUILDER
Action Builder.
static final long serialVersionUID
The serial version UID.
Locale[] locales
Locale[].
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.
static final String[] EMPTY_STRING_ARRAY
An empty.
Component buildLocaleBox()
Constructs the combo box for the selection of locales.
GUIPreferences(@NotNull final EditorSettings editorSettings)
Creates a new instance.
JComboBox< Locale > localeBox
/** ComboBox for choosing the locale.
Component createLayoutPanel()
Creates the sub-panel with the layout settings.
final Comparator< Locale > comp
LocaleComparator.
Utility class for ActionBuilder related functions.
static final String PREFERENCES_LANGUAGE
Preferences key for language.
static Border createTitledBorder(@NotNull final String titleKey)
Creates a titled border.
Border DIALOG_BORDER
The Border object to be used when creating dialogs.
void addComponent(@NotNull final Component component)
Adds a component to the container.
Component createGlobalPanel()
Creates the sub-panel with the editor settings.
Interface used as preferences location.