Archived
0

add remove route entry button

This commit is contained in:
iMoHax
2016-03-17 14:33:01 +03:00
parent d2af798de3
commit c071b327a9
3 changed files with 21 additions and 7 deletions

View File

@@ -291,6 +291,13 @@ public class RouteTrackController {
} }
} }
@FXML
private void removeLast(){
if (route != null && route.getJumps() > 0){
updateRoute(route.dropLast());
}
}
@FXML @FXML
private void addOrder(){ private void addOrder(){
if (route != null){ if (route != null){

View File

@@ -204,6 +204,12 @@ public class RouteModel {
return copyFill(res, offset); return copyFill(res, offset);
} }
public RouteModel dropLast(){
Route res = Route.clone(_route);
res.dropTo(entries.size()-2);
return copyFill(res, entries.size()-2);
}
public RouteModel remove(OrderModel order) { public RouteModel remove(OrderModel order) {
Route res = Route.clone(_route); Route res = Route.clone(_route);
res.dropTo(ModelFabric.get(order.getStation())); res.dropTo(ModelFabric.get(order.getStation()));

View File

@@ -65,14 +65,15 @@
<ScrollPane GridPane.rowIndex="0" GridPane.columnIndex="3" GridPane.rowSpan="5" GridPane.fillHeight="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 spacing="4">
<HBox><TextField fx:id="newEntrySystemText"/><Button minWidth="30" onAction="#newEntryAsCurrent"><graphic><Glyph text="FontAwesome|MAP_MARKER"/></graphic></Button></HBox> <HBox spacing="2"><TextField fx:id="newEntrySystemText"/><Button minWidth="30" onAction="#newEntryAsCurrent"><graphic><Glyph text="FontAwesome|MAP_MARKER"/></graphic></Button></HBox>
<HBox><ComboBox fx:id="newEntryStation"/></HBox> <HBox><ComboBox fx:id="newEntryStation"/></HBox>
<HBox> <HBox spacing="2">
<Button onAction="#addEntry"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></Button> <Button prefWidth="30" onAction="#addEntry"><graphic><Glyph text="FontAwesome|PLUS"/></graphic></Button>
<Button onAction="#setActive"><graphic><Glyph text="FontAwesome|CHECK"/></graphic></Button> <Button prefWidth="30" onAction="#removeLast"><graphic><Glyph text="FontAwesome|MINUS"/></graphic></Button>
<Button onAction="#clear"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button> <Button prefWidth="30" onAction="#clear"><graphic><Glyph text="FontAwesome|TRASH"/></graphic></Button>
<Button onAction="#copyToClipboard"><graphic><Glyph text="FontAwesome|COPY"/></graphic></Button> <Button prefWidth="30" onAction="#copyToClipboard"><graphic><Glyph text="FontAwesome|COPY"/></graphic></Button>
<Button prefWidth="30" onAction="#setActive"><graphic><Glyph text="FontAwesome|CHECK"/></graphic></Button>
</HBox> </HBox>
</VBox> </VBox>
</VBox> </VBox>