Gridarta Editor
MapPropertiesDialog.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.var.daimonin.gui.mappropertiesdialog;
21 
22 import java.awt.BorderLayout;
23 import java.awt.Component;
24 import java.awt.Container;
25 import java.awt.FlowLayout;
26 import java.awt.Frame;
27 import java.awt.GridBagConstraints;
28 import java.awt.GridBagLayout;
29 import java.awt.GridLayout;
30 import java.awt.Insets;
31 import java.awt.Window;
32 import javax.swing.AbstractButton;
33 import javax.swing.BorderFactory;
34 import javax.swing.BoxLayout;
35 import javax.swing.JButton;
36 import javax.swing.JCheckBox;
37 import javax.swing.JComponent;
38 import javax.swing.JDialog;
39 import javax.swing.JFileChooser;
40 import javax.swing.JOptionPane;
41 import javax.swing.JPanel;
42 import javax.swing.JScrollPane;
43 import javax.swing.JTabbedPane;
44 import javax.swing.JTextArea;
45 import javax.swing.JTextField;
46 import javax.swing.ScrollPaneConstants;
47 import javax.swing.border.Border;
48 import javax.swing.border.EmptyBorder;
49 import javax.swing.filechooser.FileFilter;
59 import net.sf.gridarta.utils.Size2D;
63 import net.sf.japi.swing.action.ActionBuilder;
64 import net.sf.japi.swing.action.ActionBuilderFactory;
65 import net.sf.japi.swing.action.ActionMethod;
66 import net.sf.japi.swing.misc.JFileChooserButton;
67 import org.jetbrains.annotations.NotNull;
68 import org.jetbrains.annotations.Nullable;
69 
78 public class MapPropertiesDialog extends JOptionPane {
79 
83  private static final long serialVersionUID = 1L;
84 
88  @NotNull
89  private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta");
90 
95  @NotNull
96  private final Frame helpParent;
97 
101  @NotNull
103 
108  @NotNull
110 
115  @Nullable
116  private Window dialog;
117 
122  @NotNull
123  private final JTextArea mapDescription = new JTextArea(4, 4);
124 
129  @NotNull
130  private final JTextField mapName = new JTextField();
131 
136  @NotNull
137  private final JTextField mapBackgroundMusic = new JTextField();
138 
143  @NotNull
144  private final JTextField mapWidthField = new JTextField();
145 
150  @NotNull
151  private final JTextField mapHeightField = new JTextField();
152 
157  @NotNull
158  private final AbstractButton checkboxOutdoor = new JCheckBox();
159 
164  @NotNull
165  private final JTextField fieldEnterX = new JTextField();
166 
171  @NotNull
172  private final JTextField fieldEnterY = new JTextField();
173 
178  @NotNull
179  private final JTextField fieldSwapTime = new JTextField();
180 
185  @NotNull
186  private final JTextField fieldResetTimeout = new JTextField();
187 
192  @NotNull
193  private final JTextField fieldDifficulty = new JTextField();
194 
199  @NotNull
200  private final JTextField fieldDarkness = new JTextField();
201 
206  @NotNull
207  private final AbstractButton checkboxFixedReset = new JCheckBox();
208 
213  @NotNull
214  private final AbstractButton checkboxNoSave = new JCheckBox();
215 
220  @NotNull
221  private final AbstractButton checkboxNoMagic = new JCheckBox();
222 
227  @NotNull
228  private final AbstractButton checkboxNoPriest = new JCheckBox();
229 
234  @NotNull
235  private final AbstractButton checkboxNoSummon = new JCheckBox();
236 
241  @NotNull
242  private final AbstractButton checkboxNoHarm = new JCheckBox();
243 
248  @NotNull
249  private final AbstractButton checkboxNoFixedLogin = new JCheckBox();
250 
255  @NotNull
256  private final AbstractButton checkboxPermDeath = new JCheckBox();
257 
262  @NotNull
263  private final AbstractButton checkboxUltraDeath = new JCheckBox();
264 
269  @NotNull
270  private final AbstractButton checkboxUltimateDeath = new JCheckBox();
271 
276  @NotNull
277  private final AbstractButton checkboxPvp = new JCheckBox();
278 
283  @NotNull
284  private final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this));
285 
290  @NotNull
291  private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this));
292 
297  @NotNull
299 
304  private final boolean mapTilePaneEnabled;
305 
314  public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) {
315  okButton.setDefaultCapable(true);
316  final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this));
317  final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this));
318  setOptions(new Object[] { helpButton, okButton, restoreButton, cancelButton });
319 
320  this.helpParent = helpParent;
321  this.projectSettings = projectSettings;
322  this.mapModel = mapModel;
323  final MapArchObject map = mapModel.getMapArchObject();
324 
325  final JTabbedPane tabs = new JTabbedPane();
326  tabs.setBorder(new EmptyBorder(10, 4, 4, 4));
327 
328  final Component mainPanel = createMainPanel(map);
329  tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapMapTabTitle"), mainPanel);
330 
331  mapTilePane = new IsoMapTilePane<>(mapManager, projectSettings, mapModel, mapFileFilter);
332  final Component tilePanel = createTilePathPanel(mapTilePane);
333  tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapTilesTabTitle"), tilePanel);
334 
335  mapTilePaneEnabled = mapModel.getMapFile() != null;
336  tabs.setEnabledAt(tabs.indexOfComponent(tilePanel), mapTilePaneEnabled);
337 
338  // The layoutHack is used because otherwise a tabbed pane isn't increased to its vertical size by some OptionPaneUI implementations.
339  final Container layoutHack = new JPanel(new BorderLayout());
340  layoutHack.add(tabs);
341  setMessage(layoutHack);
342 
354  }
355 
361  @NotNull
362  private Component createMainPanel(@NotNull final MapArchObject map) {
363  final GridBagConstraints gbc = new GridBagConstraints();
364  final JComponent mainPanel = new JPanel(new GridBagLayout());
365  mainPanel.setBorder(GUIConstants.DIALOG_BORDER);
366  gbc.fill = GridBagConstraints.BOTH;
367 
368  gbc.gridx = 1;
369  gbc.gridy = 1;
370  gbc.weightx = 1.0;
371  gbc.weighty = 1.0;
372  mainPanel.add(createMapPanel(map), gbc);
373 
374  gbc.gridx = 1;
375  gbc.gridy = 2;
376  gbc.weighty = 1.0;
377  mainPanel.add(createMapDataPanel(map), gbc);
378 
379  gbc.gridx = 2;
380  gbc.gridy = 1;
381  gbc.weighty = 2.0;
382  gbc.gridheight = 4;
383  mainPanel.add(createOptionsPanel(map), gbc);
384 
385  gbc.weightx = 1.0;
386  gbc.weighty = 1.0;
387 
388  return mainPanel;
389  }
390 
396  @NotNull
398  mapDescription.setText(map.getText());
399  mapDescription.setCaretPosition(0);
400  final JScrollPane scrollPane = new JScrollPane(mapDescription);
401  mapDescription.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0));
402  scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
403  scrollPane.setBorder(createTitledBorder("mapText"));
404  return scrollPane;
405  }
406 
412  @NotNull
413  private Component createOptionsPanel(@NotNull final MapArchObject map) {
414  final JPanel optionPanel = new JPanel(new GridLayout(0, 2));
415 
416  optionPanel.add(createPanelLine(fieldEnterX, 10, map.getEnterX(), "mapEnterX"));
417  optionPanel.add(createPanelLine(fieldEnterY, 10, map.getEnterY(), "mapEnterY"));
418  optionPanel.add(createPanelLine(fieldDifficulty, 10, map.getDifficulty(), "mapDifficulty"));
419  optionPanel.add(createPanelLine(fieldDarkness, 10, map.getDarkness(), "mapDarkness"));
420  optionPanel.add(createPanelLine(fieldSwapTime, 10, map.getSwapTime(), "mapSwapTime"));
421  optionPanel.add(createPanelLine(fieldResetTimeout, 10, map.getResetTimeout(), "mapResetTimeout"));
422 
423  optionPanel.add(createPanelCBox(checkboxNoSave, map.isNoSave(), "mapNoSave"));
424  optionPanel.add(createPanelCBox(checkboxNoMagic, map.isNoMagic(), "mapNoMagic"));
425  optionPanel.add(createPanelCBox(checkboxNoPriest, map.isNoPriest(), "mapNoPrayers"));
426  optionPanel.add(createPanelCBox(checkboxNoHarm, map.isNoHarm(), "mapNoHarm"));
427  optionPanel.add(createPanelCBox(checkboxNoSummon, map.isNoSummon(), "mapNoSumm"));
428  optionPanel.add(createPanelCBox(checkboxNoFixedLogin, map.isFixedLogin(), "mapFixedLogin"));
429  optionPanel.add(createPanelCBox(checkboxPermDeath, map.isPermDeath(), "mapPermDeath"));
430  optionPanel.add(createPanelCBox(checkboxUltraDeath, map.isUltraDeath(), "mapUltraDeath"));
431  optionPanel.add(createPanelCBox(checkboxUltimateDeath, map.isUltimateDeath(), "mapInstantDeath"));
432  optionPanel.add(createPanelCBox(checkboxPvp, map.isPvp(), "mapPvP"));
433 
434  final JComponent scrollPane = new JScrollPane(optionPanel);
435  scrollPane.setBorder(createTitledBorder("mapOptions"));
436  return scrollPane;
437  }
438 
444  @NotNull
445  private Component createMapPanel(@NotNull final MapArchObject map) {
446  final JPanel mapPanel = new JPanel(new GridBagLayout());
447  final GridBagConstraints labelGbc = new GridBagConstraints();
448  labelGbc.anchor = GridBagConstraints.EAST;
449  labelGbc.insets = new Insets(2, 10, 2, 2);
450  final GridBagConstraints gbc = new GridBagConstraints();
451  gbc.insets = new Insets(2, 2, 2, 2);
452  gbc.fill = GridBagConstraints.HORIZONTAL;
453  gbc.gridwidth = GridBagConstraints.REMAINDER;
454  gbc.weightx = 2.0;
455 
456  mapPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "mapName"), labelGbc);
457  mapName.setColumns(16);
458  mapName.setText(map.getMapName());
459  mapPanel.add(mapName, gbc);
460 
461  mapPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "mapBackgroundMusic"), labelGbc);
462  mapBackgroundMusic.setColumns(16);
463  mapBackgroundMusic.setText(map.getBackgroundMusic());
464  final Container mapBackgroundMusicPanel = new JPanel(new BorderLayout());
465  mapBackgroundMusicPanel.add(mapBackgroundMusic);
466  mapBackgroundMusicPanel.add(new JFileChooserButton(projectSettings.getMediaDirectory(), mapBackgroundMusic, JFileChooser.FILES_ONLY), BorderLayout.EAST);
467  mapPanel.add(mapBackgroundMusicPanel, gbc);
468 
469  mapPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "mapWidth"), labelGbc);
470  mapWidthField.setColumns(5);
471  mapWidthField.setText(Integer.toString(mapModel.getMapArchObject().getMapSize().getWidth()));
472  gbc.gridwidth = 1;
473  gbc.weightx = 1.0;
474  mapPanel.add(mapWidthField, gbc);
475 
476  mapPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "mapHeight"), labelGbc);
477  mapHeightField.setColumns(5);
478  mapHeightField.setText(Integer.toString(mapModel.getMapArchObject().getMapSize().getHeight()));
479  gbc.gridwidth = GridBagConstraints.REMAINDER;
480  gbc.weightx = 1.0;
481  mapPanel.add(mapHeightField, gbc);
482 
483  final Container p2 = new JPanel(new GridBagLayout());
484  gbc.gridwidth = 1;
485  gbc.weightx = 1.0;
486  gbc.anchor = GridBagConstraints.CENTER;
487  gbc.fill = GridBagConstraints.NONE;
488  p2.add(createPanelCBox(checkboxOutdoor, map.isOutdoor(), "mapOutdoor"), gbc);
489  gbc.gridwidth = GridBagConstraints.REMAINDER;
490  p2.add(createPanelCBox(checkboxFixedReset, map.isFixedReset(), "mapFixedReset"), gbc);
491 
492  gbc.weightx = 2.0;
493  gbc.fill = GridBagConstraints.HORIZONTAL;
494  mapPanel.add(p2, gbc);
495 
496  final JComponent scrollPane = new JScrollPane(mapPanel);
497  scrollPane.setBorder(createTitledBorder("mapMap"));
498  return scrollPane;
499  }
500 
506  @NotNull
507  private static Component createTilePathPanel(@NotNull final Component mapTilePane) {
508  final Container panel = new JPanel(new BorderLayout());
509  panel.add(mapTilePane, BorderLayout.NORTH);
510  return panel;
511  }
512 
516  @ActionMethod
517  public void mapHelp() {
518  new Help(helpParent, "tut_mapattr.html").setVisible(true);
519  }
520 
524  @ActionMethod
525  public void mapOkay() {
526  if (modifyMapProperties()) {
528  }
529  }
530 
534  @ActionMethod
535  public void mapRestore() {
537  }
538 
542  @ActionMethod
543  public void mapCancel() {
545  }
546 
547  @Override
548  public void setValue(@Nullable final Object newValue) {
549  super.setValue(newValue);
550  if (dialog != null && newValue != UNINITIALIZED_VALUE) {
551  dialog.dispose();
552  }
553  }
554 
561  @NotNull
562  private static Border createTitledBorder(@NotNull final String key) {
563  return BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(ActionBuilderUtils.getString(ACTION_BUILDER, key)), GUIConstants.DIALOG_BORDER);
564  }
565 
574  @NotNull
575  private static Component createPanelLine(@NotNull final JTextField textField, final int n, final int defaultValue, @NotNull final String labelKey) {
576  final Container lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT));
577  lineLayout.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, labelKey));
578  textField.setColumns(n);
579  textField.setText(Integer.toString(defaultValue));
580  textField.setToolTipText(ACTION_BUILDER.getString(labelKey + ".shortdescription"));
581  lineLayout.add(textField);
582  return lineLayout;
583  }
584 
592  @NotNull
593  private static Component createPanelCBox(@NotNull final AbstractButton checkBox, final boolean state, @NotNull final String labelKey) {
594  final JPanel panel = new JPanel();
595  panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
596  panel.add(checkBox);
597  checkBox.setText(ActionBuilderUtils.getString(ACTION_BUILDER, labelKey));
598  checkBox.setSelected(state);
599  return panel;
600  }
601 
607  private boolean modifyMapProperties() {
608  // first check if the entries are all okay
609  final int darkness;
610  final int difficulty;
611  final int swapTime;
612  final int resetTimeout;
613  final Size2D mapSize;
614  final int enterX;
615  final int enterY;
616  try {
617  // try to parse everything
618  final int width = parseProperty(mapWidthField.getText(), "Width");
619  final int height = parseProperty(mapHeightField.getText(), "Height");
620  enterX = parseProperty(fieldEnterX.getText(), "Enter X");
621  enterY = parseProperty(fieldEnterY.getText(), "Enter Y");
622  swapTime = parseProperty(fieldSwapTime.getText(), "Swap Time");
623  resetTimeout = parseProperty(fieldResetTimeout.getText(), "Reset Timeout");
624  difficulty = parseProperty(fieldDifficulty.getText(), "Difficulty");
625  if (difficulty < 1) {
626  throw new IllegalArgumentException("Difficulty must be > 0"); // TODO: i18n/l10n
627  }
628  darkness = parseProperty(fieldDarkness.getText(), "Darkness");
629 
630  // Now do some sanity checks:
631  if (width < 1 || height < 1) {
632  ACTION_BUILDER.showMessageDialog(this, "mapErrorIllegalSize");
633  return false;
634  }
635  mapSize = new Size2D(width, height);
636  /*
637  if (fieldDarkness > 1000) {
638  mainControl.showMessage("Illegal Value", "Darkness level must be in range 0-1000." );
639  return false;
640  }*/
641  if (mapName.getText().isEmpty()) {
642  ACTION_BUILDER.showMessageDialog(this, "mapErrorMissingMapName");
643  return false;
644  }
645  } catch (final IllegalArgumentException e) {
646  ACTION_BUILDER.showMessageDialog(this, "mapErrorInvalidEntry", e.getMessage());
647  return false;
648  }
649 
650  // now that all is well, write the new values into the map arch object
651 
652  mapModel.beginTransaction("Map properties"); // TODO: I18N/L10N
653  try {
654  final MapArchObject mapArchObject = mapModel.getMapArchObject();
655  mapArchObject.beginTransaction();
656  try {
657  mapArchObject.setMapSize(mapSize);
658  mapArchObject.setText(mapDescription.getText());
659  mapArchObject.setMapName(mapName.getText());
660  mapArchObject.setBackgroundMusic(mapBackgroundMusic.getText());
661 
662  mapArchObject.setEnterX(enterX);
663  mapArchObject.setEnterY(enterY);
664  mapArchObject.setResetTimeout(resetTimeout);
665  mapArchObject.setSwapTime(swapTime);
666  mapArchObject.setDifficulty(difficulty);
667  mapArchObject.setFixedReset(checkboxFixedReset.isSelected());
668  mapArchObject.setDarkness(darkness);
669  mapArchObject.setOutdoor(checkboxOutdoor.isSelected());
670 
671  mapArchObject.setNoSave(checkboxNoSave.isSelected());
672  mapArchObject.setNoMagic(checkboxNoMagic.isSelected());
673  mapArchObject.setNoPriest(checkboxNoPriest.isSelected());
674  mapArchObject.setNoHarm(checkboxNoHarm.isSelected());
675  mapArchObject.setNoSummon(checkboxNoSummon.isSelected());
676  mapArchObject.setFixedLogin(checkboxNoFixedLogin.isSelected());
677  mapArchObject.setPermDeath(checkboxPermDeath.isSelected());
678  mapArchObject.setUltraDeath(checkboxUltraDeath.isSelected());
679  mapArchObject.setUltimateDeath(checkboxUltimateDeath.isSelected());
680  mapArchObject.setPvp(checkboxPvp.isSelected());
681 
682  mapTilePane.modifyMapProperties();
683  } finally {
684  mapArchObject.endTransaction();
685  }
686  } finally {
687  mapModel.endTransaction();
688  }
689 
690  return true;
691  }
692 
701  private static int parseProperty(@NotNull final String s, @NotNull final String label) {
702  if (s.isEmpty()) {
703  return 0; // empty string is interpreted as zero
704  }
705  final int r = Integer.parseInt(s); // trying to parse
706  // negative values are not allowed
707  if (r < 0 && !label.equals("Darkness")) {
708  throw new IllegalArgumentException(label + ": '" + s + "' is negative.");
709  }
710 
711  return r; // everything okay
712  }
713 
717  private void restoreMapProperties() {
718  final MapArchObject map = mapModel.getMapArchObject();
719 
720  mapDescription.setText(map.getText());
721  mapName.setText(map.getMapName());
722  mapBackgroundMusic.setText(map.getBackgroundMusic());
723  mapWidthField.setText(Integer.toString(map.getMapSize().getWidth()));
724  mapHeightField.setText(Integer.toString(map.getMapSize().getHeight()));
725  fieldEnterX.setText(Integer.toString(map.getEnterX()));
726  fieldEnterY.setText(Integer.toString(map.getEnterY()));
727  fieldSwapTime.setText(Integer.toString(map.getSwapTime()));
728  fieldResetTimeout.setText(Integer.toString(map.getResetTimeout()));
729  fieldDarkness.setText(Integer.toString(map.getDarkness()));
730  fieldDifficulty.setText(Integer.toString(map.getDifficulty()));
731 
732  checkboxOutdoor.setSelected(map.isOutdoor());
733  checkboxFixedReset.setSelected(map.isFixedReset());
734 
735  checkboxNoSave.setSelected(map.isNoSave());
736  checkboxNoMagic.setSelected(map.isNoMagic());
737  checkboxNoPriest.setSelected(map.isNoPriest());
738  checkboxNoHarm.setSelected(map.isNoHarm());
739  checkboxNoSummon.setSelected(map.isNoSummon());
740  checkboxNoFixedLogin.setSelected(map.isFixedLogin());
741  checkboxPermDeath.setSelected(map.isPermDeath());
742  checkboxUltraDeath.setSelected(map.isUltraDeath());
743  checkboxUltimateDeath.setSelected(map.isUltimateDeath());
744  checkboxPvp.setSelected(map.isPvp());
745 
746  mapTilePane.restoreMapProperties();
747  }
748 
753  public void showDialog(@NotNull final Component parentComponent) {
754  final String title = ACTION_BUILDER.format("mapTitle", mapModel.getMapArchObject().getMapName(), mapModel.getMapArchObject().getMapName());
755  final JDialog window = createDialog(parentComponent, title);
756  dialog = window;
757  window.getRootPane().setDefaultButton(okButton);
758  window.setResizable(true);
759  window.setModal(false);
760  window.setVisible(true);
761  if (!mapTilePaneEnabled) {
762  ACTION_BUILDER.showOnetimeMessageDialog(window, WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane");
763  }
764  }
765 
766 }
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapTilePane
final AbstractMapTilePane< GameObject, MapArchObject, Archetype > mapTilePane
The AbstractMapTilePane.
Definition: MapPropertiesDialog.java:298
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isUltimateDeath
boolean isUltimateDeath()
Returns the ultimate death attribute.
Definition: MapArchObject.java:351
net.sf.gridarta.utils.Size2D.getWidth
int getWidth()
Returns the width of the area.
Definition: Size2D.java:96
net.sf.gridarta.model.mapmanager
Definition: AbstractMapManager.java:20
net.sf.gridarta.model.mapmodel.MapModel
A MapModel reflects the data of a map.
Definition: MapModel.java:75
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getText
String getText()
Definition: AbstractMapArchObject.java:576
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isPermDeath
boolean isPermDeath()
Returns the permanent death attribute.
Definition: MapArchObject.java:309
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setPvp
void setPvp(final boolean pvp)
Sets the pvp attribute.
Definition: MapArchObject.java:380
net.sf.gridarta.model.mapmanager.MapManager
A MapManager manages all opened maps.
Definition: MapManager.java:37
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setBackgroundMusic
void setBackgroundMusic(@NotNull final String backgroundMusic)
Sets the name of the background music.
Definition: MapArchObject.java:465
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxOutdoor
final AbstractButton checkboxOutdoor
The "outdoor" attribute.
Definition: MapPropertiesDialog.java:158
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapRestore
void mapRestore()
Action method for restore.
Definition: MapPropertiesDialog.java:535
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.beginTransaction
void beginTransaction()
Definition: AbstractMapArchObject.java:496
net.sf.gridarta.var.daimonin.model.gameobject
Handles the Daimonin variants of GameObjects and Archetypes.
Definition: DefaultGameObjectFactory.java:20
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapCancel
void mapCancel()
Action method for cancel.
Definition: MapPropertiesDialog.java:543
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.fieldEnterY
final JTextField fieldEnterY
The enter y coordinate.
Definition: MapPropertiesDialog.java:172
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.gui.utils.GUIConstants
Defines common UI constants used in different dialogs.
Definition: GUIConstants.java:33
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isNoPriest
boolean isNoPriest()
Returns the no priest attribute.
Definition: MapArchObject.java:225
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxFixedReset
final AbstractButton checkboxFixedReset
The fixed reset attribute.
Definition: MapPropertiesDialog.java:207
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxNoHarm
final AbstractButton checkboxNoHarm
The no harm attribute.
Definition: MapPropertiesDialog.java:242
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapName
final JTextField mapName
The name of the game object.
Definition: MapPropertiesDialog.java:130
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.fieldResetTimeout
final JTextField fieldResetTimeout
The reset timeout.
Definition: MapPropertiesDialog.java:186
net.sf
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createPanelCBox
static Component createPanelCBox(@NotNull final AbstractButton checkBox, final boolean state, @NotNull final String labelKey)
Creates a checkbox-line, similar to createPanelLine.
Definition: MapPropertiesDialog.java:593
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.cancelButton
final JButton cancelButton
JButton for cancel.
Definition: MapPropertiesDialog.java:291
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getEnterY
int getEnterY()
Definition: AbstractMapArchObject.java:254
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.isFixedReset
boolean isFixedReset()
Definition: AbstractMapArchObject.java:335
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getSwapTime
int getSwapTime()
Definition: AbstractMapArchObject.java:305
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getMapName
String getMapName()
Definition: AbstractMapArchObject.java:223
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.endTransaction
void endTransaction()
Definition: AbstractMapArchObject.java:511
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setMapName
void setMapName(@NotNull final String name)
Definition: AbstractMapArchObject.java:228
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createOptionsPanel
Component createOptionsPanel(@NotNull final MapArchObject map)
Creates the options panel.
Definition: MapPropertiesDialog.java:413
net.sf.gridarta.var.daimonin.model.archetype.Archetype
Implements Daimonin archetypes.
Definition: Archetype.java:30
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setUltraDeath
void setUltraDeath(final boolean ultraDeath)
Sets the ultra death attribute.
Definition: MapArchObject.java:338
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.getBackgroundMusic
String getBackgroundMusic()
Returns the name of the background music.
Definition: MapArchObject.java:457
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapWidthField
final JTextField mapWidthField
The width in squares.
Definition: MapPropertiesDialog.java:144
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapHeightField
final JTextField mapHeightField
The height in squares.
Definition: MapPropertiesDialog.java:151
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.dialog
Window dialog
The Window that represents the dialog.
Definition: MapPropertiesDialog.java:116
net.sf.gridarta.var
net.sf.gridarta.utils.ActionBuilderUtils.newLabel
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
Definition: ActionBuilderUtils.java:117
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.parseProperty
static int parseProperty(@NotNull final String s, @NotNull final String label)
This is a simple string-to-int parser that throws IllegalArgumentExceptions with appropriate error me...
Definition: MapPropertiesDialog.java:701
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.ACTION_BUILDER
static final ActionBuilder ACTION_BUILDER
Action Builder.
Definition: MapPropertiesDialog.java:89
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setFixedReset
void setFixedReset(final boolean fixedReset)
Definition: AbstractMapArchObject.java:340
net.sf.gridarta.gui.dialog.help.Help
Implements the Help Window is a separate frame with html content.
Definition: Help.java:42
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setSwapTime
void setSwapTime(final int swapTime)
Definition: AbstractMapArchObject.java:310
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.restoreMapProperties
void restoreMapProperties()
Resets all map properties to the saved values in the map arch object.
Definition: MapPropertiesDialog.java:717
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isFixedLogin
boolean isFixedLogin()
Returns the fixed login attribute.
Definition: MapArchObject.java:288
net.sf.gridarta.gui
Graphical User Interface of Gridarta.
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setMapSize
void setMapSize(@NotNull final Size2D mapSize)
Definition: AbstractMapArchObject.java:209
net.sf.gridarta.var.daimonin.model
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setNoMagic
void setNoMagic(final boolean noMagic)
Sets the no magic attribute.
Definition: MapArchObject.java:212
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getEnterX
int getEnterX()
Definition: AbstractMapArchObject.java:239
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setNoSave
void setNoSave(final boolean noSave)
Sets the no save attribute.
Definition: MapArchObject.java:191
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setNoHarm
void setNoHarm(final boolean noHarm)
Sets the no harm attribute.
Definition: MapArchObject.java:275
net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane
A Panel for managing the tiling of maps.
Definition: AbstractMapTilePane.java:65
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setDifficulty
void setDifficulty(final int difficulty)
Definition: MapArchObject.java:475
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getDifficulty
int getDifficulty()
Definition: AbstractMapArchObject.java:320
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createMainPanel
Component createMainPanel(@NotNull final MapArchObject map)
Creates the main panel.
Definition: MapPropertiesDialog.java:362
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setPermDeath
void setPermDeath(final boolean permDeath)
Sets the permanent death attribute.
Definition: MapArchObject.java:317
net
net.sf.gridarta.utils.Size2D.getHeight
int getHeight()
Returns the height of the area.
Definition: Size2D.java:104
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setResetTimeout
void setResetTimeout(final int resetTimeout)
Definition: AbstractMapArchObject.java:295
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxUltraDeath
final AbstractButton checkboxUltraDeath
The ultra death attribute.
Definition: MapPropertiesDialog.java:263
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setText
void setText(final String text)
Definition: AbstractMapArchObject.java:564
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxUltimateDeath
final AbstractButton checkboxUltimateDeath
The ultimate death attribute.
Definition: MapPropertiesDialog.java:270
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setNoSummon
void setNoSummon(final boolean noSummon)
Sets the no summon attribute.
Definition: MapArchObject.java:254
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createTilePathPanel
static Component createTilePathPanel(@NotNull final Component mapTilePane)
Creates the tile path panel.
Definition: MapPropertiesDialog.java:507
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.fieldEnterX
final JTextField fieldEnterX
The enter x coordinate.
Definition: MapPropertiesDialog.java:165
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setEnterX
void setEnterX(final int enterX)
Definition: AbstractMapArchObject.java:244
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isUltraDeath
boolean isUltraDeath()
Returns the ultra death attribute.
Definition: MapArchObject.java:330
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapModel
final MapModel< GameObject, MapArchObject, Archetype > mapModel
The MapModel this dialog shows.
Definition: MapPropertiesDialog.java:109
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getMapSize
Size2D getMapSize()
Definition: AbstractMapArchObject.java:204
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.MapPropertiesDialog
MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager< GameObject, MapArchObject, Archetype > mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel< GameObject, MapArchObject, Archetype > mapModel, @NotNull final FileFilter mapFileFilter)
Creates a map-options dialog.
Definition: MapPropertiesDialog.java:314
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getResetTimeout
int getResetTimeout()
Definition: AbstractMapArchObject.java:290
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.helpParent
final Frame helpParent
The parent frame for help windows.
Definition: MapPropertiesDialog.java:96
net.sf.gridarta.gui.map.maptilepane.IsoMapTilePane
A Panel for managing the tiling of maps.
Definition: IsoMapTilePane.java:38
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setNoPriest
void setNoPriest(final boolean noPriest)
Sets the no priest attribute.
Definition: MapArchObject.java:233
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isNoMagic
boolean isNoMagic()
Returns the no magic attribute.
Definition: MapArchObject.java:204
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isPvp
boolean isPvp()
Returns the pvp attribute.
Definition: MapArchObject.java:372
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.fieldDifficulty
final JTextField fieldDifficulty
The map difficulty.
Definition: MapPropertiesDialog.java:193
net.sf.gridarta.gui.dialog.help
The online help system for the Gridarta editor.
Definition: Help.java:20
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setEnterY
void setEnterY(final int enterY)
Definition: AbstractMapArchObject.java:259
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.getDarkness
int getDarkness()
Definition: AbstractMapArchObject.java:350
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapTilePaneEnabled
final boolean mapTilePaneEnabled
Whether the map tile pane was enabled.
Definition: MapPropertiesDialog.java:304
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.projectSettings
final ProjectSettings projectSettings
The project settings instance.
Definition: MapPropertiesDialog.java:102
net.sf.gridarta.utils.ActionBuilderUtils.getString
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Definition: ActionBuilderUtils.java:71
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.serialVersionUID
static final long serialVersionUID
Serial version UID.
Definition: MapPropertiesDialog.java:83
net.sf.gridarta.gui.dialog
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isNoSave
boolean isNoSave()
Returns the no save attribute.
Definition: MapArchObject.java:183
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.fieldDarkness
final JTextField fieldDarkness
The map darkness.
Definition: MapPropertiesDialog.java:200
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.okButton
final JButton okButton
JButton for ok.
Definition: MapPropertiesDialog.java:284
net.sf.gridarta.var.daimonin.model.gameobject.GameObject
Handles the Daimonin GameObjects.
Definition: GameObject.java:42
net.sf.gridarta.model.settings.ProjectSettings
Settings that apply to a project.
Definition: ProjectSettings.java:29
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createMapDataPanel
Component createMapDataPanel(@NotNull final net.sf.gridarta.model.maparchobject.MapArchObject< MapArchObject > map)
Creates the map data panel.
Definition: MapPropertiesDialog.java:397
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isNoHarm
boolean isNoHarm()
Returns the no harm attribute.
Definition: MapArchObject.java:267
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createTitledBorder
static Border createTitledBorder(@NotNull final String key)
Creates a border to be used in dialogs to frame dialog component groups.
Definition: MapPropertiesDialog.java:562
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxNoPriest
final AbstractButton checkboxNoPriest
The no priest attribute.
Definition: MapPropertiesDialog.java:228
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapOkay
void mapOkay()
Action method for okay.
Definition: MapPropertiesDialog.java:525
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.showDialog
void showDialog(@NotNull final Component parentComponent)
Creates and displays the map properties dialog.
Definition: MapPropertiesDialog.java:753
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxPermDeath
final AbstractButton checkboxPermDeath
The perm death attribute.
Definition: MapPropertiesDialog.java:256
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.setValue
void setValue(@Nullable final Object newValue)
Definition: MapPropertiesDialog.java:548
net.sf.gridarta.model
net.sf.gridarta.gui.utils.TextComponentUtils.setAutoSelectOnFocus
static void setAutoSelectOnFocus(@NotNull final JTextComponent textComponent)
Selects all text of a JTextComponent when the component gains the focus.
Definition: TextComponentUtils.java:47
net.sf.gridarta.var.daimonin.model.archetype
Definition: Archetype.java:20
net.sf.gridarta.var.daimonin
Main package of Gridarta4Daimonin, contains all classes specific to the Daimonin version of the Grida...
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxNoFixedLogin
final AbstractButton checkboxNoFixedLogin
The no fixed login attribute.
Definition: MapPropertiesDialog.java:249
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createPanelLine
static Component createPanelLine(@NotNull final JTextField textField, final int n, final int defaultValue, @NotNull final String labelKey)
Creates an "attribute"-line (format: <label> <textfield>).
Definition: MapPropertiesDialog.java:575
net.sf.gridarta.gui.map
Base classes for rendering maps.
Definition: AbstractPerMapDialogManager.java:20
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxNoSave
final AbstractButton checkboxNoSave
The no save attribute.
Definition: MapPropertiesDialog.java:214
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject
MapArchObject contains the specific meta data about a map that is stored in the map-arch,...
Definition: MapArchObject.java:39
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setDarkness
void setDarkness(final int darkness)
Definition: AbstractMapArchObject.java:355
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setFixedLogin
void setFixedLogin(final boolean fixedLogin)
Sets the fixed login attribute.
Definition: MapArchObject.java:296
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.isOutdoor
boolean isOutdoor()
Definition: AbstractMapArchObject.java:275
net.sf.gridarta.utils.ActionBuilderUtils
Utility class for ActionBuilder related functions.
Definition: ActionBuilderUtils.java:31
net.sf.gridarta.var.daimonin.model.maparchobject
Definition: DefaultMapArchObjectFactory.java:20
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapBackgroundMusic
final JTextField mapBackgroundMusic
The name of the sound file.
Definition: MapPropertiesDialog.java:137
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxPvp
final AbstractButton checkboxPvp
The pvp attribute.
Definition: MapPropertiesDialog.java:277
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxNoSummon
final AbstractButton checkboxNoSummon
The no summon attribute.
Definition: MapPropertiesDialog.java:235
net.sf.gridarta.model.maparchobject.AbstractMapArchObject.setOutdoor
void setOutdoor(final boolean outdoor)
Definition: AbstractMapArchObject.java:280
net.sf.gridarta.gui.utils
Definition: AnimationComponent.java:20
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.modifyMapProperties
boolean modifyMapProperties()
Checks the given values and modifies the current map.
Definition: MapPropertiesDialog.java:607
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.checkboxNoMagic
final AbstractButton checkboxNoMagic
The no magic attribute.
Definition: MapPropertiesDialog.java:221
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapHelp
void mapHelp()
Action method for help.
Definition: MapPropertiesDialog.java:517
net.sf.gridarta.model.settings.ProjectSettings.getMediaDirectory
File getMediaDirectory()
Returns the media directory.
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog
A dialog to change the properties of a map, like several flags and settings about the environment and...
Definition: MapPropertiesDialog.java:78
net.sf.gridarta.gui.utils.TextComponentUtils
Utility class for JTextComponent related functions.
Definition: TextComponentUtils.java:34
net.sf.gridarta.utils.Size2D
The class Size2D represents a 2d rectangular area.
Definition: Size2D.java:30
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.fieldSwapTime
final JTextField fieldSwapTime
The swap time.
Definition: MapPropertiesDialog.java:179
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.setUltimateDeath
void setUltimateDeath(final boolean ultimateDeath)
Sets the ultimate death attribute.
Definition: MapArchObject.java:359
net.sf.gridarta.model.settings
Definition: AbstractDefaultProjectSettings.java:20
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.createMapPanel
Component createMapPanel(@NotNull final MapArchObject map)
Creates the map panel.
Definition: MapPropertiesDialog.java:445
net.sf.gridarta.gui.map.maptilepane
Definition: AbstractMapTilePane.java:20
net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject.isNoSummon
boolean isNoSummon()
Returns the no summon attribute.
Definition: MapArchObject.java:246
net.sf.gridarta.gui.utils.GUIConstants.DIALOG_BORDER
Border DIALOG_BORDER
The Border object to be used when creating dialogs.
Definition: GUIConstants.java:38
net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.MapPropertiesDialog.mapDescription
final JTextArea mapDescription
The message text.
Definition: MapPropertiesDialog.java:123