Skip to content

Commit

Permalink
Review Finding 7
Browse files Browse the repository at this point in the history
  • Loading branch information
sgcr committed Sep 10, 2024
1 parent b145d74 commit 6967f3d
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 168 deletions.
57 changes: 28 additions & 29 deletions src/main/java/core/gui/HOMainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import core.gui.theme.ThemeManager;
import core.model.FormulaFactors;
import core.model.HOVerwaltung;
import core.model.TranslationFacility;
import core.model.UserParameter;
import core.model.match.Weather;
import core.model.player.Player;
Expand Down Expand Up @@ -43,8 +44,6 @@
import java.util.Vector;
import java.util.concurrent.atomic.AtomicBoolean;

import static core.model.TranslationFacility.tr;

/**
* The Main HO window
*/
Expand All @@ -55,37 +54,37 @@ public final class HOMainFrame extends JFrame implements Refreshable, ActionList
private InfoPanel m_jpInfoPanel;
private final JMenuBar m_jmMenuBar = new JMenuBar();
// Top level Menu
private final JMenu m_jmFile = new JMenu(tr("ls.menu.file")); //File
private final JMenu m_jmFunctions = new JMenu(tr("ls.menu.functions")); //Functions
private final JMenu m_jmModules = new JMenu(tr("ls.menu.modules")); //Modules
private final JMenu m_jmHelp = new JMenu(tr("ls.menu.help")); //Help
private final JMenu m_jmFile = new JMenu(TranslationFacility.tr("ls.menu.file")); //File
private final JMenu m_jmFunctions = new JMenu(TranslationFacility.tr("ls.menu.functions")); //Functions
private final JMenu m_jmModules = new JMenu(TranslationFacility.tr("ls.menu.modules")); //Modules
private final JMenu m_jmHelp = new JMenu(TranslationFacility.tr("ls.menu.help")); //Help

// Sub Level Menus

// ----------- File
private final JMenuItem m_jmDownloadItem = new JMenuItem(tr("ls.menu.file.download"));
private final JMenuItem m_jmImportItem = new JMenuItem(tr("ls.menu.file.importfromhrf"));
private final JMenuItem m_jmSubksillFull = new JMenuItem(tr("ls.menu.file.subskillrecalculation"));
private final JMenuItem m_jmSubksillRecalc7 = new JMenuItem(tr("ls.menu.file.subskillrecalculation7weeks"));
private final JMenuItem m_jmOptionen = new JMenuItem(tr("ls.menu.file.preferences"));
private final JMenuItem m_jmDownloadItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.download"));
private final JMenuItem m_jmImportItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.importfromhrf"));
private final JMenuItem m_jmSubksillFull = new JMenuItem(TranslationFacility.tr("ls.menu.file.subskillrecalculation"));
private final JMenuItem m_jmSubksillRecalc7 = new JMenuItem(TranslationFacility.tr("ls.menu.file.subskillrecalculation7weeks"));
private final JMenuItem m_jmOptionen = new JMenuItem(TranslationFacility.tr("ls.menu.file.preferences"));
//private final JMenu databaseMenu = new JMenu(TranslationFacility.tr("ls.menu.file.database"));
private final JMenuItem userAdministrationOptionsMenu = new JMenuItem(tr("ls.menu.file.database.dbuseradministration"));
private final JMenuItem m_jmiDbCleanupTool = new JMenuItem(tr("ls.menu.file.database.databasecleanup"));
private final JMenuItem m_jmFullScreenItem = new JMenuItem(tr("ls.menu.file.fullscreen"));
private final JMenuItem m_jmBeendenItem = new JMenuItem(tr("ls.menu.file.quit"));
private final JMenuItem userAdministrationOptionsMenu = new JMenuItem(TranslationFacility.tr("ls.menu.file.database.dbuseradministration"));
private final JMenuItem m_jmiDbCleanupTool = new JMenuItem(TranslationFacility.tr("ls.menu.file.database.databasecleanup"));
private final JMenuItem m_jmFullScreenItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.fullscreen"));
private final JMenuItem m_jmBeendenItem = new JMenuItem(TranslationFacility.tr("ls.menu.file.quit"));


