Archived
0

implement search for mission prototype

This commit is contained in:
iMoHax
2015-09-09 17:12:13 +03:00
parent e1d8dcc680
commit 5a658ce90a
17 changed files with 567 additions and 75 deletions

View File

@@ -0,0 +1,112 @@
package ru.trader.controllers;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import ru.trader.model.ItemModel;
import ru.trader.model.MarketModel;
import ru.trader.model.MissionModel;
import ru.trader.model.StationModel;
import ru.trader.view.support.NumberField;
import ru.trader.view.support.autocomplete.AutoCompletion;
import ru.trader.view.support.autocomplete.StationsProvider;
public class MissionsController {
@FXML
private TextField receiverText;
private AutoCompletion<StationModel> receiver;
@FXML
private NumberField courierProfit;
@FXML
private Button addCourierBtn;
@FXML
private TextField buyerText;
private AutoCompletion<StationModel> buyer;
@FXML
private NumberField deliveryCount;
@FXML
private NumberField deliveryProfit;
@FXML
private Button addDeliveryBtn;
@FXML
private ComboBox<ItemModel> item;
@FXML
private NumberField supplyCount;
@FXML
private NumberField supplyProfit;
@FXML
private Button addSupplyBtn;
private final ObservableList<MissionModel> missions;
private StationModel station;
public MissionsController() {
missions = FXCollections.observableArrayList();
}
@FXML
private void initialize(){
MarketModel world = MainController.getWorld();
StationsProvider provider = new StationsProvider(world);
receiver = new AutoCompletion<>(receiverText, provider, provider.getConverter());
provider = new StationsProvider(world);
buyer = new AutoCompletion<>(buyerText, provider, provider.getConverter());
item.setItems(world.itemsProperty());
addCourierBtn.disableProperty().bind(Bindings.createBooleanBinding(() -> receiver.getCompletion() == null, receiver.completionProperty())
.or(courierProfit.wrongProperty())
);
addDeliveryBtn.disableProperty().bind(Bindings.createBooleanBinding(() -> buyer.getCompletion() == null, buyer.completionProperty())
.or(deliveryCount.wrongProperty())
.or(deliveryProfit.wrongProperty())
);
addSupplyBtn.disableProperty().bind(Bindings.createBooleanBinding(() -> item.getValue() == null, item.valueProperty())
.or(supplyCount.wrongProperty())
.or(supplyProfit.wrongProperty())
);
}
@FXML
private void addCourier(){
StationModel station = receiver.getCompletion();
double profit = courierProfit.getValue().doubleValue();
if (station != null && profit > 0){
missions.add(new MissionModel(station, profit));
}
}
@FXML
private void addDelivery(){
StationModel station = buyer.getCompletion();
long count = deliveryCount.getValue().longValue();
double profit = deliveryProfit.getValue().doubleValue();
if (station != null && profit > 0){
missions.add(new MissionModel(station, count, profit));
}
}
@FXML
private void addSupply(){
ItemModel item = this.item.getValue();
long count = supplyCount.getValue().longValue();
double profit = supplyProfit.getValue().doubleValue();
if (item != null && profit > 0){
missions.add(new MissionModel(station, item, count, profit));
}
}
public ObservableList<MissionModel> getMissions() {
return missions;
}
public void setStation(StationModel station) {
this.station = station;
}
}

View File

