Skip to content
Merged
Show file tree
Hide file tree
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 Jan 2, 2026
2debcca
#2379 PlayerOverview uses PlayersTable
wsbrenk Jan 3, 2026
25eeb5b
#2379 PlayerOverview uses PlayersTable
wsbrenk Jan 3, 2026
52df564
#2379 Fix HOTableModel.kt rowsorter
wsbrenk Jan 4, 2026
fd5b12a
#2379 CheckBoxTableEntry (not yet editable)
wsbrenk Jan 17, 2026
67d7704
#2379 CheckBoxTableEntry (not yet editable)
wsbrenk Jan 17, 2026
cf61a25
#2379 Fix PlayerColumn.getTableEntry
wsbrenk Jan 17, 2026
830db30
#2379 Debug CheckBoxTableEntry
wsbrenk Jan 21, 2026
58d5999
#2379 Fix CheckBoxTableEntry
wsbrenk Jan 21, 2026
9fd04c8
#2379 Fix CheckBoxTableEntry
wsbrenk Jan 21, 2026
ef75892
#2379 Review
wsbrenk Jan 21, 2026
3d3ae1b
#2379 Review
wsbrenk Jan 21, 2026
82e3795
Merge branch 'master' into #2379-merge-master
wsbrenk Jan 22, 2026
a608eef
#2379 Review
wsbrenk Jan 22, 2026
e3455c0
#2379 release_notes.md
wsbrenk Jan 22, 2026
61377d4
#2379 release_notes.md
wsbrenk Jan 22, 2026
788087d
Rename .java to .kt
wsbrenk Jan 23, 2026
c440e4a
#2379 convert new class CheckBoxTableEntry to kotlin
wsbrenk Jan 23, 2026
0e5cd24
Revert "#2379 convert new class CheckBoxTableEntry to kotlin"
wsbrenk Jan 23, 2026
ed72aa7
Revert "Rename .java to .kt"
wsbrenk Jan 23, 2026
84cbcbb
#2379 LineupModule.storeUserSettings
wsbrenk Jan 24, 2026
1d68ecf
Rename .java to .kt
wsbrenk Jan 24, 2026
c7b9fc8
#2379 convert CheckBoxTableEntry to kotlin again
wsbrenk Jan 24, 2026
9950b81
#2379 Review
wsbrenk Jan 24, 2026
b8a9e46
#2379 Format UserColumn.java
wsbrenk Jan 24, 2026
4b4d334
#2379 formatting
wsbrenk Jan 25, 2026
d64d8a8
#2379 review
wsbrenk Jan 25, 2026
befacfb
#2379 Fix CheckBoxTableEntry null handling
wsbrenk Jan 25, 2026
868beba
#2379 review
wsbrenk Jan 26, 2026
d47fb21
#2379 CheckBoxTableEntry.value not null
wsbrenk Jan 27, 2026
6bf3795
#2379 review
wsbrenk Jan 27, 2026
72c34d8
#2379 Fix PlayerOverviewPanel constructor
wsbrenk Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions src/main/java/core/gui/HOMainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import core.model.TranslationFacility;
import core.model.UserParameter;
import core.model.match.Weather;
import core.model.player.Player;
import core.module.IModule;
import core.module.ModuleManager;
import core.module.config.ModuleConfig;
Expand Down Expand Up @@ -69,16 +68,6 @@ public final class HOMainFrame extends JFrame implements Refreshable {
private final Color c_beta = new Color(162, 201, 255);
private final Color c_dev = new Color(235, 170, 170);

// TODO: Move this to a model backing the main window
public Player getSelectedPlayer() {
return m_selectedPlayer;
}

private Player m_selectedPlayer;

// ~ Constructors
// -------------------------------------------------------------------------------

Comment on lines -72 to -81
Copy link
Copy Markdown
Contributor

@tychobrailleur tychobrailleur Jan 22, 2026

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 into HOModel, and make HOModel truly that M in MVC, and then HOVerwaltung become the C, controller. Maybe something to re-visit at some point

The other thing that I was considering solving is how we propagate event across the app, and I was thinking of something like an EventBus that subscribers subscribe to, and made available through HOVerwaltung.

Copy link
Copy Markdown
Collaborator Author

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.

/**
* Singleton
*/
Expand Down Expand Up @@ -188,15 +177,6 @@ public static boolean isHOMainFrame_initialized() {
return m_HOMainFrame_initialized;
}

public void selectPlayer(Player player) {
if (m_selectedPlayer != player) {
m_selectedPlayer = player;
var lineupPanel = getLineupPanel();
if (lineupPanel != null) lineupPanel.setPlayer(player.getPlayerId());
getSpielerUebersichtPanel().setPlayer(player);
}
}

public LineupPanel getLineupPanel() {
Container c = getTabbedPane().getModulePanel(IModule.LINEUP);
if (c instanceof LineupPanel) {
Expand Down Expand Up @@ -674,15 +654,13 @@ private void saveUserParameter() {
parameter.spielerUebersichtsPanel_horizontalLeftSplitPane = sup[0];
parameter.spielerUebersichtsPanel_horizontalRightSplitPane = sup[1];
parameter.spielerUebersichtsPanel_verticalSplitPane = sup[2];
// getSpielerUebersichtPanel().saveColumnOrder();
}

// Lineup Panel
if (getTabbedPane().isModuleTabVisible(IModule.LINEUP)) {
final int[] ap = getLineupPanel().getDividerLocations();
parameter.lineupPanel_verticalSplitLocation = ap[0];
parameter.lineupPanel_horizontalSplitLocation = ap[1];
getLineupPanel().saveColumnOrder();
}

// TransferScoutPanel
Expand Down
100 changes: 100 additions & 0 deletions src/main/java/core/gui/comp/entry/CheckBoxTableEntry.kt
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.
Comment thread
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)
}
}
4 changes: 2 additions & 2 deletions src/main/java/core/gui/comp/entry/IHOTableCellEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Classes implementing this interface create a {@link javax.swing.JComponent} that will
* be displayed as a cell in a {@link javax.swing.JTable}: they act as factories to
* create and initialise the UI component.
* create and update the UI component.
*
* <p>To display the component, call {@link #getComponent(boolean)}</p>.
*/
Expand All @@ -14,7 +14,7 @@ public interface IHOTableCellEntry extends Comparable<IHOTableCellEntry> {

/**
* This method returns the JComponent, which shall be shown in the Table. The component should
* be created be createComponent and only the background should be changed according to the
* be created by createComponent and only the background should be changed according to the
* isSelected-Flag. Nevertheless, you can ignore the createComponent and updateComponent and
* create a new one everytime getComponent is called, but that is much slower!
*/
Expand Down
97 changes: 0 additions & 97 deletions src/main/java/core/gui/comp/entry/TorLabelEntry.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import javax.swing.JLabel;
import javax.swing.JTable;


/**
* Renderer for tables with JLabels as table objects
*/
Expand All @@ -26,12 +25,13 @@ public java.awt.Component getTableCellRendererComponent(JTable table, Object val
boolean isSelected,
boolean hasFocus,
int row,
int column)
{
int column) {
if (value instanceof IHOTableCellEntry ihoTableCellEntry) {
final JComponent component = ihoTableCellEntry.getComponent(isSelected);
if (isSelected) {
component.setOpaque(true);
if (component != null) {
if (isSelected) {
component.setOpaque(true);
}
}
return component;
} else if (value instanceof JComponent component) {
Expand All @@ -47,4 +47,4 @@ public java.awt.Component getTableCellRendererComponent(JTable table, Object val
return component;
}
}
}
}
19 changes: 0 additions & 19 deletions src/main/java/core/gui/comp/table/BooleanColumn.java

This file was deleted.

12 changes: 6 additions & 6 deletions src/main/java/core/gui/comp/table/FixedColumnsTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ open class FixedColumnsTable @JvmOverloads constructor(

if (fixedColumnsCount > 0) {
fixed = JTable(model)
fixed!!.setFocusable(false)
fixed!!.setSelectionModel(getSelectionModel())
fixed!!.setFocusable(true)
fixed!!.getTableHeader().reorderingAllowed = false
fixed!!.setSelectionModel(getSelectionModel())
fixed!!.columnModel.selectionModel = getSelectionModel()

// Remove the non-fixed columns from the fixed table
while (fixed!!.getColumnCount() > fixedColumnsCount) {
while (fixed!!.columnCount > fixedColumnsCount) {
val _columnModel = fixed!!.getColumnModel()
_columnModel.removeColumn(_columnModel.getColumn(fixedColumnsCount))
}
Expand Down Expand Up @@ -173,7 +174,6 @@ open class FixedColumnsTable @JvmOverloads constructor(
}
}


/**
* Show the horizontal scroll bar of the scroll pane when the other horizontal scroll bar appeared in case of pane resizing
* @param scrollPane The scroll pane that has to be synchronized with the other scroll pane
Expand All @@ -189,8 +189,8 @@ open class FixedColumnsTable @JvmOverloads constructor(

/**
* Hide the horizontal scroll bar of the scroll pane when the other horizontal scroll bar disappeared in case of pane resizing
* If the other scroll bar does not require a scroll bar, its scroll bar will be removed
* otherwise the disappearance in hidden scroll bar will be reset.
* If the other scroll bar does not require a scroll bar, its scroll bar will be removed,
* otherwise the disappearance in hidden scroll bar will reset.
* @param hiddenScrollPane The scroll pane that removed the scroll bar
* @param otherScrollPane The scroll pane that has to be adapted
*/
Expand Down
Loading