 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.dialog.newmap;
22 import java.awt.Component;
23 import java.awt.FlowLayout;
24 import java.awt.GridBagConstraints;
25 import javax.swing.AbstractButton;
26 import javax.swing.JCheckBox;
27 import javax.swing.JPanel;
28 import javax.swing.JTextField;
29 import javax.swing.text.JTextComponent;
38 import net.
sf.japi.swing.action.ActionBuilder;
39 import net.
sf.japi.swing.action.ActionBuilderFactory;
40 import net.
sf.japi.swing.action.ActionMethod;
41 import org.jetbrains.annotations.NotNull;
42 import org.jetbrains.annotations.Nullable;
77 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
185 final JPanel panel =
new JPanel(
new FlowLayout(FlowLayout.RIGHT));
192 protected void addFields(@NotNull
final JPanel panel, @NotNull
final GridBagConstraints gbcLabel, @NotNull
final GridBagConstraints gbcField) {
196 super.addFields(panel, gbcLabel, gbcField);
210 if (mapSize ==
null) {
213 mapArchObject.setMapSize(mapSize);
216 if (mapName ==
null) {
220 mapArchObject.setMapName(mapName);
223 if (difficulty < 0) {
226 mapArchObject.setDifficulty(difficulty);
245 return mapName.isEmpty() ? null : mapName;
255 return difficulty >= 1 ? difficulty : -1;
int getDifficulty()
Returns the current difficulty value.
static int parseInt(@NotNull final String s)
Parses an integer string.
boolean mapSizeDefault
Whether to use the default map size.
final AbstractButton mapSizeDefaultCheckbox
Checkbox to set whether the default width / height should be overridden.
final int defaultDifficulty
The default height for new maps.
Base package of all Gridarta classes.
static final String DEFAULT_LEVEL_HEIGHT_KEY
The key used to store the last used map height in preferences.
boolean isMapSizeDefault()
Set whether to override the default map size.
String getMapName()
Returns the current map name value.
Reflects a game object (object on a map).
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
Graphical User Interface of Gridarta.
int getMapHeight()
Returns the current map height value.
static final ActionBuilder ACTION_BUILDER
Action Builder.
void setMapSizeDefault(final boolean mapSizeDefault)
Set whether to override the default map size.
GameObjects are the objects based on Archetypes found on maps.
static final String DEFAULT_DIFFICULTY_KEY
The key used to store the last used difficulty in preferences.
final JTextField mapDifficultyField
Textfield for the difficulty of the new map.
void newMapWithView(@Nullable final List< G > objects, @NotNull final A mapArchObject, @Nullable final Point viewPosition, @Nullable final MapFile mapFile)
Creates a new map control and an initial map view.
Interface for MapArchObjects.
final boolean showMapSizeDefault
Whether to show the "mapSizeDefault" checkbox.
boolean isOkButtonEnabled()
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
final boolean showMapDifficulty
Whether to show the "mapDifficulty" field.
static final String DEFAULT_LEVEL_WIDTH_KEY
The key used to store the last used map width in preferences.
JPanel createMapNamePanel()
static final long serialVersionUID
Serial Version UID.
final int defaultHeight
The default height for new maps.
final int defaultWidth
The default width for new maps.
Base classes for rendering maps.
void addFields(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField)
Dialog to create a new map file.
An abstract base class implementing a AbstractNewMapDialog supporting map size input fields.
NewMapDialog(@NotNull final MapViewsManager< G, A, R > mapViewsManager, @NotNull final MapArchObjectFactory< A > mapArchObjectFactory, @NotNull final Component parentComponent, final boolean showMapSizeDefault, final boolean showMapDifficulty, final int defaultWidth, final int defaultHeight, final int defaultDifficulty)
Creates a "new map" dialog.
int getMapWidth()
Returns the current map width value.
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager to use.
Utility class for ActionBuilder related functions.
void setMapSizeEnabled(final boolean enabled)
Enables or disables the map size input fields.
Size2D getMapSize()
Validate the map size fields and return the result.
A newMapArchObject(boolean addDefaultAttributes)
Creates a new MapArchObject instance.
final MapArchObjectFactory< A > mapArchObjectFactory
The map arch object factory instance.
Stores all existing MapViews.
The class Size2D represents a 2d rectangular area.
Factory for creating MapArchObject instances.
Utility class for parsing strings into numbers.
final JTextComponent mapNameField
Textfield for the name of the map.