modify track route screen
This commit is contained in:
@@ -19,6 +19,7 @@ import ru.trader.view.support.autocomplete.CachedSuggestionProvider;
|
|||||||
import ru.trader.view.support.autocomplete.SystemsProvider;
|
import ru.trader.view.support.autocomplete.SystemsProvider;
|
||||||
import ru.trader.view.support.cells.OrderListCell;
|
import ru.trader.view.support.cells.OrderListCell;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -28,7 +29,7 @@ public class RouteTrackController {
|
|||||||
@FXML
|
@FXML
|
||||||
private Node editGroup;
|
private Node editGroup;
|
||||||
@FXML
|
@FXML
|
||||||
private Node infoGroup;
|
private Node missionsGroup;
|
||||||
@FXML
|
@FXML
|
||||||
private Node refuelGroup;
|
private Node refuelGroup;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -58,6 +59,9 @@ public class RouteTrackController {
|
|||||||
private AutoCompletion<SystemModel> newEntrySystem;
|
private AutoCompletion<SystemModel> newEntrySystem;
|
||||||
@FXML
|
@FXML
|
||||||
private ComboBox<String> newEntryStation;
|
private ComboBox<String> newEntryStation;
|
||||||
|
@FXML
|
||||||
|
private ToggleButton tbMissionsEdit;
|
||||||
|
|
||||||
|
|
||||||
private RouteModel route;
|
private RouteModel route;
|
||||||
private Track trackNode;
|
private Track trackNode;
|
||||||
@@ -163,13 +167,13 @@ public class RouteTrackController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void toggleEdit(){
|
private void toggleMissionsEdit(){
|
||||||
if (editGroup.isVisible()){
|
if (editGroup.isVisible()){
|
||||||
editGroup.setVisible(false);
|
editGroup.setVisible(false);
|
||||||
infoGroup.setVisible(true);
|
missionsGroup.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
editGroup.setVisible(true);
|
editGroup.setVisible(true);
|
||||||
infoGroup.setVisible(false);
|
missionsGroup.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +207,8 @@ public class RouteTrackController {
|
|||||||
newRoute.addAll(startIndex, notAdded);
|
newRoute.addAll(startIndex, notAdded);
|
||||||
newRoute.addAll(startIndex, oldMissions);
|
newRoute.addAll(startIndex, oldMissions);
|
||||||
updateRoute(newRoute);
|
updateRoute(newRoute);
|
||||||
|
clearMissions();
|
||||||
|
tbMissionsEdit.fire();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -231,7 +237,26 @@ public class RouteTrackController {
|
|||||||
@FXML
|
@FXML
|
||||||
private void clearMissions(){
|
private void clearMissions(){
|
||||||
missionsController.clear();
|
missionsController.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void removeMissionFromTrack(){
|
||||||
|
if (route != null){
|
||||||
|
MissionModel mission = missionsList.getSelectionModel().getSelectedItem();
|
||||||
|
if (mission != null){
|
||||||
|
route.remove(mission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void removeAllMissionsFromTrack(){
|
||||||
|
if (route != null){
|
||||||
|
Collection<MissionModel> missions = new ArrayList<>(missionsList.getItems());
|
||||||
|
if (!missions.isEmpty()){
|
||||||
|
route.removeAll(missions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -4,59 +4,65 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import org.controlsfx.glyphfont.Glyph?>
|
<?import org.controlsfx.glyphfont.Glyph?>
|
||||||
<HBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
<?import javafx.geometry.Insets?>
|
||||||
|
<GridPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="ru.trader.controllers.RouteTrackController"
|
fx:controller="ru.trader.controllers.RouteTrackController"
|
||||||
spacing="4" >
|
vgap="4" hgap="4">
|
||||||
<VBox>
|
<padding>
|
||||||
<ToggleButton minWidth="30" onAction="#toggleEdit">
|
<Insets left="5" right="5" top="5" bottom="5"/>
|
||||||
<graphic><Glyph text="FontAwesome|EDIT"/></graphic>
|
</padding>
|
||||||
</ToggleButton>
|
|
||||||
<StackPane>
|
<columnConstraints>
|
||||||
<VBox fx:id="editGroup">
|
<ColumnConstraints minWidth="300" maxWidth="300"/>
|
||||||
<fx:include fx:id="missions" source="missions.fxml"/>
|
<ColumnConstraints minWidth="300" maxWidth="300"/>
|
||||||
<HBox>
|
<ColumnConstraints minWidth="30" maxWidth="40"/>
|
||||||
<ListView fx:id="addMissionsList" maxHeight="150"/>
|
<ColumnConstraints minWidth="220" />
|
||||||
<VBox spacing="4" alignment="TOP_RIGHT">
|
</columnConstraints>
|
||||||
<Button prefWidth="30" onAction="#addMission"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></Button>
|
|
||||||
<Button prefWidth="30" onAction="#removeMission"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
|
<VBox GridPane.rowIndex="0" GridPane.columnIndex="0" GridPane.columnSpan="3">
|
||||||
<Button prefWidth="30" onAction="#clearMissions"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button>
|
|
||||||
</VBox>
|
|
||||||
<VBox>
|
|
||||||
<Button prefWidth="80" text="Добавить" onAction="#addMissionsToTrack" />
|
|
||||||
<Button prefWidth="80" text="Добавить все" onAction="#addAllMissionsToTrack" />
|
|
||||||
</VBox>
|
|
||||||
</HBox>
|
|
||||||
</VBox>
|
|
||||||
<VBox fx:id="infoGroup">
|
|
||||||
<HBox><Label text="Система:" /><Label fx:id="system" /></HBox>
|
<HBox><Label text="Система:" /><Label fx:id="system" /></HBox>
|
||||||
<HBox><Label text="Станция:" /><Label fx:id="station" /></HBox>
|
<HBox><Label text="Станция:" /><Label fx:id="station" /></HBox>
|
||||||
<HBox><Label text="Время:" /><Label fx:id="time" /></HBox>
|
<HBox><Label text="Время:" /><Label fx:id="time" /></HBox>
|
||||||
<HBox fx:id="refuelGroup"><Label text="Заправить:" /><Label fx:id="refuel" /></HBox>
|
<HBox fx:id="refuelGroup"><Label text="Заправить:" /><Label fx:id="refuel" /></HBox>
|
||||||
<HBox fx:id="ordersGroup" maxHeight="120">
|
|
||||||
<VBox>
|
|
||||||
<Label text="Продать:" />
|
|
||||||
<ListView fx:id="sellOrders"/>
|
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox>
|
|
||||||
<Label text="Купить:" />
|
<Label GridPane.rowIndex="1" GridPane.columnIndex="0" text="Продать:" />
|
||||||
<HBox spacing="4">
|
<ListView GridPane.rowIndex="2" GridPane.columnIndex="0" fx:id="sellOrders" maxHeight="150"/>
|
||||||
<ListView fx:id="buyOrders"/>
|
|
||||||
<VBox spacing="4" alignment="TOP_RIGHT">
|
<Label GridPane.rowIndex="1" GridPane.columnIndex="1" text="Купить:" />
|
||||||
|
<ListView GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="buyOrders" maxHeight="150"/>
|
||||||
|
|
||||||
|
<VBox GridPane.rowIndex="2" GridPane.columnIndex="2" spacing="4" alignment="TOP_RIGHT">
|
||||||
<Button prefWidth="30" onAction="#addOrder"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></Button>
|
<Button prefWidth="30" onAction="#addOrder"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></Button>
|
||||||
<Button prefWidth="30" onAction="#removeOrder"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
|
<Button prefWidth="30" onAction="#removeOrder"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
|
||||||
<Button prefWidth="30" onAction="#clearOrders"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button>
|
<Button prefWidth="30" onAction="#clearOrders"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|
||||||
|
<Label GridPane.rowIndex="3" GridPane.columnIndex="0" GridPane.columnSpan="2" text="Миссии:" />
|
||||||
|
<StackPane GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="2" maxHeight="150">
|
||||||
|
<HBox fx:id="missionsGroup">
|
||||||
|
<ListView fx:id="missionsList" HBox.hgrow="ALWAYS"/>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
<HBox fx:id="editGroup" spacing="4">
|
||||||
|
<fx:include fx:id="missions" source="missions.fxml"/>
|
||||||
|
<ListView fx:id="addMissionsList"/>
|
||||||
|
<VBox spacing="4">
|
||||||
|
<Button prefWidth="30" onAction="#addMission"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></Button>
|
||||||
|
<Button prefWidth="30" onAction="#removeMission"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
|
||||||
|
<Button prefWidth="30" onAction="#clearMissions"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button>
|
||||||
|
<VBox VBox.vgrow="ALWAYS" alignment="BOTTOM_LEFT">
|
||||||
|
<Button prefWidth="30" onAction="#addAllMissionsToTrack"><graphic><Glyph text="FontAwesome|CHECK"/><Glyph text="FontAwesome|CHECK"/></graphic></Button>
|
||||||
|
</VBox>
|
||||||
</VBox>
|
</VBox>
|
||||||
</HBox>
|
</HBox>
|
||||||
<VBox fx:id="missionsGroup" maxHeight="120">
|
|
||||||
<Label text="Сдать миссии:" />
|
|
||||||
<ListView fx:id="missionsList" maxHeight="150"/>
|
|
||||||
</VBox>
|
|
||||||
</VBox>
|
|
||||||
</StackPane>
|
</StackPane>
|
||||||
|
|
||||||
|
<VBox GridPane.rowIndex="4" GridPane.columnIndex="2" alignment="TOP_RIGHT" spacing="4">
|
||||||
|
<ToggleButton fx:id="tbMissionsEdit" prefWidth="30" onAction="#toggleMissionsEdit"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></ToggleButton>
|
||||||
|
<Button prefWidth="30" onAction="#removeMissionFromTrack"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
|
||||||
|
<Button prefWidth="30" onAction="#removeAllMissionsFromTrack"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button>
|
||||||
</VBox>
|
</VBox>
|
||||||
<ScrollPane minWidth="220" fitToHeight="true">
|
<ScrollPane GridPane.rowIndex="0" GridPane.columnIndex="3" GridPane.rowSpan="5" GridPane.fillHeight="true">
|
||||||
<VBox>
|
<VBox>
|
||||||
<AnchorPane fx:id="track"/>
|
<AnchorPane fx:id="track"/>
|
||||||
<VBox>
|
<VBox>
|
||||||
@@ -71,5 +77,4 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</VBox>
|
</VBox>
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
|
</GridPane>
|
||||||
</HBox>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user