Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~alex.sung/design into feature/10.0

research/10.0
alex.sung 6 years ago
parent
commit
c401616d4f
  1. 47
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/GlobalNativePrintSettingPane.java

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

@ -3,7 +3,10 @@ package com.fr.design.webattr.printsettings;
import com.fr.base.print.NativePrintAttr; import com.fr.base.print.NativePrintAttr;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; 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.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -17,21 +20,20 @@ import java.awt.Component;
* Created by plough on 2018/10/31. * Created by plough on 2018/10/31.
*/ */
public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane { public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane {
private static final int PRINT_PORT_FIELD_COLUMNS = 8;
// 服务器配置面板特有的组件 // 服务器配置面板特有的组件
private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址 private UICheckBox defaultDownloadUrlCheck; // 采用默认的软件下载地址
private UITextField customUrlFieldWin; private UITextField customUrlFieldWin;
private UITextField customUrlFieldMac; private UITextField customUrlFieldMac;
private UINumberField printPortField; // 打印软件端口号
@Override @Override
JPanel createHeaderPane(Component... comps) { JPanel createHeaderPane(Component... comps) {
Component[] allComps = new Component[comps.length + 1];
Component[] newComps = {
getDownloadUrlSettingPane()
};
Component[] allComps = new Component[comps.length + newComps.length];
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); allComps[comps.length] = getExtraSettingPane();
JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps); JPanel headerPane = GUICoreUtils.createHeaderLayoutPane(allComps);
headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0)); headerPane.setBorder(BorderFactory.createEmptyBorder(2, 12, 5, 0));
@ -48,6 +50,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText()); nativePrintAttr.setCustomDownloadUrlMac(customUrlFieldMac.getText());
nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText()); nativePrintAttr.setCustomDownloadUrlWin(customUrlFieldWin.getText());
} }
nativePrintAttr.setPrintPort((int) printPortField.getValue());
} }
@Override @Override
@ -55,21 +58,43 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl()); defaultDownloadUrlCheck.setSelected(nativePrintAttr.isUseDefaultDownloadUrl());
customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac()); customUrlFieldMac.setText(nativePrintAttr.getCustomDownloadUrlMac());
customUrlFieldWin.setText(nativePrintAttr.getCustomDownloadUrlWin()); 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")); defaultDownloadUrlCheck = GUICoreUtils.createNoBorderCheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"));
JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true); JPanel downloadUrlSettingCheckPane = GUICoreUtils.createCheckboxAndDynamicPane(defaultDownloadUrlCheck, getCustomUrlSettingPane(), true);
downloadUrlSettingCheckPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); 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 // TableLayout
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p}; double[] rowSize = {p, p};
double[] columnSize = {p, p}; double[] columnSize = {p, p};
Component[][] components = { 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() { private JPanel getCustomUrlSettingPane() {
@ -85,7 +110,7 @@ public class GlobalNativePrintSettingPane extends AbstractNativePrintSettingPane
{new UILabel("macOS: "), customUrlFieldMac} {new UILabel("macOS: "), customUrlFieldMac}
}; };
JPanel urlSettingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10); 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; return urlSettingPane;
} }
} }

Loading…
Cancel
Save