20 package net.sf.gridarta.gui.dialog.newmap;
22 import java.awt.Component;
23 import java.awt.FlowLayout;
24 import java.awt.GridBagConstraints;
26 import javax.swing.JPanel;
27 import javax.swing.JTextField;
28 import javax.swing.text.JTextComponent;
38 import net.
sf.japi.swing.action.ActionBuilder;
39 import net.
sf.japi.swing.action.ActionBuilderFactory;
40 import org.jetbrains.annotations.NotNull;
41 import org.jetbrains.annotations.Nullable;
58 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
105 final JPanel panel =
new JPanel(
new FlowLayout(FlowLayout.RIGHT));
107 panel.add(folderNameField);
118 protected void addFields(@NotNull
final JPanel panel, @NotNull
final GridBagConstraints gbcLabel, @NotNull
final GridBagConstraints gbcField) {
119 throw new AssertionError();
126 if (folderName == null) {
134 ACTION_BUILDER.showMessageDialog(
this,
"newPickmapFolderInvalidName", folderName);
135 folderNameField.requestFocus();
139 final File folderDir = mapFolder.
getDir();
140 if (folderDir.exists()) {
141 ACTION_BUILDER.showMessageDialog(
this,
"newPickmapFolderExists", folderName);
142 folderNameField.requestFocus();
145 if (!folderDir.mkdir()) {
146 ACTION_BUILDER.showMessageDialog(
this,
"mkdirIOError", folderDir);
147 folderNameField.requestFocus();
154 ACTION_BUILDER.showMessageDialog(
this,
"newPickmapFolderExists", folderName);
155 folderNameField.requestFocus();
175 final String folderName = folderNameField.getText();
176 if (folderName.length() <= 0) {
File getBaseDir()
Returns the base directory for creating new map folders.
Graphical User Interface of Gridarta.
final MapFolder< G, A, R > parent
The parent folder to add the pickmap folder to.
final JTextComponent folderNameField
Textfield for the name of the map.
final MapFolderTree< G, A, R > mapFolderTree
The model to add the pickmap folder to.
File getDir()
Returns the base directory.
static final ActionBuilder ACTION_BUILDER
Action Builder.
JPanel createMapParametersPanel()
Stores all existing MapViews.
void addFields(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField)
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
void updateOkButton()
Updates the enabled state of the "OK" button depending on the dialog's contents.
NewPickmapFolderDialog(@NotNull final Component parentComponent, @NotNull final MapFolderTree< G, A, R > mapFolderTree, @Nullable final MapFolder< G, A, R > parent, @NotNull final MapViewsManager< G, A, R > mapViewsManager)
Creates a "new pickmap folder" dialog.
synchronized void addMapFolder(@NotNull final MapFolder< G, A, R > mapFolder)
Adds a map folder to this model.
Base package of all Gridarta classes.
void init2()
Initializes the dialog.
Reflects a game object (object on a map).
Indicates that a folder name is not unique.
GameObjects are the objects based on Archetypes found on maps.
Stores all known MapFiles.
Base classes for rendering maps.
Utility class for ActionBuilder related functions.
static final long serialVersionUID
Serial Version UID.
synchronized void setActiveMapFolder(@NotNull final MapFolder< G, A, R > mapFolder)
Sets the active map folder.
void addDocumentListener( @NotNull final JTextComponent textComponent)
Watches for text changes in a text component and enables the "OK" button accordingly.
boolean isOkButtonEnabled()
Dialog used to ask the user the properties for the new level.
Dialog to create a new pickmap folder.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
JPanel createMapNamePanel()
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager.
String getFolderName()
Returns the current folder name value.
Interface for MapArchObjects.
Indicates that a folder or pickmap name is invalid.
Model class representing a folder of MapFiles.
void init1( @NotNull final Component parentComponent, @NotNull final String dialogTitle)
Initializes the dialog.