Blame view
src/main/kotlin/application/controller/VesselListPanelController.kt
1.08 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 17 18 19 20 21 22 |
@FXML var shipListView: ListView<Int> = ListView() var shipList: ObservableList<Int> = FXCollections.observableArrayList() override fun initialize(location: URL?, resources: ResourceBundle?) { shipListView.items = shipList |
2bbe36a1b addd the possibil... |
23 24 25 26 |
observableVessel.listeners.add(this) shipListView.selectionModel.selectedItemProperty().addListener { _, _, newValue -> observableSelectedVessel.vessel = observableVessel.vessels[newValue]!! } |
b350f9dfe import vessels an... |
27 28 29 30 31 32 33 34 |
} override fun onValueChanged(newValue: MutableMap<Int?, Vessel>) { shipList.clear() shipList.addAll(newValue.keys) } } |