mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
update selected value on set
This commit is contained in:
@@ -14,10 +14,11 @@ class ChoicePropertyUiManager<T : Any>(defaultChoice: T) {
|
||||
var selected: T
|
||||
get() = _selected
|
||||
set(value) {
|
||||
updateSelection(components.firstOrNull { it.id == value })
|
||||
_selected = value
|
||||
updateSelectedInfo(components.firstOrNull { it.id == value })
|
||||
}
|
||||
|
||||
private fun updateSelection(newSelection: ChoiceInfo<T>?) {
|
||||
private fun updateSelectedInfo(newSelection: ChoiceInfo<T>?) {
|
||||
currentSelection?.select(false)
|
||||
|
||||
currentSelection = newSelection ?: return
|
||||
@@ -38,7 +39,8 @@ class ChoicePropertyUiManager<T : Any>(defaultChoice: T) {
|
||||
|
||||
component.addActionListener(ActionListener {
|
||||
if (component.isSelected) {
|
||||
updateSelection(info)
|
||||
_selected = id
|
||||
updateSelectedInfo(info)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user