20 package net.sf.gridarta.gui.dialog.newmap;
22 import java.awt.Component;
23 import java.awt.FlowLayout;
24 import java.io.IOException;
25 import javax.swing.JPanel;
26 import javax.swing.JTextField;
27 import javax.swing.text.JTextComponent;
36 import net.
sf.japi.swing.action.ActionBuilder;
37 import net.
sf.japi.swing.action.ActionBuilderFactory;
38 import org.jetbrains.annotations.NotNull;
39 import org.jetbrains.annotations.Nullable;
56 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
86 super(null, null, defaultWidth, defaultHeight);
91 addDocumentListener(pickmapNameField);
98 final JPanel panel =
new JPanel(
new FlowLayout(FlowLayout.RIGHT));
100 panel.add(pickmapNameField);
107 if (mapSize == null) {
112 if (pickmapName == null) {
117 pickmapChooserView.
newPickmap(mapSize, pickmapName);
119 ACTION_BUILDER.showMessageDialog(
this,
"pickmapExists", pickmapName);
121 }
catch (
final IOException ex) {
122 ACTION_BUILDER.showMessageDialog(
this,
"pickmapIOError", pickmapName, ex.getMessage());
141 final String folderName = pickmapNameField.getText();
142 if (folderName.length() <= 0) {
final int defaultHeight
The default height for new maps.
Graphical User Interface of Gridarta.
String getPickmapName()
Returns the current pickmap name value.
int getMapWidth()
Returns the current map width value.
boolean isOkButtonEnabled()
static final long serialVersionUID
Serial Version UID.
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.
A View for choosing pickmaps.
final JTextComponent pickmapNameField
Textfield for the name of the map.
Reflects a game object (object on a map).
static final ActionBuilder ACTION_BUILDER
Action Builder.
final ObjectChooser< G, A, R > objectChooser
The object chooser instance to use.
Indicates that a pickmap name is not unique within its folder.
GameObjects are the objects based on Archetypes found on maps.
void newPickmap(@NotNull final Size2D mapSize, @NotNull final String pickmapName)
Add a new pickmap.
final int defaultWidth
The default width for new maps.
Classes implementing the pickmap chooser.
void movePickmapChooserToFront()
Move the Pickmap Chooser in front of the Archetype Chooser.
Utility class for ActionBuilder related functions.
An abstract base class implementing a AbstractNewMapDialog supporting map size input fields...
final PickmapChooserView< G, A, R > pickmapChooserView
The pickmap chooser view.
NewPickmapDialog(@NotNull final ObjectChooser< G, A, R > objectChooser, @NotNull final Component parentComponent, final int defaultWidth, final int defaultHeight, @NotNull final PickmapChooserView< G, A, R > pickmapChooserView)
Creates a "new pickmap" dialog.
Size2D getMapSize()
Validate the map size fields and return the result.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
Common base interface for ObjectChoosers.
JPanel createMapNamePanel()
Interface for MapArchObjects.
int getMapHeight()
Returns the current map height value.
The class Size2D represents a 2d rectangular area.
Dialog to create a new pickmap file.