From 58818ba2bc4bc031286226638adb567ab7a5403b Mon Sep 17 00:00:00 2001 From: Mo Date: Sun, 3 Apr 2016 14:21:10 +0300 Subject: [PATCH] set deprecated landing pads services, uses station type --- .../trader/controllers/OffersController.java | 8 ---- .../trader/controllers/SearchController.java | 37 ++++++------------- .../controllers/StationEditorController.java | 6 --- client/src/main/resources/view/offers.fxml | 10 ++--- client/src/main/resources/view/search.fxml | 17 +++------ client/src/main/resources/view/vEditor.fxml | 2 - .../java/ru/trader/core/SERVICE_TYPE.java | 6 ++- .../ru/trader/store/berkeley/MarketTest.java | 18 ++++----- .../ru/trader/maddavo/StationHandler.java | 17 ++++----- .../ru/trader/maddavo/StationImportTest.java | 19 ++++------ 10 files changed, 50 insertions(+), 90 deletions(-) diff --git a/client/src/main/java/ru/trader/controllers/OffersController.java b/client/src/main/java/ru/trader/controllers/OffersController.java index 912b7e6..95f0a71 100644 --- a/client/src/main/java/ru/trader/controllers/OffersController.java +++ b/client/src/main/java/ru/trader/controllers/OffersController.java @@ -62,10 +62,6 @@ public class OffersController { @FXML private CheckBox cbShipyard; @FXML - private CheckBox cbMediumLandpad; - @FXML - private CheckBox cbLargeLandpad; - @FXML private TitledPane stationPane; @FXML private Node warningIcon; @@ -153,8 +149,6 @@ public class OffersController { cbRepair.setSelected(false); cbOutfit.setSelected(false); cbShipyard.setSelected(false); - cbMediumLandpad.setSelected(false); - cbLargeLandpad.setSelected(false); if (!ModelFabric.isFake(station)){ type.setText(StationTypeStringConverter.toLocalizationString(station.getType())); faction.setText(FactionStringConverter.toLocalizationString(station.getFaction())); @@ -169,8 +163,6 @@ public class OffersController { cbRepair.setSelected(station.hasService(SERVICE_TYPE.REPAIR)); cbOutfit.setSelected(station.hasService(SERVICE_TYPE.OUTFIT)); cbShipyard.setSelected(station.hasService(SERVICE_TYPE.SHIPYARD)); - cbMediumLandpad.setSelected(station.hasService(SERVICE_TYPE.MEDIUM_LANDPAD)); - cbLargeLandpad.setSelected(station.hasService(SERVICE_TYPE.LARGE_LANDPAD)); sells.addAll(station.getSells()); buys.addAll(station.getBuys()); } diff --git a/client/src/main/java/ru/trader/controllers/SearchController.java b/client/src/main/java/ru/trader/controllers/SearchController.java index dcf61fe..8bae9d5 100644 --- a/client/src/main/java/ru/trader/controllers/SearchController.java +++ b/client/src/main/java/ru/trader/controllers/SearchController.java @@ -6,15 +6,19 @@ import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.util.StringConverter; +import org.controlsfx.control.CheckComboBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ru.trader.core.MarketFilter; import ru.trader.core.OFFER_TYPE; import ru.trader.core.SERVICE_TYPE; +import ru.trader.core.STATION_TYPE; import ru.trader.model.*; import ru.trader.model.support.BindingsHelper; import ru.trader.model.support.ChangeMarketListener; import ru.trader.view.support.NumberField; +import ru.trader.view.support.ServiceTypeStringConverter; +import ru.trader.view.support.StationTypeStringConverter; import ru.trader.view.support.autocomplete.AutoCompletion; import ru.trader.view.support.autocomplete.CachedSuggestionProvider; import ru.trader.view.support.autocomplete.SystemsProvider; @@ -39,23 +43,9 @@ public class SearchController { @FXML private NumberField distance; @FXML - private CheckBox cbMarket; + private CheckComboBox stationTypes; @FXML - private CheckBox cbBlackMarket; - @FXML - private CheckBox cbRefuel; - @FXML - private CheckBox cbRepair; - @FXML - private CheckBox cbMunition; - @FXML - private CheckBox cbOutfit; - @FXML - private CheckBox cbShipyard; - @FXML - private CheckBox cbMediumLandpad; - @FXML - private CheckBox cbLargeLandpad; + private CheckComboBox services; @FXML private TableView tblResults; @@ -68,6 +58,10 @@ public class SearchController { @FXML private void initialize() { init(); + stationTypes.setConverter(new StationTypeStringConverter()); + stationTypes.getItems().setAll(STATION_TYPE.values()); + services.setConverter(new ServiceTypeStringConverter()); + services.getItems().setAll(SERVICE_TYPE.values()); rbBuyer.setToggleGroup(offerType); rbBuyer.setUserData(OFFER_TYPE.BUY); rbSeller.setToggleGroup(offerType); @@ -114,15 +108,8 @@ public class SearchController { private void searchStations(){ MarketFilter filter = new MarketFilter(); filter.setDistance(distance.getValue().doubleValue()); - if (cbMarket.isSelected()) filter.add(SERVICE_TYPE.MARKET); else filter.remove(SERVICE_TYPE.MARKET); - if (cbBlackMarket.isSelected()) filter.add(SERVICE_TYPE.BLACK_MARKET); else filter.remove(SERVICE_TYPE.BLACK_MARKET); - if (cbRefuel.isSelected()) filter.add(SERVICE_TYPE.REFUEL); else filter.remove(SERVICE_TYPE.REFUEL); - if (cbMunition.isSelected()) filter.add(SERVICE_TYPE.MUNITION); else filter.remove(SERVICE_TYPE.MUNITION); - if (cbRepair.isSelected()) filter.add(SERVICE_TYPE.REPAIR); else filter.remove(SERVICE_TYPE.REPAIR); - if (cbOutfit.isSelected()) filter.add(SERVICE_TYPE.OUTFIT); else filter.remove(SERVICE_TYPE.OUTFIT); - if (cbShipyard.isSelected()) filter.add(SERVICE_TYPE.SHIPYARD); else filter.remove(SERVICE_TYPE.SHIPYARD); - if (cbMediumLandpad.isSelected()) filter.add(SERVICE_TYPE.MEDIUM_LANDPAD); else filter.remove(SERVICE_TYPE.MEDIUM_LANDPAD); - if (cbLargeLandpad.isSelected()) filter.add(SERVICE_TYPE.LARGE_LANDPAD); else filter.remove(SERVICE_TYPE.LARGE_LANDPAD); + stationTypes.getCheckModel().getCheckedItems().forEach(filter::add); + services.getCheckModel().getCheckedItems().forEach(filter::add); ItemModel item = items.getValue(); if (ModelFabric.isFake(item)){ Collection stations = market.getStations(filter); diff --git a/client/src/main/java/ru/trader/controllers/StationEditorController.java b/client/src/main/java/ru/trader/controllers/StationEditorController.java index a5ed59f..d919ea4 100644 --- a/client/src/main/java/ru/trader/controllers/StationEditorController.java +++ b/client/src/main/java/ru/trader/controllers/StationEditorController.java @@ -66,10 +66,6 @@ public class StationEditorController { private CheckBox cbOutfit; @FXML private CheckBox cbShipyard; - @FXML - private CheckBox cbMediumLandpad; - @FXML - private CheckBox cbLargeLandpad; private StationUpdater updater; @@ -128,8 +124,6 @@ public class StationEditorController { cbRepair.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.REPAIR)); cbOutfit.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.OUTFIT)); cbShipyard.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.SHIPYARD)); - cbMediumLandpad.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.MEDIUM_LANDPAD)); - cbLargeLandpad.selectedProperty().bindBidirectional(updater.serviceProperty(SERVICE_TYPE.LARGE_LANDPAD)); items.setItems(updater.getOffers()); } diff --git a/client/src/main/resources/view/offers.fxml b/client/src/main/resources/view/offers.fxml index bdab05c..d1b8d68 100644 --- a/client/src/main/resources/view/offers.fxml +++ b/client/src/main/resources/view/offers.fxml @@ -54,10 +54,10 @@