Compare commits

..

2 Commits

Author SHA1 Message Date
ccab9cd620 Fixes 2022-11-08 16:32:08 +04:00
5c582f70b3 Fixes 2022-11-08 16:19:52 +04:00
3 changed files with 12 additions and 2 deletions

View File

@ -157,12 +157,14 @@ public class FormMapWithSetArtilleries extends JFrame {
buttonShowDeleted.addActionListener(e -> {
if (!deletedObjects.empty()) {
DrawingObjectArtillery deleted = (DrawingObjectArtillery) deletedObjects.pop();
FormArtillery dialog = new FormArtillery(deleted == null ? null : deleted.getArtillery());
FormArtillery dialog = new FormArtillery(deleted.getArtillery());
dialog.setSize(800, 500);
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "Стек удалённых объектов пуст", "Провал", JOptionPane.INFORMATION_MESSAGE);
}
});

View File

@ -7,7 +7,7 @@ public class MapWithSetArtilleriesGeneric<T extends IDrawingObject, U extends Ab
public final int _pictureHeight;
public final int _placeSizeWidth = 210;
public final int _placeSizeHeight = 90;
private final SetArtilleriesGeneric<T> _setArtilleries;
public final SetArtilleriesGeneric<T> _setArtilleries;
private final U _map;
public MapWithSetArtilleriesGeneric(int picWidth, int picHeight, U map) {

View File

@ -30,4 +30,12 @@ public class MapsCollection {
public MapWithSetArtilleriesGeneric<IDrawingObject, AbstractMap> getMap(String name) {
return _mapsStorage.getOrDefault(name, null);
}
public IDrawingObject getArtillery(String mapName, int index) {
var map = _mapsStorage.getOrDefault(mapName, null);
if (map != null) {
return map._setArtilleries.get(index);
}
return null;
}
}