Gridarta Editor
ReplaceDialog.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.gui.dialog.replace;
21 
22 import java.awt.Component;
23 import java.awt.Container;
24 import java.awt.FlowLayout;
25 import java.awt.event.ItemEvent;
26 import java.awt.event.ItemListener;
27 import java.util.ArrayList;
28 import java.util.List;
29 import javax.swing.BorderFactory;
30 import javax.swing.Box;
31 import javax.swing.BoxLayout;
32 import javax.swing.Icon;
33 import javax.swing.JButton;
34 import javax.swing.JComboBox;
35 import javax.swing.JDialog;
36 import javax.swing.JLabel;
37 import javax.swing.JOptionPane;
38 import javax.swing.JPanel;
39 import javax.swing.JTextField;
40 import javax.swing.WindowConstants;
41 import javax.swing.text.JTextComponent;
57 import net.sf.japi.swing.action.ActionBuilder;
58 import net.sf.japi.swing.action.ActionBuilderFactory;
59 import net.sf.japi.swing.action.ActionMethod;
60 import org.jetbrains.annotations.NotNull;
61 import org.jetbrains.annotations.Nullable;
62 
68 public class ReplaceDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JOptionPane {
69 
73  private static final long serialVersionUID = 1L;
74 
78  @NotNull
79  private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta");
80 
85  private static final int REPLACE_WITH_OBJECT_CHOOSER = 0;
86 
90  private static final int REPLACE_WITH_COPY_BUFFER = 1;
91 
95  private static final int REPLACE_WITH_PICKMAP = 2;
96 
100  private static final int REPLACE_WITH_NOTHING = 3;
101 
105  private static final int REPLACE_ON_MAP = 0;
106 
110  private static final int REPLACE_ON_SELECTION = 1;
111 
115  @NotNull
117 
121  @NotNull
122  private final JDialog dialog;
123 
127  @NotNull
128  private final Component parent;
129 
133  @NotNull
135 
139  @NotNull
141 
145  @NotNull
147 
151  private boolean isBuilt;
152 
156  @NotNull
158 
162  @Nullable
164 
165  @NotNull
166  private List<G> replaceCopyBuffer; // objects in CopyBuffer
167 
168  @NotNull
169  private List<? extends BaseObject<G, A, R, ?>> replacePickmap; // selected objects in pickmap or all if none is selected
170 
171  @NotNull
172  private JLabel rfHeading;
173 
174  @Nullable
175  private JLabel rfArchName;
176 
177  @NotNull
178  private JLabel iconLabel;
179 
180  @NotNull
181  private JLabel colonLabel;
182 
183  @NotNull
184  private JComboBox<String> replaceCriteria;
185 
186  @NotNull
187  private JComboBox<String> replaceWithBox;
188 
189  @NotNull
190  private JComboBox<String> replaceEntireBox;
191 
192  @NotNull
193  private JTextComponent replaceInput1;
194 
198  @NotNull
199  private JTextComponent replaceDensityInput;
200 
202 
206  @NotNull
208 
209  @Override
210  public void pickmapActiveChanged(final boolean pickmapActive) {
211  // ignore
212  }
213 
214  @Override
215  public void selectionChanged(@Nullable final BaseObject<G, A, R, ?> gameObject) {
216  updateArchSelection(gameObject, false);
217  }
218 
219  };
220 
224  @NotNull
226 
227  @Override
228  public void facesReloaded() {
230  }
231 
232  };
233 
243  public ReplaceDialog(@NotNull final Component parent, @NotNull final CopyBuffer<G, A, R> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) {
244  this.insertionModeSet = insertionModeSet;
245  dialog = createDialog(parent, ActionBuilderUtils.getString(ACTION_BUILDER, "replaceTitle"));
246  dialog.setModal(false);
247  dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
248  this.parent = parent;
249  this.copyBuffer = copyBuffer;
250  this.objectChooser = objectChooser;
251  this.faceObjectProviders = faceObjectProviders;
254  }
255 
260  public void display(@NotNull final MapView<G, A, R> mapView) {
261  replaceArch = objectChooser.getCursorSelection(); // highlighted arch
262  replacePickmap = objectChooser.getSelections(); // selected arches
264 
265  if (isBuilt) {
266  // just set fields and show
267  rfHeading.setText("\"" + mapView.getMapControl().getMapModel().getMapArchObject().getMapName() + "\":");
268  replaceInput1.setText("");
269 
270  this.mapView = mapView;
271  if (replaceArch == null) {
272  replaceWithBox.setSelectedIndex(REPLACE_WITH_COPY_BUFFER);
273  iconLabel.setIcon(null);
274  rfArchName.setText("");
275  colonLabel.setText("");
276  } else {
279  rfArchName.setText(" " + replaceArch.getBestName());
280  colonLabel.setText(":");
281  }
282 
284 
285  replaceDensityInput.setText("100");
286 
287  dialog.pack();
288  dialog.toFront();
289  } else {
290  this.mapView = mapView;
291  final JPanel mainPanel = new JPanel();
292  mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
293  mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5));
294 
295  // first line: heading
296  final Container line1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
297  line1.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceOn"));
298  line1.add(Box.createVerticalStrut(3));
299  replaceEntireBox = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOnMap"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOnSelection") });
300  replaceEntireBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOn.shortdescription"));
302  line1.add(replaceEntireBox);
303  line1.add(Box.createVerticalStrut(3));
304  rfHeading = new JLabel("\"" + mapView.getMapControl().getMapModel().getMapArchObject().getMapName() + "\":");
305  line1.add(rfHeading);
306  mainPanel.add(line1);
307 
308  // second line: replace what?
309  final Container line2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
310  line2.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceDelete"));
311  line2.add(Box.createVerticalStrut(5));
312 
313  replaceCriteria = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceArchetype"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceName") });
314  replaceCriteria.setSelectedIndex(0);
315  replaceCriteria.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceDelete.shortdescription"));
316  line2.add(replaceCriteria);
317  line2.add(Box.createVerticalStrut(5));
318 
319  replaceInput1 = new JTextField(20);
320  replaceInput1.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceInput1.shortdescription"));
321  line2.add(replaceInput1);
322  mainPanel.add(line2);
323 
324  // third line: replace by?
325  final Container line3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
326  line3.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceBy"));
327  line3.add(Box.createVerticalStrut(5));
328  replaceWithBox = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByObject"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByCopyBuffer"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByPickmap"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceByNothing") });
329  replaceWithBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceBy.shortdescription"));
330  //noinspection VariableNotUsedInsideIf
332  replaceWithBox.addItemListener(new ReplaceWithBoxItemListener());
333  lastSelectedIndex = replaceWithBox.getSelectedIndex();
334  line3.add(replaceWithBox);
335 
336  iconLabel = new JLabel();
337  if (replaceArch == null) {
338  colonLabel = new JLabel("");
339  rfArchName = new JLabel("");
340  } else {
341  colonLabel = new JLabel(":");
343  rfArchName = new JLabel(" " + replaceArch.getBestName());
344  }
345  line3.add(colonLabel);
346  line3.add(Box.createVerticalStrut(5));
347  line3.add(iconLabel);
348  line3.add(rfArchName);
349  mainPanel.add(line3);
350 
351  // fourth line: replace density
352  final Container line4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
353  line4.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceDensity"));
354  line4.add(Box.createVerticalStrut(5));
355  replaceDensityInput = new JTextField(5);
356  replaceDensityInput.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceDensity.shortdescription"));
357  line4.add(replaceDensityInput);
358  replaceDensityInput.setText("100");
359  mainPanel.add(line4);
360 
361  final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "replaceOk", this));
362  final JButton applyButton = new JButton(ACTION_BUILDER.createAction(false, "replaceApply", this));
363  final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "replaceCancel", this));
364 
365  setMessage(mainPanel);
366  setOptions(new Object[] { okButton, applyButton, cancelButton });
367  dialog.getRootPane().setDefaultButton(okButton);
368  dialog.pack();
369  dialog.setLocationRelativeTo(parent);
370  isBuilt = true;
371  }
372  dialog.setVisible(true);
373  }
374 
382  private void updateArchSelection(@Nullable final BaseObject<G, A, R, ?> newArch, final boolean alwaysPack) {
383  if (isShowing() && replaceWithBox.getSelectedIndex() == REPLACE_WITH_OBJECT_CHOOSER) {
384  replaceArch = newArch;
385  if (newArch == null) {
386  iconLabel.setIcon(null);
387  rfArchName.setText("");
388  colonLabel.setText("");
389  } else {
390  final Icon oldIcon = iconLabel.getIcon();
391 
392  iconLabel.setIcon(faceObjectProviders.getFace(newArch));
393  rfArchName.setText(" " + newArch.getBestName());
394  colonLabel.setText(":");
395 
396  // pack frame only if height of icon changed
397  if (alwaysPack || (oldIcon == null && iconLabel.getIcon() != null) || (oldIcon != null && iconLabel.getIcon() == null) || (oldIcon != iconLabel.getIcon() && oldIcon != null && oldIcon.getIconHeight() != iconLabel.getIcon().getIconHeight())) {
398  dialog.pack();
399  }
400  }
401  }
402  }
403 
409  @NotNull
410  private static <T> List<T> newList(@NotNull final T element) {
411  final List<T> list = new ArrayList<>(1);
412  list.add(element);
413  return list;
414  }
415 
419  private class ReplaceWithBoxItemListener implements ItemListener {
420 
421  @Override
422  public void itemStateChanged(@NotNull final ItemEvent e) {
423  final int selectedIndex = replaceWithBox.getSelectedIndex();
424  if (e.getStateChange() == ItemEvent.SELECTED && lastSelectedIndex != selectedIndex) {
425  final int size;
426  switch (selectedIndex) {
428  replaceArch = objectChooser.getSelection(); // selected arch
430  break;
431 
434  iconLabel.setIcon(null);
435  size = replaceCopyBuffer.size();
436  rfArchName.setText(String.valueOf(size));
437  colonLabel.setText(":");
438  dialog.pack();
439  break;
440 
442  replacePickmap = objectChooser.getSelections(); // selected arches
443  iconLabel.setIcon(null);
444  size = replacePickmap.size();
445  rfArchName.setText(String.valueOf(size));
446  colonLabel.setText(":");
447  dialog.pack();
448  break;
449 
451  iconLabel.setIcon(null);
452  rfArchName.setText("");
453  colonLabel.setText("");
454  dialog.pack();
455  break;
456  }
457  lastSelectedIndex = selectedIndex;
458  }
459  }
460 
461  }
462 
466  @ActionMethod
467  public void replaceOk() {
468  if (doReplace()) {
469  dialog.setVisible(false);
470  }
471  }
472 
476  @ActionMethod
477  public void replaceApply() {
478  doReplace();
479  }
480 
485  private boolean doReplace() {
486  final String matchString = replaceInput1.getText().trim();
487  final boolean deleteOnly = replaceWithBox.getSelectedIndex() == REPLACE_WITH_NOTHING;
488  final boolean entireMap = replaceEntireBox.getSelectedIndex() == REPLACE_ON_MAP;
489 
490  if (!entireMap && mapView.getMapGrid().getSelectedRec() == null) {
491  // user selected "replace highlighted" but nothing is highlighted
492  ACTION_BUILDER.showMessageDialog(this, "replaceMapNoSelection", mapView.getMapControl().getMapModel().getMapArchObject().getMapName());
493  return false;
494  }
495 
496  final MatchCriteria<G, A, R> matchCriteria;
497  if (replaceCriteria.getSelectedIndex() == 0) {
498  matchCriteria = new ArchetypeNameMatchCriteria<>(matchString);
499  } else if (replaceCriteria.getSelectedIndex() == 1) {
500  matchCriteria = new ObjectNameMatchCriteria<>(matchString);
501  } else {
502  return false;
503  }
504 
505  final int replaceDensity;
506  try {
507  replaceDensity = Integer.parseInt(replaceDensityInput.getText());
508  } catch (final NumberFormatException ignored) {
509  ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity");
510  return false;
511  }
512  if (replaceDensity < 1 || replaceDensity > 100) {
513  ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity");
514  return false;
515  }
516 
517  @Nullable final List<? extends BaseObject<G, A, R, ?>> replaceList;
518  switch (lastSelectedIndex) {
520  replaceList = replaceArch == null ? null : newList(replaceArch);
521  break;
522 
524  replaceList = replaceCopyBuffer;
525  break;
526 
528  replaceList = replacePickmap;
529  break;
530 
531  default: // REPLACE_WITH_NOTHING
532  replaceList = null;
533  break;
534  }
535  final int replaceCount = ReplaceUtils.replace(matchCriteria, entireMap, deleteOnly, replaceDensity, mapView, insertionModeSet, replaceList);
536  if (replaceCount <= 0) {
537  ACTION_BUILDER.showMessageDialog(this, "replacedZero");
538  return false;
539  }
540 
541  if (replaceCount == 1) {
542  ACTION_BUILDER.showMessageDialog(this, "replacedOne");
543  } else {
544  ACTION_BUILDER.showMessageDialog(this, "replacedMany", replaceCount);
545  }
546  return true;
547  }
548 
552  @ActionMethod
553  public void replaceCancel() {
554  dialog.setVisible(false);
555  }
556 
561  public void dispose(@NotNull final MapView<G, A, R> mapView) {
562  if (mapView == this.mapView) {
563  dialog.setVisible(false);
564  }
565  }
566 
567 }
net.sf.gridarta.gui.dialog.replace.ReplaceUtils.replace
static< G extends GameObject< G, A, R > A extends R extends Archetype< G, A, R > int replace(@NotNull final MatchCriteria< G, A, R > matchCriteria, final boolean entireMap, final boolean deleteOnly, final int replaceDensity, @NotNull final MapView< G, A, R > mapView, @NotNull final InsertionModeSet< G, A, R > insertionModeSet, @Nullable final List<? extends BaseObject< G, A, R, ?>> replaceList)
Definition: ReplaceUtils.java:62
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.serialVersionUID
static final long serialVersionUID
Serial Version UID.
Definition: ReplaceDialog.java:73
net.sf.gridarta.gui.panel
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.colonLabel
JLabel colonLabel
Definition: ReplaceDialog.java:181
net.sf.gridarta.gui.map.mapview.MapView.getMapGrid
MapGrid getMapGrid()
Returns the MapGrid of this view.
net.sf.gridarta.model.mapmodel.MapModel.getMapArchObject
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
net.sf.gridarta.model.mapmodel.InsertionModeSet
A set of InsertionModes.
Definition: InsertionModeSet.java:33
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceCancel
void replaceCancel()
Action method for Cancel button.
Definition: ReplaceDialog.java:553
net.sf.gridarta.gui.copybuffer
Definition: CopyBuffer.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_ON_MAP
static final int REPLACE_ON_MAP
Index for replaceEntireBox: replace map.
Definition: ReplaceDialog.java:105
net.sf.gridarta.model.select.MatchCriteria
Criteria for game object matchers.
Definition: MatchCriteria.java:31
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_COPY_BUFFER
static final int REPLACE_WITH_COPY_BUFFER
Index for replaceWithBox: replace with copy buffer contents.
Definition: ReplaceDialog.java:90
net.sf.gridarta.gui.map.mapview.MapView.getMapControl
MapControl< G, A, R > getMapControl()
Return the controller of this view.
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.objectChooser
final ObjectChooser< G, A, R > objectChooser
The object chooser to use.
Definition: ReplaceDialog.java:140
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.ACTION_BUILDER
static final ActionBuilder ACTION_BUILDER
Action Builder.
Definition: ReplaceDialog.java:79
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.addObjectChooserListener
void addObjectChooserListener(@NotNull ObjectChooserListener< G, A, R > listener)
Adds a listener to be notified.
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.doReplace
boolean doReplace()
Executes one replace operation.
Definition: ReplaceDialog.java:485
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getCursorSelection
BaseObject< G, A, R, ?> getCursorSelection()
Returns the selected archetype (if the archetype chooser is active) or the game object selected by th...
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replacePickmap
List<? extends BaseObject< G, A, R, ?> > replacePickmap
Definition: ReplaceDialog.java:169
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_ON_SELECTION
static final int REPLACE_ON_SELECTION
Index for replaceEntireBox: replace selection.
Definition: ReplaceDialog.java:110
net.sf
net.sf.gridarta.model.select.ArchetypeNameMatchCriteria
A MatchCriteria that matches by archetype name.
Definition: ArchetypeNameMatchCriteria.java:33
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.ReplaceWithBoxItemListener.itemStateChanged
void itemStateChanged(@NotNull final ItemEvent e)
Definition: ReplaceDialog.java:422
net.sf.gridarta.model.mapgrid.MapGrid.getSelectedRec
Rectangle getSelectedRec()
Returns the smallest rectangle containing selection.
Definition: MapGrid.java:514
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.isBuilt
boolean isBuilt
Whether this replace dialog has been displayed.
Definition: ReplaceDialog.java:151
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.ReplaceDialog
ReplaceDialog(@NotNull final Component parent, @NotNull final CopyBuffer< G, A, R > copyBuffer, @NotNull final ObjectChooser< G, A, R > objectChooser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet< G, A, R > insertionModeSet)
Creates a new instance.
Definition: ReplaceDialog.java:243
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.objectChooserListener
final ObjectChooserListener< G, A, R > objectChooserListener
The ObjectChooserListener for tracking the selection.
Definition: ReplaceDialog.java:207
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_PICKMAP
static final int REPLACE_WITH_PICKMAP
Index for replaceWithBox: replace with pickmap contents.
Definition: ReplaceDialog.java:95
net.sf.gridarta.model.face.FaceObjectProviders
Provider for faces of GameObjects and Archetypes.
Definition: FaceObjectProviders.java:46
net.sf.gridarta.model.gameobject.GameObject
Reflects a game object (object on a map).
Definition: GameObject.java:36
net.sf.gridarta.model.baseobject.BaseObject.getBestName
String getBestName()
Returns the name which is best appropriate to describe this GameObject.
net.sf.gridarta.model.select
Definition: ArchetypeNameMatchCriteria.java:20
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.gui.dialog.replace.ReplaceDialog.replaceEntireBox
JComboBox< String > replaceEntireBox
Definition: ReplaceDialog.java:190
net.sf.gridarta.gui.copybuffer.CopyBuffer.getAllGameObjects
List< G > getAllGameObjects()
Returns all game objects.
Definition: CopyBuffer.java:263
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.faceObjectProvidersListener
final FaceObjectProvidersListener faceObjectProvidersListener
The FaceObjectProvidersListener for detecting reloaded faces.
Definition: ReplaceDialog.java:225
net.sf.gridarta.model.face.FaceObjectProviders.addFaceObjectProvidersListener
void addFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener)
Adds a FaceObjectProvidersListener to be notified about changes.
Definition: FaceObjectProviders.java:197
net.sf.gridarta.gui
Graphical User Interface of Gridarta.
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.iconLabel
JLabel iconLabel
Definition: ReplaceDialog.java:178
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_NOTHING
static final int REPLACE_WITH_NOTHING
Index for replaceWithBox: delete matching game objects.
Definition: ReplaceDialog.java:100
net.sf.gridarta.gui.dialog.replace.ReplaceDialog
This dialog manages the replace action.
Definition: ReplaceDialog.java:68
net.sf.gridarta.gui.panel.objectchooser
Definition: DefaultObjectChooser.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceCopyBuffer
List< G > replaceCopyBuffer
Definition: ReplaceDialog.java:166
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getSelections
List<? extends BaseObject< G, A, R, ?> > getSelections()
Returns the selected arches in the left-side panel.
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceCriteria
JComboBox< String > replaceCriteria
Definition: ReplaceDialog.java:184
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceWithBox
JComboBox< String > replaceWithBox
Definition: ReplaceDialog.java:187
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceArch
BaseObject< G, A, R, ?> replaceArch
Objects will be replaced with this game object.
Definition: ReplaceDialog.java:163
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.dispose
void dispose(@NotNull final MapView< G, A, R > mapView)
Disposes the replace dialog.
Definition: ReplaceDialog.java:561
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_OBJECT_CHOOSER
static final int REPLACE_WITH_OBJECT_CHOOSER
Index for replaceWithBox: replace with object chooser selection.
Definition: ReplaceDialog.java:85
list
This document describes some hints and requirements for general development on the CrossfireEditor If you plan to make changes to the editor code or setup please read the following and keep it in derived from a basic editor application called Gridder by Pasi Ker�nen so please communicate with best through the cf devel mailing list
Definition: Developer_README.txt:13
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.dialog
final JDialog dialog
The dialog instance.
Definition: ReplaceDialog.java:122
net.sf.gridarta.gui.map.mapview
Definition: AbstractMapView.java:20
net.sf.gridarta.gui.map.mapview.MapView
A map view consists of a map grid and a map cursor, and is attached to a map control.
Definition: MapView.java:43
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getSelection
BaseObject< G, A, R, ?> getSelection()
Returns the active arch in the left-side panel.
net.sf.gridarta.model.face.FaceObjectProviders.getFace
public< G extends GameObject< G, A, R >, A extends MapArchObject< A >, R extends Archetype< G, A, R > > ImageIcon getFace(@NotNull final BaseObject< G, A, R, ?> baseObject)
Returns the face of a BaseObject as an ImageIcon.
Definition: FaceObjectProviders.java:251
net.sf.gridarta.gui.copybuffer.CopyBuffer
Common base implementation of CopyBuffer.
Definition: CopyBuffer.java:52
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.display
void display(@NotNull final MapView< G, A, R > mapView)
Replace objects on the map.
Definition: ReplaceDialog.java:260
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.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser
Common base interface for ObjectChoosers.
Definition: ObjectChooser.java:34
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceDensityInput
JTextComponent replaceDensityInput
Input field for replace density value.
Definition: ReplaceDialog.java:199
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.faceObjectProviders
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for looking up faces.
Definition: ReplaceDialog.java:146
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.ReplaceWithBoxItemListener
Item-listener for the "replace with"-selection box.
Definition: ReplaceDialog.java:419
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceApply
void replaceApply()
Action method for Apply button.
Definition: ReplaceDialog.java:477
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.lastSelectedIndex
int lastSelectedIndex
Definition: ReplaceDialog.java:201
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.gui.map
Base classes for rendering maps.
Definition: AbstractPerMapDialogManager.java:20
net.sf.gridarta.model.select.ObjectNameMatchCriteria
A MatchCriteria that matches by object name.
Definition: ObjectNameMatchCriteria.java:33
net.sf.gridarta.gui.dialog.replace.ReplaceUtils
Utility class to replace objects in a map.
Definition: ReplaceUtils.java:44
net.sf.gridarta.model.face.FaceObjectProvidersListener
Interface for listeners interested in FaceObjectProviders related events.
Definition: FaceObjectProvidersListener.java:29
net.sf.gridarta.model.face
The face is the appearance of an object.
Definition: AbstractFaceObjects.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.insertionModeSet
final InsertionModeSet< G, A, R > insertionModeSet
The InsertionModeSet to use.
Definition: ReplaceDialog.java:116
net.sf.gridarta.utils.ActionBuilderUtils
Utility class for ActionBuilder related functions.
Definition: ActionBuilderUtils.java:31
net.sf.gridarta.model.mapcontrol.MapControl.getMapModel
MapModel< G, A, R > getMapModel()
Returns the map model.
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.gui.map.mapview.MapView.getSelectedSquares
List< MapSquare< G, A, R > > getSelectedSquares()
Returns the selected squares.
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.parent
final Component parent
The parent component for dialogs.
Definition: ReplaceDialog.java:128
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceInput1
JTextComponent replaceInput1
Definition: ReplaceDialog.java:193
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.copyBuffer
final CopyBuffer< G, A, R > copyBuffer
The CopyBuffer.
Definition: ReplaceDialog.java:134
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.newList
static< T > List< T > newList(@NotNull final T element)
Creates a new list containing one element.
Definition: ReplaceDialog.java:410
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.mapView
MapView< G, A, R > mapView
The MapView to operate on.
Definition: ReplaceDialog.java:157
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.rfArchName
JLabel rfArchName
Definition: ReplaceDialog.java:175
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceOk
void replaceOk()
Action method for Ok button.
Definition: ReplaceDialog.java:467
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.updateArchSelection
void updateArchSelection(@Nullable final BaseObject< G, A, R, ?> newArch, final boolean alwaysPack)
Update which arch is displayed as replace object.
Definition: ReplaceDialog.java:382
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.rfHeading
JLabel rfHeading
Definition: ReplaceDialog.java:172
net.sf.gridarta.gui.panel.objectchooser.ObjectChooserListener
Interface for listener interested in ObjectChooser events.
Definition: ObjectChooserListener.java:32