From 631dbe489307e99e5df8780a50f4bae87a020eec Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 16 Jun 2021 13:55:55 +0800 Subject: [PATCH 001/100] =?UTF-8?q?KERNEL-8038=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AD=98=E5=9C=A8=E4=B8=80=E4=BA=9B=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=BC=E8=87=B4=E6=9C=80=E8=BF=91=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=AF=B9=E8=B1=A1=E4=B8=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/CloseReleasable.java | 5 +++++ .../design/gui/icombobox/FRTreeComboBox.java | 5 +++++ .../gui/controlpane/EventPropertyPane.java | 12 ++++++++++- .../design/mainframe/FormParaWidgetPane.java | 12 ++++++++++- .../mainframe/FormWidgetDetailPane.java | 8 ++++++- .../java/com/fr/design/mainframe/JForm.java | 20 +++++++++++++++++- .../design/mainframe/WidgetPropertyPane.java | 21 ++++++++++++++++++- 7 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/file/CloseReleasable.java diff --git a/designer-base/src/main/java/com/fr/design/file/CloseReleasable.java b/designer-base/src/main/java/com/fr/design/file/CloseReleasable.java new file mode 100644 index 0000000000..b76c2b18e6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/CloseReleasable.java @@ -0,0 +1,5 @@ +package com.fr.design.file; + +public interface CloseReleasable { + void releaseResources(); +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java index 8fe79d41ed..e96ae92960 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java @@ -248,6 +248,11 @@ public class FRTreeComboBox extends UIComboBox { private static TreePopup treePopup; + + public static void releaseTreePopup(){ + treePopup = null; + } + private static class FRTreeComboBoxUI extends BasicComboBoxUI implements MouseListener{ private boolean isRollover = false; diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index 72ff969829..cf235191ee 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java @@ -2,6 +2,8 @@ package com.fr.design.gui.controlpane; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.EventPropertyTable; +import com.fr.design.file.CloseReleasable; +import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; import com.fr.design.widget.EventCreator; @@ -13,7 +15,7 @@ import com.fr.stable.Nameable; /** * Created by kerry on 5/17/21 */ -public class EventPropertyPane extends UIListGroupControlPane { +public class EventPropertyPane extends UIListGroupControlPane implements CloseReleasable { private XCreator creator; private FormDesigner designer; @@ -24,6 +26,14 @@ public class EventPropertyPane extends UIListGroupControlPane { this.designer = designer; } + @Override + public void releaseResources() { + Widget widget = creator.toData(); + if (widget.getListenerSize() > 0) { + FRTreeComboBox.releaseTreePopup(); + } + } + /** * 刷新 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index b8f3ff6380..32fa71a680 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.file.CloseReleasable; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; @@ -56,7 +57,7 @@ import java.awt.event.MouseEvent; /** * @author null */ -public class FormParaWidgetPane extends JPanel { +public class FormParaWidgetPane extends JPanel implements CloseReleasable { private static FormParaWidgetPane THIS; private final static int BORDER = 5; private final static int WIDGET_WIDTHGAP = 4; @@ -119,6 +120,15 @@ public class FormParaWidgetPane extends JPanel { return THIS; } + public static FormParaWidgetPane getInstance(){ + return THIS; + } + + @Override + public void releaseResources() { + designer = null; + } + public FormParaWidgetPane() { setLayout(new FlowLayout(FlowLayout.LEFT)); DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 8fbc4d06db..a53f1e3660 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.dialog.BasicPane; +import com.fr.design.file.CloseReleasable; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; @@ -23,7 +24,7 @@ import java.util.List; * Date: 14-7-8 * Time: 下午8:18 */ -public class FormWidgetDetailPane extends FormDockView{ +public class FormWidgetDetailPane extends FormDockView implements CloseReleasable { private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -52,6 +53,11 @@ public class FormWidgetDetailPane extends FormDockView{ private static FormWidgetDetailPane singleton = new FormWidgetDetailPane(); } + @Override + public void releaseResources() { + setEditingFormDesigner(null); + } + public String getViewTitle() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 3ddc16c9c9..3aab1ca0a1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -116,7 +116,8 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm Date: Wed, 16 Jun 2021 19:20:10 +0800 Subject: [PATCH 002/100] =?UTF-8?q?KERNEL-8038=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AD=98=E5=9C=A8=E4=B8=80=E4=BA=9B=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=BC=E8=87=B4=E6=9C=80=E8=BF=91=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=AF=B9=E8=B1=A1=E4=B8=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/EventPropertyPane.java | 11 ++++------- .../java/com/fr/design/mainframe/JForm.java | 1 - .../fr/design/mainframe/WidgetPropertyPane.java | 9 ++++++++- .../mainframe/widget/ui/FormWidgetCardPane.java | 17 +++++++++++++++-- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index cf235191ee..7ba3b6e252 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java @@ -28,13 +28,11 @@ public class EventPropertyPane extends UIListGroupControlPane implements CloseRe @Override public void releaseResources() { - Widget widget = creator.toData(); - if (widget.getListenerSize() > 0) { - FRTreeComboBox.releaseTreePopup(); - } + creator = null; + designer = null; + this.removeAll(); } - /** * 刷新 */ @@ -54,7 +52,6 @@ public class EventPropertyPane extends UIListGroupControlPane implements CloseRe } - public void populateNameObjects() { Widget widget = creator.toData(); populateNameObjects(widget); @@ -103,7 +100,7 @@ public class EventPropertyPane extends UIListGroupControlPane implements CloseRe return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Event"); } - protected String getWrapperLabelText(){ + protected String getWrapperLabelText() { return Toolkit.i18nText("Fine-Design_Report_Event"); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 3aab1ca0a1..eee57c99f4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -859,7 +859,6 @@ public class JForm extends JTemplate implements BaseJForm Date: Wed, 16 Jun 2021 19:22:03 +0800 Subject: [PATCH 003/100] =?UTF-8?q?KERNEL-8038=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AD=98=E5=9C=A8=E4=B8=80=E4=BA=9B=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=BC=E8=87=B4=E6=9C=80=E8=BF=91=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=AF=B9=E8=B1=A1=E4=B8=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/icombobox/FRTreeComboBox.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java index e96ae92960..8fe79d41ed 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java @@ -248,11 +248,6 @@ public class FRTreeComboBox extends UIComboBox { private static TreePopup treePopup; - - public static void releaseTreePopup(){ - treePopup = null; - } - private static class FRTreeComboBoxUI extends BasicComboBoxUI implements MouseListener{ private boolean isRollover = false; From d2a07364126d28f90cfc1552e11ef99fd0641185 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 16 Jun 2021 19:53:47 +0800 Subject: [PATCH 004/100] =?UTF-8?q?KERNEL-8038=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AD=98=E5=9C=A8=E4=B8=80=E4=BA=9B=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=BC=E8=87=B4=E6=9C=80=E8=BF=91=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=AF=B9=E8=B1=A1=E4=B8=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 5cf563292c..2f7b100e44 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -24,7 +24,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.JForm; import com.fr.design.widget.DataModify; import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; From d240aba665366092c3872e986ef409b81c755da0 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 17 Jun 2021 10:44:41 +0800 Subject: [PATCH 005/100] =?UTF-8?q?KERNEL-8038=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AD=98=E5=9C=A8=E4=B8=80=E4=BA=9B=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=BC=E8=87=B4=E6=9C=80=E8=BF=91=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=AF=B9=E8=B1=A1=E4=B8=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/{CloseReleasable.java => Releasable.java} | 2 +- .../com/fr/design/gui/controlpane/EventPropertyPane.java | 5 ++--- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 4 ++-- .../java/com/fr/design/mainframe/FormWidgetDetailPane.java | 4 ++-- .../java/com/fr/design/mainframe/WidgetPropertyPane.java | 4 ++-- .../fr/design/mainframe/widget/ui/FormWidgetCardPane.java | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) rename designer-base/src/main/java/com/fr/design/file/{CloseReleasable.java => Releasable.java} (63%) diff --git a/designer-base/src/main/java/com/fr/design/file/CloseReleasable.java b/designer-base/src/main/java/com/fr/design/file/Releasable.java similarity index 63% rename from designer-base/src/main/java/com/fr/design/file/CloseReleasable.java rename to designer-base/src/main/java/com/fr/design/file/Releasable.java index b76c2b18e6..cb78789e6f 100644 --- a/designer-base/src/main/java/com/fr/design/file/CloseReleasable.java +++ b/designer-base/src/main/java/com/fr/design/file/Releasable.java @@ -1,5 +1,5 @@ package com.fr.design.file; -public interface CloseReleasable { +public interface Releasable { void releaseResources(); } diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index 7ba3b6e252..834b6b4a87 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java @@ -2,8 +2,7 @@ package com.fr.design.gui.controlpane; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.EventPropertyTable; -import com.fr.design.file.CloseReleasable; -import com.fr.design.gui.icombobox.FRTreeComboBox; +import com.fr.design.file.Releasable; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; import com.fr.design.widget.EventCreator; @@ -15,7 +14,7 @@ import com.fr.stable.Nameable; /** * Created by kerry on 5/17/21 */ -public class EventPropertyPane extends UIListGroupControlPane implements CloseReleasable { +public class EventPropertyPane extends UIListGroupControlPane implements Releasable { private XCreator creator; private FormDesigner designer; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 32fa71a680..d8b604e195 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -7,7 +7,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.file.CloseReleasable; +import com.fr.design.file.Releasable; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; @@ -57,7 +57,7 @@ import java.awt.event.MouseEvent; /** * @author null */ -public class FormParaWidgetPane extends JPanel implements CloseReleasable { +public class FormParaWidgetPane extends JPanel implements Releasable { private static FormParaWidgetPane THIS; private final static int BORDER = 5; private final static int WIDGET_WIDTHGAP = 4; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index a53f1e3660..f22592ee73 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,7 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.dialog.BasicPane; -import com.fr.design.file.CloseReleasable; +import com.fr.design.file.Releasable; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; @@ -24,7 +24,7 @@ import java.util.List; * Date: 14-7-8 * Time: 下午8:18 */ -public class FormWidgetDetailPane extends FormDockView implements CloseReleasable { +public class FormWidgetDetailPane extends FormDockView implements Releasable { private static final int ONLINE_TAB = 1; private JPanel centerPane; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 927fe892b4..9be0d84b2c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -9,7 +9,7 @@ import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI; import com.fr.design.designer.properties.mobile.MobileStylePropertyUI; -import com.fr.design.file.CloseReleasable; +import com.fr.design.file.Releasable; import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.controlpane.EventPropertyPane; @@ -33,7 +33,7 @@ import java.util.Set; * 控件属性表绘制 * Modified by fanglei */ -public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane, CloseReleasable { +public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane, Releasable { private static final int PADDING = 10; private static final int PADDING_M = 12; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 2f7b100e44..609e45b5da 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -14,7 +14,7 @@ import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicScrollPane; -import com.fr.design.file.CloseReleasable; +import com.fr.design.file.Releasable; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; @@ -49,7 +49,7 @@ import java.awt.BorderLayout; /** * Created by ibm on 2017/7/25. */ -public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements CloseReleasable { +public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Releasable { private AttributeChangeListener listener; private FormDesigner designer; //当前的编辑器属性定义面板 From f17a135216daabddc24fc2244eb0ff0a453851ca Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 25 Jun 2021 09:51:25 +0800 Subject: [PATCH 006/100] =?UTF-8?q?=E4=B9=8B=E5=89=8D=E6=BC=8F=E4=BC=A0?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E5=BC=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/FormWidgetDetailPane.java | 2 +- .../fr/design/form/images/version_not_match.png | Bin 0 -> 2082 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 designer-form/src/main/resources/com/fr/design/form/images/version_not_match.png diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 2c47e1e072..d792f0eca2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -125,7 +125,7 @@ public class FormWidgetDetailPane extends FormDockView{ isEmptyPane = true; this.removeAll(); JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); - UILabel imagePanel = new UILabel(BaseUtils.readIcon("/com/fr/base/images/share/version_not_match.png")); + UILabel imagePanel = new UILabel(BaseUtils.readIcon("/com/fr/design/form/images/version_not_match.png")); imagePanel.setPreferredSize(new Dimension(240, 96)); imagePanel.setHorizontalAlignment(SwingConstants.CENTER); panel.add(imagePanel); diff --git a/designer-form/src/main/resources/com/fr/design/form/images/version_not_match.png b/designer-form/src/main/resources/com/fr/design/form/images/version_not_match.png new file mode 100644 index 0000000000000000000000000000000000000000..cb3eeffe2e84cb89a2b3a4e86ff70a3ac8aa1b57 GIT binary patch literal 2082 zcmV+-2;KLIP)1SDJPY>_U*3fdL-Rd>COku?Y@;tQu&gTlXFf|(9qD(Xb#4F z$;Zc6cLBU<0GCY5GBr2V5XUj1D7p&Zc>rIfHy<6H&&3aG_`Qzpz;+h6(I^4KFyMAv`g;MuVbL8~1Ox^NrdT(3 z9gqk@LPS`m6}60S7@B~Fp$TXhnt+C(31}F?1d!Tg7z^vU%4xP0V#EmAt_jLKBc zmj$5_5Jgeu_fu)YurN&%pt?-Plk)3L8s(OSZm%n~wp(d$pq@XSOxftIHVO6%0<`&lEyz?uS#(zzY4x!ts#tv&2%wdr z=lSfTv3lq^pkZXihBCVjIUckKs)sm=F&vIcwO{5OKw?Oy(_z~XMq%kE&b0+m<7)zH zqC&IjIiO)^0vd)UpkZhN8ippIVF-J~W__wzTGPDGRcltKAw)nJrqN|F3r(a2+(~&Qd^L$b;=ojsgtcD zuvm%+G726c6+>-_P)|CKhkk#+S53tgW3fcG#e$1vhO%sJWE_dcAP9J`E+-PnLL7!6 zi>Q+&Mz@xLRGgGm9FSGb|JJ{n{I>gtp|TjhekZDTyC-9GB75rn4uitY22CHVca&@*AL_l8#fH zW*ta_hskG4Dltu{^nKp{P3b7^l{%Hh#E!{+leX8o{Q)Y(hEju4LwlZ=Xfi=q>^Prs zi8CT>3$Ej^eFgMeYe6NDHvD8VWs64Y^(eWub{5pwzUQ-#IWf_pRe!f5g@}zLfZCSY zg&Lk#;Y5PyUgh*&^7oF%6HKQb^P4C8B9ijzVB-i#dp$YDsmHQ)x@6rwol8cn3=cbJ zc517q8)c5Bh6(%t{hNcN@u}fgX#Sx5{j@yauSIn32vG580cv#GdP+TUUG+~#+@L?i zncbb_w5+&%*_i}HQOp=s#cFJ@6>Ws!V7%7GKPjJyBw#ogB_@jswH`U4i5>KI+8>&D;_#VFYZH)|OS;(Mb|HG? z8#ivsIM*URy`0NNPG};euJ%>|YH%_ocwRm2BSjhuyT5<-V#oIaRThg+Ejz+kIRe<^8-#2ERs^>KcqFf?N{)a)oyJe`Xx@dDhbERyQw3oV z2MOa%WxsDIzpj|)UfHXm9!wD z6R76Xj7MW;n+FeuIygMY%&#os^xQVJjJ4}bqw=UOUC3a}vjK!1!SBuk#^L^syRcjg;=3Nj9P3-o1EMO^#onOo< zJ+_k0=%nve4ob}fi&`^G1hF!v2*RIv7lcLtJwG{bP_PIqN>i;&gM|vpT#L;TY37V% zLHwL|yON=a7LB&49G`W1JkNj}>PWUMtw7EFI`4v#fmx1iNfSTGI}T{EI6nEGDSsoz z7kL+yQ$wkDniR2Y%iJhoFmalGB;!W_-{obgy_dNtQC4W;+ffwV-R}>c zYybP44PnzXjU>{70=}@I?3lknoQT(pVuFw}2VAGOLC10Yj_(KLNO0S{@aM0MeGI@0 zb@L#3?|A{wPs%8G55Q+-5-yvBuNa1LMYJYs!YADM{Y0JOlAvB`6{Xjhzg9N!rkJB? z6g&&y+lK4$J%FbvXs_%Io8%Apm&f3I*--i40C*C>UsZ0}G>6RJoP_t+T<)g;9xqZk zv#^OCF|w+?1mIE`EkqDExV(RcFS;sYlU+`5Yk|)axGv@Rmrvo9+`n2Jj+) zhqy`Lx?q0P%RdJ2Fz@w0iB@ny`8qznDw=1TaXXjQ7kRYW9pqkEQs0ovb+TrD&Ofyp z=;-Kt=Kr^ifLYuI;2r>XaU#+e9UHu-{|ew2-phXzEi8`!jV1x$KM{pjFH4ao1ONa4 M07*qoM6N<$f_InS8vp Date: Fri, 25 Jun 2021 17:54:30 +0800 Subject: [PATCH 007/100] =?UTF-8?q?REPORT-54354=20=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/ClassTableDataPane.java | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java index b454ddd89f..e2f7efc70b 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java @@ -4,7 +4,6 @@ import com.fr.base.Parameter; import com.fr.data.impl.ClassTableData; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.formula.JavaEditorPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itableeditorpane.ParameterTableModel; @@ -15,14 +14,18 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.IOUtils; - import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -65,30 +68,6 @@ public class ClassTableDataPane extends AbstractTableDataPane { dlg.setVisible(true); } }); - UIButton editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - editButton.setPreferredSize(new Dimension( - editButton.getPreferredSize().width, - classNameTextField.getPreferredSize().height)); - reportletNamePane.add(editButton); - editButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_TABLEDATA_STRING); - final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(ClassTableDataPane.this), - new DialogActionAdapter() { - public void doOk() { - classNameTextField.setText(javaEditorPane.getClassText()); - } - }); - - javaEditorPane.addSaveActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - dlg.doOK(); - } - }); - dlg.setVisible(true); - } - }); Component[][] components = { {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), reportletNamePane}, From bf84ab6a3ea44811d3733b344a3287e11df20cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 28 Jun 2021 11:00:13 +0800 Subject: [PATCH 008/100] =?UTF-8?q?CHART-19508=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=94=AF=E6=8C=81=E8=B0=83=E6=95=B4=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=E5=92=8C=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ChartTypeButtonPane.java | 249 ++++++++++++------ 1 file changed, 166 insertions(+), 83 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 4d7673b3e7..2ddfe46d42 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -6,7 +6,6 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; @@ -16,7 +15,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.vanchart.VanChart; @@ -48,6 +49,7 @@ import java.awt.image.BufferedImage; /** * 图表 类型 增删 控制按钮界面. + * * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-9-26 上午09:27:49 */ @@ -55,7 +57,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final long serialVersionUID = -8130803225718028933L; private static final int B_W = 52; private static final int B_H = 20; - private static final int COL_COUNT = 3; + private static final int COL_COUNT = 4; private static final int P_W = 300; private static final int P_H = 400; @@ -67,7 +69,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private UIButton addButton; private UIButton configButton; - private ArrayList indexList = new ArrayList(); + private UIButton copyButton; + private UIButton moveForwardButton; + private UIButton moveBackButton; + + private ArrayList indexList = new ArrayList<>(); private JPanel buttonPane; private ChartCollection editingCollection; @@ -85,37 +91,60 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //所以:stopEditing--选中其他button则响应click之后relayout;普通失焦则直接relayout. private boolean pressOtherButtonWhenEditing = false; - public ChartTypeButtonPane(ChartTypePane chartTypePane){ + public ChartTypeButtonPane(ChartTypePane chartTypePane) { this(); parent = chartTypePane; } public ChartTypeButtonPane() { this.setLayout(new BorderLayout()); - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); + initButton(); buttonPane = new JPanel(); this.add(buttonPane, BorderLayout.CENTER); - JPanel eastPane = new JPanel(); - this.add(eastPane, BorderLayout.EAST); + JPanel northPane = new JPanel(); + this.add(northPane, BorderLayout.NORTH); - eastPane.setLayout(new BorderLayout()); + northPane.setLayout(new BorderLayout()); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + + JPanel addPanel = new JPanel(); + addPanel.setLayout(new BorderLayout()); + addPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); + addPanel.add(addButton, BorderLayout.CENTER); - eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 5)); JPanel button = new JPanel(); - button.setPreferredSize(new Dimension(45, 20)); - button.setLayout(new GridLayout(1, 2, 5, 0)); - button.add(addButton); - button.add(configButton); - eastPane.add(button, BorderLayout.NORTH); + button.setPreferredSize(new Dimension(95, 20)); + button.setLayout(new GridLayout(1, 4, 0, 0)); + button.add(addPanel); + button.add(copyButton); + button.add(moveForwardButton); + button.add(moveBackButton); + northPane.add(button, BorderLayout.WEST); + northPane.add(configButton, BorderLayout.EAST); - initAddButton(); - initConfigButton(); initConfigCreator(); - // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + + private void initButton() { + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); + copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); + copyButton.setBorderPainted(false); + copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); + moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png")); + moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left")); + moveForwardButton.setBorderPainted(false); + moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png")); + moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right")); + moveBackButton.setBorderPainted(false); + initAddButton(); + initConfigButton(); + initMoveButton(); + initCopyButton(); } public static void registerSupportChangeConfigChartClass(Class cls) { @@ -123,53 +152,95 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigCreator() { - configCreator = new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class); + configCreator = new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class); } private void initAddButton() { addButton.setPreferredSize(new Dimension(20, 20)); - addButton.addActionListener(addListener); + addButton.addActionListener((e) -> { + String name = getNewChartName(); + ChartProvider chart = getChangeStateNewChart(); + addNewChart(chart, name, editingCollection.getChartCount()); + }); } private void initConfigButton() { configButton.setPreferredSize(new Dimension(20, 20)); - configButton.addActionListener(configListener); + configButton.addActionListener((e) -> showConfigDialog()); } - ActionListener addListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String name = getNewChartName(); - ChartChangeButton button = new ChartChangeButton(name);// some set selected + private void initCopyButton() { + copyButton.setPreferredSize(new Dimension(20, 20)); + copyButton.addActionListener((e) -> { + String name = getCopyChartName(); + ChartProvider chart = getCopyChart(); + addNewChart(chart, name, editingCollection.getSelectedIndex() + 1); + }); + } - button.registerChangeListener(uiobListener); + private void initMoveButton() { + moveForwardButton.setPreferredSize(new Dimension(20, 20)); + moveBackButton.setPreferredSize(new Dimension(20, 20)); + moveForwardButton.addActionListener((e) -> moveForwardChart()); + moveBackButton.addActionListener((e) -> moveBackChart()); + } - indexList.add(button); + private void moveBackChart() { + editingCollection.moveBackChart(); + populateBean(editingCollection); + } - if (editingCollection != null) { - //点击添加按钮,则会触发切换状态 - ChartProvider chart = getChangeStateNewChart(); - try { - ChartProvider newChart = (ChartProvider) chart.clone(); - editingCollection.addNamedChart(name, newChart); - ChartInfoCollector.getInstance().collection(newChart, null); - } catch (CloneNotSupportedException e1) { - FineLoggerFactory.getLogger().error("Error in Clone"); - } - checkoutChange(); - } - layoutPane(buttonPane); + private void moveForwardChart() { + editingCollection.moveForwardChart(); + populateBean(editingCollection); + } + + private void checkMoveButton() { + moveBackButton.setEnabled(editingCollection.getSelectedIndex() != editingCollection.getChartCount() - 1); + moveForwardButton.setEnabled(editingCollection.getSelectedIndex() != 0); + } + + private void addNewChart(ChartProvider chart, String name, int index) { + if (chart == null) { + return; } - }; + ChartChangeButton button = new ChartChangeButton(name);// some set selected + button.registerChangeListener(uiobListener); + indexList.add(index, button); + editingCollection.addNamedChart(index, name, chart); + ChartInfoCollector.getInstance().collection(chart, null); + checkoutChange(); + layoutPane(buttonPane); + } + + private void showConfigDialog() { + UIMenuNameableCreator ui = configCreator.clone(); + final BasicBeanPane pane = ui.getPane(); + pane.populateBean(editingCollection); + UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { + @Override + public void doOk() { + pane.updateBean(editingCollection); + } + + @Override + public void doCancel() { + + } + }); + dialog.setSize(P_W, P_H); + dialog.setVisible(true); + } //获取图表收集器的状态 - private void checkoutChange(){ + private void checkoutChange() { calculateMultiChartMode(); - if (parent != null){ + if (parent != null) { parent.relayoutChartTypePane(editingCollection); } //检查是否可以配置切换 configButton.setEnabled(changeEnable()); + checkMoveButton(); } /** @@ -181,7 +252,23 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class); String chartID = chart.getID(); String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); - return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority); + ChartProvider firstChart = ChartTypeManager.getInstanceWithCheck().getFirstChart(priority); + try { + return (ChartProvider) firstChart.clone(); + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + } + return null; + } + + public ChartProvider getCopyChart() { + ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class); + try { + return (ChartProvider) chart.clone(); + } catch (Exception ex) { + FineLoggerFactory.getLogger().error(ex.getMessage(), ex); + return getChangeStateNewChart(); + } } //图表收集器模式状态改变 @@ -204,48 +291,42 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider(ChartProvider.class).getClass()); } - ActionListener configListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - UIMenuNameableCreator ui = configCreator.clone(); - final BasicBeanPane pane = ui.getPane(); - pane.populateBean(editingCollection); - UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(parent), new DialogActionListener() { - @Override - public void doOk() { - pane.updateBean(editingCollection); - } - - @Override - public void doCancel() { - - } - }); - dialog.setSize(P_W, P_H); - dialog.setVisible(true); - } - }; - private String getNewChartName() { int count = indexList.size() + 1; while (true) { - String name_test = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Module_Name") + count; - boolean repeated = false; - for (int i = 0, len = indexList.size(); i < len; i++) { - ChartChangeButton nameable = indexList.get(i); - if (ComparatorUtils.equals(nameable.getButtonName(), name_test)) { - repeated = true; - break; - } + String nameTest = Toolkit.i18nText("Fine-Design_Chart_Module_Name") + count; + if (!nameRepeated(nameTest)) { + return nameTest; } + count++; + } + } - if (!repeated) { - return name_test; + private String getCopyChartName() { + String chartName = "CopyOf" + editingCollection.getChartName(editingCollection.getSelectedIndex()); + if (!nameRepeated(chartName)) { + return chartName; + } + int count = 1; + while (true) { + String nameTest = chartName + count; + if (!nameRepeated(nameTest)) { + return nameTest; } count++; } } + private boolean nameRepeated(String name) { + for (int i = 0, len = indexList.size(); i < len; i++) { + ChartChangeButton nameable = indexList.get(i); + if (ComparatorUtils.equals(nameable.getButtonName(), name)) { + return true; + } + } + return false; + } + private void layoutPane(JPanel northPane) { if (northPane == null) { return; @@ -291,6 +372,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen /** * 注册监听器 + * * @param listener 观察者监听事件 */ public void registerChangeListener(UIObserverListener listener) { @@ -299,6 +381,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen /** * 是否应该响应事件监听器 + * * @return 是则返回true */ public boolean shouldResponseChangeListener() { @@ -383,7 +466,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen int selectedIndex = editingCollection.getSelectedIndex(); ChartChangeButton button = indexList.get(selectedIndex); button.isMoveOn = false; - if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) { + if (!nameRepeated(newName)) { editingCollection.setChartName(selectedIndex, newName); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); button.changeChartName(newName); @@ -391,7 +474,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen buttonPane.remove(currentEditingEditor); currentEditingEditor = null; - if(!pressOtherButtonWhenEditing) { + if (!pressOtherButtonWhenEditing) { layoutPane(buttonPane); } } @@ -427,7 +510,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen @Override public void focusLost(FocusEvent e) {//编辑状态lost才走这边 - if (currentEditingEditor != null ) { + if (currentEditingEditor != null) { stopEditing(); } } @@ -519,7 +602,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen relayoutPane(); //重构面板 - if (parent != null ){ + if (parent != null) { parent.reLayoutEditPane(lastPlotID, editingCollection); } } @@ -534,7 +617,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen @Override public void mouseClicked(MouseEvent e) { mouseClick(e); - if(pressOtherButtonWhenEditing){ + if (pressOtherButtonWhenEditing) { relayoutPane(); pressOtherButtonWhenEditing = false; } @@ -581,7 +664,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //需要先更新,最后重构面板 //重构面板 - if (parent != null ){ + if (parent != null) { parent.reLayoutEditPane(lastPlotID, editingCollection); } } From 40ffe4a454293ae439bf52cb1a9e2fbc7015ef8f Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 28 Jun 2021 14:26:44 +0800 Subject: [PATCH 009/100] =?UTF-8?q?REPORT-54454=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=BE=B9=E8=B7=9D=E6=97=B6=E5=90=8E=EF=BC=8C=E5=B0=81=E9=9D=A2?= =?UTF-8?q?=E5=9B=BE=E8=BE=B9=E6=A1=86=E6=98=BE=E7=A4=BA=E6=9C=89=E5=81=8F?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/designer/creator/XCreator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 01d53f850c..98dc7f218b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -692,7 +692,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo if (coverPanel != null) { coverPanel.setVisible(display); coverPanel.setPreferredSize(editor.getPreferredSize()); - coverPanel.setBounds(editor.getBounds()); + coverPanel.setBounds(new Rectangle(0, 0 , editor.getWidth(), editor.getHeight())); editor.repaint(); } } From 1e07cc8ee24cf42da41ed3f1f015d88cc6a241b3 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 28 Jun 2021 15:05:40 +0800 Subject: [PATCH 010/100] =?UTF-8?q?REPORT-54349=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=89=93=E5=BC=80=E6=A8=A1=E6=9D=BF=E7=9A=84=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E9=9D=A2=E6=98=BE=E7=A4=BA=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/OpenLoadingPane.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java index 624f280a74..adc30b2bff 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.general.IOUtils; import java.awt.Color; import java.awt.Component; @@ -17,9 +18,13 @@ import javax.swing.JPanel; */ public class OpenLoadingPane extends JPanel { - private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.gif")); + private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png")); + private static final Color TIP_COLOR = new Color(108, 174, 235); + private static final int Y_GAP = 50; + private static final int X_GAP = 10; private UILabel loadingLabel; + private UILabel tipLabel; public OpenLoadingPane() { @@ -47,7 +52,12 @@ public class OpenLoadingPane extends JPanel { int loadingLabelHeight = loadingLabel.getPreferredSize().height; int loadingLabelX = (width - loadingLabelWidth) / 2; int loadingLabelY = (height - loadingLabelHeight) / 2; + int tipLabelWidth = tipLabel.getPreferredSize().width; + int tipLabelHeight = tipLabel.getPreferredSize().height; + int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP; + int tipLabelY = loadingLabelY + loadingLabelHeight - Y_GAP; loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight); + tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight); } @Override @@ -56,7 +66,10 @@ public class OpenLoadingPane extends JPanel { }); setBackground(Color.WHITE); loadingLabel = new UILabel(LOADING_ICON); + tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading")); + tipLabel.setForeground(TIP_COLOR); add(loadingLabel); + add(tipLabel); } } From 25098619e436695d680741b1b0a37442a4acc93b Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 28 Jun 2021 15:06:44 +0800 Subject: [PATCH 011/100] =?UTF-8?q?REPORT-54349=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=89=93=E5=BC=80=E6=A8=A1=E6=9D=BF=E7=9A=84=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E9=9D=A2=E6=98=BE=E7=A4=BA=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/images/mainframe/openloading.png | Bin 0 -> 5702 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png diff --git a/designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png b/designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png new file mode 100644 index 0000000000000000000000000000000000000000..512333be9ad2d5f65eb25629e9dffe2ca2722c8a GIT binary patch literal 5702 zcmeHLRZtvGlV1oBG!Qnp26uOdU>n@sLV&PX2)1~T1a}J#K^F*1fW-p@2qZwzMHhEj z-2LN!4`0Gt9ngrpfNOmiSHL22vgzn(_OJ)Q2gwv8qDgiQ~O zdNuZl4_` z_p;b87(+HRa>){fcv<9I5IwMq2BG^3^3}`)F~=+H7dD}CFLBJrCXWop)!Vt4Ck}b( zfg8NMj(B%YFIV4|IIkfL$39oJ0pBf9Ul(Vl!u;@UuLQZzo~CuGHF}EvfuIUr*29Mz zMD7I+lGthhYY0q3K+oovkHx|YBd>s1-xL=8{rQSL3}!4?3n3mbY3Qmk5rbO6)A3FR&vkJ*qvorOU8C_HahD z@b##*no(N0zrSWkU{x3SaH|fQ+F?_tH>$T-Sq% zHAF&;$W!KzcJrUNr~4CXo=>oHU)E6jRW4<0HLFQuWsbUS@EP}EVHOQ(!?QH=Ep%W- z&vIYF%>B(QVOMRm;32OjO?*P-+(N??7Vb)pSKlRp<`qr1VgzOEi|pYS#Qu^Ru-1I^LkD zBx3!ZwIGqv!^Iw*X&x}CBG6E`=bMk^dXhSoswtH?o#htaf|wSf9;4GlaEz^i(fPne zm2^=)3~1zVAUs;AISUXwJF%m(lB)_(-c$U>pi#{NDDsA1CqY<=KkEEfm=TS7Iny|1 z-*H7 z*|5j}nSA$;U-ZYl4?FO^v8mwtRc=Ah#qsNBW`uE{-x#@4Ep30U2?1cUp*INbK)$Xz zNbN2P`iqKK)WG15;=|h)MaDw0%$i41VV&-eTflkQb;?__@i+vOSwXVHe7-~BRQ^Qo zCDCpughwj{GN(lf#m3dEH=`h}EOXOgACWlI)rD2ypjDbDDiYT`zK3jD1>6hE!HfZ} zaY&M=)38nqG$h5@>QofDN;_(-p<1h4v8tKzvR7I`tfON+ytn3Qh#pZ*u8vl*gPYU* z?heFlw}%2H55RbVCOHW$6ej|Nm|%C7JA{O((OauLCPNZT;Ewg**rprK{L_VIR>m^n zmI4-hxk-h#;;xl+s^svAo`iuD3dl5G_`=Z}om=m==p?zu=O1-iHC9z&t2hOh7W5<$ ztI4~FW~e@u6ag&Q)LkZH*&*!rfEW0z+n(mJBD|`~R3)afTiHXyO0c-0c@hK%H+TG$ zQKao^Ql;2=U%l0+*@DbMDHP;7B_8A4HGV~mZL9$J<)+5hY7_|;h8)N75vY97BWXH{ zuxPX#Bi$JYXG>_D3NI$SaCQz50zPOSJt^{zW{DA^vGP}+$uBn0ka!q&l?h zj+us$8d9Y$eJ`amTY__u%w1}voe@0c0va=gYM1d4E74QZCvu|m?U*Miiq#SSZW@$w zV)JM%f15{BJa_7snY|Ty{aJ_XMTdX5Q3epMA%$w>*?vL2{cL-^85su=;eg@H@G*TT~4L5WR>;;FFlRgwunRoa6&v z@&%JO0qgbz;aBBPM*ds}UD4Wrc0IB}-5ko2m?5r0x^|%)j?cWy=8``RP~A_Cs#M(A zEh~yrqV95KfuGE+6i5`f|e#8 zbUk*iNg0!woi{U5A1IEK3j*3bK|5$=+CrN)5$U#|yBKxB&qwSj}Njnq0Pq(;Rb1Ye)`?lv=1VM%L@^6fav zEpbt!*-ayx^!i&4yh}F(^x_=o+)mwHHR!zbn>`$~JRg#b|Kv$#$vh3ygmIF4`SFOE z(W9p^QwkfBBLp2$@N0}xk$Y+-H|qGS@Pdvo`Gm*IaMAu#y(g$sob`EAimbaAKFhm# zR)+>#D96ACFJ|-4tRPQcW<@dppZ(KIn%E^Oe$OAT z(wYtyHSC+3Wl{pA#qYwBpg@vmn*HC>IzAa-xm+Wy>5~$(VL?r+l_>{aC;YLqe`k5E zXAPbOjx$=+b8Qu-$8e7I76;4%61H8v#zQ%BgKo75)}F6~@H+3cak|LyNa7R?sV_VB zZPs@NXKqRKikMB&;02XU?(=-1h&-;s_E;5L z1OM{t7eIEl?)wFTpK_V`?cFJ~b7JE7jWpfmf+J!+o~nqyux;v4TQ7t8}M<2+;*mQ%qjxC?|zXK zRg(FUohbTEaxZ_ep^lkB5?WFpn19$+TK5gyNA%!KxyX{zs%_;@w-)Ztzp+nFXj&(6 zm0>X7;^TGMy%f+g^#S(T3SSrv22#|H;0zW82xo7l?}kCOjD26E;I`ad6>e4EF)q#q z_TAo`aN{k9edNRul0~#0RzyfB`^xaCH7wG`{&s5gdNV^~B;%r5FO0F0WZcxh}SxztV8tld>Rq1|5W@uHe%sTjcn;n^!^b zJv%o^(&H9oW$I!Z_W8G4dezC{tAk}?z#iLzndtfPA?%2#eF5m@|ubhekAOK2MkNqr?nwt zPI-+-j;W^9UC#Y$Pr#-{jCx1Quo4=L3-=<-7Lu|zOvNZ~)poBj<%wQ21o~vQaW;C+ zQO0Ex9&u#6O75#M%?zm4%Vu;Qkx6K}-9~16o3Xbh)^dF^{~fO2y^MW3QEGc;tB^|7 zHCrlB=;$|gus0Lvp=7nJOZeyUE&jhs+Q#T#AR`R-ZDTF&1re`TSTNNoaG2Epy1o9{ z5pI>z)wkOR{jrEhwoLBgWb)N;3D6olJv{zEo803sfXH*$So`64c$)+EHMV%oA5=BR za>GEZn`m0h;8ituTbA3@`;w@&4|Wm{A&?ZfViC@Vt#KwlAhIagMIZExdgoWCh*6ry zf0%ASxKL*G!gGP2A65d4a$vt^2wR0^O26>grNVw)2B-u5)N9QWV-MZKpG3XOirwmZ z+bBC&Y4~{eN(iHG|a{}^b+SYq;v@GS|IEs1O= z$!$$~ok?olQCi)DKoI%BG)Mns;Ra|;iJi`0^CecsIMI@*PV7vaz@m-}txYfEpz&S= zWLS0~`;9jC%|cvV4*$C=AG1VW23*Q&huiXbQ@zmP$R}1iHscDx$91ysf zNWbx^lnAP>IaEAP54efAUCr@ZV1kL&f}jfu_fKk-Lb{ zU4(r;OMQ^YtR?K!^XZ1(1@6nQnIO-2UUK-S7JaP1HSDV^cCM%s-sQM!4Z(?>z3g|G zo22gfBWx4sL%h#;J6>FVG5f*X7=#BGB?u}oP;2^0^67}wEyb*(S=c-U?6y;-A7}Pi zf42dAv=Pc8dcfZJ;VADL^TbZ>hlIw|N+qRi8;l9`#NSz*+bM_TaEgvQS&@Gr`ysol{>H2jv~GU;pSZWe-H zvl5ev!B>+3&#l54LNH%gGAQ;aOvt^!{s{Pg`k!auV=MNpEPE~KdZMBO??0cpASF%3 JY6a`ie*t4bAG-hm literal 0 HcmV?d00001 From 1b0cc9107e167db367b97acfe97dbcb0d661769b Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 28 Jun 2021 17:34:56 +0800 Subject: [PATCH 012/100] =?UTF-8?q?REPORT-54529=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/creator/XChartEditor.java | 2 +- .../java/com/fr/design/designer/creator/XCreator.java | 10 +++++----- .../com/fr/design/designer/creator/XElementCase.java | 2 +- .../fr/design/designer/creator/XWAbsoluteLayout.java | 2 +- .../creator/cardlayout/XWCardMainBorderLayout.java | 2 +- .../com/fr/design/mainframe/EditingMouseListener.java | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index 682dcc4d47..354a60ecb8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -255,7 +255,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { * @param e 鼠标点击事件 */ public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { - if (this.isShareConfigButtonFocus()) { + if (this.isHelpBtnOnFocus()) { CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData()); return; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 98dc7f218b..265fa3618c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -67,7 +67,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo private int[] directions; private Rectangle backupBound; private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性 - private boolean isShareConfigButtonFocus = false;//焦点是否在帮助按钮上 + private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 public XCreator(Widget ob, Dimension initSize) { @@ -671,12 +671,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 焦点是否在帮助按钮上 * @return 焦点是否在帮助按钮上 */ - public boolean isShareConfigButtonFocus() { - return isShareConfigButtonFocus; + public boolean isHelpBtnOnFocus() { + return isHelpBtnOnFocus; } - public void setShareConfigButtonFocus(boolean shareConfigButtonFocus) { - isShareConfigButtonFocus = shareConfigButtonFocus; + public void setHelpBtnOnFocus(boolean isHelpBtnOnFocus) { + this.isHelpBtnOnFocus = isHelpBtnOnFocus; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 9c459e9868..e08cb658c7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -306,7 +306,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { super.respondClick(editingMouseListener, e); editingMouseListener.refreshTopXCreator(); - if (this.isShareConfigButtonFocus()) { + if (this.isHelpBtnOnFocus()) { CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData()); } else { switchTab(e, editingMouseListener); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 32273ca08a..60197ba12c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -467,7 +467,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { * @param e 鼠标点击事件 */ public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { - if (this.isShareConfigButtonFocus()) { + if (this.isHelpBtnOnFocus()) { CoverReportPane.showShareConfig(this.toData()); return; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 2d5b5ba917..b2dcae61a9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -358,7 +358,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { */ @Override public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ - if (this.isShareConfigButtonFocus()) { + if (this.isHelpBtnOnFocus()) { CoverReportPane.showShareConfig(this.toData()); return; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index fd12360915..931b668281 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -435,7 +435,7 @@ public class EditingMouseListener extends MouseInputAdapter { } private void processCoverMouseMove(XCreator component, MouseEvent e) { - component.setShareConfigButtonFocus(false); + component.setHelpBtnOnFocus(false); Insets insets; if (component instanceof XBorderStyleWidgetCreator) { insets = ((XBorderStyleWidgetCreator) component).getInsets(); @@ -447,7 +447,7 @@ public class EditingMouseListener extends MouseInputAdapter { } if (isShareConfigButton(e, component, insets)) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - component.setShareConfigButtonFocus(true); + component.setHelpBtnOnFocus(true); } else if (isEditButton(e, component, insets)) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } From 0456e91914dbe5fa923fe8bb13a262c91c37c33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 29 Jun 2021 10:11:17 +0800 Subject: [PATCH 013/100] =?UTF-8?q?CHART-19694=20=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=94=AF=E6=8C=81=E5=A4=9A=E7=B3=BB=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../label/VanChartMapLabelContentPane.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java index ce3e34ba76..680a7e4f24 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java @@ -1,6 +1,9 @@ package com.fr.van.chart.map.designer.style.label; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; import com.fr.design.ui.ModernUIPane; import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; @@ -10,6 +13,7 @@ import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.type.TextAlign; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; @@ -23,12 +27,17 @@ import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane; import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by Mitisky on 16/5/20. */ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { + private UICheckBox showAllSeries; + private JPanel checkPane; + public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { super(parent, showOnPane, inCondition); } @@ -55,6 +64,31 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { }; } + protected JPanel getLabelContentPane(JPanel contentPane) { + showAllSeries = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Show_All_Series")); + + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double p = TableLayout.PREFERRED; + double[] row = {p, p}; + Component[][] components = { + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy")), showAllSeries} + }; + checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(contentPane, BorderLayout.CENTER); + panel.add(checkPane, BorderLayout.SOUTH); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), panel); + } + + protected void checkCardPane() { + super.checkCardPane(); + checkPane.setVisible(getContent().getSelectedIndex() == COMMON_INDEX); + } + protected String[] getRichTextFieldNames() { return new String[]{ Toolkit.i18nText("Fine-Design_Chart_Area_Name"), @@ -82,4 +116,15 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane { content.setRichTextValueFormat(new AttrTooltipMapValueFormat()); return content; } + + public AttrTooltipContent updateBean() { + AttrTooltipContent attrTooltipContent = super.updateBean(); + attrTooltipContent.setShowAllSeries(showAllSeries.isSelected()); + return attrTooltipContent; + } + + public void populateBean(AttrTooltipContent attrTooltipContent) { + super.populateBean(attrTooltipContent); + showAllSeries.setSelected(attrTooltipContent.isShowAllSeries()); + } } From 7352c73ba4ea88b342a20e7d3379ed36018e28ea Mon Sep 17 00:00:00 2001 From: pengda Date: Tue, 29 Jun 2021 14:21:28 +0800 Subject: [PATCH 014/100] =?UTF-8?q?REPORT-54574=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E7=8E=AF=E5=A2=83=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=86=85=E5=AE=B9=E4=B8=AD=EF=BC=8C=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E6=8F=92=E4=BB=B6=E4=B8=8B=E7=9A=84=E5=85=AD=E4=B8=AA?= =?UTF-8?q?=E5=8C=85=E8=A2=AB=E5=88=86=E5=88=AB=E8=AF=86=E5=88=AB=E4=B8=BA?= =?UTF-8?q?=E4=BA=86=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../versioncheck/VersionCheckUtils.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index e63395ff65..045d54413f 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -39,6 +39,7 @@ import java.lang.reflect.Method; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -59,6 +60,21 @@ public class VersionCheckUtils { private static final String ID = "id"; private static final String VERSION = "version"; private static final String NAME = "name"; + private static final Set pluginsNeedIgnore = new HashSet<>(); + static { + pluginsNeedIgnore.addAll(Arrays.asList( + "com.fr.plugin.performance.newexecutetool", + "com.fr.plugin.performance.newline", + "com.fr.plugin.performance.pdfstream", + "com.fr.plugin.performance.dzstartemptyfile", + "com.fr.plugin.performance.treenode.button.optimization", + "com.fr.plugin.performance.druid", + "com.fr.plugin.performance.reducecalculation", + "com.fr.plugin.performance.fasttree", + "com.fr.plugin.performance.paralleldsloader", + "com.fr.plugin.cloud.analytics.v10" + )); + } public static boolean versionCheck(String envName) { @@ -236,6 +252,9 @@ public class VersionCheckUtils { continue; } String remotePluginID = remotePlugin.getString(ID); + if (pluginsNeedIgnore.contains(remotePluginID)) { + continue; + } if (localPluginsMap.containsKey(remotePluginID)) { if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) { continue; From 9a160fb75c4f04f66f5dabaffbcb6fc6bb322063 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Jun 2021 15:53:30 +0800 Subject: [PATCH 015/100] =?UTF-8?q?REPORT-54155=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=B8=83=E5=B1=80=E9=9D=A2=E6=9D=BF=E4=B8=8ATab?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=8B=96=E6=8B=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteLayoutAdapter.java | 2 +- .../adapters/layout/FRFitLayoutAdapter.java | 7 +- .../designer/creator/XLayoutContainer.java | 9 +++ .../cardlayout/XWCardMainBorderLayout.java | 5 ++ .../mainframe/FormCreatorDropTarget.java | 28 +++++++- .../com/fr/design/mainframe/TabDragInner.java | 65 +++++++++++++++++++ 6 files changed, 108 insertions(+), 8 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 932338a3fd..4b3147c0ab 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -72,7 +72,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { } XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); if(topLayout != null){ - if (topLayout.isEditable()){ + if (topLayout.isDragInAble() || topLayout.isEditable()){ return topLayoutAccept(creator, x, y); } //绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局 diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 22d74d7741..c893268ba1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -19,12 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.FormWidgetOptionProvider; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.JForm; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteLayout; @@ -169,7 +164,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { //布局控件要先判断是不是可编辑 XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout(); - boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp); + boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble(); if (access) { return false; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java index 9044d6c3cd..07220df0db 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java @@ -48,6 +48,8 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme //鼠标移动到布局画出编辑层 protected boolean isMouseEnter = false; + private volatile boolean dragInAble; + public void setMouseEnter(boolean mouseEnter) { isMouseEnter = mouseEnter; } @@ -577,4 +579,11 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme return false; } + public boolean isDragInAble() { + return dragInAble; + } + + public void setDragInAble(boolean dragInAble) { + this.dragInAble = dragInAble; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 2d5b5ba917..47b9275051 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -447,4 +447,9 @@ public class XWCardMainBorderLayout extends XWBorderLayout { return true; } + @Override + public Dimension initEditorSize() { + return LARGEPREFERREDSIZE; + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 01a46d25b7..515fd209e1 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -8,6 +8,7 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.events.DesignerEvent; @@ -66,6 +67,8 @@ public class FormCreatorDropTarget extends DropTarget { private AddingModel addingModel; private static final int GAP = 30; + private TabDragInner tabDragInner; + private JWindow promptWindow = new JWindow(); private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); @@ -73,6 +76,7 @@ public class FormCreatorDropTarget extends DropTarget { this.designer = designer; this.addingModel = designer.getAddingModel(); this.promptWindow.add(promptButton); + this.tabDragInner = new TabDragInner(designer); } private void adding(int x, int y) { @@ -128,6 +132,7 @@ public class FormCreatorDropTarget extends DropTarget { designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + tryEditTabContainer(); } else { Toolkit.getDefaultToolkit().beep(); } @@ -137,6 +142,24 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } + /** + * 尝试进入tab编辑 + */ + private void tryEditTabContainer() { + XLayoutContainer belowXLayoutContainer = tabDragInner.getBelowXLayoutContainer(); + if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) { + EditingMouseListener editingMouseListener = new EditingMouseListener(designer); + editingMouseListener.refreshTopXCreator(); + belowXLayoutContainer.setEditable(true); + if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) { + ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); + if (adapter != null) { + editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); + } + } + } + } + private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); @@ -263,7 +286,10 @@ public class FormCreatorDropTarget extends DropTarget { @Override public synchronized void dragOver(DropTargetDragEvent dtde) { Point loc = dtde.getLocation(); - hovering(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); + int x = designer.getRelativeX(loc.x); + int y = designer.getRelativeY(loc.y); + hovering(x, y); + tabDragInner.dragIn(designer.getComponentAt(x, y), x, y); } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java new file mode 100644 index 0000000000..1b0b976a92 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java @@ -0,0 +1,65 @@ +package com.fr.design.mainframe; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; + +/** + * 判断tab块是否能拖入 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/6/29 + */ +public class TabDragInner { + + /** + * 悬浮停留的时间间隔 + */ + private static final long TIME_GAP = 1000; + + private FormDesigner designer; + private XLayoutContainer belowXLayoutContainer; + private long timer; + private int oldX; + private int oldY; + + public TabDragInner(FormDesigner designer) { + this.designer = designer; + } + + /** + * 判断拖入 + * + * @param creator 当前拖拽的组件下方所在布局最上层的组件 + * @param x + * @param y + */ + public void dragIn(XCreator creator, int x, int y) { + XCreator xCreator = designer.getComponentAt(x, y); + XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(xCreator).getTopLayout(); + boolean dragInAble = false; + if (topLayout != null && topLayout.acceptType(XWCardMainBorderLayout.class) && belowXLayoutContainer == null) { + belowXLayoutContainer = topLayout; + timer = System.currentTimeMillis(); + } else if (topLayout == belowXLayoutContainer && topLayout != null && oldX == x && oldY == y) { + if (System.currentTimeMillis() - timer > TIME_GAP) { + dragInAble = true; + } + } else { + timer = 0; + belowXLayoutContainer = null; + } + if (topLayout != null) { + topLayout.setDragInAble(dragInAble); + } + oldX = x; + oldY = y; + } + + + public XLayoutContainer getBelowXLayoutContainer() { + return belowXLayoutContainer; + } +} From 964c980724fe3b85da880e547a92e426003d4a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 29 Jun 2021 15:57:25 +0800 Subject: [PATCH 016/100] =?UTF-8?q?CHART-19722=20=E6=9B=B4=E6=8D=A2?= =?UTF-8?q?=E4=BA=86=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E9=9B=86=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../richText/VanChartRichEditorPane.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java index 80d49abe37..d36ef487c7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java @@ -7,14 +7,13 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.data.TableDataSource; -import com.fr.data.impl.EmbeddedTableData; +import com.fr.data.impl.NameTableData; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.ui.ModernUIPane; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.custom.CustomDefinition; import com.fr.plugin.chart.custom.type.CustomPlotType; @@ -28,6 +27,8 @@ import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Map; @@ -117,15 +118,9 @@ public class VanChartRichEditorPane { return; } - try { - EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, - tableData, TableData.RESULT_NOT_NEED, false); - - List fieldNames = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); - VanChartRichEditorPane.fieldNames = fieldNames; - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + String[] columnNames = DesignTableDataManager.getSelectedColumnNames(tableDataSource, ((NameTableData) tableData).getName()); + VanChartRichEditorPane.fieldNames = new ArrayList<>(); + fieldNames.addAll(Arrays.asList(columnNames)); } public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { From 7e105b9f160bcfb810525f1b8bcec6cf56441aba Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Jun 2021 17:22:12 +0800 Subject: [PATCH 017/100] =?UTF-8?q?REPORT-54545=20=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=BB=98=E8=AE=A4=E5=AD=97=E4=BD=93=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/cell/editor/RichTextToolBar.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java index fb904e2190..5f0fd27d2f 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java @@ -5,6 +5,7 @@ package com.fr.design.cell.editor; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; +import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -61,6 +62,11 @@ public class RichTextToolBar extends BasicPane{ private static final Dimension BUTTON_SIZE = new Dimension(24, 20); + /** + * 富文本字体下拉框默认首选字体 非设计器UI界面字体 + */ + private static final FRFont DEFAULT_FONT = FRContext.getDefaultValues().getFRFont().applySize(13); + private UIComboBox fontNameComboBox; private UIComboBox fontSizeComboBox; private UIToggleButton bold; @@ -153,11 +159,11 @@ public class RichTextToolBar extends BasicPane{ } private void bindListener(){ - FRFont defaultFont = (this.textPane != null) ? FRFont.getInstance(this.textPane.getFont()) : RichTextPane.DEFAUL_FONT; + // 这里下拉框默认选中字体 不由UI界面字体决定 两套不同体系 fontNameComboBox.addItemListener(fontNameItemListener); - fontNameComboBox.setSelectedItem(defaultFont.getFamily()); + fontNameComboBox.setSelectedItem(DEFAULT_FONT.getFamily()); fontSizeComboBox.addItemListener(fontSizeItemListener); - fontSizeComboBox.setSelectedItem(scaleDown(defaultFont.getSize())); + fontSizeComboBox.setSelectedItem(scaleDown(DEFAULT_FONT.getSize())); bold.addActionListener(blodChangeAction); italic.addActionListener(itaChangeAction); From a5d4c13be6d0126a748edb971592f28a0cc079ca Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Jun 2021 17:44:38 +0800 Subject: [PATCH 018/100] =?UTF-8?q?REPORT-54155=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=B8=83=E5=B1=80=E9=9D=A2=E6=9D=BF=E4=B8=8ATab?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=8B=96=E6=8B=BD=E4=BC=98=E5=8C=96=20update?= =?UTF-8?q?-=E8=B0=83=E6=95=B4=E4=B8=8B=E6=96=B9=E6=B3=95=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormCreatorDropTarget.java | 23 ++---------------- .../com/fr/design/mainframe/TabDragInner.java | 24 ++++++++++++++++--- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 515fd209e1..222165a53c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -8,7 +8,6 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.beans.AdapterBus; -import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.events.DesignerEvent; @@ -132,7 +131,7 @@ public class FormCreatorDropTarget extends DropTarget { designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); - tryEditTabContainer(); + tabDragInner.tryDragIn(); } else { Toolkit.getDefaultToolkit().beep(); } @@ -142,24 +141,6 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } - /** - * 尝试进入tab编辑 - */ - private void tryEditTabContainer() { - XLayoutContainer belowXLayoutContainer = tabDragInner.getBelowXLayoutContainer(); - if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) { - EditingMouseListener editingMouseListener = new EditingMouseListener(designer); - editingMouseListener.refreshTopXCreator(); - belowXLayoutContainer.setEditable(true); - if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) { - ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); - if (adapter != null) { - editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); - } - } - } - } - private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); @@ -289,7 +270,7 @@ public class FormCreatorDropTarget extends DropTarget { int x = designer.getRelativeX(loc.x); int y = designer.getRelativeY(loc.y); hovering(x, y); - tabDragInner.dragIn(designer.getComponentAt(x, y), x, y); + tabDragInner.canDragIn(designer.getComponentAt(x, y), x, y); } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java index 1b0b976a92..ce98d9d55b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; @@ -36,9 +38,8 @@ public class TabDragInner { * @param x * @param y */ - public void dragIn(XCreator creator, int x, int y) { - XCreator xCreator = designer.getComponentAt(x, y); - XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(xCreator).getTopLayout(); + public void canDragIn(XCreator creator, int x, int y) { + XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout(); boolean dragInAble = false; if (topLayout != null && topLayout.acceptType(XWCardMainBorderLayout.class) && belowXLayoutContainer == null) { belowXLayoutContainer = topLayout; @@ -58,6 +59,23 @@ public class TabDragInner { oldY = y; } + /** + * 尝试进入tab编辑 + */ + public void tryDragIn() { + if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) { + EditingMouseListener editingMouseListener = new EditingMouseListener(designer); + editingMouseListener.refreshTopXCreator(); + belowXLayoutContainer.setEditable(true); + if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) { + ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); + if (adapter != null) { + editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); + } + } + } + } + public XLayoutContainer getBelowXLayoutContainer() { return belowXLayoutContainer; From ce6392b593038838a52036aaeed634f348a78408 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 29 Jun 2021 21:17:00 +0800 Subject: [PATCH 019/100] =?UTF-8?q?REPORT-53902=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=97=A0=E6=9D=83=E9=99=90=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 3 ++- .../main/resources/com/fr/design/i18n/dimension_en.properties | 1 + .../resources/com/fr/design/i18n/dimension_ja_JP.properties | 3 ++- .../resources/com/fr/design/i18n/dimension_ko_KR.properties | 3 ++- .../main/resources/com/fr/design/i18n/dimension_zh.properties | 3 ++- .../resources/com/fr/design/i18n/dimension_zh_TW.properties | 3 ++- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 5be56bfbf7..ab7f27df08 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -15,6 +15,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; @@ -653,7 +654,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"), true); - dialog.setSize(new Dimension(308, 132)); + dialog.setSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.env.RemoteEnvPane.dialog")); okButton.setEnabled(false); JPanel jp = new JPanel(); JPanel upPane = new JPanel(); diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties index 23abf1ba42..6a227a996a 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties @@ -3,3 +3,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=630*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=630*31 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=630*280 com.fr.design.report.ReportColumnsPane=800*600 +com.fr.env.RemoteEnvPane.dialog=458*132 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties index 97c7a38b66..db3632a293 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties @@ -1,4 +1,5 @@ com.fr.design.mainframe.check.CheckButton=280*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=610*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=610*31 -com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280 \ No newline at end of file +com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280 +com.fr.env.RemoteEnvPane.dialog=458*132 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties index c00c5eb621..b9d7ef15ab 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties @@ -1,4 +1,5 @@ com.fr.design.mainframe.check.CheckButton=230*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=490*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=490*35 -com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280 \ No newline at end of file +com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280 +com.fr.env.RemoteEnvPane.dialog=458*132 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties index 85eb5c5525..818a9d5d62 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties @@ -2,4 +2,5 @@ com.fr.design.mainframe.check.CheckButton=250*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31 -com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 \ No newline at end of file +com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 +com.fr.env.RemoteEnvPane.dialog=308*132 \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties index d6bdbbc64a..87d117140e 100644 --- a/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties +++ b/designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties @@ -1,4 +1,5 @@ com.fr.design.mainframe.check.CheckButton=250*118 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31 -com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 \ No newline at end of file +com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 +com.fr.env.RemoteEnvPane.dialog=308*132 \ No newline at end of file From 805075f1d2417589b8df17843f8f26e7bbfbcc84 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 30 Jun 2021 10:00:42 +0800 Subject: [PATCH 020/100] =?UTF-8?q?REPORT-54486=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86-=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E4=B8=BB=E6=9C=BA=E5=90=8D=E6=9C=89\=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index c1afbe137f..475e5b71af 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -53,7 +53,7 @@ public class JDBCDefPane extends JPanel { public static final String USER_NAME = "user_name"; private static final String OTHER_DB = "Others"; private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE); - private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE); + private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$"); private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]"); // 编码转换. From d831ae632d69ba02c214a7ac0ca73213a845f2e3 Mon Sep 17 00:00:00 2001 From: pengda Date: Wed, 30 Jun 2021 10:05:35 +0800 Subject: [PATCH 021/100] =?UTF-8?q?REPORT-54486=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86-=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E4=B8=BB=E6=9C=BA=E5=90=8D=E6=9C=89\=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=E6=B2=A1=E6=9C=89=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index 475e5b71af..72e30df2c1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -52,7 +52,7 @@ public class JDBCDefPane extends JPanel { public static final String DRIVER_TYPE = "driver_type"; public static final String USER_NAME = "user_name"; private static final String OTHER_DB = "Others"; - private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE); + private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$"); private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]"); From 1ac21709746b541e68c17e27e21e75663826d71f Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Jun 2021 16:18:55 +0800 Subject: [PATCH 022/100] =?UTF-8?q?REPORT-54643=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84persist=E5=88=86=E6=94=AF=E5=AE=89=E8=A3=85=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E5=AD=98=E7=9B=91=E6=8E=A7=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E4=B8=94=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 5 ++ .../design/mainframe/SafeWindowListener.java | 84 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 25948b62cf..dc90fb0d06 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -535,6 +535,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + @Override + public synchronized void addWindowListener(WindowListener l) { + super.addWindowListener(new SafeWindowListener(l)); + } + private void addMacOsListener() { OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java new file mode 100644 index 0000000000..4f3c812ad2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java @@ -0,0 +1,84 @@ +package com.fr.design.mainframe; + +import com.fr.log.FineLoggerFactory; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/** + * 保证监听运行出错也不影响其他功能正常使用 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/6/30 + */ +public class SafeWindowListener implements WindowListener { + + private final WindowListener windowListener; + + public SafeWindowListener(WindowListener windowListener) { + this.windowListener = windowListener; + } + + @Override + public void windowOpened(WindowEvent e) { + try { + windowListener.windowOpened(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosing(WindowEvent e) { + try { + windowListener.windowClosing(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosed(WindowEvent e) { + try { + windowListener.windowClosed(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowIconified(WindowEvent e) { + try { + windowListener.windowIconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeiconified(WindowEvent e) { + try { + windowListener.windowDeiconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowActivated(WindowEvent e) { + try { + windowListener.windowActivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeactivated(WindowEvent e) { + try { + windowListener.windowDeactivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } +} From 22e191155a92cb7a9ded7db2330b908287de6def Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Jun 2021 16:18:55 +0800 Subject: [PATCH 023/100] =?UTF-8?q?REPORT-54643=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84persist=E5=88=86=E6=94=AF=E5=AE=89=E8=A3=85=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E5=AD=98=E7=9B=91=E6=8E=A7=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E4=B8=94=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 5 ++ .../design/mainframe/SafeWindowListener.java | 84 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 25948b62cf..dc90fb0d06 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -535,6 +535,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + @Override + public synchronized void addWindowListener(WindowListener l) { + super.addWindowListener(new SafeWindowListener(l)); + } + private void addMacOsListener() { OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java new file mode 100644 index 0000000000..4f3c812ad2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java @@ -0,0 +1,84 @@ +package com.fr.design.mainframe; + +import com.fr.log.FineLoggerFactory; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/** + * 保证监听运行出错也不影响其他功能正常使用 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/6/30 + */ +public class SafeWindowListener implements WindowListener { + + private final WindowListener windowListener; + + public SafeWindowListener(WindowListener windowListener) { + this.windowListener = windowListener; + } + + @Override + public void windowOpened(WindowEvent e) { + try { + windowListener.windowOpened(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosing(WindowEvent e) { + try { + windowListener.windowClosing(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosed(WindowEvent e) { + try { + windowListener.windowClosed(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowIconified(WindowEvent e) { + try { + windowListener.windowIconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeiconified(WindowEvent e) { + try { + windowListener.windowDeiconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowActivated(WindowEvent e) { + try { + windowListener.windowActivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeactivated(WindowEvent e) { + try { + windowListener.windowDeactivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } +} From 64c360e1cb47891afe62236840f214c7ef7dee68 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 30 Jun 2021 19:39:01 +0800 Subject: [PATCH 024/100] =?UTF-8?q?REPORT-54573=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=9C=AC=E5=9C=B0=E9=A2=84=E8=A7=88=E6=8A=A5=E9=94=99?= =?UTF-8?q?400=E8=AF=B7=E6=B1=82=E5=A4=B4=E8=BF=87=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/start/server/FineEmbedServerActivator.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java index 5fa8173d4b..854d260bf5 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java @@ -6,6 +6,7 @@ import com.fr.module.Activator; import com.fr.module.ModuleRole; import com.fr.stable.EncodeConstants; import com.fr.stable.ProductConstants; +import com.fr.stable.StringUtils; import com.fr.startup.FineWebApplicationInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -26,6 +27,8 @@ import java.util.Set; */ public class FineEmbedServerActivator extends Activator { + private static final String TOMCAT_MAX_HEADER_SIZE = "tomcat-maxHttpHeaderSize"; + private Tomcat tomcat; @Override @@ -68,6 +71,7 @@ public class FineEmbedServerActivator extends Activator { // 8.5.x 请求参数带特殊字符被tomcat拒绝 []|{}^\`"<> tomcat.getConnector().setProperty("relaxedQueryChars", "[]|{}^\`"<>"); setMaxPostSize(); + setMaxHttpHeaderSize(); String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); //内置的上下文使用工程目录比如webroot @@ -102,6 +106,17 @@ public class FineEmbedServerActivator extends Activator { } } + private void setMaxHttpHeaderSize() { + String value = System.getProperty(TOMCAT_MAX_HEADER_SIZE); + if (StringUtils.isNotEmpty(value)) { + try { + tomcat.getConnector().setProperty("maxHttpHeaderSize", value); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + private void stopServerActivator() { From 0ec9b2839174743d3a1f1e8cd526af4371707652 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 1 Jul 2021 11:00:22 +0800 Subject: [PATCH 025/100] =?UTF-8?q?REPORT-54123=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=8A=A5=E8=A1=A8=E5=9D=97=E7=BB=84=E4=BB=B6=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E5=92=8C=E9=80=80=E5=87=BA=E7=BC=96=E8=BE=91=E6=97=B6?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 表单报表块进入编辑状态后选中某单元格, 单元格边框高亮, 之后报表块退出编辑,对报表块截图以显示在布局面板上,但 此时因为单元格未退出选中状态,导致截图中出现边框高亮的单元格。 当布局面板中出现多个这样的报表块时,产生了很混乱的效果,因此需要进行 优化。 报表块退出编辑状态后,取消单元格选中 --- .../com/fr/design/mainframe/form/FormECDesignerProvider.java | 2 ++ designer-form/src/main/java/com/fr/design/mainframe/JForm.java | 3 +++ .../com/fr/design/mainframe/form/FormElementCaseDesigner.java | 3 +++ 3 files changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java index 27b4a249aa..88a4623071 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java @@ -90,4 +90,6 @@ public interface FormECDesignerProvider { BufferedImage getElementCaseImage(Dimension elementCaseContainerSize); void refreshPropertyPane(); + + void removeSelection(); } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index eee57c99f4..856494401b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -917,6 +917,9 @@ public class JForm extends JTemplate implements BaseJForm Date: Thu, 1 Jul 2021 11:34:50 +0800 Subject: [PATCH 026/100] =?UTF-8?q?CHART-19719=20=E5=9B=BE=E4=BE=8B?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E4=BF=AE=E6=94=B9=20&&=20CHART-19692=20?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=9B=BA=E5=AE=9A=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/designer/PlotFactory.java | 6 ++-- .../style/HeatMapRangeLegendPane.java | 2 +- .../style/VanChartPlotLegendPane.java | 36 +++++++++---------- .../style/VanChartRangeLegendPane.java | 2 +- .../VanLegendPaneWidthOutFixedCheck.java | 21 +++++++++++ .../style/VanLegendPaneWidthOutHighlight.java | 21 ----------- .../van/chart/pie/RadiusCardLayoutPane.java | 16 ++++----- 7 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutFixedCheck.java delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutHighlight.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index 3167b5f59c..4ceeab5485 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -34,7 +34,7 @@ import com.fr.van.chart.designer.style.MapRangeLegendPane; import com.fr.van.chart.designer.style.VanChartPlotLegendPane; import com.fr.van.chart.designer.style.VanChartRangeLegendPane; import com.fr.van.chart.designer.style.VanChartStylePane; -import com.fr.van.chart.designer.style.VanLegendPaneWidthOutHighlight; +import com.fr.van.chart.designer.style.VanLegendPaneWidthOutFixedCheck; import com.fr.van.chart.designer.style.label.VanChartGaugePlotLabelPane; import com.fr.van.chart.designer.style.label.VanChartPiePlotLabelPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane; @@ -128,8 +128,8 @@ public class PlotFactory { private static Map, Class> legendMap = new HashMap, Class>(); static { - legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); - legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); + legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutFixedCheck.class); + legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutFixedCheck.class); legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartMapPlot.class, MapRangeLegendPane.class); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java index d77a106a29..556f9e0fd6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java @@ -17,6 +17,6 @@ public class HeatMapRangeLegendPane extends MapRangeLegendPane { } protected JPanel createCommonLegendPane(){ - return this.createLegendPaneWithoutHighlight(); + return this.createLegendPaneWithoutFixedCheck(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 5a16aa4c82..4ba1abb7dc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -72,9 +72,9 @@ public class VanChartPlotLegendPane extends BasicPane { //private LimitPane limitPane; //高亮显示的按钮 - private UILabel highlightLabel; - private UIButtonGroup highlightButton; - private JPanel highlightPane; + private UILabel fixedCheckLabel; + private UICheckBox fixedCheck; + private JPanel fixedCheckPane; private VanChartStylePane parent; @@ -91,8 +91,8 @@ public class VanChartPlotLegendPane extends BasicPane { this.plot = plot; } - public JPanel getHighlightPane() { - return highlightPane; + public JPanel getFixedCheckPane() { + return fixedCheckPane; } public VanChartStylePane getLegendPaneParent() { @@ -135,7 +135,7 @@ public class VanChartPlotLegendPane extends BasicPane { }); } - protected JPanel createLegendPaneWithoutHighlight() { + protected JPanel createLegendPaneWithoutFixedCheck() { borderPane = new VanChartBorderWithRadiusPane(); backgroundPane = creatBackgroundPane(); @@ -162,11 +162,11 @@ public class VanChartPlotLegendPane extends BasicPane { protected JPanel createLegendPane() { borderPane = new VanChartBorderWithRadiusPane(); backgroundPane = creatBackgroundPane(); - highlightPane = createHighlightPane(); + fixedCheckPane = createFixedCheckPane(); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(createDisplayStrategy(), BorderLayout.CENTER); - panel.add(highlightPane, BorderLayout.SOUTH); + panel.add(fixedCheckPane, BorderLayout.SOUTH); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -319,9 +319,9 @@ public class VanChartPlotLegendPane extends BasicPane { // return limitPane; } - private JPanel createHighlightPane() { - highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); - highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")); + private JPanel createFixedCheckPane() { + fixedCheck = new UICheckBox(Toolkit.i18nText("Fine-Engine_Chart_Open_Fixed_Display")); + fixedCheckLabel = new UILabel(Toolkit.i18nText("Fine-Engine_Chart_Fixed_Display")); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -329,7 +329,7 @@ public class VanChartPlotLegendPane extends BasicPane { double[] rowSize = {p, p}; Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{highlightLabel, highlightButton} + new Component[]{fixedCheckLabel, fixedCheck} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } @@ -408,8 +408,8 @@ public class VanChartPlotLegendPane extends BasicPane { //legend.setLimitAttribute(limitPane.updateBean()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); - if (highlightButton != null && highlightButton.getSelectedItem() != null) { - legend.setHighlight(highlightButton.getSelectedItem()); + if (fixedCheck != null) { + legend.setHighlight(fixedCheck.isSelected()); } } @@ -431,11 +431,11 @@ public class VanChartPlotLegendPane extends BasicPane { maxProportion.populateBean(legend.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(legend.getLimitAttribute()); - if (highlightButton != null) { - highlightButton.setSelectedItem(legend.isHighlight()); + if (fixedCheck != null) { + fixedCheck.setSelected(legend.isHighlight()); boolean largeDataModel = PlotFactory.largeDataModel(plot); - highlightButton.setEnabled(!largeDataModel); - highlightLabel.setEnabled(!largeDataModel); + fixedCheck.setEnabled(!largeDataModel); + fixedCheckLabel.setEnabled(!largeDataModel); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 5fa030a287..cae5bd30cd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -114,7 +114,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { } private void checkHighlightVisible() { - JPanel highlightPane = this.getHighlightPane(); + JPanel highlightPane = this.getFixedCheckPane(); if (highlightPane != null) { highlightPane.setVisible(legendType != LegendType.GRADUAL); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutFixedCheck.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutFixedCheck.java new file mode 100644 index 0000000000..80dd6d9c2f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutFixedCheck.java @@ -0,0 +1,21 @@ +package com.fr.van.chart.designer.style; + +import javax.swing.JPanel; + +/** + * Created by eason on 2016/12/14. + */ +public class VanLegendPaneWidthOutFixedCheck extends VanChartPlotLegendPane{ + + public VanLegendPaneWidthOutFixedCheck(){ + + } + + public VanLegendPaneWidthOutFixedCheck(VanChartStylePane parent){ + super(parent); + } + + protected JPanel createLegendPane(){ + return this.createLegendPaneWithoutFixedCheck(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutHighlight.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutHighlight.java deleted file mode 100644 index 8387a2053e..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutHighlight.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fr.van.chart.designer.style; - -import javax.swing.JPanel; - -/** - * Created by eason on 2016/12/14. - */ -public class VanLegendPaneWidthOutHighlight extends VanChartPlotLegendPane{ - - public VanLegendPaneWidthOutHighlight(){ - - } - - public VanLegendPaneWidthOutHighlight(VanChartStylePane parent){ - super(parent); - } - - protected JPanel createLegendPane(){ - return this.createLegendPaneWithoutHighlight(); - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java index 7befd40e7d..db13b28061 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java @@ -42,7 +42,7 @@ public class RadiusCardLayoutPane extends BasicBeanPane { Map paneList = new HashMap(); radiusType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); - radius = new UISpinnerWithPx(100); + radius = new UISpinnerWithPx(1, Double.MAX_VALUE, 1, 100); radiusContent = new JPanel(new BorderLayout()); radiusContent.add(radius, BorderLayout.CENTER); @@ -55,12 +55,12 @@ public class RadiusCardLayoutPane extends BasicBeanPane { radiusType.setSelectedIndex(0); - cardPane = new VanChartCardLayoutPane(paneList, "auto"){ + cardPane = new VanChartCardLayoutPane(paneList, "auto") { @Override public Dimension getPreferredSize() { if (radiusType.getSelectedIndex() == 1) { return radiusContent.getPreferredSize(); - }else { + } else { return new Dimension(0, 0); } } @@ -69,15 +69,15 @@ public class RadiusCardLayoutPane extends BasicBeanPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p,p}; + double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{radiusType,null}, + new Component[]{radiusType, null}, new Component[]{cardPane, null}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.setLayout(new BorderLayout(0,0)); + this.setLayout(new BorderLayout(0, 0)); this.add(panel, BorderLayout.CENTER); @@ -90,7 +90,7 @@ public class RadiusCardLayoutPane extends BasicBeanPane { @Override public void populateBean(Plot plot) { - if (plot instanceof VanChartRadiusPlot){ + if (plot instanceof VanChartRadiusPlot) { VanChartRadiusPlot radiusPlot = (VanChartRadiusPlot) plot; VanChartRadius vanChartRadius = radiusPlot.getRadius(); radiusType.setSelectedIndex(vanChartRadius.getRadiusType() == RadiusType.AUTO ? 0 : 1); @@ -102,7 +102,7 @@ public class RadiusCardLayoutPane extends BasicBeanPane { public void updateBean(Plot plot) { //更新半径 - if (plot instanceof VanChartRadiusPlot){ + if (plot instanceof VanChartRadiusPlot) { VanChartRadiusPlot radiusPlot = (VanChartRadiusPlot) plot; VanChartRadius vanChartRadius = radiusPlot.getRadius(); vanChartRadius.setRadiusType(radiusType.getSelectedIndex() == 0 ? RadiusType.AUTO : RadiusType.FIXED); From f1cfb52102585feb61c8c8f8bc00cf8b60edf38b Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 1 Jul 2021 14:45:31 +0800 Subject: [PATCH 027/100] =?UTF-8?q?REPORT-54116=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E5=86=85=E5=8F=AF?= =?UTF-8?q?=E9=94=81=E5=AE=9A=E7=BB=84=E4=BB=B6=E5=AE=BD=E9=AB=98=E6=AF=94?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 绝对布局内的组件,按下Shift键拖拽改变组件尺寸或在设计器右侧栏 编辑组件尺寸大小时,可以保持组件宽高比例不变,优化用户体验 按下Shift键鼠标拖拽改变组件尺寸时锁定宽高比例的逻辑, 也对参数面板内控件和表格浮动元素生效 --- .../widget/WidgetBoundsPaneFactory.java | 48 ++++-- .../images/buttonicon/icon_lock_disabled.png | Bin 0 -> 225 bytes .../images/buttonicon/icon_lock_enabled.png | Bin 0 -> 229 bytes .../buttonicon/icon_unlock_disabled.png | Bin 0 -> 226 bytes .../images/buttonicon/icon_unlock_enabled.png | Bin 0 -> 229 bytes .../beans/location/AccessDirection.java | 5 + .../designer/beans/location/Bottom.java | 11 ++ .../design/designer/beans/location/Left.java | 11 ++ .../designer/beans/location/LeftBottom.java | 20 +++ .../designer/beans/location/LeftTop.java | 23 +++ .../design/designer/beans/location/Right.java | 13 ++ .../designer/beans/location/RightBottom.java | 18 +++ .../designer/beans/location/RightTop.java | 20 +++ .../design/designer/beans/location/Top.java | 11 ++ .../designer/beans/models/StateModel.java | 11 ++ .../mainframe/EditingMouseListener.java | 7 +- .../mainframe/FormEditorKeyListener.java | 12 +- .../fr/design/mainframe/FormSelection.java | 13 ++ .../component/WidgetAbsoluteBoundPane.java | 6 +- .../designer/component/WidgetBoundPane.java | 149 ++++++++++++++++-- .../java/com/fr/grid/GridMouseAdapter.java | 81 ++++++++-- 21 files changed, 423 insertions(+), 36 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_disabled.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_enabled.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_disabled.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_enabled.png diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index 9b6e7b5c83..ae3dfc2557 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -10,6 +10,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import javax.swing.BorderFactory; +import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; @@ -45,23 +46,28 @@ public class WidgetBoundsPaneFactory { private static final int RIGHT_PANE_WIDTH = 145; - public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { + public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked) { JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), + ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; double[] columnSize = {f, RIGHT_PANE_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}}; + int[][] rowCount = ratioLocked != null ? new int[][]{{1, 1}, {1, 1, 1}} : new int[][]{{1, 1}, {1, 1}}; final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } + public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { + return createBoundsPane(width, height, null); + } + public static JPanel createRightPane(Component com1, Component com2) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; @@ -74,21 +80,41 @@ public class WidgetBoundsPaneFactory { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L1); } - public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) { + public static JPanel createRightPane(Component com1, Component com2, Component com3) { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {f, 24, f}; + int[][] rowCount = {{1, 1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{com1, com2, com3} + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, IntervalConstants.INTERVAL_L1); + } + + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; + UILabel positionLabel = FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName()); + UILabel xLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER); + UILabel yLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER); + + UILabel sizeLabel = FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()); + UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER); + UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER); + Component[][] northComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName()), createRightPane(x, y)}, - new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, + new Component[]{positionLabel, ratioLocked != null ? createRightPane(x, null, y) : createRightPane(x, y)}, + new Component[]{null, ratioLocked != null ? createRightPane(xLabel, null, yLabel) : createRightPane(xLabel, yLabel)}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{sizeLabel, ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, + new Component[]{null, ratioLocked != null ? createRightPane(widthLabel, null, heightLabel) : createRightPane(widthLabel, heightLabel)}, }; double[] rowSize = {p, p}; double[] columnSize = {f, RIGHT_PANE_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}}; + int[][] rowCount = ratioLocked != null ? new int[][]{{1, 1, 1}, {1, 1, 1}} : new int[][]{{1, 1}, {1, 1}}; final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -99,6 +125,10 @@ public class WidgetBoundsPaneFactory { return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); } + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) { + return createAbsoluteBoundsPane(x, y, width, height, null, nameAttribute); + } + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { return createAbsoluteBoundsPane(x, y, width, height, NameAttribute.DEFAULT); } diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_disabled.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..b498e7c141ff6e719ef7ea3c4ba8dc33da3f7d2a GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`D?D8sLoEE0Qx*sq1g)6gn8s!x zDH*xK*x=99_8k*`KHOQXo@ZoW@W;8_Fic!RGBU%+$mqkzPem~-nLqygZ2$NFKhOMg zbFB;KdNBLg{`j$jU&f-~0lPXLoEE0Qx*sq1g)6gXvUV2 znYppBsL1^9|Nr{DPn_J`mPOv*U%z&D+1p$CCF04YjT<*+vNIp9zk7fG%*&FJ^?%Y6 z6Xza1aG>Jno12$KT_h7yQvSRVBL;LggQu&X%Q~loCIA+%TQC3s literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_disabled.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..6785a5130912472e8ec207c6b6707e5bb61de154 GIT binary patch literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`D?MEtLoEE0Qx*sq1g)6QIGxeQ z%}wkT4^REm|9^k~pWfN|^yJQB^*kd3gFnvO1y(ZxWoPyD@YL+tBO~r8Wmo@i;s5{k zhnE*W_lr@##1PDHXZMbooloWm!VcI9Q?~ zosg82^!L5|Vga-N#)g0E%b%T@x%fnpL}Efp%Bybu4;Prr1*9AbB?Kl{d|*>r33Rbq Wr=OtT@&zDYFnGH9xvXXLoEE0Qx*sq1g)6QxSBC4 zDk^8roIAe%|Nr++PD%Om@xT4yNAmXjuEy;ydn>-HHGLyJv}}5|Ni~${{7L>ZhuFqFJI22MnwLfXIcHNhb53rLVETe z`|58zfe)Jxb35N+NKT%7n1_eQ%;M7ViJQ~U-%vW8*utp6@KIIo%K_OrYyo0yOVacf d1xedEGfuAe75w 0 && height4Backup > 0) { + mHeightSpinner.setValue(mWidthSpinner.getValue() * width4Backup / height4Backup, false); + } + } + }); + mHeightSpinner.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (isLockEnabled() && isLocked() && width4Backup > 0 && height4Backup > 0) { + mWidthSpinner.setValue(mHeightSpinner.getValue() * height4Backup / width4Backup, false); + } + } + }); + } + + @Override + public Icon getIcon() { + if (this.isLocked()) { + if (this.isLockEnabled()) { + return enabledLocked; + } else { + return disabledLocked; + } + } else { + if (this.isLockEnabled()) { + return enabledUnLocked; + } else { + return disabledUnLocked; + } + } + } + + public void setLocked(boolean locked) { + this.setSelected(locked); + } + + public boolean isLocked() { + return this.isSelected(); + } + + public boolean isLockEnabled() { + return this.isEnabled(); + } + + public void setLockEnabled(boolean enabled) { + this.setEnabled(enabled); + } + + public void populate(XCreator creator) { + Rectangle bounds = new Rectangle(creator.getBounds()); + mCreator = creator; + width4Backup = bounds.width; + height4Backup = bounds.height; + Widget widget = creator.toData(); + setLocked(widget.isAspectRatioLocked()); + } + } } diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index b0f91a9029..b6dc8bc4ad 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -75,6 +75,8 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private int resolution = ScreenResolution.getScreenResolution(); + private int[] resizingBackupBounds = null; + protected GridMouseAdapter(Grid grid) { this.grid = grid; } @@ -338,6 +340,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } boolean isControlDown = InputEventBaseOnOS.isControlDown(evt); + boolean isShiftDown = evt.isShiftDown(); long systemCurrentTime = System.currentTimeMillis(); if (systemCurrentTime - lastMouseMoveTime <= DRAG_REFRESH_TIME) {// alex:Drag @@ -351,10 +354,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous return; } - doWithMouseDragged(evt.getX(), evt.getY(), isControlDown); + doWithMouseDragged(evt.getX(), evt.getY(), isControlDown, isShiftDown); } - private void doWithMouseDragged(int evtX, int evtY, boolean isControlDown) { + private void doWithMouseDragged(int evtX, int evtY, boolean isControlDown, boolean isShiftDown) { ElementCasePane reportPane = grid.getElementCasePane(); if (reportPane.mustInVisibleRange()) { @@ -366,7 +369,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous Selection selection = reportPane.getSelection(); if (selection instanceof FloatSelection && !DesignerMode.isAuthorityEditing()) { - doWithFloatElementDragged(evtX, evtY, (FloatSelection) selection); + doWithFloatElementDragged(evtX, evtY, (FloatSelection) selection, isShiftDown); grid.setDragType(GridUtils.DRAG_FLOAT); } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !DesignerMode.isAuthorityEditing()) { doWithCellElementDragged(evtX, evtY, (CellSelection) selection); @@ -391,36 +394,83 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous * @param fs */ - private void doWithFloatElementDragged(int evtX, int evtY, FloatSelection fs) { + private void doWithFloatElementDragged(int evtX, int evtY, FloatSelection fs, boolean aspectRatio) { ElementCase report = grid.getElementCasePane().getEditingElementCase(); // int resolution = ScreenResolution.getScreenResolution(); String floatName = fs.getSelectedFloatName(); FloatElement floatElement = report.getFloatElement(floatName); int cursorType = grid.getCursor().getType(); + int currentLeft = Math.min(oldEvtX, evtX); + int currentTop = Math.min(oldEvtY, evtY); + int currentRight = Math.max(oldEvtX, evtX); + int currentBottom = Math.max(oldEvtY, evtY); + int currentWidth = currentRight - currentLeft; + int currentHeight = currentBottom - currentTop; + + int backupWidth= resizingBackupBounds[2]; + int backupHeight= resizingBackupBounds[3]; + if (cursorType == Cursor.NW_RESIZE_CURSOR || cursorType == Cursor.NE_RESIZE_CURSOR || cursorType == Cursor.SE_RESIZE_CURSOR || cursorType == Cursor.SW_RESIZE_CURSOR) { + if (aspectRatio) { + double currentDiagonal = Math.pow(currentWidth, 2) + Math.pow(currentHeight, 2); + double backupDiagonal = Math.pow(backupWidth, 2) + Math.pow(backupHeight, 2); + + int newWidth = (int) (Math.sqrt((currentDiagonal / backupDiagonal) * (Math.pow(backupWidth, 2)))); + int newHeight = (int) (Math.sqrt((currentDiagonal / backupDiagonal) * (Math.pow(backupHeight, 2)))); + + if (cursorType == Cursor.NW_RESIZE_CURSOR) { + currentLeft = currentRight - newWidth; + currentTop = currentBottom - newHeight; + } else if (cursorType == Cursor.NE_RESIZE_CURSOR) { + currentRight = currentLeft + newWidth; + currentTop = currentBottom - newHeight; + } else if (cursorType == Cursor.SW_RESIZE_CURSOR) { + currentLeft = currentRight - newWidth; + currentBottom = currentTop + newHeight; + } else if (cursorType == Cursor.SE_RESIZE_CURSOR){ + currentRight = currentLeft + newWidth; + currentBottom = currentTop + newHeight; + } + } + DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); - FU floatX1_fu = FU.valueOfPix(Math.min(oldEvtX, evtX), resolution); - FU floatY1_fu = FU.valueOfPix(Math.min(oldEvtY, evtY), resolution); + + FU floatX1_fu = FU.valueOfPix(currentLeft, resolution); + FU floatY1_fu = FU.valueOfPix(currentTop, resolution); FU leftDistance = floatX1_fu.add(columnWidthList.getRangeValue(0, grid.getHorizontalValue())); FU topDistance = floatY1_fu.add(rowHeightList.getRangeValue(0, grid.getVerticalValue())); floatElement.setLeftDistance(leftDistance); floatElement.setTopDistance(topDistance); - floatElement.setWidth(FU.valueOfPix(Math.max(oldEvtX, evtX), resolution).subtract(floatX1_fu)); - floatElement.setHeight(FU.valueOfPix(Math.max(oldEvtY, evtY), resolution).subtract(floatY1_fu)); + floatElement.setWidth(FU.valueOfPix(currentRight, resolution).subtract(floatX1_fu)); + floatElement.setHeight(FU.valueOfPix(currentBottom, resolution).subtract(floatY1_fu)); } else if (cursorType == Cursor.S_RESIZE_CURSOR || cursorType == Cursor.N_RESIZE_CURSOR) { DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); - FU floatY1_fu = FU.valueOfPix(Math.min(oldEvtY, evtY), resolution); + FU floatY1_fu = FU.valueOfPix(currentTop, resolution); FU topDistance = floatY1_fu.add(rowHeightList.getRangeValue(0, grid.getVerticalValue())); floatElement.setTopDistance(topDistance); - floatElement.setHeight(FU.valueOfPix(Math.max(oldEvtY, evtY), resolution).subtract(floatY1_fu)); + floatElement.setHeight(FU.valueOfPix(currentBottom, resolution).subtract(floatY1_fu)); + + if (aspectRatio) { + currentWidth = backupWidth * currentHeight / backupHeight; + currentRight = currentLeft + currentWidth; + FU floatX1_fu = FU.valueOfPix(currentLeft, resolution); + floatElement.setWidth(FU.valueOfPix(currentRight, resolution).subtract(floatX1_fu)); + } } else if (cursorType == Cursor.W_RESIZE_CURSOR || cursorType == Cursor.E_RESIZE_CURSOR) { DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); - FU floatX1_fu = FU.valueOfPix(Math.min(oldEvtX, evtX), resolution); + FU floatX1_fu = FU.valueOfPix(currentLeft, resolution); FU leftDistance = floatX1_fu.add(columnWidthList.getRangeValue(0, grid.getHorizontalValue())); floatElement.setLeftDistance(leftDistance); - floatElement.setWidth(FU.valueOfPix(Math.max(oldEvtX, evtX), resolution).subtract(floatX1_fu)); + floatElement.setWidth(FU.valueOfPix(currentRight, resolution).subtract(floatX1_fu)); + + if (aspectRatio) { + currentHeight = backupHeight * currentWidth / backupWidth; + currentBottom = currentTop + currentHeight; + FU floatY1_fu = FU.valueOfPix(currentTop, resolution); + floatElement.setHeight(FU.valueOfPix(currentBottom, resolution).subtract(floatY1_fu)); + } } else if (cursorType == Cursor.MOVE_CURSOR) { DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); @@ -799,6 +849,13 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } else if (cursorType == Cursor.E_RESIZE_CURSOR) { setOld_X_AndOld_Y(floatArray[0], floatArray[1]); } + + if (Cursor.SW_RESIZE_CURSOR <= cursorType && cursorType <= Cursor.E_RESIZE_CURSOR) { + resizingBackupBounds = new int[] { + (int) floatArray[0], (int)floatArray[1], + (int) floatArray[2] - (int) floatArray[0], (int) floatArray[3] - (int) floatArray[1] + }; + } } private void setOld_X_AndOld_Y(double x, double y) { From 2cafff639d7c0a50e97dea693b14ba31bd55c2b1 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 1 Jul 2021 16:32:17 +0800 Subject: [PATCH 028/100] =?UTF-8?q?REPORT-53699=20=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=97=B6=E6=A8=A1=E6=9D=BF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=8F=92=E4=BB=B6=E6=9C=AA=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/app/DesignerAppUtils.java | 22 ++++++++++++++++++- .../start/module/DesignerInitActivator.java | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java index 4680a8a258..a00e7dd6fc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java @@ -16,6 +16,10 @@ import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.control.PluginControllerHelper; import com.fr.plugin.manage.control.PluginExtraInfo; import com.fr.plugin.manage.control.PluginTask; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; import com.fr.stable.StringUtils; import com.fr.stable.TemplateIOErrorContextHolder; import com.fr.third.guava.cache.Cache; @@ -39,6 +43,7 @@ public class DesignerAppUtils { private static final int DEFAULT_MAX_CACHE_SIZE = 50; private static final int DEFAULT_CONCURRENCY_LEVEL = 8; private static final long DEFAULT_EXPIRE_HOURS = 1; + private static boolean enablePluginTipDialog = true; private static final Cache> ERROR_CACHE = CacheBuilder.newBuilder() .maximumSize(DEFAULT_MAX_CACHE_SIZE) @@ -46,6 +51,21 @@ public class DesignerAppUtils { .concurrencyLevel(DEFAULT_CONCURRENCY_LEVEL) .build(); + public static void initPluginAllActiveListener() { + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() { + @Override + public void on(PluginEvent event) { + enablePluginTipDialog = false; + } + }); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() { + @Override + public void on(PluginEvent event) { + enablePluginTipDialog = true; + } + }); + } + /** * 弹出指定的插件信息, * 并失效缓存 @@ -77,7 +97,7 @@ public class DesignerAppUtils { * @return 格式化后的多行插件错误信息详情 */ public static String dealWithErrorDetailMultiLineAndCache(String key) { - if (!DesignerEnvManager.getEnvManager().isShowTemplateMissingPlugin()) { + if (!DesignerEnvManager.getEnvManager().isShowTemplateMissingPlugin() || !enablePluginTipDialog) { // 直接清空不提示 TemplateIOErrorContextHolder.reset(); return StringUtils.EMPTY; diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java index ebea410bba..1c8fee3793 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java @@ -1,6 +1,7 @@ package com.fr.start.module; import com.fr.design.PluginClassRefreshManager; +import com.fr.design.mainframe.app.DesignerAppUtils; import com.fr.module.Activator; import com.fr.start.DesignerInitial; @@ -17,6 +18,7 @@ public class DesignerInitActivator extends Activator { @Override public void start() { PluginClassRefreshManager.getInstance().load(); + DesignerAppUtils.initPluginAllActiveListener(); DesignerInitial.init(findSingleton(StartupArgs.class).get()); } From f4138e5c220569d0bdd2e91e9fa2cb2fa6a44799 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 1 Jul 2021 16:35:08 +0800 Subject: [PATCH 029/100] =?UTF-8?q?REPORT-54643=20=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 5 -- .../design/mainframe/SafeWindowListener.java | 84 ------------------- 2 files changed, 89 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index dc90fb0d06..25948b62cf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -535,11 +535,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } - @Override - public synchronized void addWindowListener(WindowListener l) { - super.addWindowListener(new SafeWindowListener(l)); - } - private void addMacOsListener() { OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java deleted file mode 100644 index 4f3c812ad2..0000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.fr.design.mainframe; - -import com.fr.log.FineLoggerFactory; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -/** - * 保证监听运行出错也不影响其他功能正常使用 - * - * @author hades - * @version 10.0 - * Created by hades on 2021/6/30 - */ -public class SafeWindowListener implements WindowListener { - - private final WindowListener windowListener; - - public SafeWindowListener(WindowListener windowListener) { - this.windowListener = windowListener; - } - - @Override - public void windowOpened(WindowEvent e) { - try { - windowListener.windowOpened(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowClosing(WindowEvent e) { - try { - windowListener.windowClosing(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowClosed(WindowEvent e) { - try { - windowListener.windowClosed(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowIconified(WindowEvent e) { - try { - windowListener.windowIconified(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowDeiconified(WindowEvent e) { - try { - windowListener.windowDeiconified(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowActivated(WindowEvent e) { - try { - windowListener.windowActivated(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowDeactivated(WindowEvent e) { - try { - windowListener.windowDeactivated(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } -} From 43c398043c82dd310615561bd24e97fa792555a0 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 1 Jul 2021 16:35:08 +0800 Subject: [PATCH 030/100] =?UTF-8?q?REPORT-54643=20=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 5 -- .../design/mainframe/SafeWindowListener.java | 84 ------------------- 2 files changed, 89 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index dc90fb0d06..25948b62cf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -535,11 +535,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } - @Override - public synchronized void addWindowListener(WindowListener l) { - super.addWindowListener(new SafeWindowListener(l)); - } - private void addMacOsListener() { OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java deleted file mode 100644 index 4f3c812ad2..0000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.fr.design.mainframe; - -import com.fr.log.FineLoggerFactory; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -/** - * 保证监听运行出错也不影响其他功能正常使用 - * - * @author hades - * @version 10.0 - * Created by hades on 2021/6/30 - */ -public class SafeWindowListener implements WindowListener { - - private final WindowListener windowListener; - - public SafeWindowListener(WindowListener windowListener) { - this.windowListener = windowListener; - } - - @Override - public void windowOpened(WindowEvent e) { - try { - windowListener.windowOpened(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowClosing(WindowEvent e) { - try { - windowListener.windowClosing(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowClosed(WindowEvent e) { - try { - windowListener.windowClosed(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowIconified(WindowEvent e) { - try { - windowListener.windowIconified(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowDeiconified(WindowEvent e) { - try { - windowListener.windowDeiconified(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowActivated(WindowEvent e) { - try { - windowListener.windowActivated(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } - - @Override - public void windowDeactivated(WindowEvent e) { - try { - windowListener.windowDeactivated(e); - } catch (Throwable throwable) { - FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); - } - } -} From 89f2bbc0e3c6b6ebe1d939b8cfdeef69b9df223c Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 1 Jul 2021 17:43:53 +0800 Subject: [PATCH 031/100] =?UTF-8?q?REPORT-54643=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84persist=E5=88=86=E6=94=AF=E5=AE=89=E8=A3=85=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E5=AD=98=E7=9B=91=E6=8E=A7=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E4=B8=94=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 15 ++++ .../design/mainframe/SafeWindowListener.java | 84 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 25948b62cf..01a7defb2e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -535,6 +535,21 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + @Override + public synchronized void addWindowListener(WindowListener l) { + SafeWindowListener safeWindowListener = new SafeWindowListener(l); + map.put(l, safeWindowListener); + super.addWindowListener(safeWindowListener); + } + + @Override + public synchronized void removeWindowListener(WindowListener l) { + SafeWindowListener safeWindowListener = map.remove(l); + if (safeWindowListener != null) { + super.removeWindowListener(safeWindowListener); + } + } + private void addMacOsListener() { OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java new file mode 100644 index 0000000000..d88eccfa72 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java @@ -0,0 +1,84 @@ +package com.fr.design.mainframe; + +import com.fr.log.FineLoggerFactory; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/** + * 保证监听运行出错也不影响其他功能正常使用 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/6/30 + */ +public class SafeWindowListener implements WindowListener { + + private final WindowListener windowListener; + + public SafeWindowListener(WindowListener windowListener) { + this.windowListener = windowListener; + } + + @Override + public void windowOpened(WindowEvent e) { + try { + windowListener.windowOpened(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosing(WindowEvent e) { + try { + windowListener.windowClosing(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosed(WindowEvent e) { + try { + windowListener.windowClosed(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowIconified(WindowEvent e) { + try { + windowListener.windowIconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeiconified(WindowEvent e) { + try { + windowListener.windowDeiconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowActivated(WindowEvent e) { + try { + windowListener.windowActivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeactivated(WindowEvent e) { + try { + windowListener.windowDeactivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } +} \ No newline at end of file From 9c08ba509eb4d985f1fdd3c51a671cf98ef70936 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 1 Jul 2021 18:46:16 +0800 Subject: [PATCH 032/100] =?UTF-8?q?REPORT-54643=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84persist=E5=88=86=E6=94=AF=E5=AE=89=E8=A3=85=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E5=AD=98=E7=9B=91=E6=8E=A7=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E4=B8=94=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91=20=20?= =?UTF-8?q?=E6=BC=8F=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 01a7defb2e..890b6fa04b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -72,6 +72,8 @@ import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import org.jetbrains.annotations.Nullable; @@ -179,6 +181,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + private Map map = new HashMap<>(); + private WindowAdapter windowAdapter = new WindowAdapter() { @Override From faf18938f45d54cdb2cd3ec5e7c87b3f531c8bab Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 1 Jul 2021 17:43:53 +0800 Subject: [PATCH 033/100] =?UTF-8?q?REPORT-54643=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84persist=E5=88=86=E6=94=AF=E5=AE=89=E8=A3=85=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E5=AD=98=E7=9B=91=E6=8E=A7=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E4=B8=94=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 15 ++++ .../design/mainframe/SafeWindowListener.java | 84 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 25948b62cf..01a7defb2e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -535,6 +535,21 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + @Override + public synchronized void addWindowListener(WindowListener l) { + SafeWindowListener safeWindowListener = new SafeWindowListener(l); + map.put(l, safeWindowListener); + super.addWindowListener(safeWindowListener); + } + + @Override + public synchronized void removeWindowListener(WindowListener l) { + SafeWindowListener safeWindowListener = map.remove(l); + if (safeWindowListener != null) { + super.removeWindowListener(safeWindowListener); + } + } + private void addMacOsListener() { OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java new file mode 100644 index 0000000000..d88eccfa72 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java @@ -0,0 +1,84 @@ +package com.fr.design.mainframe; + +import com.fr.log.FineLoggerFactory; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/** + * 保证监听运行出错也不影响其他功能正常使用 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/6/30 + */ +public class SafeWindowListener implements WindowListener { + + private final WindowListener windowListener; + + public SafeWindowListener(WindowListener windowListener) { + this.windowListener = windowListener; + } + + @Override + public void windowOpened(WindowEvent e) { + try { + windowListener.windowOpened(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosing(WindowEvent e) { + try { + windowListener.windowClosing(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowClosed(WindowEvent e) { + try { + windowListener.windowClosed(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowIconified(WindowEvent e) { + try { + windowListener.windowIconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeiconified(WindowEvent e) { + try { + windowListener.windowDeiconified(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowActivated(WindowEvent e) { + try { + windowListener.windowActivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } + + @Override + public void windowDeactivated(WindowEvent e) { + try { + windowListener.windowDeactivated(e); + } catch (Throwable throwable) { + FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); + } + } +} \ No newline at end of file From 0cf20157c18cccf246f56209acccbcf65a9f62c6 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 1 Jul 2021 18:46:16 +0800 Subject: [PATCH 034/100] =?UTF-8?q?REPORT-54643=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84persist=E5=88=86=E6=94=AF=E5=AE=89=E8=A3=85=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=86=85=E5=AD=98=E7=9B=91=E6=8E=A7=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E4=B8=94=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=A0=E6=B3=95=E7=BC=96=E8=BE=91=20=20?= =?UTF-8?q?=E6=BC=8F=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/DesignerFrame.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 01a7defb2e..890b6fa04b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -72,6 +72,8 @@ import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import org.jetbrains.annotations.Nullable; @@ -179,6 +181,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + private Map map = new HashMap<>(); + private WindowAdapter windowAdapter = new WindowAdapter() { @Override From 8b0619f9dc174328232a5a3fcd9d76134b3882dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 2 Jul 2021 15:21:49 +0800 Subject: [PATCH 035/100] =?UTF-8?q?CHART-19720=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E6=8E=A7=E4=BB=B6=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/TableLayout4VanChartHelper.java | 63 +++-- .../other/VanChartInteractivePane.java | 252 +++++++++++++----- .../VanChartInteractivePaneWithMapZoom.java | 2 +- .../VanChartDrillMapInteractivePane.java | 2 +- 4 files changed, 221 insertions(+), 98 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java index f377cee917..0305817686 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java @@ -12,8 +12,8 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.Border; -import java.awt.Component; import java.util.Arrays; +import java.awt.Component; /** * 布局 标题+组件 @@ -21,13 +21,13 @@ import java.util.Arrays; public class TableLayout4VanChartHelper { private static final int SMALL_GAP = 20; - public static final int EXPANDABLE_PANE_WIDTH =290; - public static final int EXPANDABLE_PANE_HIGHT =24; + public static final int EXPANDABLE_PANE_WIDTH = 290; + public static final int EXPANDABLE_PANE_HIGHT = 24; public static final int DESCRIPTION_AREA_WIDTH = 60; - public static final int EDIT_AREA_WIDTH =155; + public static final int EDIT_AREA_WIDTH = 155; public static final int SECOND_EDIT_AREA_WIDTH = 143; - public static final int COMPONENT_INTERVAL =12; - public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0,12,0,0); + public static final int COMPONENT_INTERVAL = 12; + public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0, 12, 0, 0); public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) { return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) { @@ -43,9 +43,9 @@ public class TableLayout4VanChartHelper { } public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { - return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel){ - protected void setcontentPanelontentPanelBorder (){ - getContentPanel().setBorder(BorderFactory.createEmptyBorder(0 ,5, 0, 0)); + return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) { + protected void setcontentPanelontentPanelBorder() { + getContentPanel().setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); } }; } @@ -54,13 +54,23 @@ public class TableLayout4VanChartHelper { return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH); } + public static JPanel createGapTableLayoutPaneWithoutTop(String title, Component component) { + return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH, false); + } + public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth) { + return createGapTableLayoutPane(title, component, componentWidth, true); + } + + public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth, boolean topLabel) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f, componentWidth}; double[] rowSize = {p, p}; UILabel label = FRWidgetFactory.createLineWrapLabel(title); - label.setVerticalAlignment(SwingConstants.TOP); + if (topLabel) { + label.setVerticalAlignment(SwingConstants.TOP); + } Component[][] components = new Component[][]{ new Component[]{null, null}, new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)}, @@ -93,60 +103,65 @@ public class TableLayout4VanChartHelper { /** * 标题布局(二级菜单距左边框46) - * @param title 标题 + * + * @param title 标题 * @param component 组件 * @return 布局好的组件 */ - public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ + public static JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); } /** * 标题布局(二级菜单距左边框46) - * @param label 标题label + * + * @param label 标题label * @param component 组件 * @return 布局好的组件 */ - public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component){ + public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component) { return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN); } /** * 标题布局(三级菜单距二级左侧20) - * @param title 标题 + * + * @param title 标题 * @param component 组件 * @return 布局好的组件 */ - public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component){ + public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component) { return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP); } /** * 标题布局(指定gap) - * @param title 标题 + * + * @param title 标题 * @param component 组件 - * @param gap 距左侧距离 + * @param gap 距左侧距离 * @return 布局好的组件 */ - public static JPanel createTitlePane(String title, Component component, int gap){ + public static JPanel createTitlePane(String title, Component component, int gap) { return createTitlePaneWithUILabel(new UILabel(title), component, gap); } /** * 标题布局(指定gap) - * @param label 标题label + * + * @param label 标题label * @param component 组件 - * @param gap 距左侧距离 + * @param gap 距左侧距离 * @return 布局好的组件 */ - public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ + public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {gap, f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{label,null}, - new Component[]{null,component}, + new Component[]{label, null}, + new Component[]{null, component}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 885931cb93..d1ac6aa14c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -8,15 +8,19 @@ import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chartx.attr.LargeDataModeType; import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.UnsignedIntUISpinner; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; @@ -32,6 +36,8 @@ import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.gantt.attr.AttrGanttLabel; import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; +import com.fr.plugin.chart.type.AxisType; +import com.fr.plugin.chart.type.ControlType; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.StableUtils; import com.fr.van.chart.custom.component.VanChartHyperLinkPane; @@ -45,14 +51,15 @@ import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.awt.Dimension; public class VanChartInteractivePane extends AbstractVanChartScrollPane { private static final long serialVersionUID = 8135452818502145597L; private static final int AUTO_REFRESH_LEFT_GAP = 18; + private static final double PERCENT = 100.0; protected UICheckBox isSort; protected UICheckBox exportImages; @@ -72,15 +79,20 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private AutoRefreshPane autoRefreshPane; //图表缩放新设计 恢复用注释。删除下面八行代码。 - private UIButtonGroup zoomWidget; + private UICheckBox zoomWidget; protected UIButtonGroup zoomGesture;//地图手势缩放 - private UIButtonGroup zoomResize; - private TinyFormulaPane from; - private TinyFormulaPane to; private UIButtonGroup zoomType; private JPanel changeEnablePane; private JPanel zoomTypePane; + private UIButtonGroup controlType; + protected JPanel centerPane; + private UISpinner categoryNum; + private UINumberDragPane scaling; + private UIButtonGroup zoomResize; + private TinyFormulaPane from; + private TinyFormulaPane to; + //图表缩放新设计 恢复用注释。取消注释。 //private ZoomPane zoomPane; @@ -126,7 +138,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { //new Component[]{createLargeDataModePane(), null}, new Component[]{createAnimationPane(), null}, new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, - new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(plot), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} }; @@ -172,7 +184,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return false; } - protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { + protected JPanel createZoomPane(VanChartPlot plot) { //图表缩放新设计 恢复用注释。取消注释。 // zoomPane = createZoomPane(); // if (zoomPane == null) { @@ -184,47 +196,118 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (!plot.isSupportZoomDirection()) { return null; } - zoomWidget = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - zoomResize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")}); - from = new TinyFormulaPane(); - to = new TinyFormulaPane(); + zoomWidget = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Open_Zoom_Control")); + zoomGesture = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); + JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); + JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); zoomType = new UIButtonGroup(getNameArray(), getValueArray()); - zoomGesture = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); + zoomTypePane = getZoomTypePane(zoomType); + + JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, plot); + zoomWidget.addActionListener((event) -> checkZoomPane()); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel); + } - JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); - JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); + private void createChangeEnablePane(VanChartRectanglePlot plot) { + String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll"); + String scaleAxis = Toolkit.i18nText("Fine-Design_Chart_Scale_Axis"); + controlType = new UIButtonGroup<>(new String[]{scroll, scaleAxis}, ControlType.values()); + JPanel scaleAxisPane = createScaleAxisPane(); + JPanel scrollPane = createScrollPane(plot); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_From")), from}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_To")), to}, + centerPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (controlType.getSelectedItem() == ControlType.ZOOM) { + return scaleAxisPane.getPreferredSize(); + } else { + return scrollPane.getPreferredSize(); + } + } }; + centerPane.add(scaleAxisPane, scroll); + centerPane.add(scrollPane, scaleAxis); + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double[] columnSize = {f, e}; + double[] row = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Control_Type")), controlType}, + new Component[]{centerPane, null} + }; changeEnablePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); - changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 0)); - zoomTypePane = getzoomTypePane(zoomType); - JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); - zoomWidget.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkZoomPane(); + changeEnablePane.setBorder(BorderFactory.createEmptyBorder(5, 12, 0, 0)); + + controlType.addActionListener((event) -> checkCardPane()); + } + + private JPanel createScaleAxisPane() { + zoomResize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Change"), Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")}); + from = new TinyFormulaPane(); + to = new TinyFormulaPane(); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_From")), from}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_To")), to}, + }; + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] row = {p, p, p}; + JPanel resizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); + return resizePane; + } + + + private JPanel createScrollPane(VanChartRectanglePlot plot) { + VanChartAxis vanChartAxis = plot.getCategoryAxisList().get(0); + AxisType axisType = vanChartAxis.getAxisType(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] row = {p}; + Component[][] components; + if (axisType == AxisType.AXIS_CATEGORY) { + categoryNum = new UnsignedIntUISpinner(1, Double.MAX_VALUE, 1); + components = new Component[][]{ + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Initial_Cate_Num")), categoryNum}, + }; + } else { + scaling = new UINumberDragPaneWithPercent(1, 100, 1); + components = new Component[][]{ + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Scaling")), scaling}, + }; + } + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); + } + + protected void checkCardPane() { + if (centerPane != null && controlType != null) { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (controlType.getSelectedItem() == ControlType.ZOOM) { + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll")); + } else { + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scale_Axis")); } - }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel); + } } //图表缩放新设计 恢复用注释。删除下面八个方法getzoomTypePane createZoomPaneContent // checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。 - protected JPanel getzoomTypePane(UIButtonGroup zoomType) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); + protected JPanel getZoomTypePane(UIButtonGroup zoomType) { + return TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); } - protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { + protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, VanChartPlot plot) { JPanel panel = new JPanel(new BorderLayout(0, 4)); if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件 + createChangeEnablePane((VanChartRectanglePlot) plot); panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(changeEnablePane, BorderLayout.CENTER); } @@ -236,17 +319,18 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (zoomWidget != null && axisRotation != null) { if (axisRotation.getSelectedIndex() == 0) { //只有开启坐标轴翻转,才需要将缩放控件强制关闭。 - zoomWidget.setSelectedIndex(1); + zoomWidget.setSelected(false); } checkZoomPane(); zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1); } + checkCardPane(); } protected String[] getNameArray() { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_X_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Y_Axis") - , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; + return new String[]{Toolkit.i18nText("Fine-Design_Chart_X_Axis"), Toolkit.i18nText("Fine-Design_Chart_Y_Axis") + , Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), Toolkit.i18nText("Fine-Design_Chart_Use_None")}; } protected String[] getValueArray() { @@ -256,9 +340,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } private void checkZoomPane() { - boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; - changeEnablePane.setVisible(zoomWidgetEnabled); - zoomType.setEnabled(!zoomWidgetEnabled); + boolean zoomWidgetEnabled = zoomWidget.isSelected(); + if (changeEnablePane != null) { + changeEnablePane.setVisible(zoomWidgetEnabled); + } + zoomTypePane.setVisible(!zoomWidgetEnabled); } private void populateChartZoom(VanChart chart) { @@ -266,20 +352,31 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (zoom == null) { zoom = new VanChartZoom(); } - zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); + zoomWidget.setSelected(zoom.isZoomVisible()); zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); - zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); - if (zoom.getFrom() instanceof BaseFormula) { - from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); - } else { - from.populateBean(Utils.objectToString(zoom.getFrom())); - } - if (zoom.getTo() instanceof BaseFormula) { - to.populateBean(((BaseFormula) zoom.getTo()).getContent()); - } else { - to.populateBean(Utils.objectToString(zoom.getTo())); - } zoomType.setSelectedItem(zoom.getZoomType()); + + if (changeEnablePane != null) { + controlType.setSelectedItem(zoom.getControlType()); + + zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); + if (zoom.getFrom() instanceof BaseFormula) { + from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); + } else { + from.populateBean(Utils.objectToString(zoom.getFrom())); + } + if (zoom.getTo() instanceof BaseFormula) { + to.populateBean(((BaseFormula) zoom.getTo()).getContent()); + } else { + to.populateBean(Utils.objectToString(zoom.getTo())); + } + if (categoryNum != null) { + categoryNum.setValue(zoom.getCategoryNum()); + } + if (scaling != null) { + scaling.populateBean(zoom.getScaling() * PERCENT); + } + } } private void updateChartZoom(VanChart chart) { @@ -288,26 +385,38 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { zoom = new VanChartZoom(); chart.setVanChartZoom(zoom); } - zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); + zoom.setZoomVisible(zoomWidget.isSelected()); zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); - zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); - String fromString = from.updateBean(); - Object fromObject; - if (StableUtils.maybeFormula(fromString)) { - fromObject = BaseFormula.createFormulaBuilder().build(fromString); - } else { - fromObject = fromString; - } - zoom.setFrom(fromObject); - String toString = to.updateBean(); - Object toObject; - if (StableUtils.maybeFormula(toString)) { - toObject = BaseFormula.createFormulaBuilder().build(toString); - } else { - toObject = toString; - } - zoom.setTo(toObject); zoom.setZoomType(zoomType.getSelectedItem()); + if (changeEnablePane != null) { + zoom.setControlType(controlType.getSelectedItem()); + if (zoom.getControlType() == ControlType.ZOOM) { + zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); + String fromString = from.updateBean(); + Object fromObject; + if (StableUtils.maybeFormula(fromString)) { + fromObject = BaseFormula.createFormulaBuilder().build(fromString); + } else { + fromObject = fromString; + } + zoom.setFrom(fromObject); + String toString = to.updateBean(); + Object toObject; + if (StableUtils.maybeFormula(toString)) { + toObject = BaseFormula.createFormulaBuilder().build(toString); + } else { + toObject = toString; + } + zoom.setTo(toObject); + } else { + if (categoryNum != null) { + zoom.setCategoryNum((int) categoryNum.getValue()); + } + if (scaling != null) { + zoom.setScaling(scaling.updateBean() / PERCENT); + } + } + } } protected ZoomPane createZoomPane() { @@ -380,12 +489,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p,p}; + double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{chartAnimationLabel,isChartAnimation} + new Component[]{null, null}, + new Component[]{chartAnimationLabel, isChartAnimation} }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); } @@ -467,7 +576,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { //图表缩放新设计 恢复用注释。删除下面三行代码。 if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件 populateChartZoom((VanChart) chart); - checkZoomPane(); } if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java index 7de7ca3d5d..3ed3251d0a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java @@ -12,7 +12,7 @@ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneW //图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。 @Override - protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { + protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, VanChartPlot plot) { JPanel panel = new JPanel(new BorderLayout(0, 4)); panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(zoomGesturePane, BorderLayout.CENTER); diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 1c8c98f42b..c7386ed0a4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -42,7 +42,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith Component[][] components = new Component[][]{ new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createAnimationPane(), null}, - new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(plot), null}, new Component[]{createDrillToolsPane(), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} From 8da18889b198a755b0c90c645e231b7fbbaa87e5 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 5 Jul 2021 00:01:53 +0800 Subject: [PATCH 036/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 组件样式优化后,期望用户通过组件样式面板中的标题来替换 图表内部的标题,因此新创建的图表组件默认显示组件标题 --- .../designer/creator/XBorderStyleWidgetCreator.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index e4b5377ba7..d4160ef334 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -47,8 +47,16 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ public AbstractBorderStyleWidget toData() { return (AbstractBorderStyleWidget) data; } - - protected void initStyle() { + + @Override + protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight) { + super.addToWrapper(parentPanel, width, minHeight); + // REPORT-53175: 新创建的图表组件默认显示标题 since 10.0.18 + // 将当前对象添加到父容器后,初始化默认样式的效果 + initStyle(); + } + + protected void initStyle() { BorderPacker style = toData().getBorderStyle(); initBorderStyle(); if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { From 9050f236398b2227283db53724d6564c9375d1dd Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 5 Jul 2021 00:09:47 +0800 Subject: [PATCH 037/100] =?UTF-8?q?REPORT-53175=20=E3=80=9010.0.18?= =?UTF-8?q?=E3=80=91=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E4=B8=BA=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化样式面板中线型选择下拉列表的显示,原有的渲染方法会导致 显示文字"无"时字体过大(使用了默认字体),超出下拉框的高度从而 被截断,且不支持其他文字选项. 优化后的文字渲染逻辑使用默认的JComboBox的文字渲染方法,即通过 JComboBox内部的JLabel控件渲染文字. 且提供toStringFromStyle 接口方法,将对应的Int类型线型值,转变为可渲染的文本. --- .../fr/design/gui/icombobox/LineComboBox.java | 57 +++++++++---------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java index ca4eddfe3e..65e24a7c3a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java @@ -3,22 +3,14 @@ */ package com.fr.design.gui.icombobox; -import com.fr.base.FRContext; import com.fr.base.GraphHelper; -import com.fr.base.ScreenResolution; -import com.fr.general.FRFont; import com.fr.stable.Constants; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JLabel; -import javax.swing.JList; /** @@ -59,6 +51,13 @@ public class LineComboBox extends UIComboBox { this.setSelectedItem(new Integer(style)); } + protected String toStringFromStyle(int style) { + if (style == Constants.LINE_NONE) { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"); + } + return null; + } + /** * CellRenderer. */ @@ -67,31 +66,27 @@ public class LineComboBox extends UIComboBox { JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel comp= (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); this.style = ((Integer) value).intValue(); - comp.setText(null); + String displayString = toStringFromStyle(style); + if (StringUtils.isNotEmpty(displayString)) { + comp.setText(" " + displayString); + } else { + comp.setText(null); + } return comp; } public void paint(Graphics g) { super.paint(g); - Graphics2D g2d = (Graphics2D) g; - - Dimension d = getSize(); - g2d.setColor(getForeground()); - - FRFont font = FRContext.getDefaultValues().getFRFont(); - int resolution = ScreenResolution.getScreenResolution(); - Font rfont = font.applyResolutionNP(resolution); - g2d.setFont(rfont); - FontMetrics fm = GraphHelper.getFontMetrics(rfont); - if (style == Constants.LINE_NONE) { - //draw "none" string - GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2D + fm.getAscent()); - } else { + if (StringUtils.isEmpty(toStringFromStyle(style))) { + Graphics2D g2d = (Graphics2D) g; + + Dimension d = getSize(); + g2d.setColor(getForeground()); GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style); - } - - if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式. - drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D)); + + if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式. + drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D)); + } } } From a4ab670616eab1b407de26ecef01757cf877787d Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 5 Jul 2021 10:25:00 +0800 Subject: [PATCH 038/100] =?UTF-8?q?REPORT-53614=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= =?UTF-8?q?-=E5=90=8C=E6=AD=A5jar=E6=97=B6=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/CheckServiceDialog.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java index ef4b0e0322..185268e79c 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -167,8 +167,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { centerPanel.add(detailsPane, BorderLayout.CENTER); JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); - boolean Sync = false; - if (Sync && isOnline()) { + if (isOnline()) { ignoreButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_Ignore")); ignoreButton.addActionListener(this); syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local")); @@ -184,6 +183,8 @@ public class CheckServiceDialog extends JDialog implements ActionListener { buttonPanel.add(progressBar, BorderLayout.CENTER); buttonPanel.add(syncButton, BorderLayout.EAST); } else { + UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); + centerPanel.add(adviceLabel, BorderLayout.SOUTH); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); okButton.addActionListener(this); buttonPanel.add(okButton, BorderLayout.EAST); From c867ff7ea75d5617707ae07a5548e4704d43fb6b Mon Sep 17 00:00:00 2001 From: Lanlan Date: Mon, 5 Jul 2021 10:44:11 +0800 Subject: [PATCH 039/100] =?UTF-8?q?REPORT-53762=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=92=8C=E7=9F=AD=E4=BF=A1=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=EF=BC=8C=E4=BD=BF=E7=94=A8=E7=9A=84=E6=98=AF?= =?UTF-8?q?http=E5=8D=8F=E8=AE=AE=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/locale/impl/BbsRegisterMark.java | 4 ++-- .../src/main/java/com/fr/design/locale/impl/BbsResetMark.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java index 6c97b1e6b5..afe1c8eef3 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java @@ -16,8 +16,8 @@ import java.util.Map; public class BbsRegisterMark implements LocaleMark { private final Map map = new HashMap<>(); - private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "http://id.fanruan.com/register/register.php?clueSource=activityfr"); - private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "http://id.fanruan.com/register/register.php?clueSource=activityfr"); + private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "https://id.fanruan.com/register/register.php?clueSource=activityfr"); + private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "https://id.fanruan.com/register/register.php?clueSource=activityfr"); private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php"); private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php"); private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php"); diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java index b44a4e691c..27db28e416 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java @@ -16,8 +16,8 @@ import java.util.Map; public class BbsResetMark implements LocaleMark { private final Map map = new HashMap<>(); - private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "http://id.fanruan.com/forget/forget.php?clue=activityfr"); - private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "http://id.fanruan.com/forget/forget.php?clue=activityfr"); + private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "https://id.fanruan.com/forget/forget.php?clue=activityfr"); + private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "https://id.fanruan.com/forget/forget.php?clue=activityfr"); private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php"); private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php"); private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php"); From 859d2667a378654002106f922b742530b3ccd874 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Mon, 5 Jul 2021 10:51:34 +0800 Subject: [PATCH 040/100] =?UTF-8?q?REPORT-52847=20=E3=80=9010.0.18?= =?UTF-8?q?=E3=80=91=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81fetchsize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/DBCPAttrPane.java | 138 +++++++++++++++++- .../connect/DatabaseConnectionPane.java | 5 +- .../datapane/connect/JDBCConnectionDef.java | 43 ++++++ .../data/datapane/connect/JDBCDefPane.java | 2 + 4 files changed, 177 insertions(+), 11 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java index 01af972931..58a021812c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java @@ -1,8 +1,9 @@ package com.fr.design.data.datapane.connect; +import com.fr.base.GraphHelper; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.pool.DBCPConnectionPoolAttr; -import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.gui.icombobox.UIComboBox; @@ -12,14 +13,35 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import java.awt.BorderLayout; -import java.awt.Component; -import javax.swing.BorderFactory; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; + import javax.swing.JPanel; +import javax.swing.JTextField; import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Window; +import java.awt.event.InputMethodEvent; +import java.awt.event.InputMethodListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class DBCPAttrPane extends BasicPane { public static final int TIME_MULTIPLE = 1000; + private static final Pattern FETCHSIZE_PATTERN = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");; + private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]"); + private static final int MAX_FETCHSIZE = 1000000; + private static final Map DEFAULT_FETCHSIZE_MAP = new HashMap<>(); + private static final int ORACLE_DEFAULT_FETCHSIZE = 128; + private static final int DB2_DEFAULT_FETCHSIZE = 50; + private static final int POSTGRE_DEFAULT_FETCHSIZE = 10000; // carl:DBCP的一些属性 private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); @@ -36,11 +58,24 @@ public class DBCPAttrPane extends BasicPane { private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); + private UITextField FETCHSIZE = new UITextField(); + + private JPanel defaultPane; + private JPanel northFlowPane; + private JPanel southFlowPane; + + static { + DEFAULT_FETCHSIZE_MAP.put("Oracle", ORACLE_DEFAULT_FETCHSIZE); + DEFAULT_FETCHSIZE_MAP.put("DB2", DB2_DEFAULT_FETCHSIZE); + DEFAULT_FETCHSIZE_MAP.put("Postgre", POSTGRE_DEFAULT_FETCHSIZE); + } + public DBCPAttrPane() { - JPanel defaultPane = this; + defaultPane = this; // JPanel northFlowPane - JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + northFlowPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr")); + northFlowPane.setPreferredSize(new Dimension(630, 320)); defaultPane.add(northFlowPane, BorderLayout.NORTH); DBCP_VALIDATION_QUERY.setColumns(15); @@ -67,7 +102,6 @@ public class DBCPAttrPane extends BasicPane { DBCP_MINEVICTABLEIDLETIMEMILLIS}}; JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); - contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR)); northFlowPane.add(contextPane); } @@ -89,6 +123,10 @@ public class DBCPAttrPane extends BasicPane { this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); + Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName()); + if (fetchSize != null) { + this.FETCHSIZE.setText(jdbcDatabase.getFetchSize() == -1 ? String.valueOf(fetchSize) : String.valueOf(jdbcDatabase.getFetchSize())); + } } public void update(JDBCDatabaseConnection jdbcDatabase) { @@ -109,10 +147,94 @@ public class DBCPAttrPane extends BasicPane { dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE); dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue()); dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue()); + Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName()); + if (fetchSize != null) { + jdbcDatabase.setFetchSize(Integer.parseInt(this.FETCHSIZE.getText())); + } + } + + @Override + public BasicDialog showWindow(Window window) { + String databaseName = JDBCConnectionDef.getInstance().getDatabaseName(); + if (showOtherConfig(databaseName)) { + southFlowPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Other")); + southFlowPane.setPreferredSize(new Dimension(630, 200)); + double f = TableLayout.FILL; + double[] rowSize = {f}; + double otherColumnSize = GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis")) + 6; + double[] columnSize = {otherColumnSize, otherColumnSize}; + FETCHSIZE.addKeyListener(fetchSizeKeyListener); + FETCHSIZE.addInputMethodListener(fetchSizeInputMethodListener); + FETCHSIZE.setHorizontalAlignment(JTextField.RIGHT); + Component[][] comps = { + {new UILabel("Fetchsize:", SwingConstants.RIGHT), FETCHSIZE} + }; + JPanel otherConfigPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); + southFlowPane.add(otherConfigPane); + + defaultPane.removeAll(); + defaultPane.add(northFlowPane, BorderLayout.NORTH); + defaultPane.add(southFlowPane, BorderLayout.SOUTH); + } else { + if (southFlowPane != null) { + defaultPane.remove(southFlowPane); + } + } + return this.showWindow(window, null); + } + + private boolean showOtherConfig(Object dbType) { + return ComparatorUtils.equals(dbType, "Oracle") || ComparatorUtils.equals(dbType, "DB2") || ComparatorUtils.equals(dbType, "Postgre"); + } + + KeyListener fetchSizeKeyListener = new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + String fetchSize = FETCHSIZE.getText(); + if (!isFetchSizeValid(fetchSize)) { + FETCHSIZE.setText(fetchSize.replaceAll(getCharNeedReplace(e.getKeyChar()), "")); + if (!isFetchSizeValid(FETCHSIZE.getText())) { + FETCHSIZE.setText(StringUtils.EMPTY); + } + } else if (FETCHSIZE.getText().length() > String.valueOf(MAX_FETCHSIZE).length() || Long.parseLong(FETCHSIZE.getText()) > MAX_FETCHSIZE) { + FETCHSIZE.setText(String.valueOf(MAX_FETCHSIZE)); + } + } + }; + + InputMethodListener fetchSizeInputMethodListener = new InputMethodListener() { + @Override + public void inputMethodTextChanged(InputMethodEvent event) { + if (null == event.getText()) { + return; + } + char ch = event.getText().current(); + if (!(ch >= '0' && ch <= '9')) { + event.consume(); + } + } + + @Override + public void caretPositionChanged(InputMethodEvent event) { + + } + }; + + private boolean isFetchSizeValid(String fetchSize) { + return FETCHSIZE_PATTERN.matcher(fetchSize).find(); + } + + private String getCharNeedReplace(char c) { + String charNeedReplace = c + ""; + Matcher matcher = CHAR_NEED_ESCAPE.matcher(charNeedReplace); + if (matcher.find()) { + charNeedReplace = "\\" + charNeedReplace; + } + return charNeedReplace; } @Override protected String title4PopupWindow() { - return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); + return Toolkit.i18nText("Fine-Design_Basic_Advanced_Setup"); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index f3a97ffb1c..e55aaa2dd4 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -12,7 +12,6 @@ import com.fr.data.solution.entity.DriverPage; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.ActionLabel; @@ -338,7 +337,7 @@ public abstract class DatabaseConnectionPane Date: Mon, 5 Jul 2021 13:55:29 +0800 Subject: [PATCH 041/100] =?UTF-8?q?REPORT-54116=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E5=86=85=E5=8F=AF?= =?UTF-8?q?=E9=94=81=E5=AE=9A=E7=BB=84=E4=BB=B6=E5=AE=BD=E9=AB=98=E6=AF=94?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在已展示Shift锁定尺寸比例提示信息后,下次打开不再提示该信息 --- .../design/designer/beans/location/AccessDirection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java index 8cdca27f61..be44eae817 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java @@ -3,6 +3,8 @@ */ package com.fr.design.designer.beans.location; +import com.fr.config.ServerPreferenceConfig; +import com.fr.config.utils.ConfigReadUtils; import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; import com.fr.design.designer.creator.*; @@ -193,7 +195,11 @@ public abstract class AccessDirection implements Direction { if (type != formEditor.getCursor().getType()) { // 设置当前形状 formEditor.setCursor(Cursor.getPredefinedCursor(type)); - formEditor.setToolTipText(getTooltip()); + ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); + if (!config.isHasShownLockedAspectRatioResizingToolTip()) { + formEditor.setToolTipText(getTooltip()); + config.setHasShownLockedAspectRatioResizingToolTip(true); + } } } From f2e7401bda33cb554f70899d4acd72ee5b7050d9 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 5 Jul 2021 14:17:03 +0800 Subject: [PATCH 042/100] =?UTF-8?q?REPORT-54716=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E4=B8=AD=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=E5=A4=A7=E5=86=99=EF=BC=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=87=8D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/widget/ui/FormWidgetCardPane.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 4ab3fdb74a..debc5ae875 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -86,7 +86,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { return null; } else if (xLayoutContainer.acceptType(XWAbsoluteLayout.class)) { return new WidgetAbsoluteBoundPane(xCreator); - } else if(xCreator.acceptType(XWCardTagLayout.class)){ + } else if (xCreator.acceptType(XWCardTagLayout.class)) { return new WidgetCardTagBoundPane(xCreator); } return new WidgetBoundPane(xCreator); @@ -231,7 +231,14 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { UITextField widgetNameField = widgetPropertyPane.getWidgetNameField(); String toSetWidgetName = widgetNameField.getText(); String currentWidgetName = widget.getWidgetName(); - boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); + boolean isNameExist = false; + Widget tempWidget = designer.getTarget().getWidgetByName(toSetWidgetName); + if (!ComparatorUtils.equals(widget, tempWidget)) { + isNameExist = true; + } else if (ComparatorUtils.equals(toSetWidgetName, tempWidget.getWidgetName())) { + isNameExist = true; + } + boolean exist = isNameExist && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); if (toSetWidgetName.isEmpty()) { widgetNameField.setText(currentWidgetName); return; From f4e67a6b149c91406aa40ee8ba43a9228cd6a38c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 5 Jul 2021 14:36:59 +0800 Subject: [PATCH 043/100] =?UTF-8?q?REPORT-54716=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E4=B8=AD=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=E5=A4=A7=E5=86=99=EF=BC=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=87=8D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/widget/ui/FormWidgetCardPane.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index debc5ae875..2fc161fc0a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -231,14 +231,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { UITextField widgetNameField = widgetPropertyPane.getWidgetNameField(); String toSetWidgetName = widgetNameField.getText(); String currentWidgetName = widget.getWidgetName(); - boolean isNameExist = false; - Widget tempWidget = designer.getTarget().getWidgetByName(toSetWidgetName); - if (!ComparatorUtils.equals(widget, tempWidget)) { - isNameExist = true; - } else if (ComparatorUtils.equals(toSetWidgetName, tempWidget.getWidgetName())) { - isNameExist = true; - } - boolean exist = isNameExist && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); + boolean exist = designer.getTarget().isNameExist(toSetWidgetName, widget) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); if (toSetWidgetName.isEmpty()) { widgetNameField.setText(currentWidgetName); return; From f583095eca6e20206cea2f55e8abdb9dcae738bb Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 5 Jul 2021 14:06:58 +0800 Subject: [PATCH 044/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 设计器组件样式设置直接在设计器右侧栏展示 2. 设计器组件标题样式支持背景图片,图文混排 3. 设计器组件样式主体样式支持边框图片(点九图) 4. 标题样式背景填充,边框图片,主体背景填充支持透明度 --- .../design/gui/frpane/UIPercentDragPane.java | 30 + .../fr/design/gui/style/BackgroundPane.java | 10 +- .../backgroundpane/ImagePreviewPane.java | 23 +- .../buttonicon/icon_border_image_help.png | Bin 0 -> 468 bytes .../images/buttonicon/icon_choose_inset.png | Bin 0 -> 280 bytes .../images/buttonicon/icon_delete_inset.png | Bin 0 -> 147 bytes .../buttonicon/icon_inset_both_selected.png | Bin 0 -> 145 bytes .../buttonicon/icon_inset_both_unselected.png | Bin 0 -> 141 bytes .../buttonicon/icon_inset_left_selected.png | Bin 0 -> 155 bytes .../buttonicon/icon_inset_left_unselected.png | Bin 0 -> 141 bytes .../buttonicon/icon_inset_right_selected.png | Bin 0 -> 140 bytes .../icon_inset_right_unselected.png | Bin 0 -> 136 bytes .../design/images/transparent_background.jpg | Bin 0 -> 24869 bytes .../creator/XBorderStyleWidgetCreator.java | 6 + .../fr/design/designer/creator/XLabel.java | 14 +- .../gui/xpane/BorderLineAndImagePane.java | 598 ++++++++++++++++++ .../gui/xpane/CardTagLayoutStylePane.java | 27 + .../fr/design/gui/xpane/LayoutStylePane.java | 502 +++++++++++++++ .../design/gui/xpane/TitleInsetImagePane.java | 258 ++++++++ .../widget/ui/FormWidgetCardPane.java | 10 +- .../layout/BorderStyleWidgetDefinePane.java | 14 +- .../FRAbsoluteBodyLayoutDefinePane.java | 91 +-- .../layout/FRFitLayoutDefinePane.java | 93 +-- .../layout/WCardMainLayoutDefinePane.java | 13 +- .../layout/WTitleLayoutDefinePane.java | 36 +- 25 files changed, 1585 insertions(+), 140 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_border_image_help.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_choose_inset.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete_inset.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_selected.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_unselected.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_selected.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_unselected.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_right_selected.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_right_unselected.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg create mode 100644 designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java create mode 100644 designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java create mode 100644 designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java create mode 100644 designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java new file mode 100644 index 0000000000..1dd96de00a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java @@ -0,0 +1,30 @@ +package com.fr.design.gui.frpane; + +import com.fr.design.gui.ilable.UILabel; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Starryi + * @version 10.0.18 + * Created by Starryi on 2021/7/3 + */ +public class UIPercentDragPane extends JPanel { + + private final UINumberDragPane dragPane = new UINumberDragPane(0, 100, 1); + + public UIPercentDragPane() { + setLayout(new BorderLayout()); + add(dragPane, BorderLayout.CENTER); + add(new UILabel(" %"), BorderLayout.EAST); + } + + public void populateBean(double value) { + dragPane.populateBean(value * 100); + } + + public double updateBean() { + return dragPane.updateBean() * 100; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java index 13dd9e3c9d..bdf96f32e3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java @@ -70,13 +70,13 @@ public class BackgroundPane extends AbstractBasicStylePane { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill") + " ", SwingConstants.LEFT),typeComboBox}, - new Component[]{null, centerPane} + new Component[]{null}, + new Component[]{typeComboBox}, + new Component[]{centerPane} }; double[] rowSize = {p, p, p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; + double[] columnSize = {f}; + int[][] rowCount = {{1},{1},{1}}; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); this.add(panel, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java index 24b3ebfc42..10629de029 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java @@ -52,8 +52,15 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre private boolean isLoading = false; public ImagePreviewPane() { - sizeLabel = new UILabel(); - this.add(sizeLabel); + this(true); + } + + public ImagePreviewPane(boolean showSizeLabel) { + if (showSizeLabel) { + sizeLabel = new UILabel(); + this.add(sizeLabel); + } + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 20, 10)); this.setLayout(new BorderLayout()); this.add(new JPanel() { @@ -117,7 +124,9 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre ((JViewport) this.getParent()).setMinimumSize(newDimension); ((JViewport) this.getParent()).setMaximumSize(newDimension); } - sizeLabel.setText(null); + if (sizeLabel != null) { + sizeLabel.setText(null); + } } else { isLoading = false; // wait for the size of image. @@ -128,10 +137,14 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre int totalwidth = ImagePreviewPane.this.getWidth(); int totalheight = ImagePreviewPane.this.getHeight(); String text = imageWidth + "x" + imageHeight; - sizeLabel.setText(text); + if (sizeLabel != null) { + sizeLabel.setText(text); + } FontMetrics cellFM = this.getFontMetrics(getFont()); int width = cellFM.stringWidth(text); - sizeLabel.setBounds(totalwidth - width - LABEL_DELTA_X, totalheight - LABEL_DELTA_Y, width, LABEL_HEIGHT); + if (sizeLabel != null) { + sizeLabel.setBounds(totalwidth - width - LABEL_DELTA_X, totalheight - LABEL_DELTA_Y, width, LABEL_HEIGHT); + } } fireChangeListener(); this.revalidate(); diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_border_image_help.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_border_image_help.png new file mode 100644 index 0000000000000000000000000000000000000000..89a12190b6b73a804c87d2440b2450d52364ba90 GIT binary patch literal 468 zcmV;_0W1EAP)H(Lx210C#EU2YVozSg-)-#Z*q{jN^q?XLqRy>d5=pyA zokhX*(!Az>fAMh;^!Ln%F!ajjNM zb-Voygv6zc8G}o2Z;2DvJqj!lLbiM#J~@u%27pp&Z5sgGw(a9~2&|?75ZH0fuVuWt zx>n#Ed^8&7RhYk-1;EeRws|lB7`vW_&zjAX=V9-aN@d#fc-i+cRriI$#+0u6Rok}q zeg!Bo#;{?U=7WOA0KQvLiDB2VR_C0J&Y14zItY-=?#G0K9w zA&|x`m;c|){9!;HA3FNU3kbuo7X-mU3K(PNWm!I5#hifJd}OAHm;gE(V`eVM55O|_ z0lEu-nFatoT#z3?6eUxDw?sS!kiG$&65+y(RZ(Oodz8iy<2c@lSZlrXh5aW0rPK%j zYpt(#tG*FzeKmql*yg_xpj5Jv0(qXTeVsJ|e97CLeF4lo1aNC}8y~H#w*u6mEZUeY e&0a$9e2p(fMtTuu{8=af0000$zN{#U|Pe@ihwI$821Rzjy9V0 wfZ63#`2nvh_nV_@pWoiiwtW6e)=ehNFKwm>nzQeF0knm|)78&qol`;+0D4z8LjV8( literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_selected.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_selected.png new file mode 100644 index 0000000000000000000000000000000000000000..018fa1257d88e057db9675b637cd0ee29aadf138 GIT binary patch literal 145 zcmeAS@N?(olHy`uVBq!ia0vp^fYnuYxoZfBr%tDNI2yj sc=VMovaM%XL{Gxu6Aee$bT(NrtTPN&Ja*}DInWLUPgg&ebxsLQ08%S27XSbN literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_unselected.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_unselected.png new file mode 100644 index 0000000000000000000000000000000000000000..3a822ba8b245620614da89189048ef11a511c648 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^fscq8isq@DZ(4FCQ9UT@0G?98F8%wfDv^_qZ4?Ta=6=?%_D1Xi_h pMz-}Vi|9!>e4^n9o6aUHhMCV(J~CzQcmp(_!PC{xWt~$(696oBF5dtE literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_selected.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_selected.png new file mode 100644 index 0000000000000000000000000000000000000000..b34a287048004a051da7f1f85b725e534e152b2b GIT binary patch literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^f;M1& literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_unselected.png b/designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_unselected.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8696b97809fe6e670c06178844cc9aabc295f5 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^fm5(#_&zU&!qnc0M1Zk%%gT}p|fik`S{~P}>G-@(zopr0QICZ!T7<`n^ZoYyFBm)x@Dzp+6~VoJh}MW+gUr>`-PRB8)Q o^;wa0BBP6yT{%)y%$A9P<+rzB!o+P4fyOgucw_4(NIB(wSWwX(;r#Fa|Mh?W+aDHna}!9rqN?rF)}a`}DZEO; kXjam}gC1dBuKf%QdwIhJQ#0zafJQTTy85}Sb4q9e0015>>i_@% literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg b/designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b04da96ea64527351d96ba579a8195ffa940a785 GIT binary patch literal 24869 zcmeI)KS&!<9KiASJk6go*W@5tjL3zkZK!pSYNHVwF*UYs6%i^3LJJkUYnOtHQbZ{2 zE?B#iwsw#@>7e4EOL0*AQ(ElSC9OjzmouldHlvUe zXYOZ&lu``lUc&w=(!%fY`n(>$&+F55f2mO(Gy(ymGF%oak5=oI#|n>qfwc1cQ-8tyP;i_hK&#()PBIDjB{rvDlt{ zSn=&g_s6MUhqHAL{xt2&{+Dk)ZMODhMxXV3sBT?~Pi{RoM#lOWm_woBzoO&xY#Qt2 zY+>SH4lN`n(Gz>_6=Ms`a>Y@|i!ab(rY_`6O+@i81_CV=qX5EW_cI2d1zMoxO5zT* zK#Sb28)#GSTA&45paoi>#mz}*sI-REw8-MAoyBvlNuNjyTa>n?-L0GCK?}4%i$)9@F=)h~ z5rakyG*nwdA}t~E+QPZNPg@#INNP3WfNbP`#nid2oO@M2qC)WlBEzkn3 bi>hg@_j_)iJ(`_&f1iG@=8=f5NPF)X8B;4H literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index d4160ef334..e174c122f3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -129,6 +129,12 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ title.setFont(wTitle.getFrFont()); title.setTextalign(wTitle.getPosition()); title.setBackground(wTitle.getBackground()); + title.setBackgroundOpacity(wTitle.getBackgroundOpacity()); + + title.setInsetImage(wTitle.getInsetImage()); + title.setInsetImagePadding(wTitle.getInsetImagePadding()); + title.setInsetRelativeTextLeft(wTitle.isInsetRelativeTextLeft()); + title.setInsetRelativeTextRight(wTitle.isInsetRelativeTextRight()); } private WidgetValue getTitleValue(TitlePacker wTitle){ diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java index df2252c7af..154091a296 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java @@ -5,6 +5,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; import com.fr.base.Style; +import com.fr.base.background.ImageBackground; import com.fr.design.border.UIRoundedBorder; import com.fr.design.form.util.FontTransformUtil; import com.fr.design.form.util.XCreatorConstants; @@ -17,6 +18,7 @@ import com.fr.design.mainframe.widget.renderer.LabelHorizontalAlignmentRenderer; import com.fr.form.ui.Label; import com.fr.form.ui.container.WParameterLayout; +import com.fr.general.Background; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.core.PropertyChangeAdapter; @@ -94,10 +96,18 @@ public class XLabel extends XWidgetCreator { } if (label.getWidgetValue() != null) { Graphics2D g2d = (Graphics2D) g.create(); - BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue() - .toString(), Style.getInstance(label.getFont()).deriveHorizontalAlignment(label.getTextalign()) + + Background inset = label.getInsetImage(); + Image insetImage = inset instanceof ImageBackground ? ((ImageBackground) inset).getImage() : null; + + BaseUtils.drawStringStyleInRotation(g2d, + this.getWidth(), this.getHeight(), + label.getWidgetValue().toString(), + Style.getInstance(label.getFont()) + .deriveHorizontalAlignment(label.getTextalign()) .deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP) .deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE), + insetImage, label.getInsetImagePadding(), label.isInsetRelativeTextLeft(), label.isInsetRelativeTextRight(), FontTransformUtil.getDesignerFontResolution()); } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java new file mode 100644 index 0000000000..67eb8c1ae5 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -0,0 +1,598 @@ +package com.fr.design.gui.xpane; + +import com.fr.base.GraphHelper; +import com.fr.base.Style; +import com.fr.base.Utils; +import com.fr.base.background.ImageBackground; +import com.fr.base.background.ImageFileBackground; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.ImgChooseWrapper; +import com.fr.design.gui.frpane.UIPercentDragPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itooltip.UIToolTip; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.backgroundpane.ImagePreviewPane; +import com.fr.design.style.background.image.ImageFileChooser; +import com.fr.form.ui.LayoutBorderStyle; +import com.fr.general.Background; +import com.fr.general.IOUtils; +import com.fr.stable.Constants; +import com.fr.stable.GraphDrawHelper; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.RoundRectangle2D; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +/** + * @author Starryi + * @version 10.0.18 + * Created by Starryi on 2021/7/2 + * + * 可配置图片类型边框的样式设置面板 + */ +public class BorderLineAndImagePane extends JPanel implements UIObserver { + private final int SETTING_LABEL_WIDTH = 60; + private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); + private final String TWEAK_NINE_POINT_HELP_URL = ""; + + private UIObserverListener uiObserverListener; + + private BorderLineAndImageComboBox borderLineCombo; + private UIColorButton borderColorPane; + private ImagePreviewPane imagePreviewPane; + private UIButton chooseImageButton; + private UIButton tweakNinePointHelpButton; + private UIButton tweakNinePointButton; + private UIPercentDragPane borderImageOpacityPane; + + private NinePointImageTweakDialogPane tweakPane; + private ImageFileChooser imageFileChooser; + + private int ninePointLeft = -1; + private int ninePointTop = -1; + private int ninePointRight = -1; + private int ninePointBottom = -1; + + public BorderLineAndImagePane() { + this.initComponents(); + this.initLayout(); + } + + private void initComponents() { + borderLineCombo = new BorderLineAndImageComboBox(); + borderColorPane = new UIColorButton(null) {{ + setUI(createButtonUI(this)); + set4ToolbarButton(); + }}; + imagePreviewPane = new ImagePreviewPane() {{ + setImageStyle(Style.DEFAULT_STYLE); + }}; + chooseImageButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Select_Picture")); + + tweakNinePointHelpButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_border_image_help.png")); + tweakNinePointHelpButton.setUI(new BasicButtonUI()); + tweakNinePointHelpButton.setBorderPainted(false); + tweakNinePointHelpButton.setBorder(null); + tweakNinePointHelpButton.setContentAreaFilled(false); + tweakNinePointHelpButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Desktop desktop = Desktop.getDesktop(); + try { + desktop.browse(new URI(TWEAK_NINE_POINT_HELP_URL)); + } catch (IOException | URISyntaxException ioException) { + ioException.printStackTrace(); + } + } + }); + + tweakNinePointButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image_Config_Nine_Point_Fill")); + borderImageOpacityPane = new UIPercentDragPane(); + } + + private JPanel createBorderLineComposedPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + return TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Line")), this.borderLineCombo}}, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, 0); + } + + private JPanel createBorderColorComposedPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + return TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Color")), this.borderColorPane}}, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, 0); + } + + private JPanel createBorderImageComposePane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p, p, p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + JPanel borderedImagePreviewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + borderedImagePreviewPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); + borderedImagePreviewPane.setPreferredSize(new Dimension(145, 145)); + borderedImagePreviewPane.add(imagePreviewPane, BorderLayout.CENTER); + + JPanel tweakNinePointComposedPane = new JPanel(); + tweakNinePointComposedPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + tweakNinePointButton.setPreferredSize(new Dimension(145, 16)); + tweakNinePointComposedPane.add(tweakNinePointHelpButton); + tweakNinePointComposedPane.add(tweakNinePointButton); + + return TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{ + {null, borderedImagePreviewPane}, + {null, chooseImageButton}, + {tweakNinePointComposedPane, null}, + {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, + {null, this.borderImageOpacityPane} + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + } + + private void initImageFileChooserIfNotExist() { + if (imageFileChooser == null) { + imageFileChooser = new ImageFileChooser(); + imageFileChooser.setMultiSelectionEnabled(false); + } + } + + protected void initNinePointTweakPaneIfNotExist() { + if (tweakPane == null) { + tweakPane = new NinePointImageTweakDialogPane(); + } + } + + private void initLayout() { + this.setLayout(new BorderLayout(0, IntervalConstants.INTERVAL_L1)); + + this.add(this.createBorderLineComposedPane(), BorderLayout.NORTH, 0); + this.add(this.createBorderColorComposedPane(), BorderLayout.CENTER, 1); + this.add(this.createBorderImageComposePane(), BorderLayout.SOUTH, 2); + + getComponent(1).setVisible(false); + getComponent(2).setVisible(false); + + this.borderLineCombo.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + getComponent(1).setVisible(borderLineCombo.isSelectedBorderLine()); + getComponent(2).setVisible(borderLineCombo.isSelectedBorderImage()); + + if (!borderLineCombo.isSelectedBorderLine()) { + borderColorPane.setColor(Color.BLACK); + } + if (!borderLineCombo.isSelectedBorderImage()) { + imagePreviewPane.setImageWithSuffix(null); + } + + fireStateChanged(); + } + }); + this.chooseImageButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + initImageFileChooserIfNotExist(); + + int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); + ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + Image image = imagePreviewPane.getImage(); + ninePointLeft = ninePointRight = (image != null ? image.getWidth(null) / 3 : -1); + ninePointTop = ninePointBottom = (image != null ? image.getHeight(null) / 3 : -1); + borderImageOpacityPane.populateBean(1.0); + + fireStateChanged(); + } + }).dealWithImageFile(returnVal); + } + }); + this.tweakNinePointButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + initNinePointTweakPaneIfNotExist(); + + if (imagePreviewPane.getImage() != null) { + BasicDialog dialog = tweakPane.showWindow(SwingUtilities.getWindowAncestor(BorderLineAndImagePane.this)); + dialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + fireStateChanged(); + } + }); + dialog.setVisible(true); + } + } + }); + } + + public void populateBean(LayoutBorderStyle style) { + int borderLine = style.getBorder(); + Color borderColor = style.getColor(); + + this.borderLineCombo.setSelectedLineStyle(borderLine); + this.borderColorPane.setColor(borderColor); + + Background borderImage = style.getBorderImage(); + if (borderImage instanceof ImageBackground) { + // 图片类型边框 + Image image = ((ImageBackground) borderImage).getImage(); + int[] ninePoint = ((ImageBackground) borderImage).getNinePoint(); + + if (image != null) { + this.borderLineCombo.selectBorderImage(); + this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix()); + this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity()); + if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] > 0 && ninePoint[1] > 0 && ninePoint[2] > 0 && ninePoint[3] > 0) { + ninePointLeft = ninePoint[0]; + ninePointTop = ninePoint[1]; + ninePointRight = ninePoint[2]; + ninePointBottom = ninePoint[3]; + } else { + ninePointLeft = ninePointRight = image.getWidth(null) / 3; + ninePointTop = ninePointBottom = image.getHeight(null) / 3; + } + + getComponent(1).setVisible(false); + getComponent(2).setVisible(true); + + return; + } + } + + if (borderLine == Constants.LINE_NONE) { + getComponent(1).setVisible(false); + getComponent(2).setVisible(false); + return; + } else { + getComponent(1).setVisible(true); + getComponent(2).setVisible(false); + } + + this.borderLineCombo.setSelectedLineStyle(style.getBorder()); + this.borderColorPane.setColor(style.getColor()); + } + + public void updateBean(LayoutBorderStyle style) { + + style.setBorder(this.borderLineCombo.getSelectedLineStyle()); + style.setColor(this.borderColorPane.getColor()); + style.setBorderImage(null); + + if (this.borderLineCombo.isSelectedBorderImage()) { + Image image = this.imagePreviewPane.getImage(); + if (image != null) { + ImageBackground newImageBackground = new ImageFileBackground(this.imagePreviewPane.getImageWithSuffix(), Constants.IMAGE_EXTEND); + newImageBackground.setNinePoint(new int[] { ninePointLeft, ninePointTop, ninePointRight, ninePointBottom }); + style.setBorderImage(newImageBackground); + style.setBorderImageOpacity((float)borderImageOpacityPane.updateBean()); + } + } + } + + private void fireStateChanged() { + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.uiObserverListener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + protected UIButtonUI createButtonUI(final UIColorButton uiColorButton) { + return new UIButtonUI() { + + public void paint(Graphics g, JComponent c) { + UIButton b = (UIButton) c; + g.setColor(Color.black); + GraphHelper.draw(g, new RoundRectangle2D.Double(1, 1, b.getWidth() - 2, b.getHeight() - 2, 0, 0), 1); + + if (b.getModel().isEnabled()) { + g.setColor(uiColorButton.getColor()); + } else { + g.setColor(new Color(Utils.filterRGB(uiColorButton.getColor().getRGB(), 50))); + } + g.fillRect(2, 2, b.getWidth() - 3, b.getHeight() - 3); + } + }; + } + + protected static class BorderLineAndImageComboBox extends LineComboBox { + public static final int LINE_PICTURE = -1; + public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] { + Constants.LINE_NONE, + LINE_PICTURE, + Constants.LINE_THIN, //1px + Constants.LINE_MEDIUM, //2px + Constants.LINE_THICK, //3px + }; + + public BorderLineAndImageComboBox() { + super(BORDER_LINE_STYLE_ARRAY); + } + + @Override + protected String toStringFromStyle(int style) { + if (style == LINE_PICTURE) { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image"); + } + return super.toStringFromStyle(style); + } + + public boolean isSelectedBorderLine() { + return getSelectedIndex() > 1; + } + + public boolean isSelectedBorderImage() { + return getSelectedIndex() == 1; + } + + public void selectBorderImage() { + this.setSelectedIndex(1); + } + } + + private class NinePointImageTweakDialogPane extends BasicPane { + private final NinePointLinePreviewPane previewPane = new NinePointLinePreviewPane(); + + public NinePointImageTweakDialogPane() { + this.initComponents(); + } + + private void initComponents() { + setLayout(new BorderLayout()); + setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image_Config_Nine_Point_Fill_Preview"))); + + JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); + content.setBorder(BorderFactory.createEmptyBorder( + IntervalConstants.INTERVAL_W1, + IntervalConstants.INTERVAL_W1, + IntervalConstants.INTERVAL_W1, + IntervalConstants.INTERVAL_W1)); + content.add(previewPane); + previewPane.setPreferredSize(new Dimension(611, 457)); + + add(content, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Border_Image_Config_Nine_Point_Fill"); + } + } + + private class NinePointLinePreviewPane extends JPanel implements MouseMotionListener, MouseListener { + private final BufferedImage transparentImage = IOUtils.readImage("/com/fr/design/images/transparent_background.jpg"); + + public final Color PATCH_COLOR = new Color(0, 0, 0, 38); + public final Color DIVIDER_COLOR = new Color(250, 250, 250); + public final Color TEXT_COLOR = Color.WHITE; + public final int PADDING = 15; + + private int imgWidth; + private int imgHeight; + private int scaleImgWidth; + private int scaleImgHeight; + private int scaleImgX; + private int scaleImgY; + private double scale = 1.0; + + public NinePointLinePreviewPane() { + this.addMouseMotionListener(this); + this.addMouseListener(this); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + + Graphics2D g2d = (Graphics2D) g; + g2d.drawImage(transparentImage, 0, 0, getWidth(), getHeight(), null); + + Image image = imagePreviewPane.getImage(); + + imgWidth = image.getWidth(null); + imgHeight = image.getHeight(null); + int autoFixAreaWidth = getWidth() - 2 * PADDING; + int autoFixAreaHeight = getHeight() - 2 * PADDING; + int autoFixAreaX = PADDING; + int autoFixAreaY = PADDING; + + if (imgWidth / imgHeight > autoFixAreaWidth / autoFixAreaHeight) { + scaleImgWidth = autoFixAreaWidth; + scaleImgHeight = (int) (1.0F * scaleImgWidth * imgHeight / imgWidth); + scaleImgX = autoFixAreaX; + scaleImgY = (autoFixAreaHeight - scaleImgHeight) / 2 + autoFixAreaY; // 垂直居中 + scale = 1.0 * scaleImgWidth / imgWidth; + } else { + scaleImgHeight = autoFixAreaHeight; + scaleImgWidth = (int) (1.0F * scaleImgHeight * imgWidth / imgHeight); + scaleImgX = (autoFixAreaWidth - scaleImgWidth) / 2 + autoFixAreaX; // 水平居中 + scaleImgY = autoFixAreaY; + scale = 1.0 * scaleImgHeight / imgHeight; + } + + g2d.drawImage(image, scaleImgX, scaleImgY, scaleImgWidth, scaleImgHeight, null); + + int scaleLeft = (int) (ninePointLeft * scale); + int scaleTop = (int) (ninePointTop * scale); + int scaleRight = (int) (ninePointRight * scale); + int scaleBottom = (int) (ninePointBottom * scale); + + g2d.setColor(PATCH_COLOR); + // draw horizontal patch + GraphDrawHelper.fillRect(g2d, 0, scaleImgY + scaleTop, getWidth(), scaleImgHeight - scaleTop - scaleBottom); + // draw vertical patch + GraphDrawHelper.fillRect(g2d, scaleImgX + scaleLeft, 0,scaleImgWidth - scaleLeft - scaleRight, getHeight()); + + g2d.setColor(DIVIDER_COLOR); + // draw top divider + GraphDrawHelper.drawLine(g2d, 0, scaleImgY + scaleTop, getWidth(), scaleImgY + scaleTop); + // draw bottom divider + GraphDrawHelper.drawLine(g2d, 0, scaleImgY + scaleImgHeight - scaleBottom, getWidth(), scaleImgY + scaleImgHeight - scaleBottom); + // draw left divider + GraphDrawHelper.drawLine(g2d, scaleImgX + scaleLeft, 0, scaleImgX + scaleLeft, getHeight()); + // draw right divider + GraphDrawHelper.drawLine(g2d, scaleImgX + scaleImgWidth - scaleRight, 0, scaleImgX + scaleImgWidth - scaleRight, getHeight()); + + g2d.setColor(TEXT_COLOR); + // draw nine point info + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointTop), scaleImgX + (scaleImgWidth + scaleLeft - scaleRight) / 2.0, (scaleImgY + scaleTop) / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointBottom), scaleImgX + scaleLeft + (scaleImgWidth - scaleLeft - scaleRight) / 2.0, scaleImgY + scaleImgHeight - (scaleBottom - PADDING) / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointLeft), (scaleImgX + scaleLeft) / 2.0, scaleImgY + (scaleImgHeight + scaleTop - scaleBottom) / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointRight), scaleImgX + scaleImgWidth - (scaleRight - PADDING) / 2.0, scaleImgY + (scaleImgHeight + scaleTop - scaleBottom) / 2.0); + } + + @Override + public void mouseDragged(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + + int cursorType = getCursor().getType(); + + switch (cursorType) { + case Cursor.W_RESIZE_CURSOR: { + int nextLeft = (int) ((x - scaleImgX) / scale); + if (1 <= nextLeft && nextLeft < imgWidth - ninePointRight) { + ninePointLeft = nextLeft; + repaint(); + } + return; + } + case Cursor.E_RESIZE_CURSOR: { + int nextRight = (int) ((scaleImgX + scaleImgWidth - x) / scale); + if (1 <= nextRight && nextRight < imgWidth - ninePointLeft) { + ninePointRight = nextRight; + repaint(); + } + return; + } + case Cursor.N_RESIZE_CURSOR: { + int nextTop = (int) ((y - scaleImgY) / scale); + if (1 <= nextTop && nextTop < imgHeight - ninePointBottom) { + ninePointTop = nextTop; + repaint(); + } + return; + } + case Cursor.S_RESIZE_CURSOR: { + int nextBottom = (int) ((scaleImgY + scaleImgHeight - y) / scale); + if (1 <= nextBottom && nextBottom < imgHeight - ninePointTop) { + ninePointBottom = nextBottom; + repaint(); + } + } + } + } + + @Override + public void mouseMoved(MouseEvent e) { + boolean needRepaint; + + int x = e.getX(); + int y = e.getY(); + + double scaleLeft = ninePointLeft * scale; + double scaleTop = ninePointTop * scale; + double scaleRight = ninePointRight * scale; + double scaleBottom = ninePointBottom * scale; + + // determine cursor + int cursorType = Cursor.DEFAULT_CURSOR; + + boolean hoveringLeftDivider = Math.abs(x - (scaleImgX + scaleLeft)) < 2; + boolean hoveringRightDivider = Math.abs(x - (scaleImgX + scaleImgWidth - scaleRight)) < 2; + boolean hoveringTopDivider = Math.abs(y - (scaleImgY + scaleTop)) < 2; + boolean hoveringBottomDivider = Math.abs(y - (scaleImgY + scaleImgHeight - scaleBottom)) < 2; + + if (hoveringLeftDivider) { + cursorType = Cursor.W_RESIZE_CURSOR; + } else if (hoveringRightDivider) { + cursorType = Cursor.E_RESIZE_CURSOR; + } else if (hoveringTopDivider) { + cursorType = Cursor.N_RESIZE_CURSOR; + } else if (hoveringBottomDivider) { + cursorType = Cursor.S_RESIZE_CURSOR; + } + + needRepaint = getCursor().getType() != cursorType; + this.setCursor(Cursor.getPredefinedCursor(cursorType)); + + if (needRepaint) { + repaint(); + } + } + + @Override + public void mouseClicked(MouseEvent e) { + + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + + repaint(); + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java new file mode 100644 index 0000000000..5e6f7c06c5 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java @@ -0,0 +1,27 @@ +/* + * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. + */ +package com.fr.design.gui.xpane; + +import com.fr.form.ui.LayoutBorderStyle; + +import javax.swing.*; + +/** + * CardTagLayoutBorderPane Pane. + */ +public class CardTagLayoutStylePane extends LayoutStylePane { + + @Override + protected JPanel createTitleStylePane(){ + return null; + } + + @Override + public void updateTitle(LayoutBorderStyle style) { + + } + + @Override + protected void populateTitle() { } +} diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java new file mode 100644 index 0000000000..265de1aba7 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -0,0 +1,502 @@ +package com.fr.design.gui.xpane; + +import com.fr.base.GraphHelper; +import com.fr.base.Utils; +import com.fr.base.svg.IconUtils; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UIPercentDragPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.style.BackgroundSpecialPane; +import com.fr.design.gui.style.FRFontPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; +import com.fr.form.ui.LayoutBorderStyle; +import com.fr.form.ui.WidgetTitle; +import com.fr.general.Background; +import com.fr.general.FRFont; +import com.fr.general.IOUtils; +import com.fr.general.act.TitlePacker; +import com.fr.stable.Constants; + +import javax.swing.*; +import javax.swing.border.LineBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * @author Starryi + * @version 10.0.18 + * Created by Starryi on 2021/6/25 + * + * 可配置图片类型边框的样式设置面板 + */ +public class LayoutStylePane extends BasicBeanPane { + public static final String[] BORDER_STYLE = new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Common"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow") + }; + private static final Dimension BUTTON_SIZE = new Dimension(20, 20); + private static final int SETTING_LABEL_WIDTH = 60; + + protected LayoutBorderStyle style = new LayoutBorderStyle(); + + //渲染风格:有无阴影 + protected UIComboBox borderStyleCombo; + // 含图片类型边框的边框配置面板(图片类型边框 + 阴影时存在默认的阴影颜色) + protected BorderLineAndImagePane borderLineAndImagePane; + //边框圆角或圆角裁剪 + protected UISpinner cornerSpinner; + //主体背景 + protected BackgroundSpecialPane backgroundPane; + //主体背景透明度 + protected UIPercentDragPane backgroundOpacityPane; + + // 标题可见 + protected UICheckBox titleVisibleCheckbox; + //标题文字内容 + protected TinyFormulaPane titleTextPane; + //标题字体格式 + protected UIComboBox titleFontFamilyComboBox; + //标题字体大小 + protected UIComboBox titleFontSizeComboBox; + //标题字体颜色 + protected UIColorButton titleFontColorSelectPane; + //标题字体特殊效果:粗体、斜体、下划线 + private UIToggleButton titleFontBoldButton; + private UIToggleButton titleFontItalicButton; + private UIToggleButton titleFontUnderlineButton; + private LineComboBox titleFontUnderlineCombo; + // 标题图文混排 + protected TitleInsetImagePane titleInsetImagePane; + //对齐方式 + protected UIButtonGroup titleAlignPane; + //标题整体背景 + protected BackgroundSpecialPane titleBackgroundPane; + //标题背景透明度 + protected UIPercentDragPane titleBackgroundOpacityPane; + + public LayoutStylePane() { + this.initLayout(); + } + + protected void initLayout() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + boolean currentIsRootLayout = currentEditingTemplate != null && !currentEditingTemplate.isJWorkBook() && ((JForm)currentEditingTemplate).isSelectRootPane(); + + JPanel titlePane = createTitleStylePane(); + if (titlePane != null) { + container.add(titlePane, BorderLayout.NORTH); + if (currentIsRootLayout) { + titlePane.setVisible(false); + } + } + + //界面上表单主体只有背景和透明度可以设置 + JPanel mainStylePane = currentIsRootLayout ? createMainStylePane4RootLayout() : createMainStylePane4WidgetLayout(); + if (mainStylePane != null) { + container.add(mainStylePane, BorderLayout.CENTER); + } + + this.add(container, BorderLayout.CENTER); + } + + protected void initMainComponents() { + borderStyleCombo = new UIComboBox(BORDER_STYLE); + borderLineAndImagePane = new BorderLineAndImagePane(); + cornerSpinner = new UISpinner(0,1000,1,0); + backgroundPane = new BackgroundSpecialPane(); + backgroundOpacityPane = new UIPercentDragPane(); + } + + protected JPanel createMainStylePane4WidgetLayout() { + initMainComponents(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, + {this.borderLineAndImagePane, null}, + {this.createMainBackgroundAndOpacityPane(), null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(new BottomLineBorder()); + container.add(contentPane, BorderLayout.NORTH); + + return container; + } + + protected JPanel createMainStylePane4RootLayout() { + initMainComponents(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p, p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, + {this.createMainBackgroundAndOpacityPane(), null}, + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(new BottomLineBorder()); + container.add(contentPane, BorderLayout.NORTH); + + return container; + } + + protected JPanel createMainBackgroundAndOpacityPane() { + return createBackgroundAndOpacityPane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Background"), + this.backgroundPane, + this.backgroundOpacityPane); + } + + protected void initTitleComponents() { + titleVisibleCheckbox = new UICheckBox(); + + titleTextPane = new TinyFormulaPane(); + + titleFontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + titleFontFamilyComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family")); + + titleFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + titleFontSizeComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Size")); + + titleFontColorSelectPane = new UIColorButton(); + titleFontColorSelectPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Foreground")); + titleFontColorSelectPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Foreground")); + + titleFontBoldButton = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); + titleFontBoldButton.setPreferredSize(BUTTON_SIZE); + titleFontBoldButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Bold")); + titleFontBoldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Bold")); + + titleFontItalicButton = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + titleFontItalicButton.setPreferredSize(BUTTON_SIZE); + titleFontItalicButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Italic")); + titleFontItalicButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Italic")); + + titleFontUnderlineButton = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); + titleFontUnderlineButton.setPreferredSize(BUTTON_SIZE); + titleFontUnderlineButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); + titleFontUnderlineButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); + + titleFontUnderlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); + titleFontUnderlineCombo.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style")); + + titleInsetImagePane = new TitleInsetImagePane(); + + titleAlignPane = new UIButtonGroup( + new Icon[] { + IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), + IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), + IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png") + }, + new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}); + titleAlignPane.setAllToolTips( + new String[] { + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") + }); + + titleBackgroundPane = new BackgroundSpecialPane(); + + titleBackgroundOpacityPane = new UIPercentDragPane(); + } + + protected JPanel createTitleStylePane() { + initTitleComponents(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p,p,p,p,p,p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + final JPanel bottomPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), titleTextPane}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Format")), titleFontFamilyComboBox}, + {null, createTitleFontButtonPane()}, + {titleInsetImagePane, null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Text_Align")), titleAlignPane}, + {this.createTitleBackgroundAndOpacityPane(), null}, + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1); + bottomPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + bottomPane.setVisible(false); + + JPanel visibleComposedPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + titleVisibleCheckbox.setSelected(false); + visibleComposedPane.add(titleVisibleCheckbox, BorderLayout.WEST); + visibleComposedPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Visible")), BorderLayout.CENTER); + + JPanel topPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][] { + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title")), null}, + {visibleComposedPane, null} + }, new double[]{p, p}, new double[]{SETTING_LABEL_WIDTH, p}, IntervalConstants.INTERVAL_L1); + topPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(new BottomLineBorder()); + container.add(topPane, BorderLayout.NORTH); + container.add(bottomPane, BorderLayout.CENTER); + + titleVisibleCheckbox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + bottomPane.setVisible(titleVisibleCheckbox.isSelected()); + } + }); + + return container; + } + + protected JPanel createTitleFontButtonPane(){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] columnSize = {f, p, p, p, p}; + + JPanel buttonPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][] { + {titleFontSizeComboBox, titleFontColorSelectPane, titleFontItalicButton, titleFontBoldButton, titleFontUnderlineButton}, + }, rowSize, columnSize, IntervalConstants.INTERVAL_W0); + + JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + containerPane.add(buttonPane, BorderLayout.NORTH); + containerPane.add(titleFontUnderlineCombo, BorderLayout.CENTER); + + titleFontUnderlineCombo.setVisible(false); + titleFontUnderlineButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + titleFontUnderlineCombo.setVisible(titleFontUnderlineButton.isSelected()); + } + }); + + return containerPane; + } + + protected JPanel createTitleBackgroundAndOpacityPane() { + return createBackgroundAndOpacityPane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Background"), + titleBackgroundPane, + titleBackgroundOpacityPane); + } + + @Override + public LayoutBorderStyle updateBean() { + LayoutBorderStyle style = new LayoutBorderStyle(); + updateMain(style); + updateTitle(style); + return style; + } + + protected void updateMain(LayoutBorderStyle style) { + if (borderStyleCombo != null) { + style.setBorderStyle(borderStyleCombo.getSelectedIndex()); + } + if (cornerSpinner != null) { + style.setBorderRadius((int) cornerSpinner.getValue()); + } + if (borderLineAndImagePane != null) { + borderLineAndImagePane.updateBean(style); + } + if (backgroundPane != null) { + style.setBackground(backgroundPane.update()); + } + if (backgroundOpacityPane != null) { + style.setAlpha((float)backgroundOpacityPane.updateBean()); + } + } + + protected void updateTitle(LayoutBorderStyle style) { + style.setType(titleVisibleCheckbox != null && titleVisibleCheckbox.isSelected() ? LayoutBorderStyle.TITLE : LayoutBorderStyle.STANDARD); + TitlePacker title = style.getTitle() == null ? new WidgetTitle() : style.getTitle(); + title.setTextObject(titleTextPane.updateBean()); + FRFont frFont = title.getFrFont(); + frFont = frFont.applySize((Integer) titleFontSizeComboBox.getSelectedItem()); + frFont = frFont.applyName(titleFontFamilyComboBox.getSelectedItem().toString()); + frFont = frFont.applyForeground(titleFontColorSelectPane.getColor()); + frFont = updateTitleFontItalicBold(frFont); + int line = titleFontUnderlineButton.isSelected() ? this.titleFontUnderlineCombo.getSelectedLineStyle() : Constants.LINE_NONE; + frFont = frFont.applyUnderline(line); + title.setFrFont(frFont); + title.setPosition((Integer) titleAlignPane.getSelectedItem()); + titleInsetImagePane.updateBean(title); + title.setBackground(titleBackgroundPane.update()); + title.setBackgroundOpacity((float)titleBackgroundOpacityPane.updateBean()); + style.setTitle(title); + } + + private FRFont updateTitleFontItalicBold(FRFont frFont) { + int italic_bold = frFont.getStyle(); + boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC); + boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC); + if (titleFontItalicButton.isSelected() && !isItalic) { + italic_bold += Font.ITALIC; + } else if (!titleFontItalicButton.isSelected() && isItalic) { + italic_bold -= Font.ITALIC; + } + frFont = frFont.applyStyle(italic_bold); + if (titleFontBoldButton.isSelected() && !isBold) { + italic_bold += Font.BOLD; + } else if (!titleFontBoldButton.isSelected() && isBold) { + italic_bold -= Font.BOLD; + } + frFont = frFont.applyStyle(italic_bold); + return frFont; + } + + @Override + public void populateBean(LayoutBorderStyle style) { + if(this.style == null) { + this.style = new LayoutBorderStyle(); + } + this.style.setStyle(style); + + populateMain(); + populateTitle(); + } + + protected void populateMain() { + if (this.borderStyleCombo != null) { + this.borderStyleCombo.setSelectedIndex(style.getBorderStyle()); + } + if (this.borderLineAndImagePane != null) { + this.borderLineAndImagePane.populateBean(style); + } + if (this.backgroundPane != null) { + this.backgroundPane.populateBean(style.getBackground()); + if (this.backgroundOpacityPane != null) { + this.backgroundOpacityPane.populateBean(style.getAlpha()); + } + } + if (this.cornerSpinner != null) { + this.cornerSpinner.setValue(style.getBorderRadius()); + } + } + + protected void populateTitle() { + TitlePacker widgetTitle = style == null ? new WidgetTitle() : style.getTitle(); + widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle; + titleVisibleCheckbox.setSelected(style.getType() != LayoutBorderStyle.STANDARD); + + this.titleTextPane.populateBean(widgetTitle.getTextObject().toString()); + + FRFont frFont = widgetTitle.getFrFont(); + this.titleFontSizeComboBox.setSelectedItem(frFont.getSize()); + this.titleFontFamilyComboBox.setSelectedItem(frFont.getFamily()); + this.titleFontColorSelectPane.setColor(frFont.getForeground()); + this.titleFontColorSelectPane.repaint(); + titleFontBoldButton.setSelected(frFont.isBold()); + titleFontItalicButton.setSelected(frFont.isItalic()); + + int line = frFont.getUnderline(); + if (line == Constants.LINE_NONE) { + titleFontUnderlineButton.setSelected(false); + titleFontUnderlineCombo.setVisible(false); + } else { + titleFontUnderlineButton.setSelected(true); + titleFontUnderlineCombo.setVisible(true); + this.titleFontUnderlineCombo.setSelectedLineStyle(line); + } + + titleAlignPane.setSelectedItem(widgetTitle.getPosition()); + titleInsetImagePane.populateBean(widgetTitle); + titleBackgroundPane.populateBean(widgetTitle.getBackground()); + titleBackgroundOpacityPane.populateBean(widgetTitle.getBackgroundOpacity()); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style"); + } + + private static JPanel createBackgroundAndOpacityPane(String name, BackgroundSpecialPane backgroundPane, UIPercentDragPane opacityPane) { + JPanel container = new JPanel(); + container.setLayout(new BorderLayout(0, 6)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + // 确保BackgroundSpecialPane高度变化时,Label依然保持与其顶部对齐 + JPanel backgroundLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + backgroundLabelPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); + backgroundLabelPane.add(new UILabel(name), BorderLayout.NORTH); + + JPanel backgroundComposedPane = TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{ + {backgroundLabelPane, backgroundPane} + }, + new double[]{p}, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + + JPanel opacityComposedPane = TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{ + {new UILabel(""), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, + {new UILabel(""), opacityPane} + }, + new double[]{p, p}, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + + container.add(backgroundComposedPane, BorderLayout.NORTH, 0); + container.add(opacityComposedPane, BorderLayout.CENTER, 1); + + opacityComposedPane.setVisible(false); + + backgroundPane.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + Background background = backgroundPane.update(); + opacityComposedPane.setVisible(background != null); + } + }); + + return container; + } + + protected static class BottomLineBorder extends LineBorder { + + public BottomLineBorder() { + super(Color.lightGray, 1); + } + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + Graphics2D g2d = (Graphics2D) g; + Color oldColor = g2d.getColor(); + g2d.setColor(this.lineColor); + GraphHelper.drawLine(g, 0, height, width, height, 1); + g2d.setColor(oldColor); + } + } +} diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java new file mode 100644 index 0000000000..1a207a0b3e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -0,0 +1,258 @@ +package com.fr.design.gui.xpane; + +import com.fr.base.Style; +import com.fr.base.background.ImageBackground; +import com.fr.base.background.ImageFileBackground; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.frpane.ImgChooseWrapper; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.backgroundpane.ImagePreviewPane; +import com.fr.design.style.background.image.ImageFileChooser; +import com.fr.design.widget.ui.designer.component.UIBoundSpinner; +import com.fr.form.ui.WidgetTitle; +import com.fr.general.Background; +import com.fr.general.IOUtils; +import com.fr.general.ImageWithSuffix; +import com.fr.general.act.TitlePacker; +import com.fr.stable.Constants; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.basic.BasicButtonUI; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Starryi + * @version 10.0.18 + * Created by Starryi on 2021/7/3 + */ +public class TitleInsetImagePane extends JPanel implements UIObserver { + private final int SETTING_LABEL_WIDTH = 60; + private final int DELETE_BUTTON_SIZE = 24; + private final int IMAGE_PREVIEW_SIZE = 145; + private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); + private final int DEFAULT_INSET_LOCATION_INDEX = 0; + private final int DEFAULT_INSET_PADDING = 10; + + private UIObserverListener uiObserverListener; + + private UIButton imageChooseButton; + private UIButton imageDeleteButton; + private ImagePreviewPane imagePreviewPane; + private UIButtonGroup imageLocationPane; + private UISpinner imagePaddingPane; + + private ImageFileChooser imageFileChooser; + + public TitleInsetImagePane() { + this.initComponents(); + this.initLayout(); + } + + private JPanel createImageChooseComposedPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + return TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Inset")), this.imageChooseButton}, + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1); + } + + private JPanel createImageContentComposedPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + JPanel deletableImagePreviewPane = new JPanel(); + deletableImagePreviewPane.setLayout(null); + deletableImagePreviewPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); + deletableImagePreviewPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE)); + imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); + imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE); + deletableImagePreviewPane.add(imageDeleteButton, 0); + deletableImagePreviewPane.add(imagePreviewPane, 1); + + return TableLayoutHelper.createCommonTableLayoutPane( + new JComponent[][]{ + {null, deletableImagePreviewPane}, + {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Inset_Relative_Location"))}, + {null, this.imageLocationPane}, + {null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Inset_Padding"))}, + {null, this.imagePaddingPane} + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1); + } + + private void initImageFileChooserIfNotExist() { + if (imageFileChooser == null) { + imageFileChooser = new ImageFileChooser(); + imageFileChooser.setMultiSelectionEnabled(false); + } + } + + private void initComponents() { + imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png")); + + imageDeleteButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png")); + imageDeleteButton.setUI(new BasicButtonUI()); + imageDeleteButton.setOpaque(true); + imageDeleteButton.setBorderPainted(false); + imageDeleteButton.setBorder(null); + imageDeleteButton.setFocusPainted(false); + imageDeleteButton.setContentAreaFilled(true); + imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); + imageDeleteButton.setBackground(new Color(51, 51, 51)); + + imagePreviewPane = new ImagePreviewPane(); + imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE); + imagePreviewPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE)); + + imageLocationPane = new UIButtonGroup(new Icon[][]{ + { + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_inset_left_selected.png"), + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_inset_left_unselected.png") + }, + { + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_inset_both_selected.png"), + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_inset_both_unselected.png") + }, + { + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_inset_right_selected.png"), + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_inset_right_unselected.png") + }, + }); + imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); + imageLocationPane.setAllToolTips(new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Inset_Relative_Left_Tooltip"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Inset_Relative_Both_Tooltip"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Inset_Relative_Right_Tooltip"), + }); + + imagePaddingPane = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, WidgetTitle.DEFAULT_INSET_PADDING); + imagePaddingPane.setValue(DEFAULT_INSET_PADDING); + } + + private void initLayout() { + + + this.setLayout(new BorderLayout(0, IntervalConstants.INTERVAL_L1)); + + add(createImageChooseComposedPane(), BorderLayout.NORTH, 0); + add(createImageContentComposedPane(), BorderLayout.CENTER, 1); + + getComponent(1).setVisible(false); + + this.imageChooseButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + initImageFileChooserIfNotExist(); + + int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); + ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (!getComponent(1).isVisible()) { + imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); + imagePaddingPane.setValue(DEFAULT_INSET_PADDING); + getComponent(1).setVisible(true); + } + + fireStateChanged(); + } + }).dealWithImageFile(returnVal); + } + }); + this.imageDeleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + imagePreviewPane.setImageWithSuffix(null); + imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); + imagePaddingPane.setValue(DEFAULT_INSET_PADDING); + getComponent(1).setVisible(false); + + fireStateChanged(); + } + }); + } + + public void populateBean(TitlePacker packer) { + Background insetImage = packer.getInsetImage(); + if (insetImage instanceof ImageBackground) { + ImageWithSuffix image = ((ImageBackground) insetImage).getImageWithSuffix(); + if (image != null) { + this.imagePreviewPane.setImageWithSuffix(image); + + if (!packer.isInsetRelativeTextLeft()) { + this.imageLocationPane.setSelectedIndex(2); + } else if (!packer.isInsetRelativeTextRight()) { + this.imageLocationPane.setSelectedIndex(0); + } else { + this.imageLocationPane.setSelectedIndex(1); + } + + this.imagePaddingPane.setValue(packer.getInsetImagePadding()); + + getComponent(1).setVisible(true); + + return; + } + } + + this.imagePreviewPane.setImageWithSuffix(null); + this.imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); + this.imagePaddingPane.setValue(DEFAULT_INSET_PADDING); + + getComponent(1).setVisible(false); + } + + public void updateBean(TitlePacker packer) { + Image image = imagePreviewPane.getImageWithSuffix(); + if (image != null) { + packer.setInsetImage(new ImageFileBackground(image, Constants.IMAGE_DEFAULT)); + + int imageLocationIndex = this.imageLocationPane.getSelectedIndex(); + packer.setInsetRelativeTextLeft(imageLocationIndex == 0 || imageLocationIndex == 1); + packer.setInsetRelativeTextRight(imageLocationIndex == 2 || imageLocationIndex == 1); + + packer.setInsetImagePadding((int) this.imagePaddingPane.getValue()); + } else { + packer.setInsetImage(null); + packer.setInsetImagePadding(WidgetTitle.DEFAULT_INSET_PADDING); + packer.setInsetRelativeTextLeft(WidgetTitle.DEFAULT_INSET_LEFT); + packer.setInsetRelativeTextRight(WidgetTitle.DEFAULT_INSET_RIGHT); + } + } + + private void fireStateChanged() { + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.uiObserverListener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 609e45b5da..b1bd8d80de 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -67,10 +67,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Rele this.designer = designer; initComponents(); initDefinePane(); - widgetBoundPane = createWidgetBoundPane(xCreator); - if (widgetBoundPane != null) { - attriCardPane.add(widgetBoundPane, BorderLayout.CENTER); - } } public XLayoutContainer getParent(XCreator source) { @@ -162,6 +158,10 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Rele jPanel.add(uiExpandablePane, BorderLayout.NORTH); + widgetBoundPane = createWidgetBoundPane(xCreator); + if (widgetBoundPane != null) { + attriCardPane.add(widgetBoundPane, BorderLayout.NORTH); + } } private static void freshPropertyMode(XCreator xCreator) { @@ -187,7 +187,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane implements Rele JComponent jComponent = definePane.toSwingComponent(); - attriCardPane.add(jComponent, BorderLayout.NORTH); + attriCardPane.add(jComponent, BorderLayout.CENTER); currentEditorDefinePane = definePane; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java index dbe2735e3f..fe6634b1f7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/BorderStyleWidgetDefinePane.java @@ -5,6 +5,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.xpane.LayoutStylePane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; @@ -20,7 +21,7 @@ import java.awt.*; * Created by kerry on 2017/8/29. */ public class BorderStyleWidgetDefinePane extends AbstractDataModify { - private AccessibleWLayoutBorderStyleEditor borderStyleEditor; + private LayoutStylePane stylePane; public BorderStyleWidgetDefinePane(XCreator xCreator) { super(xCreator); @@ -29,13 +30,10 @@ public class BorderStyleWidgetDefinePane extends AbstractDataModify ADAPT_LABEL_MAX_WIDTH ? ADAPT_LABEL_MAX_WIDTH : p; - double[] columnSize = {adaptLabelColumnWidth, f}; - int[][] rowCount = {{1, 1}, {1, 1}}; - JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")), layoutComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - northPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); - - - - Component[][] components = new Component[][]{ - new Component[]{adaptLabel, adaptComboBoxPane}, - new Component[]{intervalLabel, componentIntervelPane} - }; - JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0)); - jPanel.add(northPane, BorderLayout.NORTH); - jPanel.add(centerPane, BorderLayout.CENTER); - return jPanel; + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")), layoutComboBox}, + {adaptLabel, adaptComboBoxPane}, + {intervalLabel, componentIntervelPane} + }, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + containerPane.add(contentPane, BorderLayout.CENTER); + + return containerPane; } @@ -154,7 +157,7 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane { - private AccessibleCardTagWLayoutBorderStyleEditor accessibleCardTagWLayoutBorderStyleEditor; + private CardTagLayoutStylePane stylePane; private UICheckBox setCarousel; private UISpinner carouselInterval; private JPanel IntervalPane; @@ -39,11 +41,8 @@ public class WCardMainLayoutDefinePane extends AbstractDataModify extends AbstractDataModify { - private AccessibleWLayoutBorderStyleEditor borderStyleEditor; + private LayoutStylePane stylePane; public WTitleLayoutDefinePane(XCreator xCreator) { super(xCreator); @@ -34,18 +27,8 @@ public abstract class WTitleLayoutDefinePane Date: Mon, 5 Jul 2021 17:13:40 +0800 Subject: [PATCH 045/100] =?UTF-8?q?REPORT-54438=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=20=E5=9C=A8=E5=88=87=E6=8D=A2=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=BC=96=E8=BE=91=E5=90=8E=20=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=9C=AA=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 2fc161fc0a..e0c6073238 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -24,6 +24,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; import com.fr.design.widget.DataModify; import com.fr.design.widget.FormWidgetDefinePaneFactoryBase; import com.fr.design.widget.Operator; @@ -164,7 +165,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } private static void freshPropertyMode(XCreator xCreator) { - if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (!(jTemplate instanceof JForm) && jTemplate.isUpMode()) { if (xCreator instanceof XWParameterLayout) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); } else { From 644338f3ecc22be697807d9b04fbb9ade4e502b4 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Mon, 5 Jul 2021 17:41:00 +0800 Subject: [PATCH 046/100] =?UTF-8?q?REPORT-52847=20=E3=80=9010.0.18?= =?UTF-8?q?=E3=80=91=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81fetchsize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/JDBCConnectionDef.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java index 1410decee6..6d15b23e9f 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java @@ -24,6 +24,10 @@ public class JDBCConnectionDef { return instance; } + private JDBCConnectionDef() { + + } + public String getDatabaseName() { return databaseName; } From d99bffbc5826f7e59337bd755485790512dfb8aa Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 5 Jul 2021 17:43:29 +0800 Subject: [PATCH 047/100] =?UTF-8?q?REPORT-53699=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E7=9B=91=E5=90=ACBeforeAllStop=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/app/DesignerAppUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java index a00e7dd6fc..437458c9ae 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java @@ -43,7 +43,7 @@ public class DesignerAppUtils { private static final int DEFAULT_MAX_CACHE_SIZE = 50; private static final int DEFAULT_CONCURRENCY_LEVEL = 8; private static final long DEFAULT_EXPIRE_HOURS = 1; - private static boolean enablePluginTipDialog = true; + private volatile static boolean enablePluginTipDialog = true; private static final Cache> ERROR_CACHE = CacheBuilder.newBuilder() .maximumSize(DEFAULT_MAX_CACHE_SIZE) @@ -52,7 +52,7 @@ public class DesignerAppUtils { .build(); public static void initPluginAllActiveListener() { - PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() { + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllStop, new PluginEventListener() { @Override public void on(PluginEvent event) { enablePluginTipDialog = false; From 0b968f8351c106dff0d5f9b5f1e70e98cbc45bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 6 Jul 2021 09:43:46 +0800 Subject: [PATCH 048/100] =?UTF-8?q?CHART-19720=20=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/other/VanChartInteractivePane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index d1ac6aa14c..4a0e7adc54 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -209,9 +209,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } private void createChangeEnablePane(VanChartRectanglePlot plot) { - String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll"); String scaleAxis = Toolkit.i18nText("Fine-Design_Chart_Scale_Axis"); - controlType = new UIButtonGroup<>(new String[]{scroll, scaleAxis}, ControlType.values()); + String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll"); + controlType = new UIButtonGroup<>(new String[]{scaleAxis, scroll}, ControlType.values()); JPanel scaleAxisPane = createScaleAxisPane(); JPanel scrollPane = createScrollPane(plot); @@ -225,8 +225,8 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } } }; - centerPane.add(scaleAxisPane, scroll); - centerPane.add(scrollPane, scaleAxis); + centerPane.add(scaleAxisPane, scaleAxis); + centerPane.add(scrollPane, scroll); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -291,9 +291,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (centerPane != null && controlType != null) { CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (controlType.getSelectedItem() == ControlType.ZOOM) { - cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll")); - } else { cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scale_Axis")); + } else { + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll")); } } } From 39c29ab26d386ca727efbb14eaab7466e275ee9e Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 6 Jul 2021 10:15:30 +0800 Subject: [PATCH 049/100] =?UTF-8?q?REPORT-54122=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E6=82=AC=E5=81=9C/=E9=80=89?= =?UTF-8?q?=E4=B8=AD/=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/images/control/show_edit.png | Bin 0 -> 304 bytes .../fr/design/images/control/show_setting.png | Bin 0 -> 281 bytes .../designer/creator/SelectedBorderIcon.java | 47 ++++++++++ .../fr/design/designer/creator/XCreator.java | 22 +++++ .../fr/design/mainframe/ComponentTree.java | 82 +++++++++++++++++- .../mainframe/EditingMouseListener.java | 40 ++++++++- .../mainframe/FormCreatorDropTarget.java | 11 +++ .../fr/design/mainframe/FormDesignerUI.java | 39 ++++++--- .../fr/design/mainframe/FormSelection.java | 3 + 9 files changed, 230 insertions(+), 14 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/show_edit.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/show_setting.png create mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java diff --git a/designer-base/src/main/resources/com/fr/design/images/control/show_edit.png b/designer-base/src/main/resources/com/fr/design/images/control/show_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..9378e76c5f5f969c782028ca87d3e8b5676c7273 GIT binary patch literal 304 zcmV-00nh%4P)%4P1gBOq>D1ND$YciMk3A+{75^A_OrqP!mxMT!4b1FsUHol@3OF zpnJL-E3K+i@7`A>{|v|dNp69D6;CbKtpFqSt*9+0QZB3lCD{V5ffseT6ClYV@C5XL zWA(H(Ajuq1NL&Z5fF1Rx3t$Kw0C$O>CN4m;VJ45t$L|(NuW=0000*q)O`A@-*y{VM!hF#{~NYIV7mh}B`s{f0F!7MOPbn#1imG$GqN*5G_QaL zFbD2|hX8&88(;wZ0NsovPmtI@E{vp~R3>cM!h1~lk7q7vSg;U*JprSf?4;&7fHR<< zv-1kPrC?7AY;S?v(%6=yuc+Suhf;kf>F#O-Y3J1~WYTO`3o(4wTVw4*3Ki8)xqLa5 fKGTI~T!0+`QonK$Q5cW*00000NkvXXu0mjfNWyQ% literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java b/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java new file mode 100644 index 0000000000..fe2d839b96 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java @@ -0,0 +1,47 @@ +package com.fr.design.designer.creator; + +import com.fr.design.form.util.XCreatorConstants; +import com.fr.general.IOUtils; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Rectangle; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/06/30 + */ +public class SelectedBorderIcon { + + private static final Image EDIT_ICON = IOUtils.readImage("/com/fr/design/images/control/show_edit.png"); + private static final Image SETTING_ICON = IOUtils.readImage("/com/fr/design/images/control/show_setting.png"); + private static final float ALPHA = 0.7F; + private static final int TIP_WIDTH = 20; + private static final int TIP_HEIGHT = 40; + private static final int ARC_VALUE = 4; + // 组件到整个提示之间的空隙 + private static final int CREATOR_TO_TIP_GAP = 5; + // icon在整个提示背景下缩进 + private static final int TIP_ICON_GAP = 2; + + /** + * 在bounds范围的右上角绘制特定图标 + * + * @param g + * @param bounds + */ + public void paint(Graphics g, Rectangle bounds) { + Graphics2D g2d = (Graphics2D) g; + AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ALPHA); + g2d.setColor(XCreatorConstants.EDIT_COLOR); + g2d.setComposite(alphaComposite); + g2d.fillRoundRect(bounds.x + bounds.width + CREATOR_TO_TIP_GAP, bounds.y, TIP_WIDTH, TIP_HEIGHT, ARC_VALUE, ARC_VALUE); + g2d.drawImage(EDIT_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_ICON_GAP, EDIT_ICON.getWidth(null), EDIT_ICON.getHeight(null), null); + g2d.drawImage(SETTING_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + CREATOR_TO_TIP_GAP + EDIT_ICON.getHeight(null), SETTING_ICON.getWidth(null), SETTING_ICON.getHeight(null), null); + g2d.setColor(Color.WHITE); + g2d.drawLine(bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_WIDTH, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP + EDIT_ICON.getWidth(null), bounds.y + TIP_WIDTH); + } +} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 265fa3618c..7220eafe8b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -68,6 +68,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo private Rectangle backupBound; private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性 private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 + // 当前组件是否处在选中状态 + private boolean selected; + private SelectedBorderIcon selectedBorderIcon = new SelectedBorderIcon(); private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 public XCreator(Widget ob, Dimension initSize) { @@ -760,6 +763,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo GraphHelper.draw(g, bounds, Constants.LINE_MEDIUM); } + /** + * 绘制选中时右上边框图标 + * + * @param g + * @param bounds + */ + public void paintSelectedBorderIcon(Graphics g, Rectangle bounds) { + if (selected) { + selectedBorderIcon.paint(g, bounds); + } + } + /** * 创建右击弹出菜单 * @@ -797,5 +812,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } + public boolean isSelected() { + return selected; + } + + public void setSelected(boolean selected) { + this.selected = selected; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index c9ae03272f..134252487c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -2,15 +2,20 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.itree.UITreeUI; +import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import java.awt.Rectangle; +import java.awt.event.MouseListener; +import java.util.Stack; import javax.swing.BorderFactory; import javax.swing.DropMode; import javax.swing.JPanel; @@ -370,6 +375,81 @@ public class ComponentTree extends JTree { public void mouseExited(MouseEvent e) { hidePreviewPane(); } + + @Override + public void mouseClicked(MouseEvent e) { + // 鼠标左键 双击 + if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) { + Point p = e.getPoint(); + // 解析组件树路径 获取选中的组件 + int selRow = tree.getRowForLocation(p.x, p.y); + TreePath path = tree.getPathForRow(selRow); + Rectangle bounds = tree.getPathBounds(path); + if (bounds != null) { + Point point = bounds.getLocation(); + SwingUtilities.convertPointToScreen(point, tree); + XCreator comp = (XCreator) path.getLastPathComponent(); + startEditing(comp, e); + } + } + } + + /** + * 组件进入编辑状态 + * + * @param comp + * @param e + */ + private void startEditing(XCreator comp, MouseEvent e) { + designer.getSelectionModel().selectACreator(comp); + Rectangle rectangle = getRelativeBounds(comp); + int x = rectangle.x + rectangle.width / 2; + int y = rectangle.y + rectangle.height / 2; + XCreator creator = comp.getEditingChildCreator(); + MouseListener[] listeners = designer.getMouseListeners(); + if (ArrayUtils.isNotEmpty(listeners) && listeners[0] instanceof EditingMouseListener) { + responseClickAll(creator, (EditingMouseListener) listeners[0], new MouseEvent(creator, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), x, y, e.getClickCount(), false)); + } + } + + /** + * 自父容器到子组件 每一层的都响应click事件 + * + * + * @param creator + * @param editingMouseListener + * @param mouseEvent + */ + public void responseClickAll(XCreator creator, EditingMouseListener editingMouseListener, MouseEvent mouseEvent) { + Stack stack = new Stack<>(); + stack.push(creator); + while (creator.getParent() instanceof XCreator) { + creator = (XCreator) creator.getParent(); + stack.push(creator); + } + while (!stack.isEmpty()) { + stack.pop().respondClick(editingMouseListener, mouseEvent); + } + } + + + /** + * 获取组件范围坐标 + * + * @param creator + * @return + */ + private Rectangle getRelativeBounds(XCreator creator) { + Rectangle bounds = creator.getBounds(); + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); + if (parent == null) { + return bounds; + } + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + bounds.x += rec.x; + bounds.y += rec.y; + return bounds; + } } private class PopupPreviewPane extends JPopupMenu { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index a8ad6dd585..00ba360bba 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -21,6 +21,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIPopupMenu; @@ -29,6 +30,7 @@ import com.fr.design.icon.IconPathConstants; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.general.ComparatorUtils; import com.fr.stable.Constants; import javax.swing.BorderFactory; @@ -353,6 +355,15 @@ public class EditingMouseListener extends MouseInputAdapter { } + private void processCoverPane(XCreator component) { + // selected状态 不展示封面 + XCreator xCreator = selectionModel.getSelection().getSelectedCreator(); + boolean accept = xCreator == null || !ComparatorUtils.equals(xCreator.toData().getWidgetName(), component.toData().getWidgetName()) ||!xCreator.isSelected(); + if (accept) { + component.displayCoverPane(true); + } + } + private boolean isShareConfigButton(MouseEvent e, XCreator component, Insets insets) { if (component.isShared()) { int minX = getParentPositionX(component, component.getX()) + component.getWidth() - insets.right - CoverReportPane.SHARE_CONF_BTN_W - designer.getHorizontalScaleValue(); @@ -387,7 +398,7 @@ public class EditingMouseListener extends MouseInputAdapter { private void elementCaseMouseMoved(MouseEvent e, XCreator component) { xElementCase = (XElementCase) component; - component.displayCoverPane(true); + processCoverPane(component); processCoverMouseMove(component, e); } @@ -428,7 +439,7 @@ public class EditingMouseListener extends MouseInputAdapter { private void processChartEditorMouseMove(XCreator component, MouseEvent e) { if (component instanceof XChartEditor) { xChartEditor = (XChartEditor) component; - component.displayCoverPane(true); + processCoverPane(component); processCoverMouseMove(component, e); } @@ -608,10 +619,23 @@ public class EditingMouseListener extends MouseInputAdapter { return; } + XCreator oldCreator = creator; creator = processTopLayoutMouseClick(creator); if (creator != null) { - creator.respondClick(this, e); + if (e.getClickCount() == 1 && designer.getCursor().getType() != Cursor.HAND_CURSOR) { + setCoverPaneNotDisplay(creator, e, false); + selectionModel.selectACreatorAtMouseEvent(e); + refreshTopXCreator(); + XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators(); + for (XCreator xCreator : xCreators) { + xCreator.setSelected(true); + } + } else if (responseTabLayout(oldCreator, e)) { + // do nothing + } else { + creator.respondClick(this, e); + } if (e.getButton() == MouseEvent.BUTTON3) { UIPopupMenu cellPopupMenu = creator.createPopupMenu(designer); if (cellPopupMenu != UIPopupMenu.EMPTY) { @@ -624,6 +648,16 @@ public class EditingMouseListener extends MouseInputAdapter { LayoutUtils.layoutRootContainer(designer.getRootComponent()); } + private boolean responseTabLayout(XCreator creator, MouseEvent e) { + if (creator.acceptType(XWCardMainBorderLayout.class) ) { + creator.respondClick(this, e); + return true; + } else if (creator.getParent() instanceof XCreator) { + return responseTabLayout((XCreator) creator.getParent(), e); + } + return false; + } + /** * 离开 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 222165a53c..30b941818d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -49,6 +49,7 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; +import javax.swing.SwingUtilities; /** * 添加模式下鼠标事件处理器。 @@ -302,6 +303,16 @@ public class FormCreatorDropTarget extends DropTarget { public synchronized void drop(DropTargetDropEvent dtde) { Point loc = dtde.getLocation(); this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); + // 放到事件末尾执行 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + // 拖拽释放后标记未选中 + for (XCreator xCreator : designer.getSelectionModel().getSelection().getSelectedCreators()) { + xCreator.setSelected(true); + } + } + }); //针对在表单中拖入一个控件直接ctrl+s无反应 designer.requestFocus(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 7cd9e21083..8df27c19fe 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -307,7 +307,10 @@ public class FormDesignerUI extends ComponentUI { bounds.x -= designer.getHorizontalScaleValue(); bounds.y -= designer.getVerticalScaleValue(); - drawResizingThumbs(g, selectionModel.getSelection().getDirections(), bounds.x, bounds.y, bounds.width, bounds.height); + // 绘制调整框线 + if (designer.getStateModel().getDirection() != null) { + drawResizingThumbs(g, selectionModel.getSelection().getDirections(), bounds.x, bounds.y, bounds.width, bounds.height, designer.getStateModel().getDirection().getActual()); + } //选中时边框颜色 g.setColor(XCreatorConstants.FORM_BORDER_COLOR); @@ -321,6 +324,10 @@ public class FormDesignerUI extends ComponentUI { resetCreatorBounds(creatorBounds); } creator.paintBorder(g, creatorBounds); + // 拖拽时不绘制 + if (!designer.getStateModel().isDragging()) { + creator.paintSelectedBorderIcon(g, creatorBounds); + } } } @@ -357,48 +364,60 @@ public class FormDesignerUI extends ComponentUI { /** * 画出八个拖拽框 */ - private void drawResizingThumbs(Graphics g, int[] directions, int x, int y, int w, int h) { + private void drawResizingThumbs(Graphics g, int[] directions, int x, int y, int w, int h, int direction) { int bx = x - XCreatorConstants.RESIZE_BOX_SIZ; int by = y - XCreatorConstants.RESIZE_BOX_SIZ; - if (ArrayUtils.contains(directions, Direction.LEFT_TOP)) { + if (showBox(Direction.LEFT_TOP, direction, directions)) { drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.TOP)) { + if (showBox(Direction.TOP, direction, directions)) { bx = x + ((w - XCreatorConstants.RESIZE_BOX_SIZ) / 2); drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.RIGHT_TOP)) { + if (showBox(Direction.RIGHT_TOP, direction, directions)) { bx = x + w; drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.LEFT)) { + if (showBox(Direction.LEFT, direction, directions)) { bx = x - XCreatorConstants.RESIZE_BOX_SIZ; by = y + ((h - XCreatorConstants.RESIZE_BOX_SIZ) / 2); drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.LEFT_BOTTOM)) { + if (showBox(Direction.LEFT_BOTTOM, direction, directions)) { bx = x - XCreatorConstants.RESIZE_BOX_SIZ; by = y + h; drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.BOTTOM)) { + if (showBox(Direction.BOTTOM, direction, directions)) { bx = x + ((w - XCreatorConstants.RESIZE_BOX_SIZ) / 2); by = y + h; drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.RIGHT_BOTTOM)) { + if (showBox(Direction.RIGHT_BOTTOM, direction, directions)) { bx = x + w; by = y + h; drawBox(g, bx, by); } - if (ArrayUtils.contains(directions, Direction.RIGHT)) { + if (showBox(Direction.RIGHT, direction, directions)) { bx = x + w; by = y + ((h - XCreatorConstants.RESIZE_BOX_SIZ) / 2); drawBox(g, bx, by); } } + /** + * 是否展示某个方位的调整框 + * + * @param currentDirection + * @param actualDirection + * @param directions + * @return + */ + private boolean showBox(int currentDirection, int actualDirection, int[] directions) { + return ArrayUtils.contains(directions, currentDirection) && (currentDirection == actualDirection || !designer.getStateModel().isDragging()); + } + /** * 画每一个小拖拽框 */ diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java index 956e1cb66a..3bf4b49ac3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java @@ -40,6 +40,9 @@ public class FormSelection { * 重置选中的组件 */ public void reset() { + for (XCreator xCreator : selection) { + xCreator.setSelected(false); + } selection.clear(); } From 4563e2e7817e2649f279a2b8685b14022b0da45d Mon Sep 17 00:00:00 2001 From: Lanlan Date: Tue, 6 Jul 2021 10:32:43 +0800 Subject: [PATCH 050/100] =?UTF-8?q?REPORT-54817=20=E5=86=85=E7=BD=91?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=B8=8B=E8=AF=A5=E8=BF=AD=E4=BB=A3=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=BA=94=E5=BD=93=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/login/AbstractDesignerSSO.java | 4 ++++ .../login/guide/DesignerGuideHelper.java | 6 +++++- .../login/message/DesignerMessageHelper.java | 3 +++ .../login/utils/DesignerLoginUtils.java | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java b/designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java index 6fc3c817b4..2662198bbc 100644 --- a/designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java +++ b/designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java @@ -20,6 +20,10 @@ public abstract class AbstractDesignerSSO extends UpdateAction { @Override public void actionPerformed(ActionEvent event) { String url = getJumpUrl(); + if (!DesignerLoginUtils.isOnline()) { + BrowseUtils.browser(url); + return; + } DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); int uid = manager.getDesignerLoginUid(); if (uid > 0) { diff --git a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java index 8adebba4f1..92e4171460 100644 --- a/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java @@ -4,9 +4,13 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.UIDialog; import com.fr.design.event.DesignerOpenedListener; +import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.update.push.DesignerPushUpdateManager; +import com.fr.general.CloudCenter; +import com.fr.general.CloudCenterConfig; +import com.fr.general.http.HttpToolbox; import com.fr.stable.StringUtils; import javax.swing.WindowConstants; @@ -35,7 +39,7 @@ public class DesignerGuideHelper { public static void prepareShowGuideDialog() { // 如果存在更新升级的弹窗,则不显示引导页面 - if (!SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) { + if (!DesignerLoginUtils.isOnline() || !SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) { return; } if (isActivatedForOneWeek()) { diff --git a/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java b/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java index c053fc0e50..f3768629b4 100644 --- a/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java @@ -51,6 +51,9 @@ public class DesignerMessageHelper { } public void prepareShowMessage() { + if (!DesignerLoginUtils.isOnline()) { + return; + } DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { @Override public void designerOpened() { diff --git a/designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java b/designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java index 26e095df6a..a39a0be4bf 100644 --- a/designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java +++ b/designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java @@ -3,10 +3,13 @@ package com.fr.design.login.utils; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.toast.DesignerToastMsgUtil; import com.fr.general.CloudCenter; +import com.fr.general.CloudCenterConfig; import com.fr.general.GeneralContext; +import com.fr.general.http.HttpToolbox; import com.fr.general.log.MessageFormatter; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; import com.fr.third.org.bouncycastle.util.encoders.Hex; import java.awt.Window; import java.security.SecureRandom; @@ -49,6 +52,9 @@ public class DesignerLoginUtils { } public static String generateDesignerSSOUrl(String referrer) { + if (!DesignerLoginUtils.isOnline()) { + return referrer; + } String ssoTemplate = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); try { String code = generateLoginCode(); @@ -60,6 +66,19 @@ public class DesignerLoginUtils { return referrer; } + public static boolean isOnline() { + if (CloudCenterConfig.getInstance().isOnline()) { + String ping = CloudCenter.getInstance().acquireConf("ping", StringUtils.EMPTY); + if (StringUtils.isNotEmpty(ping)) { + try { + return StringUtils.isEmpty(HttpToolbox.get(ping)); + } catch (Exception ignore) { + } + } + } + return false; + } + private static String generateLoginCode() throws Exception { DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); JSONObject jo = JSONObject.create(); From d4fc5e23cfb342e1e04d08dddc119bd91034ddbb Mon Sep 17 00:00:00 2001 From: pengda Date: Tue, 6 Jul 2021 11:11:48 +0800 Subject: [PATCH 051/100] =?UTF-8?q?REPORT-54844=20jar=E5=8C=85=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=97=B6=E5=90=8C=E6=AD=A5=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E6=B2=A1=E7=81=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/CheckServiceDialog.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java index 185268e79c..fb1adae6fe 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -309,6 +309,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { @Override public void mouseClicked(MouseEvent e) { ignoreButton.setEnabled(false); + syncButton.setEnabled(false); String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; if (!jarConsistency) { int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"), @@ -350,6 +351,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener { @Override protected JSONArray doInBackground() { + progressBar.setVisible(true); progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); progressBar.setValue(0); return VersionCheckUtils.syncPlugins(differentPlugins); From 5cfb22420c95c3d1ef3e631330b7f72e15d21a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 6 Jul 2021 15:13:11 +0800 Subject: [PATCH 052/100] =?UTF-8?q?CHART-19708=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=9B=BE=E8=A1=A8=E6=A0=87=E9=A2=98=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/gui/ChartWidgetOption.java | 9 +++- .../design/mainframe/chart/ChartEditPane.java | 12 +++++ .../chart/gui/ChartTypeButtonPane.java | 13 +++++ .../mainframe/chart/gui/ChartTypePane.java | 9 +++- .../chart/bubble/VanChartBubbleStylePane.java | 14 ++--- .../custom/style/VanChartCustomStylePane.java | 5 +- .../designer/style/VanChartStylePane.java | 26 +++++++--- .../designer/style/VanChartTitlePane.java | 25 +++++++-- .../VanChartAreaBackgroundPane.java | 52 +++++++++++++------ .../style/background/VanChartAreaPane.java | 15 ++++-- 10 files changed, 136 insertions(+), 44 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index 42eabf93e1..7e64f3d209 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -1,10 +1,12 @@ package com.fr.design.chart.gui; import com.fr.base.chart.BaseChartGetter; +import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.Icon; @@ -37,7 +39,12 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); - widget.resetChangeChartCollection(BaseChartGetter.createChartCollection(this.chartID)); + ChartCollection chartCollection = (ChartCollection) BaseChartGetter.createChartCollection(this.chartID); + VanChart vanChart = chartCollection.getSelectedChartProvider(VanChart.class); + if (vanChart !=null) { + vanChart.resetAttrInForm(); + } + widget.resetChangeChartCollection(chartCollection); return widget; } catch (InstantiationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 3dc90d3a34..6cd8ae54a2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -20,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.ChartOtherPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.form.main.Form; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.vanchart.VanChart; @@ -168,6 +169,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener); for (int i = 0; i < otherPaneList.length; i++) { otherPaneList[i].addAttributeChangeListener(listener); + otherPaneList[i].registerChartEditPane(this); paneList.add(otherPaneList[i]); } this.isDefaultPane = false; @@ -366,4 +368,14 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare } }); } + + public boolean isInForm() { + if (container != null && container.getEPane() != null) { + Object target = container.getEPane().getTarget(); + if (target instanceof Form) { + return true; + } + } + return false; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 2ddfe46d42..778f779a07 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -67,6 +67,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen registerSupportChangeConfigChartClass(VanChart.class); } + private boolean inForm; + private UIButton addButton; private UIButton configButton; private UIButton copyButton; @@ -160,10 +162,17 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen addButton.addActionListener((e) -> { String name = getNewChartName(); ChartProvider chart = getChangeStateNewChart(); + checkInForm(chart); addNewChart(chart, name, editingCollection.getChartCount()); }); } + private void checkInForm(ChartProvider chart) { + if (inForm) { + chart.resetAttrInForm(); + } + } + private void initConfigButton() { configButton.setPreferredSize(new Dimension(20, 20)); configButton.addActionListener((e) -> showConfigDialog()); @@ -680,4 +689,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen currentEditingEditor.requestFocus(); } } + + public void refreshChartInForm(boolean inForm) { + this.inForm = inForm; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 1fa61298a5..2318fc05f5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -47,6 +47,7 @@ public class ChartTypePane extends AbstractChartAttrPane { private ChartEditPane editPane; private ChartCollection editingCollection; private ActionListener autoButtonListener; + private boolean inForm; @Override protected JPanel createContentPane() { @@ -54,6 +55,7 @@ public class ChartTypePane extends AbstractChartAttrPane { JPanel content = new JPanel(new BorderLayout()); buttonPane = new ChartTypeButtonPane(this); + buttonPane.refreshChartInForm(inForm); content.add(buttonPane, BorderLayout.NORTH); if (editingCollection != null) { @@ -180,8 +182,10 @@ public class ChartTypePane extends AbstractChartAttrPane { } //这一步会替换plot ((AbstractChartTypePane) getSelectedPane()).updateBean(chart); - - reLayoutEditPane(chart,lastPlotID); + if (inForm) { + chart.resetAttrInForm(); + } + reLayoutEditPane(chart, lastPlotID); } protected UIComboBox createComboBox() { @@ -405,5 +409,6 @@ public class ChartTypePane extends AbstractChartAttrPane { */ public void registerChartEditPane(ChartEditPane currentEditPane) { this.editPane = currentEditPane; + this.inForm = editPane.isInForm(); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleStylePane.java index de4e88070f..cd62fff560 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleStylePane.java @@ -21,9 +21,9 @@ public class VanChartBubbleStylePane extends VanChartScatterStylePane { super(listener); } - protected void addVanChartTooltipPane(List paneList){ + protected void addVanChartTooltipPane(List paneList) { Plot plot = getChart().getPlot(); - if(((VanChartBubblePlot) plot).isForceBubble()){ + if (((VanChartBubblePlot) plot).isForceBubble()) { paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this)); } else { super.addVanChartTooltipPane(paneList); @@ -31,11 +31,11 @@ public class VanChartBubbleStylePane extends VanChartScatterStylePane { } @Override - protected void addVanChartAreaPane(List paneList) { - if (((VanChartBubblePlot)getChart().getPlot()).isForceBubble()){ - paneList.add(new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); - }else { - paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); + protected VanChartAreaPane createVanChartAreaPane() { + if (((VanChartBubblePlot) getChart().getPlot()).isForceBubble()) { + return new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this); + } else { + return new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java index a01cbf1cb5..da4fa2534c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java @@ -11,6 +11,7 @@ import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.background.VanChartAreaPane; import java.util.List; @@ -61,8 +62,8 @@ public class VanChartCustomStylePane extends VanChartStylePane { @Override - protected void addVanChartAreaPane(List paneList) { - paneList.add(new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this)); + protected VanChartAreaPane createVanChartAreaPane() { + return new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java index 53619765c7..7ca77a9fc2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style; import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; @@ -19,14 +20,20 @@ public class VanChartStylePane extends ChartStylePane { private static final long serialVersionUID = 186776958263021761L; + private ChartEditPane chartEditPane; + public VanChartStylePane(AttributeChangeListener listener) { super(listener); } - protected java.util.List getPaneList() { - java.util.List paneList = new ArrayList(); + protected List getPaneList() { + List paneList = new ArrayList(); Plot plot = getChart().getPlot(); - paneList.add(createVanChartTitlePane()); + + boolean inForm = chartEditPane != null ? chartEditPane.isInForm() : false; + VanChartTitlePane vanChartTitlePane = createVanChartTitlePane(); + vanChartTitlePane.refreshTooltipLabel(inForm); + paneList.add(vanChartTitlePane); if (plot.isSupportLegend()) { paneList.add(new VanChartLegendPane(VanChartStylePane.this)); } @@ -47,7 +54,9 @@ public class VanChartStylePane extends ChartStylePane { } } - addVanChartAreaPane(paneList); + VanChartAreaPane vanChartAreaPane = createVanChartAreaPane(); + vanChartAreaPane.refreshTooltipLabel(inForm); + paneList.add(vanChartAreaPane); addVanChartTooltipPane(paneList); @@ -61,8 +70,8 @@ public class VanChartStylePane extends ChartStylePane { protected void addOtherAxisPane(java.util.List paneList, Plot plot) { } - protected void addVanChartAreaPane(List paneList) { - paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartStylePane.this)); + protected VanChartAreaPane createVanChartAreaPane() { + return new VanChartAreaPane(getChart().getPlot(), VanChartStylePane.this); } protected void createVanChartAxisPane(List paneList, VanChartAxisPlot plot) { @@ -80,4 +89,9 @@ public class VanChartStylePane extends ChartStylePane { public void refreshTableFieldNames() { VanChartRichEditorPane.refreshCommonChartFieldNames(getChart()); } + + public void registerChartEditPane(ChartEditPane currentEditPane) { + this.chartEditPane = currentEditPane; + } + } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 59652a4afa..10a313af7e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; @@ -36,6 +37,7 @@ import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Point; import java.awt.event.ActionEvent; @@ -69,6 +71,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; + private UILabel tooltipLabel; protected VanChartStylePane parent; @@ -88,21 +91,30 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } private void initComponents() { - isTitleVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); - titlePane = createTitlePane(); + isTitleVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); + tooltipLabel = new UILabel("" + Toolkit.i18nText("Fine-Design_Chart_Title_Tooltip") + ""); + tooltipLabel.setForeground(Color.gray); + tooltipLabel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); + tooltipLabel.setVisible(false); + + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + panel.add(isTitleVisible, BorderLayout.NORTH); + panel.add(tooltipLabel, BorderLayout.CENTER); + titlePane = createTitlePane(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{isTitleVisible}, + new Component[]{panel}, new Component[]{titlePane} }; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel1 = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.add(panel, BorderLayout.CENTER); + this.add(panel1, BorderLayout.CENTER); isTitleVisible.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -370,4 +382,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.TITLE, chart.getBuryingPointTitleConfig()); } + public void refreshTooltipLabel(boolean inForm) { + tooltipLabel.setVisible(inForm); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java index 6cef622ebe..19f5d40510 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.designer.style.background; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; @@ -12,8 +14,10 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; //图表区|绘图区 边框和背景 @@ -25,12 +29,13 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane" + Toolkit.i18nText("Fine-Design_Chart_Background_Tooltip") + ""); + tooltipLabel.setForeground(Color.gray); + tooltipLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10)); + contentPane.add(tooltipLabel, BorderLayout.NORTH); + tooltipLabel.setVisible(false); + } return contentPane; } @@ -68,11 +81,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane implements AutoSele JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); if (nameArray.length > 1) { pane.add(tabPane); - tabPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); + tabPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); this.add(pane, BorderLayout.NORTH); } } - centerPane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); + centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.add(centerPane, BorderLayout.CENTER); } /** * 界面 使用标题 - * @return 标题 + * + * @return 标题 */ public String title4PopupWindow() { return PaneTitleConstants.CHART_STYLE_AREA_TITLE; @@ -66,7 +67,7 @@ public class VanChartAreaPane extends ThirdTabPane implements AutoSele paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane)); - if(plot.isSupportPlotBackground()) { + if (plot.isSupportPlotBackground()) { paneList.add(new NamePane(plotPane.title4PopupWindow(), plotPane)); } return paneList; @@ -111,4 +112,10 @@ public class VanChartAreaPane extends ThirdTabPane implements AutoSele } } } + + public void refreshTooltipLabel(boolean inForm) { + if (areaPane != null) { + areaPane.refreshTooltipLabel(inForm); + } + } } \ No newline at end of file From 6f740ef27716336db1cd0077814b9b0c721f3f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 6 Jul 2021 16:17:56 +0800 Subject: [PATCH 053/100] =?UTF-8?q?REPORT-54604=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=94=BE=E7=BD=AE=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E7=9A=84=E9=A2=84=E5=AE=9A=E4=B9=89=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=90=8E=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=8E=A7=E4=BB=B6=E5=9C=A8=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E4=B8=A2=E5=A4=B1=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/creator/XNameWidget.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java index 0f78c5739d..2cc20e111a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java @@ -91,7 +91,6 @@ public class XNameWidget extends XWidgetCreator { if (editor != null) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); add(editor, BorderLayout.CENTER); - this.setVisible(toData().isVisible()); } } From d7d67520d8efd90403c48ddd4223c1c13821d099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 6 Jul 2021 09:43:46 +0800 Subject: [PATCH 054/100] =?UTF-8?q?CHART-19720=20=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/other/VanChartInteractivePane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index d1ac6aa14c..4a0e7adc54 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -209,9 +209,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } private void createChangeEnablePane(VanChartRectanglePlot plot) { - String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll"); String scaleAxis = Toolkit.i18nText("Fine-Design_Chart_Scale_Axis"); - controlType = new UIButtonGroup<>(new String[]{scroll, scaleAxis}, ControlType.values()); + String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll"); + controlType = new UIButtonGroup<>(new String[]{scaleAxis, scroll}, ControlType.values()); JPanel scaleAxisPane = createScaleAxisPane(); JPanel scrollPane = createScrollPane(plot); @@ -225,8 +225,8 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } } }; - centerPane.add(scaleAxisPane, scroll); - centerPane.add(scrollPane, scaleAxis); + centerPane.add(scaleAxisPane, scaleAxis); + centerPane.add(scrollPane, scroll); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -291,9 +291,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (centerPane != null && controlType != null) { CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (controlType.getSelectedItem() == ControlType.ZOOM) { - cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll")); - } else { cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scale_Axis")); + } else { + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll")); } } } From ffe42c5b6a0b9d57508d803260ebf0e78c7bfb4c Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 5 Jul 2021 17:53:13 +0800 Subject: [PATCH 055/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 组件线型边框/圆角/背景样式优化 1. 修改组件边框/圆角/背景在设计器端布局面板中展示效果 2. 组件边框为整体边框 3. 组件圆角为整体圆角 4. 不管有无边框线,组件圆角裁剪总是生效 5. 组件背景为整体背景 --- .../com/fr/design/border/UIRoundedBorder.java | 25 ++- .../creator/XBorderStyleWidgetCreator.java | 146 ++++++++++++++++-- .../design/designer/creator/XChartEditor.java | 2 +- .../design/designer/creator/XElementCase.java | 2 +- .../designer/creator/XLayoutContainer.java | 2 +- .../creator/XWAbsoluteBodyLayout.java | 2 +- .../designer/creator/XWTitleLayout.java | 14 +- .../creator/cardlayout/XWCardLayout.java | 2 +- 8 files changed, 171 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java b/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java index 757bbbbe08..4530f0f485 100644 --- a/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java +++ b/designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java @@ -1,32 +1,33 @@ package com.fr.design.border; import com.fr.base.GraphHelper; +import com.fr.stable.GraphDrawHelper; import javax.swing.border.LineBorder; -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; +import java.awt.*; import java.awt.geom.RoundRectangle2D; public class UIRoundedBorder extends LineBorder { private static final long serialVersionUID = 1L; + private BasicStroke stroke4Thickness; private int roundedCorner; private int lineStyle; public UIRoundedBorder(Color color) { super(color); + this.stroke4Thickness = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); } public UIRoundedBorder(Color color, int thickness){ super(color, thickness); + this.stroke4Thickness = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); } public UIRoundedBorder(Color color, int thickness, int roundedCorners){ super(color, thickness, true); + this.stroke4Thickness = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); this.roundedCorner = roundedCorners; } @@ -51,7 +52,19 @@ public class UIRoundedBorder extends LineBorder { Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(lineColor); - GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1.0D, height - 1.0D, roundedCorner, roundedCorner), lineStyle); + + Shape shape = new RoundRectangle2D.Double(x, y, width - 1.0D, height - 1.0D, roundedCorner, roundedCorner); + + if (stroke4Thickness != null) { + Stroke oldStroke = g2d.getStroke(); + g2d.setStroke(stroke4Thickness); + g2d.draw(shape); + + g2d.setStroke(oldStroke); + } else { + GraphHelper.draw(g2d, shape, lineStyle); + } + g2d.setColor(oldColor); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index e174c122f3..fc40b1d123 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -11,6 +11,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetValue; import com.fr.form.ui.container.WTitleLayout; +import com.fr.general.Background; import com.fr.general.ComparatorUtils; import com.fr.general.act.BorderPacker; import com.fr.general.act.TitlePacker; @@ -18,7 +19,11 @@ import com.fr.stable.Constants; import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.border.Border; +import javax.swing.border.LineBorder; import java.awt.*; +import java.awt.geom.Rectangle2D; +import java.awt.geom.RoundRectangle2D; /** * Created with IntelliJ IDEA. @@ -29,6 +34,7 @@ import java.awt.*; public class XBorderStyleWidgetCreator extends XWidgetCreator{ protected static final Dimension BORDER_PREFERRED_SIZE = new Dimension(250, 150); + protected Background background4Painting; // 设计器预览界面中绘制组件背景图 public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { super(widget, initSize); @@ -38,8 +44,17 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ this.setShareId(sharableAttrMark.getShareId()); } } - - /** + + public Background getBackground4Painting() { + return this.background4Painting; + } + + public void setBackground4Painting(Background background4Painting) { + this.background4Painting = background4Painting; + this.repaint(); + } + + /** * 返回容器对应的widget * @return 同上 */ @@ -58,22 +73,37 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ protected void initStyle() { BorderPacker style = toData().getBorderStyle(); - initBorderStyle(); + initBorderAndBackgroundStyle(); if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { initTitleStyle(style); } else { clearTitleWidget(); } + + // 编辑右侧栏组件样式面板后,重新调整组件/标题/边框的显示效果 + reshuffleBorderAndBackgroundPaintingEffectIfTitleExists(); } - // 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框 - protected void initBorderStyle() { + protected void initBorderAndBackgroundStyle() { BorderPacker style = toData().getBorderStyle(); - if (style != null && style.getBorder() != Constants.LINE_NONE) { - this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); - } else { - this.setBorder(DEFALUTBORDER); + LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER; + + // 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框 + Border border = DEFAULT_LINE_BORDER; + if (style != null) { + int radius = style.getBorderRadius(); // 不管有无边框线, 圆角裁剪总是生效 + if (style.getBorder() != Constants.LINE_NONE) { + // 设置了边框线 + border = new UIRoundedBorder(style.getBorder(), style.getColor(), radius); + } else { + // 为设置边框线 + border = new UIRoundedBorder(DEFAULT_LINE_BORDER.getLineColor(), DEFAULT_LINE_BORDER.getThickness(), radius); + } } + + this.setBorder(border); + + this.setBackground4Painting(style != null ? style.getBackground() : null); } private void clearTitleWidget() { @@ -143,6 +173,75 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ return new WidgetValue(value); } + // 如果存在标题栏,则需要重新弄调整边框和背景的显示效果,使得边框和背景的视觉效果出现在包含组件和标题的整体区域上, + // 而不是组件和标题各自出现独立的边框和背景,同时如存在标题栏,则标题栏下方还应有底部边框,作为标题和内容的分界线 + protected void reshuffleBorderAndBackgroundPaintingEffectIfTitleExists() { + Container parent = this.getParent(); + if (parent instanceof XWTitleLayout) { + XWTitleLayout titleParent = (XWTitleLayout) parent; + if (parent.getComponentCount() > 1) { + XCreator titleCreator = titleParent.getTitleCreator(); + XCreator bodyXCreator = titleParent.getBodyCreator(); + + Border border = bodyXCreator.getBorder(); + + titleParent.setBorder(border); // 容器绘制完整边框 + bodyXCreator.setBorder(BorderFactory.createEmptyBorder()); // body不绘制边框 + titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title绘制底部边框 + if (border instanceof LineBorder) { + Color color = ((LineBorder) border).getLineColor(); + int thickness = ((LineBorder) border).getThickness(); + titleCreator.setBorder(new BottomLineBorder(color, thickness)); + } + + if (bodyXCreator instanceof XBorderStyleWidgetCreator) { + XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyXCreator; + Background background4Painting = styledBodyXCreator.getBackground4Painting(); + + styledBodyXCreator.setBackground4Painting(null); // body不绘制背景 + titleParent.setBackground4Painting(background4Painting); // 容器绘制完整背景 + } + } + } + } + + + // 根据当前组件边框裁剪内容,如果当前组件存在圆角,则应当按圆角裁剪内容 + private void clipByRoundedBorder(Graphics2D g2d) { + Border currentBorder = getBorder(); + if (currentBorder instanceof UIRoundedBorder) { + int thickness = ((UIRoundedBorder) currentBorder).getThickness(); + int radius = ((UIRoundedBorder) currentBorder).getRoundedCorner(); + int currentClipX = 0; + int currentClipY = 0; + int currentClipWidth = getWidth(); + int currentClipHeight = getHeight(); + int currentClipRadius = Math.max(radius - thickness, 0); // 应沿着边框外围进行裁剪 + g2d.clip(new RoundRectangle2D.Double(currentClipX, currentClipY, currentClipWidth, currentClipHeight, currentClipRadius, currentClipRadius)); + } + } + + // 设计器预览界面中绘制组件背景效果 + private void paintBackground(Graphics2D g2d) { + Background background4Painting = getBackground4Painting(); + if (background4Painting != null) { + background4Painting.paint(g2d, new Rectangle2D.Double(0, 0, getWidth(), getHeight())); + } + } + + @Override + protected void paintComponent(Graphics g) { + this.paintBackground((Graphics2D) g); + super.paintComponent(g); + } + + @Override + public void paint(Graphics g) { + this.clipByRoundedBorder((Graphics2D) g); + super.paint(g); + paintBorder(g); + } + @Override protected String getIconName() { return StringUtils.EMPTY; @@ -169,8 +268,33 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ * data属性改变触发其他操作 * */ - public void firePropertyChange(){ + public void firePropertyChange() { } - + + // 适用于标题栏的底部边框 + public static class BottomLineBorder extends LineBorder { + + private BottomLineBorder(Color color, int thickness) { + super(color, thickness); + } + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + Graphics2D g2d = (Graphics2D)g; + + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + g2d.setColor(getLineColor()); + g2d.setStroke(new BasicStroke(getThickness())); + g2d.drawLine(0, height, width, height); + + g2d.setStroke(oldStroke); + g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + } + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index 354a60ecb8..bbd2f52d9e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -165,7 +165,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { @Override protected void initXCreatorProperties() { super.initXCreatorProperties(); - initBorderStyle(); + initBorderAndBackgroundStyle(); BaseChartCollection collection = ((BaseChartEditor) data).getChartCollection(); isRefreshing = true; ((MiddleChartComponent) designerEditor.getEditorTarget()).populate(collection); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index e08cb658c7..4729be0b5b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -57,7 +57,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme super.initXCreatorProperties(); // 报表块初始化时要加载对应的borderStyle - initBorderStyle(); + initBorderAndBackgroundStyle(); } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java index 07220df0db..50c5967c55 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java @@ -118,7 +118,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme @Override protected void initXCreatorProperties() { super.initXCreatorProperties(); - initBorderStyle(); + initBorderAndBackgroundStyle(); this.initLayoutManager(); this.convert(); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index a43ed01251..aa5612c09f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java @@ -106,7 +106,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { @Override protected void initStyle() { - initBorderStyle(); + initBorderAndBackgroundStyle(); } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java index bfa841a4a5..ba864e6070 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java @@ -10,10 +10,9 @@ import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.form.ui.Label; import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetTitle; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; -import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; -import com.fr.stable.StringUtils; import java.awt.*; import java.awt.event.ContainerEvent; @@ -46,6 +45,17 @@ public class XWTitleLayout extends DedicateLayoutContainer { super(widget, initSize); } + @Override + protected void initXCreatorProperties() { + super.initXCreatorProperties(); + + // 初始化后(如打开旧模版),需要重新调整组件/标题/边框的显示效果 + XCreator xCreator = getBodyCreator(); + if (xCreator instanceof XBorderStyleWidgetCreator) { + ((XBorderStyleWidgetCreator) xCreator).reshuffleBorderAndBackgroundPaintingEffectIfTitleExists(); + } + } + /** * 初始化容器对应的布局 由于是只装一个需要保持原样高度的控件,布局设为absolute */ diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 1ff3f41c55..4fb422c0aa 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -400,7 +400,7 @@ public class XWCardLayout extends XLayoutContainer { protected void initStyle() { BorderPacker style = toData().getBorderStyle(); initBorderTitleStyle(style); - initBorderStyle(); + initBorderAndBackgroundStyle(); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); } From 80cc65a197fc7cf92af3b538a34b78997951d7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 7 Jul 2021 15:44:40 +0800 Subject: [PATCH 056/100] =?UTF-8?q?CHART-19778=20=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9D=A2=E6=9D=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/component/SeriesTypeUseComboxPaneWithOutFilter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java index db545b9d45..1b567b474e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java @@ -26,6 +26,7 @@ public class SeriesTypeUseComboxPaneWithOutFilter extends SeriesTypeUseComboxPan protected void initComponents() { super.initComponents(); this.setSelectedIndex(1); + this.checkCardPane(); } @Override From b0436d5a819a8b2063ff32ed6b0d82fb69939d01 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Wed, 7 Jul 2021 16:36:20 +0800 Subject: [PATCH 057/100] =?UTF-8?q?REPORT-53949=20UISpinner=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=84=A6=E7=82=B9=E5=90=8E=E6=89=8D=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E8=B0=83=E6=95=B4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/ispinner/UISpinner.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index 454b1e5b99..9d10da3a72 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -58,6 +58,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver * Spinner内的数字文本框长度 */ private int numberFieldColumns; + private boolean hasTextFieldFocus = false; public UISpinner() { @@ -318,7 +319,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { + if (hasTextFieldFocus && isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { setValue(value - e.getWheelRotation()); } } @@ -330,8 +331,14 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.getDocument().removeDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener); textField.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + hasTextFieldFocus = true; + } + @Override public void focusLost(FocusEvent e) { + hasTextFieldFocus = false; textField.getDocument().removeDocumentListener(docListener); textField.setValue(value); textField.getDocument().addDocumentListener(docListener); From 869aff12f345f6bb7d864c7b8ed13c46c0c7bc0d Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 5 Jul 2021 23:17:51 +0800 Subject: [PATCH 058/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 设计器绝对布局内可锁定组件宽高比例 修复尺寸比例锁定按钮不能保存锁定状态的问题 1. 尺寸比例锁定按钮不应该保存XCreator对象(点击按钮时不能直接通过保存的XCreator, 改变widget锁定状态) 2. 尺寸比例锁定按钮需要实现GlobalNameObserver接口才能成功使得update被调用, 从而更新XCreator中widget的锁定状态 弹出提示显示逻辑 仅选中绝对布局内组件且该组件未勾选比例锁定按钮时,显示Shift键锁定组件尺寸比例功能 提示信息 --- .../beans/location/AccessDirection.java | 5 +- .../designer/beans/models/StateModel.java | 7 +- .../fr/design/mainframe/FormSelection.java | 10 +++ .../component/WidgetAbsoluteBoundPane.java | 3 +- .../designer/component/WidgetBoundPane.java | 74 ++++++++++++++----- 5 files changed, 76 insertions(+), 23 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java index be44eae817..adb0c6017b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java @@ -195,8 +195,11 @@ public abstract class AccessDirection implements Direction { if (type != formEditor.getCursor().getType()) { // 设置当前形状 formEditor.setCursor(Cursor.getPredefinedCursor(type)); + + FormSelection selection = formEditor.getSelectionModel().getSelection(); + boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor); ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - if (!config.isHasShownLockedAspectRatioResizingToolTip()) { + if (canLockAspectRatioOnlyByShift && !config.isHasShownLockedAspectRatioResizingToolTip()) { formEditor.setToolTipText(getTooltip()); config.setHasShownLockedAspectRatioResizingToolTip(true); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java index 34b03bc528..3b676921b1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java @@ -15,6 +15,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.utils.ComponentUtils; @@ -486,12 +487,14 @@ public class StateModel { public void dragging(MouseEvent e) { //进入dragging状态时备份组件大小和位置 if (!dragging) { - this.aspectRatioLocked = this.selectionModel.getSelection().isCreatorAspectRatioLockedInAbsLayout(designer); selectedPositionBackup = selectionModel.getSelection().getRelativeBounds(); } checkAddable(e); setDependLinePainter(e); - this.aspectRatioLocked = this.aspectRatioLocked || e.isShiftDown(); + + FormSelection selection = this.selectionModel.getSelection(); + this.aspectRatioLocked = selection.isCreatorAspectRatioLockedInAbsLayout(designer) || + (this.selectionModel.getSelection().isCreatorInAbsLayout(designer) && e.isShiftDown()); driection.drag(getMouseXY(e).x - currentX, getMouseXY(e).y - currentY, designer); this.dragging = true; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java index 956e1cb66a..54ab34a4fd 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java @@ -300,6 +300,16 @@ public class FormSelection { return false; } + public boolean isCreatorInAbsLayout(FormDesigner designer) { + for (XCreator creator : selection) { + LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); + if (layoutAdapter instanceof FRAbsoluteLayoutAdapter) { + return true; + } + } + return false; + } + /** * @Description 重置报表块缩略图 * @param: creator diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 30c90b3269..e8aeb994df 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -29,11 +29,12 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { y = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); width = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); height = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0d); - ratioLockedButton = new AspectRatioLockedButton(width, height, creator); + ratioLockedButton = new AspectRatioLockedButton(width, height); x.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); y.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); + ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 5e1c8dee70..e963bf7130 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -11,8 +11,11 @@ import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.GlobalNameListener; +import com.fr.design.event.GlobalNameObserver; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; @@ -81,7 +84,8 @@ public class WidgetBoundPane extends BasicPane { JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (jTemplate.isJWorkBook() || !((JForm)jTemplate).isSelectRootPane()) { - ratioLockedButton = new AspectRatioLockedButton(width, height, creator); + ratioLockedButton = new AspectRatioLockedButton(width, height); + ratioLockedButton.setGlobalName(i18nText("Fine-Design_Form_Coords_And_Size")); ratioLockedButton.setLockEnabled(false); } @@ -121,7 +125,7 @@ public class WidgetBoundPane extends BasicPane { limitHeight(wabs, h, bounds, rec); } if (ratioLockedButton != null) { - ratioLockedButton.setLocked(creator.toData().isAspectRatioLocked()); + ratioLockedButton.update(creator); } } @@ -191,21 +195,24 @@ public class WidgetBoundPane extends BasicPane { } - protected static class AspectRatioLockedButton extends UIButton { + protected static class AspectRatioLockedButton extends JButton implements UIObserver, GlobalNameObserver { private final Icon enabledLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_lock_enabled.png"); private final Icon disabledLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_lock_disabled.png"); private final Icon enabledUnLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_unlock_enabled.png"); private final Icon disabledUnLocked = IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_unlock_disabled.png"); - private UISpinner mWidthSpinner; - private UISpinner mHeightSpinner; - private XCreator mCreator; + private UIObserverListener uiObserverListener; + private GlobalNameListener globalNameListener; + private String globalName = null; + + private final UISpinner mWidthSpinner; + private final UISpinner mHeightSpinner; protected double width4Backup = 0; protected double height4Backup = 0; - public AspectRatioLockedButton(UISpinner widthSpinner, UISpinner heightSpinner, XCreator creator) { + public AspectRatioLockedButton(UISpinner widthSpinner, UISpinner heightSpinner) { setUI(new BasicButtonUI()); setBorderPainted(false); setBorder(null); @@ -214,25 +221,25 @@ public class WidgetBoundPane extends BasicPane { this.mWidthSpinner = widthSpinner; this.mHeightSpinner = heightSpinner; - this.mCreator = creator; addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - setSelected(!isSelected()); - } - }); - addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - mCreator.toData().setAspectRatioLocked(isLocked()); - - setToolTipText(isLockEnabled() ? null : i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Button_ToolTip")); + // 改变图标icon + setLocked(!isLocked()); if (isLocked() && isLockEnabled()) { width4Backup = mWidthSpinner.getValue(); height4Backup = mHeightSpinner.getValue(); } + + if (globalNameListener != null) { + globalNameListener.setGlobalName(globalName); + } + + if (uiObserverListener != null) { + uiObserverListener.doChange(); + } } }); @@ -285,15 +292,44 @@ public class WidgetBoundPane extends BasicPane { public void setLockEnabled(boolean enabled) { this.setEnabled(enabled); + setToolTipText(isLockEnabled() ? null : i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Button_ToolTip")); } public void populate(XCreator creator) { Rectangle bounds = new Rectangle(creator.getBounds()); - mCreator = creator; width4Backup = bounds.width; height4Backup = bounds.height; Widget widget = creator.toData(); setLocked(widget.isAspectRatioLocked()); } + + public void update(XCreator creator) { + creator.toData().setAspectRatioLocked(this.isLocked()); + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + uiObserverListener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + @Override + public void registerNameListener(GlobalNameListener listener) { + this.globalNameListener = listener; + } + + @Override + public boolean shouldResponseNameListener() { + return true; + } + + @Override + public void setGlobalName(String name) { + this.globalName = name; + } } } From 56b32280f38684e44d1fb6a7345c5582799ec4b9 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 6 Jul 2021 13:48:20 +0800 Subject: [PATCH 059/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 组件样式支持图片边框 首次打开边框图片选择器的默认路径为assets/border_images, 后续打开路径为上次位置 --- .../gui/xpane/BorderLineAndImagePane.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 67eb8c1ae5..ca8b5abebd 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -5,6 +5,7 @@ import com.fr.base.Style; import com.fr.base.Utils; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; +import com.fr.config.ServerPreferenceConfig; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; @@ -20,7 +21,6 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itooltip.UIToolTip; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -32,7 +32,10 @@ import com.fr.general.Background; import com.fr.general.IOUtils; import com.fr.stable.Constants; import com.fr.stable.GraphDrawHelper; +import com.fr.stable.ProjectLibrary; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -46,6 +49,7 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -174,6 +178,20 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } } + private void initImageFileChooserDirectory() { + ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); + String lastUsedBorderImagesDirPath = config.getLastUsedBorderImagesDir(); + File lastUsedBorderImagesDir = StringUtils.isNotEmpty(lastUsedBorderImagesDirPath) ? new File(lastUsedBorderImagesDirPath) : null; + + File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images")); + + if (lastUsedBorderImagesDir!= null && lastUsedBorderImagesDir.exists()) { + imageFileChooser.setCurrentDirectory(lastUsedBorderImagesDir); + } else if (inbuiltBorderImagesDir.exists()) { + imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir); + } + } + protected void initNinePointTweakPaneIfNotExist() { if (tweakPane == null) { tweakPane = new NinePointImageTweakDialogPane(); @@ -210,8 +228,15 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { @Override public void actionPerformed(ActionEvent e) { initImageFileChooserIfNotExist(); - + initImageFileChooserDirectory(); int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); + File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile(); + config.setLastUsedBorderImagesDir(selectedDirectory.getPath()); + } + ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { From f788999a9ce31db7187999f81d88eefa145eb5a6 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 8 Jul 2021 10:25:07 +0800 Subject: [PATCH 060/100] =?UTF-8?q?REPORT-54392=20=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E6=89=93=E5=BC=80=E8=A1=A8=E5=8D=95=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E5=86=85=E5=AD=98=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/Releasable.java | 5 -- .../design/designer/creator/XElementCase.java | 8 +++- .../gui/controlpane/EventPropertyPane.java | 9 +--- .../design/mainframe/FormParaWidgetPane.java | 12 +---- .../mainframe/FormWidgetDetailPane.java | 8 +--- .../java/com/fr/design/mainframe/JForm.java | 48 ++++++++++++++----- .../design/mainframe/WidgetPropertyPane.java | 28 +---------- .../fr/design/mainframe/XCreateGather.java | 7 +++ .../widget/ui/FormWidgetCardPane.java | 15 +----- 9 files changed, 55 insertions(+), 85 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/file/Releasable.java create mode 100644 designer-form/src/main/java/com/fr/design/mainframe/XCreateGather.java diff --git a/designer-base/src/main/java/com/fr/design/file/Releasable.java b/designer-base/src/main/java/com/fr/design/file/Releasable.java deleted file mode 100644 index cb78789e6f..0000000000 --- a/designer-base/src/main/java/com/fr/design/file/Releasable.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.fr.design.file; - -public interface Releasable { - void releaseResources(); -} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 4729be0b5b..7ed22c52dd 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -1,6 +1,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; +import com.fr.base.Releasable; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; @@ -32,7 +33,7 @@ import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.util.Set; -public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider { +public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider , Releasable { private UILabel imageLable; private FormDesigner designer; private static BufferedImage DEFAULT_BACKGROUND; @@ -352,4 +353,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public boolean isSupportShared() { return true; } + + @Override + public void releaseResources() { + imageLable.setIcon(null); + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index 834b6b4a87..2a67f61ae4 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java @@ -2,7 +2,6 @@ package com.fr.design.gui.controlpane; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.EventPropertyTable; -import com.fr.design.file.Releasable; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; import com.fr.design.widget.EventCreator; @@ -14,7 +13,7 @@ import com.fr.stable.Nameable; /** * Created by kerry on 5/17/21 */ -public class EventPropertyPane extends UIListGroupControlPane implements Releasable { +public class EventPropertyPane extends UIListGroupControlPane { private XCreator creator; private FormDesigner designer; @@ -25,12 +24,6 @@ public class EventPropertyPane extends UIListGroupControlPane implements Releasa this.designer = designer; } - @Override - public void releaseResources() { - creator = null; - designer = null; - this.removeAll(); - } /** * 刷新 diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index d8b604e195..b8f3ff6380 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -7,7 +7,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.file.Releasable; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; @@ -57,7 +56,7 @@ import java.awt.event.MouseEvent; /** * @author null */ -public class FormParaWidgetPane extends JPanel implements Releasable { +public class FormParaWidgetPane extends JPanel { private static FormParaWidgetPane THIS; private final static int BORDER = 5; private final static int WIDGET_WIDTHGAP = 4; @@ -120,15 +119,6 @@ public class FormParaWidgetPane extends JPanel implements Releasable { return THIS; } - public static FormParaWidgetPane getInstance(){ - return THIS; - } - - @Override - public void releaseResources() { - designer = null; - } - public FormParaWidgetPane() { setLayout(new FlowLayout(FlowLayout.LEFT)); DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java index 60a63a0cc5..d792f0eca2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,7 +2,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.dialog.BasicPane; -import com.fr.design.file.Releasable; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; @@ -31,7 +30,7 @@ import java.util.List; * Date: 14-7-8 * Time: 下午8:18 */ -public class FormWidgetDetailPane extends FormDockView implements Releasable { +public class FormWidgetDetailPane extends FormDockView{ private static final int ONLINE_TAB = 1; private JPanel centerPane; @@ -62,11 +61,6 @@ public class FormWidgetDetailPane extends FormDockView implements Releasable { private static FormWidgetDetailPane singleton = new FormWidgetDetailPane(); } - @Override - public void releaseResources() { - setEditingFormDesigner(null); - } - public String getViewTitle() { return Toolkit.i18nText("Fine-Design_Form_Widget_Tree_And_Table"); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 856494401b..08969c91a0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.PaperSize; import com.fr.base.Parameter; +import com.fr.base.Releasable; import com.fr.base.extension.FileExtension; import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.vcs.DesignerMode; @@ -26,6 +27,7 @@ import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XComponent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWParameterLayout; @@ -72,6 +74,7 @@ import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.utils.ShareUtils; import com.fr.form.ui.AbstractBorderStyleWidget; +import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; @@ -110,14 +113,13 @@ import java.util.Iterator; import java.util.List; import javax.swing.tree.TreePath; -public class JForm extends JTemplate implements BaseJForm
{ +public class JForm extends JTemplate implements BaseJForm, Releasable { private static final String FORM_CARD = "FORM"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; private static final String[] CARDNAME = new String[]{FORM_CARD, ELEMENTCASE_CARD}; private static final int TOOLBARPANEDIMHEIGHT_FORM = 60; - //当前使用的表单设计器 - private static FormDesigner currentFormDesign; + //表单设计器 private FormDesigner formDesign; //格子设计器 @@ -712,7 +714,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm Date: Thu, 8 Jul 2021 10:44:13 +0800 Subject: [PATCH 061/100] =?UTF-8?q?REPORT-54834=20=20=20=20=E6=8B=96?= =?UTF-8?q?=E5=8A=A8=E8=BF=9B=E5=85=A5=E5=AF=BC=E8=87=B4=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E7=9A=84=E6=A0=87=E5=BF=97=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ipasswordfield/UIPasswordFieldWithFixedLength.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java b/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java index c1cb98ca3d..02ed99830a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java +++ b/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java @@ -68,7 +68,13 @@ public class UIPasswordFieldWithFixedLength extends UIPassWordField { this.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - UIPasswordFieldWithFixedLength.this.clearPassword = true; + UIPasswordFieldWithFixedLength.this.clearPassword = true; + } + + @Override + public void mousePressed(MouseEvent e) { + // 防止拖动进入 + UIPasswordFieldWithFixedLength.this.clearPassword = true; } }); this.addKeyListener(new KeyAdapter() { From 2a119a4d8d6a71867edc027d913b7abc58efaf7e Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 8 Jul 2021 16:02:51 +0800 Subject: [PATCH 062/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把诸如是否已展示/是否已点击/上次选择的目录等设计器交互历史相关的需持久化数据 从ServerPreferenceConfig中抽离,放到单独的文件中存储,不要和服务器配置 数据混淆 --- .../env/utils/DesignerInteractionHistory.java | 148 ++++++++++++++++++ .../beans/location/AccessDirection.java | 31 ++-- .../gui/xpane/BorderLineAndImagePane.java | 16 +- .../main/java/com/fr/start/MainDesigner.java | 4 + 4 files changed, 181 insertions(+), 18 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java diff --git a/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java b/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java new file mode 100644 index 0000000000..45cebca48b --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java @@ -0,0 +1,148 @@ +package com.fr.env.utils; + +import com.fr.common.annotations.Compatible; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.third.javax.xml.stream.XMLStreamException; + +import java.io.BufferedWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; + +/** + * @author Starryi + * @version 10.0.18 + * Created by Starryi on 2021/7/7 + * 设计器访问和获取关键历史交互信息的持久化工具,该关键历史交互信息, + * 如用户是否点击过某按钮,是否查看过某弹窗信息,上次选择过的文件所在目录等 + */ +@Compatible +public class DesignerInteractionHistory implements XMLReadable, XMLWriter { + + private static final String FILE_NAME = "designer.ix.history.info"; + private static final String ROOT_TAG = "History"; + + private static DesignerInteractionHistory history; + public static DesignerInteractionHistory getInstance() { + if (history == null) { + history = new DesignerInteractionHistory(); + + readXMLFile(history, history.getHistoryFile()); + } + + return history; + } + + private File getHistoryFile() { + return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME)); + } + + private static void readXMLFile(XMLReadable xmlReadable, File xmlFile) { + if (xmlFile == null || !xmlFile.exists()) { + return; + } + String charset = EncodeConstants.ENCODING_UTF_8; + try { + String decodeContent = getFileContent(xmlFile); + InputStream xmlInputStream = new ByteArrayInputStream(decodeContent.getBytes(charset)); + InputStreamReader inputStreamReader = new InputStreamReader(xmlInputStream, charset); + + XMLableReader xmlReader = XMLableReader.createXMLableReader(inputStreamReader); + + if (xmlReader != null) { + xmlReader.readXMLObject(xmlReadable); + } + xmlInputStream.close(); + } catch (IOException | XMLStreamException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + + } + + private static String getFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException { + InputStream encodeInputStream = new FileInputStream(xmlFile); + return IOUtils.inputStream2String(encodeInputStream); + } + + private static void writeContentToFile(String fileContent, File file) { + try (FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); + BufferedWriter bw = new BufferedWriter(osw)) { + bw.write(fileContent); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + public void saveXMLFile() { + File xmlFile = this.getHistoryFile(); + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XMLTools.writeOutputStreamXML(this, out); + out.flush(); + out.close(); + String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8); + writeContentToFile(fileContent, xmlFile); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + + private static final String HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP = "hasShownShiftDragResizingTooltip"; + private static final String LAST_SELECTED_BORDER_IMAGE_DIR = "lastSelectedBorderImageDir"; + + // 是否已展示过按下Shift键可锁定比例拖拽尺寸的Tooltip + private boolean hasShownShiftDragResizingTooltip = false; + // 用户上次通过文件选择器选择的边框图片所在目录 + private String lastSelectedBorderImageDir = StringUtils.EMPTY; + + public boolean isHasShownShiftDragResizingTooltip() { + return hasShownShiftDragResizingTooltip; + } + + public void setHasShownShiftDragResizingTooltip(boolean shown) { + this.hasShownShiftDragResizingTooltip = shown; + } + + public String getLastSelectedBorderImageDir() { + return lastSelectedBorderImageDir; + } + + public void setLastSelectedBorderImageDir(String dirPath) { + this.lastSelectedBorderImageDir = dirPath; + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(ROOT_TAG) + .attr(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, isHasShownShiftDragResizingTooltip()) + .attr(LAST_SELECTED_BORDER_IMAGE_DIR, getLastSelectedBorderImageDir()) + .end(); + } + + @Override + public void readXML(XMLableReader reader) { + setHasShownShiftDragResizingTooltip(reader.getAttrAsBoolean(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, false)); + setLastSelectedBorderImageDir(reader.getAttrAsString(LAST_SELECTED_BORDER_IMAGE_DIR, StringUtils.EMPTY)); + } +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java index adb0c6017b..eae04d9987 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java @@ -3,17 +3,19 @@ */ package com.fr.design.designer.beans.location; -import com.fr.config.ServerPreferenceConfig; -import com.fr.config.utils.ConfigReadUtils; import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.XWBorderLayout; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.utils.ComponentUtils; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; -import com.fr.form.ui.container.WParameterLayout; import java.awt.*; @@ -196,15 +198,24 @@ public abstract class AccessDirection implements Direction { // 设置当前形状 formEditor.setCursor(Cursor.getPredefinedCursor(type)); - FormSelection selection = formEditor.getSelectionModel().getSelection(); + // 显示/改变Tooltip + showTooltip(formEditor); + } + } + + private void showTooltip(FormDesigner formEditor) { + // 显示拖拽改变组件尺寸相关的提示信息 + int cursorType = formEditor.getCursor().getType(); + if (Cursor.SW_RESIZE_CURSOR <= cursorType && cursorType <= Cursor.E_RESIZE_CURSOR) { + FormSelection selection = formEditor.getSelectionModel().getSelection(); boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor); - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - if (canLockAspectRatioOnlyByShift && !config.isHasShownLockedAspectRatioResizingToolTip()) { + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); + if (canLockAspectRatioOnlyByShift && !history.isHasShownShiftDragResizingTooltip()) { formEditor.setToolTipText(getTooltip()); - config.setHasShownLockedAspectRatioResizingToolTip(true); + history.setHasShownShiftDragResizingTooltip(true); } - } - } + } + } public String getTooltip() { return null; diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index ca8b5abebd..9444ec1f8f 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -5,7 +5,6 @@ import com.fr.base.Style; import com.fr.base.Utils; import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageFileBackground; -import com.fr.config.ServerPreferenceConfig; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; @@ -27,6 +26,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.backgroundpane.ImagePreviewPane; import com.fr.design.style.background.image.ImageFileChooser; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.form.ui.LayoutBorderStyle; import com.fr.general.Background; import com.fr.general.IOUtils; @@ -179,14 +179,14 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } private void initImageFileChooserDirectory() { - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); - String lastUsedBorderImagesDirPath = config.getLastUsedBorderImagesDir(); - File lastUsedBorderImagesDir = StringUtils.isNotEmpty(lastUsedBorderImagesDirPath) ? new File(lastUsedBorderImagesDirPath) : null; + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); + String lastUsedBorderImageDirPath = history.getLastSelectedBorderImageDir(); + File lastUsedBorderImageDir = StringUtils.isNotEmpty(lastUsedBorderImageDirPath) ? new File(lastUsedBorderImageDirPath) : null; File inbuiltBorderImagesDir = new File(StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSETS_NAME, "border_images")); - if (lastUsedBorderImagesDir!= null && lastUsedBorderImagesDir.exists()) { - imageFileChooser.setCurrentDirectory(lastUsedBorderImagesDir); + if (lastUsedBorderImageDir!= null && lastUsedBorderImageDir.exists()) { + imageFileChooser.setCurrentDirectory(lastUsedBorderImageDir); } else if (inbuiltBorderImagesDir.exists()) { imageFileChooser.setCurrentDirectory(inbuiltBorderImagesDir); } @@ -232,9 +232,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int returnVal = imageFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { - ServerPreferenceConfig config = ServerPreferenceConfig.getInstance(); + DesignerInteractionHistory history = DesignerInteractionHistory.getInstance(); File selectedDirectory = imageFileChooser.getSelectedFile().getParentFile(); - config.setLastUsedBorderImagesDir(selectedDirectory.getPath()); + history.setLastSelectedBorderImageDir(selectedDirectory.getPath()); } ImgChooseWrapper.getInstance(imagePreviewPane, imageFileChooser, DEFAULT_IMAGE_LAYOUT_STYLE, new ChangeListener() { diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 5c8c57987b..dd49f1b1ae 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -42,6 +42,7 @@ import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.share.SharableManager; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.env.utils.DesignerInteractionHistory; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; @@ -512,6 +513,9 @@ public class MainDesigner extends BaseDesigner { InformationCollector collector = InformationCollector.getInstance(); collector.collectStopTime(); collector.saveXMLFile(); + + DesignerInteractionHistory historyCollector = DesignerInteractionHistory.getInstance(); + historyCollector.saveXMLFile(); } } From abff5e2d022a30aaeda5a4d6881adb7c30480fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 9 Jul 2021 10:04:03 +0800 Subject: [PATCH 063/100] =?UTF-8?q?CHART-19824=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=9D=A2=E6=9D=BF=E4=BA=A4=E4=BA=92=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartTypeButtonPane.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 778f779a07..f2bea52278 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -111,15 +111,10 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen northPane.setLayout(new BorderLayout()); northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - JPanel addPanel = new JPanel(); - addPanel.setLayout(new BorderLayout()); - addPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); - addPanel.add(addButton, BorderLayout.CENTER); - JPanel button = new JPanel(); - button.setPreferredSize(new Dimension(95, 20)); - button.setLayout(new GridLayout(1, 4, 0, 0)); - button.add(addPanel); + button.setPreferredSize(new Dimension(89, 20)); + button.setLayout(new GridLayout(1, 4, 3, 0)); + button.add(addButton); button.add(copyButton); button.add(moveForwardButton); button.add(moveBackButton); @@ -135,14 +130,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); - copyButton.setBorderPainted(false); copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy")); moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png")); moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left")); - moveForwardButton.setBorderPainted(false); moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png")); moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right")); - moveBackButton.setBorderPainted(false); initAddButton(); initConfigButton(); initMoveButton(); @@ -312,7 +304,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private String getCopyChartName() { - String chartName = "CopyOf" + editingCollection.getChartName(editingCollection.getSelectedIndex()); + String chartName = editingCollection.getChartName(editingCollection.getSelectedIndex()) + "_Copy"; if (!nameRepeated(chartName)) { return chartName; } From 0703562439dd39729908757d7f9d7ee54f68d51f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 17:50:34 +0800 Subject: [PATCH 064/100] =?UTF-8?q?REPORT-55089=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E7=8E=B0=E5=9C=A8=E9=94=81=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=9C=A8=E5=AE=BD=E9=AB=98=E5=80=BC=E4=B9=8B=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E9=94=81=E5=AE=9A=E6=97=B6=EF=BC=8C=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=AE=BD=E5=BA=A6=E5=80=BC=E4=BC=9A=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E6=88=90=E4=B8=80=E4=B8=AA=E5=BE=88=E9=95=BF=E7=9A=84=E5=B0=8F?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 因为尺寸比例锁定,所以宽度设置控件和高度设置控件的显示内容做了关联:当宽度设置控件发生变化后,会自动修改高度控制的显示只, 反之亦然。因为上述关联,导致拖拽结束后,重新设置面板上尺寸显示值时,高度设置控件的值后更细,联动宽度控件的值,所以宽度控件 的值被修改,显示错误 【改动思路】 populate中设置宽度和高度值时,先临时关闭比例锁定 【review建议】 --- .../design/widget/ui/designer/component/WidgetBoundPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index e963bf7130..bfcaeb60e7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -104,6 +104,10 @@ public class WidgetBoundPane extends BasicPane { public void populate() { Rectangle bounds = new Rectangle(creator.getBounds()); + if (ratioLockedButton != null) { + // 临时禁止尺寸比例锁定,关掉widthSpinner/heightSpinner之间的数值关联,以更新其高度和宽度值 + ratioLockedButton.setLocked(false); + } width.setValue(bounds.width); height.setValue(bounds.height); if (ratioLockedButton != null) { From 5cfbe3fec415f92f2c3044f0bdc1d1d1ea3b6dbb Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 18:45:33 +0800 Subject: [PATCH 065/100] =?UTF-8?q?REPORT-55071=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=A1=AB?= =?UTF-8?q?=E5=85=85=E9=80=89=E6=8B=A9=E6=B8=90=E5=8F=98=E8=89=B2=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=BA=B5=E5=90=91=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E4=BD=8F=E4=BA=86=E6=B8=90=E5=8F=98=E8=89=B2=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E9=A2=9C=E8=89=B2=E9=80=89=E6=8B=A9=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 渐变条的默认宽度超过了右侧栏设置项的宽度,导致渐变条右侧被截断 【改动思路】 提供可继承的方法,使得右侧栏实例化渐变条时能控制其宽度 【review建议】 --- .../fr/design/gui/style/BackgroundSpecialPane.java | 7 ++++++- .../design/gui/xpane/BorderLineAndImagePane.java | 2 +- .../com/fr/design/gui/xpane/LayoutStylePane.java | 14 +++++++++++--- .../fr/design/gui/xpane/TitleInsetImagePane.java | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java index 7fa2664235..ee05a8b59e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java @@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{ fireStateChanged(); } }); - GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); + GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane(); gradientPane.registerChangeListener(new UIObserverListener() { @Override public void doChange() { @@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{ return kinds.toArray(new BackgroundQuickPane[kinds.size()]); } + + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + // 使用默认的150宽度构建渐变条 + return new GradientBackgroundQuickPane(); + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 9444ec1f8f..27c045459d 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -62,7 +62,7 @@ import java.net.URISyntaxException; * 可配置图片类型边框的样式设置面板 */ public class BorderLineAndImagePane extends JPanel implements UIObserver { - private final int SETTING_LABEL_WIDTH = 60; + private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); private final String TWEAK_NINE_POINT_HELP_URL = ""; diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 265de1aba7..ee1de8f7e8 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -24,6 +24,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.WidgetTitle; import com.fr.general.Background; @@ -51,7 +52,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow") }; private static final Dimension BUTTON_SIZE = new Dimension(20, 20); - private static final int SETTING_LABEL_WIDTH = 60; + public static final int SETTING_LABEL_WIDTH = 60; protected LayoutBorderStyle style = new LayoutBorderStyle(); @@ -124,7 +125,7 @@ public class LayoutStylePane extends BasicBeanPane { borderStyleCombo = new UIComboBox(BORDER_STYLE); borderLineAndImagePane = new BorderLineAndImagePane(); cornerSpinner = new UISpinner(0,1000,1,0); - backgroundPane = new BackgroundSpecialPane(); + backgroundPane = new LayoutBackgroundSpecialPane(); backgroundOpacityPane = new UIPercentDragPane(); } @@ -229,7 +230,7 @@ public class LayoutStylePane extends BasicBeanPane { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") }); - titleBackgroundPane = new BackgroundSpecialPane(); + titleBackgroundPane = new LayoutBackgroundSpecialPane(); titleBackgroundOpacityPane = new UIPercentDragPane(); } @@ -499,4 +500,11 @@ public class LayoutStylePane extends BasicBeanPane { g2d.setColor(oldColor); } } + + protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane { + @Override + protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { + return new GradientBackgroundQuickPane(140); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index 1a207a0b3e..e3b3c00f48 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -40,7 +40,7 @@ import java.awt.event.ActionListener; * Created by Starryi on 2021/7/3 */ public class TitleInsetImagePane extends JPanel implements UIObserver { - private final int SETTING_LABEL_WIDTH = 60; + private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final int DELETE_BUTTON_SIZE = 24; private final int IMAGE_PREVIEW_SIZE = 145; private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); From 4bad4e373444e6929240285dd45f3937f927cbba Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 19:17:14 +0800 Subject: [PATCH 066/100] =?UTF-8?q?REPORT-55090=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=9B=BE=E6=A1=88?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=9B=BE=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E4=BA=A4=E4=BA=92=E6=96=87=E6=A1=A3=E9=87=8C=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=82=AC=E6=B5=AE=E6=97=B6=E5=87=BA=E7=8E=B0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E5=92=8C=E4=B8=8D=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E9=81=AE=E7=BD=A9=E9=A2=84=E6=9C=9F=E6=95=88=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 插图图片按钮的交互和样式不对,需要重新实现 【改动思路】 【review建议】 --- .../design/gui/xpane/TitleInsetImagePane.java | 69 ++++++++++++++++--- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index e3b3c00f48..b7161cbfb1 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -33,6 +33,10 @@ import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.RoundRectangle2D; /** * @author Starryi @@ -89,6 +93,28 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { deletableImagePreviewPane.add(imageDeleteButton, 0); deletableImagePreviewPane.add(imagePreviewPane, 1); + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + deletableImagePreviewPane.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + super.mouseEntered(e); + imageDeleteButton.setVisible(true); + imageDeleteButton.setEnabled(true); + } + + @Override + public void mouseExited(MouseEvent e) { + super.mouseExited(e); + int x = e.getX(); + int y = e.getY(); + if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); + } + } + }); + return TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ {null, deletableImagePreviewPane}, @@ -110,15 +136,11 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { private void initComponents() { imageChooseButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_choose_inset.png")); - imageDeleteButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png")); - imageDeleteButton.setUI(new BasicButtonUI()); - imageDeleteButton.setOpaque(true); - imageDeleteButton.setBorderPainted(false); - imageDeleteButton.setBorder(null); - imageDeleteButton.setFocusPainted(false); - imageDeleteButton.setContentAreaFilled(true); + imageDeleteButton = new OpaqueColorButton( + IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), + new Color(51, 51, 52, 178), + 2); imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); - imageDeleteButton.setBackground(new Color(51, 51, 51)); imagePreviewPane = new ImagePreviewPane(); imagePreviewPane.setImageStyle(DEFAULT_IMAGE_LAYOUT_STYLE); @@ -255,4 +277,35 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { public boolean shouldResponseChangeListener() { return true; } + + private static class OpaqueColorButton extends UIButton { + private final Color color; + private final int radius; + + public OpaqueColorButton(Icon icon, Color color, int radius) { + super(icon); + setUI(new BasicButtonUI()); + setOpaque(true); + setBorderPainted(false); + setBorder(null); + setFocusPainted(false); + setContentAreaFilled(false); + this.color = color; + this.radius = radius; + } + + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Color oldColor = g2d.getColor(); + + Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), radius, radius); + g2d.clip(shape); + g2d.setColor(color); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.setColor(oldColor); + super.paint(g); + } + } } From 43efd3c46f5b152362ffdb70f5b68abb704054fa Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 9 Jul 2021 19:26:02 +0800 Subject: [PATCH 067/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 子功能: 设计器绝对布局内可锁定组件宽高比例 绝对布局未锁定尺寸比例,但其内部子组件锁定了尺寸比例,此时 改变绝对布局的尺寸,其内部组件应该保持原有的尺寸比例. 根据规则, 其内部组件选择宽度和高度中较小的缩放比例,缩放其尺寸. --- .../java/com/fr/design/designer/creator/XWAbsoluteLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 60197ba12c..72bb2cb032 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -203,6 +203,10 @@ public class XWAbsoluteLayout extends XLayoutContainer { double percentH = ((double) backupBound.height / (double) currentBound.height); for (int index = 0, n = this.getComponentCount(); index < n; index++) { XCreator creator = (XCreator) this.getComponent(index); + if (creator.toData().isAspectRatioLocked()) { + double percent = Math.min(percentW, percentH); + percentW = percentH = percent; + } BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); // 用当前的显示大小计算后调正具体位置 Rectangle wgtBound = creator.getBounds(); From b8f32bf0a061df0bcd591c602b0f415d63fdddbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Sat, 10 Jul 2021 21:20:46 +0800 Subject: [PATCH 068/100] =?UTF-8?q?REPORT-54998=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=8D=95=E5=85=83=E6=A0=BC=E5=8F=B3=E4=B8=8B=E8=A7=92?= =?UTF-8?q?=E2=80=98=E5=8D=81=E2=80=99=E6=8B=96=E5=8A=A8=EF=BC=8C=E5=90=91?= =?UTF-8?q?=E5=8F=B3=E5=90=91=E4=B8=8B=E6=AD=A3=E5=B8=B8=EF=BC=8C=E5=90=91?= =?UTF-8?q?=E5=B7=A6=E6=97=A0=E6=B3=95=E9=80=92=E5=87=8F=EF=BC=8C=E5=90=91?= =?UTF-8?q?=E4=B8=8A=E6=97=A0=E6=B3=95=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/grid/GridMouseAdapter.java | 2 +- .../java/com/fr/grid/IntelliElements.java | 128 +++++++++++------- 2 files changed, 82 insertions(+), 48 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index b0f91a9029..55bbcfed30 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -474,7 +474,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous grid.getDragRectangle().y = cellRectangle.y; grid.getDragRectangle().height = cellRectangle.height; } else { - grid.getDragRectangle().y = cellRectangle.y; + grid.getDragRectangle().y = selectedCellPoint.getRow(); grid.getDragRectangle().height = cellRectangle.y - selectedCellPoint.getRow() + cellRectangle.height; } } diff --git a/designer-realize/src/main/java/com/fr/grid/IntelliElements.java b/designer-realize/src/main/java/com/fr/grid/IntelliElements.java index ca1ed55d8a..8234485539 100644 --- a/designer-realize/src/main/java/com/fr/grid/IntelliElements.java +++ b/designer-realize/src/main/java/com/fr/grid/IntelliElements.java @@ -183,42 +183,40 @@ public class IntelliElements { } - public void doIntelliAction() { - for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) { - for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex++) { - TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex); + public abstract void doIntelliAction(); - if (sourceCellElement == null) { - sourceCellElement = new DefaultTemplateCellElement(); - } - TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); - applyStyle(newCellElement, sourceCellElement);//style - if (sourceCellElement.getValue() instanceof DSColumn) { - try{ - DSColumn dsColumn = (DSColumn)((DSColumn) sourceCellElement.getValue()).clone(); - newCellElement.setValue(dsColumn); - }catch (CloneNotSupportedException e){ - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); - } else if (sourceCellElement.getValue() instanceof Number) { - newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); - } else if (sourceCellElement.getValue() instanceof BaseFormula) { - BaseFormula formula = (BaseFormula) sourceCellElement.getValue(); - formula = this.generateSimpleFormula(formula, 1); - newCellElement.setValue(formula); - } else { - try { - //richer:不改变原单元格 - newCellElement.setValue(BaseUtils.cloneObject(sourceCellElement.getValue())); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } + public void expandCellValue(int colIndex, int rowIndex) { + TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex); - report.addCellElement(newCellElement); + if (sourceCellElement == null) { + sourceCellElement = new DefaultTemplateCellElement(); + } + TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); + applyStyle(newCellElement, sourceCellElement);//style + if (sourceCellElement.getValue() instanceof DSColumn) { + try{ + DSColumn dsColumn = (DSColumn)((DSColumn) sourceCellElement.getValue()).clone(); + newCellElement.setValue(dsColumn); + }catch (CloneNotSupportedException e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); + } else if (sourceCellElement.getValue() instanceof Number) { + newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); + } else if (sourceCellElement.getValue() instanceof BaseFormula) { + BaseFormula formula = (BaseFormula) sourceCellElement.getValue(); + formula = this.generateSimpleFormula(formula, 1); + newCellElement.setValue(formula); + } else { + try { + //richer:不改变原单元格 + newCellElement.setValue(BaseUtils.cloneObject(sourceCellElement.getValue())); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } + + report.addCellElement(newCellElement); } protected abstract int getStartColumnIndex(); @@ -328,6 +326,15 @@ public class IntelliElements { }; } + @Override + public void doIntelliAction() { + for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex ++) { + for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) { + expandCellValue(colIndex, rowIndex); + } + } + } + @Override public boolean havetoModify() { return IntelliElements.this.dragCellRectangle.width > IntelliElements.this.oldCellRectangle.width; @@ -397,34 +404,43 @@ public class IntelliElements { }; } + @Override + public void doIntelliAction() { + for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex > colEnd; colIndex --) { + for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) { + expandCellValue(colIndex, rowIndex); + } + } + } + @Override public boolean havetoModify() { return true; } @Override - public int getStartRowIndex() { + public int getStartRowIndex() { return IntelliElements.this.oldCellRectangle.y; } @Override - public int getEndRowIndex() { + public int getEndRowIndex() { return IntelliElements.this.oldCellRectangle.y + IntelliElements.this.oldCellRectangle.height; } @Override - public int getStartColumnIndex() { - return IntelliElements.this.dragCellRectangle.x; + public int getStartColumnIndex() { + return IntelliElements.this.oldCellRectangle.x - 1; } @Override - public int getEndColumnIndex() { - return IntelliElements.this.oldCellRectangle.x; + public int getEndColumnIndex() { + return IntelliElements.this.dragCellRectangle.x - 1; } @Override public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) { - return report.getTemplateCellElement(IntelliElements.this.oldCellRectangle.x + (columnIndex - IntelliElements.this.dragCellRectangle.x) % (IntelliElements.this.oldCellRectangle.width), rowIndex); + return report.getTemplateCellElement(columnIndex + IntelliElements.this.oldCellRectangle.width, rowIndex); } @Override @@ -465,6 +481,15 @@ public class IntelliElements { }; } + @Override + public void doIntelliAction() { + for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex ++) { + for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) { + expandCellValue(colIndex, rowIndex); + } + } + } + @Override public boolean havetoModify() { return IntelliElements.this.dragCellRectangle.height > IntelliElements.this.oldCellRectangle.height; @@ -534,33 +559,42 @@ public class IntelliElements { } @Override - public boolean havetoModify() { + public void doIntelliAction() { + for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) { + for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex > rowEnd; rowIndex--) { + expandCellValue(colIndex, rowIndex); + } + } + } + + @Override + public boolean havetoModify() { return true; } @Override - public int getStartRowIndex() { - return IntelliElements.this.dragCellRectangle.y; + public int getStartRowIndex() { + return IntelliElements.this.oldCellRectangle.y - 1; } @Override - public int getEndRowIndex() { - return IntelliElements.this.oldCellRectangle.y; + public int getEndRowIndex() { + return IntelliElements.this.dragCellRectangle.y - 1; } @Override - public int getStartColumnIndex() { + public int getStartColumnIndex() { return IntelliElements.this.oldCellRectangle.x; } @Override - public int getEndColumnIndex() { + public int getEndColumnIndex() { return IntelliElements.this.oldCellRectangle.x + IntelliElements.this.oldCellRectangle.width; } @Override public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) { - return report.getTemplateCellElement(columnIndex, IntelliElements.this.oldCellRectangle.y + (rowIndex - IntelliElements.this.dragCellRectangle.y) % (IntelliElements.this.oldCellRectangle.height)); + return report.getTemplateCellElement(columnIndex, rowIndex + IntelliElements.this.oldCellRectangle.height); } @Override From 0e6cffac44b92354f0ba30adba207cdbd1dda021 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 12 Jul 2021 09:55:50 +0800 Subject: [PATCH 069/100] =?UTF-8?q?REPORT-54122=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E5=BC=B9=E7=AA=97=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/images/control/edit_lock.png | Bin 0 -> 255 bytes .../fr/design/images/control/edit_unlock.png | Bin 0 -> 220 bytes .../designer/creator/SelectedBorderIcon.java | 47 ----- .../fr/design/designer/creator/XCreator.java | 22 +- .../design/designer/ui/PopupControlPanel.java | 193 ++++++++++++++++++ .../designer/ui/SelectedPopupDialog.java | 36 ++++ .../fr/design/mainframe/FormDesignerUI.java | 5 +- 7 files changed, 247 insertions(+), 56 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png delete mode 100644 designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java diff --git a/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png b/designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png new file mode 100644 index 0000000000000000000000000000000000000000..6168d9a98ea8b35b5b03f8610c79af1c2fdcba55 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5M?jcysy3fAP;jHC zi(`mI@7oCrxtJV9T;HEiN}6zV$H_$b{FCmxGhE(eqgSYx!I!2Hgh z*-1+!8Ce4u%@?p{JuvzHE%?W&5Z!=d4Cmx_Ft96pXJhc?N%-+sqGD!sxk4n<61(L8 zFDICMxvw`VCGBt0S%>?ta~L-~WGI>R?V_V`^wNX!8<-UC9BE&2cYT96!?ET7NArt? QK$kIiy85}Sb4q9e0M}Gd*#H0l literal 0 HcmV?d00001 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java b/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java deleted file mode 100644 index fe2d839b96..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/creator/SelectedBorderIcon.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fr.design.designer.creator; - -import com.fr.design.form.util.XCreatorConstants; -import com.fr.general.IOUtils; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Rectangle; - -/** - * @author hades - * @version 10.0 - * Created by hades on 2021/06/30 - */ -public class SelectedBorderIcon { - - private static final Image EDIT_ICON = IOUtils.readImage("/com/fr/design/images/control/show_edit.png"); - private static final Image SETTING_ICON = IOUtils.readImage("/com/fr/design/images/control/show_setting.png"); - private static final float ALPHA = 0.7F; - private static final int TIP_WIDTH = 20; - private static final int TIP_HEIGHT = 40; - private static final int ARC_VALUE = 4; - // 组件到整个提示之间的空隙 - private static final int CREATOR_TO_TIP_GAP = 5; - // icon在整个提示背景下缩进 - private static final int TIP_ICON_GAP = 2; - - /** - * 在bounds范围的右上角绘制特定图标 - * - * @param g - * @param bounds - */ - public void paint(Graphics g, Rectangle bounds) { - Graphics2D g2d = (Graphics2D) g; - AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ALPHA); - g2d.setColor(XCreatorConstants.EDIT_COLOR); - g2d.setComposite(alphaComposite); - g2d.fillRoundRect(bounds.x + bounds.width + CREATOR_TO_TIP_GAP, bounds.y, TIP_WIDTH, TIP_HEIGHT, ARC_VALUE, ARC_VALUE); - g2d.drawImage(EDIT_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_ICON_GAP, EDIT_ICON.getWidth(null), EDIT_ICON.getHeight(null), null); - g2d.drawImage(SETTING_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + CREATOR_TO_TIP_GAP + EDIT_ICON.getHeight(null), SETTING_ICON.getWidth(null), SETTING_ICON.getHeight(null), null); - g2d.setColor(Color.WHITE); - g2d.drawLine(bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_WIDTH, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP + EDIT_ICON.getWidth(null), bounds.y + TIP_WIDTH); - } -} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 7220eafe8b..7f76eb3852 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.ui.SelectedPopupDialog; import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.imenu.UIPopupMenu; @@ -25,6 +26,7 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; +import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -70,7 +72,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 // 当前组件是否处在选中状态 private boolean selected; - private SelectedBorderIcon selectedBorderIcon = new SelectedBorderIcon(); + private SelectedPopupDialog popup; private static final int SHORTS_SEPARATOR_POS = 4; // 弹出菜单分割的位置 public XCreator(Widget ob, Dimension initSize) { @@ -764,15 +766,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } /** - * 绘制选中时右上边框图标 + * 选中时右侧展示小弹窗 * - * @param g + * @param designer * @param bounds */ - public void paintSelectedBorderIcon(Graphics g, Rectangle bounds) { - if (selected) { - selectedBorderIcon.paint(g, bounds); + public void showSelectedPopup(FormDesigner designer, Rectangle bounds, boolean accept) { + if (popup == null) { + popup = new SelectedPopupDialog(this, designer); } + int extraX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale()); + int extraY = (int) (bounds.y * designer.getScale()); + popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); + popup.setVisible(selected && accept); + popup.setRelativeBounds(bounds); } /** @@ -818,6 +825,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void setSelected(boolean selected) { this.selected = selected; + if (popup != null && !selected) { + popup.setVisible(false); + } } } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java new file mode 100644 index 0000000000..a2e8992083 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -0,0 +1,193 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.CoverReportPane; +import com.fr.design.mainframe.EditingMouseListener; +import com.fr.design.mainframe.FormDesigner; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.AbstractButton; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/7/8 + */ +public class PopupControlPanel extends JPanel { + + private static final int ARC_VALUE = 4; + private static final Color FILLED_COLOR = new Color(60, 63, 65); + private static final int V_GAP = 10; + private static final int H_GAP = 2; + + private Dimension defaultDimension = new Dimension(20, 60); + private Rectangle rectangle; + private final JButton editButton; + private final JButton settingButton; + private final JToggleButton toggleButton; + private final XCreator creator; + private final UILabel firstLabel; + private final UILabel secondLabel; + + public PopupControlPanel(XCreator creator, FormDesigner designer) { + FineLoggerFactory.getLogger().error("shared: {}", creator.isShared()); + if (creator.isShared()) { + defaultDimension = new Dimension(20, 85); + } + setLayout(getCustomLayout()); + this.creator = creator; + editButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_edit.png"), Toolkit.i18nText("Fine-Design_Form_Edit_Widget")); + editButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + int x = rectangle.x + rectangle.width / 2; + int y = rectangle.y + rectangle.height / 2; + XCreator childCreator = PopupControlPanel.this.creator.getEditingChildCreator(); + MouseListener[] listeners = designer.getMouseListeners(); + if (ArrayUtils.isNotEmpty(listeners) && listeners[0] instanceof EditingMouseListener) { + childCreator.respondClick(((EditingMouseListener) listeners[0]), new MouseEvent(childCreator, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), x, y, 2, false)); + } + } + }); + settingButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_setting.png"), Toolkit.i18nText("Fine-Design_Share_Help_Settings")); + + settingButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + CoverReportPane.showShareConfig(creator.toData()); + } + }); + toggleButton = new JToggleButton(IOUtils.readIcon("/com/fr/design/images/control/edit_lock.png")); + initButtonStyle(toggleButton); + toggleButton.setSelectedIcon(IOUtils.readIcon("com/fr/design/images/control/edit_unlock.png")); + toggleButton.setToolTipText(Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio")); + toggleButton.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JToggleButton toggleBtn = (JToggleButton) e.getSource(); + String toolTipText = toggleBtn.isSelected() ? Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio") : Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio"); + toggleBtn.setToolTipText(toolTipText); + } + }); + + firstLabel = createLabel(); + secondLabel = createLabel(); + + add(editButton); + add(toggleButton); + add(settingButton); + add(firstLabel); + add(secondLabel); + } + + protected LayoutManager getCustomLayout() { + return new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return defaultDimension; + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getPreferredSize().width; + int buttonWidth = editButton.getPreferredSize().width; + int buttonHeight = editButton.getPreferredSize().height; + int x = (width - buttonWidth) / 2; + editButton.setBounds(x, V_GAP, buttonWidth, buttonHeight); + firstLabel.setBounds(x, V_GAP + editButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); + toggleButton.setBounds(x, V_GAP * 2 + editButton.getHeight(), buttonWidth, buttonHeight); + if (creator.isShared()) { + secondLabel.setBounds(x, V_GAP * 2 + editButton.getHeight() + toggleButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); + settingButton.setBounds(x, V_GAP * 3 + editButton.getHeight() + toggleButton.getHeight(), buttonWidth, buttonHeight); + } + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } + + private JButton createNormalButton(Icon icon, String toolTipText) { + JButton button = new JButton(icon); + initButtonStyle(button); + button.setToolTipText(toolTipText); + return button; + } + + private void initButtonStyle(AbstractButton button) { + button.setBorderPainted(false); + button.setBorder(null); + button.setMargin(new Insets(0, 0, 0, 0)); + button.setContentAreaFilled(false); + } + + private UILabel createLabel() { + return new UILabel() { + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(Color.WHITE); + g2d.drawLine(H_GAP, 0, toggleButton.getWidth() - H_GAP, 0); + + } + }; + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + int w = this.getWidth(); + int h = this.getHeight(); + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setColor(FILLED_COLOR); + g2d.fillRoundRect(0, 0, w - 1, h - 1, ARC_VALUE, ARC_VALUE); + g2d.setColor(Color.WHITE); + g2d.drawRoundRect(0, 0, w - 1, h - 1, ARC_VALUE, ARC_VALUE); + } + + public Dimension getDefaultDimension() { + return defaultDimension; + } + + public void setRelativeBounds(Rectangle rectangle) { + this.rectangle = rectangle; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java new file mode 100644 index 0000000000..e7de926793 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -0,0 +1,36 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import java.awt.Rectangle; +import javax.swing.JDialog; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/7/09 + */ +public class SelectedPopupDialog extends JDialog { + + /** + * 弹窗的相对组件的偏移 + */ + public static final int OFFSET_X = 5; + + private final PopupControlPanel controlPanel; + + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { + super(DesignerContext.getDesignerFrame()); + this.setUndecorated(true); + this.setModal(false); + controlPanel = new PopupControlPanel(creator, designer); + this.getContentPane().add(controlPanel); + this.setSize(controlPanel.getDefaultDimension()); + } + + public void setRelativeBounds(Rectangle rectangle) { + this.controlPanel.setRelativeBounds(rectangle); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 8df27c19fe..c49902c8d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -13,6 +13,7 @@ import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.ComponentUtils; @@ -325,9 +326,7 @@ public class FormDesignerUI extends ComponentUI { } creator.paintBorder(g, creatorBounds); // 拖拽时不绘制 - if (!designer.getStateModel().isDragging()) { - creator.paintSelectedBorderIcon(g, creatorBounds); - } + creator.showSelectedPopup(designer, creatorBounds, !designer.getStateModel().isDragging() && creator.acceptType(XWTitleLayout.class)); } } From cc92aac234c731dd818c0f43b2993c0c87d4b6f4 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 12 Jul 2021 09:58:06 +0800 Subject: [PATCH 070/100] =?UTF-8?q?REPORT-54122=20fix=20=E6=97=A0=E7=94=A8?= =?UTF-8?q?import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/designer/creator/XCreator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 7f76eb3852..80bf1b51d8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -26,7 +26,6 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; -import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; From f144baf9cabe638ce3025cb6c3f248b1576bad23 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 12 Jul 2021 10:05:36 +0800 Subject: [PATCH 071/100] =?UTF-8?q?REPORT-54122=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E5=BC=B9=E7=AA=97=E6=94=B9=E8=BF=9B=20?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/ui/PopupControlPanel.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index a2e8992083..b8133d3dac 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -7,7 +7,6 @@ import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import java.awt.Color; import java.awt.Component; @@ -54,7 +53,6 @@ public class PopupControlPanel extends JPanel { private final UILabel secondLabel; public PopupControlPanel(XCreator creator, FormDesigner designer) { - FineLoggerFactory.getLogger().error("shared: {}", creator.isShared()); if (creator.isShared()) { defaultDimension = new Dimension(20, 85); } From d1e2aa982b3e3d0d9d8dddd5626a9c004d36fd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 12 Jul 2021 10:54:35 +0800 Subject: [PATCH 072/100] =?UTF-8?q?CHART-19488=20=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=BD=B4=E7=9A=84=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=88=90=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/style/axis/VanChartTimeAxisPane.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java index f960b4aff7..1a0b78982f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java @@ -293,7 +293,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString)); - timeAxis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString)); + timeAxis.setMinValue(createDataFormula(dateString)); } } else { timeAxis.setCustomMinValue(false); @@ -308,7 +308,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString)); - timeAxis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString)); + timeAxis.setMaxValue(createDataFormula(dateString)); } } else { timeAxis.setCustomMaxValue(false); @@ -332,6 +332,11 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { checkBoxUse(); } + private BaseFormula createDataFormula(String dateString) { + String formulaString = "\"" + dateString + "\""; + return BaseFormula.createFormulaBuilder().build(formulaString); + } + public void populate(VanChartTimeAxis timeAxis){ // 最小值 if (timeAxis.isCustomMinValue() && timeAxis.getMinValue() != null) { From 783f0b7043e7bc41e680456d82573d5a833f6a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 12 Jul 2021 14:00:53 +0800 Subject: [PATCH 073/100] =?UTF-8?q?REPORT-54998=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E6=8B=93=E5=B1=95=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/IntelliElements.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/IntelliElements.java b/designer-realize/src/main/java/com/fr/grid/IntelliElements.java index 8234485539..e53e8b9522 100644 --- a/designer-realize/src/main/java/com/fr/grid/IntelliElements.java +++ b/designer-realize/src/main/java/com/fr/grid/IntelliElements.java @@ -445,7 +445,7 @@ public class IntelliElements { @Override protected Number processNumber(Number i) { - return i; + return FunctionHelper.asNumber(i.doubleValue() - 1); } @Override @@ -599,7 +599,7 @@ public class IntelliElements { @Override protected Number processNumber(Number i) { - return i; + return FunctionHelper.asNumber(i.doubleValue() - 1); } @Override From 0915d4d927af752e692330686f37dd0bee15efe5 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:38:14 +0800 Subject: [PATCH 074/100] =?UTF-8?q?REPORT-55107=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=83=8C=E6=99=AF=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=20=E8=BE=B9=E6=A1=86=E9=80=89=E6=8B=A9=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=9B=BE=E7=89=87=E6=97=B6=EF=BC=8C=E4=B8=8B?= =?UTF-8?q?=E6=96=B9=E5=BA=94=E5=87=BA=E7=8E=B0=E4=B8=8D=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E5=BA=A6=E8=AE=BE=E7=BD=AE=EF=BC=8C=E7=9B=AE=E5=89=8D=E6=B2=A1?= =?UTF-8?q?=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 rowSize设置错误,导致透明度设置项高度为0 【改动思路】 【review建议】 --- .../java/com/fr/design/gui/xpane/BorderLineAndImagePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 27c045459d..c2eefd3faa 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -146,7 +146,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private JPanel createBorderImageComposePane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p, p, p, p}; double[] columnSize = {SETTING_LABEL_WIDTH, f}; JPanel borderedImagePreviewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); From ea6cec84582bee5115728f4b593d69c0a9c1403d Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:38:43 +0800 Subject: [PATCH 075/100] =?UTF-8?q?REPORT-55108=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=BE=B9=E6=A1=86=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BE=E7=89=87=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E8=BF=98=E6=B2=A1=E5=85=B7=E4=BD=93=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=9F=90=E5=BC=A0=E5=9B=BE=E7=89=87=E6=97=B6=EF=BC=8C=E6=AD=A4?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E7=82=B9=E4=B9=9D=E5=9B=BE=E5=A1=AB=E5=85=85?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=8C=89=E9=92=AE=E5=BA=94=E8=AF=A5=E5=85=88?= =?UTF-8?q?=E7=81=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 原交互稿上没有灰化的逻辑,补充下 【改动思路】 【review建议】 --- .../java/com/fr/design/gui/xpane/BorderLineAndImagePane.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index c2eefd3faa..d704634197 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -219,6 +219,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } if (!borderLineCombo.isSelectedBorderImage()) { imagePreviewPane.setImageWithSuffix(null); + tweakNinePointButton.setEnabled(false); } fireStateChanged(); @@ -244,6 +245,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { ninePointLeft = ninePointRight = (image != null ? image.getWidth(null) / 3 : -1); ninePointTop = ninePointBottom = (image != null ? image.getHeight(null) / 3 : -1); borderImageOpacityPane.populateBean(1.0); + if (image != null) { + tweakNinePointButton.setEnabled(true); + } fireStateChanged(); } @@ -285,6 +289,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { if (image != null) { this.borderLineCombo.selectBorderImage(); this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix()); + this.tweakNinePointButton.setEnabled(true); this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity()); if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] > 0 && ninePoint[1] > 0 && ninePoint[2] > 0 && ninePoint[3] > 0) { ninePointLeft = ninePoint[0]; From 5b349728960c7ce1287f0b3c9ccb88473e4d7edf Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:39:10 +0800 Subject: [PATCH 076/100] =?UTF-8?q?REPORT-55112=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=82=B9=E4=B9=9D=E5=9B=BE?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E8=AE=BE=E7=BD=AE=E5=BC=B9=E7=AA=97=EF=BC=8C?= =?UTF-8?q?=E5=88=86=E5=89=B2=E7=BA=BF=E6=8B=96=E6=8B=BD=E5=88=B0=E9=9D=A0?= =?UTF-8?q?=E8=BF=91=E8=BE=B9=E7=BC=98=E6=97=B6=EF=BC=8C=E5=83=8F=E7=B4=A0?= =?UTF-8?q?=E5=80=BC=E5=B0=B1=E8=A2=AB=E9=81=AE=E6=8C=A1=E7=9C=8B=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 右侧分割线位置信息的计算位置不对,需要重新整理下 【改动思路】 【review建议】 --- .../gui/xpane/BorderLineAndImagePane.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index d704634197..675140d774 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -494,28 +494,33 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int scaleRight = (int) (ninePointRight * scale); int scaleBottom = (int) (ninePointBottom * scale); + double topYInPane = scaleImgY + scaleTop; + double bottomYInPane = scaleImgY + scaleImgHeight - scaleBottom; + double leftXInPane = scaleImgX + scaleLeft; + double rightXInPane = scaleImgX + scaleImgWidth - scaleRight; + g2d.setColor(PATCH_COLOR); // draw horizontal patch - GraphDrawHelper.fillRect(g2d, 0, scaleImgY + scaleTop, getWidth(), scaleImgHeight - scaleTop - scaleBottom); + GraphDrawHelper.fillRect(g2d, 0, topYInPane, getWidth(), scaleImgHeight - scaleTop - scaleBottom); // draw vertical patch GraphDrawHelper.fillRect(g2d, scaleImgX + scaleLeft, 0,scaleImgWidth - scaleLeft - scaleRight, getHeight()); g2d.setColor(DIVIDER_COLOR); // draw top divider - GraphDrawHelper.drawLine(g2d, 0, scaleImgY + scaleTop, getWidth(), scaleImgY + scaleTop); + GraphDrawHelper.drawLine(g2d, 0, topYInPane, getWidth(), topYInPane); // draw bottom divider - GraphDrawHelper.drawLine(g2d, 0, scaleImgY + scaleImgHeight - scaleBottom, getWidth(), scaleImgY + scaleImgHeight - scaleBottom); + GraphDrawHelper.drawLine(g2d, 0, bottomYInPane, getWidth(), bottomYInPane); // draw left divider - GraphDrawHelper.drawLine(g2d, scaleImgX + scaleLeft, 0, scaleImgX + scaleLeft, getHeight()); + GraphDrawHelper.drawLine(g2d, leftXInPane, 0, leftXInPane, getHeight()); // draw right divider - GraphDrawHelper.drawLine(g2d, scaleImgX + scaleImgWidth - scaleRight, 0, scaleImgX + scaleImgWidth - scaleRight, getHeight()); + GraphDrawHelper.drawLine(g2d, rightXInPane, 0, rightXInPane, getHeight()); g2d.setColor(TEXT_COLOR); // draw nine point info - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointTop), scaleImgX + (scaleImgWidth + scaleLeft - scaleRight) / 2.0, (scaleImgY + scaleTop) / 2.0); - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointBottom), scaleImgX + scaleLeft + (scaleImgWidth - scaleLeft - scaleRight) / 2.0, scaleImgY + scaleImgHeight - (scaleBottom - PADDING) / 2.0); - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointLeft), (scaleImgX + scaleLeft) / 2.0, scaleImgY + (scaleImgHeight + scaleTop - scaleBottom) / 2.0); - GraphDrawHelper.drawString(g2d, Integer.toString(ninePointRight), scaleImgX + scaleImgWidth - (scaleRight - PADDING) / 2.0, scaleImgY + (scaleImgHeight + scaleTop - scaleBottom) / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointTop), (leftXInPane + rightXInPane) / 2.0F, topYInPane / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointBottom), (leftXInPane + rightXInPane) / 2.0F, (bottomYInPane + getHeight()) / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointLeft), leftXInPane / 2.0, (topYInPane + bottomYInPane) / 2.0); + GraphDrawHelper.drawString(g2d, Integer.toString(ninePointRight), (rightXInPane + getWidth()) / 2.0, (topYInPane + bottomYInPane) / 2.0); } @Override From e03d83488889633045d6a8891cafd472de755441 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:39:27 +0800 Subject: [PATCH 077/100] =?UTF-8?q?REPORT-55114=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=82=B9=E4=B9=9D=E5=9B=BE?= =?UTF-8?q?=E5=88=86=E5=89=B2=E7=BA=BF=E6=8B=96=E5=8A=A8=E5=88=B0=E8=BE=B9?= =?UTF-8?q?=E7=BC=98=E6=97=B6=EF=BC=8C=E5=B0=B1=E6=97=A0=E6=B3=95=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E9=80=89=E4=B8=AD=E5=88=86=E5=89=B2=E7=BA=BF=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 整数计算导致的比例比较错误,图片在宽度上显示不全导致的 【改动思路】 【review建议】 --- .../java/com/fr/design/gui/xpane/BorderLineAndImagePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 675140d774..830853b33a 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -473,7 +473,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { int autoFixAreaX = PADDING; int autoFixAreaY = PADDING; - if (imgWidth / imgHeight > autoFixAreaWidth / autoFixAreaHeight) { + if ((imgWidth * 1.0F / imgHeight) > (autoFixAreaWidth * 1.0F / autoFixAreaHeight)) { scaleImgWidth = autoFixAreaWidth; scaleImgHeight = (int) (1.0F * scaleImgWidth * imgHeight / imgWidth); scaleImgX = autoFixAreaX; From e02bfda3e6a15e993f825d1f76d076d8cc977cbb Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:40:52 +0800 Subject: [PATCH 078/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 百分比控件值计算错误 --- .../main/java/com/fr/design/gui/frpane/UIPercentDragPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java index 1dd96de00a..a375420b0b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java @@ -25,6 +25,6 @@ public class UIPercentDragPane extends JPanel { } public double updateBean() { - return dragPane.updateBean() * 100; + return dragPane.updateBean() / 100.0; } } From dc456b1b5f930f126f39ae98b4736e94b28bd4f8 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:41:19 +0800 Subject: [PATCH 079/100] =?UTF-8?q?REPORT-55089=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E5=9B=BE=E6=A1=88?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=9B=BE=EF=BC=8C?= =?UTF-8?q?=E5=92=8C=E4=BA=A4=E4=BA=92=E6=96=87=E6=A1=A3=E9=87=8C=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=82=AC=E6=B5=AE=E6=97=B6=E5=87=BA=E7=8E=B0=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E5=92=8C=E4=B8=8D=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E9=81=AE=E7=BD=A9=E9=A2=84=E6=9C=9F=E6=95=88=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 交互补充遮罩层 【改动思路】 【review建议】 --- .../com/fr/design/gui/xpane/TitleInsetImagePane.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index b7161cbfb1..6b5391fb1d 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -47,6 +47,7 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; private final int DELETE_BUTTON_SIZE = 24; private final int IMAGE_PREVIEW_SIZE = 145; + private final Color IMAGE_PREVIEW_OVERLAY_COLOR = new Color(255, 255, 255, 51); private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); private final int DEFAULT_INSET_LOCATION_INDEX = 0; private final int DEFAULT_INSET_PADDING = 10; @@ -88,17 +89,24 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { deletableImagePreviewPane.setLayout(null); deletableImagePreviewPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); deletableImagePreviewPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE)); + JPanel overlayPane = new JPanel(); + overlayPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2)); + overlayPane.setBackground(IMAGE_PREVIEW_OVERLAY_COLOR); imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); + overlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE); deletableImagePreviewPane.add(imageDeleteButton, 0); - deletableImagePreviewPane.add(imagePreviewPane, 1); + deletableImagePreviewPane.add(overlayPane, 1); + deletableImagePreviewPane.add(imagePreviewPane, 2); + overlayPane.setVisible(false); imageDeleteButton.setVisible(false); imageDeleteButton.setEnabled(false); deletableImagePreviewPane.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { super.mouseEntered(e); + overlayPane.setVisible(true); imageDeleteButton.setVisible(true); imageDeleteButton.setEnabled(true); } @@ -109,6 +117,7 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { int x = e.getX(); int y = e.getY(); if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { + overlayPane.setVisible(false); imageDeleteButton.setVisible(false); imageDeleteButton.setEnabled(false); } From 0102122dbdf31f233d77675ec0d554c8dd0e81a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 12 Jul 2021 14:47:21 +0800 Subject: [PATCH 080/100] =?UTF-8?q?CHART-19871=20=E5=A4=A7=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/van/chart/designer/PlotFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index 4ceeab5485..3b76130933 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -423,7 +423,7 @@ public class PlotFactory { //大数据模式 恢复用注释。删除下面2个方法 largeDataModel lineMapLargeModel。 public static boolean largeDataModel(Plot plot) { - return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; + return plot != null && plot.isLargeDataModel(); } public static boolean lineMapLargeModel(Plot plot) { From dfb56cb2ec65bc17c8e9208d0d000ae654901f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 12 Jul 2021 14:47:59 +0800 Subject: [PATCH 081/100] =?UTF-8?q?CHART-19834=20svg=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/editor/editor/Editor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/Editor.java b/designer-base/src/main/java/com/fr/design/editor/editor/Editor.java index b4e885d1b7..d80e3d730e 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/Editor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/Editor.java @@ -4,6 +4,7 @@ package com.fr.design.editor.editor; import com.fr.base.BaseUtils; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -34,6 +35,9 @@ public abstract class Editor extends JComponent { // 约定图片的文件名为this.getName(),处理起来方便些 // b:这里国际化没有考虑 public Icon getIcon() { + if (StringUtils.isEmpty(this.getIconName())) { + return null; + } String iconName = "com/fr/design/images/buttonicon/" + this.getIconName() + ".png"; try { return BaseUtils.readIcon(iconName); From c83ade528924a90d9e815bb1d7634663ccbc92a4 Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 12 Jul 2021 14:57:19 +0800 Subject: [PATCH 082/100] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E5=B1=8F=E8=94=BD=E4=B8=80=E4=B8=8B=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=9C=A8=E7=BB=B4=E6=8A=A4=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/CheckServiceDialog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java index fb1adae6fe..441a1fdecd 100644 --- a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -167,7 +167,8 @@ public class CheckServiceDialog extends JDialog implements ActionListener { centerPanel.add(detailsPane, BorderLayout.CENTER); JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); - if (isOnline()) { + boolean Sync = false; + if (isOnline() && Sync) { ignoreButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_Ignore")); ignoreButton.addActionListener(this); syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local")); @@ -183,8 +184,6 @@ public class CheckServiceDialog extends JDialog implements ActionListener { buttonPanel.add(progressBar, BorderLayout.CENTER); buttonPanel.add(syncButton, BorderLayout.EAST); } else { - UILabel adviceLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Sync_Suggestion")); - centerPanel.add(adviceLabel, BorderLayout.SOUTH); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); okButton.addActionListener(this); buttonPanel.add(okButton, BorderLayout.EAST); From e4fe8267847615ecd0549f4b1691ce9a35c0db55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 12 Jul 2021 18:06:54 +0800 Subject: [PATCH 083/100] =?UTF-8?q?REPORT-54998=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E8=BF=99=E8=BE=B9=E7=9A=84=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BD=BF=E5=85=B6=E6=9B=B4=E5=8A=A0?= =?UTF-8?q?=E6=B8=85=E6=99=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/grid/GridMouseAdapter.java | 153 ++++++++++++++---- 1 file changed, 118 insertions(+), 35 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 55bbcfed30..da2f6f1743 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -46,6 +46,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private static final int TOOLTIP_X_Y_FIX = 4; private static final double COPY_CROSS_INNER_DISTANCE = 1.5; private static final double COPY_CROSS_OUTER_DISTANCE = 2.5; + private static final int DIRECTION_UP = 1; + private static final int DIRECTION_DOWN = 2; + private static final int DIRECTION_LEFT = 3; + private static final int DIRECTION_RIGHT = 4; /** * 拖拽时候刷新时间间隔 */ @@ -457,48 +461,127 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) { grid.getDragRectangle().setBounds(cellRectangle); } else { + if (isOutECBlockPane(evtX, evtY)) { + return; + } int xDistance = evtX - this.oldEvtX; int yDistance = evtY - this.oldEvtY; - if (Math.abs(yDistance) > Math.abs(xDistance)) { - grid.getDragRectangle().x = cellRectangle.x; - grid.getDragRectangle().width = cellRectangle.width; - if (yDistance >= 0) { - // 聚合报表要求拖拽的时候要在本块的内部进行 不能无限往下拖 - if (reportPane instanceof ECBlockPane && evtY > reportPane.getBounds().height - ECBlockGap) { - return; - } - grid.getDragRectangle().y = cellRectangle.y; - grid.getDragRectangle().height = selectedCellPoint.getRow() - cellRectangle.y + 1; + int dragDirection = calculateDragDirection(xDistance, yDistance); + grid.getDragRectangle().x = calculateDragRectangleX(selectedCellPoint, cellRectangle, dragDirection); + grid.getDragRectangle().y = calculateDragRectangleY(selectedCellPoint, cellRectangle, dragDirection); + grid.getDragRectangle().width = calculateDragRectangleWidth(selectedCellPoint, cellRectangle, dragDirection); + grid.getDragRectangle().height = calculateDragRectangleHeight(selectedCellPoint, cellRectangle, dragDirection); + } + reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow() + 1); + } + + private int calculateDragDirection(int xDistance, int yDistance) { + if (Math.abs(yDistance) > Math.abs(xDistance)) { + if (yDistance >= 0) { + return DIRECTION_DOWN; + } else { + return DIRECTION_UP; + } + } else { + if (xDistance >= 0) { + return DIRECTION_RIGHT; + } else { + return DIRECTION_LEFT; + } + } + } + + private int calculateDragRectangleX(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + int result = 0; + switch(direction) { + case DIRECTION_DOWN: + case DIRECTION_UP: + case DIRECTION_RIGHT: + result = startRec.x; + break; + case DIRECTION_LEFT: + if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { + result = startRec.x; } else { - if (selectedCellPoint.getRow() >= cellRectangle.y && selectedCellPoint.getRow() < cellRectangle.y + cellRectangle.height) { - grid.getDragRectangle().y = cellRectangle.y; - grid.getDragRectangle().height = cellRectangle.height; - } else { - grid.getDragRectangle().y = selectedCellPoint.getRow(); - grid.getDragRectangle().height = cellRectangle.y - selectedCellPoint.getRow() + cellRectangle.height; - } + result = currentMouseCell.getColumn(); } - } else { - grid.getDragRectangle().y = cellRectangle.y; - grid.getDragRectangle().height = cellRectangle.height; - if (xDistance >= 0) { - if (reportPane instanceof ECBlockPane && evtX > reportPane.getBounds().width - ECBlockGap) { - return; - } - grid.getDragRectangle().x = cellRectangle.x; - grid.getDragRectangle().width = selectedCellPoint.getColumn() - cellRectangle.x + 1; + break; + } + return result; + } + + private int calculateDragRectangleY(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + int result = 0; + switch(direction) { + case DIRECTION_RIGHT: + case DIRECTION_LEFT: + case DIRECTION_DOWN: + result = startRec.y; + break; + case DIRECTION_UP: + if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { + result = startRec.y; } else { - if (selectedCellPoint.getColumn() >= cellRectangle.x && selectedCellPoint.getColumn() < cellRectangle.x + cellRectangle.width) { - grid.getDragRectangle().x = cellRectangle.x; - grid.getDragRectangle().width = cellRectangle.width; - } else { - grid.getDragRectangle().x = selectedCellPoint.getColumn(); - grid.getDragRectangle().width = cellRectangle.x - selectedCellPoint.getColumn() + cellRectangle.width; - } + result = currentMouseCell.getRow(); } - } + break; } - reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow() + 1); + return result; + } + + private int calculateDragRectangleWidth(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + int result = 0; + switch(direction) { + case DIRECTION_DOWN: + case DIRECTION_UP: + result = startRec.width; + break; + case DIRECTION_RIGHT: + result = currentMouseCell.getColumn() - startRec.x + 1; + break; + case DIRECTION_LEFT: + if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { + result = startRec.width; + } else { + result = startRec.x - currentMouseCell.getColumn() + startRec.width; + } + break; + } + return result; + } + + private int calculateDragRectangleHeight(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + int result = 0; + switch(direction) { + case DIRECTION_DOWN: + result = currentMouseCell.getRow() - startRec.y + 1; + break; + case DIRECTION_UP: + if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { + result = startRec.y - currentMouseCell.getRow() + startRec.height; + } else { + result = startRec.height; + } + break; + case DIRECTION_RIGHT: + case DIRECTION_LEFT: + result = startRec.height; + break; + } + return result; + } + + private boolean isOutECBlockPane(int evtX, int evtY) { + ElementCasePane reportPane = grid.getElementCasePane(); + if (reportPane instanceof ECBlockPane) { + return (evtY > reportPane.getBounds().height - ECBlockGap) || (evtX > reportPane.getBounds().width - ECBlockGap); + } + return true; + } + + private boolean isInsideSelectedCell(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + return (direction == DIRECTION_UP && currentMouseCell.getRow() >= startRec.y && currentMouseCell.getRow() < startRec.y + startRec.height) || + (direction == DIRECTION_LEFT && currentMouseCell.getColumn() >= startRec.x && currentMouseCell.getColumn() < startRec.x + startRec.width); } private void doShiftSelectCell(double evtX, double evtY) { From 3f195ec59136ec51606f6502b7300cc1a5043f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 12 Jul 2021 18:42:59 +0800 Subject: [PATCH 084/100] =?UTF-8?q?REPORT-54998=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/grid/GridMouseAdapter.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index da2f6f1743..f09c34b07f 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -455,11 +455,11 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private void doWithCellElementDragged(int evtX, int evtY, CellSelection cs) { ElementCasePane reportPane = grid.getElementCasePane(); - java.awt.Rectangle cellRectangle = cs.toRectangle(); + java.awt.Rectangle startRec = cs.toRectangle(); - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); - if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) { - grid.getDragRectangle().setBounds(cellRectangle); + ColumnRow currentMouseCell = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); + if (startRec.contains(currentMouseCell.getColumn(), currentMouseCell.getRow())) { + grid.getDragRectangle().setBounds(startRec); } else { if (isOutECBlockPane(evtX, evtY)) { return; @@ -467,12 +467,12 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous int xDistance = evtX - this.oldEvtX; int yDistance = evtY - this.oldEvtY; int dragDirection = calculateDragDirection(xDistance, yDistance); - grid.getDragRectangle().x = calculateDragRectangleX(selectedCellPoint, cellRectangle, dragDirection); - grid.getDragRectangle().y = calculateDragRectangleY(selectedCellPoint, cellRectangle, dragDirection); - grid.getDragRectangle().width = calculateDragRectangleWidth(selectedCellPoint, cellRectangle, dragDirection); - grid.getDragRectangle().height = calculateDragRectangleHeight(selectedCellPoint, cellRectangle, dragDirection); + grid.getDragRectangle().x = calculateDragRectangleX(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().y = calculateDragRectangleY(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().width = calculateDragRectangleWidth(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().height = calculateDragRectangleHeight(currentMouseCell, startRec, dragDirection); } - reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow() + 1); + reportPane.ensureColumnRowVisible(currentMouseCell.getColumn() + 1, currentMouseCell.getRow() + 1); } private int calculateDragDirection(int xDistance, int yDistance) { From 2446db1e27359f62fd45c9dfa6a1585c16cedb9f Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Mon, 12 Jul 2021 20:02:02 +0800 Subject: [PATCH 085/100] =?UTF-8?q?REPORT-54853=20fetchsize=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=A1=AE=E5=AE=9A=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/DBCPAttrPane.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java index 58a021812c..f65b6dc128 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java @@ -42,6 +42,7 @@ public class DBCPAttrPane extends BasicPane { private static final int ORACLE_DEFAULT_FETCHSIZE = 128; private static final int DB2_DEFAULT_FETCHSIZE = 50; private static final int POSTGRE_DEFAULT_FETCHSIZE = 10000; + private static final int EMPTY_FETCHSIZE = -2; // carl:DBCP的一些属性 private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); @@ -125,7 +126,11 @@ public class DBCPAttrPane extends BasicPane { this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName()); if (fetchSize != null) { - this.FETCHSIZE.setText(jdbcDatabase.getFetchSize() == -1 ? String.valueOf(fetchSize) : String.valueOf(jdbcDatabase.getFetchSize())); + if (jdbcDatabase.getFetchSize() == EMPTY_FETCHSIZE) { + this.FETCHSIZE.setText(StringUtils.EMPTY); + } else { + this.FETCHSIZE.setText(jdbcDatabase.getFetchSize() == -1 ? String.valueOf(fetchSize) : String.valueOf(jdbcDatabase.getFetchSize())); + } } } @@ -149,7 +154,11 @@ public class DBCPAttrPane extends BasicPane { dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue()); Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName()); if (fetchSize != null) { - jdbcDatabase.setFetchSize(Integer.parseInt(this.FETCHSIZE.getText())); + if (StringUtils.isEmpty(this.FETCHSIZE.getText())) { + jdbcDatabase.setFetchSize(EMPTY_FETCHSIZE); + } else { + jdbcDatabase.setFetchSize(Integer.parseInt(this.FETCHSIZE.getText())); + } } } From 1a52132587fef7760809dea1b2a7f45d8ee63f6e Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 13 Jul 2021 11:11:59 +0800 Subject: [PATCH 086/100] =?UTF-8?q?REPORT-55070=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-tab=E5=9D=97=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E6=B2=A1=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/EditingMouseListener.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 00ba360bba..8a2bdcc6cc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -19,6 +19,7 @@ import com.fr.design.designer.creator.XEditorHolder; import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.cardlayout.XCardAddButton; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; @@ -623,7 +624,9 @@ public class EditingMouseListener extends MouseInputAdapter { creator = processTopLayoutMouseClick(creator); if (creator != null) { - if (e.getClickCount() == 1 && designer.getCursor().getType() != Cursor.HAND_CURSOR) { + // 点击不在tab块的button中 + boolean clickedNonCardButton = !creator.acceptType(XCardAddButton.class, XCardSwitchButton.class); + if (clickedNonCardButton && e.getClickCount() == 1 && designer.getCursor().getType() != Cursor.HAND_CURSOR) { setCoverPaneNotDisplay(creator, e, false); selectionModel.selectACreatorAtMouseEvent(e); refreshTopXCreator(); @@ -631,7 +634,7 @@ public class EditingMouseListener extends MouseInputAdapter { for (XCreator xCreator : xCreators) { xCreator.setSelected(true); } - } else if (responseTabLayout(oldCreator, e)) { + } else if (clickedNonCardButton && responseTabLayout(oldCreator, e)) { // do nothing } else { creator.respondClick(this, e); From 5d64f792797a4ac49f708a6ae8ad957e60e33811 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 14:42:18 +0800 Subject: [PATCH 087/100] =?UTF-8?q?REPORT-53175=E3=80=9010.0.18=E3=80=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E4=B8=BA?= =?UTF-8?q?=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 因为percentW/H是旧尺寸与新尺寸之间的比例,所以实现组件选择宽度和高度中较小的缩放比例的规则,需要使用Math.max --- .../java/com/fr/design/designer/creator/XWAbsoluteLayout.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 72bb2cb032..c6d0067c3a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -204,7 +204,8 @@ public class XWAbsoluteLayout extends XLayoutContainer { for (int index = 0, n = this.getComponentCount(); index < n; index++) { XCreator creator = (XCreator) this.getComponent(index); if (creator.toData().isAspectRatioLocked()) { - double percent = Math.min(percentW, percentH); + // 因为percentW/H是旧尺寸与新尺寸之间的比例,所以实现组件选择宽度和高度中较小的缩放比例的规则,需要使用Math.max + double percent = Math.max(percentW, percentH); percentW = percentH = percent; } BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); From d710e8c7f8adeee03da6618299f05d2193602bcf Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 18:01:14 +0800 Subject: [PATCH 088/100] =?UTF-8?q?REPORT-53175=20=E3=80=9010.0.18?= =?UTF-8?q?=E3=80=91=E7=BB=84=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E4=B8=BA=E6=A0=87=E9=A2=98/=E8=83=8C=E6=99=AF/=E8=BE=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 组件尺寸比例锁定提示及共享组件默认锁定尺寸比例锁定交互更新 【改动思路】 【review建议】 --- .../fr/design/designer/creator/XCreator.java | 1 + .../design/designer/ui/PopupControlPanel.java | 222 +++++++++++------- .../designer/ui/SelectedPopupDialog.java | 5 + .../mainframe/FormCreatorDropTarget.java | 5 + .../designer/component/WidgetBoundPane.java | 4 +- 5 files changed, 144 insertions(+), 93 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 80bf1b51d8..0983dded9b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -777,6 +777,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo int extraX = (int) ((bounds.x + bounds.width + SelectedPopupDialog.OFFSET_X) * designer.getScale()); int extraY = (int) (bounds.y * designer.getScale()); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); + popup.updatePane(designer); popup.setVisible(selected && accept); popup.setRelativeBounds(bounds); } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index b8133d3dac..ee0db4571d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -1,35 +1,27 @@ package com.fr.design.designer.ui; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; +import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.general.IOUtils; import com.fr.stable.ArrayUtils; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.LayoutManager; -import java.awt.Rectangle; -import java.awt.RenderingHints; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import javax.swing.AbstractButton; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JToggleButton; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; +import java.util.ArrayList; +import java.util.List; /** * @author hades @@ -40,25 +32,39 @@ public class PopupControlPanel extends JPanel { private static final int ARC_VALUE = 4; private static final Color FILLED_COLOR = new Color(60, 63, 65); - private static final int V_GAP = 10; - private static final int H_GAP = 2; + private static final int BUTTON_SIZE = 16; + private static final int BUTTON_MARGIN = 4; + private static final int PANE_WIDTH = BUTTON_SIZE + BUTTON_MARGIN * 2; // 24 - private Dimension defaultDimension = new Dimension(20, 60); + private final Dimension defaultDimension = new Dimension(PANE_WIDTH, 0); private Rectangle rectangle; + + private final List buttons = new ArrayList<>(); private final JButton editButton; private final JButton settingButton; private final JToggleButton toggleButton; private final XCreator creator; - private final UILabel firstLabel; - private final UILabel secondLabel; public PopupControlPanel(XCreator creator, FormDesigner designer) { - if (creator.isShared()) { - defaultDimension = new Dimension(20, 85); - } - setLayout(getCustomLayout()); + setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0)); + setBorder(BorderFactory.createEmptyBorder()); this.creator = creator; - editButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_edit.png"), Toolkit.i18nText("Fine-Design_Form_Edit_Widget")); + + editButton = createEditButton(designer); + toggleButton = createAspectRatioLockedButton(designer); + settingButton = createSettingButton(); + + addButton(editButton, 0); + addButton(toggleButton, 1); + addButton(settingButton, 2); + + setButtonVisible(editButton, true); + setButtonVisible(toggleButton, false); + setButtonVisible(settingButton, false); + } + + private JButton createEditButton(FormDesigner designer) { + JButton editButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_edit.png"), Toolkit.i18nText("Fine-Design_Form_Edit_Widget")); editButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -71,102 +77,99 @@ public class PopupControlPanel extends JPanel { } } }); - settingButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_setting.png"), Toolkit.i18nText("Fine-Design_Share_Help_Settings")); + return editButton; + } - settingButton.addActionListener(new ActionListener() { + private JToggleButton createAspectRatioLockedButton(FormDesigner designer) { + JToggleButton button = new JToggleButton(IOUtils.readIcon("/com/fr/design/images/control/edit_unlock.png")); + initButtonStyle(button); + button.setSelectedIcon(IOUtils.readIcon("com/fr/design/images/control/edit_lock.png")); + button.setToolTipText(Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio")); + button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - CoverReportPane.showShareConfig(creator.toData()); - } - }); - toggleButton = new JToggleButton(IOUtils.readIcon("/com/fr/design/images/control/edit_lock.png")); - initButtonStyle(toggleButton); - toggleButton.setSelectedIcon(IOUtils.readIcon("com/fr/design/images/control/edit_unlock.png")); - toggleButton.setToolTipText(Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio")); - toggleButton.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { JToggleButton toggleBtn = (JToggleButton) e.getSource(); - String toolTipText = toggleBtn.isSelected() ? Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio") : Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio"); + String toolTipText = toggleBtn.isSelected() ? Toolkit.i18nText("Fine-Design_Form_Lock_Widget_Ratio") : Toolkit.i18nText("Fine-Design_Form_UnLock_Widget_Ratio"); toggleBtn.setToolTipText(toolTipText); + creator.toData().setAspectRatioLocked(toggleBtn.isSelected()); + designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_RESIZED); } }); - - firstLabel = createLabel(); - secondLabel = createLabel(); - - add(editButton); - add(toggleButton); - add(settingButton); - add(firstLabel); - add(secondLabel); + return button; } - protected LayoutManager getCustomLayout() { - return new LayoutManager() { + private JButton createSettingButton() { + JButton settingButton = createNormalButton(IOUtils.readIcon("/com/fr/design/images/control/show_setting.png"), Toolkit.i18nText("Fine-Design_Share_Help_Settings")); + settingButton.addActionListener(new ActionListener() { @Override - public void removeLayoutComponent(Component comp) { + public void actionPerformed(ActionEvent e) { + CoverReportPane.showShareConfig(creator.toData()); } + }); + return settingButton; + } - @Override - public Dimension preferredLayoutSize(Container parent) { - return defaultDimension; - } + private void addButton(JComponent component, int index) { + buttons.add(index, component); + if (index > 0) { + this.add(new SeparatorLabel(), index * 2 - 1); + } + this.add(component, index * 2); + } - @Override - public Dimension minimumLayoutSize(Container parent) { - return null; - } + private void setButtonVisible(JComponent component, boolean visible) { + int index = buttons.indexOf(component); - @Override - public void layoutContainer(Container parent) { - int width = parent.getPreferredSize().width; - int buttonWidth = editButton.getPreferredSize().width; - int buttonHeight = editButton.getPreferredSize().height; - int x = (width - buttonWidth) / 2; - editButton.setBounds(x, V_GAP, buttonWidth, buttonHeight); - firstLabel.setBounds(x, V_GAP + editButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); - toggleButton.setBounds(x, V_GAP * 2 + editButton.getHeight(), buttonWidth, buttonHeight); - if (creator.isShared()) { - secondLabel.setBounds(x, V_GAP * 2 + editButton.getHeight() + toggleButton.getHeight() + V_GAP / 2, buttonWidth, buttonHeight); - settingButton.setBounds(x, V_GAP * 3 + editButton.getHeight() + toggleButton.getHeight(), buttonWidth, buttonHeight); - } + boolean hasVisibleButtonBeforeCurrent = false; + for (int i = 0; i < index; i++) { + if (buttons.get(i).isVisible()) { + hasVisibleButtonBeforeCurrent = true; + break; } + } - @Override - public void addLayoutComponent(String name, Component comp) { + if (hasVisibleButtonBeforeCurrent) { + buttons.get(index).setVisible(visible); + getComponent(2 * index - 1).setVisible(visible); + return; + } + + // 在当前按钮之前没有可见的按钮了 + if (index > 0) { + getComponent(2 * index - 1).setVisible(false); + } + buttons.get(index).setVisible(true); + + if (!visible) { + // 如果当前按钮设置为不可见,且在当前按钮之前的其他按钮也不可见,则下一个可见按钮前无分割线 + for (int i = index + 1; i < buttons.size(); i++) { + if (buttons.get(i).isVisible()) { + if (i > 0) { + getComponent(2 * i - 1).setVisible(false); + } + break; + } } - }; + } } private JButton createNormalButton(Icon icon, String toolTipText) { JButton button = new JButton(icon); + button.setPreferredSize(new Dimension(BUTTON_SIZE + 2 * BUTTON_MARGIN, BUTTON_SIZE + 2 * BUTTON_MARGIN)); + button.setBorder(BorderFactory.createEmptyBorder(BUTTON_MARGIN, BUTTON_MARGIN, BUTTON_MARGIN, BUTTON_MARGIN)); initButtonStyle(button); button.setToolTipText(toolTipText); return button; } private void initButtonStyle(AbstractButton button) { + button.setPreferredSize(new Dimension(BUTTON_SIZE + 2 * BUTTON_MARGIN, BUTTON_SIZE + 2 * BUTTON_MARGIN)); + button.setBorder(BorderFactory.createEmptyBorder(BUTTON_MARGIN, BUTTON_MARGIN, BUTTON_MARGIN, BUTTON_MARGIN)); button.setBorderPainted(false); - button.setBorder(null); - button.setMargin(new Insets(0, 0, 0, 0)); button.setContentAreaFilled(false); } - private UILabel createLabel() { - return new UILabel() { - @Override - public void paint(Graphics g) { - super.paint(g); - Graphics2D g2d = (Graphics2D) g; - g2d.setColor(Color.WHITE); - g2d.drawLine(H_GAP, 0, toggleButton.getWidth() - H_GAP, 0); - - } - }; - } - @Override protected void paintComponent(Graphics g) { super.paintComponent(g); @@ -188,4 +191,41 @@ public class PopupControlPanel extends JPanel { this.rectangle = rectangle; } + public void updatePane(FormDesigner designer) { + setButtonVisible(settingButton, creator.isShared()); + setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter); + toggleButton.setSelected(creator.toData().isAspectRatioLocked()); + + updateDimension(); + } + + private void updateDimension() { + int height = 0; + for (int i = 0; i < buttons.size(); i++) { + JComponent component = buttons.get(i); + if (component.isVisible()) { + if (i > 0) { + height += 1; + } + height += component.getHeight(); + } + } + height += 2; + + defaultDimension.height = height; + } + + private static class SeparatorLabel extends UILabel { + public SeparatorLabel() { + setPreferredSize(new Dimension(PANE_WIDTH, 1)); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(Color.WHITE); + g2d.drawLine(BUTTON_MARGIN, 0, getWidth() - BUTTON_MARGIN, 0); + } + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index e7de926793..6702fe7f42 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -29,6 +29,11 @@ public class SelectedPopupDialog extends JDialog { this.setSize(controlPanel.getDefaultDimension()); } + public void updatePane(FormDesigner designer) { + controlPanel.updatePane(designer); + this.setSize(controlPanel.getDefaultDimension()); + } + public void setRelativeBounds(Rectangle rectangle) { this.controlPanel.setRelativeBounds(rectangle); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 30b941818d..2fdbb5a29a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -110,6 +110,11 @@ public class FormCreatorDropTarget extends DropTarget { //图表埋点 dealChartBuryingPoint(widget); if (addingXCreator.isShared()) { + if (container.acceptType(XWAbsoluteLayout.class)) { + // 绝对布局中新添加的共享组件默认锁定尺寸比例 + addingXCreator.toData().setAspectRatioLocked(true); + } + String shareId = addingXCreator.getShareId(); SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index bfcaeb60e7..d046a6a9e8 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -251,7 +251,7 @@ public class WidgetBoundPane extends BasicPane { @Override public void stateChanged(ChangeEvent e) { if (isLockEnabled() && isLocked() && width4Backup > 0 && height4Backup > 0) { - mHeightSpinner.setValue(mWidthSpinner.getValue() * width4Backup / height4Backup, false); + mHeightSpinner.setValue(mWidthSpinner.getValue() * height4Backup / width4Backup, false); } } }); @@ -259,7 +259,7 @@ public class WidgetBoundPane extends BasicPane { @Override public void stateChanged(ChangeEvent e) { if (isLockEnabled() && isLocked() && width4Backup > 0 && height4Backup > 0) { - mWidthSpinner.setValue(mHeightSpinner.getValue() * height4Backup / width4Backup, false); + mWidthSpinner.setValue(mHeightSpinner.getValue() * width4Backup / height4Backup, false); } } }); From 716904551f01d49cd8358031ad902626f79429a2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 12 Jul 2021 18:36:45 +0800 Subject: [PATCH 089/100] =?UTF-8?q?REPORT-55121=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E7=82=B9=E4=B9=9D=E5=9B=BE?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E8=AE=BE=E7=BD=AE=E5=BC=B9=E7=AA=97=E7=9A=84?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=8C=89=E9=92=AE=E5=92=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E5=85=B6=E5=AE=9E=E8=BF=98=E6=98=AF?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4&=E4=BF=9D=E5=AD=98=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=9A=84=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. BorderLineAndImagePane与TweakNinePointDialog共享了关于点九图位置的属性,拖拽改变点九分分割线的位置 就会直接改变BorderLineAndImagePane对应点九图字段的值 2. showWindow展示的对话框,其中的取消和关闭按钮总是会触发面板BorderLineAndImagePane的updatePane,从而将点九图的位置设置给了组件 需要将BorderLineAndImagePane与TweakNinePointDialog的数据做隔离,仅在点击确定按钮时 才将TweakNinePointDialog中已调整过的点九图分割线位置传递给BorderLineAndImagePane. 【改动思路】 【review建议】 --- .../gui/xpane/BorderLineAndImagePane.java | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java index 830853b33a..fcd9ed0103 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java @@ -53,6 +53,7 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.util.Arrays; /** * @author Starryi @@ -79,10 +80,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { private NinePointImageTweakDialogPane tweakPane; private ImageFileChooser imageFileChooser; - private int ninePointLeft = -1; - private int ninePointTop = -1; - private int ninePointRight = -1; - private int ninePointBottom = -1; + private int[] ninePoint = new int[] {-1, -1, -1, -1}; public BorderLineAndImagePane() { this.initComponents(); @@ -242,8 +240,9 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { @Override public void stateChanged(ChangeEvent e) { Image image = imagePreviewPane.getImage(); - ninePointLeft = ninePointRight = (image != null ? image.getWidth(null) / 3 : -1); - ninePointTop = ninePointBottom = (image != null ? image.getHeight(null) / 3 : -1); + ninePoint = new int[4]; + ninePoint[0] = ninePoint[2] = (image != null ? image.getWidth(null) / 3 : -1); + ninePoint[1] = ninePoint[3] = (image != null ? image.getHeight(null) / 3 : -1); borderImageOpacityPane.populateBean(1.0); if (image != null) { tweakNinePointButton.setEnabled(true); @@ -260,10 +259,12 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { initNinePointTweakPaneIfNotExist(); if (imagePreviewPane.getImage() != null) { + tweakPane.previewPane.setNinePoint(ninePoint); BasicDialog dialog = tweakPane.showWindow(SwingUtilities.getWindowAncestor(BorderLineAndImagePane.this)); dialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { + ninePoint = Arrays.copyOf(tweakPane.previewPane.getNinePoint(), 4); fireStateChanged(); } }); @@ -292,13 +293,11 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { this.tweakNinePointButton.setEnabled(true); this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity()); if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] > 0 && ninePoint[1] > 0 && ninePoint[2] > 0 && ninePoint[3] > 0) { - ninePointLeft = ninePoint[0]; - ninePointTop = ninePoint[1]; - ninePointRight = ninePoint[2]; - ninePointBottom = ninePoint[3]; + this.ninePoint = Arrays.copyOf(ninePoint, 4); } else { - ninePointLeft = ninePointRight = image.getWidth(null) / 3; - ninePointTop = ninePointBottom = image.getHeight(null) / 3; + this.ninePoint = new int[4]; + this.ninePoint[0] = this.ninePoint[2] = image.getWidth(null) / 3; + this.ninePoint[1] = this.ninePoint[3] = image.getHeight(null) / 3; } getComponent(1).setVisible(false); @@ -331,7 +330,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { Image image = this.imagePreviewPane.getImage(); if (image != null) { ImageBackground newImageBackground = new ImageFileBackground(this.imagePreviewPane.getImageWithSuffix(), Constants.IMAGE_EXTEND); - newImageBackground.setNinePoint(new int[] { ninePointLeft, ninePointTop, ninePointRight, ninePointBottom }); + newImageBackground.setNinePoint(Arrays.copyOf(ninePoint, 4)); style.setBorderImage(newImageBackground); style.setBorderImageOpacity((float)borderImageOpacityPane.updateBean()); } @@ -408,7 +407,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { } private class NinePointImageTweakDialogPane extends BasicPane { - private final NinePointLinePreviewPane previewPane = new NinePointLinePreviewPane(); + public final NinePointLinePreviewPane previewPane = new NinePointLinePreviewPane(); public NinePointImageTweakDialogPane() { this.initComponents(); @@ -444,6 +443,11 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { public final Color TEXT_COLOR = Color.WHITE; public final int PADDING = 15; + private int ninePointLeft = -1; + private int ninePointTop = -1; + private int ninePointRight = -1; + private int ninePointBottom = -1; + private int imgWidth; private int imgHeight; private int scaleImgWidth; @@ -629,5 +633,17 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { public void mouseExited(MouseEvent e) { } + + + public void setNinePoint(int[] ninePoint) { + ninePointLeft = ninePoint[0]; + ninePointTop = ninePoint[1]; + ninePointRight = ninePoint[2]; + ninePointBottom = ninePoint[3]; + } + + public int[] getNinePoint() { + return new int[] { ninePointLeft, ninePointTop, ninePointRight, ninePointBottom }; + } } } From 22b34d9bd8431889b9f50d534c17abb7951b57b0 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 13 Jul 2021 13:39:37 +0800 Subject: [PATCH 090/100] =?UTF-8?q?REPORT-55150=20=E3=80=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E6=A0=87=E9=A2=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=8B=E5=88=92=E7=BA=BF=EF=BC=8C=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=B8=8B=E5=88=92=E7=BA=BF=E6=A0=B7=E5=BC=8F=EF=BC=8C=E7=9B=AE?= =?UTF-8?q?=E5=89=8Dweb=E9=A2=84=E8=A7=88=EF=BC=8C=E4=B8=8D=E7=AE=A1?= =?UTF-8?q?=E9=80=89=E7=9A=84=E4=BB=80=E4=B9=88=E4=B8=8B=E5=88=92=E7=BA=BF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=83=BD=E6=98=BE=E7=A4=BA=E7=9A=84=E6=98=AF?= =?UTF-8?q?=E5=8D=95=E6=A8=AA=E7=BA=BF=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 这是一个普遍存在的历史问题。临时性的解决方法是在组件样式设置面板中 隐藏下划线线型选择框,待后续全平台显示优化 【改动思路】 【review建议】 --- .../fr/design/gui/xpane/LayoutStylePane.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index ee1de8f7e8..81ce5fa7e1 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -81,7 +81,7 @@ public class LayoutStylePane extends BasicBeanPane { private UIToggleButton titleFontBoldButton; private UIToggleButton titleFontItalicButton; private UIToggleButton titleFontUnderlineButton; - private LineComboBox titleFontUnderlineCombo; +// private LineComboBox titleFontUnderlineCombo; // 目前前端仅支持短横线类型的下划线,因此设计器端暂时就不展示线型选择框了,待后续优化 // 标题图文混排 protected TitleInsetImagePane titleInsetImagePane; //对齐方式 @@ -211,8 +211,8 @@ public class LayoutStylePane extends BasicBeanPane { titleFontUnderlineButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); titleFontUnderlineButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); - titleFontUnderlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); - titleFontUnderlineCombo.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style")); +// titleFontUnderlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY); +// titleFontUnderlineCombo.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style")); titleInsetImagePane = new TitleInsetImagePane(); @@ -294,15 +294,15 @@ public class LayoutStylePane extends BasicBeanPane { JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); containerPane.add(buttonPane, BorderLayout.NORTH); - containerPane.add(titleFontUnderlineCombo, BorderLayout.CENTER); +// containerPane.add(titleFontUnderlineCombo, BorderLayout.CENTER); - titleFontUnderlineCombo.setVisible(false); - titleFontUnderlineButton.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - titleFontUnderlineCombo.setVisible(titleFontUnderlineButton.isSelected()); - } - }); +// titleFontUnderlineCombo.setVisible(false); +// titleFontUnderlineButton.addChangeListener(new ChangeListener() { +// @Override +// public void stateChanged(ChangeEvent e) { +// titleFontUnderlineCombo.setVisible(titleFontUnderlineButton.isSelected()); +// } +// }); return containerPane; } @@ -349,7 +349,8 @@ public class LayoutStylePane extends BasicBeanPane { frFont = frFont.applyName(titleFontFamilyComboBox.getSelectedItem().toString()); frFont = frFont.applyForeground(titleFontColorSelectPane.getColor()); frFont = updateTitleFontItalicBold(frFont); - int line = titleFontUnderlineButton.isSelected() ? this.titleFontUnderlineCombo.getSelectedLineStyle() : Constants.LINE_NONE; +// int line = titleFontUnderlineButton.isSelected() ? this.titleFontUnderlineCombo.getSelectedLineStyle() : Constants.LINE_NONE; + int line = titleFontUnderlineButton.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE; frFont = frFont.applyUnderline(line); title.setFrFont(frFont); title.setPosition((Integer) titleAlignPane.getSelectedItem()); @@ -425,11 +426,11 @@ public class LayoutStylePane extends BasicBeanPane { int line = frFont.getUnderline(); if (line == Constants.LINE_NONE) { titleFontUnderlineButton.setSelected(false); - titleFontUnderlineCombo.setVisible(false); +// titleFontUnderlineCombo.setVisible(false); } else { titleFontUnderlineButton.setSelected(true); - titleFontUnderlineCombo.setVisible(true); - this.titleFontUnderlineCombo.setSelectedLineStyle(line); +// titleFontUnderlineCombo.setVisible(true); +// this.titleFontUnderlineCombo.setSelectedLineStyle(line); } titleAlignPane.setSelectedItem(widgetTitle.getPosition()); From 26f2825ccb916aa583153994b5da3df636f7b5cb Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 13 Jul 2021 13:42:52 +0800 Subject: [PATCH 091/100] =?UTF-8?q?REPORT-55149=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E5=9B=BE=E8=A1=A8=E5=9D=97=E6=B2=A1?= =?UTF-8?q?=E7=9C=8B=E5=88=B0=E5=86=85=E8=BE=B9=E8=B7=9D=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 实现表单图表控件支持内边距 【改动思路】 【review建议】 --- .../designer/beans/events/DesignerEditor.java | 17 ++++++ .../design/designer/creator/XChartEditor.java | 9 ++- .../FormWidgetDefinePaneFactoryBase.java | 4 +- .../layout/ChartEditorDefinePane.java | 57 +++++++++++++++++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ChartEditorDefinePane.java diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java index 1bb2cea523..a1c9f1ff9f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java @@ -1,5 +1,6 @@ package com.fr.design.designer.beans.events; +import com.fr.form.ui.PaddingMargin; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeListener; import com.fr.design.utils.gui.LayoutUtils; @@ -76,6 +77,22 @@ public class DesignerEditor implements PropertyChangeListe } } + public void paintEditor(Graphics g, Dimension size, PaddingMargin margin) { + if (this.comp != null) { + int marginLeft = margin != null ? margin.getLeft() : 0; + int marginTop = margin != null ? margin.getTop() : 0; + int marginRight = margin != null ? margin.getRight() : 0; + int marginBottom = margin != null ? margin.getBottom() : 0; + int horizonMargin = marginLeft + marginRight; + int verticalMargin = marginTop + marginBottom; + + comp.setSize(new Dimension(size.width - 2 - horizonMargin, size.height - 2 - verticalMargin)); + LayoutUtils.layoutContainer(comp); + Graphics clipg = g.create(1 + marginLeft, 1 + marginTop, size.width, size.height); + this.comp.paint(clipg); + } + } + public T getEditorTarget() { return comp; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java index bbd2f52d9e..2e9b3e23a4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java @@ -20,6 +20,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.module.DesignModuleFactory; import com.fr.form.ui.BaseChartEditor; +import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.core.PropertyChangeAdapter; @@ -228,9 +229,13 @@ public class XChartEditor extends XBorderStyleWidgetCreator { * 渲染Painter */ public void paint(Graphics g) { - designerEditor.paintEditor(g, this.getSize()); + Dimension size = getSize(); + PaddingMargin margin = toData().getMargin(); + designerEditor.paintEditor(g, size, margin); if (coverPanel != null) { - coverPanel.setSize(this.getSize()); + int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0; + int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0; + coverPanel.setSize(size.width - horizonMargin, size.height - verticalMargin); } super.paint(g); if (isEditing) { diff --git a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java index 1947e9ec4e..e6217dbf02 100644 --- a/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java +++ b/designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -24,7 +24,7 @@ import com.fr.design.widget.ui.designer.TreeComboBoxEditorDefinePane; import com.fr.design.widget.ui.designer.TreeEditorDefinePane; import com.fr.design.widget.ui.designer.UserEditorDefinePane; import com.fr.design.widget.ui.designer.WidgetDefinePane; -import com.fr.design.widget.ui.designer.layout.BorderStyleWidgetDefinePane; +import com.fr.design.widget.ui.designer.layout.ChartEditorDefinePane; import com.fr.design.widget.ui.designer.layout.ElementEditorDefinePane; import com.fr.design.widget.ui.designer.layout.FRAbsoluteBodyLayoutDefinePane; import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane; @@ -107,7 +107,7 @@ public class FormWidgetDefinePaneFactoryBase { defineMap.put(FormSubmitButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + "")); defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, "wFitLayout")); if (StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class) != null) { - defineMap.put(StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class), new Appearance(BorderStyleWidgetDefinePane.class, "chartEditor")); + defineMap.put(StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class), new Appearance(ChartEditorDefinePane.class, "chartEditor")); } defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, "wAbsoluteLayout")); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ChartEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ChartEditorDefinePane.java new file mode 100644 index 0000000000..fdb3efc9d3 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ChartEditorDefinePane.java @@ -0,0 +1,57 @@ +package com.fr.design.widget.ui.designer.layout; + +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.PropertyGroupPane; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XElementCase; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor; +import com.fr.design.widget.ui.designer.component.PaddingBoundPane; +import com.fr.form.ui.ChartEditor; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.web.FormToolBarManager; +import com.fr.general.ComparatorUtils; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by ibm on 2017/8/7. + */ +public class ChartEditorDefinePane extends WTitleLayoutDefinePane { + private PaddingBoundPane paddingBoundPane; + + public ChartEditorDefinePane(XCreator xCreator) { + super(xCreator); + + } + + protected JPanel createCenterPane() { + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + paddingBoundPane = new PaddingBoundPane(); + Component[][] components = new Component[][]{ + new Component[]{paddingBoundPane, null}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); + panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); + centerPane.add(panel, BorderLayout.NORTH); + return centerPane; + } + + protected ChartEditor updateSubBean() { + ChartEditor chartEditor = (ChartEditor) creator.toData(); + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) { + paddingBoundPane.update(chartEditor); + } + + return chartEditor; + } + + protected void populateSubBean(ChartEditor ob) { + paddingBoundPane.populate(ob); + } + +} From c64c4b7a5ff352d9eb3cf3db71bd8047973f1178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 13 Jul 2021 15:46:34 +0800 Subject: [PATCH 092/100] =?UTF-8?q?REPORT-55034=20=E8=81=9A=E5=90=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=90=8E=EF=BC=8C=E9=9D=A2=E6=9D=BF=E6=9C=AA=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JWorkBook.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 0f1ced3797..d43926e6a5 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -1019,6 +1019,9 @@ public class JWorkBook extends JTemplate { // EastRegionContainerPane.getInstance().replaceDownPane(new JPanel()); QuickEditorRegion.getInstance().populate(QuickEditor.DEFAULT_EDITOR); } else { + if (polyDesigner.getSelectionType() == PolyDesigner.SelectionType.INNER) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); + } EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance()); } EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance()); From f4c608d4a54a82e8d8813803bfe37a05da691b29 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 13 Jul 2021 17:35:12 +0800 Subject: [PATCH 093/100] =?UTF-8?q?KERNEL-7634=20mac=E5=92=8Cwin=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E4=B8=8D=E5=90=8C=E7=89=88=E6=9C=AC=E7=9A=84jxbrowser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 8 +- .../java/com/fr/design/ui/ModernUIPane.java | 24 +- .../fr/design/ui/compatible/BuilderDiff.java | 24 + .../ui/compatible/ModernUIPaneFactory.java | 20 + .../design/ui/compatible/NewModernUIPane.java | 301 +++++++++++ .../NxComplexInterceptRequestCallback.java | 3 + .../NxInterceptRequestCallback.java | 14 + .../java/com/fr/design/upm/NewUpmBridge.java | 502 ++++++++++++++++++ .../java/com/fr/design/upm/UpmBridge.java | 4 + .../java/com/fr/design/upm/UpmFinder.java | 3 +- .../java/com/fr/design/upm/UpmShowPane.java | 35 +- .../upm/exec/NewUpmBrowserExecutor.java | 30 ++ 12 files changed, 941 insertions(+), 27 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java create mode 100644 designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java create mode 100644 designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java create mode 100644 designer-base/src/main/java/com/fr/design/upm/exec/NewUpmBrowserExecutor.java diff --git a/build.gradle b/build.gradle index cbc6d696ce..804f1ad0f9 100644 --- a/build.gradle +++ b/build.gradle @@ -60,10 +60,10 @@ allprojects { implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser-mac:6.23' implementation 'com.fr.third:jxbrowser-win64:6.23' - implementation 'com.fr.third:jxbrowser-v7:7.5' - implementation 'com.fr.third:jxbrowser-mac-v7:7.5' - implementation 'com.fr.third:jxbrowser-win64-v7:7.5' - implementation 'com.fr.third:jxbrowser-swing:7.5' + implementation 'com.fr.third:jxbrowser-v7:7.7' + implementation 'com.fr.third:jxbrowser-mac-v7:7.7' + implementation 'com.fr.third:jxbrowser-win64-v7:7.7' + implementation 'com.fr.third:jxbrowser-swing-v7:7.7' implementation 'com.fr.third.server:servlet-api:3.0' implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swag:1.0' diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 084820a13e..8c7ed5ac5a 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -5,8 +5,10 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.compatible.BuilderDiff; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.web.struct.AssembleComponent; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.BrowserType; import com.teamdev.jxbrowser.chromium.JSValue; @@ -42,6 +44,10 @@ public class ModernUIPane extends BasicPane { initialize(browserType); } + protected ModernUIPane() { + + } + private void initialize(BrowserType browserType) { if (browser == null) { setLayout(new BorderLayout()); @@ -151,7 +157,7 @@ public class ModernUIPane extends BasicPane { return null; } - public static class Builder { + public static class Builder implements BuilderDiff { private ModernUIPane pane; @@ -271,6 +277,22 @@ public class ModernUIPane extends BasicPane { return this; } + @Override + public Builder prepareForV6(ScriptContextListener contextListener) { + return prepare(contextListener); + } + + @Override + public Builder prepareForV6(LoadListener loadListener) { + return prepare(loadListener); + } + + @Override + public Builder prepareForV7(InjectJsCallback callback) { + // do nothing + return this; + } + public ModernUIPane build() { return pane; } diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java b/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java new file mode 100644 index 0000000000..33c817c948 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java @@ -0,0 +1,24 @@ +package com.fr.design.ui.compatible; + +import com.fr.design.ui.ModernUIPane; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; +import com.teamdev.jxbrowser.chromium.events.LoadListener; +import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; + +/** + * 封装jxbrwoser v6/v7的构建方式的差异 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/6/13 + */ +public interface BuilderDiff { + + ModernUIPane.Builder prepareForV6(ScriptContextListener contextListener); + + ModernUIPane.Builder prepareForV6(LoadListener loadListener); + + ModernUIPane.Builder prepareForV7(InjectJsCallback callback); + + +} diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java new file mode 100644 index 0000000000..8616b647b4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java @@ -0,0 +1,20 @@ +package com.fr.design.ui.compatible; + +import com.fr.design.ui.ModernUIPane; +import com.fr.stable.os.OperatingSystem; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/13 + */ +public class ModernUIPaneFactory { + + public static ModernUIPane.Builder modernUIPaneBuilder() { + if (OperatingSystem.isWindows()) { + return new NewModernUIPane.Builder<>(); + } else { + return new ModernUIPane.Builder<>(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java new file mode 100644 index 0000000000..ab883516cf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java @@ -0,0 +1,301 @@ +package com.fr.design.ui.compatible; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.ModernUIConstants; +import com.fr.design.ui.ModernUIPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.web.struct.AssembleComponent; +import com.teamdev.jxbrowser.browser.Browser; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; +import com.teamdev.jxbrowser.chromium.events.LoadListener; +import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; +import com.teamdev.jxbrowser.engine.Engine; +import com.teamdev.jxbrowser.engine.EngineOptions; +import com.teamdev.jxbrowser.engine.RenderingMode; +import com.teamdev.jxbrowser.js.JsObject; +import com.teamdev.jxbrowser.net.Network; +import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; +import com.teamdev.jxbrowser.view.swing.BrowserView; + + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.util.Map; +import java.util.Optional; +import javax.swing.JDialog; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +/** + * 基于v7 jxbrowser实现 + * + * @author richie + * @version 10.0 + * Created by richie on 2019-03-04 + * 用于加载html5的Swing容器,可以在设计选项设置中打开调试窗口,示例可查看:com.fr.design.ui.ModernUIPaneTest + */ +public class NewModernUIPane extends ModernUIPane { + + private Browser browser; + private String namespace = "Pool"; + private String variable = "data"; + private String expression = "update()"; + + private NewModernUIPane() { + super(); + initialize(); + } + + private void initialize() { + setLayout(new BorderLayout()); + if (browser == null) { + if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + UIToolbar toolbar = new UIToolbar(); + add(toolbar, BorderLayout.NORTH); + UIButton openDebugButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window")); + toolbar.add(openDebugButton); + UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload")); + toolbar.add(reloadButton); + UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window")); + toolbar.add(closeButton); + + openDebugButton.addActionListener(e -> showDebuggerDialog()); + + reloadButton.addActionListener(e -> browser.navigation().reloadIgnoringCache()); + + closeButton.addActionListener(e -> SwingUtilities.getWindowAncestor( + NewModernUIPane.this).setVisible(false)); + initializeBrowser(); + add(BrowserView.newInstance(browser), BorderLayout.CENTER); + } else { + initializeBrowser(); + add(BrowserView.newInstance(browser), BorderLayout.CENTER); + } + } + } + + private void showDebuggerDialog() { + JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this)); + Engine engine = Engine.newInstance( + EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED) + .addSwitch("--disable-google-traffic") + .remoteDebuggingPort(9222).build()); + Browser debugger = engine.newBrowser(); + BrowserView debuggerView = BrowserView.newInstance(debugger); + dialog.add(debuggerView, BorderLayout.CENTER); + dialog.setSize(new Dimension(800, 400)); + GUICoreUtils.centerWindow(dialog); + dialog.setVisible(true); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + browser.devTools().remoteDebuggingUrl().ifPresent(url -> { + debugger.navigation().loadUrl(url); + }); + } + + private void initializeBrowser() { + Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build()); + browser = engine.newBrowser(); + + // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 + browser.set(InjectJsCallback.class, params -> { + params.frame().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace)); + return InjectJsCallback.Response.proceed(); + }); + } + + /** + * 转向一个新的地址,相当于重新加载 + * + * @param url 新的地址 + */ + @Override + public void redirect(String url) { + browser.navigation().loadUrl(url); + } + + /** + * 转向一个新的地址,相当于重新加载 + * + * @param url 新的地址 + * @param map 初始化参数 + */ + @Override + public void redirect(String url, Map map) { + Network network = browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map)); + browser.navigation().loadUrl(url); + } + + @Override + protected String title4PopupWindow() { + return "Modern"; + } + + @Override + public void populate(final T t) { + browser.set(InjectJsCallback.class, params -> { + JsObject ns = params.frame().executeJavaScript("window." + namespace); + if (ns != null) { + ns.putProperty(variable, t); + } + return InjectJsCallback.Response.proceed(); + }); + } + + @Override + public T update() { + if (browser.mainFrame().isPresent()) { + return browser.mainFrame().get().executeJavaScript("window." + namespace + "." + expression); + } + return null; + } + + public static class Builder extends ModernUIPane.Builder { + + private NewModernUIPane pane = new NewModernUIPane<>(); + + public NewModernUIPane.Builder prepare(InjectJsCallback callback) { + pane.browser.set(InjectJsCallback.class, callback); + return this; + } + + /** + * 加载jar包中的资源 + * + * @param path 资源路径 + */ + @Override + public NewModernUIPane.Builder withEMB(final String path) { + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, null)); + pane.browser.navigation().loadUrl("emb:" + path); + return this; + } + + /** + * 加载url指向的资源 + * + * @param url 文件的地址 + */ + @Override + public NewModernUIPane.Builder withURL(final String url) { + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); + pane.browser.navigation().loadUrl(url); + return this; + } + + /** + * 加载url指向的资源 + * + * @param url 文件的地址 + */ + @Override + public NewModernUIPane.Builder withURL(final String url, Map map) { + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map)); + pane.browser.navigation().loadUrl(url); + return this; + } + + /** + * 加载Atom组件 + * + * @param component Atom组件 + */ + @Override + public NewModernUIPane.Builder withComponent(AssembleComponent component) { + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component)); + pane.browser.navigation().loadUrl("emb:dynamic"); + return this; + } + + /** + * 加载Atom组件 + * + * @param component Atom组件 + */ + @Override + public NewModernUIPane.Builder withComponent(AssembleComponent component, Map map) { + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component, map)); + pane.browser.navigation().loadUrl("emb:dynamic"); + return this; + } + + + /** + * 加载html文本内容 + * + * @param html 要加载html文本内容 + */ + @Override + public NewModernUIPane.Builder withHTML(String html) { + Network network = pane.browser.engine().network(); + network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network)); + pane.browser.mainFrame().ifPresent(frame -> { + frame.loadHtml(html); + }); + return this; + } + + /** + * 设置该前端页面做数据交换所使用的对象 + * + * @param namespace 对象名 + */ + @Override + public NewModernUIPane.Builder namespace(String namespace) { + pane.namespace = namespace; + return this; + } + + /** + * java端往js端传数据时使用的变量名字 + * + * @param name 变量的名字 + */ + @Override + public NewModernUIPane.Builder variable(String name) { + pane.variable = name; + return this; + } + + /** + * js端往java端传数据时执行的函数表达式 + * + * @param expression 函数表达式 + */ + @Override + public NewModernUIPane.Builder expression(String expression) { + pane.expression = expression; + return this; + } + + @Override + public NewModernUIPane.Builder prepareForV6(ScriptContextListener contextListener) { + // do nothing + return this; + } + + @Override + public NewModernUIPane.Builder prepareForV6(LoadListener loadListener) { + // do nothing + return this; + } + + @Override + public NewModernUIPane.Builder prepareForV7(InjectJsCallback callback) { + return prepare(callback); + } + + @Override + public NewModernUIPane build() { + return pane; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java index 2c430bd348..f3147b6529 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java @@ -49,6 +49,9 @@ public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallbac path = path.substring(4); } InputStream inputStream = IOUtils.readResource(path); + if (inputStream == null) { + return Response.proceed(); + } return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream))); } } diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java b/designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java index 7b4977e77b..e2ab7ad93c 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java @@ -100,6 +100,11 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback { } String getMimeType(String path) { + // 去除 xxx?xxx 后面部分 + int index = path.indexOf("?"); + if (index != -1) { + path = path.substring(0, path.indexOf("?")); + } if (StringUtils.isBlank(path)) { return "text/html"; } @@ -124,6 +129,15 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback { if (path.endsWith(".gif")) { return "image/gif"; } + if (path.endsWith(".woff")) { + return "font/woff"; + } + if (path.endsWith(".ttf")) { + return "truetype"; + } + if (path.endsWith(".eot")) { + return "embedded-opentype"; + } Path file = new File(path).toPath(); try { return Files.probeContentType(file); diff --git a/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java new file mode 100644 index 0000000000..a69871e7a9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java @@ -0,0 +1,502 @@ +package com.fr.design.upm; + +import com.fr.config.MarketConfig; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; +import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.bridge.exec.JSCallback; +import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.extra.PluginUtils; +import com.fr.design.extra.exe.GetInstalledPluginsExecutor; +import com.fr.design.extra.exe.GetPluginCategoriesExecutor; +import com.fr.design.extra.exe.GetPluginFromStoreExecutor; +import com.fr.design.extra.exe.GetPluginPrefixExecutor; +import com.fr.design.extra.exe.PluginLoginExecutor; +import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; +import com.fr.design.extra.exe.SearchOnlineExecutor; +import com.fr.design.i18n.Toolkit; +import com.fr.design.upm.event.CertificateEvent; +import com.fr.design.upm.event.DownloadEvent; +import com.fr.design.upm.exec.NewUpmBrowserExecutor; +import com.fr.design.upm.task.UpmTaskWorker; +import com.fr.event.EventDispatcher; +import com.fr.general.GeneralUtils; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginMarker; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.teamdev.jxbrowser.js.JsAccessible; +import com.teamdev.jxbrowser.js.JsFunction; +import com.teamdev.jxbrowser.js.JsObject; + +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.FutureTask; +import java.util.concurrent.RunnableFuture; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + * 桥接Java和JavaScript的类 + */ +public class NewUpmBridge extends UpmBridge { + + public static NewUpmBridge getBridge(JsObject jsObject) { + return new NewUpmBridge(jsObject); + } + + private JsObject jsObject; + + private NewUpmBridge(JsObject jsObject) { + this.jsObject = jsObject; + } + + /** + * 更新插件管理中心资源文件,这个方法仅仅是为了语义上的作用(更新) + * + * @param callback 安装完成后的回调函数 + */ + @JSBridge + @JsAccessible + public void update(final JsFunction callback) { + callback.invoke(jsObject, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + try { + UpmResourceLoader.INSTANCE.download(); + UpmResourceLoader.INSTANCE.install(); + callback.invoke(jsObject, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + EventDispatcher.fire(DownloadEvent.UPDATE, "success"); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + callback.invoke(jsObject, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + } + } + + /** + * 下载并安装插件管理中心的资源文件 + * + * @param callback 安装完成后的回调函数 + */ + @JSBridge + @JsAccessible + public void startDownload(final JsFunction callback) { + callback.invoke(jsObject, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + UpmResourceLoader.INSTANCE.download(); + UpmResourceLoader.INSTANCE.install(); + return null; + } + + @Override + protected void done() { + try { + get(); + callback.invoke(jsObject, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); + } catch (Exception e) { + callback.invoke(jsObject, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + EventDispatcher.fire(DownloadEvent.ERROR, "error"); + } + } + }.execute(); + } + + /** + * 获取upm的版本信息 + * + * @return 版本信息 + */ + @JSBridge + @JsAccessible + @Override + public String getVersion() { + return super.getVersion(); + } + + @JSBridge + @JsAccessible + @Override + public String i18nText(String key) { + return super.i18nText(key); + } + + @JSBridge + @JsAccessible + @Override + public void closeWindow() { + super.closeWindow(); + } + + @JSBridge + @JsAccessible + @Override + public boolean isDesigner() { + return super.isDesigner(); + } + + @JSBridge + @JsAccessible + public void getPackInfo(final JsFunction callback) { + callback.invoke(jsObject, StringUtils.EMPTY); + } + + @JSBridge + @JsAccessible + public void getPluginPrefix(final JsFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetPluginPrefixExecutor()); + task.execute(); + } + + /** + * 在线获取插件分类 + * + * @param callback 回调函数 + */ + @JSBridge + @JsAccessible + public void getPluginCategories(final JsFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetPluginCategoriesExecutor()); + task.execute(); + } + + /** + * 根据条件获取在线插件 + * + * @param info 插件信息 + * @param callback 回调函数 + */ + @JSBridge + @JsAccessible + public void getPluginFromStoreNew(String info, final JsFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetPluginFromStoreExecutor(new JSONObject(info))); + task.execute(); + } + + /** + * 已安装插件检查更新 + */ + @JSBridge + @JsAccessible + public void readUpdateOnline(final JsFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new ReadUpdateOnlineExecutor()); + task.execute(); + } + + /** + * 获取已经安装的插件的数组 + */ + @JSBridge + @JsAccessible + public void getInstalledPlugins(final JsFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetInstalledPluginsExecutor()); + task.execute(); + } + + /** + * 从插件服务器上更新选中的插件 + * + * @param pluginIDs 插件集合 + */ + @JSBridge + @JsAccessible + public void updatePluginOnline(JsObject pluginIDs, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + List pluginMarkerList = new ArrayList<>(); + for (String key : pluginIDs.propertyNames()) { + pluginIDs.property(key).ifPresent(v -> { + pluginMarkerList.add(PluginUtils.createPluginMarker(GeneralUtils.objectToString(v))); + }); + } + PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); + } + + @JSBridge + @JsAccessible + public void updatePluginOnline(String pluginID, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + List pluginMarkerList = new ArrayList<>(); + pluginMarkerList.add(PluginUtils.createPluginMarker(pluginID)); + PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); + } + + /** + * 搜索在线插件 + * + * @param keyword 关键字 + */ + @JSBridge + @JsAccessible + public void searchPlugin(String keyword, final JsFunction callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new SearchOnlineExecutor(keyword)); + worker.execute(); + } + + /** + * 从磁盘上选择插件安装包进行安装 + * + * @param filePath 插件包的路径 + */ + @JSBridge + @JsAccessible + public void installPluginFromDisk(final String filePath, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + File file = new File(filePath); + PluginOperateUtils.installPluginFromDisk(file, jsCallback); + } + + /** + * 卸载当前选中的插件 + * + * @param pluginInfo 插件信息 + */ + @JSBridge + @JsAccessible + public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); + } + + /** + * 从插件服务器上安装插件 + * + * @param pluginInfo 插件的ID + * @param callback 回调函数 + */ + @JSBridge + @JsAccessible + public void installPluginOnline(final String pluginInfo, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); + } + + /** + * 从磁盘上选择插件安装包进行插件升级 + * + * @param filePath 插件包的路径 + */ + @JSBridge + @JsAccessible + public void updatePluginFromDisk(String filePath, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + File file = new File(filePath); + PluginOperateUtils.updatePluginFromDisk(file, jsCallback); + } + + /** + * 修改选中的插件的活跃状态 + * + * @param pluginID 插件ID + */ + @JSBridge + @JsAccessible + public void setPluginActive(String pluginID, final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + PluginOperateUtils.setPluginActive(pluginID, jsCallback); + } + + /** + * 选择文件对话框 + * + * @return 选择的文件的路径 + */ + @JSBridge + @JsAccessible + @Override + public String showFileChooser() { + return super.showFileChooser(); + } + + /** + * 选择文件对话框 + * + * @param des 过滤文件描述 + * @param filter 文件的后缀 + * @return 选择的文件的路径 + * 这里换用JFileChooser会卡死,不知道为什么 + */ + @JSBridge + @JsAccessible + @Override + public String showFileChooserWithFilter(final String des, final String filter) { + return super.showFileChooserWithFilter(des, filter); + } + + /** + * 选择文件对话框 + * + * @param des 过滤文件描述 + * @param args 文件的后缀 + * @return 选择的文件的路径 + */ + @JSBridge + @JsAccessible + public String showFileChooserWithFilters(final String des, final String args) { + RunnableFuture future = new FutureTask<>(() -> { + JFileChooser fileChooser = new JFileChooser(); + List filterList = new ArrayList<>(); + filterList.add(args); + String[] filters = filterList.toArray(new String[0]); + if (ArrayUtils.isNotEmpty(filters)) { + FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); + fileChooser.setFileFilter(filter); + } + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; + }); + SwingUtilities.invokeLater(future); + try { + return future.get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + /** + * 选择文件对话框 + * + * @param des 过滤文件描述 + * @param args 文件的后缀 + * @return 选择的文件的路径 + */ + @JSBridge + @JsAccessible + public String showFileChooserWithFilters(final String des, final JsObject args) { + RunnableFuture future = new FutureTask<>(() -> { + JFileChooser fileChooser = new JFileChooser(); + List filterList = new ArrayList<>(); + for (String key : args.propertyNames()) { + args.property(key).ifPresent(v -> { + filterList.add(GeneralUtils.objectToString(v)); + }); + } + String[] filters = filterList.toArray(new String[0]); + if (ArrayUtils.isNotEmpty(filters)) { + FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); + fileChooser.setFileFilter(filter); + } + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; + }); + SwingUtilities.invokeLater(future); + try { + return future.get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + ////////登录相关/////// + + /** + * 获取系统登录的用户名 + */ + @JSBridge + @JsAccessible + public String getLoginInfo(final JsFunction callback) { + registerLoginInfo(callback); + return MarketConfig.getInstance().getBbsUsername(); + } + + /** + * 系统登录注册 + * + * @param callback 回调函数 + */ + @JSBridge + @JsAccessible + public void registerLoginInfo(final JsFunction callback) { + JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); + String username = MarketConfig.getInstance().getBbsUsername(); + if (StringUtils.isEmpty(username)) { + jsCallback.execute(StringUtils.EMPTY); + EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY); + } else { + jsCallback.execute(username); + EventDispatcher.fire(CertificateEvent.LOGIN, username); + } + } + + + /** + * 设计器端的用户登录 + * + * @param username 用户名 + * @param password 密码 + * @param callback 回调函数 + */ + @JSBridge + @JsAccessible + public void defaultLogin(String username, String password, final JsFunction callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new PluginLoginExecutor(username, password)); + worker.execute(); + } + + /** + * 清除用户信息 + */ + @JsAccessible + @JSBridge + @Override + public void clearUserInfo() { + super.clearUserInfo(); + } + + /** + * 打开论坛消息界面 + */ + @JSBridge + @JsAccessible + @Override + public void getPriviteMessage() { + super.getPriviteMessage(); + } + + /** + * 忘记密码 + */ + @JSBridge + @JsAccessible + @Override + public void forgetHref() { + super.forgetHref(); + } + + /** + * 立即注册 + */ + @JSBridge + @JsAccessible + @Override + public void registerHref() { + super.registerHref(); + } + + /** + * 使用系统浏览器打开网页 + * + * @param url 要打开的网页 + */ + @JSBridge + @JsAccessible + @Override + public void openShopUrlAtWebBrowser(String url) { + super.openShopUrlAtWebBrowser(url); + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index ad933d7d24..fb40d54345 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -66,6 +66,10 @@ public class UpmBridge { this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); } + protected UpmBridge() { + + } + /** * 更新插件管理中心资源文件,这个方法仅仅是为了语义上的作用(更新) * @param callback 安装完成后的回调函数 diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index 2ea539faf1..db0661b1f8 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -15,6 +15,7 @@ import com.fr.event.Listener; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; +import com.fr.stable.os.OperatingSystem; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; @@ -31,7 +32,7 @@ public class UpmFinder { private static final String UPM_DIR = "/upm"; private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; - private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; + private static final String JXBROWSER = OperatingSystem.isWindows() ? "com.teamdev.jxbrowser.browser.Browser" : "com.teamdev.jxbrowser.chromium.Browser"; public static String installHome = FRContext.getCommonOperator().getWebRootPath(); diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java index 1bc4b9e948..0384b5c291 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java @@ -2,14 +2,17 @@ package com.fr.design.upm; import com.fr.design.dialog.BasicPane; import com.fr.design.ui.ModernUIPane; +import com.fr.design.ui.compatible.ModernUIPaneFactory; import com.fr.design.upm.event.DownloadEvent; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; +import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; +import com.teamdev.jxbrowser.js.JsObject; import java.awt.*; /** @@ -29,16 +32,23 @@ public class UpmShowPane extends BasicPane { UpmShowPane() { setLayout(new BorderLayout()); -// 先屏蔽掉这个判断,后续可能修改交互 -// if (UpmFinder.checkUPMResourcesExist()) { - modernUIPane = new ModernUIPane.Builder<>() - .prepare(new ScriptContextAdapter() { + modernUIPane = ModernUIPaneFactory.modernUIPaneBuilder() + .prepareForV6(new ScriptContextAdapter() { @Override public void onScriptContextCreated(ScriptContextEvent event) { + // 6.x JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); } }) + .prepareForV7(params -> { + // 7.x + JsObject window = params.frame().executeJavaScript("window"); + if (window != null) { + window.putProperty("PluginHelper", NewUpmBridge.getBridge(window)); + } + return InjectJsCallback.Response.proceed(); + }) .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) .build(); EventDispatcher.listen(DownloadEvent.UPDATE, new Listener() { @@ -47,23 +57,6 @@ public class UpmShowPane extends BasicPane { modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); } }); -// } else { -// modernUIPane = new ModernUIPane.Builder<>() -// .withComponent(WarnComponent.KEY) -// .prepare(new ScriptContextAdapter() { -// @Override -// public void onScriptContextCreated(ScriptContextEvent event) { -// JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); -// window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); -// } -// }).build(); -// EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener() { -// @Override -// public void on(Event event, String param) { -// modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); -// } -// }); -// } add(modernUIPane, BorderLayout.CENTER); } } diff --git a/designer-base/src/main/java/com/fr/design/upm/exec/NewUpmBrowserExecutor.java b/designer-base/src/main/java/com/fr/design/upm/exec/NewUpmBrowserExecutor.java new file mode 100644 index 0000000000..04ab5620f1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/exec/NewUpmBrowserExecutor.java @@ -0,0 +1,30 @@ +package com.fr.design.upm.exec; + +import com.fr.design.bridge.exec.JSExecutor; +import com.teamdev.jxbrowser.js.JsFunction; +import com.teamdev.jxbrowser.js.JsObject; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + */ +public class NewUpmBrowserExecutor implements JSExecutor { + + public static NewUpmBrowserExecutor create(JsObject window, JsFunction callback) { + return new NewUpmBrowserExecutor(window, callback); + } + + private final JsFunction callback; + private final JsObject window; + + private NewUpmBrowserExecutor(JsObject window, JsFunction callback) { + this.window = window; + this.callback = callback; + } + + @Override + public void executor(String newValue) { + callback.invoke(window, newValue); + } +} From 0e7d4a92517a5a81753ceb9bbbe5a4757da86578 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 13 Jul 2021 18:43:32 +0800 Subject: [PATCH 094/100] =?UTF-8?q?REPORT-54410:=20=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=8C=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=BD=E9=AB=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BC=9A=E5=BD=B1=E5=93=8D=E7=BB=9D=E5=AF=B9=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=9D=97=E4=B8=AD=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=BD?= =?UTF-8?q?=E9=AB=98=E5=92=8C=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 自适应布局下的绝对画布块,在缩放内部组件时的时机不对,导致绝对布局计算自己的 缩放比例时,实际计算的是: (currentHeight + GAP / 2) / backupHeight, 然后把这个比例用在了自己的子组件上,导致绝对画布块内部组件的尺寸缩放比例与 外界不一致 【改动思路】 在addCompInterval调用后,此时XWAbsolute.getBounds中年返回的尺寸 是不包含gap的,进行绝对画布块内部组件尺寸调整 --- .../fr/design/designer/creator/XWFitLayout.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 6d7aa5d9ff..896cbe37c5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -780,6 +780,17 @@ public class XWFitLayout extends XLayoutContainer { tabLayout.updateBoundsWidget(); } } + } + layout.setContainerHeight(containerHeight); + layout.setContainerWidth(containerWidth); + addCompInterval(getAcualInterval()); + + // REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置 + // 绝对布局内的组件尺寸调整需要在绝对布局的bound排除GAP后进行,否则计算出的 + // 组件尺寸缩放比例会有问题 + for (int index = 0, n = this.getComponentCount(); index < n; index++) { + XCreator creator = (XCreator) this.getComponent(index); + BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); //如果子组件是绝对布局,则内部的widget也要更新 if (creator.acceptType(XWAbsoluteLayout.class)){ //更新的时候一定要带上backupBound @@ -790,9 +801,6 @@ public class XWFitLayout extends XLayoutContainer { creator.setBackupBound(creator.getBounds()); } } - layout.setContainerHeight(containerHeight); - layout.setContainerWidth(containerWidth); - addCompInterval(getAcualInterval()); } private Rectangle recalculateWidgetBounds(Rectangle rec, int[] hors, int[] veris) { From ce0437869c2a858fa6c05159281eeb0f999767ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 13 Jul 2021 19:00:14 +0800 Subject: [PATCH 095/100] =?UTF-8?q?REPORT-54998=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/grid/GridMouseAdapter.java | 160 ++++++++---------- 1 file changed, 74 insertions(+), 86 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index f09c34b07f..7fb4af3293 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -458,20 +458,15 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous java.awt.Rectangle startRec = cs.toRectangle(); ColumnRow currentMouseCell = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); - if (startRec.contains(currentMouseCell.getColumn(), currentMouseCell.getRow())) { - grid.getDragRectangle().setBounds(startRec); - } else { - if (isOutECBlockPane(evtX, evtY)) { - return; - } - int xDistance = evtX - this.oldEvtX; - int yDistance = evtY - this.oldEvtY; - int dragDirection = calculateDragDirection(xDistance, yDistance); - grid.getDragRectangle().x = calculateDragRectangleX(currentMouseCell, startRec, dragDirection); - grid.getDragRectangle().y = calculateDragRectangleY(currentMouseCell, startRec, dragDirection); - grid.getDragRectangle().width = calculateDragRectangleWidth(currentMouseCell, startRec, dragDirection); - grid.getDragRectangle().height = calculateDragRectangleHeight(currentMouseCell, startRec, dragDirection); + if (isOutECBlockPane(evtX, evtY)) { + return; } + int xDistance = evtX - this.oldEvtX; + int yDistance = evtY - this.oldEvtY; + int dragDirection = calculateDragDirection(xDistance, yDistance); + ColumnRow realCell = calculateRealCell(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().setBounds(calculateDragRectangle(realCell, startRec, dragDirection)); + reportPane.ensureColumnRowVisible(currentMouseCell.getColumn() + 1, currentMouseCell.getRow() + 1); } @@ -491,97 +486,90 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } } - private int calculateDragRectangleX(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - int result = 0; + /** + * 计算当前十字标所在格子对应的真正参与计算拖拽边框的格子 + * @param currentMouseCell 当前鼠标所在的格子 + * @param startRec 起始格子 + * @param direction 拖拽方向 + * @return 当前十字标所在格子对应的真正参与计算拖拽边框的格子 + */ + private ColumnRow calculateRealCell(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + ColumnRow realCell; switch(direction) { case DIRECTION_DOWN: case DIRECTION_UP: - case DIRECTION_RIGHT: - result = startRec.x; + realCell = ColumnRow.valueOf(startRec.x, currentMouseCell.row); break; - case DIRECTION_LEFT: - if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { - result = startRec.x; - } else { - result = currentMouseCell.getColumn(); - } - break; - } - return result; - } - - private int calculateDragRectangleY(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - int result = 0; - switch(direction) { case DIRECTION_RIGHT: case DIRECTION_LEFT: - case DIRECTION_DOWN: - result = startRec.y; + realCell = ColumnRow.valueOf(currentMouseCell.column, startRec.y); break; - case DIRECTION_UP: - if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { - result = startRec.y; - } else { - result = currentMouseCell.getRow(); - } + default: + realCell = currentMouseCell; break; } - return result; + return realCell; } - private int calculateDragRectangleWidth(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - int result = 0; - switch(direction) { - case DIRECTION_DOWN: - case DIRECTION_UP: - result = startRec.width; - break; - case DIRECTION_RIGHT: - result = currentMouseCell.getColumn() - startRec.x + 1; - break; - case DIRECTION_LEFT: - if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { - result = startRec.width; - } else { - result = startRec.x - currentMouseCell.getColumn() + startRec.width; - } - break; + /** + * 计算拖拽的边框 + * @param realCell 当前十字标所在格子对应的真正参与计算拖拽边框的格子 + * @param startRec 起始格子 + * @param direction 拖拽方向 + * @return 拖拽的边框 + */ + private Rectangle calculateDragRectangle(ColumnRow realCell, Rectangle startRec, int direction) { + Rectangle rectangle = new Rectangle(); + if (startRec.contains(realCell.column, realCell.row)) { + rectangle.setBounds(startRec); + } else { + boolean clockWise = isClockWise(direction); + int x, y, width, height; + if (clockWise) { + x = startRec.x; + y = startRec.y; + width = Math.abs(realCell.column - startRec.x) + 1; // 加一是因为计算顺时针边框宽度或者高度的时候,没把realCell自身高度算进去 + height = Math.abs(realCell.row - startRec.y) + 1; + } else { + x = realCell.column; + y = realCell.row; + width = Math.abs(realCell.column - startRec.x) + startRec.width; + height = Math.abs(realCell.row - startRec.y) + startRec.height; + } + + // 上面的只计算了顺时针和逆时针的width,height,但是还要顺时针里面还要区分从左往右和从上往下,这里是用于修正 + boolean isHorizontal = isHorizontal(direction); + if (isHorizontal) { + height = startRec.height; // 水平方向,绘制的边框肯定就等于起始格子的高度 + } else { + width = startRec.width; // 垂直方向,绘制的边框肯定就等于起始给子的宽度 + } + rectangle.setBounds(x, y, width, height); } - return result; + return rectangle; } - private int calculateDragRectangleHeight(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - int result = 0; - switch(direction) { - case DIRECTION_DOWN: - result = currentMouseCell.getRow() - startRec.y + 1; - break; - case DIRECTION_UP: - if (isInsideSelectedCell(currentMouseCell, startRec, direction)) { - result = startRec.y - currentMouseCell.getRow() + startRec.height; - } else { - result = startRec.height; - } - break; - case DIRECTION_RIGHT: - case DIRECTION_LEFT: - result = startRec.height; - break; - } - return result; + /** + * 判断拖拽方向是否是顺时针 从左往右,从上往下为顺时针,从右往左,从下往上为逆时针 + * @param direction 方向 + * @return 是否是顺时针 + */ + private boolean isClockWise(int direction) { + return direction == DIRECTION_DOWN || direction == DIRECTION_RIGHT; } - private boolean isOutECBlockPane(int evtX, int evtY) { - ElementCasePane reportPane = grid.getElementCasePane(); - if (reportPane instanceof ECBlockPane) { - return (evtY > reportPane.getBounds().height - ECBlockGap) || (evtX > reportPane.getBounds().width - ECBlockGap); - } - return true; + /** + * 判断拖拽方向是否为水平还是垂直 + * @param direction 方向 + * @return 是否为水平 + */ + private boolean isHorizontal(int direction) { + return direction == DIRECTION_RIGHT || direction == DIRECTION_LEFT; } - private boolean isInsideSelectedCell(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - return (direction == DIRECTION_UP && currentMouseCell.getRow() >= startRec.y && currentMouseCell.getRow() < startRec.y + startRec.height) || - (direction == DIRECTION_LEFT && currentMouseCell.getColumn() >= startRec.x && currentMouseCell.getColumn() < startRec.x + startRec.width); + private boolean isOutECBlockPane(int evtX, int evtY) { + ElementCasePane reportPane = grid.getElementCasePane(); + return reportPane instanceof ECBlockPane && ((evtY > reportPane.getBounds().height - ECBlockGap) || (evtX > reportPane.getBounds().width - ECBlockGap)); } private void doShiftSelectCell(double evtX, double evtY) { From f8b37438f976ed040b0d3bc153f1fba3a75cbf7f Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 13 Jul 2021 19:44:02 +0800 Subject: [PATCH 096/100] =?UTF-8?q?KERNEL-7634=20mac=E5=92=8Cwin=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E4=B8=8D=E5=90=8C=E7=89=88=E6=9C=AC=E7=9A=84jxbrowser?= =?UTF-8?q?=20fix=20=E7=99=BB=E5=BD=95=E5=90=8D=E8=8E=B7=E5=8F=96=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/upm/NewUpmBridge.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java index a69871e7a9..6b9f1f85fc 100644 --- a/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java @@ -1,7 +1,7 @@ package com.fr.design.upm; -import com.fr.config.MarketConfig; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; +import com.fr.design.DesignerEnvManager; import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginOperateUtils; @@ -411,7 +411,7 @@ public class NewUpmBridge extends UpmBridge { @JsAccessible public String getLoginInfo(final JsFunction callback) { registerLoginInfo(callback); - return MarketConfig.getInstance().getBbsUsername(); + return DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); } /** @@ -423,7 +423,7 @@ public class NewUpmBridge extends UpmBridge { @JsAccessible public void registerLoginInfo(final JsFunction callback) { JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)); - String username = MarketConfig.getInstance().getBbsUsername(); + String username = DesignerEnvManager.getEnvManager().getDesignerLoginUsername(); if (StringUtils.isEmpty(username)) { jsCallback.execute(StringUtils.EMPTY); EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY); From 34fd37a8780a2e4e82699bf5abec54a4a520de37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 13 Jul 2021 19:59:30 +0800 Subject: [PATCH 097/100] =?UTF-8?q?REPORT-54998=20=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/grid/GridMouseAdapter.java | 78 +++++-------------- 1 file changed, 19 insertions(+), 59 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 7fb4af3293..b0f8fff467 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -464,8 +464,8 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous int xDistance = evtX - this.oldEvtX; int yDistance = evtY - this.oldEvtY; int dragDirection = calculateDragDirection(xDistance, yDistance); - ColumnRow realCell = calculateRealCell(currentMouseCell, startRec, dragDirection); - grid.getDragRectangle().setBounds(calculateDragRectangle(realCell, startRec, dragDirection)); + Rectangle endRec = calculateEndRec(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().setBounds(calculateDragRectangle(startRec, endRec)); reportPane.ensureColumnRowVisible(currentMouseCell.getColumn() + 1, currentMouseCell.getRow() + 1); } @@ -487,86 +487,46 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } /** - * 计算当前十字标所在格子对应的真正参与计算拖拽边框的格子 + * 计算拖拽的结尾矩形 * @param currentMouseCell 当前鼠标所在的格子 * @param startRec 起始格子 * @param direction 拖拽方向 - * @return 当前十字标所在格子对应的真正参与计算拖拽边框的格子 + * @return 计算拖拽的结尾矩形 */ - private ColumnRow calculateRealCell(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - ColumnRow realCell; + private Rectangle calculateEndRec(ColumnRow currentMouseCell, Rectangle startRec, int direction) { + Rectangle rec; switch(direction) { case DIRECTION_DOWN: case DIRECTION_UP: - realCell = ColumnRow.valueOf(startRec.x, currentMouseCell.row); + rec = new Rectangle(startRec.x, currentMouseCell.row, 1, 1); break; case DIRECTION_RIGHT: case DIRECTION_LEFT: - realCell = ColumnRow.valueOf(currentMouseCell.column, startRec.y); + rec = new Rectangle(currentMouseCell.column, startRec.y, 1, 1); break; default: - realCell = currentMouseCell; + rec = new Rectangle(); break; } - return realCell; + return rec; } /** - * 计算拖拽的边框 - * @param realCell 当前十字标所在格子对应的真正参与计算拖拽边框的格子 - * @param startRec 起始格子 - * @param direction 拖拽方向 + * 计算拖拽的边框,传俩矩形确认出一个大矩形,就是所要的结果 + * @param startRec 起始格子矩形 + * @param endRec 结尾格子矩形 * @return 拖拽的边框 */ - private Rectangle calculateDragRectangle(ColumnRow realCell, Rectangle startRec, int direction) { + private Rectangle calculateDragRectangle(Rectangle startRec, Rectangle endRec) { Rectangle rectangle = new Rectangle(); - if (startRec.contains(realCell.column, realCell.row)) { - rectangle.setBounds(startRec); - } else { - boolean clockWise = isClockWise(direction); - int x, y, width, height; - if (clockWise) { - x = startRec.x; - y = startRec.y; - width = Math.abs(realCell.column - startRec.x) + 1; // 加一是因为计算顺时针边框宽度或者高度的时候,没把realCell自身高度算进去 - height = Math.abs(realCell.row - startRec.y) + 1; - } else { - x = realCell.column; - y = realCell.row; - width = Math.abs(realCell.column - startRec.x) + startRec.width; - height = Math.abs(realCell.row - startRec.y) + startRec.height; - } - - // 上面的只计算了顺时针和逆时针的width,height,但是还要顺时针里面还要区分从左往右和从上往下,这里是用于修正 - boolean isHorizontal = isHorizontal(direction); - if (isHorizontal) { - height = startRec.height; // 水平方向,绘制的边框肯定就等于起始格子的高度 - } else { - width = startRec.width; // 垂直方向,绘制的边框肯定就等于起始给子的宽度 - } - rectangle.setBounds(x, y, width, height); - } + int x = Math.min(startRec.x, endRec.x); + int y = Math.min(startRec.y, endRec.y); + int rightBottomX = Math.max(startRec.x + startRec.width, endRec.x + endRec.width); + int rightBottomY = Math.max(startRec.y + startRec.height, endRec.y + endRec.height); + rectangle.setBounds(x, y, rightBottomX - x, rightBottomY - y); return rectangle; } - /** - * 判断拖拽方向是否是顺时针 从左往右,从上往下为顺时针,从右往左,从下往上为逆时针 - * @param direction 方向 - * @return 是否是顺时针 - */ - private boolean isClockWise(int direction) { - return direction == DIRECTION_DOWN || direction == DIRECTION_RIGHT; - } - - /** - * 判断拖拽方向是否为水平还是垂直 - * @param direction 方向 - * @return 是否为水平 - */ - private boolean isHorizontal(int direction) { - return direction == DIRECTION_RIGHT || direction == DIRECTION_LEFT; - } - private boolean isOutECBlockPane(int evtX, int evtY) { ElementCasePane reportPane = grid.getElementCasePane(); return reportPane instanceof ECBlockPane && ((evtY > reportPane.getBounds().height - ECBlockGap) || (evtX > reportPane.getBounds().width - ECBlockGap)); From bdad7f09e27485894ce414b1444d6a7eab1dbf56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 13 Jul 2021 20:15:42 +0800 Subject: [PATCH 098/100] =?UTF-8?q?REPORT-54998=20=E8=BF=9B=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=85=B7=E4=BD=93=E7=9A=84=E6=96=B9=E5=90=91=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=8F=AA=E7=95=99=E6=B0=B4=E5=B9=B3=E6=88=96?= =?UTF-8?q?=E8=80=85=E5=9E=82=E7=9B=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/grid/GridMouseAdapter.java | 44 +++++-------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index b0f8fff467..0a6ba50421 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -463,52 +463,30 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } int xDistance = evtX - this.oldEvtX; int yDistance = evtY - this.oldEvtY; - int dragDirection = calculateDragDirection(xDistance, yDistance); - Rectangle endRec = calculateEndRec(currentMouseCell, startRec, dragDirection); + boolean isHorizontal = isHorizontal(xDistance, yDistance); + Rectangle endRec = calculateEndRec(currentMouseCell, startRec, isHorizontal); grid.getDragRectangle().setBounds(calculateDragRectangle(startRec, endRec)); reportPane.ensureColumnRowVisible(currentMouseCell.getColumn() + 1, currentMouseCell.getRow() + 1); } - private int calculateDragDirection(int xDistance, int yDistance) { - if (Math.abs(yDistance) > Math.abs(xDistance)) { - if (yDistance >= 0) { - return DIRECTION_DOWN; - } else { - return DIRECTION_UP; - } - } else { - if (xDistance >= 0) { - return DIRECTION_RIGHT; - } else { - return DIRECTION_LEFT; - } - } + private boolean isHorizontal(int xDistance, int yDistance) { + return Math.abs(yDistance) <= Math.abs(xDistance); } /** * 计算拖拽的结尾矩形 * @param currentMouseCell 当前鼠标所在的格子 * @param startRec 起始格子 - * @param direction 拖拽方向 + * @param isHorizontal 拖拽方向 水平or垂直 * @return 计算拖拽的结尾矩形 */ - private Rectangle calculateEndRec(ColumnRow currentMouseCell, Rectangle startRec, int direction) { - Rectangle rec; - switch(direction) { - case DIRECTION_DOWN: - case DIRECTION_UP: - rec = new Rectangle(startRec.x, currentMouseCell.row, 1, 1); - break; - case DIRECTION_RIGHT: - case DIRECTION_LEFT: - rec = new Rectangle(currentMouseCell.column, startRec.y, 1, 1); - break; - default: - rec = new Rectangle(); - break; - } - return rec; + private Rectangle calculateEndRec(ColumnRow currentMouseCell, Rectangle startRec, boolean isHorizontal) { + if (isHorizontal) { + return new Rectangle(currentMouseCell.column, startRec.y, 1, 1); + } else { + return new Rectangle(startRec.x, currentMouseCell.row, 1, 1); + } } /** From b3ca4897870e1e88e3bedfc3491458209ba5aab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 13 Jul 2021 20:16:29 +0800 Subject: [PATCH 099/100] =?UTF-8?q?REPORT-54998=20=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E7=9A=84=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/GridMouseAdapter.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index 0a6ba50421..dfd7f29fd5 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -46,10 +46,6 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private static final int TOOLTIP_X_Y_FIX = 4; private static final double COPY_CROSS_INNER_DISTANCE = 1.5; private static final double COPY_CROSS_OUTER_DISTANCE = 2.5; - private static final int DIRECTION_UP = 1; - private static final int DIRECTION_DOWN = 2; - private static final int DIRECTION_LEFT = 3; - private static final int DIRECTION_RIGHT = 4; /** * 拖拽时候刷新时间间隔 */ From 0e019e3742ee4fab08b8e9541a5d4430ba2890e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 14 Jul 2021 13:42:33 +0800 Subject: [PATCH 100/100] =?UTF-8?q?CHART-19757=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=A2=9E=E5=8A=A0=E5=90=8D=E7=A7=B0=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FormWidgetCardPane.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 3b9ee9ab4b..a5189e66f6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -19,6 +19,7 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; @@ -31,12 +32,12 @@ import com.fr.design.widget.Operator; import com.fr.design.widget.ui.designer.component.WidgetAbsoluteBoundPane; import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.design.widget.ui.designer.component.WidgetCardTagBoundPane; +import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.ComparatorUtils; - import com.fr.general.IOUtils; import com.fr.stable.StringUtils; @@ -229,17 +230,26 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { public void updateCreator() { currentEditorDefinePane.setGlobalName(getGlobalName()); Widget widget = currentEditorDefinePane.updateBean(); - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")) && widgetPropertyPane != null) { + if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_Basic")) && widgetPropertyPane != null) { UITextField widgetNameField = widgetPropertyPane.getWidgetNameField(); String toSetWidgetName = widgetNameField.getText(); String currentWidgetName = widget.getWidgetName(); - boolean exist = designer.getTarget().isNameExist(toSetWidgetName, widget) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); if (toSetWidgetName.isEmpty()) { widgetNameField.setText(currentWidgetName); return; - } else if (exist) { + } + + boolean exist = designer.getTarget().isNameExist(toSetWidgetName, widget) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); + if (exist) { widgetNameField.setText(currentWidgetName); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); + showNameInvalidDialog(Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure")); + return; + } + + //图表名称的合法性检查 + if (widget instanceof ChartEditor && toSetWidgetName.startsWith("Chart")) { + widgetNameField.setText(currentWidgetName); + showNameInvalidDialog(Toolkit.i18nText("Fine-Design_Form_Chart_Widget_Rename_Failure")); return; } widgetPropertyPane.update(widget); @@ -252,6 +262,10 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { fireValueChanged(); } + private void showNameInvalidDialog(String message) { + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), message, Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); + } + public void updateWidgetBound() { if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"))) { widgetBoundPane.update();