Polish words and character list
This commit is contained in:
parent
f6f2cfac5c
commit
630d464916
@ -35,6 +35,7 @@ class Model(
|
||||
|
||||
val isSearching: ReadOnlyBooleanProperty = searchService.runningProperty()
|
||||
val isFindingWords: ReadOnlyBooleanProperty = findWordsService.runningProperty()
|
||||
val isFindingCharacters: ReadOnlyBooleanProperty = findCharacterService.runningProperty()
|
||||
|
||||
init {
|
||||
searchService.onSucceeded = EventHandler {
|
||||
@ -65,6 +66,8 @@ class Model(
|
||||
}
|
||||
|
||||
fun selectEntry(entry: DictionaryEntryFx) {
|
||||
internalWordsContaining.setAll(emptyList())
|
||||
internalCharacters.setAll(emptyList())
|
||||
internalSelectedEntry.value = entry
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import javafx.beans.binding.Bindings
|
||||
import javafx.fxml.FXML
|
||||
import javafx.scene.control.Label
|
||||
import javafx.scene.control.ListView
|
||||
import javafx.scene.control.ProgressIndicator
|
||||
import javafx.scene.control.TabPane
|
||||
import javafx.scene.input.ContextMenuEvent
|
||||
import javafx.scene.layout.FlowPane
|
||||
@ -48,6 +49,18 @@ class DetailsController(private val model: Model, private val config: Config) {
|
||||
@FXML
|
||||
private lateinit var listViewCharacters: ListView<DictionaryEntryFx>
|
||||
|
||||
@FXML
|
||||
private lateinit var progressIndicatorCharacters: ProgressIndicator
|
||||
|
||||
@FXML
|
||||
private lateinit var progressIndicatorWords: ProgressIndicator
|
||||
|
||||
@FXML
|
||||
private lateinit var labelNoCharactersFound: Label
|
||||
|
||||
@FXML
|
||||
private lateinit var labelNoWordsFound: Label
|
||||
|
||||
|
||||
@FXML
|
||||
private fun initialize() {
|
||||
@ -132,14 +145,26 @@ class DetailsController(private val model: Model, private val config: Config) {
|
||||
listViewWords.apply {
|
||||
cellFactory = DictionaryEntryCellFactory(resources, config)
|
||||
items = model.wordsContaining
|
||||
|
||||
disableProperty().bind(Bindings.or(model.isFindingWords, Bindings.isEmpty(model.wordsContaining)))
|
||||
}
|
||||
progressIndicatorWords.visibleProperty().bind(model.isFindingWords)
|
||||
labelNoWordsFound
|
||||
.visibleProperty()
|
||||
.bind(Bindings.and(Bindings.isEmpty(model.wordsContaining), Bindings.not(model.isFindingWords)))
|
||||
}
|
||||
|
||||
private fun initializeListViewCharacters() {
|
||||
listViewCharacters.apply {
|
||||
cellFactory = DictionaryEntryCellFactory(resources, config)
|
||||
items = model.characters
|
||||
|
||||
disableProperty().bind(Bindings.or(model.isFindingCharacters, Bindings.isEmpty(model.characters)))
|
||||
}
|
||||
progressIndicatorCharacters.visibleProperty().bind(model.isFindingCharacters)
|
||||
labelNoCharactersFound
|
||||
.visibleProperty()
|
||||
.bind(Bindings.and(Bindings.isEmpty(model.characters), Bindings.not(model.isFindingCharacters)))
|
||||
}
|
||||
|
||||
private fun initializeWebViewDefinition() {
|
||||
@ -180,15 +205,21 @@ class DetailsController(private val model: Model, private val config: Config) {
|
||||
)
|
||||
}
|
||||
|
||||
private fun lazyUpdateTabContent(selectedTabId: String?) = when (selectedTabId) {
|
||||
private fun lazyUpdateTabContent(selectedTabId: String?) {
|
||||
when (selectedTabId) {
|
||||
"tabWords" -> {
|
||||
if (model.wordsContaining.isNotEmpty()) return
|
||||
|
||||
model.findWords()
|
||||
}
|
||||
|
||||
"tabCharacters" -> {
|
||||
if (model.characters.isNotEmpty()) return
|
||||
|
||||
model.findCharacters()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.FlowPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.web.WebView?>
|
||||
<VBox xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.marvinelsen.willow.ui.controllers.DetailsController"
|
||||
@ -29,10 +28,28 @@
|
||||
<ListView fx:id="listViewSentences"/>
|
||||
</Tab>
|
||||
<Tab id="tabWords" closable="false" text="%tab.words">
|
||||
<StackPane>
|
||||
<ListView fx:id="listViewWords"/>
|
||||
<Label fx:id="labelNoWordsFound" text="%list.no_words_found" textAlignment="CENTER"
|
||||
visible="false" wrapText="true">
|
||||
<padding>
|
||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0"/>
|
||||
</padding>
|
||||
</Label>
|
||||
<ProgressIndicator fx:id="progressIndicatorWords" visible="false"/>
|
||||
</StackPane>
|
||||
</Tab>
|
||||
<Tab id="tabCharacters" closable="false" text="%tab.characters">
|
||||
<StackPane>
|
||||
<ListView fx:id="listViewCharacters"/>
|
||||
<Label fx:id="labelNoCharactersFound" text="%list.no_characters_found" textAlignment="CENTER"
|
||||
visible="false" wrapText="true">
|
||||
<padding>
|
||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0"/>
|
||||
</padding>
|
||||
</Label>
|
||||
<ProgressIndicator fx:id="progressIndicatorCharacters" visible="false"/>
|
||||
</StackPane>
|
||||
</Tab>
|
||||
</TabPane>
|
||||
</VBox>
|
||||
|
@ -18,3 +18,5 @@ menubar.help=_Help
|
||||
menubar.help.about=_About…
|
||||
list.no_entries_found=No matching entries found
|
||||
search.mode.phrase=Phrase
|
||||
list.no_characters_found=No characters found
|
||||
list.no_words_found=No words found
|
||||
|
@ -18,3 +18,5 @@ menubar.help=_Hilfe
|
||||
menubar.help.about=_Über…
|
||||
list.no_entries_found=No matching entries found
|
||||
search.mode.phrase=Phrase
|
||||
list.no_characters_found=No characters found
|
||||
list.no_words_found=No words found
|
||||
|
@ -18,3 +18,5 @@ menubar.help=_Help
|
||||
menubar.help.about=_About…
|
||||
list.no_entries_found=No matching entries found
|
||||
search.mode.phrase=Phrase
|
||||
list.no_characters_found=No characters found
|
||||
list.no_words_found=No words found
|
||||
|
@ -18,3 +18,5 @@ menubar.help=_說明
|
||||
menubar.help.about=_關於 Willow…
|
||||
list.no_entries_found=No matching entries found
|
||||
search.mode.phrase=Phrase
|
||||
list.no_characters_found=No characters found
|
||||
list.no_words_found=No words found
|
||||
|
@ -18,3 +18,5 @@ menubar.help=_說明
|
||||
menubar.help.about=_關於 Willow…
|
||||
list.no_entries_found=No matching entries found
|
||||
search.mode.phrase=Phrase
|
||||
list.no_characters_found=No characters found
|
||||
list.no_words_found=No words found
|
||||
|
Loading…
Reference in New Issue
Block a user