Add context menu to list entries
This commit is contained in:
parent
573515217e
commit
47d53d4df8
@ -44,15 +44,13 @@ internal class EntryCell : ListCell<DictionaryEntryFx?>() {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
text = null
|
text = null
|
||||||
if (item != null) {
|
|
||||||
contextMenu = createContextMenuForEntry(item!!)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateItem(entry: DictionaryEntryFx?, empty: Boolean) {
|
override fun updateItem(entry: DictionaryEntryFx?, empty: Boolean) {
|
||||||
super.updateItem(entry, empty)
|
super.updateItem(entry, empty)
|
||||||
if (empty || entry == null) {
|
if (empty || entry == null) {
|
||||||
graphic = null
|
graphic = null
|
||||||
|
contextMenu = null
|
||||||
} else {
|
} else {
|
||||||
labelHeadword.text = entry.traditionalProperty.value
|
labelHeadword.text = entry.traditionalProperty.value
|
||||||
labelPronunciation.text = entry.pinyinWithToneMarksProperty.value
|
labelPronunciation.text = entry.pinyinWithToneMarksProperty.value
|
||||||
@ -60,6 +58,7 @@ internal class EntryCell : ListCell<DictionaryEntryFx?>() {
|
|||||||
val definition = entry.definitions.joinToString(separator = " / ") { it.joinToString(separator = "; ") }
|
val definition = entry.definitions.joinToString(separator = " / ") { it.joinToString(separator = "; ") }
|
||||||
labelDefinition.text = definition
|
labelDefinition.text = definition
|
||||||
|
|
||||||
|
contextMenu = createContextMenuForEntry(entry)
|
||||||
graphic = root
|
graphic = root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user