From c18b4ebbeaa286234a7ecd637d6977398b8e902f Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Tue, 14 May 2024 20:59:26 -0500 Subject: [PATCH 1/2] Updated tooltip behavior in PersonnelTableMouseAdapter. Updated the tooltip functionality in the PersonnelTableMouseAdapter class to make use of MultiLineTooltip. The tooltips for "Marriageable" and "Trying to Conceive" options have been updated. --- MekHQ/resources/mekhq/resources/GUI.properties | 4 ++-- MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MekHQ/resources/mekhq/resources/GUI.properties b/MekHQ/resources/mekhq/resources/GUI.properties index 9d5f360ac1..3121b473c6 100644 --- a/MekHQ/resources/mekhq/resources/GUI.properties +++ b/MekHQ/resources/mekhq/resources/GUI.properties @@ -178,9 +178,9 @@ miFounder.toolTipText=If this is selected then the person is a founding member o miImmortal.text=Immortal miImmortal.toolTipText=If this is selected then the person will not be processed during random death \n(standard checks still apply) miMarriageable.text=Marriageable -miMarriageable.toolTipText=If this is selected then the person will be included as a potential spouse for marriages \n(standard checks still apply, so married personnel will not be included even if this flag is selected) +miMarriageable.toolTipText=If this is selected, then the person will be included as a potential spouse for marriages (married personnel will not be included even if this flag is selected, nor will characters under 0 years old) miTryingToConceive.text=Trying to Conceive -miTryingToConceive.toolTipText=If this is selected the person has a chance to have children created through random procreation. \n(standard checks still apply) +miTryingToConceive.toolTipText=If this is selected, the person has a chance to have children created through random procreation (this flag is ignored for personnel under 18 years old). ### Randomization Menu randomizationMenu.text=Randomization miRandomName.single.text=Randomize Name diff --git a/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java b/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java index 006bb91624..d04caa4bb1 100644 --- a/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java +++ b/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java @@ -2165,7 +2165,8 @@ protected Optional createPopupMenu() { || !gui.getCampaign().getCampaignOptions().getRandomMarriageMethod().isNone()) && Stream.of(selected).allMatch(p -> p.isMarriageable() == person.isMarriageable())) { cbMenuItem = new JCheckBoxMenuItem(resources.getString("miMarriageable.text")); - cbMenuItem.setToolTipText(resources.getString("miMarriageable.toolTipText")); + cbMenuItem.setToolTipText(MultiLineTooltip.splitToolTip(resources.getString("miMarriageable.toolTipText") + .replaceAll("0", String.valueOf(gui.getCampaign().getCampaignOptions().getMinimumMarriageAge())), 100)); cbMenuItem.setName("miMarriageable"); cbMenuItem.setSelected(person.isMarriageable()); cbMenuItem.addActionListener(evt -> { @@ -2180,7 +2181,7 @@ protected Optional createPopupMenu() { && Stream.of(selected).allMatch(p -> p.getGender().isFemale()) && Stream.of(selected).allMatch(p -> p.isTryingToConceive() == person.isTryingToConceive())) { cbMenuItem = new JCheckBoxMenuItem(resources.getString("miTryingToConceive.text")); - cbMenuItem.setToolTipText(resources.getString("miTryingToConceive.toolTipText")); + cbMenuItem.setToolTipText(MultiLineTooltip.splitToolTip(resources.getString("miTryingToConceive.toolTipText"), 100)); cbMenuItem.setName("miTryingToConceive"); cbMenuItem.setSelected(person.isTryingToConceive()); cbMenuItem.addActionListener(evt -> { From 77ad875980ec1786994a62665b42d07b410f1a50 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Wed, 15 May 2024 19:42:49 -0500 Subject: [PATCH 2/2] Updated tooltip text formatting for marriageability The tooltip text for the "Marriageable" menu item has been updated to use the String.format method for cleaner text replacement. Additionally, the GUI properties file has been adjusted to support this update, changing the replacement syntax to use a placeholder ("%s") for the minimum marriage age. --- MekHQ/resources/mekhq/resources/GUI.properties | 2 +- MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MekHQ/resources/mekhq/resources/GUI.properties b/MekHQ/resources/mekhq/resources/GUI.properties index 3121b473c6..258820b30d 100644 --- a/MekHQ/resources/mekhq/resources/GUI.properties +++ b/MekHQ/resources/mekhq/resources/GUI.properties @@ -178,7 +178,7 @@ miFounder.toolTipText=If this is selected then the person is a founding member o miImmortal.text=Immortal miImmortal.toolTipText=If this is selected then the person will not be processed during random death \n(standard checks still apply) miMarriageable.text=Marriageable -miMarriageable.toolTipText=If this is selected, then the person will be included as a potential spouse for marriages (married personnel will not be included even if this flag is selected, nor will characters under 0 years old) +miMarriageable.toolTipText=If this is selected, then the person will be included as a potential spouse for marriages (married personnel will not be included even if this flag is selected, nor will characters under %s years old) miTryingToConceive.text=Trying to Conceive miTryingToConceive.toolTipText=If this is selected, the person has a chance to have children created through random procreation (this flag is ignored for personnel under 18 years old). ### Randomization Menu diff --git a/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java b/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java index d04caa4bb1..d8b43ee4ab 100644 --- a/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java +++ b/MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java @@ -2165,8 +2165,8 @@ protected Optional createPopupMenu() { || !gui.getCampaign().getCampaignOptions().getRandomMarriageMethod().isNone()) && Stream.of(selected).allMatch(p -> p.isMarriageable() == person.isMarriageable())) { cbMenuItem = new JCheckBoxMenuItem(resources.getString("miMarriageable.text")); - cbMenuItem.setToolTipText(MultiLineTooltip.splitToolTip(resources.getString("miMarriageable.toolTipText") - .replaceAll("0", String.valueOf(gui.getCampaign().getCampaignOptions().getMinimumMarriageAge())), 100)); + cbMenuItem.setToolTipText(MultiLineTooltip.splitToolTip(String.format(resources.getString("miMarriageable.toolTipText"), + gui.getCampaign().getCampaignOptions().getMinimumMarriageAge()), 100)); cbMenuItem.setName("miMarriageable"); cbMenuItem.setSelected(person.isMarriageable()); cbMenuItem.addActionListener(evt -> {