Skip to content

Commit 2fd78c4

Browse files
committed
feat(proxy): enable system proxy detection and improve proxy handling
1 parent 92504ba commit 2fd78c4

1 file changed

Lines changed: 80 additions & 5 deletions

File tree

easy-postman-app/src/main/java/com/laker/postman/panel/performance/result/PerformanceTrendPanel.java

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,88 @@ private void ensureChartsInitialized() {
184184
}
185185

186186
private void showDeferredPlaceholder() {
187-
JPanel placeholder = new JPanel(new BorderLayout());
188-
placeholder.setBorder(BorderFactory.createEmptyBorder(24, 24, 24, 24));
189-
JLabel label = new JLabel(I18nUtil.getMessage(MessageKeys.PERFORMANCE_TREND_TIME), SwingConstants.CENTER);
190-
label.setEnabled(false);
191-
placeholder.add(label, BorderLayout.CENTER);
187+
JPanel placeholder = createDeferredPlaceholderPanel();
192188
chartContainer.removeAll();
193189
chartContainer.add(placeholder, BorderLayout.CENTER);
190+
chartContainer.revalidate();
191+
chartContainer.repaint();
192+
}
193+
194+
private JPanel createDeferredPlaceholderPanel() {
195+
return new JPanel(new BorderLayout()) {
196+
{
197+
setOpaque(true);
198+
setBackground(getChartPanelBackgroundColor());
199+
setBorder(BorderFactory.createEmptyBorder(18, 18, 18, 18));
200+
}
201+
202+
@Override
203+
protected void paintComponent(Graphics g) {
204+
super.paintComponent(g);
205+
Graphics2D g2 = (Graphics2D) g.create();
206+
try {
207+
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
208+
209+
int width = getWidth();
210+
int height = getHeight();
211+
if (width <= 120 || height <= 120) {
212+
return;
213+
}
214+
215+
Color cardBg = isDarkTheme() ? new Color(52, 52, 52) : new Color(252, 253, 255);
216+
Color borderColor = isDarkTheme() ? new Color(82, 82, 82) : new Color(230, 235, 242);
217+
Color blockColor = isDarkTheme() ? new Color(78, 78, 78) : new Color(237, 241, 246);
218+
Color accentColor = isDarkTheme() ? new Color(100, 181, 246, 90) : new Color(33, 150, 243, 55);
219+
Color titleColor = isDarkTheme() ? new Color(205, 205, 205) : new Color(88, 96, 108);
220+
Color hintColor = isDarkTheme() ? new Color(160, 160, 160) : new Color(130, 138, 148);
221+
222+
int cardW = Math.min(520, width - 48);
223+
int cardH = 190;
224+
int cardX = (width - cardW) / 2;
225+
int cardY = Math.max(28, (height - cardH) / 2 - 24);
226+
227+
g2.setColor(cardBg);
228+
g2.fillRoundRect(cardX, cardY, cardW, cardH, 20, 20);
229+
g2.setColor(borderColor);
230+
g2.drawRoundRect(cardX, cardY, cardW, cardH, 20, 20);
231+
232+
int topBarX = cardX + 24;
233+
int topBarY = cardY + 22;
234+
g2.setColor(accentColor);
235+
g2.fillRoundRect(topBarX, topBarY, 112, 10, 10, 10);
236+
237+
g2.setColor(blockColor);
238+
g2.fillRoundRect(topBarX, topBarY + 28, cardW - 48, 14, 12, 12);
239+
g2.fillRoundRect(topBarX, topBarY + 56, cardW - 140, 12, 10, 10);
240+
g2.fillRoundRect(topBarX, topBarY + 80, cardW - 180, 12, 10, 10);
241+
242+
int chipY = topBarY + 118;
243+
int chipX = topBarX;
244+
int[] chipWidths = {74, 96, 82};
245+
for (int chipWidth : chipWidths) {
246+
g2.fillRoundRect(chipX, chipY, chipWidth, 28, 14, 14);
247+
chipX += chipWidth + 12;
248+
}
249+
250+
g2.setFont(FontsUtil.getDefaultFontWithOffset(Font.BOLD, 0));
251+
g2.setColor(titleColor);
252+
String title = "\u8d8b\u52bf\u56fe\u5c06\u5728\u91c7\u6837\u540e\u663e\u793a";
253+
FontMetrics titleMetrics = g2.getFontMetrics();
254+
int titleX = (width - titleMetrics.stringWidth(title)) / 2;
255+
int titleY = cardY + cardH + 42;
256+
g2.drawString(title, titleX, titleY);
257+
258+
g2.setFont(FontsUtil.getDefaultFontWithOffset(Font.PLAIN, -1));
259+
g2.setColor(hintColor);
260+
String hint = "\u542f\u52a8\u538b\u6d4b\u540e\uff0c\u8fd9\u91cc\u4f1a\u663e\u793a\u7528\u6237\u6570\u3001QPS \u548c\u54cd\u5e94\u65f6\u95f4";
261+
FontMetrics hintMetrics = g2.getFontMetrics();
262+
int hintX = (width - hintMetrics.stringWidth(hint)) / 2;
263+
g2.drawString(hint, hintX, titleY + 24);
264+
} finally {
265+
g2.dispose();
266+
}
267+
}
268+
};
194269
}
195270

196271
/**

0 commit comments

Comments
 (0)