-
Notifications
You must be signed in to change notification settings - Fork 84
#2379 Fix player table selection refresh #2393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
f5532dc
#2379 Enable focus in FixedColumnsTable.kt
wsbrenk 2debcca
#2379 PlayerOverview uses PlayersTable
wsbrenk 25eeb5b
#2379 PlayerOverview uses PlayersTable
wsbrenk 52df564
#2379 Fix HOTableModel.kt rowsorter
wsbrenk fd5b12a
#2379 CheckBoxTableEntry (not yet editable)
wsbrenk 67d7704
#2379 CheckBoxTableEntry (not yet editable)
wsbrenk cf61a25
#2379 Fix PlayerColumn.getTableEntry
wsbrenk 830db30
#2379 Debug CheckBoxTableEntry
wsbrenk 58d5999
#2379 Fix CheckBoxTableEntry
wsbrenk 9fd04c8
#2379 Fix CheckBoxTableEntry
wsbrenk ef75892
#2379 Review
wsbrenk 3d3ae1b
#2379 Review
wsbrenk 82e3795
Merge branch 'master' into #2379-merge-master
wsbrenk a608eef
#2379 Review
wsbrenk e3455c0
#2379 release_notes.md
wsbrenk 61377d4
#2379 release_notes.md
wsbrenk 788087d
Rename .java to .kt
wsbrenk c440e4a
#2379 convert new class CheckBoxTableEntry to kotlin
wsbrenk 0e5cd24
Revert "#2379 convert new class CheckBoxTableEntry to kotlin"
wsbrenk ed72aa7
Revert "Rename .java to .kt"
wsbrenk 84cbcbb
#2379 LineupModule.storeUserSettings
wsbrenk 1d68ecf
Rename .java to .kt
wsbrenk c7b9fc8
#2379 convert CheckBoxTableEntry to kotlin again
wsbrenk 9950b81
#2379 Review
wsbrenk b8a9e46
#2379 Format UserColumn.java
wsbrenk 4b4d334
#2379 formatting
wsbrenk d64d8a8
#2379 review
wsbrenk befacfb
#2379 Fix CheckBoxTableEntry null handling
wsbrenk 868beba
#2379 review
wsbrenk d47fb21
#2379 CheckBoxTableEntry.value not null
wsbrenk 6bf3795
#2379 review
wsbrenk 72c34d8
#2379 Fix PlayerOverviewPanel constructor
wsbrenk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
100 changes: 100 additions & 0 deletions
100
src/main/java/core/gui/comp/entry/CheckBoxTableEntry.kt
This file contains hidden or 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,100 @@ | ||
| package core.gui.comp.entry | ||
|
|
||
| import core.gui.comp.renderer.HODefaultTableCellRenderer | ||
| import java.awt.Color | ||
| import javax.swing.JCheckBox | ||
| import javax.swing.JComponent | ||
|
|
||
| open class CheckBoxTableEntry(isEnabled: Boolean, var value: Boolean, fgStandard: Color?, bgStandard: Color?) : | ||
| IHOTableCellEntry { | ||
| private val fgStandard: Color? | ||
| private val bgStandard: Color? | ||
| private val checkBox: JCheckBox = JCheckBox() | ||
|
|
||
| /** | ||
| * Create table cell entry for booleans by check box | ||
| * @param isEnabled boolean | ||
| * @param value Boolean - Checked | ||
| * @param fgStandard Color | ||
| * @param bgStandard Color | ||
| */ | ||
| init { | ||
| this.checkBox.setSelected(value) | ||
| this.checkBox.setEnabled(isEnabled) | ||
| this.fgStandard = fgStandard | ||
| this.bgStandard = bgStandard | ||
| createComponent() | ||
| } | ||
|
|
||
| /** | ||
| * Set value is called from HOTableModel | ||
| * @param b boolean | ||
| */ | ||
| open fun changeValue(b: Boolean) { | ||
| this.value = b | ||
| this.updateComponent() | ||
| } | ||
|
|
||
| /** | ||
| * Return the checkbox component | ||
| * @param selected boolean | ||
| * @return JComponent | ||
| */ | ||
| override fun getComponent(selected: Boolean): JComponent { | ||
| if (selected) { | ||
| this.checkBox.setBackground(HODefaultTableCellRenderer.SELECTION_BG) | ||
| this.checkBox.setForeground(HODefaultTableCellRenderer.SELECTION_FG) | ||
| } else { | ||
| this.checkBox.setBackground(bgStandard) | ||
| this.checkBox.setForeground(fgStandard) | ||
| } | ||
| return this.checkBox | ||
| } | ||
|
|
||
| /** | ||
| * Reset the checkbox | ||
| */ | ||
| override fun clear() { | ||
| this.value = false | ||
| this.checkBox.setSelected(false) | ||
| } | ||
|
|
||
| /** | ||
| * Compare with other cell entry. | ||
| * Descending order is true, false, null. | ||
|
sgcr marked this conversation as resolved.
|
||
| * @param obj the object to be compared. | ||
| * @return int [-1,0,1] | ||
| */ | ||
| override fun compareTo(obj: IHOTableCellEntry): Int { | ||
| if (obj is CheckBoxTableEntry) { | ||
| return this.value.compareTo(obj.value) | ||
| } | ||
| // Not a checkbox | ||
| return -1 | ||
| } | ||
|
|
||
| /** | ||
| * Same as compareTo | ||
| * @param obj IHOTableCellEntry The other entry | ||
| * @return int | ||
| */ | ||
| override fun compareToThird(obj: IHOTableCellEntry): Int { | ||
| return this.compareTo(obj) | ||
| } | ||
|
|
||
| /** | ||
| * Update the component | ||
| */ | ||
| override fun createComponent() { | ||
| updateComponent() | ||
| } | ||
|
|
||
| /** | ||
| * Update the component | ||
| */ | ||
| override fun updateComponent() { | ||
| this.checkBox.setSelected(value) | ||
| this.checkBox.setBackground(bgStandard) | ||
| this.checkBox.setForeground(fgStandard) | ||
| } | ||
| } | ||
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting!! This is something that has bothered me for a long long time! I am glad you're tackling this. I see you're pushing this into
PlayersTable– I had been considering moving this intoHOModel, and makeHOModeltruly that M in MVC, and thenHOVerwaltungbecome the C, controller. Maybe something to re-visit at some pointThe other thing that I was considering solving is how we propagate event across the app, and I was thinking of something like an
EventBusthat subscribers subscribe to, and made available throughHOVerwaltung.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlayersTable is my approach to bringing the various HO tables onto a common basis.
This allows the user to now select players across the Training and PlayerOverview modules, which I find very convenient.
I also hope that this will simplify the step towards Kotlin/Android, as there won't be so many different table implementations anymore.
Suggestions for improving this table foundation are very welcome.