You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.5 KiB
113 lines
4.5 KiB
package com.fr.design.report; |
|
|
|
import com.fr.base.CustomConfig; |
|
import com.fr.design.constants.UIConstants; |
|
import com.fr.design.dialog.BasicPane; |
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
import com.fr.design.gui.ilable.ActionLabel; |
|
import com.fr.design.gui.ilable.UILabel; |
|
import com.fr.design.i18n.LocaleLinkProvider; |
|
import com.fr.design.i18n.Toolkit; |
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
import com.fr.design.utils.BrowseUtils; |
|
import com.fr.io.attr.ReportExportAttr; |
|
import com.fr.transaction.Configurations; |
|
import com.fr.transaction.WorkerFacade; |
|
|
|
import javax.swing.BorderFactory; |
|
import javax.swing.JPanel; |
|
import java.awt.BorderLayout; |
|
import java.awt.Color; |
|
import java.awt.event.ActionEvent; |
|
import java.awt.event.ActionListener; |
|
|
|
/** |
|
* 通用 |
|
* |
|
* @author hades |
|
* @version 11.0 |
|
* Created by hades on 2022/5/26 |
|
*/ |
|
public class ExportUniversalPane extends BasicPane { |
|
|
|
/** |
|
* 云中心特殊字符导出在配置文件中对应的配置文件key |
|
*/ |
|
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Alt_Font_Export"; |
|
|
|
/** |
|
* 云中心特殊字符导出默认链接在配置文件中对应的配置文件key |
|
*/ |
|
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Alt_Font_Export_Default"; |
|
|
|
private static final String HELP_URL = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); |
|
|
|
private UICheckBox specialCharacterExport; |
|
// 密码支持公式 |
|
private UICheckBox passwordSupportFormula; |
|
|
|
public ExportUniversalPane() { |
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
|
JPanel outerNorthPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Config")); |
|
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
|
JPanel specialCharacterExportPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
|
specialCharacterExport = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Special_Character")); |
|
specialCharacterExport.setSelected(true); |
|
specialCharacterExportPane.add(specialCharacterExport); |
|
northPane.add(specialCharacterExportPane); |
|
JPanel labelPane = new JPanel(new BorderLayout()); |
|
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
|
UILabel centerLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Special_Character_Tip")); |
|
centerLabel.setForeground(Color.GRAY); |
|
ActionLabel rightLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Report_Universal_Export_More_Alternative_Fonts"), UIConstants.FLESH_BLUE); |
|
rightLabel.addActionListener(new ActionListener() { |
|
@Override |
|
public void actionPerformed(ActionEvent e) { |
|
BrowseUtils.browser(HELP_URL); |
|
} |
|
}); |
|
labelPane.add(centerLabel, BorderLayout.CENTER); |
|
labelPane.add(rightLabel, BorderLayout.EAST); |
|
northPane.add(labelPane); |
|
JPanel passwordSupportPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
|
passwordSupportFormula = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Password_Support_Formula")); |
|
passwordSupportFormula.setSelected(false); |
|
passwordSupportPane.add(passwordSupportFormula); |
|
northPane.add(passwordSupportPane); |
|
outerNorthPane.add(northPane); |
|
this.add(outerNorthPane); |
|
} |
|
|
|
@Override |
|
protected String title4PopupWindow() { |
|
return "ExportUniversalPane"; |
|
} |
|
|
|
/** |
|
* 填充数据 |
|
* |
|
* @param reportExportAttr 报表导出属性 |
|
*/ |
|
public void populate(ReportExportAttr reportExportAttr) { |
|
this.specialCharacterExport.setSelected(CustomConfig.getInstance().isOptimizedSpecialCharacterExport()); |
|
this.passwordSupportFormula.setSelected(reportExportAttr.isPwdSupportFormula()); |
|
} |
|
|
|
/** |
|
* 更新界面 |
|
* |
|
* @param reportExportAttr 报表导出属性 |
|
*/ |
|
public void update(ReportExportAttr reportExportAttr) { |
|
Configurations.modify(new WorkerFacade(CustomConfig.class) { |
|
@Override |
|
public void run() { |
|
CustomConfig.getInstance().setOptimizedSpecialCharacterExport(specialCharacterExport.isSelected()); |
|
reportExportAttr.setPwdSupportFormula(passwordSupportFormula.isSelected()); |
|
} |
|
}); |
|
} |
|
|
|
|
|
}
|
|
|