Archived
0

set deprecated landing pads services, uses station type

This commit is contained in:
Mo
2016-04-03 14:21:10 +03:00
parent 72f5cd2cf7
commit 58818ba2bc
10 changed files with 50 additions and 90 deletions

View File

@@ -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());
}

View File

@@ -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<STATION_TYPE> 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<SERVICE_TYPE> services;
@FXML
private TableView<ResultEntry> 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<StationModel> stations = market.getStations(filter);

View File

@@ -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());
}

View File

@@ -54,10 +54,10 @@
</columnConstraints>
<Label text="%label.station.type" />
<Label fx:id="type" GridPane.columnIndex="1"/>
<Label text="%label.government" GridPane.columnIndex="4" />
<Label fx:id="government" GridPane.columnIndex="5" />
<Label text="%label.allegiance" GridPane.columnIndex="2"/>
<Label fx:id="faction" GridPane.columnIndex="3" />
<Label text="%label.government" GridPane.columnIndex="2" />
<Label fx:id="government" GridPane.columnIndex="3" />
<Label text="%label.allegiance" GridPane.columnIndex="4"/>
<Label fx:id="faction" GridPane.columnIndex="5" />
<HBox GridPane.columnIndex="6" GridPane.rowSpan="2" alignment="TOP_RIGHT">
<Label fx:id="warningIcon" styleClass="icon-warning" prefWidth="30" prefHeight="30" visible="false">
<graphic><Glyph text="FontAwesome|WARNING" /></graphic>
@@ -80,8 +80,6 @@
<CheckBox fx:id="cbMunition" text="%services.MUNITION"/>
<CheckBox fx:id="cbOutfit" text="%services.OUTFIT"/>
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
<CheckBox fx:id="cbMediumLandpad" text="%services.MEDIUM_LANDPAD"/>
<CheckBox fx:id="cbLargeLandpad" text="%services.LARGE_LANDPAD"/>
</TilePane>
</GridPane>
<contextMenu><fx:reference source="editMenu"/></contextMenu>

View File

@@ -4,6 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.control.cell.*?>
<?import javafx.scene.layout.*?>
<?import org.controlsfx.control.CheckComboBox?>
<?import ru.trader.view.support.cells.DistanceCell?>
<?import ru.trader.view.support.NumberField?>
<GridPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
@@ -32,18 +33,10 @@
<ComboBox fx:id="items" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label text="%search.text.distance" GridPane.rowIndex="3" />
<NumberField fx:id="distance" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="%filter.services" GridPane.rowIndex="4" />
<TilePane hgap="5" vgap="5" tileAlignment="BASELINE_LEFT" prefColumns="2" GridPane.columnSpan="2" GridPane.rowIndex="5" >
<CheckBox fx:id="cbMarket" text="%services.MARKET"/>
<CheckBox fx:id="cbBlackMarket" text="%services.BLACK_MARKET"/>
<CheckBox fx:id="cbRefuel" text="%services.REFUEL"/>
<CheckBox fx:id="cbRepair" text="%services.REPAIR"/>
<CheckBox fx:id="cbMunition" text="%services.MUNITION"/>
<CheckBox fx:id="cbOutfit" text="%services.OUTFIT"/>
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
<CheckBox fx:id="cbMediumLandpad" text="%services.MEDIUM_LANDPAD"/>
<CheckBox fx:id="cbLargeLandpad" text="%services.LARGE_LANDPAD"/>
</TilePane>
<Label text="%label.station.type" GridPane.rowIndex="4"/>
<CheckComboBox fx:id="stationTypes" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="%label.station.services" GridPane.rowIndex="5"/>
<CheckComboBox fx:id="services" prefWidth="150" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
<Separator GridPane.columnSpan="2" GridPane.rowIndex="6" GridPane.margin="$separator_margin"/>
<HBox GridPane.columnSpan="2" GridPane.rowIndex="7" spacing="10" alignment="CENTER">
<Button text="%search.button.find" onAction="#searchStations" />

View File

@@ -56,8 +56,6 @@
</VBox>
<VBox spacing="5">
<CheckBox fx:id="cbShipyard" text="%services.SHIPYARD"/>
<CheckBox fx:id="cbMediumLandpad" text="%services.MEDIUM_LANDPAD"/>
<CheckBox fx:id="cbLargeLandpad" text="%services.LARGE_LANDPAD"/>
</VBox>
</HBox>
</VBox>