Browse Source

REPORT-12029 打印机下载地址提供自定义设置

research/10.0
plough 6 years ago
parent
commit
bd104a3811
  1. 2
      designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java
  2. 122
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java
  3. 2
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java
  4. 2
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java
  5. 14
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java

2
designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java

@ -60,7 +60,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), cssPane = new WebCssPane());
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane());
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane());
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane());
tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(true));
}
@Override

122
designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java

@ -52,6 +52,11 @@ public class NativePrintSettingPane extends JPanel {
private static final String CUSTOM_PAPERSIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom");
private static final PaperSize DEFAULT_PAPERSIZE = PaperSize.PAPERSIZE_A4;
// 服务器配置面板特有的组件
private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址
private UITextField customUrlFieldWin;
private UITextField customUrlFieldMac;
// 公共组件
private UICheckBox showDialogCheck;
private UICheckBox needSelectSheetCheck; // 打印需要指定 sheet
private UIComboBox printerComboBox;
@ -75,8 +80,10 @@ public class NativePrintSettingPane extends JPanel {
private JPanel customPaperSizePane;
private UnitFieldPane customWidthFieldPane;
private UnitFieldPane customHeightFieldPane;
private boolean serverConfigMode; // 是否为服务器配置中的面板
public NativePrintSettingPane() {
NativePrintSettingPane(boolean serverConfigMode) {
this.serverConfigMode = serverConfigMode;
initComponents();
initListeners();
}
@ -84,39 +91,94 @@ public class NativePrintSettingPane extends JPanel {
private void initComponents() {
JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(1, 0, 12);
JPanel northPane = getHeaderPane();
printPane.add(northPane, BorderLayout.NORTH);
centerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings"));
centerPane.add(getNativePrintMainSettingPane());
printPane.add(centerPane, BorderLayout.CENTER);
this.setLayout(new BorderLayout());
this.add(printPane, BorderLayout.CENTER);
}
private JPanel getHeaderPane() {
JPanel headerPane;
UILabel tipDownload = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Native_Print_Need_Client"));
northPane.add(tipDownload);
// 打印时需要打印设置窗口
showDialogCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Show_Print_Setting_Window_When_Printing"));
showDialogCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
UILabel showDialogCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Settings"));
JPanel showDialogCheckPane = GUICoreUtils.createFlowPane(new Component[] {
showDialogCheck, showDialogCheckTip}, FlowLayout.LEFT);
northPane.add(showDialogCheckPane);
// 打印需要指定 sheet
needSelectSheetCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Need_Select_Sheet_When_Printing"));
needSelectSheetCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
UILabel needSelectSheetCheckTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Invalid_In_Page_View"));
JPanel needSelectSheetCheckPane = GUICoreUtils.createFlowPane(new Component[] {
needSelectSheetCheck, needSelectSheetCheckTip}, FlowLayout.LEFT);
northPane.add(needSelectSheetCheckPane);
northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 15, 0));
if (isServerConfigMode()) {
headerPane = createHeaderLayoutPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane, getDownloadUrlSettingPane());
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0));
} else {
headerPane = createHeaderLayoutPane(tipDownload, showDialogCheckPane, needSelectSheetCheckPane);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0));
}
return headerPane;
}
printPane.add(northPane, BorderLayout.NORTH);
private JPanel createHeaderLayoutPane(Component... comps) {
// TableLayout
double p = TableLayout.PREFERRED;
double[] columnSize = {p};
centerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default_Settings"));
double[] rowSize = new double[comps.length];
for (int i = 0; i < rowSize.length; i++) {
rowSize[i] = p;
}
UIScrollPane scrollPane = new UIScrollPane(getNativePrintMainSettingPane());
scrollPane.setBorder(null);
scrollPane.setPreferredSize(new Dimension(600, 340));
centerPane.add(scrollPane);
Component[][] components = new Component[rowSize.length][columnSize.length];
for (int i = 0; i < rowSize.length; i++) {
components[i][0] = comps[i];
}
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
}
printPane.add(centerPane, BorderLayout.CENTER);
private JPanel getDownloadUrlSettingPane() {
defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"));
JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true);
downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.setLayout(new BorderLayout());
this.add(printPane, BorderLayout.CENTER);
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, p};
Component[][] components = {
{getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15);
}
private JPanel getCustomUrlSettingPane() {
customUrlFieldWin = new UITextField(20);
customUrlFieldMac = new UITextField(20);
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {60, p};
Component[][] components = {
{new UILabel("windows: "), customUrlFieldWin},
{new UILabel("macOS: "), customUrlFieldMac}
};
JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return urlSettingPane;
}
private void initListeners() {
@ -399,10 +461,14 @@ public class NativePrintSettingPane extends JPanel {
private JPanel getTopAlignLabelPane(String labelText) {
JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
labelPane.add(new UILabel(labelText), BorderLayout.NORTH);
labelPane.add(new JPanel(), BorderLayout.CENTER);
return labelPane;
}
public void populate(NativePrintAttr nativePrintAttr) {
if (isServerConfigMode()) {
serverOnlyPopulate(nativePrintAttr);
}
showDialogCheck.setSelected(nativePrintAttr.isShowDialog());
needSelectSheetCheck.setSelected(nativePrintAttr.isNeedSelectSheet());
printerComboBox.setSelectedItem(nativePrintAttr.getPrinterName());
@ -452,12 +518,18 @@ public class NativePrintSettingPane extends JPanel {
checkEnabled();
}
private void serverOnlyPopulate(NativePrintAttr nativePrintAttr) {
defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl());
customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac());
customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin());
}
public void update(NativePrintAttr nativePrintAttr) {
if (isServerConfigMode()) {
serverOnlyUpdate(nativePrintAttr);
}
nativePrintAttr.setShowDialog(showDialogCheck.isSelected());
nativePrintAttr.setNeedSelectSheet(needSelectSheetCheck.isSelected());
if (printerComboBox.getSelectedItem() != null) {
nativePrintAttr.setPrinterName(printerComboBox.getSelectedItem().toString());
}
nativePrintAttr.setCopy((int)copySpinner.getValue());
// 页码
@ -493,8 +565,22 @@ public class NativePrintSettingPane extends JPanel {
nativePrintAttr.setScalePercent((int)scalePercentField.getValue());
}
private void serverOnlyUpdate(NativePrintAttr nativePrintAttr) {
if (defaultDownloadUrlCheck.isSelected()) {
nativePrintAttr.setUseDefaultDownloadUrl(true);
} else {
nativePrintAttr.setUseDefaultDownloadUrl(false);
nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText());
nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText());
}
}
// 刷新面板可用状态
public void checkEnabled() {
GUICoreUtils.setEnabled(centerPane, !showDialogCheck.isSelected());
}
public boolean isServerConfigMode() {
return serverConfigMode;
}
}

