Yvan-欧阳帆
2 years ago
13 changed files with 164 additions and 41 deletions
@ -0,0 +1,94 @@ |
|||||||
|
package com.fr.design.data.datapane.preview.desensitization.view.common; |
||||||
|
|
||||||
|
import com.fr.base.svg.IconUtils; |
||||||
|
import com.fr.design.border.UITitledBorder; |
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.VerticalFlowLayout; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.Desktop; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.net.URL; |
||||||
|
|
||||||
|
/** |
||||||
|
* 启用数据脱敏的面板 |
||||||
|
* |
||||||
|
* @author Yvan |
||||||
|
* @version 11.0 |
||||||
|
* Created by Yvan on 2022/10/12 |
||||||
|
*/ |
||||||
|
public class DesensitizationOpenPane extends JPanel { |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据脱敏启用框 |
||||||
|
*/ |
||||||
|
private UICheckBox desensitizeOpenCheckBox; |
||||||
|
|
||||||
|
/** |
||||||
|
* 跳转帮助文档Label |
||||||
|
*/ |
||||||
|
private UILabel hyperlinkLabel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 启用提示Label |
||||||
|
*/ |
||||||
|
private UILabel tipsLabel; |
||||||
|
|
||||||
|
|
||||||
|
public DesensitizationOpenPane() { |
||||||
|
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP); |
||||||
|
layout.setAlignLeft(true); |
||||||
|
this.setLayout(layout); |
||||||
|
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Report_Desensitization_Config"))); |
||||||
|
|
||||||
|
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||||
|
// 启用数据脱敏的勾选框
|
||||||
|
desensitizeOpenCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Desensitization_Opened")); |
||||||
|
// 跳转帮助文档Label
|
||||||
|
hyperlinkLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/tip/tips")); |
||||||
|
hyperlinkLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Open_Tips")); |
||||||
|
hyperlinkLabel.addMouseListener(new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mouseClicked(MouseEvent event) { |
||||||
|
try { |
||||||
|
URL url = new URL(Toolkit.i18nText("Fine-Design_Report_Desensitization_Help_Document_Url")); |
||||||
|
Desktop.getDesktop().browse(url.toURI()); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e, "open browse of table data desensitization help document failed for {}", e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
panel.add(desensitizeOpenCheckBox); |
||||||
|
panel.add(hyperlinkLabel); |
||||||
|
|
||||||
|
// 提示Label
|
||||||
|
tipsLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Desensitization_Opened_Tooltips")); |
||||||
|
tipsLabel.setForeground(UIConstants.CHECK_BOX_TIP_FONT_COLOR); |
||||||
|
|
||||||
|
this.add(panel); |
||||||
|
this.add(tipsLabel); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据脱敏启用状态 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean isDesensitizationOpened() { |
||||||
|
return desensitizeOpenCheckBox.isSelected(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设置数据脱敏启用状态 |
||||||
|
* @param opened |
||||||
|
*/ |
||||||
|
public void setDesensitizationOpened(boolean opened) { |
||||||
|
desensitizeOpenCheckBox.setSelected(opened); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue