Browse Source

REPORT-12034 零客户端针式打印优化

research/10.0
plough 6 years ago
parent
commit
725a6389fb
  1. 24
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  2. 19
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java
  3. 2
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java
  4. 38
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/NoClientPrintSettingPane.java
  5. 4
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java

24
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -18,6 +18,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.EditTextField; import com.fr.design.gui.itextfield.EditTextField;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
@ -891,4 +893,26 @@ public abstract class GUICoreUtils{
panel.add(dynamicPaneWrapper, BorderLayout.CENTER); panel.add(dynamicPaneWrapper, BorderLayout.CENTER);
return panel; return panel;
} }
/**
* 创建一个单列垂直布局的 TableLayout 面板
* @param comps 组件数组
* @return 布局完成后的面板
*/
public static JPanel createHeaderLayoutPane(Component... comps) {
// TableLayout
double p = TableLayout.PREFERRED;
double[] columnSize = {p};
double[] rowSize = new double[comps.length];
for (int i = 0; i < rowSize.length; i++) {
rowSize[i] = p;
}
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);
}
} }

19
designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java

@ -118,25 +118,6 @@ public abstract class AbstractNativePrintSettingPane extends JPanel {
abstract JPanel createHeaderPane(Component... comps); abstract JPanel createHeaderPane(Component... comps);
JPanel createHeaderLayoutPane(Component... comps) {
// TableLayout
double p = TableLayout.PREFERRED;
double[] columnSize = {p};
double[] rowSize = new double[comps.length];
for (int i = 0; i < rowSize.length; i++) {
rowSize[i] = p;
}
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);
}
private void initListeners() { private void initListeners() {
allPageRadioButton.addItemListener(getPageRaidoListener()); allPageRadioButton.addItemListener(getPageRaidoListener());
currentPageRadioButton.addItemListener(getPageRaidoListener()); currentPageRadioButton.addItemListener(getPageRaidoListener());

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

@ -33,7 +33,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
System.arraycopy(comps, 0, allComps, 0, comps.length); System.arraycopy(comps, 0, allComps, 0, comps.length);
System.arraycopy(newComps, 0, allComps, comps.length, newComps.length); System.arraycopy(newComps, 0, allComps, comps.length, newComps.length);
JPanel headerPane = createHeaderLayoutPane(allComps); JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0));
return headerPane; return headerPane;
} }

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