// ----------- Functions

// ----------- Modules

// ----------- Help
private final JMenuItem m_jmHomepageItem = new JMenuItem(tr("ls.menu.help.projecthomepage"));
private final JMenuItem m_jmWikiItem = new JMenuItem(tr("ls.menu.help.help"));
private final JMenuItem m_jmReportAbug = new JMenuItem(tr("ls.menu.help.reportabug"));
private final JMenuItem m_jmAboutAbout = new JMenuItem(tr("ls.menu.help.about"));
private final JMenuItem m_jmCheckUpdate = new JMenuItem(tr("ls.menu.file.update.ho"));
private final JMenuItem m_jmChangelog = new JMenuItem(tr("ls.menu.help.changelog"));
private final JMenuItem m_jmHomepageItem = new JMenuItem(TranslationFacility.tr("ls.menu.help.projecthomepage"));
private final JMenuItem m_jmWikiItem = new JMenuItem(TranslationFacility.tr("ls.menu.help.help"));
private final JMenuItem m_jmReportAbug = new JMenuItem(TranslationFacility.tr("ls.menu.help.reportabug"));
private final JMenuItem m_jmAboutAbout = new JMenuItem(TranslationFacility.tr("ls.menu.help.about"));
private final JMenuItem m_jmCheckUpdate = new JMenuItem(TranslationFacility.tr("ls.menu.file.update.ho"));
private final JMenuItem m_jmChangelog = new JMenuItem(TranslationFacility.tr("ls.menu.help.changelog"));

public static AtomicBoolean launching = new AtomicBoolean(false);

