done lab 6

This commit is contained in:
ZakenChannel 2024-05-05 13:35:05 +04:00
parent 2cdbfa66e5
commit 2df2b62be9
16 changed files with 525 additions and 287 deletions

View File

@ -5,7 +5,6 @@ import com.projectairfighter.drawnings.*;
import com.projectairfighter.entities.EntityAirFighter;
import com.projectairfighter.entities.EntityWarPlane;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
@ -34,7 +33,7 @@ public class FormConstructor extends Application {
private Constructor<EntityWarPlane, IDrawableExtras> constructor;
@FXML
private void generatePlane(ActionEvent event) {
private void generatePlane() {
if (constructor == null) {
constructor = createAirFighterDrawable();
}
@ -55,7 +54,7 @@ public class FormConstructor extends Application {
}
@FXML
public void buttonGoToForm(ActionEvent event) {
public void buttonGoToForm() {
FormWarPlaneCollection formWarPlaneCollection = FormWarPlaneCollection.getFormWarPlaneCollection();
if (drawningWarPlane != null && formWarPlaneCollection != null) {
formWarPlaneCollection.createObject(drawningWarPlane);
@ -71,44 +70,45 @@ public class FormConstructor extends Application {
canvas = (Canvas) loader.getNamespace().get("canvas");
Scene scene = new Scene(root, 900, 500);
primaryStage.setTitle("Информация о самолете");
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
}
private Constructor<EntityWarPlane, IDrawableExtras> createAirFighterDrawable() {
Constructor<EntityWarPlane, IDrawableExtras> drawable = new Constructor<>();
for (int i = 0; i < 3; i++) {
EntityWarPlane plane = createRandomPlane();
if (plane == null) return null;
drawable.addAirFighter(plane);
drawable.addDrawingEngines(plane.getEngineDrawing());
}
return drawable;
}
private EntityWarPlane createRandomPlane() {
Random random = new Random();
int randomPlane = random.nextInt(1, 3);
IDrawableExtras[] engineDrawings = {
new EllipticalEngineDrawing(),
new TriangleEngineDrawing(),
new RectangleEngineDrawing()
};
Random random = new Random();
for (int i = 0; i < 3; i++) {
EntityWarPlane plane = createRandomPlane();
if (plane == null) return null;
drawable.addAirFighter(plane);
IDrawableExtras engineDrawing = engineDrawings[random.nextInt(engineDrawings.length)];
IDrawableExtras engineDrawing = engineDrawings[new Random().nextInt(engineDrawings.length)];
engineDrawing.setCountEngines(random.nextInt(7));
drawable.addDrawingEngines(engineDrawing);
}
return drawable;
}
private EntityWarPlane createRandomPlane() {
Random random = new Random();
int randomPlane = random.nextInt(1, 3);
return switch (randomPlane) {
case 1 -> new EntityWarPlane(random.nextInt(200) + 100,
random.nextInt(2000) + 1000,
getColor());
getColor(), engineDrawing);
case 2 -> new EntityAirFighter(
random.nextInt(200) + 100,
random.nextInt(2000) + 1000,
getColor(),
engineDrawing,
getColor(),
random.nextBoolean(),
random.nextBoolean());

View File

@ -17,6 +17,7 @@ import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.net.URL;
import java.util.Random;
import java.util.ResourceBundle;
public class FormPlaneConfig extends Application implements Initializable {
@ -53,25 +54,23 @@ public class FormPlaneConfig extends Application implements Initializable {
});
countEngine.valueProperty().addListener((obs, oldVal, newVal) -> {
if (plane != null && plane.getEngineDrawing() != null) {
if (plane != null && plane.entityWarPlane.getEngineDrawing() != null) {
canvas.getGraphicsContext2D().clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
plane.getEngineDrawing().setCountEngines(newVal);
plane.entityWarPlane.getEngineDrawing().setCountEngines(newVal);
drawObject();
}
});
checkBoxRockets.selectedProperty().addListener((obs, wasSelected, isSelected) -> {
if (plane instanceof DrawningAirFighter) {
EntityAirFighter fighter = (EntityAirFighter) plane.entityWarPlane;
fighter.setBodyRockets(isSelected);
((EntityAirFighter) plane.entityWarPlane).setBodyRockets(isSelected);
drawObject();
}
});
checkBoxWings.selectedProperty().addListener((obs, wasSelected, isSelected) -> {
if (plane instanceof DrawningAirFighter) {
EntityAirFighter fighter = (EntityAirFighter) plane.entityWarPlane;
fighter.setAdditionalWings(isSelected);
((EntityAirFighter) plane.entityWarPlane).setAdditionalWings(isSelected);
drawObject();
}
});
@ -87,6 +86,7 @@ public class FormPlaneConfig extends Application implements Initializable {
canvas = (Canvas) loader.getNamespace().get("canvas");
Scene scene = new Scene(root, 799, 251);
stage.setTitle("Создание объекта");
stage.setResizable(false);
stage.setScene(scene);
stage.show();
}
@ -194,35 +194,46 @@ public class FormPlaneConfig extends Application implements Initializable {
if (db.hasString()) {
String droppedText = db.getString();
if (engine == null) {
IDrawableExtras[] engineDrawings = {
new EllipticalEngineDrawing(),
new TriangleEngineDrawing(),
new RectangleEngineDrawing()
};
engine = engineDrawings[new Random().nextInt(engineDrawings.length)];
engine.setCountEngines(countEngine.getValue());
}
switch (droppedText) {
case "Простой":
plane = new DrawningWarPlane(speed.getValue(), weight.getValue(), Color.WHITE);
plane.getEngineDrawing().setCountEngines(countEngine.getValue());
plane = new DrawningWarPlane(speed.getValue(), weight.getValue(), Color.WHITE, engine);
success = true;
break;
case "Продвинутый":
plane = new DrawningAirFighter(speed.getValue(), weight.getValue(), Color.WHITE, Color.BLACK, checkBoxRockets.isSelected(), checkBoxWings.isSelected());
plane.getEngineDrawing().setCountEngines(countEngine.getValue());
plane = new DrawningAirFighter(speed.getValue(), weight.getValue(), Color.WHITE, engine, Color.BLACK, checkBoxRockets.isSelected(), checkBoxWings.isSelected());
success = true;
break;
case "Прямоугольная":
engine = new RectangleEngineDrawing();
engine.setCountEngines(countEngine.getValue());
plane.setEngineDrawing(engine);
plane.entityWarPlane.setEngineDrawing(engine);
plane.entityWarPlane.setEngineDrawing(engine);
engine.drawEngine(canvas.getGraphicsContext2D(), plane.entityWarPlane.getBodyColor(), 0, 0);
success = true;
break;
case "Треугольная":
engine = new TriangleEngineDrawing();
engine.setCountEngines(countEngine.getValue());
plane.setEngineDrawing(engine);
plane.entityWarPlane.setEngineDrawing(engine);
plane.entityWarPlane.setEngineDrawing(engine);
engine.drawEngine(canvas.getGraphicsContext2D(), plane.entityWarPlane.getBodyColor(), 0, 0);
success = true;
break;
case "Овальная":
engine = new EllipticalEngineDrawing();
engine.setCountEngines(countEngine.getValue());
plane.setEngineDrawing(engine);
plane.entityWarPlane.setEngineDrawing(engine);
plane.entityWarPlane.setEngineDrawing(engine);
engine.drawEngine(canvas.getGraphicsContext2D(), plane.entityWarPlane.getBodyColor(), 0, 0);
success = true;
break;

View File

@ -3,16 +3,21 @@ package com.projectairfighter;
import com.projectairfighter.collectiongenericobjects.*;
import com.projectairfighter.drawnings.DrawningWarPlane;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Random;
@ -68,7 +73,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
private void comboBoxSelectorCompany(ActionEvent event) {
private void comboBoxSelectorCompany() {
splitPane.getItems().get(1).setDisable(true);
}
@ -85,7 +90,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
private void buttonRemovePlaneClicked(ActionEvent event) {
private void buttonRemovePlaneClicked() {
String text = textBox.getText();
if (text == null || text.isEmpty() || company == null) return;
@ -110,14 +115,14 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
private void buttonRefresh(ActionEvent event) {
private void buttonRefresh() {
if (company == null) return;
company.show(canvasWarPlane);
}
@FXML
private void buttonGoToCheck(ActionEvent event) {
private void buttonGoToCheck() {
if (company == null) return;
DrawningWarPlane warPlane = null;
@ -136,7 +141,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
private void buttonGoFormConstructor(ActionEvent event) {
private void buttonGoFormConstructor() {
if (company == null) return;
try {
@ -154,7 +159,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
private void buttonGoToFormWithDeleteObject(ActionEvent event){
private void buttonGoToFormWithDeleteObject() {
if (!removedPlanesStack.isEmpty()) {
goToFormAirFighter(removedPlanesStack.get(new Random().nextInt(0, removedPlanesStack.size())));
} else {
@ -164,7 +169,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
private void buttonGoToFormCreate(ActionEvent event) {
private void buttonGoToFormCreate() {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("FormPlaneConfig.fxml"));
Parent root = loader.load();
@ -177,7 +182,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
}
private void goToFormAirFighter(DrawningWarPlane plane){
private void goToFormAirFighter(DrawningWarPlane plane) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("FormAirFighter.fxml"));
Parent root = loader.load();
@ -192,7 +197,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
void buttonCollectionAdd(ActionEvent event) {
void buttonCollectionAdd() {
if (textFieldCollectionName.getText().isEmpty() || (!radioButtonList.isSelected() && !radioButtonMassive.isSelected())) {
showError("Не все данные заполнены");
return;
@ -210,7 +215,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
void buttonCollectionDel(ActionEvent event) {
void buttonCollectionDel() {
if (listViewCollection.getSelectionModel().getSelectedIndex() < 0 || listViewCollection.getSelectionModel().getSelectedItem() == null) {
showError("Коллекция не выбрана");
return;
@ -228,9 +233,99 @@ public class FormWarPlaneCollection extends Application implements Initializable
refreshListBoxItems();
}
/**
* Обработка нажатия "Сохранение"
*/
@FXML
private void saveToolStripMenuItem() {
Stage mainStage = (Stage) splitPane.getScene().getWindow();
Stage dialog = new Stage();
dialog.setResizable(false);
dialog.initOwner(mainStage);
dialog.initModality(Modality.APPLICATION_MODAL); // Блокируем доступ к основному окну
dialog.setTitle("Выберите коллекцию для сохранения");
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
ToggleGroup toggleGroup = new ToggleGroup();
for (String collection : listViewCollection.getItems()) {
RadioButton radioButton = new RadioButton(collection);
radioButton.setPadding(new Insets(5));
radioButton.setToggleGroup(toggleGroup);
layout.getChildren().add(radioButton);
}
RadioButton allCollections = new RadioButton("Все коллекции");
Button submitButton = new Button("Сохранить");
allCollections.setToggleGroup(toggleGroup);
layout.getChildren().addAll(allCollections, submitButton);
submitButton.setOnAction(e -> {
if (toggleGroup.getSelectedToggle() == null || storageCollection.keys().isEmpty()) {
showError("Не выбрана коллекция или выбранная коллекция пуста");
return;
}
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Сохранить данные");
fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("Text Files (*.txt)", "*.txt")
);
File selectedFile = fileChooser.showSaveDialog(null);
if (selectedFile != null) {
boolean success;
RadioButton selectedRadioButton = (RadioButton) toggleGroup.getSelectedToggle();
if (selectedRadioButton.getText().equals("Все коллекции"))
success = storageCollection.saveData(selectedFile.getAbsolutePath());
else
success = storageCollection.saveData(selectedFile.getAbsolutePath(), selectedRadioButton.getText());
if (success) {
showAlert("Сохранение прошло успешно", "Результат", Alert.AlertType.INFORMATION);
} else {
showAlert("Не сохранилось", "Результат", Alert.AlertType.ERROR);
}
}
dialog.close(); // Закрыть диалог после сохранения
});
Scene scene = new Scene(layout, 250, 200);
dialog.setScene(scene);
dialog.showAndWait(); // Показываем диалог и ждем закрытия
}
/**
* Обработка кнопки загрузки
*/
@FXML
private void loadToolStripMenuItem() {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Открыть текстовый файл");
// Настройка фильтра расширений для выбора только текстовых файлов
FileChooser.ExtensionFilter txtFilter = new FileChooser.ExtensionFilter("Text Files (*.txt)", "*.txt");
fileChooser.getExtensionFilters().add(txtFilter);
// Отображение диалога открытия файла
File selectedFile = fileChooser.showOpenDialog(null);
if (selectedFile != null) {
boolean success = storageCollection.loadData(selectedFile.getAbsolutePath());
if (success) {
refreshListBoxItems();
showAlert("Загрузка прошла успешно", "Результат", Alert.AlertType.INFORMATION);
} else {
showAlert("Загрузка не выполнена", "Результат", Alert.AlertType.ERROR);
}
}
}
private void refreshListBoxItems() {
listViewCollection.getItems().clear();
for (String colName : storageCollection.Keys()) {
for (String colName : storageCollection.keys()) {
if (colName != null && !colName.isEmpty()) {
listViewCollection.getItems().add(colName);
}
@ -238,7 +333,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
}
@FXML
void buttonCreateCompany(ActionEvent event) {
void buttonCreateCompany() {
if (listViewCollection.getSelectionModel().getSelectedIndex() < 0 || listViewCollection.getSelectionModel().getSelectedItem() == null) {
showAlert("Коллекция не выбрана");
return;
@ -275,6 +370,14 @@ public class FormWarPlaneCollection extends Application implements Initializable
alert.showAndWait();
}
private void showAlert(String message, String title, Alert.AlertType alertType) {
Alert alert = new Alert(alertType);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(message);
alert.showAndWait();
}
private void showError(String message) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Ошибка");
@ -295,6 +398,7 @@ public class FormWarPlaneCollection extends Application implements Initializable
comboBox.getItems().addAll("Хранилище");
Scene scene = new Scene(root, 1292, 795);
primaryStage.setTitle("Коллекция истребителей");
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
}

View File

@ -30,14 +30,12 @@ public class Constructor<T extends EntityWarPlane, U extends IDrawableExtras> {
public DrawningWarPlane createDrawing() {
Random rnd = new Random();
int entityIndex = rnd.nextInt(0, 3);
int engineCount = rnd.nextInt(0, 3);
T selectedPlane = planes.get(entityIndex);
U selectedEngineCount = drawingEngines.get(engineCount);
return (selectedPlane instanceof EntityAirFighter) ?
new DrawningAirFighter((EntityAirFighter) selectedPlane, selectedEngineCount) :
new DrawningWarPlane(selectedPlane, selectedEngineCount);
new DrawningAirFighter((EntityAirFighter) selectedPlane) :
new DrawningWarPlane(selectedPlane);
}
public String getPlaneInfo() {

View File

@ -1,6 +1,7 @@
package com.projectairfighter.collectiongenericobjects;
import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class MassiveGenericObjects<T> implements ICollectionGenericObjects<T> {
private T[] collection;
@ -11,7 +12,6 @@ public class MassiveGenericObjects<T> implements ICollectionGenericObjects<T> {
}
@Override
@SuppressWarnings("unchecked")
public int getMaxCount() {
return collection.length;
}
@ -21,14 +21,9 @@ public class MassiveGenericObjects<T> implements ICollectionGenericObjects<T> {
public void setMaxCount(int value){
if (value < 0) return;
// Создание нового массива с указанным размером
T[] newCollection = (T[]) new Object[value];
// Копирование элементов из старого массива в новый
// Math.min используется, чтобы избежать ArrayIndexOutOfBoundsException
System.arraycopy(collection, 0, newCollection, 0, Math.min(collection.length, value));
// Присваивание нового массива переменной collection
collection = newCollection;
}
@ -45,6 +40,36 @@ public class MassiveGenericObjects<T> implements ICollectionGenericObjects<T> {
return null;
}
@Override
public CollectionType getCollectionType() {
return CollectionType.Massive;
}
@Override
public Iterable<T> getItems() {
return () -> new Iterator<>() {
private int currentIndex = 0;
@Override
public boolean hasNext() {
return currentIndex < collection.length;
}
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return collection[currentIndex++];
}
@Override
public void remove() {
throw new UnsupportedOperationException("Оператор не поддерживается");
}
};
}
@Override
public int insert(T obj) {
return insert(obj, 0);

View File

@ -4,7 +4,9 @@ import com.projectairfighter.drawnings.DrawningWarPlane;
import java.io.*;
import java.util.*;
import java.util.regex.Pattern;
import static com.projectairfighter.drawnings.ExtensionDrawningPlane.createDrawingPlane;
import static com.projectairfighter.drawnings.ExtensionDrawningPlane.getDataForSave;
/**
* Класс-хранилище коллекций.
@ -20,17 +22,32 @@ public class StorageCollection<T extends DrawningWarPlane> {
/**
* Ключевое слово, с которого должен начинаться файл
*/
private final String collectionKey = "CollectionsStorage";
private static final String COLLECTION_KEY = "CollectionsStorage";
/**
* Разделитель для записи ключа и значения элемента словаря
* Ключевое слово, с которого должен начинаться файл с определнной коллекцией
*/
private final String separatorForKeyValue = "|";
private static final String COLLECTION_KEY_ONE_COL = "OneCollectionsStorage";
/**
* Разделитель для записей коллекции данных в файл
* Разделитель для записи ключа и значения элемента словаря для всех коллекций
*/
private final String separatorItems = ";";
private static final String SEPARATOR_FOR_KEY_VALUE_ALL_COL = "&";
/**
* Разделитель для записи ключа и значения элемента словаря для определенной коллекции
*/
private static final String SEPARATOR_FOR_KEY_VALUE_ONE_TYPE_COL = "#";
/**
* Разделитель для записей коллекции данных в файл для всех коллекций
*/
private static final String SEPARATOR_ITEMS_ALL_COL = ";";
/**
* Разделитель для записей коллекции данных в файл для определенных коллекций
*/
private static final String SEPARATOR_ITEMS_ONE_TYPE_COL = "/";
/**
@ -38,12 +55,12 @@ public class StorageCollection<T extends DrawningWarPlane> {
*
* @return Список названий коллекций.
*/
public List<String> Keys() {
public List<String> keys() {
return new ArrayList<>(storages.keySet());
}
/**
* Конструктор.
* Конструктор
*/
public StorageCollection() {
storages = new HashMap<>();
@ -67,7 +84,6 @@ public class StorageCollection<T extends DrawningWarPlane> {
return;
case List:
storages.put(name, new ListGenericObjects<>());
return;
}
}
@ -104,89 +120,173 @@ public class StorageCollection<T extends DrawningWarPlane> {
* @return Элемент коллекции или null, если коллекция с данным названием отсутствует или индекс некорректен.
*/
public T getElement(String name, int index) {
return this.get(name).get(index);
return storages.get(name).get(index);
}
/**
* Сохранение информации в файл
* @param path путь к файлу
* @return результат сохранения
*/
public boolean saveData(String filename) {
// Проверяем, не пуста ли коллекция
public boolean saveData(String path) {
if (storages.isEmpty()) {
return false;
}
// Удаляем файл, если он существует
File file = new File(filename);
File file = new File(path);
if (file.exists()) {
file.delete();
}
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
// Записываем ключ коллекции
writer.write(collectionKey);
writer.write(COLLECTION_KEY);
writer.newLine();
// Итерируемся по коллекциям
for (Map.Entry<String, ICollectionGenericObjects<T>> entry : storages.entrySet()) {
// Пропускаем пустые коллекции
if (entry.getValue().getCount() == 0) {
continue;
}
StringBuilder sb = new StringBuilder();
sb.append(entry.getKey());
sb.append(separatorForKeyValue);
sb.append(SEPARATOR_FOR_KEY_VALUE_ALL_COL);
sb.append(entry.getValue().getCollectionType());
sb.append(separatorForKeyValue);
sb.append(SEPARATOR_FOR_KEY_VALUE_ALL_COL);
sb.append(entry.getValue().getMaxCount());
sb.append(separatorForKeyValue);
sb.append(SEPARATOR_FOR_KEY_VALUE_ALL_COL);
// Сохраняем каждый элемент в коллекции
for (T item : entry.getValue().getItems()) {
if (item == null) continue; // Проверка на null
String data = item.getDataForSave();
if (data == null || data.isEmpty()) continue;
if (item == null) continue;
String data = getDataForSave(item);
if (data.isEmpty()) continue;
sb.append(data);
sb.append(separatorItems);
sb.append(SEPARATOR_ITEMS_ALL_COL);
}
writer.write(sb.toString());
writer.newLine();
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* Сохранение в файл по имени коллекции
* @param path путь к файлу
* @param collection название коллекции для сохранения
* @return результат сохранения
*/
public boolean saveData(String path, String collection) {
if (storages.isEmpty()) {
return false;
}
File file = new File(path);
if (file.exists()) {
file.delete();
}
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
writer.write(COLLECTION_KEY_ONE_COL);
writer.newLine();
for (Map.Entry<String, ICollectionGenericObjects<T>> entry : storages.entrySet()) {
if ((entry.getValue().getCount() == 0) || !entry.getKey().equals(collection)) {
continue;
}
StringBuilder sb = new StringBuilder();
sb.append(entry.getKey());
sb.append(SEPARATOR_FOR_KEY_VALUE_ONE_TYPE_COL);
sb.append(entry.getValue().getCollectionType());
sb.append(SEPARATOR_FOR_KEY_VALUE_ONE_TYPE_COL);
sb.append(entry.getValue().getMaxCount());
sb.append(SEPARATOR_FOR_KEY_VALUE_ONE_TYPE_COL);
for (T item : entry.getValue().getItems()) {
if (item == null) continue;
String data = getDataForSave(item);
if (data.isEmpty()) continue;
sb.append(data);
sb.append(SEPARATOR_ITEMS_ONE_TYPE_COL);
}
writer.write(sb.toString());
writer.newLine();
}
} catch (IOException e) {
return false;
}
return true;
}
/**
* Обработка данных в файле
* @param recordLine строка данных для обработки
* @param keyValueSeparator разделитель ключа и значения
* @param itemSeparator разделитель свойств
* @return результат обработки
*/
@SuppressWarnings("unchecked")
private boolean processRecord(String recordLine, String keyValueSeparator, String itemSeparator) {
String[] record = recordLine.split(keyValueSeparator);
if (record.length != 4) {
return false;
}
CollectionType collectionType = CollectionType.valueOf(record[1]);
ICollectionGenericObjects<T> collection = StorageCollection.createCollection(collectionType);
if (collection == null) {
return false;
}
collection.setMaxCount(Integer.parseInt(record[2]));
String[] items = record[3].split(itemSeparator, -1);
for (String elem : items) {
T ship = (T) createDrawingPlane(elem);
if (ship != null && collection.insert(ship) == -1) {
return false;
}
}
storages.put(record[0], collection);
return true;
}
/**
* Загрузка информации из файла
*/
public boolean loadData(String filename) {
if (!new File(filename).exists()) return false;
try (BufferedReader reader = new BufferedReader(new FileReader(filename))) {
String str = reader.readLine();
if (!collectionKey.equals(str)) return false;
storages.clear();
while ((str = reader.readLine()) != null) {
String[] record = str.split(Pattern.quote(separatorForKeyValue));
if (record.length != 4) continue;
CollectionType collectionType = CollectionType.valueOf(record[1]);
ICollectionGenericObjects<T> collection = createCollection(collectionType);
if (collection == null) return false;
collection.setMaxCount(Integer.parseInt(record[2]));
String[] items = record[3].split(Pattern.quote(separatorItems));
for (String item : items) {
T plane = item.createDrawingPlane(); // Нужна соответствующая реализация
if (plane != null && collection.insert(plane) == -1) return false;
File file = new File(filename);
if (!file.exists()) {
return false;
}
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
String str = br.readLine();
if (str == null) {
return false;
}
if (str.equals(COLLECTION_KEY)) {
while ((str = br.readLine()) != null) {
if (!processRecord(str, SEPARATOR_FOR_KEY_VALUE_ALL_COL, SEPARATOR_ITEMS_ALL_COL)) {
return false;
}
}
} else if (str.equals(COLLECTION_KEY_ONE_COL)) {
while ((str = br.readLine()) != null) {
if (!processRecord(str, SEPARATOR_FOR_KEY_VALUE_ONE_TYPE_COL, SEPARATOR_ITEMS_ONE_TYPE_COL)) {
return false;
}
}
storages.put(record[0], collection);
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
@ -195,14 +295,11 @@ public class StorageCollection<T extends DrawningWarPlane> {
/**
* Создание коллекции по типу
*/
private ICollectionGenericObjects<T> createCollection(CollectionType collectionType) {
switch (collectionType) {
case Massive:
return new MassiveGenericObjects<>();
case List:
return new ListGenericObjects<>();
default:
return null;
}
private static <T> ICollectionGenericObjects<T> createCollection(CollectionType collectionType) {
return switch (collectionType) {
case Massive -> new MassiveGenericObjects<>();
case List -> new ListGenericObjects<>();
default -> null;
};
}
}

View File

@ -6,14 +6,14 @@ import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class DrawningAirFighter extends DrawningWarPlane {
public DrawningAirFighter(int speed, double weight, Color bodyColor, Color
public DrawningAirFighter(int speed, double weight, Color bodyColor, IDrawableExtras engineDrawing, Color
additionalColor, boolean bodyRockets, boolean additionalWings) {
super(speed, weight, bodyColor);
entityWarPlane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, bodyRockets, additionalWings);
super(speed, weight, bodyColor, engineDrawing);
entityWarPlane = new EntityAirFighter(speed, weight, bodyColor, engineDrawing, additionalColor, bodyRockets, additionalWings);
}
public DrawningAirFighter(EntityAirFighter entityAirFighter, IDrawableExtras engineDrawing) {
super(entityAirFighter, engineDrawing);
public DrawningAirFighter(EntityAirFighter entityAirFighter) {
super(entityAirFighter);
}
public DrawningAirFighter(EntityWarPlane entityWarPlane) {

View File

@ -1,12 +1,9 @@
package com.projectairfighter.drawnings;
import com.projectairfighter.entities.EntityAirFighter;
import com.projectairfighter.entities.EntityWarPlane;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import java.util.Random;
public class DrawningWarPlane {
// Сущность
public EntityWarPlane entityWarPlane;
@ -21,28 +18,18 @@ public class DrawningWarPlane {
private final int drawningAirFighterWidth = 157;
private final int drawningAirFighterHeight = 140;
private IDrawableExtras engineDrawing;
public Integer getPosX(){
return startPosX;
}
public Integer getPosY(){
return startPosY;
}
public IDrawableExtras getEngineDrawing() {
return engineDrawing;
}
public int getWidth(){
return drawningAirFighterWidth;
}
public int getHeight(){
return drawningAirFighterHeight;
}
public void setEngineDrawing(IDrawableExtras engineDrawing) {
this.engineDrawing = engineDrawing;
}
protected DrawningWarPlane() {
pictureWidth = 0;
@ -51,22 +38,8 @@ public class DrawningWarPlane {
startPosY = null;
}
public DrawningWarPlane(int speed, double weight, Color bodyColor) {
entityWarPlane = new EntityWarPlane(speed, weight, bodyColor);
IDrawableExtras[] engineDrawings = {
new EllipticalEngineDrawing(),
new TriangleEngineDrawing(),
new RectangleEngineDrawing()
};
Random random = new Random();
engineDrawing = engineDrawings[random.nextInt(engineDrawings.length)];
engineDrawing.setCountEngines(random.nextInt(7));
}
public DrawningWarPlane(EntityWarPlane entityWarPlane, IDrawableExtras engineDrawing){
this.entityWarPlane = entityWarPlane;
this.engineDrawing = engineDrawing;
public DrawningWarPlane(int speed, double weight, Color bodyColor, IDrawableExtras engineDrawing) {
entityWarPlane = new EntityWarPlane(speed, weight, bodyColor, engineDrawing);
}
public DrawningWarPlane(EntityWarPlane entityWarPlane)
@ -75,8 +48,8 @@ public class DrawningWarPlane {
this.entityWarPlane = entityWarPlane;
}
public boolean setPictureSize(int width, int height) {
if (width <= drawningAirFighterWidth || height <= drawningAirFighterHeight) return false;
public void setPictureSize(int width, int height) {
if (width <= drawningAirFighterWidth || height <= drawningAirFighterHeight) return;
pictureWidth = width;
pictureHeight = height;
if (startPosX != null && startPosY != null) {
@ -87,7 +60,6 @@ public class DrawningWarPlane {
startPosY = pictureHeight - drawningAirFighterHeight;
}
}
return true;
}
public void setPosition(int x, int y) {
@ -141,7 +113,7 @@ public class DrawningWarPlane {
if (pictureWidth == 0 || pictureHeight == 0) return;
engineDrawing.drawEngine(gc, entityWarPlane.getBodyColor(), getPosX(), getPosY());
entityWarPlane.getEngineDrawing().drawEngine(gc, entityWarPlane.getBodyColor(), getPosX(), getPosY());
gc.setFill(entityWarPlane.getBodyColor());
gc.setStroke(entityWarPlane.getBodyColor());
@ -173,29 +145,4 @@ public class DrawningWarPlane {
new double[]{startPosY + 79, startPosY + 133, startPosY + 133, startPosY + 79}, 4);
}
private static final String SEPARATOR_FOR_OBJECT = ":";
/**
* Создание объекта из строки.
*
* @param info Строка с данными для создания объекта.
* @return Объект.
*/
public static DrawningWarPlane createDrawingPlane(String info) {
String[] strs = info.split(SEPARATOR_FOR_OBJECT);
EntityWarPlane plane = EntityAirFighter.createEntityAirFighter(strs);
if (plane != null) {
return new DrawningAirFighter(plane);
}
plane = EntityWarPlane.createEntityWarPlane(strs);
if (plane != null) {
return new DrawningWarPlane(plane);
}
return null;
}
public abstract String getDataForSave();
}

View File

@ -21,6 +21,11 @@ public class EllipticalEngineDrawing implements IDrawableExtras {
}
}
@Override
public int getCountEngines() {
return engineCount.getValue();
}
@Override
public void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY) {
double engineWidth = 6;

View File

@ -9,5 +9,5 @@ public enum EngineCount {
EngineCount(int Value) { value = Value; }
public int getValue() { return value; }
public int getValue() { return this.value; }
}

View File

@ -5,5 +5,6 @@ import javafx.scene.paint.Color;
public interface IDrawableExtras {
void setCountEngines(int countEngines);
int getCountEngines();
void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY);
}

View File

@ -21,6 +21,11 @@ public class RectangleEngineDrawing implements IDrawableExtras {
}
}
@Override
public int getCountEngines() {
return engineCount.getValue();
}
@Override
public void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY) {
double engineWidth = 6;

View File

@ -21,6 +21,11 @@ public class TriangleEngineDrawing implements IDrawableExtras {
}
}
@Override
public int getCountEngines() {
return engineCount.getValue();
}
@Override
public void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY) {
double engineWidth = 6;

View File

@ -1,5 +1,9 @@
package com.projectairfighter.entities;
import com.projectairfighter.drawnings.EllipticalEngineDrawing;
import com.projectairfighter.drawnings.IDrawableExtras;
import com.projectairfighter.drawnings.RectangleEngineDrawing;
import com.projectairfighter.drawnings.TriangleEngineDrawing;
import javafx.scene.paint.Color;
public class EntityAirFighter extends EntityWarPlane {
@ -34,9 +38,9 @@ public class EntityAirFighter extends EntityWarPlane {
}
// Конструктор
public EntityAirFighter(int speed, double weight, Color bodyColor, Color
public EntityAirFighter(int speed, double weight, Color bodyColor, IDrawableExtras engineDrawing, Color
additionalColor, boolean bodyRockets, boolean additionalWings){
super(speed, weight, bodyColor);
super(speed, weight, bodyColor, engineDrawing);
this.additionalColor = additionalColor;
this.bodyRockets = bodyRockets;
this.additionalWings = additionalWings;
@ -51,10 +55,12 @@ public class EntityAirFighter extends EntityWarPlane {
"EntityAirFighter",
String.valueOf(getSpeed()),
String.valueOf(getWeight()),
getBodyColor().toString(), // Здесь предполагается, что у вас есть метод toString, возвращающий имя цвета
getAdditionalColor().toString(), // Аналогично для дополнительного цвета
String.valueOf(hasBodyRockets()),
String.valueOf(hasAdditionalWings())
String.valueOf(getBodyColor()),
String.valueOf(getEngineDrawing().getCountEngines()),
getEngineDrawing().getClass().getSimpleName(),
String.valueOf(additionalColor),
String.valueOf(bodyRockets),
String.valueOf(additionalWings)
};
}
@ -62,17 +68,26 @@ public class EntityAirFighter extends EntityWarPlane {
* Создание объекта из массива строк
*/
public static EntityAirFighter createEntityAirFighter(String[] strs) {
if (strs.length != 7 || !"EntityAirFighter".equals(strs[0])) {
if (strs.length != 9 || !"EntityAirFighter".equals(strs[0])) {
return null;
}
int speed = Integer.parseInt(strs[1]);
double weight = Double.parseDouble(strs[2]);
Color bodyColor = Color.valueOf(strs[3]); // Здесь предполагается, что Color.valueOf может обработать имя цвета
Color additionalColor = Color.valueOf(strs[4]);
boolean bodyRockets = Boolean.parseBoolean(strs[5]);
boolean additionalWings = Boolean.parseBoolean(strs[6]);
Color bodyColor = Color.valueOf(strs[3]);
int countEngines = Integer.parseInt(strs[4]);
IDrawableExtras engineDrawing = switch (strs[5]) {
case "RectangleEngineDrawing" -> new RectangleEngineDrawing();
case "TriangleEngineDrawing" -> new TriangleEngineDrawing();
case "EllipticalEngineDrawing" -> new EllipticalEngineDrawing();
default -> null;
};
Color additionalColor = Color.valueOf(strs[6]);
boolean bodyRockets = Boolean.parseBoolean(strs[7]);
boolean additionalWings = Boolean.parseBoolean(strs[8]);
return new EntityAirFighter(speed, weight, bodyColor, additionalColor, bodyRockets, additionalWings);
if (engineDrawing != null) engineDrawing.setCountEngines(countEngines);
return new EntityAirFighter(speed, weight, bodyColor, engineDrawing, additionalColor, bodyRockets, additionalWings);
}
}

View File

@ -1,5 +1,9 @@
package com.projectairfighter.entities;
import com.projectairfighter.drawnings.EllipticalEngineDrawing;
import com.projectairfighter.drawnings.IDrawableExtras;
import com.projectairfighter.drawnings.RectangleEngineDrawing;
import com.projectairfighter.drawnings.TriangleEngineDrawing;
import javafx.scene.paint.Color;
public class EntityWarPlane {
@ -9,31 +13,43 @@ public class EntityWarPlane {
private double weight;
// Основной цвет
private Color bodyColor;
private IDrawableExtras engineDrawing;
public double getStep() {
return speed * 100 / weight;
}
public Color getBodyColor() {
return bodyColor;
}
public int getSpeed() {
return speed;
}
public double getWeight() {
return weight;
}
public IDrawableExtras getEngineDrawing() {
return engineDrawing;
}
public void setBodyColor(Color bodyColor)
{
this.bodyColor = bodyColor;
}
public void setSpeed(int speed) {
this.speed = speed;
}
public void setWeight(double weight) {
this.weight = weight;
}
public void setEngineDrawing(IDrawableExtras engineDrawing) {
this.engineDrawing = engineDrawing;
}
public EntityWarPlane(int speed, double weight, Color bodyColor){
public EntityWarPlane(int speed, double weight, Color bodyColor, IDrawableExtras engineDrawing){
this.speed = speed;
this.weight = weight;
this.bodyColor = bodyColor;
this.engineDrawing = engineDrawing;
}
/**
@ -44,7 +60,9 @@ public class EntityWarPlane {
"EntityWarPlane",
String.valueOf(speed),
String.valueOf(weight),
getBodyColor().toString()
getBodyColor().toString(),
String.valueOf(engineDrawing.getCountEngines()),
engineDrawing.getClass().getSimpleName()
};
}
@ -54,13 +72,23 @@ public class EntityWarPlane {
* @return Объект класса EntityWarPlane или null, если строка недействительна.
*/
public static EntityWarPlane createEntityWarPlane(String[] strs) {
if (strs.length != 4 || !strs[0].equals("EntityWarPlane")) {
if (strs.length != 6 || !strs[0].equals("EntityWarPlane")) {
return null;
}
int speed = Integer.parseInt(strs[1]);
double weight = Double.parseDouble(strs[2]);
Color bodyColor = Color.valueOf(strs[3]); // Должен быть реализован метод valueOf для Color
Color bodyColor = Color.valueOf(strs[3]);
int countEngine = Integer.parseInt(strs[4]);
IDrawableExtras engineDrawing = switch (strs[5]) {
case "RectangleEngineDrawing" -> new RectangleEngineDrawing();
case "TriangleEngineDrawing" -> new TriangleEngineDrawing();
case "EllipticalEngineDrawing" -> new EllipticalEngineDrawing();
default -> null;
};
return new EntityWarPlane(speed, weight, bodyColor);
if (engineDrawing != null) engineDrawing.setCountEngines(countEngine);
return new EntityWarPlane(speed, weight, bodyColor, engineDrawing);
}
}

View File

@ -1,97 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.input.KeyCodeCombination?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.canvas.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.input.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="795.0" prefWidth="1292.0" xmlns="http://javafx.com/javafx/19.0.2" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.projectairfighter.FormWarPlaneCollection">
<children>
<SplitPane dividerPositions="0.811965811965812" layoutX="1.0" layoutY="27.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="765.0" prefWidth="1292.0">
<items>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="795.0"
prefWidth="1292.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.projectairfighter.FormWarPlaneCollection">
<SplitPane dividerPositions="0.811965811965812" layoutX="1.0" layoutY="27.0" maxHeight="-Infinity"
maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="765.0" prefWidth="1292.0">
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="698.0" prefWidth="965.0">
<children>
<Canvas fx:id="canvasWarPlane" height="763.0" width="1044.0" />
</children>
<Canvas fx:id="canvasWarPlane" height="763.0" width="1044.0"/>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="196.0">
<children>
<SplitPane dividerPositions="0.43889618922470436" orientation="VERTICAL" prefHeight="763.0" prefWidth="237.0">
<items>
<SplitPane dividerPositions="0.43889618922470436" orientation="VERTICAL" prefHeight="763.0"
prefWidth="237.0">
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Инструменты" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="6.0" />
<TextField fx:id="textFieldCollectionName" layoutX="6.0" layoutY="49.0" prefHeight="25.0" prefWidth="224.0" />
<RadioButton fx:id="radioButtonMassive" layoutX="25.0" layoutY="77.0" mnemonicParsing="false" text="Массив">
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Инструменты" AnchorPane.leftAnchor="14.0"
AnchorPane.topAnchor="6.0"/>
<TextField fx:id="textFieldCollectionName" layoutX="6.0" layoutY="49.0" prefHeight="25.0"
prefWidth="224.0"/>
<RadioButton fx:id="radioButtonMassive" layoutX="25.0" layoutY="77.0" mnemonicParsing="false"
text="Массив">
<toggleGroup>
<ToggleGroup fx:id="toggle" />
<ToggleGroup fx:id="toggle"/>
</toggleGroup>
</RadioButton>
<RadioButton fx:id="radioButtonList" layoutX="141.0" layoutY="77.0" mnemonicParsing="false" text="Список" toggleGroup="$toggle" />
<Button layoutX="6.0" layoutY="101.0" mnemonicParsing="false" onAction="#buttonCollectionAdd" prefHeight="25.0" prefWidth="224.0" text="Добавить в коллекцию" />
<Button layoutX="6.0" layoutY="299.0" mnemonicParsing="false" onAction="#buttonCollectionDel" prefHeight="25.0" prefWidth="224.0" text="Удалить коллекцию" />
<ListView fx:id="listViewCollection" layoutX="6.0" layoutY="136.0" prefHeight="155.0" prefWidth="224.0" />
<Label layoutX="56.0" layoutY="26.0" text="Название коллекции" />
</children>
<RadioButton fx:id="radioButtonList" layoutX="141.0" layoutY="77.0" mnemonicParsing="false"
text="Список" toggleGroup="$toggle"/>
<Button layoutX="6.0" layoutY="101.0" mnemonicParsing="false" onAction="#buttonCollectionAdd"
prefHeight="25.0" prefWidth="224.0" text="Добавить в коллекцию"/>
<Button layoutX="6.0" layoutY="299.0" mnemonicParsing="false" onAction="#buttonCollectionDel"
prefHeight="25.0" prefWidth="224.0" text="Удалить коллекцию"/>
<ListView fx:id="listViewCollection" layoutX="6.0" layoutY="136.0" prefHeight="155.0"
prefWidth="224.0"/>
<Label layoutX="56.0" layoutY="26.0" text="Название коллекции"/>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<SplitPane fx:id="splitPane" dividerPositions="0.18691588785046728" layoutY="-8.0" orientation="VERTICAL" prefHeight="430.0" prefWidth="237.0">
<items>
<SplitPane fx:id="splitPane" dividerPositions="0.18691588785046728" layoutY="-8.0"
orientation="VERTICAL" prefHeight="430.0" prefWidth="237.0">
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="116.0" prefWidth="235.0">
<children>
<ComboBox fx:id="comboBox" layoutX="6.0" layoutY="15.0" onAction="#comboBoxSelectorCompany" prefHeight="25.0" prefWidth="224.0" />
<Button layoutX="6.0" layoutY="46.0" mnemonicParsing="false" onAction="#buttonCreateCompany" prefHeight="25.0" prefWidth="224.0" text="Создать компанию" />
</children>
<ComboBox fx:id="comboBox" layoutX="6.0" layoutY="15.0"
onAction="#comboBoxSelectorCompany" prefHeight="25.0"
prefWidth="224.0"/>
<Button layoutX="6.0" layoutY="46.0" mnemonicParsing="false"
onAction="#buttonCreateCompany" prefHeight="25.0" prefWidth="224.0"
text="Создать компанию"/>
</AnchorPane>
<AnchorPane disable="true" minHeight="0.0" minWidth="0.0" prefHeight="312.0" prefWidth="235.0">
<children>
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="5.0" layoutY="12.0" mnemonicParsing="false" onAction="#buttonGoToFormCreate" prefHeight="35.0" prefWidth="224.0" text="Добавление самолета" />
<TextField fx:id="textBox" layoutX="6.0" layoutY="132.0" prefHeight="25.0" prefWidth="224.0" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="162.0" mnemonicParsing="false" onAction="#buttonRemovePlaneClicked" prefHeight="35.0" prefWidth="224.0" text="Удалить истребитель" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="215.0" mnemonicParsing="false" onAction="#buttonGoToCheck" prefHeight="35.0" prefWidth="224.0" text="Передать на тесты" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="300.0" mnemonicParsing="false" onAction="#buttonRefresh" prefHeight="35.0" prefWidth="224.0" text="Обновить" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="90.0" mnemonicParsing="false" onAction="#buttonGoFormConstructor" prefHeight="35.0" prefWidth="224.0" text="Добавить через конструктор" />
<Button layoutX="6.0" layoutY="257.0" mnemonicParsing="false" onAction="#buttonGoToFormWithDeleteObject" prefHeight="35.0" text="Передать на тесты удаленный объект" />
</children>
<AnchorPane disable="true" minHeight="0.0" minWidth="0.0" prefHeight="312.0"
prefWidth="235.0">
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="5.0" layoutY="12.0"
mnemonicParsing="false" onAction="#buttonGoToFormCreate"
prefHeight="35.0" prefWidth="224.0" text="Добавление самолета"/>
<TextField fx:id="textBox" layoutX="6.0" layoutY="132.0" prefHeight="25.0"
prefWidth="224.0"/>
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="162.0"
mnemonicParsing="false" onAction="#buttonRemovePlaneClicked"
prefHeight="35.0" prefWidth="224.0" text="Удалить истребитель"/>
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="215.0"
mnemonicParsing="false" onAction="#buttonGoToCheck" prefHeight="35.0"
prefWidth="224.0" text="Передать на тесты"/>
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="300.0"
mnemonicParsing="false" onAction="#buttonRefresh" prefHeight="35.0"
prefWidth="224.0" text="Обновить"/>
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="90.0"
mnemonicParsing="false" onAction="#buttonGoFormConstructor"
prefHeight="35.0" prefWidth="224.0" text="Добавить через конструктор"/>
<Button layoutX="6.0" layoutY="257.0" mnemonicParsing="false"
onAction="#buttonGoToFormWithDeleteObject" prefHeight="35.0"
text="Передать на тесты удаленный объект"/>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
</items>
</SplitPane>
<MenuBar prefHeight="25.0" prefWidth="1292.0">
<menus>
<Menu mnemonicParsing="false" text="Файл">
<items>
<MenuItem mnemonicParsing="false" text="Сохранить">
<MenuItem mnemonicParsing="false" onAction="#saveToolStripMenuItem" text="Сохранить">
<accelerator>
<KeyCodeCombination alt="UP" code="S" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
</accelerator></MenuItem>
<MenuItem mnemonicParsing="false" text="Загрузить">
<accelerator>
<KeyCodeCombination alt="UP" code="L" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
<KeyCodeCombination alt="UP" code="S" control="DOWN" meta="UP" shift="UP" shortcut="UP"/>
</accelerator>
</MenuItem>
<MenuItem mnemonicParsing="false" onAction="#loadToolStripMenuItem" text="Загрузить">
<accelerator>
<KeyCodeCombination alt="UP" code="L" control="DOWN" meta="UP" shift="UP" shortcut="UP"/>
</accelerator>
</MenuItem>
</items>
</Menu>
</menus>
</MenuBar>
</children>
</AnchorPane>