From 322f01e340a7c96b8a0667dfca75110fd2868d00 Mon Sep 17 00:00:00 2001 From: assassion <1536296691@qq.com> Date: Tue, 30 Jun 2020 14:26:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-32520=20=E4=BF=AE=E6=94=B9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=AE=BE=E7=BD=AE=E8=B6=85=E8=BF=872000=E5=90=8E?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E4=B8=8D=E8=83=BD=E6=AD=A3=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AE=BD=E5=92=8C=E9=AB=98=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/report/PageSetupPane.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 20beaa564..591cd461a 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -19,25 +19,20 @@ import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.Icon; +import javax.swing.*; +import com.fr.design.gui.ispinner.ColumnRowSpinner; import com.fr.page.PaperSettingProvider; import com.fr.page.ReportSettingsProvider; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JSpinner; -import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.text.NumberFormatter; import com.fr.base.BaseUtils; import com.fr.base.Margin; @@ -212,6 +207,13 @@ public class PageSetupPane extends BasicPane { ((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7); paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); ((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().setColumns(7); + + JFormattedTextField txt = ((JSpinner.NumberEditor) paperWidthSpinner.getEditor()).getTextField(); + ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false); + txt = ((JSpinner.NumberEditor) paperHeightSpinner.getEditor()).getTextField(); + ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false); + + unitLabel = new UnitFieldPane.UnitLabel(Constants.UNIT_MM, paperHeightSpinner.getPreferredSize().height); String[] inch = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")}; @@ -738,8 +740,8 @@ public class PageSetupPane extends BasicPane { return; } // 最大2000,以免画的时候超边 - this.paper_width = Math.min(paper_width, 2000); - this.paper_height = Math.min(paper_height, 2000); + this.paper_width = Math.min(paper_width, Double.MAX_VALUE); + this.paper_height = Math.min(paper_height, Double.MAX_VALUE); this.paper_orientation = paper_orientation; length_scale = !useLocale ? NUM_3 : NUM_POINT_3; } @@ -766,18 +768,24 @@ public class PageSetupPane extends BasicPane { FontMetrics fm = g2d.getFontMetrics(); // 横向的长度 String w_str = "" + paper_width; - if (w_str.indexOf(CoreConstants.DOT) > 0) { + if (!w_str.contains("E")&&w_str.indexOf(CoreConstants.DOT) > 0) { w_str = w_str.substring(0, w_str.indexOf(CoreConstants.DOT) + 2); } int w_length = fm.stringWidth(w_str); paint_width = Math.max(paint_width, w_length + 26); // 纵向的长度 String h_str = "" + paper_height; - if (h_str.indexOf(".") > 0) { + //使用科学计数法显示长度的时候,限制纵向显示长度为9位 + if (h_str.contains("E")){ + String str1=h_str.substring(h_str.indexOf("E")); + String str2=h_str.substring(0,9-str1.length()); + h_str = str2+str1; + }else if(h_str.indexOf(".") > 0) { h_str = h_str.substring(0, h_str.indexOf(".") + 2); } int h_length = fm.stringWidth(h_str); paint_height = Math.max(paint_height, h_length + 26); + paint_height = Math.min(paint_height, 75); double startX = (pane_width - paint_width) / 2; double startY = (pane_height - paint_height) / 2; g2d.translate(startX, startY); From 900d1f688382b3aaabfae034b44f250517136b66 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 30 Jun 2020 15:19:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-32520=20=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/PageSetupPane.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 591cd461a..8dadbe7cc 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -67,6 +67,7 @@ public class PageSetupPane extends BasicPane { private PagePane pagePane; private OtherPane otherPane; private UILabel zeroMarginWarn; + private static final String E = "E"; public PageSetupPane() { this.initComponents(); @@ -768,7 +769,7 @@ public class PageSetupPane extends BasicPane { FontMetrics fm = g2d.getFontMetrics(); // 横向的长度 String w_str = "" + paper_width; - if (!w_str.contains("E")&&w_str.indexOf(CoreConstants.DOT) > 0) { + if (!w_str.contains(E) && w_str.indexOf(CoreConstants.DOT) > 0) { w_str = w_str.substring(0, w_str.indexOf(CoreConstants.DOT) + 2); } int w_length = fm.stringWidth(w_str); @@ -776,16 +777,16 @@ public class PageSetupPane extends BasicPane { // 纵向的长度 String h_str = "" + paper_height; //使用科学计数法显示长度的时候,限制纵向显示长度为9位 - if (h_str.contains("E")){ - String str1=h_str.substring(h_str.indexOf("E")); + if (h_str.contains(E)){ + String str1=h_str.substring(h_str.indexOf(E)); String str2=h_str.substring(0,9-str1.length()); h_str = str2+str1; - }else if(h_str.indexOf(".") > 0) { - h_str = h_str.substring(0, h_str.indexOf(".") + 2); + }else if(h_str.indexOf(CoreConstants.DOT) > 0) { + h_str = h_str.substring(0, h_str.indexOf(CoreConstants.DOT) + 2); } int h_length = fm.stringWidth(h_str); paint_height = Math.max(paint_height, h_length + 26); - paint_height = Math.min(paint_height, 75); + paint_height = Math.min(paint_height, 74); double startX = (pane_width - paint_width) / 2; double startY = (pane_height - paint_height) / 2; g2d.translate(startX, startY); From 1f3781c3442bbc773acaa88f8fd7630ac98853e5 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Tue, 30 Jun 2020 15:34:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-32520=20=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/PageSetupPane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java index 8dadbe7cc..668700a95 100644 --- a/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java @@ -777,11 +777,11 @@ public class PageSetupPane extends BasicPane { // 纵向的长度 String h_str = "" + paper_height; //使用科学计数法显示长度的时候,限制纵向显示长度为9位 - if (h_str.contains(E)){ - String str1=h_str.substring(h_str.indexOf(E)); - String str2=h_str.substring(0,9-str1.length()); - h_str = str2+str1; - }else if(h_str.indexOf(CoreConstants.DOT) > 0) { + if (h_str.contains(E)) { + String str1 = h_str.substring(h_str.indexOf(E)); + String str2 = h_str.substring(0, 9 - str1.length()); + h_str = str2 + str1; + } else if (h_str.indexOf(CoreConstants.DOT) > 0) { h_str = h_str.substring(0, h_str.indexOf(CoreConstants.DOT) + 2); } int h_length = fm.stringWidth(h_str); @@ -790,7 +790,7 @@ public class PageSetupPane extends BasicPane { double startX = (pane_width - paint_width) / 2; double startY = (pane_height - paint_height) / 2; g2d.translate(startX, startY); - g2d = getG2d(paint_width, paint_height,g2d,w_str,h_str,w_length,h_length); + g2d = getG2d(paint_width, paint_height, g2d, w_str, h_str, w_length, h_length); if (paper_orientation == ReportConstants.PORTRAIT) { g2d.drawImage(img, (int) ((paint_width - img.getWidth(null)) / 2), (int) ((paint_height - img.getHeight(null)) / 2), null);