This commit is contained in:
BlasphemyGod 2022-11-08 16:19:52 +04:00
parent e60990067a
commit 5c582f70b3
3 changed files with 14 additions and 9 deletions

View File

@ -155,15 +155,12 @@ 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(deletedObjects.empty() ? null : ((DrawingObjectArtillery)deletedObjects.pop()).getArtillery());
dialog.setSize(800, 500);
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
});
buttonLeft.addActionListener(e -> {

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;
}
}