From f2ba828f5fdde39e607cb8e84636c8233c65f208 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 30 Dec 2016 10:39:06 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E6=94=B9=E4=B8=BA=E5=8F=AA=E5=9C=A8=E6=8C=89?= =?UTF-8?q?=E4=B8=8B=E9=BC=A0=E6=A0=87=E5=B7=A6=E9=94=AE=E6=97=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/style/color/ColorPicker.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index cb30c186dd..8503c7f1ee 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -94,9 +94,11 @@ public class ColorPicker extends JDialog implements ActionListener validate(); // 更新所有子控件 } - public void pickComplete() { + public void pickComplete(Boolean setColor) { timer.stop(); - colorSelectable.setColor(colorToSet); + if (setColor) { + colorSelectable.setColor(colorToSet); + } this.dispose(); } @@ -111,7 +113,11 @@ public class ColorPicker extends JDialog implements ActionListener { public void mousePressed(MouseEvent e) { - pickComplete(); + if (e.getButton() == e.BUTTON1) { // 左键确定 + pickComplete(true); + } else { + pickComplete(false); + } } } } From 874d88ca75d993d45b407b99122d94f09d302175 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 30 Dec 2016 15:23:42 +0800 Subject: [PATCH 2/6] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E5=B0=86=E5=8F=96=E8=89=B2=E6=A1=86=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=A8=A1=E6=80=81=E5=AF=B9=E8=AF=9D=E6=A1=86=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BC=A0=E6=A0=87=E4=BA=8B=E4=BB=B6=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/report/ReportBackgroundAction.java | 6 ++---- .../src/com/fr/design/style/color/ColorPicker.java | 3 +++ .../com/fr/design/style/color/ColorSelectDialog.java | 2 +- .../fr/design/style/color/PickColorButtonFactory.java | 10 ++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java b/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java index 3c3940ddad..4a381d4d08 100644 --- a/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java +++ b/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java @@ -37,16 +37,14 @@ public class ReportBackgroundAction extends ReportComponentAction Date: Fri, 30 Dec 2016 16:11:06 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=A7=A3=E5=86=B3=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/style/color/ColorPicker.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 605474230b..74e5514e19 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -61,6 +61,18 @@ public class ColorPicker extends JDialog implements ActionListener timer = new Timer(timeCycle, this); timer.start(); hideCursor(); + + // 如果要求实时变化,确保先关闭弹窗,再截屏 + // 主要针对"图案"选项卡中的"前景"、"背景" + if (this.setColorRealTime) { + colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗 + try { + Thread.sleep(100); // 等待弹窗关闭 + } catch (InterruptedException e) { + e.printStackTrace(); + } + colorPickerPanel.captureScreen(); + } // System.out.println(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()); } @@ -71,7 +83,7 @@ public class ColorPicker extends JDialog implements ActionListener public void actionPerformed(ActionEvent e) { updateLocation(); colorToSet = colorPickerPanel.getPixelColor(mousePos); - if (setColorRealTime && !colorSelectable.getColor().equals(colorToSet)) { + if (setColorRealTime && (colorSelectable.getColor() == null || !colorSelectable.getColor().equals(colorToSet))) { colorSelectable.setColor(colorToSet); } } @@ -147,6 +159,15 @@ class ColorPickerPanel extends JPanel */ public ColorPickerPanel(int scaleFactor) { + colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png"); + this.scaleFactor = scaleFactor; + captureScreen(); + } + + /** + * 截屏 + */ + public void captureScreen() { try { robot = new Robot(); @@ -158,8 +179,6 @@ class ColorPickerPanel extends JPanel screenImage = robot.createScreenCapture(new Rectangle(0, 0, Toolkit .getDefaultToolkit().getScreenSize().width, Toolkit .getDefaultToolkit().getScreenSize().height)); - colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png"); - this.scaleFactor = scaleFactor; } /** From 7f11d02a532889841526b5aeb276612497ba76db Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 30 Dec 2016 16:16:26 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=E3=80=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/style/color/ColorPicker.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 74e5514e19..6fc5706037 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -5,6 +5,7 @@ package com.fr.design.style.color; */ import com.fr.base.BaseUtils; +import com.fr.general.FRLogger; import java.awt.*; import java.awt.event.*; @@ -69,7 +70,7 @@ public class ColorPicker extends JDialog implements ActionListener try { Thread.sleep(100); // 等待弹窗关闭 } catch (InterruptedException e) { - e.printStackTrace(); + FRLogger.getLogger().error(e.getMessage()); } colorPickerPanel.captureScreen(); } From 10204d76da102c1f85c333f8c42d1f14f6c6960b Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 3 Jan 2017 14:00:37 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/style/color/ColorPicker.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 6fc5706037..cf63c500be 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -127,13 +127,8 @@ public class ColorPicker extends JDialog implements ActionListener private class MouseFunctions extends MouseAdapter { - public void mousePressed(MouseEvent e) - { - if (e.getButton() == e.BUTTON1) { // 左键确定 - pickComplete(true); - } else { - pickComplete(false); - } + public void mousePressed(MouseEvent e) { + pickComplete(e.getButton() == e.BUTTON1); // 左键确定 } } } From a7fafda5a41b5f8b74206a4b24be38e03b26ac5e Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 3 Jan 2017 14:01:58 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/style/color/ColorPicker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index cf63c500be..8807e1f402 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -110,7 +110,7 @@ public class ColorPicker extends JDialog implements ActionListener validate(); // 更新所有子控件 } - public void pickComplete(Boolean setColor) { + public void pickComplete(boolean setColor) { timer.stop(); if (setColor) { colorSelectable.setColor(colorToSet);