diff --git a/src/main/java/com/botdetector/BotDetectorConfig.java b/src/main/java/com/botdetector/BotDetectorConfig.java
index ed027211..7b13c2fe 100644
--- a/src/main/java/com/botdetector/BotDetectorConfig.java
+++ b/src/main/java/com/botdetector/BotDetectorConfig.java
@@ -49,6 +49,7 @@ public interface BotDetectorConfig extends Config
String SHOW_FEEDBACK_TEXTBOX = "showFeedbackTextbox";
String SHOW_DISCORD_VERIFICATION_ERRORS = "showDiscordVerificationErrors";
String ANONYMOUS_UUID_KEY = "anonymousUUID";
+ String AUTO_SHOW_BREAKDOWN_PANEL_KEY = "autoShowBreakdownPanel";
int AUTO_SEND_MINIMUM_MINUTES = 5;
int AUTO_SEND_MAXIMUM_MINUTES = 360;
@@ -183,6 +184,15 @@ default PanelFontType panelFontType()
return PanelFontType.NORMAL;
}
+ @ConfigItem(
+ position = 5,
+ keyName = AUTO_SHOW_BREAKDOWN_PANEL_KEY,
+ name = "Auto Show Prediction Breakdown",
+ description = "Automatically shows the prediction breakdown panel when receiving a prediction.",
+ section = panelSection
+ )
+ default boolean autoShowBreakdownPanel() {return false;}
+
@ConfigItem(
position = 1,
keyName = ADD_PREDICT_OPTION_KEY,
diff --git a/src/main/java/com/botdetector/BotDetectorPlugin.java b/src/main/java/com/botdetector/BotDetectorPlugin.java
index 80e1638c..6f17bc5a 100644
--- a/src/main/java/com/botdetector/BotDetectorPlugin.java
+++ b/src/main/java/com/botdetector/BotDetectorPlugin.java
@@ -628,6 +628,9 @@ private void onConfigChanged(ConfigChanged event)
case BotDetectorConfig.ONLY_SEND_AT_LOGOUT_KEY:
updateTimeToAutoSend();
break;
+ case BotDetectorConfig.AUTO_SHOW_BREAKDOWN_PANEL_KEY:
+ SwingUtilities.invokeLater(() -> panel.setPredictionBreakdownButtons());
+ break;
}
}
diff --git a/src/main/java/com/botdetector/ui/BotDetectorPanel.java b/src/main/java/com/botdetector/ui/BotDetectorPanel.java
index f19c83ee..df9c5bf0 100644
--- a/src/main/java/com/botdetector/ui/BotDetectorPanel.java
+++ b/src/main/java/com/botdetector/ui/BotDetectorPanel.java
@@ -210,6 +210,8 @@ public enum WarningLabel
private JLabel predictionPlayerNameLabel;
private JLabel predictionTypeLabel;
private JLabel predictionConfidenceLabel;
+ private JButton showPredictionBreakdownButton;
+ private JButton hidePredictionBreakdownButton;
// Prediction Breakdown
private JLabel predictionBreakdownLabel;
@@ -705,6 +707,36 @@ private JPanel primaryPredictionPanel()
primaryPredictionPanel.add(predictionConfidenceLabel, c);
switchableFontComponents.add(predictionConfidenceLabel);
+
+ showPredictionBreakdownButton = new JButton("Show Breakdown");
+ showPredictionBreakdownButton.setToolTipText("View the complete breakdown of the prediction for the selected account." +
+ "
NOTE: We only utilize the primary prediction for our bot detection purposes.");
+ showPredictionBreakdownButton.setForeground(HEADER_COLOR);
+ showPredictionBreakdownButton.setFont(SMALL_FONT);
+ showPredictionBreakdownButton.addActionListener(l -> setPredictionBreakdownPanel(true));
+ showPredictionBreakdownButton.setFocusable(false);
+ c.gridx = 0;
+ c.weightx = 0;
+ c.gridwidth = 2;
+ c.gridy++;
+ primaryPredictionPanel.add(showPredictionBreakdownButton, c);
+ setShowPredictionBreakdownButton(false);
+
+
+ hidePredictionBreakdownButton = new JButton("Hide Breakdown");
+ hidePredictionBreakdownButton.setToolTipText("Close the prediction breakdown panel.");
+ hidePredictionBreakdownButton.setForeground(HEADER_COLOR);
+ hidePredictionBreakdownButton.setFont(SMALL_FONT);
+ hidePredictionBreakdownButton.addActionListener(l -> setPredictionBreakdownPanel(false));
+ hidePredictionBreakdownButton.setFocusable(false);
+ c.gridx = 0;
+ c.weightx = 0;
+ c.gridwidth = 2;
+ c.gridy++;
+ primaryPredictionPanel.add(hidePredictionBreakdownButton, c);
+ setHidePredictionBreakdownButton(false);
+
+
return primaryPredictionPanel;
}
@@ -1039,6 +1071,59 @@ public void setFeedbackTextboxVisible(boolean visible)
feedbackTextScrollPane.setVisible(visible);
}
+ /**
+ * Sets the visibility of the button that shows the prediction breakdown panel.
+ * @param visible The visibility to apply on the show prediction breakdown panel button.
+ */
+ public void setShowPredictionBreakdownButton(boolean visible)
+ {
+ showPredictionBreakdownButton.setVisible(visible);
+ }
+
+ /**
+ * Sets the visibility of the button that hide the prediction breakdown panel.
+ * @param visible The visibility to apply on the hide prediction breakdown panel button.
+ */
+ public void setHidePredictionBreakdownButton(boolean visible)
+ {
+ hidePredictionBreakdownButton.setVisible(visible);
+ }
+
+ /**
+ * Sets visibility of prediction breakdown panel and shows appropriate show/hide button in the primary panel.
+ * @param visible The desired visibility state of the breakdown panel.
+ */
+ private void setPredictionBreakdownPanel(boolean visible)
+ {
+ predictionBreakdownPanel.setVisible(visible);
+
+ setPredictionBreakdownButtons();
+
+ }
+
+ /**
+ * Sets visibility of the "Show Breakdown" and "Hide Breakdown" buttons in the Primary Prediction panel.
+ */
+ public void setPredictionBreakdownButtons()
+ {
+ if(config.autoShowBreakdownPanel())
+ {
+ //If the user opted to auto show prediction breakdown then hide buttons.
+ setHidePredictionBreakdownButton(false);
+ setShowPredictionBreakdownButton(false);
+ }
+ else if(predictionBreakdownPanel.isVisible())
+ {
+ setHidePredictionBreakdownButton(true);
+ setShowPredictionBreakdownButton(false);
+ }
+ else
+ {
+ setHidePredictionBreakdownButton(false);
+ setShowPredictionBreakdownButton(true);
+ }
+ }
+
/**
* Forcibly hides the feedback panel.
*/
@@ -1112,7 +1197,7 @@ public void setPrediction(Prediction pred, PlayerSighting sighting)
else
{
predictionBreakdownLabel.setText(toPredictionBreakdownString(pred.getPredictionBreakdown()));
- predictionBreakdownPanel.setVisible(true);
+ setPredictionBreakdownPanel(config.autoShowBreakdownPanel());
final String primaryLabel = pred.getPredictionLabel();
@@ -1191,6 +1276,8 @@ public void setPrediction(Prediction pred, PlayerSighting sighting)
predictionConfidenceLabel.setText(EMPTY_LABEL);
predictionBreakdownLabel.setText(EMPTY_LABEL);
+ setPredictionBreakdownPanel(false);
+ setShowPredictionBreakdownButton(false);
predictionBreakdownPanel.setVisible(false);
predictionFeedbackPanel.setVisible(false);
predictionFlaggingPanel.setVisible(false);