|
|
@ -1,12 +1,9 @@ |
|
|
|
package com.fr.env.detect.ui; |
|
|
|
package com.fr.env.detect.ui; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.svg.IconUtils; |
|
|
|
import com.fr.base.svg.IconUtils; |
|
|
|
import com.fr.design.components.notification.NotificationAction; |
|
|
|
|
|
|
|
import com.fr.design.components.notification.NotificationDialog; |
|
|
|
import com.fr.design.components.notification.NotificationDialog; |
|
|
|
import com.fr.design.components.notification.NotificationDialogProperties; |
|
|
|
import com.fr.design.components.notification.NotificationDialogProperties; |
|
|
|
import com.fr.design.components.notification.NotificationMessage; |
|
|
|
|
|
|
|
import com.fr.design.components.notification.NotificationModel; |
|
|
|
import com.fr.design.components.notification.NotificationModel; |
|
|
|
import com.fr.design.components.notification.NotificationType; |
|
|
|
|
|
|
|
import com.fr.design.components.table.TablePanel; |
|
|
|
import com.fr.design.components.table.TablePanel; |
|
|
|
import com.fr.design.constants.DesignerColor; |
|
|
|
import com.fr.design.constants.DesignerColor; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
@ -19,14 +16,11 @@ import com.fr.design.ui.util.UIUtil; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
import com.fr.env.detect.base.DetectorBridge; |
|
|
|
import com.fr.env.detect.base.DetectorBridge; |
|
|
|
|
|
|
|
import com.fr.env.detect.base.DetectorUtil; |
|
|
|
|
|
|
|
import com.fr.env.detect.base.ExceptionDetectorConfig; |
|
|
|
import com.fr.env.detect.bean.DetectorResult; |
|
|
|
import com.fr.env.detect.bean.DetectorResult; |
|
|
|
import com.fr.env.detect.bean.DetectorStatus; |
|
|
|
import com.fr.env.detect.bean.DetectorStatus; |
|
|
|
import com.fr.env.detect.bean.DetectorType; |
|
|
|
import com.fr.env.detect.bean.DetectorType; |
|
|
|
import com.fr.env.detect.bean.ExceptionSolution; |
|
|
|
|
|
|
|
import com.fr.env.detect.bean.ExceptionTips; |
|
|
|
|
|
|
|
import com.fr.env.detect.bean.Message; |
|
|
|
|
|
|
|
import com.fr.env.detect.bean.SolutionAction; |
|
|
|
|
|
|
|
import com.fr.third.guava.collect.Lists; |
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
@ -45,15 +39,10 @@ import java.awt.Image; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.net.URL; |
|
|
|
import java.net.URL; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.function.Function; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
@ -63,6 +52,7 @@ import java.util.stream.Stream; |
|
|
|
public class EnvDetectorDialog extends JDialog { |
|
|
|
public class EnvDetectorDialog extends JDialog { |
|
|
|
|
|
|
|
|
|
|
|
private static final ImageIcon LOADING_ICON = getLoadingIcon(); |
|
|
|
private static final ImageIcon LOADING_ICON = getLoadingIcon(); |
|
|
|
|
|
|
|
public static final int TIMEOUT = 1000; |
|
|
|
|
|
|
|
|
|
|
|
private JPanel body; |
|
|
|
private JPanel body; |
|
|
|
|
|
|
|
|
|
|
@ -74,7 +64,7 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
|
|
|
|
|
|
|
|
/* 数据 model */ |
|
|
|
/* 数据 model */ |
|
|
|
|
|
|
|
|
|
|
|
private EnvDetectorModel model = new EnvDetectorModel(); |
|
|
|
private EnvDetectorModel model; |
|
|
|
|
|
|
|
|
|
|
|
/* 流程 model */ |
|
|
|
/* 流程 model */ |
|
|
|
|
|
|
|
|
|
|
@ -87,11 +77,25 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
|
|
|
|
|
|
|
|
private SwingWorker<Void, Void> detectWorker = null; |
|
|
|
private SwingWorker<Void, Void> detectWorker = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* config model */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean detectOpen = ExceptionDetectorConfig.getInstance().isOpen(); |
|
|
|
|
|
|
|
|
|
|
|
public EnvDetectorDialog(Frame owner) { |
|
|
|
public EnvDetectorDialog(Frame owner) { |
|
|
|
|
|
|
|
this(owner, null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EnvDetectorDialog(Frame owner, EnvDetectorModel model) { |
|
|
|
super(owner); |
|
|
|
super(owner); |
|
|
|
|
|
|
|
|
|
|
|
configProperties(); |
|
|
|
configProperties(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model == null) { |
|
|
|
|
|
|
|
this.model = new EnvDetectorModel(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.model = model; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.body = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
|
|
this.body = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
|
|
Color backgroundColor = new Color(240, 240, 243, 1); |
|
|
|
Color backgroundColor = new Color(240, 240, 243, 1); |
|
|
|
this.body.setBackground( backgroundColor); |
|
|
|
this.body.setBackground( backgroundColor); |
|
|
@ -117,6 +121,8 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
GUICoreUtils.centerWindow(this); |
|
|
|
GUICoreUtils.centerWindow(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* header */ |
|
|
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private JPanel createHeaderPanel() { |
|
|
|
private JPanel createHeaderPanel() { |
|
|
|
|
|
|
|
|
|
|
@ -184,12 +190,13 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
DetectorType type = item.getType(); |
|
|
|
DetectorType type = item.getType(); |
|
|
|
|
|
|
|
|
|
|
|
// 执行检测, UI-当前在检测中
|
|
|
|
// 执行检测, UI-当前在检测中
|
|
|
|
Optional<DetectorResult> detect = UIUtil.waitUntil( |
|
|
|
DetectorResult result = UIUtil.waitUntil( |
|
|
|
() -> DetectorBridge.getInstance().detect(type), |
|
|
|
() -> DetectorBridge.getInstance().detect(type), |
|
|
|
1000, TimeUnit.MILLISECONDS); |
|
|
|
TIMEOUT, TimeUnit.MILLISECONDS); |
|
|
|
// 获取结果,更新UI
|
|
|
|
// 获取结果
|
|
|
|
detect.ifPresent(item::setResult); |
|
|
|
item.setResult(result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新UI
|
|
|
|
// 只有还在运行中,才会真正的刷新面板
|
|
|
|
// 只有还在运行中,才会真正的刷新面板
|
|
|
|
if (buttonStatus.isExecuting()) { |
|
|
|
if (buttonStatus.isExecuting()) { |
|
|
|
// 在刷新一下面板
|
|
|
|
// 在刷新一下面板
|
|
|
@ -231,6 +238,8 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* table */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private TablePanel createTablePanel() { |
|
|
|
private TablePanel createTablePanel() { |
|
|
@ -285,19 +294,6 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static ImageIcon getLoadingIcon() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
URL resource = EnvDetectorDialog.class.getResource("/com/fr/design/standard/loading/loading-120.gif"); |
|
|
|
|
|
|
|
if (resource == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ImageIcon loadingIcon = new ImageIcon(resource); |
|
|
|
|
|
|
|
int width = 16; |
|
|
|
|
|
|
|
int height = 16; |
|
|
|
|
|
|
|
loadingIcon.setImage(loadingIcon.getImage().getScaledInstance(width, height, Image.SCALE_DEFAULT)); |
|
|
|
|
|
|
|
return loadingIcon; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Component createResultComponent(DetectorResult result) { |
|
|
|
private Component createResultComponent(DetectorResult result) { |
|
|
|
|
|
|
|
|
|
|
|
JPanel statusPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel statusPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
@ -305,8 +301,16 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
statusPanel.add(new UILabel(IconUtils.readIcon("/com/fr/design/standard/reminder/reminder_success.svg")), BorderLayout.WEST); |
|
|
|
statusPanel.add(new UILabel(IconUtils.readIcon("/com/fr/design/standard/reminder/reminder_success.svg")), BorderLayout.WEST); |
|
|
|
statusPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Normal")), BorderLayout.CENTER); |
|
|
|
statusPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Normal")), BorderLayout.CENTER); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
statusPanel.add(new UILabel(IconUtils.readIcon("/com/fr/design/standard/reminder/reminder_error.svg")), BorderLayout.WEST); |
|
|
|
JPanel infoPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
statusPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Exception")), BorderLayout.CENTER); |
|
|
|
{ |
|
|
|
|
|
|
|
infoPanel.add(new UILabel(IconUtils.readIcon("/com/fr/design/standard/reminder/reminder_error.svg")), BorderLayout.WEST); |
|
|
|
|
|
|
|
infoPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Exception")), BorderLayout.CENTER); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
statusPanel.add(infoPanel, BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
detailPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
|
|
|
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine_Designer_Look_Detail")); |
|
|
|
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine_Designer_Look_Detail")); |
|
|
|
detailLabel.setForeground(new Color(65, 155, 249)); |
|
|
|
detailLabel.setForeground(new Color(65, 155, 249)); |
|
|
|
detailLabel.addMouseListener(new MouseAdapter() { |
|
|
|
detailLabel.addMouseListener(new MouseAdapter() { |
|
|
@ -317,76 +321,22 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
List<NotificationModel> notificationModels = results |
|
|
|
List<NotificationModel> notificationModels = results |
|
|
|
.filter(Objects::nonNull) |
|
|
|
.filter(Objects::nonNull) |
|
|
|
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION) |
|
|
|
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION) |
|
|
|
.map(EnvDetectorDialog.this::convertDetectorResult) |
|
|
|
.map(DetectorUtil::convert2Notification) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
NotificationDialog dialog = new NotificationDialog(properties, notificationModels); |
|
|
|
NotificationDialog dialog = new NotificationDialog(properties, notificationModels); |
|
|
|
dialog.open(); |
|
|
|
dialog.open(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
statusPanel.add(detailLabel); |
|
|
|
detailPanel.add(detailLabel, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
|
|
|
|
return statusPanel; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private NotificationModel convertDetectorResult(DetectorResult result) { |
|
|
|
statusPanel.add(detailPanel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
List<NotificationMessage> messages = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function<Message, Optional<NotificationMessage>> convert2NotificationMsg = message -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NotificationMessage notificationMessage = null; |
|
|
|
|
|
|
|
if (message != null) { |
|
|
|
|
|
|
|
Message.Type type = message.getType(); |
|
|
|
|
|
|
|
switch (type) { |
|
|
|
|
|
|
|
case SIMPLE: |
|
|
|
|
|
|
|
notificationMessage = (new NotificationMessage.SimpleMessage(message.get())); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case LINK: |
|
|
|
|
|
|
|
Message.Link linkMsg = (Message.Link) message; |
|
|
|
|
|
|
|
notificationMessage = new NotificationMessage.LinkMessage(linkMsg.getText(), linkMsg.getLink()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Optional.ofNullable(notificationMessage); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExceptionTips tips = result.getTips(); |
|
|
|
|
|
|
|
convert2NotificationMsg |
|
|
|
|
|
|
|
.apply(tips.getMessage()) |
|
|
|
|
|
|
|
.ifPresent(messages::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExceptionSolution solution = result.getSolution(); |
|
|
|
|
|
|
|
convert2NotificationMsg.apply(solution.getMessage()) |
|
|
|
|
|
|
|
.ifPresent(messages::add); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NotificationAction notificationAction = null; |
|
|
|
|
|
|
|
SolutionAction solutionAction = solution.getAction(); |
|
|
|
|
|
|
|
if (solutionAction != null) { |
|
|
|
|
|
|
|
notificationAction = new NotificationAction() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String name() { |
|
|
|
|
|
|
|
return solutionAction.name(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return statusPanel; |
|
|
|
@Override |
|
|
|
|
|
|
|
public void run(Object... args) { |
|
|
|
|
|
|
|
solutionAction.run(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new NotificationModel(NotificationType.WARNING, notificationAction, messages); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refresh() { |
|
|
|
/* tail */ |
|
|
|
|
|
|
|
|
|
|
|
updateTable(this.tablePanel); |
|
|
|
|
|
|
|
pack(); |
|
|
|
|
|
|
|
repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private JPanel createTailPanel() { |
|
|
|
private JPanel createTailPanel() { |
|
|
@ -397,6 +347,11 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
JPanel configPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel configPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
{ |
|
|
|
{ |
|
|
|
UICheckBox checkBox = new UICheckBox(); |
|
|
|
UICheckBox checkBox = new UICheckBox(); |
|
|
|
|
|
|
|
checkBox.setSelected(this.detectOpen); |
|
|
|
|
|
|
|
checkBox.addChangeListener(e -> { |
|
|
|
|
|
|
|
UICheckBox source = (UICheckBox) e.getSource(); |
|
|
|
|
|
|
|
EnvDetectorDialog.this.detectOpen = source.isSelected(); |
|
|
|
|
|
|
|
}); |
|
|
|
configPanel.add(checkBox, BorderLayout.WEST); |
|
|
|
configPanel.add(checkBox, BorderLayout.WEST); |
|
|
|
UILabel description = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Detect_Switch")); |
|
|
|
UILabel description = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Detect_Switch")); |
|
|
|
configPanel.add(description, BorderLayout.EAST); |
|
|
|
configPanel.add(description, BorderLayout.EAST); |
|
|
@ -411,7 +366,7 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
setVisible(false); |
|
|
|
setVisible(false); |
|
|
|
dispose(); |
|
|
|
dispose(); |
|
|
|
// 配置处理
|
|
|
|
// 配置处理
|
|
|
|
// todo
|
|
|
|
ExceptionDetectorConfig.getInstance().setOpen(this.detectOpen); |
|
|
|
}); |
|
|
|
}); |
|
|
|
actionsPanel.add(confirmButton, BorderLayout.WEST); |
|
|
|
actionsPanel.add(confirmButton, BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
|
@ -426,89 +381,33 @@ public class EnvDetectorDialog extends JDialog { |
|
|
|
return tailPanel; |
|
|
|
return tailPanel; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void configProperties() { |
|
|
|
private void refresh() { |
|
|
|
|
|
|
|
|
|
|
|
setTitle(Toolkit.i18nText("Fine-Design_Basic_Detect_Title")); |
|
|
|
|
|
|
|
setModal(false); |
|
|
|
|
|
|
|
setFocusable(false); |
|
|
|
|
|
|
|
setAutoRequestFocus(false); |
|
|
|
|
|
|
|
setResizable(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 数据 model |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* kind-list_item |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private class EnvDetectorModel { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<DetectorType.Kind, List<EnvDetectorItem>> itemMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EnvDetectorModel() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemMap.put(DetectorType.Kind.JAR, Lists.newArrayList(new EnvDetectorItem(DetectorType.LACK_OF_JAR), new EnvDetectorItem(DetectorType.JAR_IN_CONSISTENCE), new EnvDetectorItem(DetectorType.JAR_CONFLICT))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemMap.put(DetectorType.Kind.FINE_DB, Lists.newArrayList(new EnvDetectorItem(DetectorType.FINE_DB_LOCKED), new EnvDetectorItem(DetectorType.FINE_DB_PERMISSION), new EnvDetectorItem(DetectorType.FINE_DB_DIRTY))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void update(DetectorType type, DetectorResult result) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EnvDetectorItem> items = itemMap.get(type.getKind()); |
|
|
|
|
|
|
|
items.stream() |
|
|
|
|
|
|
|
.filter((e) -> e.getType() == type) |
|
|
|
|
|
|
|
.findFirst() |
|
|
|
|
|
|
|
.ifPresent((e) -> {e.setResult(result);}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Stream<DetectorResult> getResults() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return getItems().stream() |
|
|
|
|
|
|
|
.map(EnvDetectorItem::getResult); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<EnvDetectorItem> getItems() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return itemMap.values().stream() |
|
|
|
|
|
|
|
.flatMap(Collection::stream) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<DetectorType.Kind, List<EnvDetectorItem>> getItemMap() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.itemMap; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class EnvDetectorItem { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DetectorType type; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DetectorResult result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EnvDetectorItem(DetectorType detectorType) { |
|
|
|
updateTable(this.tablePanel); |
|
|
|
this.type = detectorType; |
|
|
|
pack(); |
|
|
|
|
|
|
|
repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public DetectorType getType() { |
|
|
|
private static ImageIcon getLoadingIcon() { |
|
|
|
return type; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getKind() { |
|
|
|
URL resource = EnvDetectorDialog.class.getResource("/com/fr/design/standard/loading/loading-120.gif"); |
|
|
|
return this.type.getKind().getDescription(); |
|
|
|
if (resource == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ImageIcon loadingIcon = new ImageIcon(resource); |
|
|
|
public String getDescription() { |
|
|
|
int width = 16; |
|
|
|
return this.type.getDescription(); |
|
|
|
int height = 16; |
|
|
|
|
|
|
|
loadingIcon.setImage(loadingIcon.getImage().getScaledInstance(width, height, Image.SCALE_DEFAULT)); |
|
|
|
|
|
|
|
return loadingIcon; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public DetectorResult getResult() { |
|
|
|
private void configProperties() { |
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setResult(DetectorResult result) { |
|
|
|
setTitle(Toolkit.i18nText("Fine-Design_Basic_Detect_Title")); |
|
|
|
this.result = result; |
|
|
|
setModal(false); |
|
|
|
} |
|
|
|
setFocusable(false); |
|
|
|
|
|
|
|
setAutoRequestFocus(false); |
|
|
|
|
|
|
|
setResizable(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|