Commit a6a8df6ff5be1e08eddb715734fc61cd03bce8b0

Authored by lsagona
1 parent df68a9fdcc
Exists in master and in 1 other branch dev

add the possibility to search an MMSI

Showing 8 changed files with 31 additions and 27 deletions Side-by-side Diff

src/main/kotlin/application/App.kt View file @ a6a8df6
... ... @@ -13,6 +13,7 @@
13 13 import jfxtras.styles.jmetro.Style
14 14 import kotlin.system.exitProcess
15 15  
  16 +
16 17 class App : Application() {
17 18 var style: Style = Style.LIGHT
18 19  
... ... @@ -29,7 +30,6 @@
29 30 }
30 31  
31 32 private fun closeApplication() {
32   -
33 33 Platform.exit()
34 34 exitProcess(0)
35 35 }
src/main/kotlin/application/controller/DataPanelController.kt View file @ a6a8df6
... ... @@ -86,7 +86,6 @@
86 86 dataViewer.updatePlot(plotData)
87 87 initDataList()
88 88  
89   -
90 89 }
91 90  
92 91 private fun plot() {
... ... @@ -97,8 +96,6 @@
97 96 }
98 97 }
99 98  
100   -
101   -
102 99 private fun plot(data: String?) {
103 100 if (data == null) {
104 101 plotData.allTraces.clear()
... ... @@ -332,7 +329,7 @@
332 329 timeData = populateTime(vessel)
333 330  
334 331 if (dataListView.selectionModel.selectedItem == null) return
335   -//NOTE: Ajouter les nouvelles donnée à la fin
  332 +
336 333 when (dataListView.selectionModel.selectedItem) {
337 334 "Latitude" -> {
338 335 latitude.clear()
src/main/kotlin/application/controller/VesselListPanelController.kt View file @ a6a8df6
... ... @@ -6,27 +6,32 @@
6 6 import application.model.observableVessel
7 7 import javafx.collections.FXCollections
8 8 import javafx.collections.ObservableList
  9 +import javafx.collections.transformation.FilteredList
9 10 import javafx.fxml.FXML
10 11 import javafx.fxml.Initializable
11   -import javafx.scene.control.ListCell
12   -import javafx.scene.control.ListView
13   -import javafx.scene.control.MultipleSelectionModel
14   -import javafx.scene.control.SelectionMode
  12 +import javafx.scene.control.*
15 13 import javafx.scene.input.MouseEvent
16 14 import java.net.URL
17 15 import java.util.*
18 16  
19 17  
20 18 class VesselListPanelController : Initializable, MessageListener {
  19 +
21 20 @FXML
22 21 var shipListView: ListView<String?> = ListView()
23 22  
  23 + @FXML
  24 + var filterInput: TextField = TextField()
  25 +
24 26 private var shipList: ObservableList<String?> = FXCollections.observableArrayList()
25 27  
  28 + private val filterMMSI = FilteredList(shipList)
  29 +
26 30 override fun initialize(location: URL?, resources: ResourceBundle?) {
27 31  
28 32  
29   - shipListView.items = shipList
  33 + shipListView.items = filterMMSI
  34 +
30 35 observableVessel.listeners.add(this)
31 36 shipListView.selectionModel.selectedItemProperty().addListener { _, _, newValue ->
32 37 if (newValue == null) {
33 38  
34 39  
... ... @@ -35,12 +40,26 @@
35 40 observableSelectedVessel.value = observableVessel.vessels[newValue]!!
36 41 }
37 42 }
  43 +
  44 +
38 45 setCellFactory()
  46 + setFilterTextListener()
39 47 }
40 48  
41 49 override fun onValueChanged(newValue: MutableMap<String?, Vessel>) {
42 50 shipList.clear()
43 51 shipList.addAll(newValue.keys)
  52 + }
  53 +
  54 + private fun setFilterTextListener() {
  55 + filterInput.textProperty().addListener { _ ->
  56 + val filter: String = filterInput.text
  57 + if (filter.isEmpty()) {
  58 + filterMMSI.setPredicate { true }
  59 + } else {
  60 + filterMMSI.setPredicate { s: String? -> s!!.contains(filter) }
  61 + }
  62 + }
44 63 }
45 64  
46 65 private fun setCellFactory() {
src/main/resources/gui/mapPanel.fxml View file @ a6a8df6
... ... @@ -2,7 +2,7 @@
2 2  
3 3 <?import javafx.scene.layout.*?>
4 4  
5   -<VBox prefHeight="150.0" prefWidth="371.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.MapPanelController">
  5 +<VBox prefHeight="150.0" prefWidth="371.0" xmlns="http://javafx.com/javafx/8.0.241" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.MapPanelController">
6 6 <StackPane fx:id="map" />
7 7 <fx:include source="timePanel.fxml" />
8 8 </VBox>
src/main/resources/gui/menuBar.fxml View file @ a6a8df6
... ... @@ -2,7 +2,7 @@
2 2  
3 3 <?import javafx.scene.control.*?>
4 4  
5   -<MenuBar fx:id="menuBar" prefHeight="25.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.MenuBarController">
  5 +<MenuBar fx:id="menuBar" prefHeight="25.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.241" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.MenuBarController">
6 6 <menus>
7 7 <Menu mnemonicParsing="false" text="File">
8 8 <items>
src/main/resources/gui/timePanel.fxml View file @ a6a8df6
... ... @@ -4,7 +4,7 @@
4 4 <?import javafx.scene.control.*?>
5 5 <?import javafx.scene.layout.*?>
6 6  
7   -<HBox alignment="CENTER" prefHeight="65.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.TimePanel">
  7 +<HBox alignment="CENTER" prefHeight="65.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.241" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.TimePanel">
8 8 <children>
9 9 <Slider fx:id="timeSlider" prefHeight="14.0" prefWidth="538.0">
10 10 <HBox.margin>
src/main/resources/gui/vesselListPanel.fxml View file @ a6a8df6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2  
3   -<?import javafx.geometry.*?>
4 3 <?import javafx.scene.control.*?>
5 4 <?import javafx.scene.layout.*?>
6   -<?import javafx.scene.text.*?>
7 5  
8 6 <BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.controller.VesselListPanelController">
9 7 <center>
10 8 <ListView fx:id="shipListView" prefHeight="50.0" prefWidth="200.0" />
11 9 </center>
12 10 <top>
13   - <TextFlow prefHeight="28.0" prefWidth="200.0" style="-fx-font-weight: bold;" textAlignment="CENTER" BorderPane.alignment="CENTER">
14   - <children>
15   - <Text scaleX="1.5" scaleY="1.5" strokeType="OUTSIDE" strokeWidth="0.0" text="MMSI" textAlignment="CENTER" />
16   - </children>
17   - <BorderPane.margin>
18   - <Insets />
19   - </BorderPane.margin>
20   - <padding>
21   - <Insets top="5.0" />
22   - </padding>
23   - </TextFlow>
  11 + <TextField fx:id="filterInput" promptText="MMSI" BorderPane.alignment="CENTER" />
24 12 </top>
25 13 </BorderPane>
src/main/resources/gui/windows.fxml View file @ a6a8df6
... ... @@ -4,7 +4,7 @@
4 4 <?import javafx.scene.layout.*?>
5 5 <?import javafx.scene.shape.*?>
6 6  
7   -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="900.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
  7 +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="900.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8.0.241" xmlns:fx="http://javafx.com/fxml/1">
8 8 <children>
9 9 <fx:include source="menuBar.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
10 10 <SplitPane dividerPositions="0.13772954924874792" layoutY="39.0" prefHeight="865.0" prefWidth="1194.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="35.0">