20 package net.sf.gridarta.gui.dialog.prefs;
22 import java.awt.Component;
23 import java.awt.GridBagLayout;
24 import java.util.HashMap;
26 import javax.swing.AbstractButton;
27 import javax.swing.Box;
28 import javax.swing.JCheckBox;
29 import javax.swing.JComponent;
30 import javax.swing.JPanel;
31 import javax.swing.border.Border;
32 import javax.swing.border.CompoundBorder;
33 import javax.swing.border.TitledBorder;
39 import net.
sf.japi.swing.action.ActionBuilder;
40 import net.
sf.japi.swing.action.ActionBuilderFactory;
41 import net.
sf.japi.swing.prefs.AbstractPrefs;
42 import org.jetbrains.annotations.NotNull;
60 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
77 private final Map<Validator<?, ?, ?>, JCheckBox>
checkBoxes =
new HashMap<>();
95 setListLabelIcon(ACTION_BUILDER.getIcon(
"prefsMapValidator.icon"));
99 add(Box.createVerticalGlue());
114 entry.getKey().setEnabled(entry.getValue().isSelected());
122 entry.getValue().setSelected(entry.getKey().isEnabled());
130 entry.getValue().setSelected(entry.getKey().isDefaultEnabled());
132 autoValidate.setSelected(autoDefault);
138 if (entry.getValue().isSelected() != entry.getKey().isEnabled()) {
151 final JComponent panel =
new JPanel(
new GridBagLayout());
164 final JComponent panel =
new JPanel(
new GridBagLayout());
168 final JCheckBox checkBox =
new JCheckBox(
ActionBuilderUtils.
getString(ACTION_BUILDER, validator.getKey() +
".title"), validator.isEnabled());
169 checkBoxes.put(validator, checkBox);
static final long serialVersionUID
The serial version UID.
final AbstractButton autoValidate
Check box to set whether map files should be really checked.
Graphical User Interface of Gridarta.
Component createValidationPanel()
Creates the sub-panel with the generic validation settings.
static final ActionBuilder ACTION_BUILDER
Action Builder to create Actions.
This package contains the framework for validating maps.
Component createValidatorsPanel()
Creates the sub-panel with the validators information.
static Border createTitledBorder(final String titleKey)
Creates a titled border.
void addComponent(@NotNull final Component component)
Adds a component to the container.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Base package of all Gridarta classes.
final boolean autoDefault
Whether the auto-validator is enabled by default.
static boolean isEnabled()
Return whether the auto-validator is enabled.
Super-interface for validators.
Helper class for preference panes.
MapValidatorPreferences(@NotNull final DelegatingMapValidator<?, ?, ?> validators, final boolean autoDefault)
Creates a new instance.
static void setEnabled(final boolean enabled)
Set whether the auto-validator is enabled.
A Map Validator that delegates to other MapValidators.
Utility class for ActionBuilder related functions.
Implements the auto-validator for map validation.
Preferences Module for map validator preferences.
Border DIALOG_BORDER
The Border object to be used when creating dialogs.
final DelegatingMapValidator<?, ?, ?> validators
The delegating validator that contains all the validators.
final Map< Validator<?, ?, ?>, JCheckBox > checkBoxes
Checkboxes to enabled the individual validator checks.
Defines common UI constants used in different dialogs.