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-2015 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.Collection;
29 import java.util.Iterator;
30 import java.util.List;
31 import javax.swing.BorderFactory;
32 import javax.swing.Box;
33 import javax.swing.BoxLayout;
34 import javax.swing.Icon;
35 import javax.swing.JButton;
36 import javax.swing.JComboBox;
37 import javax.swing.JDialog;
38 import javax.swing.JLabel;
39 import javax.swing.JOptionPane;
40 import javax.swing.JPanel;
41 import javax.swing.JTextField;
42 import javax.swing.WindowConstants;
43 import javax.swing.text.JTextComponent;
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 org.jetbrains.annotations.NotNull;
67 import org.jetbrains.annotations.Nullable;
68 
74 public class ReplaceDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JOptionPane {
75 
79  private static final long serialVersionUID = 1L;
80 
84  @NotNull
85  private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta");
86 
91  private static final int REPLACE_WITH_OBJECT_CHOOSER = 0;
92 
96  private static final int REPLACE_WITH_COPY_BUFFER = 1;
97 
101  private static final int REPLACE_WITH_PICKMAP = 2;
102 
106  private static final int REPLACE_WITH_NOTHING = 3;
107 
111  private static final int REPLACE_ON_MAP = 0;
112 
116  private static final int REPLACE_ON_SELECTION = 1;
117 
121  @NotNull
123 
127  @NotNull
128  private final JDialog dialog;
129 
133  @NotNull
134  private final Component parent;
135 
139  @NotNull
141 
145  @NotNull
147 
151  @NotNull
153 
157  private boolean isBuilt;
158 
162  @NotNull
164 
168  @Nullable
170 
171  @NotNull
172  private List<G> replaceCopyBuffer; // objects in CopyBuffer
173 
174  @NotNull
175  private List<? extends BaseObject<G, A, R, ?>> replacePickmap; // selected objects in pickmap or all if none is selected
176 
177  @NotNull
178  private JLabel rfHeading;
179 
180  @Nullable
181  private JLabel rfArchName;
182 
183  @NotNull
184  private JLabel iconLabel;
185 
186  @NotNull
187  private JLabel colonLabel;
188 
189  @NotNull
190  private JComboBox<String> replaceCriteria;
191 
192  @NotNull
193  private JComboBox<String> replaceWithBox;
194 
195  @NotNull
196  private JComboBox<String> replaceEntireBox;
197 
198  @NotNull
199  private JTextComponent replaceInput1;
200 
204  @NotNull
205  private JTextComponent replaceDensityInput;
206 
208 
212  @NotNull
214 
215  @Override
216  public void pickmapActiveChanged(final boolean pickmapActive) {
217  // ignore
218  }
219 
220  @Override
221  public void selectionChanged(@Nullable final BaseObject<G, A, R, ?> gameObject) {
222  updateArchSelection(gameObject, false);
223  }
224 
225  };
226 
230  @NotNull
232 
233  @Override
234  public void facesReloaded() {
236  }
237 
238  };
239 
249  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) {
250  this.insertionModeSet = insertionModeSet;
251  dialog = createDialog(parent, ActionBuilderUtils.getString(ACTION_BUILDER, "replaceTitle"));
252  dialog.setModal(false);
253  dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
254  this.parent = parent;
255  this.copyBuffer = copyBuffer;
256  this.objectChooser = objectChooser;
257  this.faceObjectProviders = faceObjectProviders;
260  }
261 
266  public void display(@NotNull final MapView<G, A, R> mapView) {
267  replaceArch = objectChooser.getCursorSelection(); // highlighted arch
268  replacePickmap = objectChooser.getSelections(); // selected arches
270 
271  if (isBuilt) {
272  // just set fields and show
273  rfHeading.setText("\"" + mapView.getMapControl().getMapModel().getMapArchObject().getMapName() + "\":");
274  replaceInput1.setText("");
275 
276  this.mapView = mapView;
277  if (replaceArch == null) {
278  replaceWithBox.setSelectedIndex(REPLACE_WITH_COPY_BUFFER);
279  iconLabel.setIcon(null);
280  rfArchName.setText("");
281  colonLabel.setText("");
282  } else {
284  iconLabel.setIcon(faceObjectProviders.getFace(replaceArch));
285  rfArchName.setText(" " + replaceArch.getBestName());
286  colonLabel.setText(":");
287  }
288 
290 
291  replaceDensityInput.setText("100");
292 
293  dialog.pack();
294  dialog.toFront();
295  } else {
296  this.mapView = mapView;
297  final JPanel mainPanel = new JPanel();
298  mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
299  mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5));
300 
301  // first line: heading
302  final Container line1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
303  line1.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceOn"));
304  line1.add(Box.createVerticalStrut(3));
305  replaceEntireBox = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOnMap"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOnSelection") });
306  replaceEntireBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOn.shortdescription"));
308  line1.add(replaceEntireBox);
309  line1.add(Box.createVerticalStrut(3));
310  rfHeading = new JLabel("\"" + mapView.getMapControl().getMapModel().getMapArchObject().getMapName() + "\":");
311  line1.add(rfHeading);
312  mainPanel.add(line1);
313 
314  // second line: replace what?
315  final Container line2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
316  line2.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceDelete"));
317  line2.add(Box.createVerticalStrut(5));
318 
319  replaceCriteria = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceArchetype"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceName") });
320  replaceCriteria.setSelectedIndex(0);
321  replaceCriteria.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceDelete.shortdescription"));
322  line2.add(replaceCriteria);
323  line2.add(Box.createVerticalStrut(5));
324 
325  replaceInput1 = new JTextField(20);
326  replaceInput1.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceInput1.shortdescription"));
327  line2.add(replaceInput1);
328  mainPanel.add(line2);
329 
330  // third line: replace by?
331  final Container line3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
332  line3.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceBy"));
333  line3.add(Box.createVerticalStrut(5));
334  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") });
335  replaceWithBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceBy.shortdescription"));
336  //noinspection VariableNotUsedInsideIf
338  replaceWithBox.addItemListener(new ReplaceWithBoxItemListener());
339  lastSelectedIndex = replaceWithBox.getSelectedIndex();
340  line3.add(replaceWithBox);
341 
342  iconLabel = new JLabel();
343  if (replaceArch == null) {
344  colonLabel = new JLabel("");
345  rfArchName = new JLabel("");
346  } else {
347  colonLabel = new JLabel(":");
348  iconLabel.setIcon(faceObjectProviders.getFace(replaceArch));
349  rfArchName = new JLabel(" " + replaceArch.getBestName());
350  }
351  line3.add(colonLabel);
352  line3.add(Box.createVerticalStrut(5));
353  line3.add(iconLabel);
354  line3.add(rfArchName);
355  mainPanel.add(line3);
356 
357  // fourth line: replace density
358  final Container line4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
359  line4.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceDensity"));
360  line4.add(Box.createVerticalStrut(5));
361  replaceDensityInput = new JTextField(5);
362  replaceDensityInput.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceDensity.shortdescription"));
363  line4.add(replaceDensityInput);
364  replaceDensityInput.setText("100");
365  mainPanel.add(line4);
366 
367  final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "replaceOk", this));
368  final JButton applyButton = new JButton(ACTION_BUILDER.createAction(false, "replaceApply", this));
369  final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "replaceCancel", this));
370 
371  setMessage(mainPanel);
372  setOptions(new Object[] { okButton, applyButton, cancelButton });
373  dialog.getRootPane().setDefaultButton(okButton);
374  dialog.pack();
375  dialog.setLocationRelativeTo(parent);
376  isBuilt = true;
377  }
378  dialog.setVisible(true);
379  }
380 
388  private void updateArchSelection(@Nullable final BaseObject<G, A, R, ?> newArch, final boolean alwaysPack) {
389  if (isShowing() && replaceWithBox.getSelectedIndex() == REPLACE_WITH_OBJECT_CHOOSER) {
390  replaceArch = newArch;
391  if (newArch == null) {
392  iconLabel.setIcon(null);
393  rfArchName.setText("");
394  colonLabel.setText("");
395  } else {
396  final Icon oldIcon = iconLabel.getIcon();
397 
398  iconLabel.setIcon(faceObjectProviders.getFace(newArch));
399  rfArchName.setText(" " + newArch.getBestName());
400  colonLabel.setText(":");
401 
402  // pack frame only if height of icon changed
403  if (alwaysPack || (oldIcon == null && iconLabel.getIcon() != null) || (oldIcon != null && iconLabel.getIcon() == null) || (oldIcon != iconLabel.getIcon() && oldIcon != null && oldIcon.getIconHeight() != iconLabel.getIcon().getIconHeight())) {
404  dialog.pack();
405  }
406  }
407  }
408  }
409 
420  private int doReplace(@NotNull final MatchCriteria<G, A, R> matchCriteria, final boolean entireMap, final boolean deleteOnly, final int replaceDensity) {
421  @Nullable final List<? extends BaseObject<G, A, R, ?>> replaceList;
422  switch (lastSelectedIndex) {
424  replaceList = replaceArch == null ? null : newList(replaceArch);
425  break;
426 
428  replaceList = replaceCopyBuffer;
429  break;
430 
432  replaceList = replacePickmap;
433  break;
434 
435  default: // REPLACE_WITH_NOTHING
436  replaceList = null;
437  break;
438  }
439  final int replaceListSize = replaceList == null ? 0 : replaceList.size();
440  final MapControl<G, A, R> mapControl = mapView.getMapControl();
441  final MapModel<G, A, R> mapModel = mapControl.getMapModel();
442  mapModel.beginTransaction("Replace"); // TODO: I18N/L10N
443  try {
444  int replaceCount = 0;
445  final Collection<G> objectsToReplace = new ArrayList<>();
446  for (final MapSquare<G, A, R> square : entireMap ? mapModel : mapView.getSelectedSquares()) {
447  // Operate on a copy of the nodes to prevent ConcurrentModificationException
448 
449  // find objects to replace
450  objectsToReplace.clear();
451  for (final G node : square) {
452  if (node.isHead() && matchCriteria.matches(node)) {
453  if (replaceDensity > RandomUtils.RND.nextInt(100)) {
454  objectsToReplace.add(node);
455  }
456  }
457  }
458 
459  // actually replace the objects
460  for (final G objectToReplace : objectsToReplace) {
461  final Iterator<G> it = square.iterator();
462  G prevArch = null;
463  G node = null;
464  while (it.hasNext()) {
465  node = it.next();
466 
467  if (node == objectToReplace) {
468  break;
469  }
470 
471  prevArch = node;
472  }
473  assert node != null;
474 
475  // first, delete the old arch
476  node.remove();
477 
478  if (replaceListSize > 0 && !deleteOnly) {
479  final BaseObject<G, A, R, ?> randomArch = replaceList.get(replaceListSize == 1 ? 0 : RandomUtils.RND.nextInt(replaceList.size()));
480  // insert replacement object
481  if (randomArch.isMulti()) {
482  mapModel.insertBaseObject(randomArch, square.getMapLocation(), false, false, insertionModeSet.getTopmostInsertionMode());
483  } else {
484  mapModel.insertArchToMap(randomArch, prevArch, square.getMapLocation(), false);
485  }
486  }
487  replaceCount++;
488  }
489  }
490  return replaceCount;
491  } finally {
492  mapModel.endTransaction();
493  }
494  }
495 
501  @NotNull
502  private static <T> List<T> newList(@NotNull final T element) {
503  final List<T> list = new ArrayList<>(1);
504  list.add(element);
505  return list;
506  }
507 
511  private class ReplaceWithBoxItemListener implements ItemListener {
512 
513  @Override
514  public void itemStateChanged(@NotNull final ItemEvent e) {
515  final int selectedIndex = replaceWithBox.getSelectedIndex();
516  if (e.getStateChange() == ItemEvent.SELECTED && lastSelectedIndex != selectedIndex) {
517  final int size;
518  switch (selectedIndex) {
520  replaceArch = objectChooser.getSelection(); // selected arch
522  break;
523 
526  iconLabel.setIcon(null);
527  size = replaceCopyBuffer.size();
528  rfArchName.setText(String.valueOf(size));
529  colonLabel.setText(":");
530  dialog.pack();
531  break;
532 
534  replacePickmap = objectChooser.getSelections(); // selected arches
535  iconLabel.setIcon(null);
536  size = replacePickmap.size();
537  rfArchName.setText(String.valueOf(size));
538  colonLabel.setText(":");
539  dialog.pack();
540  break;
541 
543  iconLabel.setIcon(null);
544  rfArchName.setText("");
545  colonLabel.setText("");
546  dialog.pack();
547  break;
548  }
549  lastSelectedIndex = selectedIndex;
550  }
551  }
552 
553  }
554 
558  @ActionMethod
559  public void replaceOk() {
560  if (doReplace()) {
561  dialog.setVisible(false);
562  }
563  }
564 
568  @ActionMethod
569  public void replaceApply() {
570  doReplace();
571  }
572 
577  private boolean doReplace() {
578  final String matchString = replaceInput1.getText().trim();
579  final boolean deleteOnly = replaceWithBox.getSelectedIndex() == REPLACE_WITH_NOTHING;
580  final boolean entireMap = replaceEntireBox.getSelectedIndex() == REPLACE_ON_MAP;
581 
582  if (!entireMap && mapView.getMapGrid().getSelectedRec() == null) {
583  // user selected "replace highlighted" but nothing is highlighted
584  ACTION_BUILDER.showMessageDialog(this, "replaceMapNoSelection", mapView.getMapControl().getMapModel().getMapArchObject().getMapName());
585  return false;
586  }
587 
588  final MatchCriteria<G, A, R> matchCriteria;
589  if (replaceCriteria.getSelectedIndex() == 0) {
590  matchCriteria = new ArchetypeNameMatchCriteria<>(matchString);
591  } else if (replaceCriteria.getSelectedIndex() == 1) {
592  matchCriteria = new ObjectNameMatchCriteria<>(matchString);
593  } else {
594  return false;
595  }
596 
597  final int replaceDensity;
598  try {
599  replaceDensity = Integer.parseInt(replaceDensityInput.getText());
600  } catch (final NumberFormatException ignored) {
601  ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity");
602  return false;
603  }
604  if (replaceDensity < 1 || replaceDensity > 100) {
605  ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity");
606  return false;
607  }
608 
609  final int replaceCount = doReplace(matchCriteria, entireMap, deleteOnly, replaceDensity);
610  if (replaceCount <= 0) {
611  ACTION_BUILDER.showMessageDialog(this, "replacedZero");
612  return false;
613  }
614 
615  if (replaceCount == 1) {
616  ACTION_BUILDER.showMessageDialog(this, "replacedOne");
617  } else {
618  ACTION_BUILDER.showMessageDialog(this, "replacedMany", replaceCount);
619  }
620  return true;
621  }
622 
626  @ActionMethod
627  public void replaceCancel() {
628  dialog.setVisible(false);
629  }
630 
635  public void dispose(@NotNull final MapView<G, A, R> mapView) {
636  if (mapView == this.mapView) {
637  dialog.setVisible(false);
638  }
639  }
640 
641 }
net.sf.gridarta.model.mapmodel.MapModel.insertArchToMap
G insertArchToMap(@NotNull BaseObject< G, A, R, ?> templateBaseObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join)
net.sf.gridarta.utils.RandomUtils
Definition: RandomUtils.java:28
net.sf.gridarta.model.mapmodel.InsertionModeSet.getTopmostInsertionMode
InsertionMode getTopmostInsertionMode()
Definition: InsertionModeSet.java:98
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.doReplace
int doReplace(@NotNull final MatchCriteria< G, A, R > matchCriteria, final boolean entireMap, final boolean deleteOnly, final int replaceDensity)
Definition: ReplaceDialog.java:420
net.sf.gridarta.model.mapmodel.MapModel
Definition: MapModel.java:75
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.serialVersionUID
static final long serialVersionUID
Definition: ReplaceDialog.java:79
net.sf.gridarta.gui.panel
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.colonLabel
JLabel colonLabel
Definition: ReplaceDialog.java:187
net.sf.gridarta.gui.map.mapview.MapView.getMapGrid
MapGrid getMapGrid()
net.sf.gridarta.model.mapmodel.MapModel.getMapArchObject
A getMapArchObject()
net.sf.gridarta.model.mapmodel.InsertionModeSet
Definition: InsertionModeSet.java:33
net.sf.gridarta.model.baseobject.BaseObject.isMulti
boolean isMulti()
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceCancel
void replaceCancel()
Definition: ReplaceDialog.java:627
net.sf.gridarta.gui.copybuffer
Definition: CopyBuffer.java:20
net.sf.gridarta.model.mapmodel.MapModel.insertBaseObject
G insertBaseObject(@NotNull BaseObject< G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode insertionMode)
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_ON_MAP
static final int REPLACE_ON_MAP
Definition: ReplaceDialog.java:111
net.sf.gridarta.model.select.MatchCriteria
Definition: MatchCriteria.java:31
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_COPY_BUFFER
static final int REPLACE_WITH_COPY_BUFFER
Definition: ReplaceDialog.java:96
net.sf.gridarta.gui.map.mapview.MapView.getMapControl
MapControl< G, A, R > getMapControl()
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.objectChooser
final ObjectChooser< G, A, R > objectChooser
Definition: ReplaceDialog.java:146
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.ACTION_BUILDER
static final ActionBuilder ACTION_BUILDER
Definition: ReplaceDialog.java:85
net.sf.gridarta
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.addObjectChooserListener
void addObjectChooserListener(@NotNull ObjectChooserListener< G, A, R > listener)
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.doReplace
boolean doReplace()
Definition: ReplaceDialog.java:577
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getCursorSelection
BaseObject< G, A, R, ?> getCursorSelection()
net.sf.gridarta.model.mapmodel.MapSquare
Definition: MapSquare.java:45
net.sf.gridarta.model.mapmodel.MapModel.endTransaction
void endTransaction()
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replacePickmap
List<? extends BaseObject< G, A, R, ?> > replacePickmap
Definition: ReplaceDialog.java:175
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_ON_SELECTION
static final int REPLACE_ON_SELECTION
Definition: ReplaceDialog.java:116
net.sf
net.sf.gridarta.model.mapmodel.MapModel.beginTransaction
void beginTransaction(@NotNull String name)
net.sf.gridarta.model.select.ArchetypeNameMatchCriteria
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:514
net.sf.gridarta.model.baseobject.BaseObject.getMapLocation
Point getMapLocation()
net.sf.gridarta.model.mapgrid.MapGrid.getSelectedRec
Rectangle getSelectedRec()
Definition: MapGrid.java:514
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.isBuilt
boolean isBuilt
Definition: ReplaceDialog.java:157
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)
Definition: ReplaceDialog.java:249
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.objectChooserListener
final ObjectChooserListener< G, A, R > objectChooserListener
Definition: ReplaceDialog.java:213
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_PICKMAP
static final int REPLACE_WITH_PICKMAP
Definition: ReplaceDialog.java:101
net.sf.gridarta.model.face.FaceObjectProviders
Definition: FaceObjectProviders.java:46
net.sf.gridarta.model.gameobject.GameObject
Definition: GameObject.java:36
net.sf.gridarta.model.baseobject.BaseObject.getBestName
String getBestName()
net.sf.gridarta.model.select
Definition: ArchetypeNameMatchCriteria.java:20
net.sf.gridarta.model.mapcontrol
Definition: DefaultMapControl.java:20
net.sf.gridarta.utils.ActionBuilderUtils.newLabel
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Definition: ActionBuilderUtils.java:117
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceEntireBox
JComboBox< String > replaceEntireBox
Definition: ReplaceDialog.java:196
net.sf.gridarta.gui.copybuffer.CopyBuffer.getAllGameObjects
List< G > getAllGameObjects()
Definition: CopyBuffer.java:263
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.faceObjectProvidersListener
final FaceObjectProvidersListener faceObjectProvidersListener
Definition: ReplaceDialog.java:231
net.sf.gridarta.model.face.FaceObjectProviders.addFaceObjectProvidersListener
void addFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener)
Definition: FaceObjectProviders.java:197
net.sf.gridarta.gui
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.iconLabel
JLabel iconLabel
Definition: ReplaceDialog.java:184
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_NOTHING
static final int REPLACE_WITH_NOTHING
Definition: ReplaceDialog.java:106
net.sf.gridarta.gui.dialog.replace.ReplaceDialog
Definition: ReplaceDialog.java:74
net.sf.gridarta.gui.panel.objectchooser
Definition: DefaultObjectChooser.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceCopyBuffer
List< G > replaceCopyBuffer
Definition: ReplaceDialog.java:172
net.sf.gridarta.model.gameobject
Definition: AbstractGameObject.java:20
net
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getSelections
List<? extends BaseObject< G, A, R, ?> > getSelections()
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceCriteria
JComboBox< String > replaceCriteria
Definition: ReplaceDialog.java:190
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceWithBox
JComboBox< String > replaceWithBox
Definition: ReplaceDialog.java:193
net.sf.gridarta.utils.RandomUtils.RND
static final Random RND
Definition: RandomUtils.java:33
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceArch
BaseObject< G, A, R, ?> replaceArch
Definition: ReplaceDialog.java:169
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.dispose
void dispose(@NotNull final MapView< G, A, R > mapView)
Definition: ReplaceDialog.java:635
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.REPLACE_WITH_OBJECT_CHOOSER
static final int REPLACE_WITH_OBJECT_CHOOSER
Definition: ReplaceDialog.java:91
net.sf.gridarta.model.maparchobject.MapArchObject
Definition: MapArchObject.java:40
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.dialog
final JDialog dialog
Definition: ReplaceDialog.java:128
net.sf.gridarta.gui.map.mapview
Definition: AbstractMapView.java:20
net.sf.gridarta.gui.map.mapview.MapView
Definition: MapView.java:43
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getSelection
BaseObject< G, A, R, ?> getSelection()
net.sf.gridarta.gui.copybuffer.CopyBuffer
Definition: CopyBuffer.java:52
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.display
void display(@NotNull final MapView< G, A, R > mapView)
Definition: ReplaceDialog.java:266
net.sf.gridarta.utils.ActionBuilderUtils.getString
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Definition: ActionBuilderUtils.java:71
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser
Definition: ObjectChooser.java:34
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceDensityInput
JTextComponent replaceDensityInput
Definition: ReplaceDialog.java:205
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.faceObjectProviders
final FaceObjectProviders faceObjectProviders
Definition: ReplaceDialog.java:152
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.ReplaceWithBoxItemListener
Definition: ReplaceDialog.java:511
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceApply
void replaceApply()
Definition: ReplaceDialog.java:569
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.lastSelectedIndex
int lastSelectedIndex
Definition: ReplaceDialog.java:207
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Definition: Archetype.java:41
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.gui.map
Definition: AbstractPerMapDialogManager.java:20
net.sf.gridarta.model.select.ObjectNameMatchCriteria
Definition: ObjectNameMatchCriteria.java:33
net.sf.gridarta.model.face.FaceObjectProvidersListener
Definition: FaceObjectProvidersListener.java:29
net.sf.gridarta.model.face
Definition: AbstractFaceObjects.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.insertionModeSet
final InsertionModeSet< G, A, R > insertionModeSet
Definition: ReplaceDialog.java:122
net.sf.gridarta.model.mapcontrol.MapControl
Definition: MapControl.java:35
net.sf.gridarta.utils.ActionBuilderUtils
Definition: ActionBuilderUtils.java:31
net.sf.gridarta.model.mapcontrol.MapControl.getMapModel
MapModel< G, A, R > getMapModel()
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.gui.map.mapview.MapView.getSelectedSquares
List< MapSquare< G, A, R > > getSelectedSquares()
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.parent
final Component parent
Definition: ReplaceDialog.java:134
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceInput1
JTextComponent replaceInput1
Definition: ReplaceDialog.java:199
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.copyBuffer
final CopyBuffer< G, A, R > copyBuffer
Definition: ReplaceDialog.java:140
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.newList
static< T > List< T > newList(@NotNull final T element)
Definition: ReplaceDialog.java:502
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.mapView
MapView< G, A, R > mapView
Definition: ReplaceDialog.java:163
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.rfArchName
JLabel rfArchName
Definition: ReplaceDialog.java:181
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.replaceOk
void replaceOk()
Definition: ReplaceDialog.java:559
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.updateArchSelection
void updateArchSelection(@Nullable final BaseObject< G, A, R, ?> newArch, final boolean alwaysPack)
Definition: ReplaceDialog.java:388
net.sf.gridarta.gui.dialog.replace.ReplaceDialog.rfHeading
JLabel rfHeading
Definition: ReplaceDialog.java:178
net.sf.gridarta.gui.panel.objectchooser.ObjectChooserListener
Definition: ObjectChooserListener.java:32