@@ -1,8 +1,92 @@
package ru.trader.controllers;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import ru.trader.analysis.CrawlerSpecificator;
import ru.trader.model.*;
import ru.trader.view.support.autocomplete.AutoCompletion;
import ru.trader.view.support.autocomplete.SystemsProvider;
import java.util.Optional;
public class RouteSearchController {
@FXML
private TextField fromSystemText;
private AutoCompletion<SystemModel> fromSystem;
@FXML
private ComboBox<StationModel> fromStation;
@FXML
private TextField toSystemText;
private AutoCompletion<SystemModel> toSystem;
@FXML
private ComboBox<StationModel> toStation;
@FXML
private ListView<MissionModel> missionsList;
@FXML
private MissionsController missionsController;
private MarketModel market;
private ProfileModel profile;
@FXML
private void initialize(){
init();
missionsList.setItems(missionsController.getMissions());
initListeners();
}
private void init(){
market = MainController.getMarket();
profile = MainController.getProfile();
SystemsProvider provider = new SystemsProvider(market);
fromSystem = new AutoCompletion<>(fromSystemText, provider, provider.getConverter());
provider = new SystemsProvider(market);
toSystem = new AutoCompletion<>(toSystemText, provider, provider.getConverter());
}
private void initListeners(){
fromSystem.completionProperty().addListener((ov, o , n) -> fromStation.setItems(n.getStationsList()));
fromStation.valueProperty().addListener((ov, o , n) -> missionsController.setStation(n));
toSystem.completionProperty().addListener((ov, o , n) -> toStation.setItems(n.getStationsList()));
}
@FXML
private void currentAsFrom(){
fromSystem.setValue(profile.getSystem());
fromStation.setValue(profile.getStation());
}
@FXML
private void loop(){
toSystem.setValue(fromSystem.getCompletion());
toStation.setValue(fromStation.getValue());
}
@FXML
private void search(){
SystemModel f = fromSystem.getCompletion();
SystemModel t = toSystem.getCompletion();
StationModel fS = fromStation.getValue();
StationModel tS = toStation.getValue();
CrawlerSpecificator specificator = new CrawlerSpecificator();
missionsList.getItems().forEach(m -> m.toSpecification(specificator));
market.getRoutes(f, fS, t, tS, profile.getBalance(), specificator, routes -> {
Optional<RouteModel> path = Screeners.showRouters(routes);
if (path.isPresent()){
}
});
}
@FXML
private void removeMission(){
int index = missionsList.getSelectionModel().getSelectedIndex();
if (index >= 0){
missionsList.getItems().remove(index);
}
}
}

View File

