From d6a9ba641b4b1edf151cf53ec0b2865e1f404e95 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 27 Oct 2020 15:31:29 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-41503=20=E3=80=90JDK11=E3=80=91?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E4=B8=8D=E6=B8=85=E6=99=B0=20=E3=80=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91Windows=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8B=EF=BC=8Cjdk11=E7=9A=84=E7=BC=A9=E6=94=BE?= =?UTF-8?q?=E4=BC=9A=E9=80=A0=E6=88=90=E7=BB=98=E5=88=B6=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=A8=A1=E7=B3=8A=20=E3=80=90=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E4=BD=BF=E7=94=A82?= =?UTF-8?q?=E5=80=8D=E5=9B=BE=EF=BC=8C=E7=84=B6=E5=90=8E=E7=94=A81?= =?UTF-8?q?=E5=80=8D=E5=9B=BE=E7=9A=84=E5=B0=BA=E5=AF=B8=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E5=9B=BE=E7=89=87=EF=BC=8C=E5=86=8D=E7=BB=8F=E8=BF=87jdk11?= =?UTF-8?q?=E7=9A=84=E7=BC=A9=E6=94=BE=E4=B9=8B=E5=90=8E=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E4=BC=9A=E5=A5=BD=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/common/SplashPane.java | 3 + .../start/common/SplashPane4WinAndJDK11.java | 58 +++++++++++++++++++ .../com/fr/start/common/SplashWindow.java | 8 ++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java index 726bdaba44..49a957a21c 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java @@ -125,4 +125,7 @@ public class SplashPane extends JPanel { repaint(MODULE_INFO_X, THANK_INFO_Y - FONT_SIZE, MODULE_INFO_WIDTH, MODULE_INFO_HEIGHT); } + protected void paintJComponent(Graphics g) { + super.paintComponent(g); + } } diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java new file mode 100644 index 0000000000..dae1808844 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java @@ -0,0 +1,58 @@ +package com.fr.start.common; + +import com.bulenkov.iconloader.IconLoader; +import com.fr.base.BaseUtils; +import com.fr.design.locale.impl.SplashMark; +import com.fr.general.locale.LocaleCenter; + +import javax.swing.Icon; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/10/27 + */ +public class SplashPane4WinAndJDK11 extends SplashPane{ + /** + * 启动画面图片路径 + */ + private String imagePath; + + public SplashPane4WinAndJDK11() { + this.imagePath = getSplashPath4WinAndJdk11(); + } + + private String getSplashPath4WinAndJdk11() { + String path = "/com/fr/design/images/splash_10@2x.png"; + String filePath = this.getClass().getResource("/").getPath(); + // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path + if (new File(filePath + path).exists()) { + return path; + } + return (String) LocaleCenter.getMark(SplashMark.class).getValue(); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintJComponent(g); + BufferedImage image = BaseUtils.readImage(imagePath); + Graphics2D newG = (Graphics2D)g.create(0, 0, image.getWidth(), image.getHeight()); + newG.scale(0.5D, 0.5D); + newG.drawImage(image, 0, 0, null); + newG.scale(1.0D, 1.0D); + newG.dispose(); + paintShowText((Graphics2D) g); + g.dispose(); + } + + @Override + Dimension getSplashDimension() { + Icon icon = IconLoader.getIcon(imagePath); + return new Dimension(icon.getIconWidth() / 2, icon.getIconHeight() / 2); + } +} diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java index aa375c1dca..75ee988582 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java @@ -1,6 +1,7 @@ package com.fr.start.common; import com.fr.design.fun.OemProcessor; +import com.fr.design.jdk.JdkVersion; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; @@ -31,7 +32,12 @@ public class SplashWindow extends JFrame { initTitleIcon(); //slash pane - this.splash = new SplashPane(); + // 如果是Windows + JDK版本大于等于9时,一倍图启动会很模糊,这边使用两倍图 + if (OperatingSystem.isWindows() && JdkVersion.GE_9.support()) { + this.splash = new SplashPane4WinAndJDK11(); + } else { + this.splash = new SplashPane(); + } splash.setBackground(null); this.setContentPane(splash); From fffded163e6309c41ee14b6bc124d6309169b536 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 27 Oct 2020 16:34:13 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-41503=20=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/common/SplashPane.java | 3 -- .../start/common/SplashPane4WinAndJDK11.java | 33 +++++++++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java index 49a957a21c..726bdaba44 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java @@ -125,7 +125,4 @@ public class SplashPane extends JPanel { repaint(MODULE_INFO_X, THANK_INFO_Y - FONT_SIZE, MODULE_INFO_WIDTH, MODULE_INFO_HEIGHT); } - protected void paintJComponent(Graphics g) { - super.paintComponent(g); - } } diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java index dae1808844..df91fcf4b7 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java @@ -3,6 +3,7 @@ package com.fr.start.common; import com.bulenkov.iconloader.IconLoader; import com.fr.base.BaseUtils; import com.fr.design.locale.impl.SplashMark; +import com.fr.general.IOUtils; import com.fr.general.locale.LocaleCenter; import javax.swing.Icon; @@ -10,7 +11,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; -import java.io.File; /** * @author Yvan @@ -21,25 +21,37 @@ public class SplashPane4WinAndJDK11 extends SplashPane{ /** * 启动画面图片路径 */ - private String imagePath; + private final String imagePath; + + /** + * 启动画面图片是否使用了两倍图 + */ + private boolean isDouble = false; public SplashPane4WinAndJDK11() { this.imagePath = getSplashPath4WinAndJdk11(); } private String getSplashPath4WinAndJdk11() { - String path = "/com/fr/design/images/splash_10@2x.png"; - String filePath = this.getClass().getResource("/").getPath(); - // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path - if (new File(filePath + path).exists()) { - return path; + String path = (String) LocaleCenter.getMark(SplashMark.class).getValue(); + if (path.contains("splash_10.png")) { + // 为图片加上"@2x" + String pathOfDouble = path.replace("splash_10.png", "splash_10@2x.png"); + // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path + if (IOUtils.readResource(pathOfDouble) != null) { + this.isDouble = true; + return pathOfDouble; + } } - return (String) LocaleCenter.getMark(SplashMark.class).getValue(); + return path; } @Override protected void paintComponent(Graphics g) { - super.paintJComponent(g); + if (isDouble) { + super.paintComponent(g); + return; + } BufferedImage image = BaseUtils.readImage(imagePath); Graphics2D newG = (Graphics2D)g.create(0, 0, image.getWidth(), image.getHeight()); newG.scale(0.5D, 0.5D); @@ -53,6 +65,7 @@ public class SplashPane4WinAndJDK11 extends SplashPane{ @Override Dimension getSplashDimension() { Icon icon = IconLoader.getIcon(imagePath); - return new Dimension(icon.getIconWidth() / 2, icon.getIconHeight() / 2); + return isDouble ? new Dimension(icon.getIconWidth() / 2, icon.getIconHeight() / 2) : + new Dimension(icon.getIconWidth(), icon.getIconHeight()); } } From 18938d585d6ba914ca28be24a4fdef9c1a239617 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 27 Oct 2020 16:52:52 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/common/SplashPane4WinAndJDK11.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java index df91fcf4b7..daa445ecb9 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java @@ -48,7 +48,7 @@ public class SplashPane4WinAndJDK11 extends SplashPane{ @Override protected void paintComponent(Graphics g) { - if (isDouble) { + if (!isDouble) { super.paintComponent(g); return; } From 73abc7140a072ad67e7c4f08308dd510ffdb6386 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 27 Oct 2020 16:57:31 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AD=94=E6=B3=95?= =?UTF-8?q?=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/common/SplashPane4WinAndJDK11.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java index daa445ecb9..fea7deb3cc 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java @@ -28,15 +28,19 @@ public class SplashPane4WinAndJDK11 extends SplashPane{ */ private boolean isDouble = false; + private static final String IMAGE_SPLASH = "splash_10.png"; + + private static final String IMAGE_SPLASH_DOUBLE = "splash_10@2x.png"; + public SplashPane4WinAndJDK11() { this.imagePath = getSplashPath4WinAndJdk11(); } private String getSplashPath4WinAndJdk11() { String path = (String) LocaleCenter.getMark(SplashMark.class).getValue(); - if (path.contains("splash_10.png")) { + if (path.contains(IMAGE_SPLASH)) { // 为图片加上"@2x" - String pathOfDouble = path.replace("splash_10.png", "splash_10@2x.png"); + String pathOfDouble = path.replace(IMAGE_SPLASH, IMAGE_SPLASH_DOUBLE); // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path if (IOUtils.readResource(pathOfDouble) != null) { this.isDouble = true; From e21b50e0e27b52739ccea6257cbbe59c0f9a8ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 27 Oct 2020 17:19:56 +0800 Subject: [PATCH 5/5] =?UTF-8?q?CHART-16440=20=E7=94=98=E7=89=B9=E5=9B=BE?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=BD=B4=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/GanttAxisStylePane.java | 38 ++++++++++--- .../axis/GanttAxisStylePaneWithPosition.java | 57 +++++++++++++++++++ .../style/axis/GanttProcessAxisPane.java | 8 +-- 3 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java index 51e045edfb..8ff6786bad 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePane.java @@ -23,22 +23,28 @@ public class GanttAxisStylePane extends BasicBeanPane { private ColorSelectBoxWithOutTransparent colorSelectBox4button; private UINumberDragPane transparent; + public ChartTextAttrPane getTextAttrPane() { + return textAttrPane; + } + + public ColorSelectBoxWithOutTransparent getColorSelectBox4button() { + return colorSelectBox4button; + } + + public UINumberDragPane getTransparent() { + return transparent; + } + public GanttAxisStylePane() { - textAttrPane = new ChartTextAttrPane(); - colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100); - transparent = new UINumberDragPane(0, 100); + initComponents(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] row = {p,p,p}; + double[] row = {p, p, p, p}; double[] col = {f, e}; - Component[][] components = new Component[][]{ - new Component[]{textAttrPane, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelectBox4button}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent} - }; + Component[][] components = getUsedComponents(); JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -46,6 +52,20 @@ public class GanttAxisStylePane extends BasicBeanPane { this.add(content, BorderLayout.CENTER); } + protected void initComponents() { + textAttrPane = new ChartTextAttrPane(); + colorSelectBox4button = new ColorSelectBoxWithOutTransparent(100); + transparent = new UINumberDragPane(0, 100); + } + + protected Component[][] getUsedComponents() { + return new Component[][]{ + new Component[]{textAttrPane, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelectBox4button}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent} + }; + } + @Override public void populateBean(GanttAxisStyleAttr contentAttr) { textAttrPane.populate(contentAttr.getTextAttr()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java new file mode 100644 index 0000000000..102b0c2321 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttAxisStylePaneWithPosition.java @@ -0,0 +1,57 @@ +package com.fr.van.chart.gantt.designer.style.axis; + +import com.fr.base.BaseUtils; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttr; +import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttrWithPosition; +import com.fr.stable.Constants; + +import javax.swing.Icon; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-10-27 + */ +public class GanttAxisStylePaneWithPosition extends GanttAxisStylePane { + + private UIButtonGroup alignmentPane; + + protected void initComponents() { + super.initComponents(); + Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; + Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; + alignmentPane = new UIButtonGroup<>(alignmentIconArray, alignment); + } + + protected Component[][] getUsedComponents() { + return new Component[][]{ + new Component[]{getTextAttrPane(), null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), getColorSelectBox4button()}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), getTransparent()}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints")), alignmentPane} + }; + } + + public void populateBean(GanttAxisStyleAttrWithPosition contentAttr) { + super.populateBean(contentAttr); + alignmentPane.setSelectedItem(contentAttr.getPosition()); + } + + public void updateBean(GanttAxisStyleAttrWithPosition contentAttr) { + super.updateBean(contentAttr); + contentAttr.setPosition(alignmentPane.getSelectedItem()); + } + + @Override + public GanttAxisStyleAttr updateBean() { + GanttAxisStyleAttrWithPosition styleAttr = new GanttAxisStyleAttrWithPosition(); + updateBean(styleAttr); + return styleAttr; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java index c642c3e130..c2461899b5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/axis/GanttProcessAxisPane.java @@ -27,8 +27,8 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { private UISpinner horizontalProportion; private GanttAxisStylePane horizontalHeaderPane; - private GanttAxisStylePane verticalHeaderPane; - private GanttAxisStylePane bodyPane; + private GanttAxisStylePaneWithPosition verticalHeaderPane; + private GanttAxisStylePaneWithPosition bodyPane; @Override protected JPanel createContentPane() { @@ -54,7 +54,7 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { } private Component createBodyPane() { - bodyPane = new GanttAxisStylePane(); + bodyPane = new GanttAxisStylePaneWithPosition(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), bodyPane); } @@ -66,7 +66,7 @@ public class GanttProcessAxisPane extends AbstractVanChartScrollPane { } private Component createVerticalHeaderPane() { - verticalHeaderPane = new GanttAxisStylePane(); + verticalHeaderPane = new GanttAxisStylePaneWithPosition(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Vertical_Table"), verticalHeaderPane); }