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 
207  @SuppressWarnings("RedundantFieldInitialization")
208  private int lastSelectedIndex = REPLACE_WITH_OBJECT_CHOOSER;
209 
213  @NotNull
214  private final ObjectChooserListener<G, A, R> objectChooserListener = new ObjectChooserListener<G, A, R>() {
215 
216  @Override
217  public void pickmapActiveChanged(final boolean pickmapActive) {
218  // ignore
219  }
220 
221  @Override
222  public void selectionChanged(@Nullable final BaseObject<G, A, R, ?> gameObject) {
223  updateArchSelection(gameObject, false);
224  }
225 
226  };
227 
231  @NotNull
233 
234  @Override
235  public void facesReloaded() {
236  updateArchSelection(objectChooser.getSelection(), false);
237  }
238 
239  };
240 
250  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) {
251  this.insertionModeSet = insertionModeSet;
252  dialog = createDialog(parent, ActionBuilderUtils.getString(ACTION_BUILDER, "replaceTitle"));
253  dialog.setModal(false);
254  dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
255  this.parent = parent;
256  this.copyBuffer = copyBuffer;
257  this.objectChooser = objectChooser;
258  this.faceObjectProviders = faceObjectProviders;
259  objectChooser.addObjectChooserListener(objectChooserListener);
260  faceObjectProviders.addFaceObjectProvidersListener(faceObjectProvidersListener);
261  }
262 
267  public void display(@NotNull final MapView<G, A, R> mapView) {
268  replaceArch = objectChooser.getCursorSelection(); // highlighted arch
269  replacePickmap = objectChooser.getSelections(); // selected arches
270  replaceCopyBuffer = copyBuffer.getAllGameObjects();
271 
272  if (isBuilt) {
273  // just set fields and show
274  rfHeading.setText("\"" + mapView.getMapControl().getMapModel().getMapArchObject().getMapName() + "\":");
275  replaceInput1.setText("");
276 
277  this.mapView = mapView;
278  if (replaceArch == null) {
279  replaceWithBox.setSelectedIndex(REPLACE_WITH_COPY_BUFFER);
280  iconLabel.setIcon(null);
281  rfArchName.setText("");
282  colonLabel.setText("");
283  } else {
284  replaceWithBox.setSelectedIndex(REPLACE_WITH_OBJECT_CHOOSER);
285  iconLabel.setIcon(faceObjectProviders.getFace(replaceArch));
286  rfArchName.setText(" " + replaceArch.getBestName());
287  colonLabel.setText(":");
288  }
289 
290  if (mapView.getSelectedSquares().size() > 1) {
291  replaceEntireBox.setSelectedIndex(REPLACE_ON_SELECTION);
292  } else {
293  replaceEntireBox.setSelectedIndex(REPLACE_ON_MAP);
294  }
295 
296  replaceDensityInput.setText("100");
297 
298  dialog.pack();
299  dialog.toFront();
300  } else {
301  this.mapView = mapView;
302  final JPanel mainPanel = new JPanel();
303  mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
304  mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5));
305 
306  // first line: heading
307  final Container line1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
308  line1.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceOn"));
309  line1.add(Box.createVerticalStrut(3));
310  replaceEntireBox = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOnMap"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOnSelection") });
311  replaceEntireBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceOn.shortdescription"));
312  if (mapView.getSelectedSquares().size() > 1) {
313  replaceEntireBox.setSelectedIndex(REPLACE_ON_SELECTION);
314  } else {
315  replaceEntireBox.setSelectedIndex(REPLACE_ON_MAP);
316  }
317  line1.add(replaceEntireBox);
318  line1.add(Box.createVerticalStrut(3));
319  rfHeading = new JLabel("\"" + mapView.getMapControl().getMapModel().getMapArchObject().getMapName() + "\":");
320  line1.add(rfHeading);
321  mainPanel.add(line1);
322 
323  // second line: replace what?
324  final Container line2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
325  line2.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceDelete"));
326  line2.add(Box.createVerticalStrut(5));
327 
328  replaceCriteria = new JComboBox<>(new String[] { ActionBuilderUtils.getString(ACTION_BUILDER, "replaceArchetype"), ActionBuilderUtils.getString(ACTION_BUILDER, "replaceName") });
329  replaceCriteria.setSelectedIndex(0);
330  replaceCriteria.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceDelete.shortdescription"));
331  line2.add(replaceCriteria);
332  line2.add(Box.createVerticalStrut(5));
333 
334  replaceInput1 = new JTextField(20);
335  replaceInput1.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceInput1.shortdescription"));
336  line2.add(replaceInput1);
337  mainPanel.add(line2);
338 
339  // third line: replace by?
340  final Container line3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
341  line3.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceBy"));
342  line3.add(Box.createVerticalStrut(5));
343  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") });
344  replaceWithBox.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceBy.shortdescription"));
345  //noinspection VariableNotUsedInsideIf
346  if (replaceArch == null) {
347  replaceWithBox.setSelectedIndex(REPLACE_WITH_NOTHING);
348  } else {
349  replaceWithBox.setSelectedIndex(REPLACE_WITH_OBJECT_CHOOSER);
350  }
351  replaceWithBox.addItemListener(new ReplaceWithBoxItemListener());
352  lastSelectedIndex = replaceWithBox.getSelectedIndex();
353  line3.add(replaceWithBox);
354 
355  iconLabel = new JLabel();
356  if (replaceArch != null) {
357  colonLabel = new JLabel(":");
358  iconLabel.setIcon(faceObjectProviders.getFace(replaceArch));
359  rfArchName = new JLabel(" " + replaceArch.getBestName());
360  } else {
361  colonLabel = new JLabel("");
362  rfArchName = new JLabel("");
363  }
364  line3.add(colonLabel);
365  line3.add(Box.createVerticalStrut(5));
366  line3.add(iconLabel);
367  line3.add(rfArchName);
368  mainPanel.add(line3);
369 
370  // fourth line: replace density
371  final Container line4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
372  line4.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "replaceDensity"));
373  line4.add(Box.createVerticalStrut(5));
374  replaceDensityInput = new JTextField(5);
375  replaceDensityInput.setToolTipText(ActionBuilderUtils.getString(ACTION_BUILDER, "replaceDensity.shortdescription"));
376  line4.add(replaceDensityInput);
377  replaceDensityInput.setText("100");
378  mainPanel.add(line4);
379 
380  final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "replaceOk", this));
381  final JButton applyButton = new JButton(ACTION_BUILDER.createAction(false, "replaceApply", this));
382  final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "replaceCancel", this));
383 
384  setMessage(mainPanel);
385  setOptions(new Object[] { okButton, applyButton, cancelButton });
386  dialog.getRootPane().setDefaultButton(okButton);
387  dialog.pack();
388  dialog.setLocationRelativeTo(parent);
389  isBuilt = true;
390  }
391  dialog.setVisible(true);
392  }
393 
401  private void updateArchSelection(@Nullable final BaseObject<G, A, R, ?> newArch, final boolean alwaysPack) {
402  if (isShowing() && replaceWithBox.getSelectedIndex() == REPLACE_WITH_OBJECT_CHOOSER) {
403  replaceArch = newArch;
404  if (newArch != null) {
405  final Icon oldIcon = iconLabel.getIcon();
406 
407  iconLabel.setIcon(faceObjectProviders.getFace(newArch));
408  rfArchName.setText(" " + newArch.getBestName());
409  colonLabel.setText(":");
410 
411  // pack frame only if height of icon changed
412  if (alwaysPack || (oldIcon == null && iconLabel.getIcon() != null) || (oldIcon != null && iconLabel.getIcon() == null) || (oldIcon != iconLabel.getIcon() && oldIcon != null && oldIcon.getIconHeight() != iconLabel.getIcon().getIconHeight())) {
413  dialog.pack();
414  }
415  } else {
416  iconLabel.setIcon(null);
417  rfArchName.setText("");
418  colonLabel.setText("");
419  }
420  }
421  }
422 
433  private int doReplace(@NotNull final MatchCriteria<G, A, R> matchCriteria, final boolean entireMap, final boolean deleteOnly, final int replaceDensity) {
434  @Nullable final List<? extends BaseObject<G, A, R, ?>> replaceList;
435  switch (lastSelectedIndex) {
437  if (replaceArch == null) {
438  replaceList = null;
439  } else {
440  replaceList = newList(replaceArch);
441  }
442  break;
443 
445  replaceList = replaceCopyBuffer;
446  break;
447 
449  replaceList = replacePickmap;
450  break;
451 
452  default: // REPLACE_WITH_NOTHING
453  replaceList = null;
454  break;
455  }
456  final Collection<G> objectsToReplace = new ArrayList<>();
457  final int replaceListSize = replaceList == null ? 0 : replaceList.size();
458  final MapControl<G, A, R> mapControl = mapView.getMapControl();
459  final MapModel<G, A, R> mapModel = mapControl.getMapModel();
460  mapModel.beginTransaction("Replace"); // TODO: I18N/L10N
461  try {
462  int replaceCount = 0;
463  for (final MapSquare<G, A, R> square : entireMap ? mapModel : mapView.getSelectedSquares()) {
464  // Operate on a copy of the nodes to prevent ConcurrentModificationException
465 
466  // find objects to replace
467  objectsToReplace.clear();
468  for (final G node : square) {
469  if (node.isHead() && matchCriteria.matches(node)) {
470  if (replaceDensity > RandomUtils.RND.nextInt(100)) {
471  objectsToReplace.add(node);
472  }
473  }
474  }
475 
476  // actually replace the objects
477  for (final G objectToReplace : objectsToReplace) {
478  final Iterator<G> it = square.iterator();
479  G prevArch = null;
480  G node = null;
481  while (it.hasNext()) {
482  node = it.next();
483 
484  if (node == objectToReplace) {
485  break;
486  }
487 
488  prevArch = node;
489  }
490  assert node != null;
491 
492  // first, delete the old arch
493  node.remove();
494 
495  if (replaceListSize > 0 && !deleteOnly) {
496  final BaseObject<G, A, R, ?> randomArch;
497  if (replaceListSize == 1) {
498  randomArch = replaceList.get(0);
499  } else {
500  randomArch = replaceList.get(RandomUtils.RND.nextInt(replaceList.size()));
501  }
502  // insert replacement object
503  if (randomArch.isMulti()) {
504  mapModel.insertBaseObject(randomArch, square.getMapLocation(), false, false, insertionModeSet.getTopmostInsertionMode());
505  } else {
506  mapModel.insertArchToMap(randomArch, prevArch, square.getMapLocation(), false);
507  }
508  }
509  replaceCount++;
510  }
511  }
512  return replaceCount;
513  } finally {
514  mapModel.endTransaction();
515  }
516  }
517 
523  @NotNull
524  private static <T> List<T> newList(@NotNull final T element) {
525  final List<T> list = new ArrayList<>(1);
526  list.add(element);
527  return list;
528  }
529 
533  private class ReplaceWithBoxItemListener implements ItemListener {
534 
535  @Override
536  public void itemStateChanged(@NotNull final ItemEvent e) {
537  final int selectedIndex = replaceWithBox.getSelectedIndex();
538  if (e.getStateChange() == ItemEvent.SELECTED && lastSelectedIndex != selectedIndex) {
539  final int size;
540  switch (selectedIndex) {
542  replaceArch = objectChooser.getSelection(); // selected arch
543  updateArchSelection(replaceArch, true);
544  break;
545 
547  replaceCopyBuffer = copyBuffer.getAllGameObjects();
548  iconLabel.setIcon(null);
549  size = replaceCopyBuffer.size();
550  rfArchName.setText(String.valueOf(size));
551  colonLabel.setText(":");
552  dialog.pack();
553  break;
554 
556  replacePickmap = objectChooser.getSelections(); // selected arches
557  iconLabel.setIcon(null);
558  size = replacePickmap.size();
559  rfArchName.setText(String.valueOf(size));
560  colonLabel.setText(":");
561  dialog.pack();
562  break;
563 
565  iconLabel.setIcon(null);
566  rfArchName.setText("");
567  colonLabel.setText("");
568  dialog.pack();
569  break;
570  }
571  lastSelectedIndex = selectedIndex;
572  }
573  }
574 
575  }
576 
580  @ActionMethod
581  public void replaceOk() {
582  if (doReplace()) {
583  dialog.setVisible(false);
584  }
585  }
586 
590  @ActionMethod
591  public void replaceApply() {
592  doReplace();
593  }
594 
599  private boolean doReplace() {
600  final String matchString = replaceInput1.getText().trim();
601  final boolean deleteOnly = replaceWithBox.getSelectedIndex() == REPLACE_WITH_NOTHING;
602  final boolean entireMap = replaceEntireBox.getSelectedIndex() == REPLACE_ON_MAP;
603 
604  if (!entireMap && mapView.getMapGrid().getSelectedRec() == null) {
605  // user selected "replace highlighted" but nothing is highlighted
606  ACTION_BUILDER.showMessageDialog(this, "replaceMapNoSelection", mapView.getMapControl().getMapModel().getMapArchObject().getMapName());
607  return false;
608  }
609 
610  final MatchCriteria<G, A, R> matchCriteria;
611  if (replaceCriteria.getSelectedIndex() == 0) {
612  matchCriteria = new ArchetypeNameMatchCriteria<>(matchString);
613  } else if (replaceCriteria.getSelectedIndex() == 1) {
614  matchCriteria = new ObjectNameMatchCriteria<>(matchString);
615  } else {
616  return false;
617  }
618 
619  final int replaceDensity;
620  try {
621  replaceDensity = Integer.parseInt(replaceDensityInput.getText());
622  } catch (final NumberFormatException ignored) {
623  ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity");
624  return false;
625  }
626  if (replaceDensity < 1 || replaceDensity > 100) {
627  ACTION_BUILDER.showMessageDialog(this, "replaceInvalidDensity");
628  return false;
629  }
630 
631  final int replaceCount = doReplace(matchCriteria, entireMap, deleteOnly, replaceDensity);
632  if (replaceCount <= 0) {
633  ACTION_BUILDER.showMessageDialog(this, "replacedZero");
634  return false;
635  }
636 
637  if (replaceCount == 1) {
638  ACTION_BUILDER.showMessageDialog(this, "replacedOne");
639  } else {
640  ACTION_BUILDER.showMessageDialog(this, "replacedMany", replaceCount);
641  }
642  return true;
643  }
644 
648  @ActionMethod
649  public void replaceCancel() {
650  dialog.setVisible(false);
651  }
652 
657  public void dispose(@NotNull final MapView<G, A, R> mapView) {
658  if (mapView == this.mapView) {
659  dialog.setVisible(false);
660  }
661  }
662 
663 }
final InsertionModeSet< G, A, R > insertionModeSet
The InsertionModeSet to use.
final JDialog dialog
The dialog instance.
List< MapSquare< G, A, R > > getSelectedSquares()
Returns the selected squares.
A MapModel reflects the data of a map.
Definition: MapModel.java:75
Graphical User Interface of Gridarta.
static final int REPLACE_WITH_COPY_BUFFER
Index for replaceWithBox: replace with copy buffer contents.
final ObjectChooserListener< G, A, R > objectChooserListener
The ObjectChooserListener for tracking the selection.
static final ActionBuilder ACTION_BUILDER
Action Builder.
boolean isBuilt
Whether this replace dialog has been displayed.
void endTransaction()
End a transaction.
MapGrid getMapGrid()
Returns the MapGrid of this view.
void display(@NotNull final MapView< G, A, R > mapView)
Replace objects on the map.
static final long serialVersionUID
Serial Version UID.
void replaceOk()
Action method for Ok button.
void replaceApply()
Action method for Apply button.
Random number utilities.
static final int REPLACE_ON_MAP
Index for replaceEntireBox: replace map.
BaseObject< G, A, R, ?> getSelection()
Returns the active arch in the left-side panel.
void dispose(@NotNull final MapView< G, A, R > mapView)
Disposes the replace dialog.
BaseObject< G, A, R, ?> replaceArch
Objects will be replaced with this game object.
MapControl< G, A, R > getMapControl()
Return the controller of this view.
static< T > List< T > newList(@NotNull final T element)
Creates a new list containing one element.
void replaceCancel()
Action method for Cancel button.
MapModel< G, A, R > getMapModel()
Returns the map model.
void addFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener)
Adds a FaceObjectProvidersListener to be notified about changes.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
G insertBaseObject(@NotNull BaseObject< G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode< G, A, R > insertionMode)
Inserts a BaseObject to a map.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Definition: GameObject.java:36
boolean doReplace()
Executes one replace operation.
static final int REPLACE_ON_SELECTION
Index for replaceEntireBox: replace selection.
static final int REPLACE_WITH_PICKMAP
Index for replaceWithBox: replace with pickmap contents.
static final int REPLACE_WITH_NOTHING
Index for replaceWithBox: delete matching game objects.
InsertionMode< G, A, R > getTopmostInsertionMode()
Returns the "topmost" insertion mode.
GameObjects are the objects based on Archetypes found on maps.
int doReplace(@NotNull final MatchCriteria< G, A, R > matchCriteria, final boolean entireMap, final boolean deleteOnly, final int replaceDensity)
This method performs the actual replace action on a map.
G insertArchToMap(@NotNull BaseObject< G, A, R, ?> templateBaseObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join)
Insert a game object to the map at a specified position.
final CopyBuffer< G, A, R > copyBuffer
The CopyBuffer.
static final Random RND
Global random number generator.
List< G > getAllGameObjects()
Return all game objects.
List<? extends BaseObject< G, A, R, ?> > getSelections()
Returns the selected arches in the left-side panel.
Base classes for rendering maps.
Point getMapLocation()
Returns the coordinate of this GameObject on its map.
final ObjectChooser< G, A, R > objectChooser
The object chooser to use.
void updateArchSelection(@Nullable final BaseObject< G, A, R, ?> newArch, final boolean alwaysPack)
Update which arch is displayed as replace object.
MapView< G, A, R > mapView
The MapView to operate on.
JTextComponent replaceDensityInput
Input field for replace density value.
String getBestName()
Returns the name which is best appropriate to describe this GameObject.
List<? extends BaseObject< G, A, R, ?> > replacePickmap
final Component parent
The parent component for dialogs.
Utility class for ActionBuilder related functions.
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for looking up faces.
A MatchCriteria that matches by object name.
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.
Interface for listeners interested in FaceObjectProviders related events.
static final int REPLACE_WITH_OBJECT_CHOOSER
Index for replaceWithBox: replace with object chooser selection.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
BaseObject< G, A, R, ?> getCursorSelection()
Returns the selected archetype (if the archetype chooser is active) or the game object selected by th...
A map view consists of a map grid and a map cursor, and is attached to a map control.
Definition: MapView.java:43
boolean isMulti()
Returns whether this Archetype is a multi-part object.
static JLabel newLabel(@NotNull final ActionBuilder actionBuilder, @NotNull final String key)
Creates a new JLabel from a resource key.
Common base interface for ObjectChoosers.
void beginTransaction(@NotNull String name)
Starts a new transaction.
A MatchCriteria that matches by archetype name.
Criteria for game object matchers.
Interface for listener interested in ObjectChooser events.
Common base implementation of CopyBuffer.
Definition: CopyBuffer.java:52
final FaceObjectProvidersListener faceObjectProvidersListener
The FaceObjectProvidersListener for detecting reloaded faces.
This dialog manages the replace action.