From 71c4097b0f572d4c0eb1e8a06283a52a50655bd2 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 28 Aug 2018 18:42:54 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10704=20&=20REPORT-10864=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=BC=A9=E6=94=BE=E6=89=93=E5=8D=B0=3D>=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86=EF=BC=9B=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=9C=BA=E5=88=97=E8=A1=A8=E4=B8=AD=E5=A2=9E=E5=8A=A0=E2=80=9C?= =?UTF-8?q?=E6=97=A0=E2=80=9D=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../printsettings/NativePrintSettingPane.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java index dbdf2ff6f6..ef73c7152d 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/printsettings/NativePrintSettingPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -57,6 +58,7 @@ public class NativePrintSettingPane extends JPanel { private UICheckBox inheritPageLayoutSettingCheck; private UICheckBox inheritPageMarginSettingCheck; private UICheckBox fitPaperSizeCheck; // 缩放 + private UINumberField scalePercentField; // 缩放百分比 private UIRadioButton portraitRadioButton; private UIRadioButton landscapeRadioButton; private PageMarginSettingPane pageMarginSettingPane; @@ -174,10 +176,13 @@ public class NativePrintSettingPane extends JPanel { // 缩放 fitPaperSizeCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_To_Fit_Paper_Size")); + JPanel scalePane = getScalePane(); + scalePane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + JPanel scaleCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(fitPaperSizeCheck, scalePane, true); // TableLayout double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p, p}; double[] columnSize = {60, p}; Component[][] components = { {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Printer") + ":"), printerPane}, @@ -185,9 +190,8 @@ public class NativePrintSettingPane extends JPanel { {printAreaLabelPane, getPrintAreaPane()}, {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Paper") + ":"), paperSettingCheckPane}, {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout") + ":"), layoutSettingCheckPane}, - {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Margin") + ":"), pageMarginCheckPane} - // 此功能暂时不做,在界面上隐藏缩放选项 -// {new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Scale_EnlargeOrReduce") + ":"), fitPaperSizeCheck}, + {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Margin") + ":"), pageMarginCheckPane}, + {getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce") + ":"), scaleCheckPane}, }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15); } @@ -197,6 +201,8 @@ public class NativePrintSettingPane extends JPanel { DocFlavor.INPUT_STREAM.AUTOSENSE, null); Set allPrinterName = new HashSet(); + allPrinterName.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_None")); + for (int i = 0, len = printServices.length; i < len; i++) { allPrinterName.add(printServices[i].getName()); } @@ -296,6 +302,24 @@ public class NativePrintSettingPane extends JPanel { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); } + private JPanel getScalePane() { + scalePercentField = new UINumberField(5); + scalePercentField.setMaxIntegerLength(3); + scalePercentField.setMaxDecimalLength(0); + scalePercentField.setMaxValue(200); + + UILabel percent = new UILabel("%"); + + // TableLayout + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, p}; + Component[][] components = { + {scalePercentField, percent} + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + } + // 返回包含一个标签的 panel,标签始终位于 panel 顶部 private JPanel getTopAlignLabelPane(String labelText) { JPanel labelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -329,6 +353,7 @@ public class NativePrintSettingPane extends JPanel { inheritPageMarginSettingCheck.setSelected(nativePrintAttr.isInheritPageMarginSetting()); pageMarginSettingPane.populate(nativePrintAttr.getMargin()); fitPaperSizeCheck.setSelected(nativePrintAttr.isFitPaperSize()); + scalePercentField.setValue(nativePrintAttr.getScalePercent()); } public void update(NativePrintAttr nativePrintAttr) { @@ -356,6 +381,7 @@ public class NativePrintSettingPane extends JPanel { nativePrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); nativePrintAttr.setMargin(pageMarginSettingPane.updateBean()); nativePrintAttr.setFitPaperSize(fitPaperSizeCheck.isSelected()); + nativePrintAttr.setScalePercent((int)scalePercentField.getValue()); } // 刷新面板可用状态