Blame view
src/main/kotlin/application/controller/ControlPanelController.kt
942 Bytes
b350f9dfe import vessels an... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
package application.controller import application.model.MessageListener import application.model.Vessel import application.model.observableMessages import javafx.collections.FXCollections import javafx.collections.ObservableList import javafx.event.EventHandler import javafx.fxml.FXML import javafx.fxml.Initializable import javafx.scene.control.Button import javafx.scene.control.ListView import java.net.URL import java.util.* class ControlPanelController : Initializable, MessageListener { @FXML var shipListView: ListView<Int> = ListView() var shipList: ObservableList<Int> = FXCollections.observableArrayList() override fun initialize(location: URL?, resources: ResourceBundle?) { shipListView.items = shipList observableMessages.listeners.add(this) } override fun onValueChanged(newValue: MutableMap<Int?, Vessel>) { shipList.clear() shipList.addAll(newValue.keys) } } |