 |
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;
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));
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);
139 final File folderDir = mapFolder.
getDir();
140 if (folderDir.exists()) {
141 ACTION_BUILDER.showMessageDialog(
this,
"newPickmapFolderExists", folderName);
145 if (!folderDir.mkdir()) {
146 ACTION_BUILDER.showMessageDialog(
this,
"mkdirIOError", folderDir);
154 ACTION_BUILDER.showMessageDialog(
this,
"newPickmapFolderExists", folderName);
176 return folderName.length() <= 0 ? null : folderName;
static final ActionBuilder ACTION_BUILDER
Action Builder.
void init2()
Initializes the dialog.
Base package of all Gridarta classes.
Stores all known MapFiles.
final MapFolder< G, A, R > parent
The parent folder to add the pickmap folder to.
synchronized void addMapFolder(@NotNull final MapFolder< G, A, R > mapFolder)
Adds a map folder to this model.
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.
Reflects a game object (object on a map).
String getFolderName()
Returns the current folder name value.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
Graphical User Interface of Gridarta.
static final long serialVersionUID
Serial Version UID.
File getDir()
Returns the base directory.
void addDocumentListener( @NotNull final JTextComponent textComponent)
Watches for text changes in a text component and enables the "OK" button accordingly.
GameObjects are the objects based on Archetypes found on maps.
Dialog used to ask the user the properties for the new level.
void updateOkButton()
Updates the enabled state of the "OK" button depending on the dialog's contents.
Indicates that a folder or pickmap name is invalid.
boolean isOkButtonEnabled()
void addFields(@NotNull final JPanel panel, @NotNull final GridBagConstraints gbcLabel, @NotNull final GridBagConstraints gbcField)
Interface for MapArchObjects.
Model class representing a folder of MapFiles.
Dialog to create a new pickmap folder.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
final MapFolderTree< G, A, R > mapFolderTree
The model to add the pickmap folder to.
void init1( @NotNull final Component parentComponent, @NotNull final String dialogTitle)
Initializes the dialog.
final JTextComponent folderNameField
Textfield for the name of the map.
Indicates that a folder name is not unique.
Base classes for rendering maps.
File getBaseDir()
Returns the base directory for creating new map folders.
Utility class for ActionBuilder related functions.
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager.
synchronized void setActiveMapFolder(@NotNull final MapFolder< G, A, R > mapFolder)
Sets the active map folder.
JPanel createMapNamePanel()
Stores all existing MapViews.
JPanel createMapParametersPanel()