Blame view
src/main/kotlin/application/controller/VesselListPanelController.kt
1.09 KB
b350f9dfe import vessels an... |
1 2 3 4 |
package application.controller import application.model.MessageListener import application.model.Vessel |
2bbe36a1b addd the possibil... |
5 6 |
import application.model.observableVessel import application.model.observableSelectedVessel |
b350f9dfe import vessels an... |
7 8 |
import javafx.collections.FXCollections import javafx.collections.ObservableList |
b350f9dfe import vessels an... |
9 10 |
import javafx.fxml.FXML import javafx.fxml.Initializable |
b350f9dfe import vessels an... |
11 12 13 |
import javafx.scene.control.ListView import java.net.URL import java.util.* |
2bbe36a1b addd the possibil... |
14 |
class VesselListPanelController : Initializable, MessageListener { |
b350f9dfe import vessels an... |
15 16 |
@FXML var shipListView: ListView<Int> = ListView() |
513c0341c add chart |
17 |
private var shipList: ObservableList<Int> = FXCollections.observableArrayList() |
b350f9dfe import vessels an... |
18 19 20 |
override fun initialize(location: URL?, resources: ResourceBundle?) { shipListView.items = shipList |
2bbe36a1b addd the possibil... |
21 22 23 24 |
observableVessel.listeners.add(this) shipListView.selectionModel.selectedItemProperty().addListener { _, _, newValue -> observableSelectedVessel.vessel = observableVessel.vessels[newValue]!! } |
b350f9dfe import vessels an... |
25 26 27 28 29 30 31 32 |
} override fun onValueChanged(newValue: MutableMap<Int?, Vessel>) { shipList.clear() shipList.addAll(newValue.keys) } } |