From 48fa065e7802c73ebaee58525045c55f30239351 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Thu, 20 Jun 2024 12:52:57 -0500 Subject: [PATCH 1/3] feat: Reversed rating names based on campaign options - Updated rating names sequence in `MissionViewPanel.java`, `ContractSummaryPanel.java`, and `CustomizeAtBContractDialog.java` - Added conditional check to reverse rating names if `isReverseQualityNames()` in campaign options is true. --- .../gui/dialog/CustomizeAtBContractDialog.java | 13 +++++++++---- MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java | 7 +++++-- MekHQ/src/mekhq/gui/view/MissionViewPanel.java | 8 ++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java index e9828553e2..c396e369ee 100644 --- a/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java @@ -164,17 +164,22 @@ public Component getListCellRendererComponent(final JList list, final Object btnClose = new JButton(); txtDesc = new MarkdownEditorPanel("Contract Description"); JLabel lblPlanetName = new JLabel(); - // TODO : Switch me to use IUnitRating - String[] ratingNames = {"F", "D", "C", "B", "A"}; + + String[] qualityNames = {"A", "B", "C", "D", "F"}; + + if (campaign.getCampaignOptions().isReverseQualityNames()) { + qualityNames = new String[] { "F", "D", "C", "B", "A" }; + } + final DefaultComboBoxModel allySkillModel = new DefaultComboBoxModel<>(); allySkillModel.addAll(SkillLevel.getGeneratableValues()); comboAllySkill = new MMComboBox<>("comboAllySkill", allySkillModel); - cbAllyQuality = new JComboBox<>(ratingNames); + cbAllyQuality = new JComboBox<>(qualityNames); JLabel lblAllyRating = new JLabel(); final DefaultComboBoxModel enemySkillModel = new DefaultComboBoxModel<>(); enemySkillModel.addAll(SkillLevel.getGeneratableValues()); comboEnemySkill = new MMComboBox<>("comboEnemySkill", enemySkillModel); - cbEnemyQuality = new JComboBox<>(ratingNames); + cbEnemyQuality = new JComboBox<>(qualityNames); JLabel lblAllyBotName = new JLabel(); txtAllyBotName = new JTextField(); JLabel lblEnemyBotName = new JLabel(); diff --git a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java index b353005ccf..73d6f7d1c6 100644 --- a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java +++ b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java @@ -117,8 +117,11 @@ private void initComponents() { private void fillStats() { //region Variable Initialization - // TODO : Switch me to use IUnitRating - String[] ratingNames = {"F", "D", "C", "B", "A"}; + String[] ratingNames = {"A", "B", "C", "D", "F"}; + + if (campaign.getCampaignOptions().isReverseQualityNames()) { + ratingNames = new String[] { "F", "D", "C", "B", "A" }; + } // Initializing the GridBagConstraint used for Labels // To use this you MUST AND ONLY overwrite gridy diff --git a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java index a7648ae29d..a4948ad316 100644 --- a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java +++ b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java @@ -557,8 +557,12 @@ private void fillStatsAtBContract() { AtBContract contract = (AtBContract) mission; Campaign campaign = gui.getCampaign(); - // TODO : Switch me to use IUnitRating - String[] ratingNames = {"F", "D", "C", "B", "A"}; + String[] ratingNames = {"A", "B", "C", "D", "F"}; + + if (campaign.getCampaignOptions().isReverseQualityNames()) { + ratingNames = new String[] { "F", "D", "C", "B", "A" }; + } + lblStatus = new JLabel(); lblLocation = new JLabel(); txtLocation = new JLabel(); From 21ad618c2a5d6f65a4d4defeef1c2ff52e443af0 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Thu, 20 Jun 2024 13:44:46 -0500 Subject: [PATCH 2/3] feat: Updated ally and enemy rating labels and references - Replaced 'Ally Dragoon Rating' and 'Enemy Dragoon Rating' with 'Ally Experience & Tech Rating' and 'Enemy Experience & Tech Rating' in various properties files - Renamed 'ratingNames' to 'qualityNames' in MissionViewPanel.java, ContractSummaryPanel.java - Updated references in Java files to align with label changes in properties files --- .../mekhq/resources/ContractMarketDialog.properties | 4 ++-- .../mekhq/resources/ContractViewPanel.properties | 6 +++--- .../mekhq/resources/NewContractDialog.properties | 4 ++-- MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java | 8 ++++---- MekHQ/src/mekhq/gui/view/MissionViewPanel.java | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties b/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties index 03e7ea9005..a3013c1c57 100644 --- a/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties +++ b/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties @@ -20,8 +20,8 @@ lblEnemy.text=Enemy: lblMissionType.text=Mission Type: lblLocation.text=Location: lblDistance.text= Days (Jumps) to Location: -lblAllyRating.text=Ally Dragoon Rating: -lblEnemyRating.text=Enemy Dragoon Rating: +lblAllyRating.text=Ally Experience & Tech Rating: +lblEnemyRating.text=Enemy Experience & Tech Rating: lblStartDate.text=Start Date: lblLength.text=Contract length (months): lblOverhead.text=Overhead Compensation: diff --git a/MekHQ/resources/mekhq/resources/ContractViewPanel.properties b/MekHQ/resources/mekhq/resources/ContractViewPanel.properties index 1484f2da5c..57ad00cdf9 100644 --- a/MekHQ/resources/mekhq/resources/ContractViewPanel.properties +++ b/MekHQ/resources/mekhq/resources/ContractViewPanel.properties @@ -10,12 +10,12 @@ lblSalvageValueMerc.text=Total Value Salvaged (Mercs): lblSalvageValueEmployer.text=Total Value Salvaged (Employer): lblSalvagePct.text=Salvage Percentage: lblSalvage.text=Salvage Rights: -exchange=Exchange +exchange=Exchange none=None lblEnemy.text=Enemy: -lblAllyRating.text=Ally Dragoon Rating: -lblEnemyRating.text=Enemy Dragoon Rating: +lblAllyRating.text=Ally Experience & Tech Rating: +lblEnemyRating.text=Enemy Experience & Tech Rating: lblMorale.text=Enemy Morale: lblScore.text=Contract Score: lblBonusParts.text=Bonus Parts: diff --git a/MekHQ/resources/mekhq/resources/NewContractDialog.properties b/MekHQ/resources/mekhq/resources/NewContractDialog.properties index a4e1bc7036..ba426ac38b 100644 --- a/MekHQ/resources/mekhq/resources/NewContractDialog.properties +++ b/MekHQ/resources/mekhq/resources/NewContractDialog.properties @@ -35,8 +35,8 @@ checkMRBC.text=Pay MRBC Fee checkSalvageExchange.text=Exchange Rights lblEnemy.text=Enemy: -lblAllyRating.text=Ally Dragoon Rating: -lblEnemyRating.text=Enemy Dragoon Rating: +lblAllyRating.text=Ally Experience & Tech Rating: +lblEnemyRating.text=Enemy Experience & Tech Rating: chkShowAllFactions.text=Show All Factions chkShowAllPlanets.text=Show All Planets lblDistance.text=Days (Jumps) to Location: diff --git a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java index 73d6f7d1c6..e671a2d0b2 100644 --- a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java +++ b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java @@ -117,10 +117,10 @@ private void initComponents() { private void fillStats() { //region Variable Initialization - String[] ratingNames = {"A", "B", "C", "D", "F"}; + String[] qualityNames = {"A", "B", "C", "D", "F"}; if (campaign.getCampaignOptions().isReverseQualityNames()) { - ratingNames = new String[] { "F", "D", "C", "B", "A" }; + qualityNames = new String[] { "F", "D", "C", "B", "A" }; } // Initializing the GridBagConstraint used for Labels @@ -242,7 +242,7 @@ public void mouseClicked(MouseEvent e) { if (contract instanceof AtBContract) { JLabel txtAllyRating = new JLabel(((AtBContract) contract).getAllySkill() - + "/" + ratingNames[((AtBContract) contract).getAllyQuality()]); + + "/" + qualityNames[((AtBContract) contract).getAllyQuality()]); txtAllyRating.setName("txtAllyRating"); gridBagConstraintsText.gridy = y; mainPanel.add(txtAllyRating, gridBagConstraintsText); @@ -253,7 +253,7 @@ public void mouseClicked(MouseEvent e) { mainPanel.add(lblEnemyRating, gridBagConstraintsLabels); JLabel txtEnemyRating = new JLabel(((AtBContract) contract).getEnemySkill() - + "/" + ratingNames[((AtBContract) contract).getEnemyQuality()]); + + "/" + qualityNames[((AtBContract) contract).getEnemyQuality()]); txtEnemyRating.setName("txtEnemyRating"); gridBagConstraintsText.gridy = y; mainPanel.add(txtEnemyRating, gridBagConstraintsText); diff --git a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java index a4948ad316..462c144bcb 100644 --- a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java +++ b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java @@ -557,10 +557,10 @@ private void fillStatsAtBContract() { AtBContract contract = (AtBContract) mission; Campaign campaign = gui.getCampaign(); - String[] ratingNames = {"A", "B", "C", "D", "F"}; + String[] qualityNames = {"A", "B", "C", "D", "F"}; if (campaign.getCampaignOptions().isReverseQualityNames()) { - ratingNames = new String[] { "F", "D", "C", "B", "A" }; + qualityNames = new String[] { "F", "D", "C", "B", "A" }; } lblStatus = new JLabel(); @@ -717,7 +717,7 @@ public void mouseClicked(MouseEvent e) { pnlStats.add(lblAllyRating, gridBagConstraints); txtAllyRating.setName("txtAllyRating"); - txtAllyRating.setText(contract.getAllySkill() + "/" + ratingNames[contract.getAllyQuality()]); + txtAllyRating.setText(contract.getAllySkill() + "/" + qualityNames[contract.getAllyQuality()]); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = y++; @@ -737,7 +737,7 @@ public void mouseClicked(MouseEvent e) { pnlStats.add(lblEnemyRating, gridBagConstraints); txtEnemyRating.setName("txtEnemyRating"); - txtEnemyRating.setText(contract.getEnemySkill() + "/" + ratingNames[contract.getEnemyQuality()]); + txtEnemyRating.setText(contract.getEnemySkill() + "/" + qualityNames[contract.getEnemyQuality()]); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = y++; From a6e52b60cb5895ae6de1a4f1e80e087099c38de9 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Thu, 20 Jun 2024 15:03:58 -0500 Subject: [PATCH 3/3] feat: updated skill ratings terminology and planned switch to IUnitRating - Changed "Tech Rating" to "Equipment" in ContractViewPanel, NewContractDialog, and ContractMarketDialog resources - Removed reverse quality names logic in MissionViewPanel, ContractSummaryPanel, and CustomizeAtBContractDialog - Planned for a switch to use IUnitRating system in skill ratings logic --- .../mekhq/resources/ContractMarketDialog.properties | 4 ++-- .../mekhq/resources/ContractViewPanel.properties | 4 ++-- .../mekhq/resources/NewContractDialog.properties | 4 ++-- .../gui/dialog/CustomizeAtBContractDialog.java | 13 ++++--------- MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java | 11 ++++------- MekHQ/src/mekhq/gui/view/MissionViewPanel.java | 12 ++++-------- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties b/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties index a3013c1c57..2e176b09d9 100644 --- a/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties +++ b/MekHQ/resources/mekhq/resources/ContractMarketDialog.properties @@ -20,8 +20,8 @@ lblEnemy.text=Enemy: lblMissionType.text=Mission Type: lblLocation.text=Location: lblDistance.text= Days (Jumps) to Location: -lblAllyRating.text=Ally Experience & Tech Rating: -lblEnemyRating.text=Enemy Experience & Tech Rating: +lblAllyRating.text=Ally Experience & Equipment: +lblEnemyRating.text=Enemy Experience & Equipment: lblStartDate.text=Start Date: lblLength.text=Contract length (months): lblOverhead.text=Overhead Compensation: diff --git a/MekHQ/resources/mekhq/resources/ContractViewPanel.properties b/MekHQ/resources/mekhq/resources/ContractViewPanel.properties index 57ad00cdf9..3f4f51d09b 100644 --- a/MekHQ/resources/mekhq/resources/ContractViewPanel.properties +++ b/MekHQ/resources/mekhq/resources/ContractViewPanel.properties @@ -14,8 +14,8 @@ exchange=Exchange none=None lblEnemy.text=Enemy: -lblAllyRating.text=Ally Experience & Tech Rating: -lblEnemyRating.text=Enemy Experience & Tech Rating: +lblAllyRating.text=Ally Experience & Equipment: +lblEnemyRating.text=Enemy Experience & Equipment: lblMorale.text=Enemy Morale: lblScore.text=Contract Score: lblBonusParts.text=Bonus Parts: diff --git a/MekHQ/resources/mekhq/resources/NewContractDialog.properties b/MekHQ/resources/mekhq/resources/NewContractDialog.properties index ba426ac38b..e53aec9e9f 100644 --- a/MekHQ/resources/mekhq/resources/NewContractDialog.properties +++ b/MekHQ/resources/mekhq/resources/NewContractDialog.properties @@ -35,8 +35,8 @@ checkMRBC.text=Pay MRBC Fee checkSalvageExchange.text=Exchange Rights lblEnemy.text=Enemy: -lblAllyRating.text=Ally Experience & Tech Rating: -lblEnemyRating.text=Enemy Experience & Tech Rating: +lblAllyRating.text=Ally Experience & Equipment: +lblEnemyRating.text=Enemy Experience & Equipment: chkShowAllFactions.text=Show All Factions chkShowAllPlanets.text=Show All Planets lblDistance.text=Days (Jumps) to Location: diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java index c396e369ee..e9828553e2 100644 --- a/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java @@ -164,22 +164,17 @@ public Component getListCellRendererComponent(final JList list, final Object btnClose = new JButton(); txtDesc = new MarkdownEditorPanel("Contract Description"); JLabel lblPlanetName = new JLabel(); - - String[] qualityNames = {"A", "B", "C", "D", "F"}; - - if (campaign.getCampaignOptions().isReverseQualityNames()) { - qualityNames = new String[] { "F", "D", "C", "B", "A" }; - } - + // TODO : Switch me to use IUnitRating + String[] ratingNames = {"F", "D", "C", "B", "A"}; final DefaultComboBoxModel allySkillModel = new DefaultComboBoxModel<>(); allySkillModel.addAll(SkillLevel.getGeneratableValues()); comboAllySkill = new MMComboBox<>("comboAllySkill", allySkillModel); - cbAllyQuality = new JComboBox<>(qualityNames); + cbAllyQuality = new JComboBox<>(ratingNames); JLabel lblAllyRating = new JLabel(); final DefaultComboBoxModel enemySkillModel = new DefaultComboBoxModel<>(); enemySkillModel.addAll(SkillLevel.getGeneratableValues()); comboEnemySkill = new MMComboBox<>("comboEnemySkill", enemySkillModel); - cbEnemyQuality = new JComboBox<>(qualityNames); + cbEnemyQuality = new JComboBox<>(ratingNames); JLabel lblAllyBotName = new JLabel(); txtAllyBotName = new JTextField(); JLabel lblEnemyBotName = new JLabel(); diff --git a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java index e671a2d0b2..b353005ccf 100644 --- a/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java +++ b/MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java @@ -117,11 +117,8 @@ private void initComponents() { private void fillStats() { //region Variable Initialization - String[] qualityNames = {"A", "B", "C", "D", "F"}; - - if (campaign.getCampaignOptions().isReverseQualityNames()) { - qualityNames = new String[] { "F", "D", "C", "B", "A" }; - } + // TODO : Switch me to use IUnitRating + String[] ratingNames = {"F", "D", "C", "B", "A"}; // Initializing the GridBagConstraint used for Labels // To use this you MUST AND ONLY overwrite gridy @@ -242,7 +239,7 @@ public void mouseClicked(MouseEvent e) { if (contract instanceof AtBContract) { JLabel txtAllyRating = new JLabel(((AtBContract) contract).getAllySkill() - + "/" + qualityNames[((AtBContract) contract).getAllyQuality()]); + + "/" + ratingNames[((AtBContract) contract).getAllyQuality()]); txtAllyRating.setName("txtAllyRating"); gridBagConstraintsText.gridy = y; mainPanel.add(txtAllyRating, gridBagConstraintsText); @@ -253,7 +250,7 @@ public void mouseClicked(MouseEvent e) { mainPanel.add(lblEnemyRating, gridBagConstraintsLabels); JLabel txtEnemyRating = new JLabel(((AtBContract) contract).getEnemySkill() - + "/" + qualityNames[((AtBContract) contract).getEnemyQuality()]); + + "/" + ratingNames[((AtBContract) contract).getEnemyQuality()]); txtEnemyRating.setName("txtEnemyRating"); gridBagConstraintsText.gridy = y; mainPanel.add(txtEnemyRating, gridBagConstraintsText); diff --git a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java index 462c144bcb..a7648ae29d 100644 --- a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java +++ b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java @@ -557,12 +557,8 @@ private void fillStatsAtBContract() { AtBContract contract = (AtBContract) mission; Campaign campaign = gui.getCampaign(); - String[] qualityNames = {"A", "B", "C", "D", "F"}; - - if (campaign.getCampaignOptions().isReverseQualityNames()) { - qualityNames = new String[] { "F", "D", "C", "B", "A" }; - } - + // TODO : Switch me to use IUnitRating + String[] ratingNames = {"F", "D", "C", "B", "A"}; lblStatus = new JLabel(); lblLocation = new JLabel(); txtLocation = new JLabel(); @@ -717,7 +713,7 @@ public void mouseClicked(MouseEvent e) { pnlStats.add(lblAllyRating, gridBagConstraints); txtAllyRating.setName("txtAllyRating"); - txtAllyRating.setText(contract.getAllySkill() + "/" + qualityNames[contract.getAllyQuality()]); + txtAllyRating.setText(contract.getAllySkill() + "/" + ratingNames[contract.getAllyQuality()]); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = y++; @@ -737,7 +733,7 @@ public void mouseClicked(MouseEvent e) { pnlStats.add(lblEnemyRating, gridBagConstraints); txtEnemyRating.setName("txtEnemyRating"); - txtEnemyRating.setText(contract.getEnemySkill() + "/" + qualityNames[contract.getEnemyQuality()]); + txtEnemyRating.setText(contract.getEnemySkill() + "/" + ratingNames[contract.getEnemyQuality()]); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = y++;