Expand Down Expand Up @@ -165,7 +164,7 @@ private void setFrameTitle() {
String frameTitle = StringUtils.isEmpty(teamName) ? "" : teamName;

if (!HO.isRelease()) {
frameTitle += " (" + tr("ls.java.version") + ": " + System.getProperty("java.version") + ")";
frameTitle += " (" + TranslationFacility.tr("ls.java.version") + ": " + System.getProperty("java.version") + ")";
}

setTitle(frameTitle);
Expand Down Expand Up @@ -251,7 +250,7 @@ private InfoPanel getInfoPanel(){
}
return m_jpInfoPanel;
}
public void setWaitInformation(){setInformation(tr("BitteWarten"), 1);}
public void setWaitInformation(){setInformation(TranslationFacility.tr("BitteWarten"), 1);}
public void resetInformation(){setInformation("",-100);}
public void setInformation( String information) { setInformation(information,-100);}
public void setInformationCompleted() { setInformation(Helper.getTranslation("ls.update_status.complete"), -100);}
Expand Down Expand Up @@ -318,18 +317,18 @@ public void actionPerformed(ActionEvent actionEvent) {
} else if (source.equals(m_jmSubksillFull)) { // recalc training (8 seasons = 128)
var from = HODateTime.now().minus(128*7, ChronoUnit.DAYS);
if (JOptionPane.showConfirmDialog(this,
tr("Subskill.Recalc.Full")+"\n"+ tr("subskill.Recalc.Start"),
TranslationFacility.tr("Subskill.Recalc.Full")+"\n"+ TranslationFacility.tr("subskill.Recalc.Start"),
Helper.getTranslation("ls.menu.file.subskillrecalculation"), JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
HOVerwaltung.instance().recalcSubskills(true, from.toDbTimestamp());
}
} else if (source.equals(m_jmSubksillRecalc7)) { // recalc training (7 weeks)
var nextTraining = HOVerwaltung.instance().getModel().getXtraDaten().getNextTrainingDate();
var from = nextTraining.minus(7*7, ChronoUnit.DAYS);
if (JOptionPane.showConfirmDialog(this,
tr("subskill.Recalc.7w")+"\n"+
tr("subskill.Recalc.1stTrainingweek") + ": " +
TranslationFacility.tr("subskill.Recalc.7w")+"\n"+
TranslationFacility.tr("subskill.Recalc.1stTrainingweek") + ": " +
from.toLocaleHTWeek().toString() + "\n" +
tr("subskill.Recalc.Start"),
TranslationFacility.tr("subskill.Recalc.Start"),
Helper.getTranslation("ls.menu.file.subskillrecalculation7weeks"), JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
HOVerwaltung.instance().recalcSubskills(true, from.toDbTimestamp());
}
Expand Down Expand Up @@ -361,8 +360,8 @@ public void actionPerformed(ActionEvent actionEvent) {
Desktop.getDesktop().browse(logFile);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
tr("Changelog.error"),
tr("Fehler"),
TranslationFacility.tr("Changelog.error"),
TranslationFacility.tr("Fehler"),
JOptionPane.ERROR_MESSAGE
);
e.printStackTrace();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/core/gui/comp/table/UserColumn.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package core.gui.comp.table;

import javax.swing.table.TableColumn;
import core.model.TranslationFacility;

import static core.model.TranslationFacility.tr;
import javax.swing.table.TableColumn;

public abstract class UserColumn {

Expand Down Expand Up @@ -48,7 +48,7 @@ public UserColumn(){}
* @return String
*/
public final String getColumnName() {
return (columnName.equals("TSI") || columnName.equals(" ")) ? columnName: tr(columnName);
return (columnName.equals("TSI") || columnName.equals(" ")) ? columnName: TranslationFacility.tr(columnName);
}

/**
Expand All @@ -68,7 +68,7 @@ public void setId(int v){
* @return String
*/
public final String getTooltip() {
return (columnName.equals("TSI") || tooltip.equals(" "))?tooltip: tr(tooltip);
return (columnName.equals("TSI") || tooltip.equals(" "))?tooltip: TranslationFacility.tr(tooltip);
}

/**
Expand Down
101 changes: 50 additions & 51 deletions src/main/java/core/gui/model/ArenaStatistikTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import core.gui.theme.HOIconName;
import core.gui.theme.ImageUtilities;
import core.gui.theme.ThemeManager;
import core.model.TranslationFacility;
import core.model.match.MatchKurzInfo;
import core.model.misc.Economy;
import core.util.HOLogger;
Expand All @@ -16,8 +17,6 @@
import java.awt.*;
import java.time.Duration;

import static core.model.TranslationFacility.tr;

public class ArenaStatistikTableModel extends AbstractTableModel {
//~ Static fields/initializers -----------------------------------------------------------------

Expand All @@ -27,81 +26,81 @@ public class ArenaStatistikTableModel extends AbstractTableModel {
//~ Instance fields ----------------------------------------------------------------------------

public String[] m_sToolTipStrings = {
tr("Datum"),
TranslationFacility.tr("Datum"),
// Spielart
tr("Spielart"),
TranslationFacility.tr("Spielart"),
// Gast
tr("Gast"),
tr("ls.match.result"),
tr("ls.match.weather"),
tr("ls.match.id"),
tr("Aktuell"), // Stadiongroesse
tr("Zuschauer"), // Zuschauer
TranslationFacility.tr("Gast"),
TranslationFacility.tr("ls.match.result"),
TranslationFacility.tr("ls.match.weather"),
TranslationFacility.tr("ls.match.id"),
TranslationFacility.tr("Aktuell"), // Stadiongroesse
TranslationFacility.tr("Zuschauer"), // Zuschauer
"%", // Auslastung
tr("ls.club.arena.income.total"), // Income Total
TranslationFacility.tr("ls.club.arena.income.total"), // Income Total

tr("ls.club.arena.terraces"),
TranslationFacility.tr("ls.club.arena.terraces"),
"%", // Percentage of crowd on the terraces
tr("ls.club.arena.income.terraces"), // Income Terraces
TranslationFacility.tr("ls.club.arena.income.terraces"), // Income Terraces

tr("ls.club.arena.basicseating"),
TranslationFacility.tr("ls.club.arena.basicseating"),
"%", // Percentage of crowd in the basic seats
tr("ls.club.arena.income.basicseating"), // Income Basic
TranslationFacility.tr("ls.club.arena.income.basicseating"), // Income Basic

tr("ls.club.arena.seatsunderroof"),
TranslationFacility.tr("ls.club.arena.seatsunderroof"),
"%", // Percentage of crowd under the roof
tr("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof
TranslationFacility.tr("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof

tr("ls.club.arena.seatsinvipboxes"),
TranslationFacility.tr("ls.club.arena.seatsinvipboxes"),
"%", // Percentage of crowd in the VIP seats
tr("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes

tr("Fans"), // Fananzahl
tr("Fans") + " / "
+ tr("Wochen"),
tr("Zuschauer") + " / "
+ tr("Fans"),
tr("Fans"), // Stimmung
tr("Platzierung") // LigaPlatz
TranslationFacility.tr("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes

TranslationFacility.tr("Fans"), // Fananzahl
TranslationFacility.tr("Fans") + " / "
+ TranslationFacility.tr("Wochen"),
TranslationFacility.tr("Zuschauer") + " / "
+ TranslationFacility.tr("Fans"),
TranslationFacility.tr("Fans"), // Stimmung
TranslationFacility.tr("Platzierung") // LigaPlatz
};

protected Object[][] m_clData;

protected String[] m_sColumnNames = {
tr("Datum"),
TranslationFacility.tr("Datum"),
"", // Spielart
tr("Gast"), // Gast
tr("ls.match.result"),
tr("ls.match.weather"),
tr("ls.match.id"),
tr("Aktuell"), // Stadiongroesse
tr("Zuschauer"), // Zuschauer
TranslationFacility.tr("Gast"), // Gast
TranslationFacility.tr("ls.match.result"),
TranslationFacility.tr("ls.match.weather"),
TranslationFacility.tr("ls.match.id"),
TranslationFacility.tr("Aktuell"), // Stadiongroesse
TranslationFacility.tr("Zuschauer"), // Zuschauer
"%", // Auslastung
tr("ls.club.arena.income.total"), // Income Total
TranslationFacility.tr("ls.club.arena.income.total"), // Income Total

tr("ls.club.arena.terraces"),
TranslationFacility.tr("ls.club.arena.terraces"),
"%", // Percentage of crowd on the terraces
tr("ls.club.arena.income.terraces"), // Income Terraces
TranslationFacility.tr("ls.club.arena.income.terraces"), // Income Terraces

tr("ls.club.arena.basicseating"),
TranslationFacility.tr("ls.club.arena.basicseating"),
"%", // Percentage of crowd in the basic seats
tr("ls.club.arena.income.basicseating"), // Income Basic
TranslationFacility.tr("ls.club.arena.income.basicseating"), // Income Basic

tr("ls.club.arena.seatsunderroof"),
TranslationFacility.tr("ls.club.arena.seatsunderroof"),
"%", // Percentage of crowd under the roof
tr("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof
TranslationFacility.tr("ls.club.arena.income.seatsunderroof"), // Income Seats Under Roof

tr("ls.club.arena.seatsinvipboxes"),
TranslationFacility.tr("ls.club.arena.seatsinvipboxes"),
"%", // Percentage of crowd in the VIP seats
tr("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes

tr("Fans"), // Fananzahl
tr("Fans") + " / "
+ tr("Wochen"),
tr("Zuschauer") + " / "
+ tr("Fans"),
tr("Fans"), // Stimmung
tr("Platzierung") // LigaPlatz
TranslationFacility.tr("ls.club.arena.income.seatsinvipboxes"), // Income Seats In Vip Boxes

TranslationFacility.tr("Fans"), // Fananzahl
TranslationFacility.tr("Fans") + " / "
+ TranslationFacility.tr("Wochen"),
TranslationFacility.tr("Zuschauer") + " / "
+ TranslationFacility.tr("Fans"),
TranslationFacility.tr("Fans"), // Stimmung
TranslationFacility.tr("Platzierung") // LigaPlatz
};
private ArenaStatistikModel[] m_clMatches;
private int m_iMaxArenaGroesse;
Expand Down
Loading

0 comments on commit 6967f3d

Please sign in to comment.