-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ensure list model changes will always be emitted on FX thread
- Loading branch information
1 parent
44da370
commit b51f108
Showing
4 changed files
with
53 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
src/main/java/mediathek/javafx/filterpanel/SenderBoxNode.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
src/main/java/mediathek/javafx/filterpanel/SenderBoxNode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package mediathek.javafx.filterpanel | ||
|
||
import ca.odell.glazedlists.* | ||
import ca.odell.glazedlists.event.ListEvent | ||
import ca.odell.glazedlists.javafx.EventObservableList | ||
import ca.odell.glazedlists.javafx.JavaFxThreadProxyEventList | ||
import javafx.event.EventHandler | ||
import javafx.scene.control.ContextMenu | ||
import javafx.scene.control.MenuItem | ||
import mediathek.controller.SenderFilmlistLoadApprover | ||
import mediathek.tool.GermanStringSorter | ||
import org.controlsfx.control.CheckListView | ||
|
||
class SenderBoxNode : CheckListView<String?>() { | ||
internal class ReadOnlyList(val list: EventList<String>) : TransformedList<String, String>(list) { | ||
init { | ||
source.addListEventListener(this) | ||
} | ||
|
||
override fun isWritable(): Boolean { | ||
return false | ||
} | ||
|
||
override fun listChanged(listChanges: ListEvent<String>?) { | ||
updates.forwardEvent(listChanges) | ||
} | ||
} | ||
|
||
init { | ||
//do not display unchecked(unloaded) senders from config... | ||
val filteredSenderList = FilterList(SenderListBoxModel.providedSenderList) | ||
filteredSenderList.setMatcher { SenderFilmlistLoadApprover.isApproved(it) } | ||
|
||
val sortedSenderList = SortedList(UniqueList(filteredSenderList)) | ||
sortedSenderList.comparator = GermanStringSorter.getInstance() | ||
|
||
items = EventObservableList(JavaFxThreadProxyEventList(ReadOnlyList(sortedSenderList))) | ||
|
||
val contextMenu = ContextMenu() | ||
val miClearChecks = MenuItem("Alle Senderfilter zurücksetzen") | ||
miClearChecks.onAction = EventHandler { checkModel.clearChecks() } | ||
contextMenu.items.add(miClearChecks) | ||
setContextMenu(contextMenu) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters