add minimum supply and minimum demand to vendor filter
This commit is contained in:
@@ -15,7 +15,9 @@ import ru.trader.model.ItemModel;
|
||||
import ru.trader.model.MarketModel;
|
||||
import ru.trader.model.ModelFabric;
|
||||
import ru.trader.view.support.Localization;
|
||||
import ru.trader.view.support.NumberField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -35,6 +37,11 @@ public class VendorFilterController {
|
||||
private CheckBox cbSkipIllegal;
|
||||
@FXML
|
||||
private CheckBox cbIllegalOnly;
|
||||
@FXML
|
||||
private NumberField minSupply;
|
||||
@FXML
|
||||
private NumberField minDemand;
|
||||
|
||||
|
||||
private VendorFilter filter;
|
||||
private Dialog<VendorFilter> dlg;
|
||||
@@ -56,7 +63,9 @@ public class VendorFilterController {
|
||||
int column = -1;
|
||||
int row = -1;
|
||||
GroupModel currentGroup = null;
|
||||
for (ItemModel item : items) {
|
||||
ArrayList<ItemModel> sortedItems = new ArrayList<>(items);
|
||||
sortedItems.sort((i1, i2) -> i1.getGroup().getName().compareTo(i2.getGroup().getName()));
|
||||
for (ItemModel item : sortedItems) {
|
||||
row++;
|
||||
if (column == -1 || !Objects.equals(currentGroup, item.getGroup())){
|
||||
column++;
|
||||
@@ -97,6 +106,8 @@ public class VendorFilterController {
|
||||
cbDontBuy.setSelected(filter.isDontBuy());
|
||||
fillCheckboxes(sellCbs, filter.getSellExcludes());
|
||||
fillCheckboxes(buyCbs, filter.getBuyExcludes());
|
||||
minSupply.setValue(filter.getMinSupply());
|
||||
minDemand.setValue(filter.getMinDemand());
|
||||
}
|
||||
|
||||
private void fillCheckboxes(Pane checkboxes, Collection<Item> excludes) {
|
||||
@@ -115,6 +126,8 @@ public class VendorFilterController {
|
||||
|
||||
private void save() {
|
||||
LOG.trace("Old filter", filter);
|
||||
filter.setMinSupply(minSupply.getValue().longValue());
|
||||
filter.setMinDemand(minDemand.getValue().longValue());
|
||||
filter.setIllegalOnly(cbIllegalOnly.isSelected());
|
||||
filter.setSkipIllegal(cbSkipIllegal.isSelected());
|
||||
filter.dontSell(cbDontSell.isSelected());
|
||||
|
||||
@@ -234,6 +234,8 @@ filter.stations.notBuy=Don't buy
|
||||
filter.stations.notSell=Don't sell
|
||||
filter.stations.label.notBuy=Don't buy:
|
||||
filter.stations.label.notSell=Don't sell:
|
||||
filter.stations.label.minSupply=Minimum supply:
|
||||
filter.stations.label.minDemand=Minimum demand:
|
||||
|
||||
# analyzer progress
|
||||
analyzer.orders.title=Search orders
|
||||
|
||||
@@ -233,6 +233,8 @@ filter.stations.notBuy=\u041D\u0435 \u043F\u043E\u043A\u0443\u043F\u0430\u0442\u
|
||||
filter.stations.notSell=\u041D\u0435 \u043F\u0440\u043E\u0434\u0430\u0432\u0430\u0442\u044C
|
||||
filter.stations.label.notBuy=\u041D\u0435 \u043F\u043E\u043A\u0443\u043F\u0430\u0442\u044C:
|
||||
filter.stations.label.notSell=\u041D\u0435 \u043F\u0440\u043E\u0434\u0430\u0432\u0430\u0442\u044C:
|
||||
filter.stations.label.minSupply=\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0437\u0430\u043F\u0430\u0441:
|
||||
filter.stations.label.minDemand=\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0441\u043F\u0440\u043E\u0441:
|
||||
|
||||
# analyzer progress
|
||||
analyzer.orders.title=\u041F\u043E\u0438\u0441\u043A \u0437\u0430\u043A\u0430\u0437\u043E\u0432
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import ru.trader.view.support.NumberField?>
|
||||
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ru.trader.controllers.VendorFilterController"
|
||||
styleClass="dialog" spacing="10">
|
||||
<HBox spacing="10">
|
||||
<CheckBox fx:id="cbIllegalOnly" text="%filter.stations.illegalOnly"/>
|
||||
<CheckBox fx:id="cbSkipIllegal" text="%filter.stations.legalOnly"/>
|
||||
<CheckBox fx:id="cbSkipIllegal" text="%filter.stations.legalOnly" prefWidth="200" />
|
||||
<CheckBox fx:id="cbDontSell" text="%filter.stations.notBuy" prefWidth="120" />
|
||||
<Label text="%filter.stations.label.minSupply" prefWidth="120" />
|
||||
<NumberField fx:id="minSupply" prefWidth="120" />
|
||||
</HBox>
|
||||
<HBox spacing="10">
|
||||
<CheckBox fx:id="cbDontSell" text="%filter.stations.notBuy"/>
|
||||
<CheckBox fx:id="cbDontBuy" text="%filter.stations.notSell"/>
|
||||
<CheckBox fx:id="cbIllegalOnly" text="%filter.stations.illegalOnly" prefWidth="200" />
|
||||
<CheckBox fx:id="cbDontBuy" text="%filter.stations.notSell" prefWidth="120" />
|
||||
<Label text="%filter.stations.label.minDemand" prefWidth="120" />
|
||||
<NumberField fx:id="minDemand" prefWidth="120" />
|
||||
</HBox>
|
||||
<VBox spacing="4">
|
||||
<Label text="%filter.stations.label.notBuy"/>
|
||||
<ScrollPane maxHeight="200" maxWidth="400">
|
||||
<ScrollPane maxHeight="200" maxWidth="600">
|
||||
<GridPane fx:id="sellCbs" hgap="5" vgap="5"/>
|
||||
</ScrollPane>
|
||||
</VBox>
|
||||
<VBox spacing="4">
|
||||
<Label text="%filter.stations.label.notSell"/>
|
||||
<ScrollPane maxHeight="200" maxWidth="400">
|
||||
<ScrollPane maxHeight="200" maxWidth="600">
|
||||
<GridPane fx:id="buyCbs" hgap="5" vgap="5"/>
|
||||
</ScrollPane>
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user