@@ -11,6 +11,7 @@ import javafx.scene.control.ComboBox;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableView;
import ru.trader.Main;
import ru.trader.analysis.CrawlerSpecificator;
import ru.trader.model.*;
import ru.trader.model.support.ChangeMarketListener;
import ru.trader.view.support.NumberField;
@@ -219,7 +220,7 @@ public class RouterController {
public void rebuild(){
if (route != null){
RouteModel r = market.getRoute(route, balance.getValue().doubleValue());
RouteModel r = market.getRoute(route);
if (r != null){
route = r;
orders.clear();
@@ -269,7 +270,7 @@ public class RouterController {
SystemModel t = target.getValue();
StationModel sS = sStation.getValue();
StationModel tS = tStation.getValue();
market.getRoutes(s, sS, t, tS, totalBalance.getValue().doubleValue(), routes -> {
market.getRoutes(s, sS, t, tS, totalBalance.getValue().doubleValue(), new CrawlerSpecificator(), routes -> {
Optional<RouteModel> path = Screeners.showRouters(routes);
if (path.isPresent()){
orders.addAll(path.get().getOrders());

View File

@@ -10,8 +10,9 @@ import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.trader.World;
import ru.trader.analysis.AnalysisCallBack;
import ru.trader.analysis.CrawlerSpecificator;
import ru.trader.analysis.Route;
import ru.trader.controllers.MainController;
import ru.trader.controllers.ProgressController;
import ru.trader.controllers.Screeners;
import ru.trader.core.*;
@@ -21,7 +22,6 @@ import ru.trader.services.OrdersSearchTask;
import ru.trader.services.RoutesSearchTask;
import ru.trader.view.support.Localization;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Consumer;
@@ -35,6 +35,7 @@ public class MarketModel {
private final Notificator notificator;
private final ListProperty<SystemModel> systems;
private final ListProperty<StationModel> stations;
// with NONE_SYSTEM
private ListProperty<SystemModel> systemsList;
private final ListProperty<GroupModel> groups;
@@ -51,6 +52,7 @@ public class MarketModel {
systems = new SimpleListProperty<>(BindingsHelper.observableList(market.get(), modeler::get));
systemsList = new SimpleListProperty<>(FXCollections.observableArrayList(ModelFabric.NONE_SYSTEM));
systemsList.addAll(systems);
stations = new SimpleListProperty<>(BindingsHelper.observableList(market.getVendors(), modeler::get));
systems.addListener(SYSTEMS_CHANGE_LISTENER);
}
@@ -69,10 +71,6 @@ public class MarketModel {
return analyzer;
}
public MarketAnalyzer getAnalyzer(AnalysisCallBack callback) {
return analyzer.changeCallBack(callback);
}
public ModelFabric getModeler() {
return modeler;
}
@@ -88,6 +86,10 @@ public class MarketModel {
return systemsList;
}
public ReadOnlyListProperty<StationModel> stationsProperty() {
return stations;
}
public SystemModel get(String name){
Place s = market.get(name);
if (s == null){
@@ -101,16 +103,33 @@ public class MarketModel {
LOG.info("Add system {} to market {}", system, this);
notificator.sendAdd(system);
systems.add(system);
stations.addAll(system.getStations());
return system;
}
public void remove(SystemModel system) {
LOG.info("Remove system {} from market {}", system, this);
notificator.sendRemove(system);
stations.removeAll(system.getStations());
market.remove(system.getSystem());
systems.remove(system);
}
StationModel addStation(SystemModel system, String name) {
StationModel station = modeler.get(system.getSystem().addVendor(name));
LOG.info("Add station {} to system {}", station, system);
stations.add(station);
notificator.sendAdd(station);
return station;
}
void removeStation(StationModel station) {
LOG.info("Remove station {} from system {}", station, station.getSystem());
notificator.sendRemove(station);
stations.remove(station);
station.getSystem().getSystem().remove(station.getStation());
}
public ReadOnlyListProperty<GroupModel> getGroups(){
return groups;
}
@@ -146,7 +165,7 @@ public class MarketModel {
return BindingsHelper.observableList(analyzer.getOffers(offerType, item.getItem(), filter), modeler::get);
}
public Collection<StationModel> getStations(MarketFilter filter){
public ObservableList<StationModel> getStations(MarketFilter filter){
return BindingsHelper.observableList(analyzer.getVendors(filter), modeler::get);
}
@@ -164,12 +183,14 @@ public class MarketModel {
public void getOrders(SystemModel from, StationModel stationFrom, SystemModel to, StationModel stationTo, double balance, Consumer<ObservableList<OrderModel>> result) {
ProgressController progress = new ProgressController(Screeners.getMainScreen(), Localization.getString("analyzer.orders.title"));
Profile profile = MainController.getProfile().getProfile().copy();
profile.setBalance(balance);
OrdersSearchTask task = new OrdersSearchTask(this,
from == null || from == ModelFabric.NONE_SYSTEM ? null : from.getSystem(),
stationFrom == null || stationFrom == ModelFabric.NONE_STATION ? null : stationFrom.getStation(),
to == null || to == ModelFabric.NONE_SYSTEM ? null : to.getSystem(),
stationTo == null || stationTo == ModelFabric.NONE_STATION ? null : stationTo.getStation(),
balance
profile
);
progress.run(task, order -> {
@@ -186,22 +207,17 @@ public class MarketModel {
getOrders(ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, balance, result);
}
public void getRoutes(SystemModel from, double balance, Consumer<ObservableList<RouteModel>> result){
getRoutes(from, ModelFabric.NONE_STATION, ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, balance, result);
}
public void getRoutes(SystemModel from, SystemModel to, double balance, Consumer<ObservableList<RouteModel>> result){
getRoutes(from, ModelFabric.NONE_STATION, to, ModelFabric.NONE_STATION, balance, result);
}
public void getRoutes(SystemModel from, StationModel stationFrom, SystemModel to, StationModel stationTo, double balance, Consumer<ObservableList<RouteModel>> result) {
public void getRoutes(SystemModel from, StationModel stationFrom, SystemModel to, StationModel stationTo, double balance, CrawlerSpecificator specificator, Consumer<ObservableList<RouteModel>> result) {
ProgressController progress = new ProgressController(Screeners.getMainScreen(), Localization.getString("analyzer.routes.title"));
Profile profile = MainController.getProfile().getProfile().copy();
profile.setBalance(balance);
RoutesSearchTask task = new RoutesSearchTask(this,
from == null || from == ModelFabric.NONE_SYSTEM ? null : from.getSystem(),
stationFrom == null || stationFrom == ModelFabric.NONE_STATION ? null : stationFrom.getStation(),
to == null || to == ModelFabric.NONE_SYSTEM ? null : to.getSystem(),
stationTo == null || stationTo == ModelFabric.NONE_STATION ? null : stationTo.getStation(),
balance
profile,
specificator
);
progress.run(task, route -> {
@@ -215,15 +231,13 @@ public class MarketModel {
}
public void getTopRoutes(double balance, Consumer<ObservableList<RouteModel>> result){
getRoutes(ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, balance, result);
getRoutes(ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, ModelFabric.NONE_SYSTEM, ModelFabric.NONE_STATION, balance, new CrawlerSpecificator(), result);
}
public RouteModel getRoute(RouteModel path, double balance) {
//TODO: implement
/*Route r = analyzer.getRoute(path.getRoute());
public RouteModel getRoute(RouteModel path) {
Route r = analyzer.getRoute(path.getRoute().getVendors());
if (r == null) return null;
return modeler.get(r);*/
return null;
return modeler.get(r);
}
Route _getPath(OrderModel order) {

View File

@@ -0,0 +1,80 @@
package ru.trader.model;
import ru.trader.analysis.CrawlerSpecificator;
import ru.trader.store.simple.SimpleOffer;
public class MissionModel {
private final StationModel target;
private final ItemModel item;
private final long count;
private final double profit;
public MissionModel(StationModel target, double profit) {
this.target = target;
this.profit = profit;
item = null;
count = 0;
}
public MissionModel(StationModel target, long count, double profit) {
this.target = target;
this.count = count;
this.profit = profit;
this.item = null;
}
public MissionModel(StationModel target, ItemModel item, long count, double profit) {
this.target = target;
this.item = item;
this.count = count;
this.profit = profit;
}
public StationModel getTarget() {
return target;
}
public ItemModel getItem() {
return item;
}
public long getCount() {
return count;
}
public double getProfit() {
return profit;
}
public boolean isSupply(){
return item != null;
}
public boolean isDelivery(){
return count > 0;
}
public boolean isCourier(){
return count == 0;
}
@Override
public String toString() {
return "MissionModel{" +
"target=" + target +
", item=" + item +
", count=" + count +
", profit=" + profit +
"} ";
}
public void toSpecification(CrawlerSpecificator specificator){
if (isSupply()){
specificator.buy(SimpleOffer.fakeBuy(target.getStation(), item.getItem(), profit/count, count));
} else
if (isCourier() || isDelivery()){
specificator.add(target.getStation(), true);
}
}
}

View File

@@ -79,6 +79,10 @@ public class ProfileModel {
}
Profile getProfile() {
return profile;
}
public MarketModel getMarket() {
return market;
}

View File

@@ -97,16 +97,11 @@ public class SystemModel {
}
public StationModel add(String name){
StationModel station = market.getModeler().get(system.addVendor(name));
LOG.info("Add station {} to system {}", station, this);
market.getNotificator().sendAdd(station);
return station;
return market.addStation(this, name);
}
public void remove(StationModel station) {
LOG.info("Remove station {} from system {}", station, this);
market.getNotificator().sendRemove(station);
system.remove(station.getStation());
market.removeStation(station);
}
public boolean isEmpty(){

View File

@@ -6,7 +6,9 @@ import javafx.beans.property.SimpleLongProperty;
import javafx.concurrent.Task;
import ru.trader.analysis.AnalysisCallBack;
import ru.trader.core.MarketAnalyzer;
import ru.trader.core.Profile;
import ru.trader.model.MarketModel;
import ru.trader.model.ProfileModel;
import ru.trader.view.support.Localization;
import java.util.concurrent.atomic.AtomicLong;
@@ -19,11 +21,11 @@ public abstract class AnalyzerTask<T> extends Task<T> {
private final LongProperty found;
private final AtomicReference<Long> foundUpdate;
public AnalyzerTask(MarketModel market) {
public AnalyzerTask(MarketModel market, Profile profile) {
foundUpdate = new AtomicReference<>((long) 0);
found = new SimpleLongProperty(0);
callback = new AnalyzerCallBack();
analyzer = market.getAnalyzer(callback);
analyzer = market.getAnalyzer().newInstance(profile, callback);
}
public long getFound() {

View File

@@ -2,6 +2,7 @@ package ru.trader.services;
import ru.trader.core.Order;
import ru.trader.core.Place;
import ru.trader.core.Profile;
import ru.trader.core.Vendor;
import ru.trader.model.MarketModel;
@@ -12,15 +13,13 @@ public class OrdersSearchTask extends AnalyzerTask<Collection<Order>>{
private final Vendor stationFrom;
private final Place to;
private final Vendor stationTo;
private final double balance;
public OrdersSearchTask(MarketModel market, Place from, Vendor stationFrom, Place to, Vendor stationTo, double balance) {
super(market);
public OrdersSearchTask(MarketModel market, Place from, Vendor stationFrom, Place to, Vendor stationTo, Profile profile) {
super(market, profile);
this.from = from;
this.stationFrom = stationFrom;
this.to = to;
this.stationTo = stationTo;
this.balance = balance;
}
@Override

View File

@@ -1,7 +1,9 @@
package ru.trader.services;
import ru.trader.analysis.CrawlerSpecificator;
import ru.trader.analysis.Route;
import ru.trader.core.Place;
import ru.trader.core.Profile;
import ru.trader.core.Vendor;
import ru.trader.model.MarketModel;
@@ -12,14 +14,18 @@ public class RoutesSearchTask extends AnalyzerTask<Collection<Route>>{
private final Vendor stationFrom;
private final Place to;
private final Vendor stationTo;
private final CrawlerSpecificator specificator;
public RoutesSearchTask(MarketModel market, Place from, Vendor stationFrom, Place to, Vendor stationTo, double balance) {
super(market);
public RoutesSearchTask(MarketModel market, Place from, Vendor stationFrom, Place to, Vendor stationTo, Profile profile, CrawlerSpecificator specificator) {
super(market, profile);
this.from = from;
this.stationFrom = stationFrom;
this.to = to;
this.stationTo = stationTo;
market.getAnalyzer().getProfile().setBalance(balance);
this.specificator = specificator;
if (stationTo != null){
specificator.target(stationTo);
}
}
@Override
@@ -28,23 +34,23 @@ public class RoutesSearchTask extends AnalyzerTask<Collection<Route>>{
if (stationFrom != null) {
if (stationTo != null) {
routes = analyzer.getRoutes(stationFrom, stationTo);
routes = analyzer.getRoutes(stationFrom, stationTo, specificator);
} else {
if (to != null) {
routes = analyzer.getRoutes(stationFrom, to);
routes = analyzer.getRoutes(stationFrom, to, specificator);
} else {
routes = analyzer.getLoops(stationFrom, 100);
routes = analyzer.getRoutes(stationFrom, specificator);
}
}
} else {
if (stationTo != null) {
routes = analyzer.getRoutes(from, stationTo);
routes = analyzer.getRoutes(from, specificator);
} else {
if (to != null) {
routes = analyzer.getRoutes(from, to);
routes = analyzer.getRoutes(from, to, specificator);
} else {
if (from != null){
routes = analyzer.getRoutes(from);
routes = analyzer.getRoutes(from, specificator);
} else {
routes = analyzer.getTopRoutes(100);
}

View File

@@ -0,0 +1,22 @@
package ru.trader.view.support;
import javafx.util.StringConverter;
import ru.trader.controllers.MainController;
import ru.trader.model.ItemModel;
import java.util.Optional;
public class ItemStringConverter extends StringConverter<ItemModel> {
@Override
public String toString(ItemModel item) {
return item.getName();
}
@Override
public ItemModel fromString(String name) {
Optional<ItemModel> item = MainController.getWorld().itemsProperty().stream().filter(i -> i.getName().equals(name)).findAny();
return item.orElse(null);
}
}

View File

@@ -0,0 +1,35 @@
package ru.trader.view.support.autocomplete;
import javafx.util.StringConverter;
import ru.trader.model.MarketModel;
import ru.trader.model.StationModel;
import ru.trader.model.SystemModel;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StationStringConverter extends StringConverter<StationModel> {
private final MarketModel market;
private static final Pattern STATION_REGEXP = Pattern.compile("([^:]+): (.+)");
public StationStringConverter(MarketModel market) {
this.market = market;
}
@Override
public String toString(StationModel station) {
return station.getSystem().getName()+": "+station.getName();
}
@Override
public StationModel fromString(String name) {
Matcher matcher = STATION_REGEXP.matcher(name);
if (matcher.find()){
SystemModel system = market.get(matcher.group(1));
if (system != null){
return system.get(matcher.group(2));
}
}
return null;
}
}

View File

@@ -0,0 +1,36 @@
package ru.trader.view.support.autocomplete;
import javafx.util.StringConverter;
import org.controlsfx.control.textfield.AutoCompletionBinding;
import ru.trader.model.MarketModel;
import ru.trader.model.StationModel;
import java.util.Comparator;
public class StationsProvider extends CachedSuggestionProvider<StationModel> {
private final StringConverter<StationModel> converter;
private final Comparator<StationModel> comparator;
public StationsProvider(MarketModel market) {
super(market.stationsProperty());
converter = new StationStringConverter(market);
comparator = (s1, s2) -> converter.toString(s1).toLowerCase().compareTo(converter.toString(s2).toLowerCase());
}
@Override
protected Comparator<StationModel> getComparator() {
return comparator;
}
@Override
protected boolean isMatch(StationModel suggestion, AutoCompletionBinding.ISuggestionRequest request) {
String s = converter.toString(suggestion).toLowerCase();
return s.contains(request.getUserText().toLowerCase());
}
public StringConverter<StationModel> getConverter() {
return converter;
}
}

View File

@@ -0,0 +1,33 @@
package ru.trader.view.support.cells;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.util.Callback;
import ru.trader.model.ItemModel;
public class ItemListCell implements Callback<ListView<ItemModel>, ListCell<ItemModel>> {
@Override
public ListCell<ItemModel> call(ListView<ItemModel> param){
return new ListCell<ItemModel>(){
private ItemModel i;
@Override
public void updateItem(ItemModel item, boolean empty) {
super.updateItem(item, empty);
if (!empty){
if (i != item){
textProperty().unbind();
textProperty().bind(item.nameProperty());
i = item;
}
} else {
textProperty().unbind();
i = null;
setText(null);
setGraphic(null);
}
}
};
}
}

View File

@@ -61,6 +61,9 @@
<Tab text="%main.tab.search">
<fx:include source="search.fxml"/>
</Tab>
<Tab text="Маршрут">
<fx:include source="routeSearch.fxml"/>
</Tab>
</TabPane>
</center>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import org.controlsfx.glyphfont.Glyph?>
<?import ru.trader.view.support.NumberField?>
<?import ru.trader.view.support.cells.ItemListCell?>
<?import ru.trader.view.support.ItemStringConverter?>
<GridPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="ru.trader.controllers.MissionsController"
hgap="10" vgap="5">
<columnConstraints>
<ColumnConstraints minWidth="180" />
<ColumnConstraints minWidth="180" />
<ColumnConstraints minWidth="180" />
</columnConstraints>
<Label text="Курьерские"/>
<HBox GridPane.rowIndex="1">
<Label text="Доставить на:"/>
<TextField fx:id="receiverText" prefWidth="160"/>
</HBox>
<HBox GridPane.rowIndex="3">
<Label text="Прибыль:"/>
<NumberField fx:id="courierProfit" value="0" />
</HBox>
<Button fx:id="addCourierBtn" prefWidth="30" onAction="#addCourier" GridPane.rowIndex="4">
<graphic><Glyph text="FontAwesome|PLUS"/></graphic>
</Button>
<Label text="Доставка" GridPane.columnIndex="1"/>
<HBox GridPane.rowIndex="1" GridPane.columnIndex="1">
<Label text="Доставить на:"/>
<TextField fx:id="buyerText" prefWidth="160"/>
</HBox>
<HBox GridPane.rowIndex="2" GridPane.columnIndex="1">
<Label text="Кол-во:"/>
<NumberField fx:id="deliveryCount" value="0"/>
</HBox>
<HBox GridPane.rowIndex="3" GridPane.columnIndex="1">
<Label text="Прибыль:"/>
<NumberField fx:id="deliveryProfit" value="0"/>
</HBox>
<Button fx:id="addDeliveryBtn" prefWidth="30" onAction="#addDelivery" GridPane.rowIndex="4" GridPane.columnIndex="1">
<graphic><Glyph text="FontAwesome|PLUS"/></graphic>
</Button>
<Label text="Поставка" GridPane.columnIndex="2"/>
<HBox GridPane.rowIndex="1" GridPane.columnIndex="2">
<Label text="Товар:"/>
<ComboBox fx:id="item" prefWidth="160">
<cellFactory><ItemListCell /></cellFactory>
<converter><ItemStringConverter /></converter>
</ComboBox>
</HBox>
<HBox GridPane.rowIndex="2" GridPane.columnIndex="2">
<Label text="Кол-во:"/>
<NumberField fx:id="supplyCount" value="0"/>
</HBox>
<HBox GridPane.rowIndex="3" GridPane.columnIndex="2">
<Label text="Прибыль:"/>
<NumberField fx:id="supplyProfit" value="0"/>
</HBox>
<Button fx:id="addSupplyBtn" prefWidth="30" onAction="#addSupply" GridPane.rowIndex="4" GridPane.columnIndex="2">
<graphic><Glyph text="FontAwesome|PLUS"/></graphic>
</Button>
</GridPane>

View File

@@ -6,35 +6,30 @@
<?import ru.trader.view.support.cells.OfferListCell?>
<?import javafx.geometry.Insets?>
<?import ru.trader.view.support.NumberField?>
<HBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
<?import org.controlsfx.glyphfont.Glyph?>
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="ru.trader.controllers.RouteSearchController"
spacing="4" >
<Label text="Имя:" />
<TextField fx:id="name" />
<Label text="Баланс:" />
<NumberField fx:id="balance" />
<Label text="Система:" />
<TextField fx:id="systemText" />
<Button fx:id="btnAddSystem"/>
<Label text="Станция:" />
<ComboBox fx:id="station" />
<Button fx:id="btnAddStation"/>
<HBox>
<HBox>
<Label text="От:" />
<TextField fx:id="fromSystemText" />
<ComboBox fx:id="fromStation" />
<Button onAction="#currentAsFrom"/>
</HBox>
<HBox>
<Label text="До:" />
<TextField fx:id="toSystemText" />
<ComboBox fx:id="toStation" />
<Button onAction="#loop"/>
</HBox>
<Button prefWidth="80" text="Найти" onAction="#search" />
</HBox>
<VBox>
<fx:include fx:id="missions" source="missions.fxml"/>
<HBox>
<Label text="Трюм:" />
<NumberField fx:id="cargo" />
</HBox>
<HBox>
<Label text="Топливный бак:" />
<NumberField fx:id="tank" />
</HBox>
<HBox>
<Label text="Масса:" />
<NumberField fx:id="mass" />
</HBox>
<HBox>
<Label text="Двигатель:" />
<ComboBox fx:id="engine" />
<ListView fx:id="missionsList" />
<Button prefWidth="30" onAction="#removeMission"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
</HBox>
</VBox>
</HBox>
</VBox>