|
|
|
@ -21,6 +21,7 @@ import com.fr.env.detect.base.EnvDetectorConfig;
|
|
|
|
|
import com.fr.env.detect.bean.DetectorResult; |
|
|
|
|
import com.fr.env.detect.bean.DetectorStatus; |
|
|
|
|
import com.fr.env.detect.bean.DetectorType; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
@ -55,6 +56,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
private static final int TIMEOUT = 1000; |
|
|
|
|
|
|
|
|
|
private static final Color SUCCESS_COLOR = new Color(22, 193, 83); |
|
|
|
|
private static final Color DETAIL_FONT_COLOR = new Color(65, 155, 249); |
|
|
|
|
|
|
|
|
|
private final JPanel body; |
|
|
|
|
|
|
|
|
@ -177,7 +179,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
} |
|
|
|
|
// 执行前
|
|
|
|
|
buttonStatus = buttonStatus.next(); |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshHeaderPanel); |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshHeader); |
|
|
|
|
detectWorker = new SwingWorker<Void, Void>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -192,7 +194,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 刷新一下面板-开始执行啦
|
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refresh); |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshBody); |
|
|
|
|
|
|
|
|
|
EnvDetectorItem item = items.get(i); |
|
|
|
|
DetectorType type = item.getType(); |
|
|
|
@ -208,7 +210,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
// 只有还在运行中,才会真正的刷新面板
|
|
|
|
|
if (buttonStatus.isExecuting()) { |
|
|
|
|
// 在刷新一下面板
|
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refresh); |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshBody); |
|
|
|
|
currentDetectIndex++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -219,10 +221,15 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
@Override |
|
|
|
|
protected void done() { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
this.get(); |
|
|
|
|
if (buttonStatus.isExecuting()) { |
|
|
|
|
// 执行结束
|
|
|
|
|
buttonStatus = EnvDetectorButtonStatus.A_NEW; |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshHeaderPanel); |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshHeader); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error("detect failed", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -236,7 +243,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
e.setResult(null); |
|
|
|
|
} |
|
|
|
|
// 刷新一下面板-开始执行啦
|
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refresh); |
|
|
|
|
UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refreshBody); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void stopDetecting(UIButton detectButton) { |
|
|
|
@ -251,7 +258,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
// 刷新按钮
|
|
|
|
|
detectButton.setText(buttonStatus.getDesc()); |
|
|
|
|
// 刷新面板
|
|
|
|
|
refresh(); |
|
|
|
|
refreshBody(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -265,7 +272,7 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
this.resultSummaryPane.setLayout(new BorderLayout(5, 0)); |
|
|
|
|
Boolean success = model.getResults() |
|
|
|
|
.map((e) -> { |
|
|
|
|
if (e.getStatus() == DetectorStatus.NORMAL) { |
|
|
|
|
if (e != null && e.getStatus() == DetectorStatus.NORMAL) { |
|
|
|
|
return Boolean.TRUE; |
|
|
|
|
} |
|
|
|
|
return Boolean.FALSE; |
|
|
|
@ -361,11 +368,13 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
} |
|
|
|
|
statusPanel.add(infoPanel, BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
// 如果结果是检测出的异常,则出现详细信息。
|
|
|
|
|
if (result.getStatus() == DetectorStatus.EXCEPTION) { |
|
|
|
|
JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
{ |
|
|
|
|
detailPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
|
|
|
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine_Designer_Look_Detail")); |
|
|
|
|
detailLabel.setForeground(new Color(65, 155, 249)); |
|
|
|
|
detailLabel.setForeground(DETAIL_FONT_COLOR); |
|
|
|
|
detailLabel.addMouseListener(new MouseAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseClicked(MouseEvent mouseEvent) { |
|
|
|
@ -383,9 +392,10 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
}); |
|
|
|
|
detailPanel.add(detailLabel, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
statusPanel.add(detailPanel, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return statusPanel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -434,14 +444,14 @@ public class EnvDetectorDialog extends JDialog {
|
|
|
|
|
return tailPanel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void refreshHeaderPanel() { |
|
|
|
|
private void refreshHeader() { |
|
|
|
|
|
|
|
|
|
updateHeaderPanel(); |
|
|
|
|
pack(); |
|
|
|
|
repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void refresh() { |
|
|
|
|
private void refreshBody() { |
|
|
|
|
|
|
|
|
|
updateTable(this.tablePanel); |
|
|
|
|
pack(); |
|
|
|
|