@ -12,6 +12,7 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -22,6 +23,7 @@ import java.awt.event.ItemListener;
public class NoClientPrintSettingPane extends JPanel { public class NoClientPrintSettingPane extends JPanel {
private UICheckBox setMarginWhenPrintCheck; private UICheckBox setMarginWhenPrintCheck;
private UICheckBox ieQuietPrintCheck; private UICheckBox ieQuietPrintCheck;
private UICheckBox needlePrinterOptimizeCheck;
private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置 private UICheckBox inheritPageMarginSettingCheck; // 继承页面边距设置
private PageMarginSettingPane pageMarginSettingPane; private PageMarginSettingPane pageMarginSettingPane;
private JPanel centerPane; private JPanel centerPane;
@ -34,7 +36,7 @@ public class NoClientPrintSettingPane extends JPanel {
private void initComponents() { private void initComponents() {
JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel printPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
printPane.add(createNorthPane(), BorderLayout.NORTH); printPane.add(createHeaderPane(), BorderLayout.NORTH);
initCenterPane(); initCenterPane();
printPane.add(centerPane, BorderLayout.CENTER); printPane.add(centerPane, BorderLayout.CENTER);
@ -63,27 +65,29 @@ public class NoClientPrintSettingPane extends JPanel {
centerPane.add(panel); centerPane.add(panel);
} }
private JPanel createNorthPane() { private JPanel createHeaderPane() {
setMarginWhenPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Set_Margin_When_Printing")); setMarginWhenPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Set_Margin_When_Printing"));
setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 20)); setMarginWhenPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
UILabel tipLabel = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Print_Margin")); UILabel marginTip = GUICoreUtils.createTipLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tip_Use_Default_Print_Margin"));
JPanel setMarginWhenPrintPane = GUICoreUtils.createFlowPane(new Component[] {
setMarginWhenPrintCheck, marginTip}, FlowLayout.LEFT);
ieQuietPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_No_Print_Settings_In_IE")); ieQuietPrintCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_No_Print_Settings_In_IE"));
ieQuietPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 12, 10, 0)); ieQuietPrintCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// TableLayout needlePrinterOptimizeCheck = new UICheckBox("针式打印优化");
double p = TableLayout.PREFERRED; needlePrinterOptimizeCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
double[] rowSize = {p, p}; UILabel needleTip = GUICoreUtils.createTipLabel("提示:将文字字体替换为黑体以优化打印效果。");
double[] columnSize = {180, p}; JPanel needlePrinterOptimizePane = GUICoreUtils.createFlowPane(new Component[] {
Component[][] components = { needlePrinterOptimizeCheck, needleTip}, FlowLayout.LEFT);
{setMarginWhenPrintCheck, tipLabel},
{ieQuietPrintCheck, null}
};
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
northPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return northPane; JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(setMarginWhenPrintPane, ieQuietPrintCheck, needlePrinterOptimizePane);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0));
return headerPane;
} }
private void initListeners() { private void initListeners() {
setMarginWhenPrintCheck.addItemListener(new ItemListener() { setMarginWhenPrintCheck.addItemListener(new ItemListener() {
@Override @Override
@ -103,6 +107,7 @@ public class NoClientPrintSettingPane extends JPanel {
public void populate(NoClientPrintAttr noClientPrintAttr) { public void populate(NoClientPrintAttr noClientPrintAttr) {
setMarginWhenPrintCheck.setSelected(noClientPrintAttr.isSetMarginOnPrint()); setMarginWhenPrintCheck.setSelected(noClientPrintAttr.isSetMarginOnPrint());
ieQuietPrintCheck.setSelected(noClientPrintAttr.isIeQuietPrint()); ieQuietPrintCheck.setSelected(noClientPrintAttr.isIeQuietPrint());
needlePrinterOptimizeCheck.setSelected(noClientPrintAttr.isNeedlePrinterOptimize());
inheritPageMarginSettingCheck.setSelected(noClientPrintAttr.isInheritPageMarginSetting()); inheritPageMarginSettingCheck.setSelected(noClientPrintAttr.isInheritPageMarginSetting());
pageMarginSettingPane.populate(noClientPrintAttr.getMargin()); pageMarginSettingPane.populate(noClientPrintAttr.getMargin());
} }
@ -110,6 +115,7 @@ public class NoClientPrintSettingPane extends JPanel {
public void update(NoClientPrintAttr noClientPrintAttr) { public void update(NoClientPrintAttr noClientPrintAttr) {
noClientPrintAttr.setSetMarginOnPrint(setMarginWhenPrintCheck.isSelected()); noClientPrintAttr.setSetMarginOnPrint(setMarginWhenPrintCheck.isSelected());
noClientPrintAttr.setIeQuietPrint(ieQuietPrintCheck.isSelected()); noClientPrintAttr.setIeQuietPrint(ieQuietPrintCheck.isSelected());
noClientPrintAttr.setNeedlePrinterOptimize(needlePrinterOptimizeCheck.isSelected());
noClientPrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected()); noClientPrintAttr.setInheritPageMarginSetting(inheritPageMarginSettingCheck.isSelected());
noClientPrintAttr.setMargin(pageMarginSettingPane.updateBean()); noClientPrintAttr.setMargin(pageMarginSettingPane.updateBean());
} }

4
designer-realize/src/main/java/com/fr/design/webattr/printsettings/ReportNativePrintSettingPane.java

@ -1,5 +1,7 @@
package com.fr.design.webattr.printsettings; package com.fr.design.webattr.printsettings;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
@ -11,7 +13,7 @@ import java.awt.Component;
public class ReportNativePrintSettingPane extends AbstractNativePrintSettingPane { public class ReportNativePrintSettingPane extends AbstractNativePrintSettingPane {
@Override @Override
JPanel createHeaderPane(Component... comps) { JPanel createHeaderPane(Component... comps) {
JPanel headerPane = createHeaderLayoutPane(comps); JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(comps);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0)); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 12, 0));
return headerPane; return headerPane;
} }

Loading…
Cancel
Save