Browse Source

REPORT-12391 本地打印端口号可配置=>设计器部分

research/10.0
plough 6 years ago
parent
commit
8722af6cbf
  1. 49
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java

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

@ -3,35 +3,39 @@ package com.fr.design.webattr.printsettings;
import com.fr.base.print.NativePrintAttr;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField;
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;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.sun.jna.Native;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Component;
import java.awt.FlowLayout;
/**
* 本地打印设置面板全局
* Created by plough on 2018/10/31.
*/
public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane {
private static final int PRINT_PORT_FIELD_COLUMNS = 8;
// 服务器配置面板特有的组件
private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址
private UITextField customUrlFieldWin;
private UITextField customUrlFieldMac;
private UINumberField printPortField; // 打印软件端口号
@Override
JPanel createHeaderPane(Component... comps) {
Component[] newComps = {
getDownloadUrlSettingPane()
};
Component[] allComps = new Component[comps.length + newComps.length];
Component[] allComps = new Component[comps.length + 1];
System.arraycopy(comps, 0, allComps, 0, comps.length);
System.arraycopy(newComps, 0, allComps, comps.length, newComps.length);
allComps[comps.length] = getExtraSettingPane();
JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0));
@ -48,6 +52,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText());
nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText());
}
nativePrintAttr.setPrintPort((int) printPortField.getValue());
}
@Override
@ -55,21 +60,43 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl());
customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac());
customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin());
printPortField.setValue(nativePrintAttr.getPrintPort());
}
private JPanel getDownloadUrlSettingPane() {
// 服务器配置中,特有的设置面板
private JPanel getExtraSettingPane() {
// 软件下载地址
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));
JPanel downloadTipPane = getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": ");
downloadTipPane.setBorder(BorderFactory.createEmptyBorder(0, 0, -6, 0));
// 打印软件端口号
UILabel printPortTip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Native_Print_Port") + ": ");
JPanel printPortFiledPane = getPrintPortFieldPane();
// TableLayout
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] rowSize = {p, p};
double[] columnSize = {p, p};
Component[][] components = {
{getTopAlignLabelPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Software_Download_Url") + ": "), downloadUrlSettingCheckPane}
{
downloadTipPane, downloadUrlSettingCheckPane
}, {
printPortTip, printPortFiledPane
}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 15);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0);
}
private JPanel getPrintPortFieldPane() {
printPortField = new UIIntNumberField();
printPortField.setMaxValue(NativePrintAttr.MAX_PRINT_PORT_VALUE);
printPortField.setColumns(PRINT_PORT_FIELD_COLUMNS);
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(printPortField);
return panel;
}
private JPanel getCustomUrlSettingPane() {
@ -85,7 +112,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
{new UILabel("macOS: "), customUrlFieldMac}
};
JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
urlSettingPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
return urlSettingPane;
}
}

Loading…
Cancel
Save