<?xml version="1.0" encoding="UTF-8"?>


<?import javafx.scene.control.cell.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.HBox?>
<?import ru.trader.view.support.cells.DistanceCell?>
<?import ru.trader.view.support.cells.DoubleCell?>
<?import ru.trader.view.support.cells.PathRouteCell?>
<?import ru.trader.view.support.cells.TimeCell?>
<?import javafx.scene.layout.VBox?>
<?import ru.trader.view.support.cells.OfferCellValueImpl?>
<?import ru.trader.view.support.cells.OrderDecoratedRow?>
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
      fx:controller="ru.trader.controllers.PathsController" styleClass="dialog"
      prefWidth="1050">
    <TableView fx:id="tblPaths" editable="true">
        <columns>
            <TableColumn minWidth="600.0" text="%routes.path">
                <cellFactory><PathRouteCell /></cellFactory>
            </TableColumn>
            <TableColumn minWidth="70.0" text="%routes.jumps">
                <cellValueFactory><PropertyValueFactory property="jumps"/></cellValueFactory>
            </TableColumn>
            <TableColumn minWidth="70.0" text="%routes.refills">
                <cellValueFactory><PropertyValueFactory property="refuels"/></cellValueFactory>
            </TableColumn>
            <TableColumn minWidth="70.0" text="%routes.lands">
                <cellValueFactory><PropertyValueFactory property="lands"/></cellValueFactory>
            </TableColumn>
            <TableColumn minWidth="80.0" text="%market.order.distance">
                <cellFactory><DistanceCell /></cellFactory>
                <cellValueFactory><PropertyValueFactory property="distance"/></cellValueFactory>
            </TableColumn>
            <TableColumn minWidth="70.0" text="%market.order.profit">
                <cellValueFactory><PropertyValueFactory property="profit"/></cellValueFactory>
            </TableColumn>
            <TableColumn minWidth="70.0" text="%routes.time" sortType="DESCENDING">
                <cellFactory><TimeCell /></cellFactory>
                <cellValueFactory><PropertyValueFactory property="time"/></cellValueFactory>
            </TableColumn>
            <TableColumn fx:id="profitByTime" minWidth="70.0" text="%routes.profitByTime" sortType="DESCENDING">
                <cellFactory><DoubleCell format="\%.0f"/></cellFactory>
                <cellValueFactory><PropertyValueFactory property="profitByTime"/></cellValueFactory>
            </TableColumn>
        </columns>
        <columnResizePolicy>
            <TableView fx:constant="UNCONSTRAINED_RESIZE_POLICY"/>
        </columnResizePolicy>
        <sortOrder>
            <fx:reference source="profitByTime"/>
        </sortOrder>
        <contextMenu>
            <ContextMenu>
                <items>
                    <MenuItem text="%dialog.button.copy" onAction="#copyToClipboard" />
                </items>
            </ContextMenu>
        </contextMenu>
    </TableView>
    <TitledPane maxHeight="200" collapsible="false">
        <TableView fx:id="tblOrders">
            <rowFactory><OrderDecoratedRow /></rowFactory>
            <columns>
                <TableColumn minWidth="150" text="%market.system">
                    <cellValueFactory><PropertyValueFactory property="system"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="150" text="%market.order.seller">
                    <cellValueFactory><PropertyValueFactory property="station"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="150" text="%market.item">
                    <cellValueFactory><PropertyValueFactory property="name"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="80" text="%market.offer.price">
                    <cellFactory><DoubleCell/></cellFactory>
                    <cellValueFactory><PropertyValueFactory property="price"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="80" text="%market.order.count">
                    <cellValueFactory><PropertyValueFactory property="count"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="170" text="%market.order.buyer">
                    <cellValueFactory><OfferCellValueImpl property="buyOffer"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="80" text="%market.order.distance">
                    <cellFactory><DistanceCell /></cellFactory>
                    <cellValueFactory><PropertyValueFactory property="distance"/></cellValueFactory>
                </TableColumn>
                <TableColumn minWidth="80" text="%market.order.profit">
                    <cellFactory><DoubleCell/></cellFactory>
                    <cellValueFactory><PropertyValueFactory property="profit"/></cellValueFactory>
                </TableColumn>
            </columns>
            <columnResizePolicy>
                <TableView fx:constant="UNCONSTRAINED_RESIZE_POLICY"/>
            </columnResizePolicy>
        </TableView>
    </TitledPane>
</VBox>
