diff --git a/client/src/main/java/ru/trader/controllers/MainController.java b/client/src/main/java/ru/trader/controllers/MainController.java index 2e2b504..d4e1349 100644 --- a/client/src/main/java/ru/trader/controllers/MainController.java +++ b/client/src/main/java/ru/trader/controllers/MainController.java @@ -222,14 +222,14 @@ public class MainController { public void editSystem(ActionEvent actionEvent){ SystemModel system = offersController.getSystem(); - if (system != null) { + if (!ModelFabric.isFake(system)) { Screeners.showSystemsEditor(system); } } public void removeSystem(ActionEvent actionEvent){ SystemModel system = offersController.getSystem(); - if (system != null) { + if (!ModelFabric.isFake(system)) { Action res = Screeners.showConfirm(String.format(Localization.getString("dialog.confirm.remove"), system.getName())); if (res == Dialog.ACTION_YES) { market.remove(system); @@ -238,22 +238,22 @@ public class MainController { } public void addStation(ActionEvent actionEvent) { - SystemModel system = offersController.getSystem(); - if (system != null){ + SystemModel system = profile.getSystem(); + if (!ModelFabric.isFake(system)) { Screeners.showAddStation(offersController.getSystem()); } } public void editStation(ActionEvent actionEvent) { StationModel station = profile.getStation(); - if (station != null) { + if (!ModelFabric.isFake(station)) { Screeners.showEditStation(station); } } public void removeStation(ActionEvent actionEvent){ - StationModel station = offersController.getStation(); - if (station != null) { + StationModel station = profile.getStation(); + if (!ModelFabric.isFake(station)) { Action res = Screeners.showConfirm(String.format(Localization.getString("dialog.confirm.remove"), station.getName())); if (res == Dialog.ACTION_YES) { station.getSystem().remove(station); diff --git a/client/src/main/java/ru/trader/controllers/OffersController.java b/client/src/main/java/ru/trader/controllers/OffersController.java index 086c410..36a451b 100644 --- a/client/src/main/java/ru/trader/controllers/OffersController.java +++ b/client/src/main/java/ru/trader/controllers/OffersController.java @@ -5,6 +5,8 @@ import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.input.MouseButton; +import org.controlsfx.control.action.Action; +import org.controlsfx.dialog.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ru.trader.core.SERVICE_TYPE; @@ -13,6 +15,7 @@ import ru.trader.model.support.BindingsHelper; import ru.trader.model.support.ChangeMarketListener; import ru.trader.view.support.FactionStringConverter; import ru.trader.view.support.GovernmentStringConverter; +import ru.trader.view.support.Localization; import ru.trader.view.support.ViewUtils; import ru.trader.view.support.autocomplete.AutoCompletion; import ru.trader.view.support.autocomplete.CachedSuggestionProvider; @@ -204,6 +207,16 @@ public class OffersController { } } + @FXML + private void removeStation() { + StationModel s = getStation(); + if (!ModelFabric.isFake(s)){ + Action res = Screeners.showConfirm(String.format(Localization.getString("dialog.confirm.remove"), s.getName())); + if (res == org.controlsfx.dialog.Dialog.ACTION_YES) { + s.getSystem().remove(s); + } + } + } private void addOffer(OfferModel offer){ switch (offer.getType()){ diff --git a/client/src/main/resources/view/offers.fxml b/client/src/main/resources/view/offers.fxml index 4417744..8a258d2 100644 --- a/client/src/main/resources/view/offers.fxml +++ b/client/src/main/resources/view/offers.fxml @@ -28,6 +28,7 @@ +