2
designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java

@ -26,7 +26,7 @@ public class NoClientPrintSettingPane extends JPanel {
private PageMarginSettingPane pageMarginSettingPane;
private JPanel centerPane;
public NoClientPrintSettingPane() {
NoClientPrintSettingPane() {
initComponents();
initListeners();
}

2
designer-realize/src/main/java/com/fr/design/webattr/printsettings/PageMarginSettingPane.java

@ -19,7 +19,7 @@ public class PageMarginSettingPane extends JPanel {
private UnitFieldPane marginLeftUnitFieldPane;
private UnitFieldPane marginRightUnitFieldPane;
public PageMarginSettingPane() {
PageMarginSettingPane() {
initComponents();
}
private void initComponents() {

14
designer-realize/src/main/java/com/fr/design/webattr/printsettings/PrintSettingPane.java

@ -3,6 +3,7 @@ package com.fr.design.webattr.printsettings;
import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
@ -28,8 +29,14 @@ public class PrintSettingPane extends BasicPane {
private NativePrintSettingPane nativePrintSettingPane;
private CardLayout printCard;
private JPanel printPane;
private boolean serverConfigMode; // 是否为服务器配置中的面板
public PrintSettingPane() {
this(false);
}
public PrintSettingPane(boolean serverConfigMode) {
this.serverConfigMode = serverConfigMode;
initComponents();
initListener();
}
@ -50,12 +57,15 @@ public class PrintSettingPane extends BasicPane {
north.add(radioGroupPane);
noClientPrintSettingPane = new NoClientPrintSettingPane();
nativePrintSettingPane = new NativePrintSettingPane();
nativePrintSettingPane = new NativePrintSettingPane(serverConfigMode);
printCard = new CardLayout();
printPane = new JPanel();
printPane.setLayout(printCard);
printPane.add(noClientPrintRadioButton.getText(), noClientPrintSettingPane);
printPane.add(nativePrintRadioButton.getText(), nativePrintSettingPane);
UIScrollPane scrollPane = new UIScrollPane(nativePrintSettingPane);
scrollPane.setBorder(null);
printPane.add(nativePrintRadioButton.getText(), scrollPane);
north.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
allPanel.add(printPane, BorderLayout.CENTER);

Loading…
Cancel
Save